[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v3 1/6] arm/mpu: Find MPU region by range
- To: "Orzel, Michal" <michal.orzel@xxxxxxx>
- From: Hari Limaye <Hari.Limaye@xxxxxxx>
- Date: Tue, 15 Jul 2025 08:36:30 +0000
- Accept-language: en-US
- Arc-authentication-results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 4.158.2.129) smtp.rcpttodomain=amd.com smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=arm.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=arm.com] dkim=[1,1,header.d=arm.com] dmarc=[1,1,header.from=arm.com])
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none
- Arc-message-signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=JendjDDkuEWu4SrqeNccVu+FdyDtlmhYuOpOgaCGv2s=; b=Hc9LeDFK/N7e4HYGbidRbOn9/YhKcTsdYBs4iEQY2Z00gLnmjJwp7aOIUMihdrUhMa3/D2KAeNZ4yj67E+QL3XLIx88QSmpXMuBAL3JZIFxQPj0ZKWHlCd3WGTUBvVXXQ5B4zBnZnKu79pmd/exqDfYEjxSDN2Hz0MHwTEUzlGdIW6TjVcJ3H6v8sCqjQenFECbfdBF9KrRfCEFfYQZF5dqo+vkdWkfx3LcQBf8BbLPnen2njIW91E7CatL+xb9GJW8g5Eo8Ai3WMu5y9WWYoAo5bIslbI4ZTdXxsB7+QEiQ+hBK3VVIpYxSKY0+/+kKCppjFuioJWx2IyYtoK3Efw==
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=JendjDDkuEWu4SrqeNccVu+FdyDtlmhYuOpOgaCGv2s=; b=SkK6mnvBqrjU3VhPTNMFbYmSb9qIbzmiOf3WgGXtbmdVe72l+djwq6OGlJYN6Gh3uOl8OhUE0PKV7roO/xN/opT9Dn8Nw6DU3108kqIV4dzDL3typkgzektS1UjjHjQPmpt7+1G9MoLjdM01F+tuMJ+bcfEHYe2gh7er4RJDmNR4T+Fpz+MNPPGbUFJ9zE5xuFwX2nlGrjSdYGTbcHhf3I9cm/ly1j3L06z4HCmOFFyZTgKyCwW8EJ/FWFFdm2IpuPXhCY0gUqGI0q/qnwN8EV5yNkTVnPYelo/MsJNX7NZBuLK2v0BD5V6jqQJw9YTxUjxBadgqi3NNFWDylRUtGQ==
- Arc-seal: i=2; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=pass; b=pdl8EJSs1E/aiEXlX6Pcb+dTjSCrKQoXRoSvDl8HVvNKLVRnzRzQ4IttwS0d7sk6fNjZOiWMLZqg/k/Md+NjgxspGDZQzOGGXRJCy042R8pZP7VR8009y3cyfR6uoNnw5sVyk4EV77q5MM53kjDpAEDRXMJBpz/2aSbRaQ1/9j5lJM7G2sqnONDVJSaUfdhqS/05tjVwusgTlbziPvct1EIlQHxi/5VoO8Ql7xSWZDr6DTkoUjiUH+vsT/L5U8XBCF41Sr6aQfkTv6NSh2qYB7BIsQ50DuQ4mcC32lDLQMbisUfPEVnF1A/Spl2lGcQd4K7rcNHzsCl+DPoWF9aktw==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=xCAwofDkI/e3WLLe6bo0A+DLz5GG9OVLalTEqsaSOK/ctocPOC+scdqO7xV/GaRY29M60Y7mpuwOn0pBVKrGUGQycFUsl4XDtNavsXIqCue0uv5l2TW9WxJuy1kG2tErFmSXUd+l+1wkOtIyKfrL4HiJASkfKn7xvPmkDGvLNR24DDXqNzUSYrW5QSKmsOnPO5NzoeEl1SeeL6qf9fN+kuAy4GnwmpYnq0m1Sl2S+ZB9Nkcu92EHwpK8npSgoMpQoGCB9L2YUZAoE6FVcBLmw57w7s/Sl6KWkKFdZayPrb68V9JAjKGxS0jlcEomnbCSWSGVaaHVZYPnM+2aMBKs4A==
- Authentication-results-original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
- Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Luca Fancellu <Luca.Fancellu@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <Bertrand.Marquis@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
- Delivery-date: Tue, 15 Jul 2025 08:37:21 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
- Nodisclaimer: true
- Thread-index: AQHb9V+06nIKaACf9UqCxt0klN23X7Qy3E8A
- Thread-topic: [PATCH v3 1/6] arm/mpu: Find MPU region by range
Hi Michal,
>> +int mpumap_contains_region(pr_t *table, uint8_t nr_regions, paddr_t base,
>> + paddr_t limit, uint8_t *index)
>> +{
>> + ASSERT(index);
>> + *index = INVALID_REGION_IDX;
>> +
>> + /*
>> + * The caller supplies a half-open interval [base, limit), i.e. limit
>> is the
>> + * first byte *after* the region. Require limit strictly greater than
>> base,
>> + * which is necessarily a non-empty region.
>> + */
>> + ASSERT(base < limit);
> Well, that does not guarantee a non-empty region.
> Consider passing [x, x+1). The assert will pass, even though the region is
> empty.
>
> ~Michal
>
Apologies, I may well be missing something here! Please could you suggest a
code snippet to understand your expectation here / what you would prefer the
assert to be?
As I understand it, with a half-open interval [base, limit) as is passed to
this function, the size is `limit - base` and so the region [x, x+1) will have
size 1. The empty region starting at the same address would be [x, x). But
perhaps I am making the off-by-one error here.
Many thanks,
Hari
|