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 --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);
+}
--
2.25.1
Hi Ayan, On 04/02/2025 19:23, Ayan Kumar Halder wrote: > Similar to "xen/arm: mpu: Define Xen start address for MPU systems", added Can you provide the commit ID? Also, we tend to use present for describing changes, so s/added/add/ > 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 --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); > +} I think it would be better if we create an arm/mpu/mm.c which would contain any common code/requirements between arm64 and arm32 (I assume there will be quire a few). Cheers, -- Julien Grall
Hi Ayan, > On 4 Feb 2025, at 19:23, Ayan Kumar Halder <ayan.kumar.halder@amd.com> wrote: > > 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> This looks ok to me and in line with what is done for arm64. Reviewed-by: Luca Fancellu <luca.fancellu@arm.com>
© 2016 - 2025 Red Hat, Inc.