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.
Signed-off-by: Ayan Kumar Halder <ayan.kumar.halder@amd.com>
---
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(-)
diff --git a/xen/arch/arm/include/asm/mm.h b/xen/arch/arm/include/asm/mm.h
index fb79aeb088..7a93dad2ed 100644
--- a/xen/arch/arm/include/asm/mm.h
+++ b/xen/arch/arm/include/asm/mm.h
@@ -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)))
diff --git a/xen/arch/arm/include/asm/mpu/mm.h b/xen/arch/arm/include/asm/mpu/mm.h
index c32fac8905..e1ded6521d 100644
--- a/xen/arch/arm/include/asm/mpu/mm.h
+++ b/xen/arch/arm/include/asm/mpu/mm.h
@@ -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)
{
--
2.25.1
On 14/08/2025 10:19, Ayan Kumar Halder wrote: > 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. > > Signed-off-by: Ayan Kumar Halder <ayan.kumar.halder@amd.com> Reviewed-by: Michal Orzel <michal.orzel@amd.com> ~Michal
Hi Ayan, On Thu, Aug 14, 2025 at 09:19:58AM +0000, Ayan Kumar Halder wrote: > 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. > > Signed-off-by: Ayan Kumar Halder <ayan.kumar.halder@amd.com> Reviewed-by: Hari Limaye <hari.limaye@arm.com> Tested-by: Hari Limaye <hari.limaye@arm.com> LGTM now, thanks for updating. Tested (build-only) on AArch32 and AArch64 MMU and MPU systems. Cheers, Hari
© 2016 - 2025 Red Hat, Inc.