Skip to contentSkip to conversation

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

PATCH Superseded Ayan Kumar Halder 3 participants 6 messages Aug 7, 2025 – Aug 14, 2025

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

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 co 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/domain-page.c    | 45 -------------------------------
 4 files changed, 1 insertion(+), 53 deletions(-)
 delete mode 100644 xen/arch/arm/mpu/domain-page.c
Signature · 1 line
2.25.1
#1 lore raw

PATCH 1/2 arm/mpu: Enable is_xen_heap_page and co 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.

---
 xen/arch/arm/include/asm/mm.h     | 2 --
 xen/arch/arm/include/asm/mpu/mm.h | 5 -----
 2 files changed, 7 deletions(-)
xen/arch/arm/include/asm/mm.h +0 -2
index fb79aeb088..4eaa81d5e8 100644
@@ -170,11 +170,9 @@ struct page_info
 #define _PGC_need_scrub   _PGC_allocated
 #define PGC_need_scrub    PGC_allocated
 
-#ifdef CONFIG_ARM_64
 #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)))
-#endif
 
 #define is_xen_fixed_mfn(mfn)                                   \
     ((mfn_to_maddr(mfn) >= virt_to_maddr(&_start)) &&           \
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
#4 lore raw

PATCH 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.

---
 xen/arch/arm/Kconfig           |  2 +-
 xen/arch/arm/mpu/domain-page.c | 45 ----------------------------------
 2 files changed, 1 insertion(+), 46 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/domain-page.c deleted +0 -45

45 lines not on this page · raw message

Signature · 1 line
2.25.1
#2 lore raw

Re: [PATCH v1 1/2] arm/mpu: Enable is_xen_heap_page and co for ARM_32

In reply to Ayan Kumar Halder

Hi Ayan,

Quoted 9 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.

---

This patch breaks the build for ARM_32, CONFIG_MMU targets due to multiple definition of is_xen_heap_page and is_xen_heap_mfn. The pre-existing definitions are located at xen/arch/arm/include/asm/mmu/mm.h:30:9

Cheers,
Hari

#5 lore raw

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

In reply to Ayan Kumar Halder

Hi Ayan,

xen/arch/arm/Kconfig

Quoted 13 lines · Ayan Kumar Halder

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

---
 xen/arch/arm/Kconfig           |  2 +-
 xen/arch/arm/mpu/domain-page.c | 45 ----------------------------------
 2 files changed, 1 insertion(+), 46 deletions(-)
 delete mode 100644 xen/arch/arm/mpu/domain-page.c
xen/arch/arm/Kconfig +0 -1
index a0c8160474..5355534f3d 100644
--- a/xen/arch/arm/Kconfig

This patch is breaking ARM_32, MPU builds for me. I think this also needs:

```
diff --git a/xen/arch/arm/mpu/Makefile b/xen/arch/arm/mpu/Makefile
index 50f8fe4326..4963c8b550 100644
--- a/xen/arch/arm/mpu/Makefile
+++ b/xen/arch/arm/mpu/Makefile
@@ -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
 ```

Cheers,
Hari

#3 lore raw

Re: [PATCH v1 1/2] arm/mpu: Enable is_xen_heap_page and co for ARM_32

In reply to Hari Limaye
Quoted 1 line · Hari Limaye

Hi Ayan,

Hi Hari,

Quoted 8 lines
Quoted 8 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.

Quoted 5 lines
Quoted 2 lines

---

This patch breaks the build for ARM_32, CONFIG_MMU targets due to multiple definition of is_xen_heap_page and is_xen_heap_mfn. The pre-existing definitions are located at xen/arch/arm/include/asm/mmu/mm.h:30:9

Thanks for checking this and apologies for the build break. I should have tested this before sending.

I have sent out

[PATCH v2 0/2] R52 MPU support (for "Third series for R82 MPU")

This time I tested https://gitlab.com/xen-project/people/ayankuma/xen/-/pipelines/1982700286 <https://gitlab.com/xen-project/people/ayankuma/xen/-/pipelines/1982700286> :)

- Ayan