Skip to contentSkip to conversation

R52 MPU support (for "Third series for R82 MPU")

PATCH In review Ayan Kumar Halder 3 participants 7 messages Aug 14, 2025 – Aug 21, 2025

lore
Share & tools
lore
#0 lore raw

v2 cover R52 MPU support (for "Third series for R82 MPU")

Hi all,

This series is related to
"[PATCH 0/5] Third series for R82 MPU support". There is no build dependency between the two series.

At the end of these 2 series, R82 and R52 boot till the same point (approximately).

Kind regards,
Ayan

Ayan Kumar Halder (2):
arm/mpu: Enable is_xen_heap_page and is_xen_heap_mfn for ARM_32 arm/mpu: Disable map_domain_page for MPU

 xen/arch/arm/Kconfig              |  2 +-
 xen/arch/arm/include/asm/mm.h     |  2 +-
 xen/arch/arm/include/asm/mpu/mm.h |  5 ----
 xen/arch/arm/mpu/Makefile         |  1 -
 xen/arch/arm/mpu/domain-page.c    | 45 -------------------------------
 5 files changed, 2 insertions(+), 53 deletions(-)
 delete mode 100644 xen/arch/arm/mpu/domain-page.c
Signature · 1 line
2.25.1
#1 lore raw

PATCH v2 1/2 arm/mpu: Enable is_xen_heap_page and is_xen_heap_mfn for ARM_32

In case of ARM_32, all of the RAM will be covered by a permanent contiguous mapping (where VA == PA) and there will be a single heap. Thus, the memory allocated from Xen heap uses PGC_xen_heap.
This is similar to the scenario described for "CONFIG_SEPARATE_XENHEAP=n W/ DIRECT MAP OF ALL RAM" in common/page_alloc.c.

---
Changes from :-

v1 - 1. Enable is_xen_heap_page() and is_xen_heap_mfn() definitions for ARM_64 or MPU (fixed a build break).

 xen/arch/arm/include/asm/mm.h     | 2 +-
 xen/arch/arm/include/asm/mpu/mm.h | 5 -----
 2 files changed, 1 insertion(+), 6 deletions(-)
xen/arch/arm/include/asm/mm.h +1 -1
index fb79aeb088..7a93dad2ed 100644
@@ -170,7 +170,7 @@ struct page_info
 #define _PGC_need_scrub   _PGC_allocated
 #define PGC_need_scrub    PGC_allocated
 
-#ifdef CONFIG_ARM_64
+#if defined(CONFIG_ARM_64) || defined(CONFIG_MPU)
 #define is_xen_heap_page(page) ((page)->count_info & PGC_xen_heap)
 #define is_xen_heap_mfn(mfn) \
     (mfn_valid(mfn) && is_xen_heap_page(mfn_to_page(mfn)))
xen/arch/arm/include/asm/mpu/mm.h +0 -5
index c32fac8905..e1ded6521d 100644
@@ -27,11 +27,6 @@ extern pr_t xen_mpumap[MAX_MPU_REGION_NR];
 
 #define virt_to_maddr(va) ((paddr_t)((vaddr_t)(va) & PADDR_MASK))
 
-#ifdef CONFIG_ARM_32
-#define is_xen_heap_page(page) ({ BUG_ON("unimplemented"); false; })
-#define is_xen_heap_mfn(mfn) ({ BUG_ON("unimplemented"); false; })
-#endif
-
 /* On MPU systems there is no translation, ma == va. */
 static inline void *maddr_to_virt(paddr_t ma)
 {
Signature · 1 line
2.25.1
Reviewed-by Tested-by on v2 1/2
#2 lore raw

Re: [PATCH v2 1/2] arm/mpu: Enable is_xen_heap_page and is_xen_heap_mfn for ARM_32

Hi Ayan,

Quoted 7 lines · Ayan Kumar Halder

In case of ARM_32, all of the RAM will be covered by a permanent contiguous mapping (where VA == PA) and there will be a single heap. Thus, the memory allocated from Xen heap uses PGC_xen_heap.
This is similar to the scenario described for "CONFIG_SEPARATE_XENHEAP=n W/ DIRECT MAP OF ALL RAM" in common/page_alloc.c.

LGTM now, thanks for updating. Tested (build-only) on AArch32 and AArch64 MMU and MPU systems.

Cheers,
Hari

Reviewed-by on v2 1/2
#3 lore raw

Re: [PATCH v2 1/2] arm/mpu: Enable is_xen_heap_page and is_xen_heap_mfn for ARM_32

In reply to Ayan Kumar Halder
Quoted 7 lines · Ayan Kumar Halder

In case of ARM_32, all of the RAM will be covered by a permanent contiguous mapping (where VA == PA) and there will be a single heap. Thus, the memory allocated from Xen heap uses PGC_xen_heap.
This is similar to the scenario described for "CONFIG_SEPARATE_XENHEAP=n W/ DIRECT MAP OF ALL RAM" in common/page_alloc.c.

~Michal

#4 lore raw

PATCH v2 2/2 arm/mpu: Disable map_domain_page for MPU

In reply to Ayan Kumar Halder

There is no domheap for ARM_32. All of the RAM is mapped and VA == PA.

---
Changes from :-

v1 - 1. No changes.

 xen/arch/arm/Kconfig           |  2 +-
 xen/arch/arm/mpu/Makefile      |  1 -
 xen/arch/arm/mpu/domain-page.c | 45 ----------------------------------
 3 files changed, 1 insertion(+), 47 deletions(-)
 delete mode 100644 xen/arch/arm/mpu/domain-page.c
xen/arch/arm/Kconfig +1 -1
index a0c8160474..5355534f3d 100644
@@ -1,7 +1,7 @@
 config ARM_32
 	def_bool y
 	depends on "$(ARCH)" = "arm32"
-	select ARCH_MAP_DOMAIN_PAGE
+	select ARCH_MAP_DOMAIN_PAGE if MMU
 
 config ARM_64
 	def_bool y
xen/arch/arm/mpu/Makefile +0 -1
index 50f8fe4326..4963c8b550 100644
@@ -1,6 +1,5 @@
 obj-$(CONFIG_ARM_32) += arm32/
 obj-$(CONFIG_ARM_64) += arm64/
-obj-$(CONFIG_ARM_32) += domain-page.o
 obj-y += mm.o
 obj-y += p2m.o
 obj-y += setup.init.o
xen/arch/arm/mpu/domain-page.c deleted +0 -45

45 lines not on this page · raw message

Signature · 1 line
2.25.1
Reviewed-by Tested-by on v2 2/2
#5 lore raw

Re: [PATCH v2 2/2] arm/mpu: Disable map_domain_page for MPU

Hi Ayan,

Quoted 9 lines · Ayan Kumar Halder

There is no domheap for ARM_32. All of the RAM is mapped and VA == PA.

---
Changes from :-

v1 - 1. No changes.

Slightly surprised by this, as it looks like the suggested change from
https://patchwork.kernel.org/comment/26507841/ has been incorporated in this v2 version of the patch...

But anyway, LGTM now!

Cheers,
Hari

Reviewed-by on v2 2/2
#6 lore raw

Re: [PATCH v2 2/2] arm/mpu: Disable map_domain_page for MPU

In reply to Ayan Kumar Halder
Quoted 1 line · Ayan Kumar Halder

There is no domheap for ARM_32. All of the RAM is mapped and VA == PA.

NIT for the future: It's always better to mention explicitly that you're talking about MPU also in commit msg. Without looking at the commit title, one can be confused.

Quoted 2 lines

~Michal