[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v4 6/6] arm/mpu: Map domain page in AArch64 MPU systems
- To: Harry Ramsey <harry.ramsey@xxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>
- From: "Halder, Ayan Kumar" <ayankuma@xxxxxxx>
- Date: Wed, 14 Jan 2026 15:55:27 +0000
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=arm.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
- 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=1CnlhtRyB3A1U7H1J3lVb0lcSHBAMx5OHvUHpMWtq3I=; b=Ynttu8Utd9DiLbm235LNyPfJLSqMpbVAwRdjny1PePc2HtpmwLHHz8fpmnBMZP9bv2iB2rm7zDW9ymJ5HEVW/2fKNJS3ThNpQDYVJIVpD/NuCMUzSJk3MMobPr0Eieg9TWpNtuw4N0kMyeYOm2c1Ir0LBQNYe8ilo0mI7ED14vHTtNU1R1SkNk7S86WnK8thVmgusslpTl2RlijsoUcIRXPEadYQPOThPe3l9pyhSjBnxMjQmDg49hEjpKRM7YN7BhOSxYmi2LCrPNnIKzZpK9zYxTOe7roZCbACTIgkw81HAD951j2xMrqLDSxdvTP4jXplBLjl6tfBkfFjd4d7xQ==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=WkDp0Ulu0YElK+9fRp4ujMWFvtvgeuI9cC6bsJU/6C4sWmtMBK2BgdH71i2ewm+VdV88mrrY6yQHzwNp9oySRtXeZhVO2jQsoDzhkubP/bamd3fZ2OrNSw9z1Y90kbCpIcq0EIZw9PnJ3XMa9vOX2MJqxwexh+AAvHOIpyWGxCVmPzvrNZHhd5uwr5blPMKW1Wr+nttJMDZb6ayBf764EVxxGo871QffvLpkVeOyk37wHrXRfOO8/TaWrloiquflXDz0sEoemEpz8VR5mUQi03MnJU+0+q1hRgBnQ2HErUw9Ss/nmwglcAWJ7WuLJOmULYVu6MlMAuB5s9xbbZ4N1w==
- Cc: <Luca.Fancellu@xxxxxxx>, Penny Zheng <Penny.Zheng@xxxxxxx>, "Stefano Stabellini" <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, "Bertrand Marquis" <bertrand.marquis@xxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Wei Chen <wei.chen@xxxxxxx>
- Delivery-date: Wed, 14 Jan 2026 15:55:56 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
Hi Harry,
Can we expand this to cover Arm32 as well ? I did some test and both
Arm32 and Arm64 get to the same point.
On 14/01/2026 14:27, Harry Ramsey wrote:
From: Penny Zheng <Penny.Zheng@xxxxxxx>
In MPU systems, we implement map_domain_page()/unmap_domain_page()
through mapping the domain page with a MPU region on demand.
Signed-off-by: Penny Zheng <penny.zheng@xxxxxxx>
Signed-off-by: Wei Chen <wei.chen@xxxxxxx>
Signed-off-by: Luca Fancellu <luca.fancellu@xxxxxxx>
Signed-off-by: Harry Ramsey <harry.ramsey@xxxxxxx>
---
v4:
- Remove duplicate code by having `map_domain_page` and
`unmap_domain_page` use `vmap_contig` and `vunmap`
v3:
- No changes
v2:
- No changes
---
xen/arch/arm/Kconfig | 1 +
xen/arch/arm/mpu/Makefile | 1 +
xen/arch/arm/mpu/domain-page.c | 46 ++++++++++++++++++++++++++++++++++
3 files changed, 48 insertions(+)
create mode 100644 xen/arch/arm/mpu/domain-page.c
diff --git a/xen/arch/arm/Kconfig b/xen/arch/arm/Kconfig
index cf6af68299..baa6c4cf15 100644
--- a/xen/arch/arm/Kconfig
+++ b/xen/arch/arm/Kconfig
@@ -91,6 +91,7 @@ config MMU
config MPU
bool "MPU" if UNSUPPORTED
+ select ARCH_MAP_DOMAIN_PAGE if ARM_64
Remove ARM_64
select STATIC_MEMORY
help
Memory Protection Unit (MPU). Select if you plan to run Xen on ARMv8-R
diff --git a/xen/arch/arm/mpu/Makefile b/xen/arch/arm/mpu/Makefile
index 4963c8b550..940297af3f 100644
--- a/xen/arch/arm/mpu/Makefile
+++ b/xen/arch/arm/mpu/Makefile
@@ -1,5 +1,6 @@
obj-$(CONFIG_ARM_32) += arm32/
obj-$(CONFIG_ARM_64) += arm64/
+obj-$(CONFIG_ARM_64) += domain-page.o
obj-y += domain-page.o
obj-y += mm.o
obj-y += p2m.o
obj-y += setup.init.o
diff --git a/xen/arch/arm/mpu/domain-page.c b/xen/arch/arm/mpu/domain-page.c
new file mode 100644
index 0000000000..b79afc493b
--- /dev/null
+++ b/xen/arch/arm/mpu/domain-page.c
@@ -0,0 +1,46 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#include <xen/bug.h>
+#include <xen/domain_page.h>
+#include <xen/mm.h>
+#include <xen/mm-frame.h>
+#include <xen/types.h>
+#include <xen/vmap.h>
+
+void *map_domain_page_global(mfn_t mfn)
+{
+ BUG_ON("unimplemented");
+ return NULL;
+}
+
+/* Map a page of domheap memory */
+void *map_domain_page(mfn_t mfn)
+{
+ return vmap_contig(mfn, 1);
+}
+
+/* Release a mapping taken with map_domain_page() */
+void unmap_domain_page(const void *ptr)
+{
+ vunmap(ptr);
+}
+
+mfn_t domain_page_map_to_mfn(const void *ptr)
+{
+ BUG_ON("unimplemented");
+ return INVALID_MFN;
+}
+
+void unmap_domain_page_global(const void *va)
+{
+ BUG_ON("unimplemented");
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
The rest LGTM.
With this, one can see R52 booting to the same level as R82.
(XEN) load tracking window length 1073741824 ns
(XEN) Allocated console ring of 16 KiB.
(XEN) VFP implementer 0x41 architecture 3 part 0x40 variant 0x2 rev 0x3
(XEN) CPU0: Guest atomics will try 1 times before pausing the domain
(XEN) Brought up 1 CPUs
(XEN) Xen BUG at arch/arm/arm32/mpu/p2m.c:9
- Ayan
|