diff mbox series

[1/5] xen/arm: mpu: Ensure that the page size is 4KB (arm32)

Message ID 20250204192357.1862264-2-ayan.kumar.halder@amd.com (mailing list archive)
State New
Headers show
Series Enable early bootup of AArch32 MPU systems | expand

Commit Message

Ayan Kumar Halder Feb. 4, 2025, 7:23 p.m. UTC
Similar to "xen/arm: mpu: Define Xen start address for MPU systems", added
a build assertion to ensure that the page size is 4KB.

Signed-off-by: Ayan Kumar Halder <ayan.kumar.halder@amd.com>
---
 xen/arch/arm/arm32/Makefile     |  1 +
 xen/arch/arm/arm32/mpu/Makefile |  1 +
 xen/arch/arm/arm32/mpu/mm.c     | 15 +++++++++++++++
 3 files changed, 17 insertions(+)
 create mode 100644 xen/arch/arm/arm32/mpu/Makefile
 create mode 100644 xen/arch/arm/arm32/mpu/mm.c
diff mbox series

Patch

diff --git a/xen/arch/arm/arm32/Makefile b/xen/arch/arm/arm32/Makefile
index 40a2b4803f..537969d753 100644
--- a/xen/arch/arm/arm32/Makefile
+++ b/xen/arch/arm/arm32/Makefile
@@ -1,5 +1,6 @@ 
 obj-y += lib/
 obj-$(CONFIG_MMU) += mmu/
+obj-$(CONFIG_MPU) += mpu/
 
 obj-$(CONFIG_EARLY_PRINTK) += debug.o
 obj-y += domctl.o
diff --git a/xen/arch/arm/arm32/mpu/Makefile b/xen/arch/arm/arm32/mpu/Makefile
new file mode 100644
index 0000000000..b18cec4836
--- /dev/null
+++ b/xen/arch/arm/arm32/mpu/Makefile
@@ -0,0 +1 @@ 
+obj-y += mm.o
diff --git a/xen/arch/arm/arm32/mpu/mm.c b/xen/arch/arm/arm32/mpu/mm.c
new file mode 100644
index 0000000000..0b8748e575
--- /dev/null
+++ b/xen/arch/arm/arm32/mpu/mm.c
@@ -0,0 +1,15 @@ 
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#include <xen/lib.h>
+#include <xen/init.h>
+#include <xen/sizes.h>
+
+static void __init __maybe_unused build_assertions(void)
+{
+    /*
+     * Unlike MMU, MPU does not use pages for translation. However, we continue
+     * to use PAGE_SIZE to denote 4KB. This is so that the existing memory
+     * management based on pages, continue to work for now.
+     */
+    BUILD_BUG_ON(PAGE_SIZE != SZ_4K);
+}