* [PATCH v3 0/7] MPU mm subsystem skeleton
@ 2025-03-17 20:07 Luca Fancellu
2025-03-17 20:07 ` [PATCH v3 1/7] arm/mpu: Add HYPERVISOR_VIRT_START and avoid a check in xen.lds.S Luca Fancellu
` (6 more replies)
0 siblings, 7 replies; 23+ messages in thread
From: Luca Fancellu @ 2025-03-17 20:07 UTC (permalink / raw)
To: xen-devel
Cc: Stefano Stabellini, Julien Grall, Bertrand Marquis, Michal Orzel,
Volodymyr Babchuk, Andrew Cooper, Anthony PERARD, Jan Beulich,
Roger Pau Monné, Alistair Francis, Bob Eshleman,
Connor Davis, Oleksii Kurochko
Hi all,
this serie implements the skeleton for the MPU memory management subsystem,
at the end of the serie it will be possible to compile the Arm64 arch using MPU.
The minimum Arm Kconfig configuration is this one:
CONFIG_UNSUPPORTED=y
CONFIG_MPU=y
CONFIG_XEN_START_ADDRESS=0x0
Luca Fancellu (5):
arm/mpu: Add HYPERVISOR_VIRT_START and avoid a check in xen.lds.S
xen/arm: Introduce frame_table and virt_to_page
arm/mpu: Kconfig symbols for MPU build
arm/mpu: Implement stubs for ioremap_attr on MPU
arm/mpu: Create the skeleton for MPU compilation
Penny Zheng (2):
xen/arm: Implement virt/maddr conversion in MPU system
xen: introduce Kconfig ARCH_PAGING_MEMPOOL
xen/arch/arm/Kconfig | 4 +-
xen/arch/arm/arm64/mpu/Makefile | 2 +
xen/arch/arm/arm64/mpu/p2m.c | 19 ++++++
xen/arch/arm/arm64/mpu/smpboot.c | 26 +++++++++
xen/arch/arm/dom0less-build.c | 74 ++++++++++++++---------
xen/arch/arm/include/asm/domain.h | 2 +
xen/arch/arm/include/asm/mm.h | 76 +++---------------------
xen/arch/arm/include/asm/mmu/mm.h | 70 ++++++++++++++++++++++
xen/arch/arm/include/asm/mpu/layout.h | 5 ++
xen/arch/arm/include/asm/mpu/mm.h | 41 +++++++++++++
xen/arch/arm/include/asm/mpu/p2m.h | 21 +++++++
xen/arch/arm/include/asm/p2m.h | 2 +-
xen/arch/arm/mm.c | 5 ++
xen/arch/arm/mmu/pt.c | 5 --
xen/arch/arm/mpu/Makefile | 3 +
xen/arch/arm/mpu/mm.c | 45 +++++++++++++-
xen/arch/arm/mpu/p2m.c | 84 +++++++++++++++++++++++++++
xen/arch/arm/mpu/setup.c | 40 +++++++++++++
xen/arch/arm/mpu/vmap.c | 26 +++++++++
xen/arch/arm/xen.lds.S | 2 +
xen/arch/riscv/Kconfig | 1 +
xen/arch/x86/Kconfig | 1 +
xen/common/Kconfig | 3 +
xen/include/xen/domain.h | 17 ++++++
24 files changed, 472 insertions(+), 102 deletions(-)
create mode 100644 xen/arch/arm/arm64/mpu/p2m.c
create mode 100644 xen/arch/arm/arm64/mpu/smpboot.c
create mode 100644 xen/arch/arm/include/asm/mpu/mm.h
create mode 100644 xen/arch/arm/include/asm/mpu/p2m.h
create mode 100644 xen/arch/arm/mpu/p2m.c
create mode 100644 xen/arch/arm/mpu/setup.c
create mode 100644 xen/arch/arm/mpu/vmap.c
--
2.34.1
^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH v3 1/7] arm/mpu: Add HYPERVISOR_VIRT_START and avoid a check in xen.lds.S
2025-03-17 20:07 [PATCH v3 0/7] MPU mm subsystem skeleton Luca Fancellu
@ 2025-03-17 20:07 ` Luca Fancellu
2025-03-17 20:07 ` [PATCH v3 2/7] xen/arm: Implement virt/maddr conversion in MPU system Luca Fancellu
` (5 subsequent siblings)
6 siblings, 0 replies; 23+ messages in thread
From: Luca Fancellu @ 2025-03-17 20:07 UTC (permalink / raw)
To: xen-devel
Cc: Stefano Stabellini, Julien Grall, Bertrand Marquis, Michal Orzel,
Volodymyr Babchuk
The define HYPERVISOR_VIRT_START is required by the common code,
even if MPU system doesn't use virtual memory, define it in
mpu/layout.h in order to reuse existing code.
Disable a check in the linker script for arm for !MMU systems.
Signed-off-by: Luca Fancellu <luca.fancellu@arm.com>
Reviewed-by: Michal Orzel <michal.orzel@amd.com>
---
v3 changes:
- no changes
v2 changes:
- Add Michal R-by
---
xen/arch/arm/include/asm/mpu/layout.h | 2 ++
xen/arch/arm/xen.lds.S | 2 ++
2 files changed, 4 insertions(+)
diff --git a/xen/arch/arm/include/asm/mpu/layout.h b/xen/arch/arm/include/asm/mpu/layout.h
index d6d397f4c2ac..248e55f8882d 100644
--- a/xen/arch/arm/include/asm/mpu/layout.h
+++ b/xen/arch/arm/include/asm/mpu/layout.h
@@ -22,6 +22,8 @@
*/
#define XEN_VIRT_START _AT(paddr_t, XEN_START_ADDRESS)
+#define HYPERVISOR_VIRT_START XEN_VIRT_START
+
#endif /* __ARM_MPU_LAYOUT_H__ */
/*
* Local variables:
diff --git a/xen/arch/arm/xen.lds.S b/xen/arch/arm/xen.lds.S
index bbccff1a0350..4342e54422a7 100644
--- a/xen/arch/arm/xen.lds.S
+++ b/xen/arch/arm/xen.lds.S
@@ -239,4 +239,6 @@ ASSERT(IS_ALIGNED(__bss_start, POINTER_ALIGN), "__bss_start is misaligned")
ASSERT(IS_ALIGNED(__bss_end, POINTER_ALIGN), "__bss_end is misaligned")
/* To simplify the logic in head.S, we want to _end to be page aligned */
ASSERT(IS_ALIGNED(_end, PAGE_SIZE), "_end is not page aligned")
+#ifdef CONFIG_MMU
ASSERT((_end - _start) <= XEN_VIRT_SIZE, "Xen is too big")
+#endif
--
2.34.1
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [PATCH v3 2/7] xen/arm: Implement virt/maddr conversion in MPU system
2025-03-17 20:07 [PATCH v3 0/7] MPU mm subsystem skeleton Luca Fancellu
2025-03-17 20:07 ` [PATCH v3 1/7] arm/mpu: Add HYPERVISOR_VIRT_START and avoid a check in xen.lds.S Luca Fancellu
@ 2025-03-17 20:07 ` Luca Fancellu
2025-03-17 20:07 ` [PATCH v3 3/7] xen/arm: Introduce frame_table and virt_to_page Luca Fancellu
` (4 subsequent siblings)
6 siblings, 0 replies; 23+ messages in thread
From: Luca Fancellu @ 2025-03-17 20:07 UTC (permalink / raw)
To: xen-devel
Cc: Penny Zheng, Stefano Stabellini, Julien Grall, Bertrand Marquis,
Michal Orzel, Volodymyr Babchuk, Penny Zheng, Wei Chen
From: Penny Zheng <Penny.Zheng@arm.com>
virt_to_maddr and maddr_to_virt are used widely in Xen code. So
even there is no VMSA in MPU system, we keep the interface in MPU to
to avoid changing the existing common code.
In order to do that, move the virt_to_maddr() and maddr_to_virt()
definitions to mmu/mm.h, move the include of memory management
subsystems (MMU/MPU) on a different place because the mentioned
helpers needs visibility of some macro in asm/mm.h.
Finally implement virt_to_maddr() and maddr_to_virt() for MPU systems
under mpu/mm.h, the MPU version of virt/maddr conversion is simple since
VA==PA.
Signed-off-by: Penny Zheng <penny.zheng@arm.com>
Signed-off-by: Wei Chen <wei.chen@arm.com>
Signed-off-by: Luca Fancellu <luca.fancellu@arm.com>
Reviewed-by: Michal Orzel <michal.orzel@amd.com>
---
v3 changes:
- Add Michal R-by
v2 changes:
- add missing headers, fix header protection macro name convention
- take into account PADDR_MASK in virt_to_maddr
- fixed typo in commit message
- moved also maddr_to_virt to mmu/mm.h and moved include of mmu/mpu.
- moved introduction of mm.c footer on commit that touches that file.
---
xen/arch/arm/include/asm/mm.h | 64 +++++--------------------------
xen/arch/arm/include/asm/mmu/mm.h | 56 +++++++++++++++++++++++++++
xen/arch/arm/include/asm/mpu/mm.h | 27 +++++++++++++
3 files changed, 92 insertions(+), 55 deletions(-)
create mode 100644 xen/arch/arm/include/asm/mpu/mm.h
diff --git a/xen/arch/arm/include/asm/mm.h b/xen/arch/arm/include/asm/mm.h
index a0d8e5afe977..444fd03823ec 100644
--- a/xen/arch/arm/include/asm/mm.h
+++ b/xen/arch/arm/include/asm/mm.h
@@ -14,12 +14,6 @@
# error "unknown ARM variant"
#endif
-#if defined(CONFIG_MMU)
-# include <asm/mmu/mm.h>
-#elif !defined(CONFIG_MPU)
-# error "Unknown memory management layout"
-#endif
-
/* Align Xen to a 2 MiB boundary. */
#define XEN_PADDR_ALIGN (1 << 21)
@@ -261,55 +255,6 @@ static inline void __iomem *ioremap_wc(paddr_t start, size_t len)
/* Page-align address and convert to frame number format */
#define paddr_to_pfn_aligned(paddr) paddr_to_pfn(PAGE_ALIGN(paddr))
-#define virt_to_maddr(va) ({ \
- vaddr_t va_ = (vaddr_t)(va); \
- (paddr_t)((va_to_par(va_) & PADDR_MASK & PAGE_MASK) | (va_ & ~PAGE_MASK)); \
-})
-
-#ifdef CONFIG_ARM_32
-/**
- * Find the virtual address corresponding to a machine address
- *
- * Only memory backing the XENHEAP has a corresponding virtual address to
- * be found. This is so we can save precious virtual space, as it's in
- * short supply on arm32. This mapping is not subject to PDX compression
- * because XENHEAP is known to be physically contiguous and can't hence
- * jump over the PDX hole. This means we can avoid the roundtrips
- * converting to/from pdx.
- *
- * @param ma Machine address
- * @return Virtual address mapped to `ma`
- */
-static inline void *maddr_to_virt(paddr_t ma)
-{
- ASSERT(is_xen_heap_mfn(maddr_to_mfn(ma)));
- ma -= mfn_to_maddr(directmap_mfn_start);
- return (void *)(unsigned long) ma + XENHEAP_VIRT_START;
-}
-#else
-/**
- * Find the virtual address corresponding to a machine address
- *
- * The directmap covers all conventional memory accesible by the
- * hypervisor. This means it's subject to PDX compression.
- *
- * Note there's an extra offset applied (directmap_base_pdx) on top of the
- * regular PDX compression logic. Its purpose is to skip over the initial
- * range of non-existing memory, should there be one.
- *
- * @param ma Machine address
- * @return Virtual address mapped to `ma`
- */
-static inline void *maddr_to_virt(paddr_t ma)
-{
- ASSERT((mfn_to_pdx(maddr_to_mfn(ma)) - directmap_base_pdx) <
- (DIRECTMAP_SIZE >> PAGE_SHIFT));
- return (void *)(XENHEAP_VIRT_START -
- (directmap_base_pdx << PAGE_SHIFT) +
- maddr_to_directmapoff(ma));
-}
-#endif
-
/*
* Translate a guest virtual address to a machine address.
* Return the fault information if the translation has failed else 0.
@@ -340,6 +285,15 @@ static inline uint64_t gvirt_to_maddr(vaddr_t va, paddr_t *pa,
#define virt_to_mfn(va) __virt_to_mfn(va)
#define mfn_to_virt(mfn) __mfn_to_virt(mfn)
+/* Memory management subsystem header placed here to see the above macros */
+#if defined(CONFIG_MMU)
+# include <asm/mmu/mm.h>
+#elif defined(CONFIG_MPU)
+# include <asm/mpu/mm.h>
+#else
+#error "Unknown memory management layout"
+#endif
+
/* Convert between Xen-heap virtual addresses and page-info structures. */
static inline struct page_info *virt_to_page(const void *v)
{
diff --git a/xen/arch/arm/include/asm/mmu/mm.h b/xen/arch/arm/include/asm/mmu/mm.h
index f5a00558c47b..6737c3ede783 100644
--- a/xen/arch/arm/include/asm/mmu/mm.h
+++ b/xen/arch/arm/include/asm/mmu/mm.h
@@ -2,6 +2,13 @@
#ifndef __ARM_MMU_MM_H__
#define __ARM_MMU_MM_H__
+#include <xen/bug.h>
+#include <xen/pdx.h>
+#include <xen/types.h>
+#include <asm/mm.h>
+#include <asm/mmu/layout.h>
+#include <asm/page.h>
+
/* Non-boot CPUs use this to find the correct pagetables. */
extern uint64_t init_ttbr;
@@ -14,6 +21,55 @@ extern unsigned long directmap_base_pdx;
#define frame_table ((struct page_info *)FRAMETABLE_VIRT_START)
+#define virt_to_maddr(va) ({ \
+ vaddr_t va_ = (vaddr_t)(va); \
+ (paddr_t)((va_to_par(va_) & PADDR_MASK & PAGE_MASK) | (va_ & ~PAGE_MASK)); \
+})
+
+#ifdef CONFIG_ARM_32
+/**
+ * Find the virtual address corresponding to a machine address
+ *
+ * Only memory backing the XENHEAP has a corresponding virtual address to
+ * be found. This is so we can save precious virtual space, as it's in
+ * short supply on arm32. This mapping is not subject to PDX compression
+ * because XENHEAP is known to be physically contiguous and can't hence
+ * jump over the PDX hole. This means we can avoid the roundtrips
+ * converting to/from pdx.
+ *
+ * @param ma Machine address
+ * @return Virtual address mapped to `ma`
+ */
+static inline void *maddr_to_virt(paddr_t ma)
+{
+ ASSERT(is_xen_heap_mfn(maddr_to_mfn(ma)));
+ ma -= mfn_to_maddr(directmap_mfn_start);
+ return (void *)(unsigned long) ma + XENHEAP_VIRT_START;
+}
+#else
+/**
+ * Find the virtual address corresponding to a machine address
+ *
+ * The directmap covers all conventional memory accesible by the
+ * hypervisor. This means it's subject to PDX compression.
+ *
+ * Note there's an extra offset applied (directmap_base_pdx) on top of the
+ * regular PDX compression logic. Its purpose is to skip over the initial
+ * range of non-existing memory, should there be one.
+ *
+ * @param ma Machine address
+ * @return Virtual address mapped to `ma`
+ */
+static inline void *maddr_to_virt(paddr_t ma)
+{
+ ASSERT((mfn_to_pdx(maddr_to_mfn(ma)) - directmap_base_pdx) <
+ (DIRECTMAP_SIZE >> PAGE_SHIFT));
+ return (void *)(XENHEAP_VIRT_START -
+ (directmap_base_pdx << PAGE_SHIFT) +
+ maddr_to_directmapoff(ma));
+}
+#endif
+
/*
* Print a walk of a page table or p2m
*
diff --git a/xen/arch/arm/include/asm/mpu/mm.h b/xen/arch/arm/include/asm/mpu/mm.h
new file mode 100644
index 000000000000..6cfd0f5cd2c2
--- /dev/null
+++ b/xen/arch/arm/include/asm/mpu/mm.h
@@ -0,0 +1,27 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#ifndef __ARM_MPU_MM_H__
+#define __ARM_MPU_MM_H__
+
+#include <xen/macros.h>
+#include <xen/page-size.h>
+#include <xen/types.h>
+
+#define virt_to_maddr(va) ((paddr_t)((vaddr_t)(va) & PADDR_MASK))
+
+/* On MPU systems there is no translation, ma == va. */
+static inline void *maddr_to_virt(paddr_t ma)
+{
+ return _p(ma);
+}
+
+#endif /* __ARM_MPU_MM_H__ */
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
--
2.34.1
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [PATCH v3 3/7] xen/arm: Introduce frame_table and virt_to_page
2025-03-17 20:07 [PATCH v3 0/7] MPU mm subsystem skeleton Luca Fancellu
2025-03-17 20:07 ` [PATCH v3 1/7] arm/mpu: Add HYPERVISOR_VIRT_START and avoid a check in xen.lds.S Luca Fancellu
2025-03-17 20:07 ` [PATCH v3 2/7] xen/arm: Implement virt/maddr conversion in MPU system Luca Fancellu
@ 2025-03-17 20:07 ` Luca Fancellu
2025-03-17 20:07 ` [PATCH v3 4/7] arm/mpu: Kconfig symbols for MPU build Luca Fancellu
` (3 subsequent siblings)
6 siblings, 0 replies; 23+ messages in thread
From: Luca Fancellu @ 2025-03-17 20:07 UTC (permalink / raw)
To: xen-devel
Cc: Stefano Stabellini, Julien Grall, Bertrand Marquis, Michal Orzel,
Volodymyr Babchuk
Introduce frame_table in order to provide the implementation of
virt_to_page for MPU system, move the MMU variant in mmu/mm.h.
Introduce FRAMETABLE_NR that is required for 'pdx_group_valid' in
pdx.c, but leave the initialisation of the frame table to a later
stage.
Define FRAMETABLE_SIZE for MPU to support up to 1TB of ram at this
stage, as the only current implementation of armv8-r aarch64, which
is cortex R82, can support 1TB or 256TB (r82 TRM r3p1
ID_AA64MMFR0_EL1.PARange).
Take the occasion to sort alphabetically the headers following
the Xen code style and add the emacs footer in mpu/mm.c.
Signed-off-by: Luca Fancellu <luca.fancellu@arm.com>
Reviewed-by: Michal Orzel <michal.orzel@amd.com>
---
v3 changes:
- Simplified MPU virt_to_page conversions (Michal suggested)
- Mentioned r82 TRM source for frame table size (Michal)
- Add Michal R-by
v2 changes:
- sorted headers in mm.c
- modified commit message
- moved virt_to_page to MMU and MPU
- removed frametable_pdx_end, used mfn_valid
---
xen/arch/arm/include/asm/mm.h | 14 --------------
xen/arch/arm/include/asm/mmu/mm.h | 14 ++++++++++++++
xen/arch/arm/include/asm/mpu/layout.h | 3 +++
xen/arch/arm/include/asm/mpu/mm.h | 14 ++++++++++++++
xen/arch/arm/mpu/mm.c | 14 +++++++++++++-
5 files changed, 44 insertions(+), 15 deletions(-)
diff --git a/xen/arch/arm/include/asm/mm.h b/xen/arch/arm/include/asm/mm.h
index 444fd03823ec..fbffaccef49b 100644
--- a/xen/arch/arm/include/asm/mm.h
+++ b/xen/arch/arm/include/asm/mm.h
@@ -294,20 +294,6 @@ static inline uint64_t gvirt_to_maddr(vaddr_t va, paddr_t *pa,
#error "Unknown memory management layout"
#endif
-/* Convert between Xen-heap virtual addresses and page-info structures. */
-static inline struct page_info *virt_to_page(const void *v)
-{
- unsigned long va = (unsigned long)v;
- unsigned long pdx;
-
- ASSERT(va >= XENHEAP_VIRT_START);
- ASSERT(va < directmap_virt_end);
-
- pdx = (va - XENHEAP_VIRT_START) >> PAGE_SHIFT;
- pdx += mfn_to_pdx(directmap_mfn_start);
- return frame_table + pdx - frametable_base_pdx;
-}
-
static inline void *page_to_virt(const struct page_info *pg)
{
return mfn_to_virt(mfn_x(page_to_mfn(pg)));
diff --git a/xen/arch/arm/include/asm/mmu/mm.h b/xen/arch/arm/include/asm/mmu/mm.h
index 6737c3ede783..caba987edc85 100644
--- a/xen/arch/arm/include/asm/mmu/mm.h
+++ b/xen/arch/arm/include/asm/mmu/mm.h
@@ -70,6 +70,20 @@ static inline void *maddr_to_virt(paddr_t ma)
}
#endif
+/* Convert between Xen-heap virtual addresses and page-info structures. */
+static inline struct page_info *virt_to_page(const void *v)
+{
+ unsigned long va = (unsigned long)v;
+ unsigned long pdx;
+
+ ASSERT(va >= XENHEAP_VIRT_START);
+ ASSERT(va < directmap_virt_end);
+
+ pdx = (va - XENHEAP_VIRT_START) >> PAGE_SHIFT;
+ pdx += mfn_to_pdx(directmap_mfn_start);
+ return frame_table + pdx - frametable_base_pdx;
+}
+
/*
* Print a walk of a page table or p2m
*
diff --git a/xen/arch/arm/include/asm/mpu/layout.h b/xen/arch/arm/include/asm/mpu/layout.h
index 248e55f8882d..c331d1feaa84 100644
--- a/xen/arch/arm/include/asm/mpu/layout.h
+++ b/xen/arch/arm/include/asm/mpu/layout.h
@@ -3,6 +3,9 @@
#ifndef __ARM_MPU_LAYOUT_H__
#define __ARM_MPU_LAYOUT_H__
+#define FRAMETABLE_SIZE GB(16)
+#define FRAMETABLE_NR (FRAMETABLE_SIZE / sizeof(*frame_table))
+
#define XEN_START_ADDRESS CONFIG_XEN_START_ADDRESS
/*
diff --git a/xen/arch/arm/include/asm/mpu/mm.h b/xen/arch/arm/include/asm/mpu/mm.h
index 6cfd0f5cd2c2..86f33d9836b7 100644
--- a/xen/arch/arm/include/asm/mpu/mm.h
+++ b/xen/arch/arm/include/asm/mpu/mm.h
@@ -3,9 +3,13 @@
#ifndef __ARM_MPU_MM_H__
#define __ARM_MPU_MM_H__
+#include <xen/bug.h>
#include <xen/macros.h>
#include <xen/page-size.h>
#include <xen/types.h>
+#include <asm/mm.h>
+
+extern struct page_info *frame_table;
#define virt_to_maddr(va) ((paddr_t)((vaddr_t)(va) & PADDR_MASK))
@@ -15,6 +19,16 @@ static inline void *maddr_to_virt(paddr_t ma)
return _p(ma);
}
+/* Convert between virtual address to page-info structure. */
+static inline struct page_info *virt_to_page(const void *v)
+{
+ mfn_t mfn = _mfn(virt_to_mfn(v));
+
+ ASSERT(mfn_valid(mfn));
+
+ return mfn_to_page(mfn);
+}
+
#endif /* __ARM_MPU_MM_H__ */
/*
diff --git a/xen/arch/arm/mpu/mm.c b/xen/arch/arm/mpu/mm.c
index 0b8748e57598..3632011c1013 100644
--- a/xen/arch/arm/mpu/mm.c
+++ b/xen/arch/arm/mpu/mm.c
@@ -1,9 +1,12 @@
/* SPDX-License-Identifier: GPL-2.0-only */
-#include <xen/lib.h>
#include <xen/init.h>
+#include <xen/lib.h>
+#include <xen/mm.h>
#include <xen/sizes.h>
+struct page_info *frame_table;
+
static void __init __maybe_unused build_assertions(void)
{
/*
@@ -13,3 +16,12 @@ static void __init __maybe_unused build_assertions(void)
*/
BUILD_BUG_ON(PAGE_SIZE != SZ_4K);
}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
--
2.34.1
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [PATCH v3 4/7] arm/mpu: Kconfig symbols for MPU build
2025-03-17 20:07 [PATCH v3 0/7] MPU mm subsystem skeleton Luca Fancellu
` (2 preceding siblings ...)
2025-03-17 20:07 ` [PATCH v3 3/7] xen/arm: Introduce frame_table and virt_to_page Luca Fancellu
@ 2025-03-17 20:07 ` Luca Fancellu
2025-03-17 20:07 ` [PATCH v3 5/7] arm/mpu: Implement stubs for ioremap_attr on MPU Luca Fancellu
` (2 subsequent siblings)
6 siblings, 0 replies; 23+ messages in thread
From: Luca Fancellu @ 2025-03-17 20:07 UTC (permalink / raw)
To: xen-devel
Cc: Stefano Stabellini, Julien Grall, Bertrand Marquis, Michal Orzel,
Volodymyr Babchuk
The MPU system requires static memory to work, select that
when building this memory management subsystem.
While there, provide a restriction for the ARM_EFI Kconfig
parameter to be built only when !MPU, the EFI stub is not
used as there are no implementation of UEFI services for
armv8-r.
Signed-off-by: Luca Fancellu <luca.fancellu@arm.com>
Reviewed-by: Michal Orzel <michal.orzel@amd.com>
---
v3 changes:
- No changes
v2 changes:
- clarified commit message about static memory
- Add R-by Michal
---
xen/arch/arm/Kconfig | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/xen/arch/arm/Kconfig b/xen/arch/arm/Kconfig
index ffdff1f0a36c..5ac6ec0212d2 100644
--- a/xen/arch/arm/Kconfig
+++ b/xen/arch/arm/Kconfig
@@ -85,6 +85,7 @@ config MMU
config MPU
bool "MPU" if UNSUPPORTED
+ select STATIC_MEMORY
help
Memory Protection Unit (MPU). Select if you plan to run Xen on ARMv8-R
systems supporting EL2. (UNSUPPORTED)
@@ -102,7 +103,7 @@ config ACPI
config ARM_EFI
bool "UEFI boot service support"
- depends on ARM_64
+ depends on ARM_64 && !MPU
default y
help
This option provides support for boot services through
--
2.34.1
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [PATCH v3 5/7] arm/mpu: Implement stubs for ioremap_attr on MPU
2025-03-17 20:07 [PATCH v3 0/7] MPU mm subsystem skeleton Luca Fancellu
` (3 preceding siblings ...)
2025-03-17 20:07 ` [PATCH v3 4/7] arm/mpu: Kconfig symbols for MPU build Luca Fancellu
@ 2025-03-17 20:07 ` Luca Fancellu
2025-03-17 20:07 ` [PATCH v3 6/7] xen: introduce Kconfig ARCH_PAGING_MEMPOOL Luca Fancellu
2025-03-17 20:07 ` [PATCH v3 7/7] arm/mpu: Create the skeleton for MPU compilation Luca Fancellu
6 siblings, 0 replies; 23+ messages in thread
From: Luca Fancellu @ 2025-03-17 20:07 UTC (permalink / raw)
To: xen-devel
Cc: Stefano Stabellini, Julien Grall, Bertrand Marquis, Michal Orzel,
Volodymyr Babchuk
Implement ioremap_attr() stub for MPU system; the
implementation of ioremap() is the same between MMU
and MPU system, and it relies on ioremap_attr(), so
move the definition from mmu/pt.c to arm/mm.c.
Signed-off-by: Luca Fancellu <luca.fancellu@arm.com>
Reviewed-by: Michal Orzel <michal.orzel@amd.com>
---
v3 changes:
- No changes
v2 changes:
- Add R-by Michal
---
xen/arch/arm/mm.c | 5 +++++
xen/arch/arm/mmu/pt.c | 5 -----
xen/arch/arm/mpu/mm.c | 6 ++++++
3 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c
index a56e20ba2bdc..5a52f0c623e5 100644
--- a/xen/arch/arm/mm.c
+++ b/xen/arch/arm/mm.c
@@ -395,6 +395,11 @@ unsigned long get_upper_mfn_bound(void)
return max_page - 1;
}
+void *ioremap(paddr_t pa, size_t len)
+{
+ return ioremap_attr(pa, len, PAGE_HYPERVISOR_NOCACHE);
+}
+
/*
* Local variables:
* mode: C
diff --git a/xen/arch/arm/mmu/pt.c b/xen/arch/arm/mmu/pt.c
index da28d669e796..11cb1c66dac8 100644
--- a/xen/arch/arm/mmu/pt.c
+++ b/xen/arch/arm/mmu/pt.c
@@ -223,11 +223,6 @@ void *ioremap_attr(paddr_t start, size_t len, unsigned int attributes)
return ptr + offs;
}
-void *ioremap(paddr_t pa, size_t len)
-{
- return ioremap_attr(pa, len, PAGE_HYPERVISOR_NOCACHE);
-}
-
static int create_xen_table(lpae_t *entry)
{
mfn_t mfn;
diff --git a/xen/arch/arm/mpu/mm.c b/xen/arch/arm/mpu/mm.c
index 3632011c1013..4e9a2405d8c5 100644
--- a/xen/arch/arm/mpu/mm.c
+++ b/xen/arch/arm/mpu/mm.c
@@ -17,6 +17,12 @@ static void __init __maybe_unused build_assertions(void)
BUILD_BUG_ON(PAGE_SIZE != SZ_4K);
}
+void __iomem *ioremap_attr(paddr_t start, size_t len, unsigned int flags)
+{
+ BUG_ON("unimplemented");
+ return NULL;
+}
+
/*
* Local variables:
* mode: C
--
2.34.1
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [PATCH v3 6/7] xen: introduce Kconfig ARCH_PAGING_MEMPOOL
2025-03-17 20:07 [PATCH v3 0/7] MPU mm subsystem skeleton Luca Fancellu
` (4 preceding siblings ...)
2025-03-17 20:07 ` [PATCH v3 5/7] arm/mpu: Implement stubs for ioremap_attr on MPU Luca Fancellu
@ 2025-03-17 20:07 ` Luca Fancellu
2025-03-18 9:11 ` Orzel, Michal
2025-03-18 13:05 ` Oleksii Kurochko
2025-03-17 20:07 ` [PATCH v3 7/7] arm/mpu: Create the skeleton for MPU compilation Luca Fancellu
6 siblings, 2 replies; 23+ messages in thread
From: Luca Fancellu @ 2025-03-17 20:07 UTC (permalink / raw)
To: xen-devel
Cc: Penny Zheng, Stefano Stabellini, Julien Grall, Bertrand Marquis,
Michal Orzel, Volodymyr Babchuk, Andrew Cooper, Anthony PERARD,
Jan Beulich, Roger Pau Monné, Alistair Francis, Bob Eshleman,
Connor Davis, Oleksii Kurochko, Penny Zheng, Wei Chen
From: Penny Zheng <Penny.Zheng@arm.com>
ARM MPU system doesn't need to use paging memory pool, as MPU memory
mapping table at most takes only one 4KB page, which is enough to
manage the maximum 255 MPU memory regions, for all EL2 stage 1
translation and EL1 stage 2 translation.
Introduce ARCH_PAGING_MEMPOOL Kconfig common symbol, selected for Arm
MMU systems, x86 and RISC-V.
Wrap the code inside 'construct_domU' that deal with p2m paging
allocation in a new function 'domain_p2m_set_allocation', protected
by ARCH_PAGING_MEMPOOL, this is done in this way to prevent polluting
the former function with #ifdefs and improve readability
Introduce arch_{get,set}_paging_mempool_size stubs for architecture
with !ARCH_PAGING_MEMPOOL.
Remove 'struct paging_domain' from Arm 'struct arch_domain' when the
field is not required.
Signed-off-by: Penny Zheng <penny.zheng@arm.com>
Signed-off-by: Wei Chen <wei.chen@arm.com>
Signed-off-by: Luca Fancellu <luca.fancellu@arm.com>
---
v3 changes:
- Introduced ARCH_PAGING_MEMPOOL instead of HAS_PAGING_MEMPOOL
v2 changes:
- make Kconfig HAS_PAGING_MEMPOOL common
- protect also "xen,domain-p2m-mem-mb" reading with HAS_PAGING_MEMPOOL
- do not define p2m_teardown{_allocation} in this patch
- change commit message
---
xen/arch/arm/Kconfig | 1 +
xen/arch/arm/dom0less-build.c | 74 ++++++++++++++++++++-----------
xen/arch/arm/include/asm/domain.h | 2 +
xen/arch/riscv/Kconfig | 1 +
xen/arch/x86/Kconfig | 1 +
xen/common/Kconfig | 3 ++
xen/include/xen/domain.h | 17 +++++++
7 files changed, 73 insertions(+), 26 deletions(-)
diff --git a/xen/arch/arm/Kconfig b/xen/arch/arm/Kconfig
index 5ac6ec0212d2..a4af0b85f158 100644
--- a/xen/arch/arm/Kconfig
+++ b/xen/arch/arm/Kconfig
@@ -75,6 +75,7 @@ choice
config MMU
bool "MMU"
+ select ARCH_PAGING_MEMPOOL
select HAS_LLC_COLORING if !NUMA && ARM_64
select HAS_PMAP
select HAS_VMAP
diff --git a/xen/arch/arm/dom0less-build.c b/xen/arch/arm/dom0less-build.c
index 573b0d25ae41..6eef6ba91444 100644
--- a/xen/arch/arm/dom0less-build.c
+++ b/xen/arch/arm/dom0less-build.c
@@ -673,21 +673,6 @@ static int __init prepare_dtb_domU(struct domain *d, struct kernel_info *kinfo)
return -EINVAL;
}
-static unsigned long __init domain_p2m_pages(unsigned long maxmem_kb,
- unsigned int smp_cpus)
-{
- /*
- * Keep in sync with libxl__get_required_paging_memory().
- * 256 pages (1MB) per vcpu, plus 1 page per MiB of RAM for the P2M map,
- * plus 128 pages to cover extended regions.
- */
- unsigned long memkb = 4 * (256 * smp_cpus + (maxmem_kb / 1024) + 128);
-
- BUILD_BUG_ON(PAGE_SIZE != SZ_4K);
-
- return DIV_ROUND_UP(memkb, 1024) << (20 - PAGE_SHIFT);
-}
-
static int __init alloc_xenstore_evtchn(struct domain *d)
{
evtchn_alloc_unbound_t alloc;
@@ -841,6 +826,53 @@ static void __init domain_vcpu_affinity(struct domain *d,
}
}
+#ifdef CONFIG_ARCH_PAGING_MEMPOOL
+
+static unsigned long __init domain_p2m_pages(unsigned long maxmem_kb,
+ unsigned int smp_cpus)
+{
+ /*
+ * Keep in sync with libxl__get_required_paging_memory().
+ * 256 pages (1MB) per vcpu, plus 1 page per MiB of RAM for the P2M map,
+ * plus 128 pages to cover extended regions.
+ */
+ unsigned long memkb = 4 * (256 * smp_cpus + (maxmem_kb / 1024) + 128);
+
+ BUILD_BUG_ON(PAGE_SIZE != SZ_4K);
+
+ return DIV_ROUND_UP(memkb, 1024) << (20 - PAGE_SHIFT);
+}
+
+static int __init domain_p2m_set_allocation(struct domain *d, uint64_t mem,
+ const struct dt_device_node *node)
+{
+ unsigned long p2m_pages;
+ uint32_t p2m_mem_mb;
+ int rc;
+
+ rc = dt_property_read_u32(node, "xen,domain-p2m-mem-mb", &p2m_mem_mb);
+ /* If xen,domain-p2m-mem-mb is not specified, use the default value. */
+ p2m_pages = rc ?
+ p2m_mem_mb << (20 - PAGE_SHIFT) :
+ domain_p2m_pages(mem, d->max_vcpus);
+
+ spin_lock(&d->arch.paging.lock);
+ rc = p2m_set_allocation(d, p2m_pages, NULL);
+ spin_unlock(&d->arch.paging.lock);
+
+ return rc;
+}
+
+#else /* !CONFIG_ARCH_PAGING_MEMPOOL */
+
+static inline int domain_p2m_set_allocation(struct domain *d, uint64_t mem,
+ const struct dt_device_node *node)
+{
+ return 0;
+}
+
+#endif /* CONFIG_ARCH_PAGING_MEMPOOL */
+
static int __init construct_domU(struct domain *d,
const struct dt_device_node *node)
{
@@ -848,8 +880,6 @@ static int __init construct_domU(struct domain *d,
const char *dom0less_enhanced;
int rc;
u64 mem;
- u32 p2m_mem_mb;
- unsigned long p2m_pages;
rc = dt_property_read_u64(node, "memory", &mem);
if ( !rc )
@@ -859,15 +889,7 @@ static int __init construct_domU(struct domain *d,
}
kinfo.unassigned_mem = (paddr_t)mem * SZ_1K;
- rc = dt_property_read_u32(node, "xen,domain-p2m-mem-mb", &p2m_mem_mb);
- /* If xen,domain-p2m-mem-mb is not specified, use the default value. */
- p2m_pages = rc ?
- p2m_mem_mb << (20 - PAGE_SHIFT) :
- domain_p2m_pages(mem, d->max_vcpus);
-
- spin_lock(&d->arch.paging.lock);
- rc = p2m_set_allocation(d, p2m_pages, NULL);
- spin_unlock(&d->arch.paging.lock);
+ rc = domain_p2m_set_allocation(d, mem, node);
if ( rc != 0 )
return rc;
diff --git a/xen/arch/arm/include/asm/domain.h b/xen/arch/arm/include/asm/domain.h
index 50b6a4b00982..a3487ca71303 100644
--- a/xen/arch/arm/include/asm/domain.h
+++ b/xen/arch/arm/include/asm/domain.h
@@ -75,7 +75,9 @@ struct arch_domain
struct hvm_domain hvm;
+#ifdef CONFIG_ARCH_PAGING_MEMPOOL
struct paging_domain paging;
+#endif
struct vmmio vmmio;
diff --git a/xen/arch/riscv/Kconfig b/xen/arch/riscv/Kconfig
index d882e0a0598d..1bd8ae16dc65 100644
--- a/xen/arch/riscv/Kconfig
+++ b/xen/arch/riscv/Kconfig
@@ -1,5 +1,6 @@
config RISCV
def_bool y
+ select ARCH_PAGING_MEMPOOL
select FUNCTION_ALIGNMENT_16B
select GENERIC_BUG_FRAME
select HAS_DEVICE_TREE
diff --git a/xen/arch/x86/Kconfig b/xen/arch/x86/Kconfig
index f08679959440..f6aa892661b4 100644
--- a/xen/arch/x86/Kconfig
+++ b/xen/arch/x86/Kconfig
@@ -9,6 +9,7 @@ config X86
select ACPI_NUMA
select ALTERNATIVE_CALL
select ARCH_MAP_DOMAIN_PAGE
+ select ARCH_PAGING_MEMPOOL
select ARCH_SUPPORTS_INT128
imply CORE_PARKING
select FUNCTION_ALIGNMENT_16B
diff --git a/xen/common/Kconfig b/xen/common/Kconfig
index a6aa2c5c1456..218357d593b7 100644
--- a/xen/common/Kconfig
+++ b/xen/common/Kconfig
@@ -44,6 +44,9 @@ config ALTERNATIVE_CALL
config ARCH_MAP_DOMAIN_PAGE
bool
+config ARCH_PAGING_MEMPOOL
+ bool
+
config GENERIC_BUG_FRAME
bool
diff --git a/xen/include/xen/domain.h b/xen/include/xen/domain.h
index 83069de50118..a34daa7d10ab 100644
--- a/xen/include/xen/domain.h
+++ b/xen/include/xen/domain.h
@@ -2,6 +2,7 @@
#ifndef __XEN_DOMAIN_H__
#define __XEN_DOMAIN_H__
+#include <xen/errno.h>
#include <xen/numa.h>
#include <xen/types.h>
@@ -114,9 +115,25 @@ void arch_get_info_guest(struct vcpu *v, vcpu_guest_context_u c);
int arch_initialise_vcpu(struct vcpu *v, XEN_GUEST_HANDLE_PARAM(void) arg);
int default_initialise_vcpu(struct vcpu *v, XEN_GUEST_HANDLE_PARAM(void) arg);
+#ifdef CONFIG_ARCH_PAGING_MEMPOOL
+
int arch_get_paging_mempool_size(struct domain *d, uint64_t *size /* bytes */);
int arch_set_paging_mempool_size(struct domain *d, uint64_t size /* bytes */);
+#else /* !CONFIG_ARCH_PAGING_MEMPOOL */
+
+static inline int arch_get_paging_mempool_size(struct domain *d, uint64_t *size)
+{
+ return -EOPNOTSUPP;
+}
+
+static inline int arch_set_paging_mempool_size(struct domain *d, uint64_t size)
+{
+ return -EOPNOTSUPP;
+}
+
+#endif /* CONFIG_ARCH_PAGING_MEMPOOL */
+
bool update_runstate_area(struct vcpu *v);
int domain_relinquish_resources(struct domain *d);
--
2.34.1
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [PATCH v3 7/7] arm/mpu: Create the skeleton for MPU compilation
2025-03-17 20:07 [PATCH v3 0/7] MPU mm subsystem skeleton Luca Fancellu
` (5 preceding siblings ...)
2025-03-17 20:07 ` [PATCH v3 6/7] xen: introduce Kconfig ARCH_PAGING_MEMPOOL Luca Fancellu
@ 2025-03-17 20:07 ` Luca Fancellu
2025-03-18 9:27 ` Orzel, Michal
6 siblings, 1 reply; 23+ messages in thread
From: Luca Fancellu @ 2025-03-17 20:07 UTC (permalink / raw)
To: xen-devel
Cc: Stefano Stabellini, Julien Grall, Bertrand Marquis, Michal Orzel,
Volodymyr Babchuk
This commit introduces the skeleton for the MPU memory management
subsystem that allows the compilation on Arm64.
Signed-off-by: Luca Fancellu <luca.fancellu@arm.com>
---
The implementation of setup_virt_paging() is under arm64/mpu
because it will have a different implementation from arm32.
v3 changes:
- rebase changes
v2 changes:
- p2m_teardown{_allocation} stubs are now part of this patch
- included missing headers
- rename vmap-mpu.c to vmap.c
- remove comment "Not used on MPU system" on implemented stubs
---
---
xen/arch/arm/arm64/mpu/Makefile | 2 +
xen/arch/arm/arm64/mpu/p2m.c | 19 +++++++
xen/arch/arm/arm64/mpu/smpboot.c | 26 +++++++++
xen/arch/arm/include/asm/mpu/p2m.h | 21 ++++++++
xen/arch/arm/include/asm/p2m.h | 2 +-
xen/arch/arm/mpu/Makefile | 3 ++
xen/arch/arm/mpu/mm.c | 25 +++++++++
xen/arch/arm/mpu/p2m.c | 84 ++++++++++++++++++++++++++++++
xen/arch/arm/mpu/setup.c | 40 ++++++++++++++
xen/arch/arm/mpu/vmap.c | 26 +++++++++
10 files changed, 247 insertions(+), 1 deletion(-)
create mode 100644 xen/arch/arm/arm64/mpu/p2m.c
create mode 100644 xen/arch/arm/arm64/mpu/smpboot.c
create mode 100644 xen/arch/arm/include/asm/mpu/p2m.h
create mode 100644 xen/arch/arm/mpu/p2m.c
create mode 100644 xen/arch/arm/mpu/setup.c
create mode 100644 xen/arch/arm/mpu/vmap.c
diff --git a/xen/arch/arm/arm64/mpu/Makefile b/xen/arch/arm/arm64/mpu/Makefile
index 3340058c08c6..cf0540aecc84 100644
--- a/xen/arch/arm/arm64/mpu/Makefile
+++ b/xen/arch/arm/arm64/mpu/Makefile
@@ -1 +1,3 @@
obj-y += head.o
+obj-y += p2m.o
+obj-y += smpboot.o
diff --git a/xen/arch/arm/arm64/mpu/p2m.c b/xen/arch/arm/arm64/mpu/p2m.c
new file mode 100644
index 000000000000..b6d8b2777b58
--- /dev/null
+++ b/xen/arch/arm/arm64/mpu/p2m.c
@@ -0,0 +1,19 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#include <xen/bug.h>
+#include <xen/init.h>
+#include <asm/p2m.h>
+
+void __init setup_virt_paging(void)
+{
+ BUG_ON("unimplemented");
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff --git a/xen/arch/arm/arm64/mpu/smpboot.c b/xen/arch/arm/arm64/mpu/smpboot.c
new file mode 100644
index 000000000000..5090f443f577
--- /dev/null
+++ b/xen/arch/arm/arm64/mpu/smpboot.c
@@ -0,0 +1,26 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#include <xen/bug.h>
+#include <xen/errno.h>
+#include <xen/mm.h>
+#include <xen/stdbool.h>
+
+int prepare_secondary_mm(int cpu)
+{
+ BUG_ON("unimplemented");
+ return -EINVAL;
+}
+
+void update_boot_mapping(bool enable)
+{
+ BUG_ON("unimplemented");
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff --git a/xen/arch/arm/include/asm/mpu/p2m.h b/xen/arch/arm/include/asm/mpu/p2m.h
new file mode 100644
index 000000000000..e46d9e757a1d
--- /dev/null
+++ b/xen/arch/arm/include/asm/mpu/p2m.h
@@ -0,0 +1,21 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#ifndef __ARM_MPU_P2M_H__
+#define __ARM_MPU_P2M_H__
+
+struct p2m_domain;
+
+static inline void p2m_clear_root_pages(struct p2m_domain *p2m) {}
+
+static inline void p2m_tlb_flush_sync(struct p2m_domain *p2m) {}
+
+#endif /* __ARM_MPU_P2M_H__ */
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff --git a/xen/arch/arm/include/asm/p2m.h b/xen/arch/arm/include/asm/p2m.h
index 594dc4004138..2d53bf9b6177 100644
--- a/xen/arch/arm/include/asm/p2m.h
+++ b/xen/arch/arm/include/asm/p2m.h
@@ -168,7 +168,7 @@ typedef enum {
#if defined(CONFIG_MMU)
# include <asm/mmu/p2m.h>
#else
-# error "Unknown memory management layout"
+# include <asm/mpu/p2m.h>
#endif
static inline bool arch_acquire_resource_check(struct domain *d)
diff --git a/xen/arch/arm/mpu/Makefile b/xen/arch/arm/mpu/Makefile
index b18cec483671..21bbc517b51a 100644
--- a/xen/arch/arm/mpu/Makefile
+++ b/xen/arch/arm/mpu/Makefile
@@ -1 +1,4 @@
obj-y += mm.o
+obj-y += p2m.o
+obj-y += setup.init.o
+obj-y += vmap.o
diff --git a/xen/arch/arm/mpu/mm.c b/xen/arch/arm/mpu/mm.c
index 4e9a2405d8c5..07c8959f4ee9 100644
--- a/xen/arch/arm/mpu/mm.c
+++ b/xen/arch/arm/mpu/mm.c
@@ -1,9 +1,12 @@
/* SPDX-License-Identifier: GPL-2.0-only */
+#include <xen/bug.h>
+#include <xen/errno.h>
#include <xen/init.h>
#include <xen/lib.h>
#include <xen/mm.h>
#include <xen/sizes.h>
+#include <xen/types.h>
struct page_info *frame_table;
@@ -17,6 +20,28 @@ static void __init __maybe_unused build_assertions(void)
BUILD_BUG_ON(PAGE_SIZE != SZ_4K);
}
+void __init setup_mm(void)
+{
+ BUG_ON("unimplemented");
+}
+
+int modify_xen_mappings(unsigned long s, unsigned long e, unsigned int nf)
+{
+ BUG_ON("unimplemented");
+ return -EINVAL;
+}
+
+void dump_hyp_walk(vaddr_t addr)
+{
+ BUG_ON("unimplemented");
+}
+
+/* Release all __init and __initdata ranges to be reused */
+void free_init_memory(void)
+{
+ BUG_ON("unimplemented");
+}
+
void __iomem *ioremap_attr(paddr_t start, size_t len, unsigned int flags)
{
BUG_ON("unimplemented");
diff --git a/xen/arch/arm/mpu/p2m.c b/xen/arch/arm/mpu/p2m.c
new file mode 100644
index 000000000000..f7fb58ab6aa8
--- /dev/null
+++ b/xen/arch/arm/mpu/p2m.c
@@ -0,0 +1,84 @@
+
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#include <xen/bug.h>
+#include <xen/domain.h>
+#include <xen/errno.h>
+#include <xen/mm-frame.h>
+#include <xen/sched.h>
+#include <xen/types.h>
+#include <asm/p2m.h>
+
+int p2m_set_entry(struct p2m_domain *p2m, gfn_t sgfn, unsigned long nr,
+ mfn_t smfn, p2m_type_t t, p2m_access_t a)
+{
+ BUG_ON("unimplemented");
+ return -EINVAL;
+}
+
+mfn_t p2m_get_entry(struct p2m_domain *p2m, gfn_t gfn, p2m_type_t *t,
+ p2m_access_t *a, unsigned int *page_order, bool *valid)
+{
+ BUG_ON("unimplemented");
+ return INVALID_MFN;
+}
+
+void p2m_dump_info(struct domain *d)
+{
+ BUG_ON("unimplemented");
+}
+
+int p2m_init(struct domain *d)
+{
+ BUG_ON("unimplemented");
+ return -EINVAL;
+}
+
+void p2m_save_state(struct vcpu *p)
+{
+ BUG_ON("unimplemented");
+}
+
+void p2m_restore_state(struct vcpu *n)
+{
+ BUG_ON("unimplemented");
+}
+
+void p2m_final_teardown(struct domain *d)
+{
+ BUG_ON("unimplemented");
+}
+
+bool p2m_resolve_translation_fault(struct domain *d, gfn_t gfn)
+{
+ BUG_ON("unimplemented");
+ return false;
+}
+
+void p2m_flush_vm(struct vcpu *v) {}
+
+int relinquish_p2m_mapping(struct domain *d)
+{
+ return 0;
+}
+
+void p2m_domain_creation_finished(struct domain *d) {}
+
+int p2m_teardown(struct domain *d)
+{
+ return 0;
+}
+
+int p2m_teardown_allocation(struct domain *d)
+{
+ return 0;
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff --git a/xen/arch/arm/mpu/setup.c b/xen/arch/arm/mpu/setup.c
new file mode 100644
index 000000000000..b4da77003f47
--- /dev/null
+++ b/xen/arch/arm/mpu/setup.c
@@ -0,0 +1,40 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#include <xen/bug.h>
+#include <xen/init.h>
+#include <xen/mm.h>
+#include <xen/types.h>
+#include <asm/setup.h>
+
+void __init setup_pagetables(void) {}
+
+void * __init early_fdt_map(paddr_t fdt_paddr)
+{
+ BUG_ON("unimplemented");
+ return NULL;
+}
+
+/*
+ * copy_from_paddr - copy data from a physical address
+ * @dst: destination virtual address
+ * @paddr: source physical address
+ * @len: length to copy
+ */
+void __init copy_from_paddr(void *dst, paddr_t paddr, unsigned long len)
+{
+ BUG_ON("unimplemented");
+}
+
+void __init remove_early_mappings(void)
+{
+ BUG_ON("unimplemented");
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff --git a/xen/arch/arm/mpu/vmap.c b/xen/arch/arm/mpu/vmap.c
new file mode 100644
index 000000000000..f977b79cd436
--- /dev/null
+++ b/xen/arch/arm/mpu/vmap.c
@@ -0,0 +1,26 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#include <xen/bug.h>
+#include <xen/mm-frame.h>
+#include <xen/types.h>
+#include <xen/vmap.h>
+
+void *vmap_contig(mfn_t mfn, unsigned int nr)
+{
+ BUG_ON("unimplemented");
+ return NULL;
+}
+
+void vunmap(const void *va)
+{
+ BUG_ON("unimplemented");
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
--
2.34.1
^ permalink raw reply related [flat|nested] 23+ messages in thread
* Re: [PATCH v3 6/7] xen: introduce Kconfig ARCH_PAGING_MEMPOOL
2025-03-17 20:07 ` [PATCH v3 6/7] xen: introduce Kconfig ARCH_PAGING_MEMPOOL Luca Fancellu
@ 2025-03-18 9:11 ` Orzel, Michal
2025-03-18 13:05 ` Oleksii Kurochko
1 sibling, 0 replies; 23+ messages in thread
From: Orzel, Michal @ 2025-03-18 9:11 UTC (permalink / raw)
To: Luca Fancellu, xen-devel
Cc: Penny Zheng, Stefano Stabellini, Julien Grall, Bertrand Marquis,
Volodymyr Babchuk, Andrew Cooper, Anthony PERARD, Jan Beulich,
Roger Pau Monné, Alistair Francis, Bob Eshleman,
Connor Davis, Oleksii Kurochko, Wei Chen
On 17/03/2025 21:07, Luca Fancellu wrote:
>
>
> From: Penny Zheng <Penny.Zheng@arm.com>
>
> ARM MPU system doesn't need to use paging memory pool, as MPU memory
> mapping table at most takes only one 4KB page, which is enough to
> manage the maximum 255 MPU memory regions, for all EL2 stage 1
> translation and EL1 stage 2 translation.
>
> Introduce ARCH_PAGING_MEMPOOL Kconfig common symbol, selected for Arm
> MMU systems, x86 and RISC-V.
>
> Wrap the code inside 'construct_domU' that deal with p2m paging
> allocation in a new function 'domain_p2m_set_allocation', protected
> by ARCH_PAGING_MEMPOOL, this is done in this way to prevent polluting
> the former function with #ifdefs and improve readability
>
> Introduce arch_{get,set}_paging_mempool_size stubs for architecture
> with !ARCH_PAGING_MEMPOOL.
>
> Remove 'struct paging_domain' from Arm 'struct arch_domain' when the
> field is not required.
>
> Signed-off-by: Penny Zheng <penny.zheng@arm.com>
> Signed-off-by: Wei Chen <wei.chen@arm.com>
> Signed-off-by: Luca Fancellu <luca.fancellu@arm.com>
> ---
> v3 changes:
> - Introduced ARCH_PAGING_MEMPOOL instead of HAS_PAGING_MEMPOOL
> v2 changes:
> - make Kconfig HAS_PAGING_MEMPOOL common
> - protect also "xen,domain-p2m-mem-mb" reading with HAS_PAGING_MEMPOOL
> - do not define p2m_teardown{_allocation} in this patch
> - change commit message
> ---
> xen/arch/arm/Kconfig | 1 +
> xen/arch/arm/dom0less-build.c | 74 ++++++++++++++++++++-----------
> xen/arch/arm/include/asm/domain.h | 2 +
> xen/arch/riscv/Kconfig | 1 +
> xen/arch/x86/Kconfig | 1 +
> xen/common/Kconfig | 3 ++
> xen/include/xen/domain.h | 17 +++++++
> 7 files changed, 73 insertions(+), 26 deletions(-)
>
> diff --git a/xen/arch/arm/Kconfig b/xen/arch/arm/Kconfig
> index 5ac6ec0212d2..a4af0b85f158 100644
> --- a/xen/arch/arm/Kconfig
> +++ b/xen/arch/arm/Kconfig
> @@ -75,6 +75,7 @@ choice
>
> config MMU
> bool "MMU"
> + select ARCH_PAGING_MEMPOOL
> select HAS_LLC_COLORING if !NUMA && ARM_64
> select HAS_PMAP
> select HAS_VMAP
> diff --git a/xen/arch/arm/dom0less-build.c b/xen/arch/arm/dom0less-build.c
> index 573b0d25ae41..6eef6ba91444 100644
> --- a/xen/arch/arm/dom0less-build.c
> +++ b/xen/arch/arm/dom0less-build.c
> @@ -673,21 +673,6 @@ static int __init prepare_dtb_domU(struct domain *d, struct kernel_info *kinfo)
> return -EINVAL;
> }
>
> -static unsigned long __init domain_p2m_pages(unsigned long maxmem_kb,
> - unsigned int smp_cpus)
> -{
> - /*
> - * Keep in sync with libxl__get_required_paging_memory().
> - * 256 pages (1MB) per vcpu, plus 1 page per MiB of RAM for the P2M map,
> - * plus 128 pages to cover extended regions.
> - */
> - unsigned long memkb = 4 * (256 * smp_cpus + (maxmem_kb / 1024) + 128);
> -
> - BUILD_BUG_ON(PAGE_SIZE != SZ_4K);
> -
> - return DIV_ROUND_UP(memkb, 1024) << (20 - PAGE_SHIFT);
> -}
> -
> static int __init alloc_xenstore_evtchn(struct domain *d)
> {
> evtchn_alloc_unbound_t alloc;
> @@ -841,6 +826,53 @@ static void __init domain_vcpu_affinity(struct domain *d,
> }
> }
>
> +#ifdef CONFIG_ARCH_PAGING_MEMPOOL
> +
NIT: here and elsewhere. We don't usually separate code from #idef/#else/#endif
with empty lines.
For Arm:
Reviewed-by: Michal Orzel <michal.orzel@amd.com>
~Michal
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH v3 7/7] arm/mpu: Create the skeleton for MPU compilation
2025-03-17 20:07 ` [PATCH v3 7/7] arm/mpu: Create the skeleton for MPU compilation Luca Fancellu
@ 2025-03-18 9:27 ` Orzel, Michal
0 siblings, 0 replies; 23+ messages in thread
From: Orzel, Michal @ 2025-03-18 9:27 UTC (permalink / raw)
To: Luca Fancellu, xen-devel
Cc: Stefano Stabellini, Julien Grall, Bertrand Marquis,
Volodymyr Babchuk
On 17/03/2025 21:07, Luca Fancellu wrote:
>
>
> This commit introduces the skeleton for the MPU memory management
> subsystem that allows the compilation on Arm64.
>
> Signed-off-by: Luca Fancellu <luca.fancellu@arm.com>
Reviewed-by: Michal Orzel <michal.orzel@amd.com>
~Michal
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH v3 6/7] xen: introduce Kconfig ARCH_PAGING_MEMPOOL
2025-03-17 20:07 ` [PATCH v3 6/7] xen: introduce Kconfig ARCH_PAGING_MEMPOOL Luca Fancellu
2025-03-18 9:11 ` Orzel, Michal
@ 2025-03-18 13:05 ` Oleksii Kurochko
2025-03-19 11:35 ` Jan Beulich
1 sibling, 1 reply; 23+ messages in thread
From: Oleksii Kurochko @ 2025-03-18 13:05 UTC (permalink / raw)
To: Luca Fancellu, xen-devel
Cc: Penny Zheng, Stefano Stabellini, Julien Grall, Bertrand Marquis,
Michal Orzel, Volodymyr Babchuk, Andrew Cooper, Anthony PERARD,
Jan Beulich, Roger Pau Monné, Alistair Francis, Bob Eshleman,
Connor Davis, Wei Chen
[-- Attachment #1: Type: text/plain, Size: 8744 bytes --]
On 3/17/25 9:07 PM, Luca Fancellu wrote:
> From: Penny Zheng<Penny.Zheng@arm.com>
>
> ARM MPU system doesn't need to use paging memory pool, as MPU memory
> mapping table at most takes only one 4KB page, which is enough to
> manage the maximum 255 MPU memory regions, for all EL2 stage 1
> translation and EL1 stage 2 translation.
>
> Introduce ARCH_PAGING_MEMPOOL Kconfig common symbol, selected for Arm
> MMU systems, x86 and RISC-V.
>
> Wrap the code inside 'construct_domU' that deal with p2m paging
> allocation in a new function 'domain_p2m_set_allocation', protected
> by ARCH_PAGING_MEMPOOL, this is done in this way to prevent polluting
> the former function with #ifdefs and improve readability
>
> Introduce arch_{get,set}_paging_mempool_size stubs for architecture
> with !ARCH_PAGING_MEMPOOL.
>
> Remove 'struct paging_domain' from Arm 'struct arch_domain' when the
> field is not required.
>
> Signed-off-by: Penny Zheng<penny.zheng@arm.com>
> Signed-off-by: Wei Chen<wei.chen@arm.com>
> Signed-off-by: Luca Fancellu<luca.fancellu@arm.com>
> ---
> v3 changes:
> - Introduced ARCH_PAGING_MEMPOOL instead of HAS_PAGING_MEMPOOL
> v2 changes:
> - make Kconfig HAS_PAGING_MEMPOOL common
> - protect also "xen,domain-p2m-mem-mb" reading with HAS_PAGING_MEMPOOL
> - do not define p2m_teardown{_allocation} in this patch
> - change commit message
> ---
> xen/arch/arm/Kconfig | 1 +
> xen/arch/arm/dom0less-build.c | 74 ++++++++++++++++++++-----------
> xen/arch/arm/include/asm/domain.h | 2 +
> xen/arch/riscv/Kconfig | 1 +
> xen/arch/x86/Kconfig | 1 +
> xen/common/Kconfig | 3 ++
> xen/include/xen/domain.h | 17 +++++++
> 7 files changed, 73 insertions(+), 26 deletions(-)
For RISC-V:
Reviewed-by: Oleksii Kurochko<oleksii.kurochko@gmail.com>
Thanks.
~ Oleksii
>
> diff --git a/xen/arch/arm/Kconfig b/xen/arch/arm/Kconfig
> index 5ac6ec0212d2..a4af0b85f158 100644
> --- a/xen/arch/arm/Kconfig
> +++ b/xen/arch/arm/Kconfig
> @@ -75,6 +75,7 @@ choice
>
> config MMU
> bool "MMU"
> + select ARCH_PAGING_MEMPOOL
> select HAS_LLC_COLORING if !NUMA && ARM_64
> select HAS_PMAP
> select HAS_VMAP
> diff --git a/xen/arch/arm/dom0less-build.c b/xen/arch/arm/dom0less-build.c
> index 573b0d25ae41..6eef6ba91444 100644
> --- a/xen/arch/arm/dom0less-build.c
> +++ b/xen/arch/arm/dom0less-build.c
> @@ -673,21 +673,6 @@ static int __init prepare_dtb_domU(struct domain *d, struct kernel_info *kinfo)
> return -EINVAL;
> }
>
> -static unsigned long __init domain_p2m_pages(unsigned long maxmem_kb,
> - unsigned int smp_cpus)
> -{
> - /*
> - * Keep in sync with libxl__get_required_paging_memory().
> - * 256 pages (1MB) per vcpu, plus 1 page per MiB of RAM for the P2M map,
> - * plus 128 pages to cover extended regions.
> - */
> - unsigned long memkb = 4 * (256 * smp_cpus + (maxmem_kb / 1024) + 128);
> -
> - BUILD_BUG_ON(PAGE_SIZE != SZ_4K);
> -
> - return DIV_ROUND_UP(memkb, 1024) << (20 - PAGE_SHIFT);
> -}
> -
> static int __init alloc_xenstore_evtchn(struct domain *d)
> {
> evtchn_alloc_unbound_t alloc;
> @@ -841,6 +826,53 @@ static void __init domain_vcpu_affinity(struct domain *d,
> }
> }
>
> +#ifdef CONFIG_ARCH_PAGING_MEMPOOL
> +
> +static unsigned long __init domain_p2m_pages(unsigned long maxmem_kb,
> + unsigned int smp_cpus)
> +{
> + /*
> + * Keep in sync with libxl__get_required_paging_memory().
> + * 256 pages (1MB) per vcpu, plus 1 page per MiB of RAM for the P2M map,
> + * plus 128 pages to cover extended regions.
> + */
> + unsigned long memkb = 4 * (256 * smp_cpus + (maxmem_kb / 1024) + 128);
> +
> + BUILD_BUG_ON(PAGE_SIZE != SZ_4K);
> +
> + return DIV_ROUND_UP(memkb, 1024) << (20 - PAGE_SHIFT);
> +}
> +
> +static int __init domain_p2m_set_allocation(struct domain *d, uint64_t mem,
> + const struct dt_device_node *node)
> +{
> + unsigned long p2m_pages;
> + uint32_t p2m_mem_mb;
> + int rc;
> +
> + rc = dt_property_read_u32(node, "xen,domain-p2m-mem-mb", &p2m_mem_mb);
> + /* If xen,domain-p2m-mem-mb is not specified, use the default value. */
> + p2m_pages = rc ?
> + p2m_mem_mb << (20 - PAGE_SHIFT) :
> + domain_p2m_pages(mem, d->max_vcpus);
> +
> + spin_lock(&d->arch.paging.lock);
> + rc = p2m_set_allocation(d, p2m_pages, NULL);
> + spin_unlock(&d->arch.paging.lock);
> +
> + return rc;
> +}
> +
> +#else /* !CONFIG_ARCH_PAGING_MEMPOOL */
> +
> +static inline int domain_p2m_set_allocation(struct domain *d, uint64_t mem,
> + const struct dt_device_node *node)
> +{
> + return 0;
> +}
> +
> +#endif /* CONFIG_ARCH_PAGING_MEMPOOL */
> +
> static int __init construct_domU(struct domain *d,
> const struct dt_device_node *node)
> {
> @@ -848,8 +880,6 @@ static int __init construct_domU(struct domain *d,
> const char *dom0less_enhanced;
> int rc;
> u64 mem;
> - u32 p2m_mem_mb;
> - unsigned long p2m_pages;
>
> rc = dt_property_read_u64(node, "memory", &mem);
> if ( !rc )
> @@ -859,15 +889,7 @@ static int __init construct_domU(struct domain *d,
> }
> kinfo.unassigned_mem = (paddr_t)mem * SZ_1K;
>
> - rc = dt_property_read_u32(node, "xen,domain-p2m-mem-mb", &p2m_mem_mb);
> - /* If xen,domain-p2m-mem-mb is not specified, use the default value. */
> - p2m_pages = rc ?
> - p2m_mem_mb << (20 - PAGE_SHIFT) :
> - domain_p2m_pages(mem, d->max_vcpus);
> -
> - spin_lock(&d->arch.paging.lock);
> - rc = p2m_set_allocation(d, p2m_pages, NULL);
> - spin_unlock(&d->arch.paging.lock);
> + rc = domain_p2m_set_allocation(d, mem, node);
> if ( rc != 0 )
> return rc;
>
> diff --git a/xen/arch/arm/include/asm/domain.h b/xen/arch/arm/include/asm/domain.h
> index 50b6a4b00982..a3487ca71303 100644
> --- a/xen/arch/arm/include/asm/domain.h
> +++ b/xen/arch/arm/include/asm/domain.h
> @@ -75,7 +75,9 @@ struct arch_domain
>
> struct hvm_domain hvm;
>
> +#ifdef CONFIG_ARCH_PAGING_MEMPOOL
> struct paging_domain paging;
> +#endif
>
> struct vmmio vmmio;
>
> diff --git a/xen/arch/riscv/Kconfig b/xen/arch/riscv/Kconfig
> index d882e0a0598d..1bd8ae16dc65 100644
> --- a/xen/arch/riscv/Kconfig
> +++ b/xen/arch/riscv/Kconfig
> @@ -1,5 +1,6 @@
> config RISCV
> def_bool y
> + select ARCH_PAGING_MEMPOOL
> select FUNCTION_ALIGNMENT_16B
> select GENERIC_BUG_FRAME
> select HAS_DEVICE_TREE
> diff --git a/xen/arch/x86/Kconfig b/xen/arch/x86/Kconfig
> index f08679959440..f6aa892661b4 100644
> --- a/xen/arch/x86/Kconfig
> +++ b/xen/arch/x86/Kconfig
> @@ -9,6 +9,7 @@ config X86
> select ACPI_NUMA
> select ALTERNATIVE_CALL
> select ARCH_MAP_DOMAIN_PAGE
> + select ARCH_PAGING_MEMPOOL
> select ARCH_SUPPORTS_INT128
> imply CORE_PARKING
> select FUNCTION_ALIGNMENT_16B
> diff --git a/xen/common/Kconfig b/xen/common/Kconfig
> index a6aa2c5c1456..218357d593b7 100644
> --- a/xen/common/Kconfig
> +++ b/xen/common/Kconfig
> @@ -44,6 +44,9 @@ config ALTERNATIVE_CALL
> config ARCH_MAP_DOMAIN_PAGE
> bool
>
> +config ARCH_PAGING_MEMPOOL
> + bool
> +
> config GENERIC_BUG_FRAME
> bool
>
> diff --git a/xen/include/xen/domain.h b/xen/include/xen/domain.h
> index 83069de50118..a34daa7d10ab 100644
> --- a/xen/include/xen/domain.h
> +++ b/xen/include/xen/domain.h
> @@ -2,6 +2,7 @@
> #ifndef __XEN_DOMAIN_H__
> #define __XEN_DOMAIN_H__
>
> +#include <xen/errno.h>
> #include <xen/numa.h>
> #include <xen/types.h>
>
> @@ -114,9 +115,25 @@ void arch_get_info_guest(struct vcpu *v, vcpu_guest_context_u c);
> int arch_initialise_vcpu(struct vcpu *v, XEN_GUEST_HANDLE_PARAM(void) arg);
> int default_initialise_vcpu(struct vcpu *v, XEN_GUEST_HANDLE_PARAM(void) arg);
>
> +#ifdef CONFIG_ARCH_PAGING_MEMPOOL
> +
> int arch_get_paging_mempool_size(struct domain *d, uint64_t *size /* bytes */);
> int arch_set_paging_mempool_size(struct domain *d, uint64_t size /* bytes */);
>
> +#else /* !CONFIG_ARCH_PAGING_MEMPOOL */
> +
> +static inline int arch_get_paging_mempool_size(struct domain *d, uint64_t *size)
> +{
> + return -EOPNOTSUPP;
> +}
> +
> +static inline int arch_set_paging_mempool_size(struct domain *d, uint64_t size)
> +{
> + return -EOPNOTSUPP;
> +}
> +
> +#endif /* CONFIG_ARCH_PAGING_MEMPOOL */
> +
> bool update_runstate_area(struct vcpu *v);
>
> int domain_relinquish_resources(struct domain *d);
[-- Attachment #2: Type: text/html, Size: 9222 bytes --]
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH v3 6/7] xen: introduce Kconfig ARCH_PAGING_MEMPOOL
2025-03-18 13:05 ` Oleksii Kurochko
@ 2025-03-19 11:35 ` Jan Beulich
2025-03-19 12:18 ` Luca Fancellu
2025-03-19 16:31 ` Oleksii Kurochko
0 siblings, 2 replies; 23+ messages in thread
From: Jan Beulich @ 2025-03-19 11:35 UTC (permalink / raw)
To: Oleksii Kurochko, Luca Fancellu
Cc: Penny Zheng, Stefano Stabellini, Julien Grall, Bertrand Marquis,
Michal Orzel, Volodymyr Babchuk, Andrew Cooper, Anthony PERARD,
Roger Pau Monné, Alistair Francis, Bob Eshleman,
Connor Davis, Wei Chen, xen-devel
On 18.03.2025 14:05, Oleksii Kurochko wrote:
>
> On 3/17/25 9:07 PM, Luca Fancellu wrote:
>> From: Penny Zheng<Penny.Zheng@arm.com>
>>
>> ARM MPU system doesn't need to use paging memory pool, as MPU memory
>> mapping table at most takes only one 4KB page, which is enough to
>> manage the maximum 255 MPU memory regions, for all EL2 stage 1
>> translation and EL1 stage 2 translation.
>>
>> Introduce ARCH_PAGING_MEMPOOL Kconfig common symbol, selected for Arm
>> MMU systems, x86 and RISC-V.
>>
>> Wrap the code inside 'construct_domU' that deal with p2m paging
>> allocation in a new function 'domain_p2m_set_allocation', protected
>> by ARCH_PAGING_MEMPOOL, this is done in this way to prevent polluting
>> the former function with #ifdefs and improve readability
>>
>> Introduce arch_{get,set}_paging_mempool_size stubs for architecture
>> with !ARCH_PAGING_MEMPOOL.
>>
>> Remove 'struct paging_domain' from Arm 'struct arch_domain' when the
>> field is not required.
>>
>> Signed-off-by: Penny Zheng<penny.zheng@arm.com>
>> Signed-off-by: Wei Chen<wei.chen@arm.com>
>> Signed-off-by: Luca Fancellu<luca.fancellu@arm.com>
>> ---
>> v3 changes:
>> - Introduced ARCH_PAGING_MEMPOOL instead of HAS_PAGING_MEMPOOL
>> v2 changes:
>> - make Kconfig HAS_PAGING_MEMPOOL common
>> - protect also "xen,domain-p2m-mem-mb" reading with HAS_PAGING_MEMPOOL
>> - do not define p2m_teardown{_allocation} in this patch
>> - change commit message
>> ---
>> xen/arch/arm/Kconfig | 1 +
>> xen/arch/arm/dom0less-build.c | 74 ++++++++++++++++++++-----------
>> xen/arch/arm/include/asm/domain.h | 2 +
>> xen/arch/riscv/Kconfig | 1 +
>> xen/arch/x86/Kconfig | 1 +
>> xen/common/Kconfig | 3 ++
>> xen/include/xen/domain.h | 17 +++++++
>> 7 files changed, 73 insertions(+), 26 deletions(-)
>
> For RISC-V:
> Reviewed-by: Oleksii Kurochko<oleksii.kurochko@gmail.com>
Mind me asking then why RISC-V needs this at this point? The stubs surely
were added to address some build issue, not because they are actively
meaningful?
Jan
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH v3 6/7] xen: introduce Kconfig ARCH_PAGING_MEMPOOL
2025-03-19 11:35 ` Jan Beulich
@ 2025-03-19 12:18 ` Luca Fancellu
2025-03-19 12:24 ` Luca Fancellu
2025-03-19 12:26 ` Luca Fancellu
2025-03-19 16:31 ` Oleksii Kurochko
1 sibling, 2 replies; 23+ messages in thread
From: Luca Fancellu @ 2025-03-19 12:18 UTC (permalink / raw)
To: Jan Beulich
Cc: Oleksii Kurochko, Penny Zheng, Stefano Stabellini, Julien Grall,
Bertrand Marquis, Michal Orzel, Volodymyr Babchuk, Andrew Cooper,
Anthony PERARD, Roger Pau Monné, Alistair Francis,
Bob Eshleman, Connor Davis, Wei Chen,
xen-devel@lists.xenproject.org
Hi Jan,
> On 19 Mar 2025, at 11:35, Jan Beulich <jbeulich@suse.com> wrote:
>
> On 18.03.2025 14:05, Oleksii Kurochko wrote:
>>
>> On 3/17/25 9:07 PM, Luca Fancellu wrote:
>>> From: Penny Zheng<Penny.Zheng@arm.com>
>>>
>>> ARM MPU system doesn't need to use paging memory pool, as MPU memory
>>> mapping table at most takes only one 4KB page, which is enough to
>>> manage the maximum 255 MPU memory regions, for all EL2 stage 1
>>> translation and EL1 stage 2 translation.
>>>
>>> Introduce ARCH_PAGING_MEMPOOL Kconfig common symbol, selected for Arm
>>> MMU systems, x86 and RISC-V.
>>>
>>> Wrap the code inside 'construct_domU' that deal with p2m paging
>>> allocation in a new function 'domain_p2m_set_allocation', protected
>>> by ARCH_PAGING_MEMPOOL, this is done in this way to prevent polluting
>>> the former function with #ifdefs and improve readability
>>>
>>> Introduce arch_{get,set}_paging_mempool_size stubs for architecture
>>> with !ARCH_PAGING_MEMPOOL.
>>>
>>> Remove 'struct paging_domain' from Arm 'struct arch_domain' when the
>>> field is not required.
>>>
>>> Signed-off-by: Penny Zheng<penny.zheng@arm.com>
>>> Signed-off-by: Wei Chen<wei.chen@arm.com>
>>> Signed-off-by: Luca Fancellu<luca.fancellu@arm.com>
>>> ---
>>> v3 changes:
>>> - Introduced ARCH_PAGING_MEMPOOL instead of HAS_PAGING_MEMPOOL
>>> v2 changes:
>>> - make Kconfig HAS_PAGING_MEMPOOL common
>>> - protect also "xen,domain-p2m-mem-mb" reading with HAS_PAGING_MEMPOOL
>>> - do not define p2m_teardown{_allocation} in this patch
>>> - change commit message
>>> ---
>>> xen/arch/arm/Kconfig | 1 +
>>> xen/arch/arm/dom0less-build.c | 74 ++++++++++++++++++++-----------
>>> xen/arch/arm/include/asm/domain.h | 2 +
>>> xen/arch/riscv/Kconfig | 1 +
>>> xen/arch/x86/Kconfig | 1 +
>>> xen/common/Kconfig | 3 ++
>>> xen/include/xen/domain.h | 17 +++++++
>>> 7 files changed, 73 insertions(+), 26 deletions(-)
>>
>> For RISC-V:
>> Reviewed-by: Oleksii Kurochko<oleksii.kurochko@gmail.com>
>
> Mind me asking then why RISC-V needs this at this point? The stubs surely
> were added to address some build issue, not because they are actively
> meaningful?
sorry I’m not a RISC-V expert, I saw the stub and I thought the architecture wanted to have them implemented.
If not, is it possible to let the RISC-V people handle that separately? I’ll be off until 31st of March and this patch is
useful for Ayan to introduce a building status for arm32.
Cheers,
Luca
>
> Jan
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH v3 6/7] xen: introduce Kconfig ARCH_PAGING_MEMPOOL
2025-03-19 12:18 ` Luca Fancellu
@ 2025-03-19 12:24 ` Luca Fancellu
2025-03-19 12:26 ` Luca Fancellu
1 sibling, 0 replies; 23+ messages in thread
From: Luca Fancellu @ 2025-03-19 12:24 UTC (permalink / raw)
To: Jan Beulich
Cc: Oleksii Kurochko, Penny Zheng, Stefano Stabellini, Julien Grall,
Bertrand Marquis, Michal Orzel, Volodymyr Babchuk, Andrew Cooper,
Anthony PERARD, Roger Pau Monné, Alistair Francis,
Bob Eshleman, Connor Davis, Wei Chen,
xen-devel@lists.xenproject.org
> On 19 Mar 2025, at 12:18, Luca Fancellu <Luca.Fancellu@arm.com> wrote:
>
> Hi Jan,
>
>> On 19 Mar 2025, at 11:35, Jan Beulich <jbeulich@suse.com> wrote:
>>
>> On 18.03.2025 14:05, Oleksii Kurochko wrote:
>>>
>>> On 3/17/25 9:07 PM, Luca Fancellu wrote:
>>>> From: Penny Zheng<Penny.Zheng@arm.com>
>>>>
>>>> ARM MPU system doesn't need to use paging memory pool, as MPU memory
>>>> mapping table at most takes only one 4KB page, which is enough to
>>>> manage the maximum 255 MPU memory regions, for all EL2 stage 1
>>>> translation and EL1 stage 2 translation.
>>>>
>>>> Introduce ARCH_PAGING_MEMPOOL Kconfig common symbol, selected for Arm
>>>> MMU systems, x86 and RISC-V.
>>>>
>>>> Wrap the code inside 'construct_domU' that deal with p2m paging
>>>> allocation in a new function 'domain_p2m_set_allocation', protected
>>>> by ARCH_PAGING_MEMPOOL, this is done in this way to prevent polluting
>>>> the former function with #ifdefs and improve readability
>>>>
>>>> Introduce arch_{get,set}_paging_mempool_size stubs for architecture
>>>> with !ARCH_PAGING_MEMPOOL.
>>>>
>>>> Remove 'struct paging_domain' from Arm 'struct arch_domain' when the
>>>> field is not required.
>>>>
>>>> Signed-off-by: Penny Zheng<penny.zheng@arm.com>
>>>> Signed-off-by: Wei Chen<wei.chen@arm.com>
>>>> Signed-off-by: Luca Fancellu<luca.fancellu@arm.com>
>>>> ---
>>>> v3 changes:
>>>> - Introduced ARCH_PAGING_MEMPOOL instead of HAS_PAGING_MEMPOOL
>>>> v2 changes:
>>>> - make Kconfig HAS_PAGING_MEMPOOL common
>>>> - protect also "xen,domain-p2m-mem-mb" reading with HAS_PAGING_MEMPOOL
>>>> - do not define p2m_teardown{_allocation} in this patch
>>>> - change commit message
>>>> ---
>>>> xen/arch/arm/Kconfig | 1 +
>>>> xen/arch/arm/dom0less-build.c | 74 ++++++++++++++++++++-----------
>>>> xen/arch/arm/include/asm/domain.h | 2 +
>>>> xen/arch/riscv/Kconfig | 1 +
>>>> xen/arch/x86/Kconfig | 1 +
>>>> xen/common/Kconfig | 3 ++
>>>> xen/include/xen/domain.h | 17 +++++++
>>>> 7 files changed, 73 insertions(+), 26 deletions(-)
>>>
>>> For RISC-V:
>>> Reviewed-by: Oleksii Kurochko<oleksii.kurochko@gmail.com>
>>
>> Mind me asking then why RISC-V needs this at this point? The stubs surely
>> were added to address some build issue, not because they are actively
>> meaningful?
>
> sorry I’m not a RISC-V expert, I saw the stub and I thought the architecture wanted to have them implemented.
>
> If not, is it possible to let the RISC-V people handle that separately? I’ll be off until 31st of March and this patch is
> useful for Ayan to introduce a building status for arm32.
Oh, apologies I didn’t see you were replying to Oleksii, anyway if possible and you are ok with this patch,
I would ask the above.
>
> Cheers,
> Luca
>
>>
>> Jan
>
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH v3 6/7] xen: introduce Kconfig ARCH_PAGING_MEMPOOL
2025-03-19 12:18 ` Luca Fancellu
2025-03-19 12:24 ` Luca Fancellu
@ 2025-03-19 12:26 ` Luca Fancellu
1 sibling, 0 replies; 23+ messages in thread
From: Luca Fancellu @ 2025-03-19 12:26 UTC (permalink / raw)
To: Jan Beulich
Cc: Oleksii Kurochko, Penny Zheng, Stefano Stabellini, Julien Grall,
Bertrand Marquis, Michal Orzel, Volodymyr Babchuk, Andrew Cooper,
Anthony PERARD, Roger Pau Monné, Alistair Francis,
Bob Eshleman, Connor Davis, Wei Chen,
xen-devel@lists.xenproject.org
> On 19 Mar 2025, at 12:18, Luca Fancellu <Luca.Fancellu@arm.com> wrote:
>
> Hi Jan,
>
>> On 19 Mar 2025, at 11:35, Jan Beulich <jbeulich@suse.com> wrote:
>>
>> On 18.03.2025 14:05, Oleksii Kurochko wrote:
>>>
>>> On 3/17/25 9:07 PM, Luca Fancellu wrote:
>>>> From: Penny Zheng<Penny.Zheng@arm.com>
>>>>
>>>> ARM MPU system doesn't need to use paging memory pool, as MPU memory
>>>> mapping table at most takes only one 4KB page, which is enough to
>>>> manage the maximum 255 MPU memory regions, for all EL2 stage 1
>>>> translation and EL1 stage 2 translation.
>>>>
>>>> Introduce ARCH_PAGING_MEMPOOL Kconfig common symbol, selected for Arm
>>>> MMU systems, x86 and RISC-V.
>>>>
>>>> Wrap the code inside 'construct_domU' that deal with p2m paging
>>>> allocation in a new function 'domain_p2m_set_allocation', protected
>>>> by ARCH_PAGING_MEMPOOL, this is done in this way to prevent polluting
>>>> the former function with #ifdefs and improve readability
>>>>
>>>> Introduce arch_{get,set}_paging_mempool_size stubs for architecture
>>>> with !ARCH_PAGING_MEMPOOL.
>>>>
>>>> Remove 'struct paging_domain' from Arm 'struct arch_domain' when the
>>>> field is not required.
>>>>
>>>> Signed-off-by: Penny Zheng<penny.zheng@arm.com>
>>>> Signed-off-by: Wei Chen<wei.chen@arm.com>
>>>> Signed-off-by: Luca Fancellu<luca.fancellu@arm.com>
>>>> ---
>>>> v3 changes:
>>>> - Introduced ARCH_PAGING_MEMPOOL instead of HAS_PAGING_MEMPOOL
>>>> v2 changes:
>>>> - make Kconfig HAS_PAGING_MEMPOOL common
>>>> - protect also "xen,domain-p2m-mem-mb" reading with HAS_PAGING_MEMPOOL
>>>> - do not define p2m_teardown{_allocation} in this patch
>>>> - change commit message
>>>> ---
>>>> xen/arch/arm/Kconfig | 1 +
>>>> xen/arch/arm/dom0less-build.c | 74 ++++++++++++++++++++-----------
>>>> xen/arch/arm/include/asm/domain.h | 2 +
>>>> xen/arch/riscv/Kconfig | 1 +
>>>> xen/arch/x86/Kconfig | 1 +
>>>> xen/common/Kconfig | 3 ++
>>>> xen/include/xen/domain.h | 17 +++++++
>>>> 7 files changed, 73 insertions(+), 26 deletions(-)
>>>
>>> For RISC-V:
>>> Reviewed-by: Oleksii Kurochko<oleksii.kurochko@gmail.com>
>>
>> Mind me asking then why RISC-V needs this at this point? The stubs surely
>> were added to address some build issue, not because they are actively
>> meaningful?
>
> sorry I’m not a RISC-V expert, I saw the stub and I thought the architecture wanted to have them implemented.
>
> If not, is it possible to let the RISC-V people handle that separately? I’ll be off until 31st of March and this patch is
> useful for Ayan to introduce a building status for arm32.
Oh, apologies I didn’t see you were replying to Oleksii, anyway if possible and you are ok with this patch,
I would ask the above.
>
> Cheers,
> Luca
>
>>
>> Jan
>
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH v3 6/7] xen: introduce Kconfig ARCH_PAGING_MEMPOOL
2025-03-19 11:35 ` Jan Beulich
2025-03-19 12:18 ` Luca Fancellu
@ 2025-03-19 16:31 ` Oleksii Kurochko
2025-03-20 7:32 ` Jan Beulich
1 sibling, 1 reply; 23+ messages in thread
From: Oleksii Kurochko @ 2025-03-19 16:31 UTC (permalink / raw)
To: Jan Beulich, Luca Fancellu
Cc: Penny Zheng, Stefano Stabellini, Julien Grall, Bertrand Marquis,
Michal Orzel, Volodymyr Babchuk, Andrew Cooper, Anthony PERARD,
Roger Pau Monné, Alistair Francis, Bob Eshleman,
Connor Davis, Wei Chen, xen-devel
[-- Attachment #1: Type: text/plain, Size: 2465 bytes --]
On 3/19/25 12:35 PM, Jan Beulich wrote:
> On 18.03.2025 14:05, Oleksii Kurochko wrote:
>> On 3/17/25 9:07 PM, Luca Fancellu wrote:
>>> From: Penny Zheng<Penny.Zheng@arm.com>
>>>
>>> ARM MPU system doesn't need to use paging memory pool, as MPU memory
>>> mapping table at most takes only one 4KB page, which is enough to
>>> manage the maximum 255 MPU memory regions, for all EL2 stage 1
>>> translation and EL1 stage 2 translation.
>>>
>>> Introduce ARCH_PAGING_MEMPOOL Kconfig common symbol, selected for Arm
>>> MMU systems, x86 and RISC-V.
>>>
>>> Wrap the code inside 'construct_domU' that deal with p2m paging
>>> allocation in a new function 'domain_p2m_set_allocation', protected
>>> by ARCH_PAGING_MEMPOOL, this is done in this way to prevent polluting
>>> the former function with #ifdefs and improve readability
>>>
>>> Introduce arch_{get,set}_paging_mempool_size stubs for architecture
>>> with !ARCH_PAGING_MEMPOOL.
>>>
>>> Remove 'struct paging_domain' from Arm 'struct arch_domain' when the
>>> field is not required.
>>>
>>> Signed-off-by: Penny Zheng<penny.zheng@arm.com>
>>> Signed-off-by: Wei Chen<wei.chen@arm.com>
>>> Signed-off-by: Luca Fancellu<luca.fancellu@arm.com>
>>> ---
>>> v3 changes:
>>> - Introduced ARCH_PAGING_MEMPOOL instead of HAS_PAGING_MEMPOOL
>>> v2 changes:
>>> - make Kconfig HAS_PAGING_MEMPOOL common
>>> - protect also "xen,domain-p2m-mem-mb" reading with HAS_PAGING_MEMPOOL
>>> - do not define p2m_teardown{_allocation} in this patch
>>> - change commit message
>>> ---
>>> xen/arch/arm/Kconfig | 1 +
>>> xen/arch/arm/dom0less-build.c | 74 ++++++++++++++++++++-----------
>>> xen/arch/arm/include/asm/domain.h | 2 +
>>> xen/arch/riscv/Kconfig | 1 +
>>> xen/arch/x86/Kconfig | 1 +
>>> xen/common/Kconfig | 3 ++
>>> xen/include/xen/domain.h | 17 +++++++
>>> 7 files changed, 73 insertions(+), 26 deletions(-)
>> For RISC-V:
>> Reviewed-by: Oleksii Kurochko<oleksii.kurochko@gmail.com>
> Mind me asking then why RISC-V needs this at this point? The stubs surely
> were added to address some build issue, not because they are actively
> meaningful?
Only because we have stubs and not to have redefinition compilation
error. And, yes, they are not actively meaningful now, at least. I am
okay with not enabling of this config for RISC-V but then seems to me we
have to drop stubs in riscv/stubs.c. ~ Oleksii
[-- Attachment #2: Type: text/html, Size: 3678 bytes --]
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH v3 6/7] xen: introduce Kconfig ARCH_PAGING_MEMPOOL
2025-03-19 16:31 ` Oleksii Kurochko
@ 2025-03-20 7:32 ` Jan Beulich
2025-03-26 9:39 ` Orzel, Michal
0 siblings, 1 reply; 23+ messages in thread
From: Jan Beulich @ 2025-03-20 7:32 UTC (permalink / raw)
To: Oleksii Kurochko, Luca Fancellu
Cc: Penny Zheng, Stefano Stabellini, Julien Grall, Bertrand Marquis,
Michal Orzel, Volodymyr Babchuk, Andrew Cooper, Anthony PERARD,
Roger Pau Monné, Alistair Francis, Bob Eshleman,
Connor Davis, Wei Chen, xen-devel
On 19.03.2025 17:31, Oleksii Kurochko wrote:
>
> On 3/19/25 12:35 PM, Jan Beulich wrote:
>> On 18.03.2025 14:05, Oleksii Kurochko wrote:
>>> On 3/17/25 9:07 PM, Luca Fancellu wrote:
>>>> From: Penny Zheng<Penny.Zheng@arm.com>
>>>>
>>>> ARM MPU system doesn't need to use paging memory pool, as MPU memory
>>>> mapping table at most takes only one 4KB page, which is enough to
>>>> manage the maximum 255 MPU memory regions, for all EL2 stage 1
>>>> translation and EL1 stage 2 translation.
>>>>
>>>> Introduce ARCH_PAGING_MEMPOOL Kconfig common symbol, selected for Arm
>>>> MMU systems, x86 and RISC-V.
>>>>
>>>> Wrap the code inside 'construct_domU' that deal with p2m paging
>>>> allocation in a new function 'domain_p2m_set_allocation', protected
>>>> by ARCH_PAGING_MEMPOOL, this is done in this way to prevent polluting
>>>> the former function with #ifdefs and improve readability
>>>>
>>>> Introduce arch_{get,set}_paging_mempool_size stubs for architecture
>>>> with !ARCH_PAGING_MEMPOOL.
>>>>
>>>> Remove 'struct paging_domain' from Arm 'struct arch_domain' when the
>>>> field is not required.
>>>>
>>>> Signed-off-by: Penny Zheng<penny.zheng@arm.com>
>>>> Signed-off-by: Wei Chen<wei.chen@arm.com>
>>>> Signed-off-by: Luca Fancellu<luca.fancellu@arm.com>
>>>> ---
>>>> v3 changes:
>>>> - Introduced ARCH_PAGING_MEMPOOL instead of HAS_PAGING_MEMPOOL
>>>> v2 changes:
>>>> - make Kconfig HAS_PAGING_MEMPOOL common
>>>> - protect also "xen,domain-p2m-mem-mb" reading with HAS_PAGING_MEMPOOL
>>>> - do not define p2m_teardown{_allocation} in this patch
>>>> - change commit message
>>>> ---
>>>> xen/arch/arm/Kconfig | 1 +
>>>> xen/arch/arm/dom0less-build.c | 74 ++++++++++++++++++++-----------
>>>> xen/arch/arm/include/asm/domain.h | 2 +
>>>> xen/arch/riscv/Kconfig | 1 +
>>>> xen/arch/x86/Kconfig | 1 +
>>>> xen/common/Kconfig | 3 ++
>>>> xen/include/xen/domain.h | 17 +++++++
>>>> 7 files changed, 73 insertions(+), 26 deletions(-)
>>> For RISC-V:
>>> Reviewed-by: Oleksii Kurochko<oleksii.kurochko@gmail.com>
>> Mind me asking then why RISC-V needs this at this point? The stubs surely
>> were added to address some build issue, not because they are actively
>> meaningful?
>
> Only because we have stubs and not to have redefinition compilation
> error. And, yes, they are not actively meaningful now, at least. I am
> okay with not enabling of this config for RISC-V but then seems to me we
> have to drop stubs in riscv/stubs.c. ~ Oleksii
Well, I don't think it's "have to", but I agree that dropping them would
make sense then (and be desirable).
Jan
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH v3 6/7] xen: introduce Kconfig ARCH_PAGING_MEMPOOL
2025-03-20 7:32 ` Jan Beulich
@ 2025-03-26 9:39 ` Orzel, Michal
2025-03-26 9:46 ` Oleksii Kurochko
2025-03-26 9:54 ` Jan Beulich
0 siblings, 2 replies; 23+ messages in thread
From: Orzel, Michal @ 2025-03-26 9:39 UTC (permalink / raw)
To: Jan Beulich, Oleksii Kurochko, Luca Fancellu
Cc: Penny Zheng, Stefano Stabellini, Julien Grall, Bertrand Marquis,
Volodymyr Babchuk, Andrew Cooper, Anthony PERARD,
Roger Pau Monné, Alistair Francis, Bob Eshleman,
Connor Davis, Wei Chen, xen-devel
On 20/03/2025 08:32, Jan Beulich wrote:
>
>
> On 19.03.2025 17:31, Oleksii Kurochko wrote:
>>
>> On 3/19/25 12:35 PM, Jan Beulich wrote:
>>> On 18.03.2025 14:05, Oleksii Kurochko wrote:
>>>> On 3/17/25 9:07 PM, Luca Fancellu wrote:
>>>>> From: Penny Zheng<Penny.Zheng@arm.com>
>>>>>
>>>>> ARM MPU system doesn't need to use paging memory pool, as MPU memory
>>>>> mapping table at most takes only one 4KB page, which is enough to
>>>>> manage the maximum 255 MPU memory regions, for all EL2 stage 1
>>>>> translation and EL1 stage 2 translation.
>>>>>
>>>>> Introduce ARCH_PAGING_MEMPOOL Kconfig common symbol, selected for Arm
>>>>> MMU systems, x86 and RISC-V.
>>>>>
>>>>> Wrap the code inside 'construct_domU' that deal with p2m paging
>>>>> allocation in a new function 'domain_p2m_set_allocation', protected
>>>>> by ARCH_PAGING_MEMPOOL, this is done in this way to prevent polluting
>>>>> the former function with #ifdefs and improve readability
>>>>>
>>>>> Introduce arch_{get,set}_paging_mempool_size stubs for architecture
>>>>> with !ARCH_PAGING_MEMPOOL.
>>>>>
>>>>> Remove 'struct paging_domain' from Arm 'struct arch_domain' when the
>>>>> field is not required.
>>>>>
>>>>> Signed-off-by: Penny Zheng<penny.zheng@arm.com>
>>>>> Signed-off-by: Wei Chen<wei.chen@arm.com>
>>>>> Signed-off-by: Luca Fancellu<luca.fancellu@arm.com>
>>>>> ---
>>>>> v3 changes:
>>>>> - Introduced ARCH_PAGING_MEMPOOL instead of HAS_PAGING_MEMPOOL
>>>>> v2 changes:
>>>>> - make Kconfig HAS_PAGING_MEMPOOL common
>>>>> - protect also "xen,domain-p2m-mem-mb" reading with HAS_PAGING_MEMPOOL
>>>>> - do not define p2m_teardown{_allocation} in this patch
>>>>> - change commit message
>>>>> ---
>>>>> xen/arch/arm/Kconfig | 1 +
>>>>> xen/arch/arm/dom0less-build.c | 74 ++++++++++++++++++++-----------
>>>>> xen/arch/arm/include/asm/domain.h | 2 +
>>>>> xen/arch/riscv/Kconfig | 1 +
>>>>> xen/arch/x86/Kconfig | 1 +
>>>>> xen/common/Kconfig | 3 ++
>>>>> xen/include/xen/domain.h | 17 +++++++
>>>>> 7 files changed, 73 insertions(+), 26 deletions(-)
>>>> For RISC-V:
>>>> Reviewed-by: Oleksii Kurochko<oleksii.kurochko@gmail.com>
>>> Mind me asking then why RISC-V needs this at this point? The stubs surely
>>> were added to address some build issue, not because they are actively
>>> meaningful?
>>
>> Only because we have stubs and not to have redefinition compilation
>> error. And, yes, they are not actively meaningful now, at least. I am
>> okay with not enabling of this config for RISC-V but then seems to me we
>> have to drop stubs in riscv/stubs.c. ~ Oleksii
>
> Well, I don't think it's "have to", but I agree that dropping them would
> make sense then (and be desirable).
@Jan, @Oleksii, is there anything blocking this patch to be committed (Luca
question does not seem to be answered)? Other patches in the series are ready to
be merged.
~Michal
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH v3 6/7] xen: introduce Kconfig ARCH_PAGING_MEMPOOL
2025-03-26 9:39 ` Orzel, Michal
@ 2025-03-26 9:46 ` Oleksii Kurochko
2025-03-26 9:53 ` Orzel, Michal
2025-03-26 9:54 ` Jan Beulich
1 sibling, 1 reply; 23+ messages in thread
From: Oleksii Kurochko @ 2025-03-26 9:46 UTC (permalink / raw)
To: Orzel, Michal, Jan Beulich, Luca Fancellu
Cc: Penny Zheng, Stefano Stabellini, Julien Grall, Bertrand Marquis,
Volodymyr Babchuk, Andrew Cooper, Anthony PERARD,
Roger Pau Monné, Alistair Francis, Bob Eshleman,
Connor Davis, Wei Chen, xen-devel
[-- Attachment #1: Type: text/plain, Size: 3292 bytes --]
On 3/26/25 10:39 AM, Orzel, Michal wrote:
>
> On 20/03/2025 08:32, Jan Beulich wrote:
>>
>> On 19.03.2025 17:31, Oleksii Kurochko wrote:
>>> On 3/19/25 12:35 PM, Jan Beulich wrote:
>>>> On 18.03.2025 14:05, Oleksii Kurochko wrote:
>>>>> On 3/17/25 9:07 PM, Luca Fancellu wrote:
>>>>>> From: Penny Zheng<Penny.Zheng@arm.com>
>>>>>>
>>>>>> ARM MPU system doesn't need to use paging memory pool, as MPU memory
>>>>>> mapping table at most takes only one 4KB page, which is enough to
>>>>>> manage the maximum 255 MPU memory regions, for all EL2 stage 1
>>>>>> translation and EL1 stage 2 translation.
>>>>>>
>>>>>> Introduce ARCH_PAGING_MEMPOOL Kconfig common symbol, selected for Arm
>>>>>> MMU systems, x86 and RISC-V.
>>>>>>
>>>>>> Wrap the code inside 'construct_domU' that deal with p2m paging
>>>>>> allocation in a new function 'domain_p2m_set_allocation', protected
>>>>>> by ARCH_PAGING_MEMPOOL, this is done in this way to prevent polluting
>>>>>> the former function with #ifdefs and improve readability
>>>>>>
>>>>>> Introduce arch_{get,set}_paging_mempool_size stubs for architecture
>>>>>> with !ARCH_PAGING_MEMPOOL.
>>>>>>
>>>>>> Remove 'struct paging_domain' from Arm 'struct arch_domain' when the
>>>>>> field is not required.
>>>>>>
>>>>>> Signed-off-by: Penny Zheng<penny.zheng@arm.com>
>>>>>> Signed-off-by: Wei Chen<wei.chen@arm.com>
>>>>>> Signed-off-by: Luca Fancellu<luca.fancellu@arm.com>
>>>>>> ---
>>>>>> v3 changes:
>>>>>> - Introduced ARCH_PAGING_MEMPOOL instead of HAS_PAGING_MEMPOOL
>>>>>> v2 changes:
>>>>>> - make Kconfig HAS_PAGING_MEMPOOL common
>>>>>> - protect also "xen,domain-p2m-mem-mb" reading with HAS_PAGING_MEMPOOL
>>>>>> - do not define p2m_teardown{_allocation} in this patch
>>>>>> - change commit message
>>>>>> ---
>>>>>> xen/arch/arm/Kconfig | 1 +
>>>>>> xen/arch/arm/dom0less-build.c | 74 ++++++++++++++++++++-----------
>>>>>> xen/arch/arm/include/asm/domain.h | 2 +
>>>>>> xen/arch/riscv/Kconfig | 1 +
>>>>>> xen/arch/x86/Kconfig | 1 +
>>>>>> xen/common/Kconfig | 3 ++
>>>>>> xen/include/xen/domain.h | 17 +++++++
>>>>>> 7 files changed, 73 insertions(+), 26 deletions(-)
>>>>> For RISC-V:
>>>>> Reviewed-by: Oleksii Kurochko<oleksii.kurochko@gmail.com>
>>>> Mind me asking then why RISC-V needs this at this point? The stubs surely
>>>> were added to address some build issue, not because they are actively
>>>> meaningful?
>>> Only because we have stubs and not to have redefinition compilation
>>> error. And, yes, they are not actively meaningful now, at least. I am
>>> okay with not enabling of this config for RISC-V but then seems to me we
>>> have to drop stubs in riscv/stubs.c. ~ Oleksii
>> Well, I don't think it's "have to", but I agree that dropping them would
>> make sense then (and be desirable).
> @Jan, @Oleksii, is there anything blocking this patch to be committed (Luca
> question does not seem to be answered)? Other patches in the series are ready to
> be merged.
I think the change in xen/arch/riscv/Kconfig should be dropped with dropping
arch_{get,set}_paging_mempool_size() in riscv/stubs.c as they are defined in
xen/domain.h for the case when CONFIG_ARCH_PAGING_MEMPOOL=n.
~ Oleksii
[-- Attachment #2: Type: text/html, Size: 4527 bytes --]
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH v3 6/7] xen: introduce Kconfig ARCH_PAGING_MEMPOOL
2025-03-26 9:46 ` Oleksii Kurochko
@ 2025-03-26 9:53 ` Orzel, Michal
0 siblings, 0 replies; 23+ messages in thread
From: Orzel, Michal @ 2025-03-26 9:53 UTC (permalink / raw)
To: Oleksii Kurochko, Jan Beulich, Luca Fancellu
Cc: Penny Zheng, Stefano Stabellini, Julien Grall, Bertrand Marquis,
Volodymyr Babchuk, Andrew Cooper, Anthony PERARD,
Roger Pau Monné, Alistair Francis, Bob Eshleman,
Connor Davis, Wei Chen, xen-devel
On 26/03/2025 10:46, Oleksii Kurochko wrote:
>
>
>
>
> On 3/26/25 10:39 AM, Orzel, Michal wrote:
>> On 20/03/2025 08:32, Jan Beulich wrote:
>>> On 19.03.2025 17:31, Oleksii Kurochko wrote:
>>>> On 3/19/25 12:35 PM, Jan Beulich wrote:
>>>>> On 18.03.2025 14:05, Oleksii Kurochko wrote:
>>>>>> On 3/17/25 9:07 PM, Luca Fancellu wrote:
>>>>>>> From: Penny Zheng<Penny.Zheng@arm.com>
>>>>>>>
>>>>>>> ARM MPU system doesn't need to use paging memory pool, as MPU memory
>>>>>>> mapping table at most takes only one 4KB page, which is enough to
>>>>>>> manage the maximum 255 MPU memory regions, for all EL2 stage 1
>>>>>>> translation and EL1 stage 2 translation.
>>>>>>>
>>>>>>> Introduce ARCH_PAGING_MEMPOOL Kconfig common symbol, selected for Arm
>>>>>>> MMU systems, x86 and RISC-V.
>>>>>>>
>>>>>>> Wrap the code inside 'construct_domU' that deal with p2m paging
>>>>>>> allocation in a new function 'domain_p2m_set_allocation', protected
>>>>>>> by ARCH_PAGING_MEMPOOL, this is done in this way to prevent polluting
>>>>>>> the former function with #ifdefs and improve readability
>>>>>>>
>>>>>>> Introduce arch_{get,set}_paging_mempool_size stubs for architecture
>>>>>>> with !ARCH_PAGING_MEMPOOL.
>>>>>>>
>>>>>>> Remove 'struct paging_domain' from Arm 'struct arch_domain' when the
>>>>>>> field is not required.
>>>>>>>
>>>>>>> Signed-off-by: Penny Zheng<penny.zheng@arm.com>
>>>>>>> Signed-off-by: Wei Chen<wei.chen@arm.com>
>>>>>>> Signed-off-by: Luca Fancellu<luca.fancellu@arm.com>
>>>>>>> ---
>>>>>>> v3 changes:
>>>>>>> - Introduced ARCH_PAGING_MEMPOOL instead of HAS_PAGING_MEMPOOL
>>>>>>> v2 changes:
>>>>>>> - make Kconfig HAS_PAGING_MEMPOOL common
>>>>>>> - protect also "xen,domain-p2m-mem-mb" reading with HAS_PAGING_MEMPOOL
>>>>>>> - do not define p2m_teardown{_allocation} in this patch
>>>>>>> - change commit message
>>>>>>> ---
>>>>>>> xen/arch/arm/Kconfig | 1 +
>>>>>>> xen/arch/arm/dom0less-build.c | 74 ++++++++++++++++++++-----------
>>>>>>> xen/arch/arm/include/asm/domain.h | 2 +
>>>>>>> xen/arch/riscv/Kconfig | 1 +
>>>>>>> xen/arch/x86/Kconfig | 1 +
>>>>>>> xen/common/Kconfig | 3 ++
>>>>>>> xen/include/xen/domain.h | 17 +++++++
>>>>>>> 7 files changed, 73 insertions(+), 26 deletions(-)
>>>>>> For RISC-V:
>>>>>> Reviewed-by: Oleksii Kurochko<oleksii.kurochko@gmail.com>
>>>>> Mind me asking then why RISC-V needs this at this point? The stubs surely
>>>>> were added to address some build issue, not because they are actively
>>>>> meaningful?
>>>> Only because we have stubs and not to have redefinition compilation
>>>> error. And, yes, they are not actively meaningful now, at least. I am
>>>> okay with not enabling of this config for RISC-V but then seems to me we
>>>> have to drop stubs in riscv/stubs.c. ~ Oleksii
>>> Well, I don't think it's "have to", but I agree that dropping them would
>>> make sense then (and be desirable).
>> @Jan, @Oleksii, is there anything blocking this patch to be committed (Luca
>> question does not seem to be answered)? Other patches in the series are ready to
>> be merged.
> I think the change in xen/arch/riscv/Kconfig should be dropped with dropping
> arch_{get,set}_paging_mempool_size() in riscv/stubs.c as they are defined in
> xen/domain.h for the case when CONFIG_ARCH_PAGING_MEMPOOL=n.
Ok, thanks for clarification. @Luca, please resend the series with this change.
~Michal
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH v3 6/7] xen: introduce Kconfig ARCH_PAGING_MEMPOOL
2025-03-26 9:39 ` Orzel, Michal
2025-03-26 9:46 ` Oleksii Kurochko
@ 2025-03-26 9:54 ` Jan Beulich
2025-03-26 9:59 ` Orzel, Michal
1 sibling, 1 reply; 23+ messages in thread
From: Jan Beulich @ 2025-03-26 9:54 UTC (permalink / raw)
To: Orzel, Michal
Cc: Penny Zheng, Stefano Stabellini, Julien Grall, Bertrand Marquis,
Volodymyr Babchuk, Andrew Cooper, Anthony PERARD,
Roger Pau Monné, Alistair Francis, Bob Eshleman,
Connor Davis, Wei Chen, xen-devel, Oleksii Kurochko,
Luca Fancellu
On 26.03.2025 10:39, Orzel, Michal wrote:
>
>
> On 20/03/2025 08:32, Jan Beulich wrote:
>>
>>
>> On 19.03.2025 17:31, Oleksii Kurochko wrote:
>>>
>>> On 3/19/25 12:35 PM, Jan Beulich wrote:
>>>> On 18.03.2025 14:05, Oleksii Kurochko wrote:
>>>>> On 3/17/25 9:07 PM, Luca Fancellu wrote:
>>>>>> From: Penny Zheng<Penny.Zheng@arm.com>
>>>>>>
>>>>>> ARM MPU system doesn't need to use paging memory pool, as MPU memory
>>>>>> mapping table at most takes only one 4KB page, which is enough to
>>>>>> manage the maximum 255 MPU memory regions, for all EL2 stage 1
>>>>>> translation and EL1 stage 2 translation.
>>>>>>
>>>>>> Introduce ARCH_PAGING_MEMPOOL Kconfig common symbol, selected for Arm
>>>>>> MMU systems, x86 and RISC-V.
>>>>>>
>>>>>> Wrap the code inside 'construct_domU' that deal with p2m paging
>>>>>> allocation in a new function 'domain_p2m_set_allocation', protected
>>>>>> by ARCH_PAGING_MEMPOOL, this is done in this way to prevent polluting
>>>>>> the former function with #ifdefs and improve readability
>>>>>>
>>>>>> Introduce arch_{get,set}_paging_mempool_size stubs for architecture
>>>>>> with !ARCH_PAGING_MEMPOOL.
>>>>>>
>>>>>> Remove 'struct paging_domain' from Arm 'struct arch_domain' when the
>>>>>> field is not required.
>>>>>>
>>>>>> Signed-off-by: Penny Zheng<penny.zheng@arm.com>
>>>>>> Signed-off-by: Wei Chen<wei.chen@arm.com>
>>>>>> Signed-off-by: Luca Fancellu<luca.fancellu@arm.com>
>>>>>> ---
>>>>>> v3 changes:
>>>>>> - Introduced ARCH_PAGING_MEMPOOL instead of HAS_PAGING_MEMPOOL
>>>>>> v2 changes:
>>>>>> - make Kconfig HAS_PAGING_MEMPOOL common
>>>>>> - protect also "xen,domain-p2m-mem-mb" reading with HAS_PAGING_MEMPOOL
>>>>>> - do not define p2m_teardown{_allocation} in this patch
>>>>>> - change commit message
>>>>>> ---
>>>>>> xen/arch/arm/Kconfig | 1 +
>>>>>> xen/arch/arm/dom0less-build.c | 74 ++++++++++++++++++++-----------
>>>>>> xen/arch/arm/include/asm/domain.h | 2 +
>>>>>> xen/arch/riscv/Kconfig | 1 +
>>>>>> xen/arch/x86/Kconfig | 1 +
>>>>>> xen/common/Kconfig | 3 ++
>>>>>> xen/include/xen/domain.h | 17 +++++++
>>>>>> 7 files changed, 73 insertions(+), 26 deletions(-)
>>>>> For RISC-V:
>>>>> Reviewed-by: Oleksii Kurochko<oleksii.kurochko@gmail.com>
>>>> Mind me asking then why RISC-V needs this at this point? The stubs surely
>>>> were added to address some build issue, not because they are actively
>>>> meaningful?
>>>
>>> Only because we have stubs and not to have redefinition compilation
>>> error. And, yes, they are not actively meaningful now, at least. I am
>>> okay with not enabling of this config for RISC-V but then seems to me we
>>> have to drop stubs in riscv/stubs.c. ~ Oleksii
>>
>> Well, I don't think it's "have to", but I agree that dropping them would
>> make sense then (and be desirable).
> @Jan, @Oleksii, is there anything blocking this patch to be committed (Luca
> question does not seem to be answered)? Other patches in the series are ready to
> be merged.
While I think Oleksii's reply has sufficiently clarified things, I still wonder:
What question of Luca are you referring to? There's none visible in context here
afaics. The two questions that are visible were raised by me, and answered by
Oleksii (also visible in context above). There was an implication to draw from
that, yes, which Oleksii has now made explicit in his reply to your mail.
And then, formally this still didn't have a REST ack (you limited your R-b to
Arm) nor an x86 one.
Jan
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH v3 6/7] xen: introduce Kconfig ARCH_PAGING_MEMPOOL
2025-03-26 9:54 ` Jan Beulich
@ 2025-03-26 9:59 ` Orzel, Michal
2025-03-26 10:04 ` Jan Beulich
0 siblings, 1 reply; 23+ messages in thread
From: Orzel, Michal @ 2025-03-26 9:59 UTC (permalink / raw)
To: Jan Beulich
Cc: Penny Zheng, Stefano Stabellini, Julien Grall, Bertrand Marquis,
Volodymyr Babchuk, Andrew Cooper, Anthony PERARD,
Roger Pau Monné, Alistair Francis, Bob Eshleman,
Connor Davis, Wei Chen, xen-devel, Oleksii Kurochko,
Luca Fancellu
On 26/03/2025 10:54, Jan Beulich wrote:
>
>
> On 26.03.2025 10:39, Orzel, Michal wrote:
>>
>>
>> On 20/03/2025 08:32, Jan Beulich wrote:
>>>
>>>
>>> On 19.03.2025 17:31, Oleksii Kurochko wrote:
>>>>
>>>> On 3/19/25 12:35 PM, Jan Beulich wrote:
>>>>> On 18.03.2025 14:05, Oleksii Kurochko wrote:
>>>>>> On 3/17/25 9:07 PM, Luca Fancellu wrote:
>>>>>>> From: Penny Zheng<Penny.Zheng@arm.com>
>>>>>>>
>>>>>>> ARM MPU system doesn't need to use paging memory pool, as MPU memory
>>>>>>> mapping table at most takes only one 4KB page, which is enough to
>>>>>>> manage the maximum 255 MPU memory regions, for all EL2 stage 1
>>>>>>> translation and EL1 stage 2 translation.
>>>>>>>
>>>>>>> Introduce ARCH_PAGING_MEMPOOL Kconfig common symbol, selected for Arm
>>>>>>> MMU systems, x86 and RISC-V.
>>>>>>>
>>>>>>> Wrap the code inside 'construct_domU' that deal with p2m paging
>>>>>>> allocation in a new function 'domain_p2m_set_allocation', protected
>>>>>>> by ARCH_PAGING_MEMPOOL, this is done in this way to prevent polluting
>>>>>>> the former function with #ifdefs and improve readability
>>>>>>>
>>>>>>> Introduce arch_{get,set}_paging_mempool_size stubs for architecture
>>>>>>> with !ARCH_PAGING_MEMPOOL.
>>>>>>>
>>>>>>> Remove 'struct paging_domain' from Arm 'struct arch_domain' when the
>>>>>>> field is not required.
>>>>>>>
>>>>>>> Signed-off-by: Penny Zheng<penny.zheng@arm.com>
>>>>>>> Signed-off-by: Wei Chen<wei.chen@arm.com>
>>>>>>> Signed-off-by: Luca Fancellu<luca.fancellu@arm.com>
>>>>>>> ---
>>>>>>> v3 changes:
>>>>>>> - Introduced ARCH_PAGING_MEMPOOL instead of HAS_PAGING_MEMPOOL
>>>>>>> v2 changes:
>>>>>>> - make Kconfig HAS_PAGING_MEMPOOL common
>>>>>>> - protect also "xen,domain-p2m-mem-mb" reading with HAS_PAGING_MEMPOOL
>>>>>>> - do not define p2m_teardown{_allocation} in this patch
>>>>>>> - change commit message
>>>>>>> ---
>>>>>>> xen/arch/arm/Kconfig | 1 +
>>>>>>> xen/arch/arm/dom0less-build.c | 74 ++++++++++++++++++++-----------
>>>>>>> xen/arch/arm/include/asm/domain.h | 2 +
>>>>>>> xen/arch/riscv/Kconfig | 1 +
>>>>>>> xen/arch/x86/Kconfig | 1 +
>>>>>>> xen/common/Kconfig | 3 ++
>>>>>>> xen/include/xen/domain.h | 17 +++++++
>>>>>>> 7 files changed, 73 insertions(+), 26 deletions(-)
>>>>>> For RISC-V:
>>>>>> Reviewed-by: Oleksii Kurochko<oleksii.kurochko@gmail.com>
>>>>> Mind me asking then why RISC-V needs this at this point? The stubs surely
>>>>> were added to address some build issue, not because they are actively
>>>>> meaningful?
>>>>
>>>> Only because we have stubs and not to have redefinition compilation
>>>> error. And, yes, they are not actively meaningful now, at least. I am
>>>> okay with not enabling of this config for RISC-V but then seems to me we
>>>> have to drop stubs in riscv/stubs.c. ~ Oleksii
>>>
>>> Well, I don't think it's "have to", but I agree that dropping them would
>>> make sense then (and be desirable).
>> @Jan, @Oleksii, is there anything blocking this patch to be committed (Luca
>> question does not seem to be answered)? Other patches in the series are ready to
>> be merged.
>
> While I think Oleksii's reply has sufficiently clarified things, I still wonder:
> What question of Luca are you referring to? There's none visible in context here
> afaics. The two questions that are visible were raised by me, and answered by
> Oleksii (also visible in context above). There was an implication to draw from
> that, yes, which Oleksii has now made explicit in his reply to your mail.
Sure thing. I'll clarify. Here Luca asks question to you if it is possible for
RISCV guys to handle it afterwards:
https://lore.kernel.org/xen-devel/D86D58F5-1EDD-4362-B163-5AD25C5DCC51@arm.com/
https://lore.kernel.org/xen-devel/F827A271-0E9B-4240-BB1E-C039E9EE5656@arm.com/
and you did not answer to these e-mails.
>
> And then, formally this still didn't have a REST ack (you limited your R-b to
> Arm) nor an x86 one.
That's why I asked: "is there anything blocking". Missing REST ack fits into my
query.
~Michal
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH v3 6/7] xen: introduce Kconfig ARCH_PAGING_MEMPOOL
2025-03-26 9:59 ` Orzel, Michal
@ 2025-03-26 10:04 ` Jan Beulich
0 siblings, 0 replies; 23+ messages in thread
From: Jan Beulich @ 2025-03-26 10:04 UTC (permalink / raw)
To: Orzel, Michal
Cc: Penny Zheng, Stefano Stabellini, Julien Grall, Bertrand Marquis,
Volodymyr Babchuk, Andrew Cooper, Anthony PERARD,
Roger Pau Monné, Alistair Francis, Bob Eshleman,
Connor Davis, Wei Chen, xen-devel, Oleksii Kurochko,
Luca Fancellu
On 26.03.2025 10:59, Orzel, Michal wrote:
> On 26/03/2025 10:54, Jan Beulich wrote:
>> On 26.03.2025 10:39, Orzel, Michal wrote:
>>> On 20/03/2025 08:32, Jan Beulich wrote:
>>>> On 19.03.2025 17:31, Oleksii Kurochko wrote:
>>>>> On 3/19/25 12:35 PM, Jan Beulich wrote:
>>>>>> On 18.03.2025 14:05, Oleksii Kurochko wrote:
>>>>>>> On 3/17/25 9:07 PM, Luca Fancellu wrote:
>>>>>>>> From: Penny Zheng<Penny.Zheng@arm.com>
>>>>>>>>
>>>>>>>> ARM MPU system doesn't need to use paging memory pool, as MPU memory
>>>>>>>> mapping table at most takes only one 4KB page, which is enough to
>>>>>>>> manage the maximum 255 MPU memory regions, for all EL2 stage 1
>>>>>>>> translation and EL1 stage 2 translation.
>>>>>>>>
>>>>>>>> Introduce ARCH_PAGING_MEMPOOL Kconfig common symbol, selected for Arm
>>>>>>>> MMU systems, x86 and RISC-V.
>>>>>>>>
>>>>>>>> Wrap the code inside 'construct_domU' that deal with p2m paging
>>>>>>>> allocation in a new function 'domain_p2m_set_allocation', protected
>>>>>>>> by ARCH_PAGING_MEMPOOL, this is done in this way to prevent polluting
>>>>>>>> the former function with #ifdefs and improve readability
>>>>>>>>
>>>>>>>> Introduce arch_{get,set}_paging_mempool_size stubs for architecture
>>>>>>>> with !ARCH_PAGING_MEMPOOL.
>>>>>>>>
>>>>>>>> Remove 'struct paging_domain' from Arm 'struct arch_domain' when the
>>>>>>>> field is not required.
>>>>>>>>
>>>>>>>> Signed-off-by: Penny Zheng<penny.zheng@arm.com>
>>>>>>>> Signed-off-by: Wei Chen<wei.chen@arm.com>
>>>>>>>> Signed-off-by: Luca Fancellu<luca.fancellu@arm.com>
>>>>>>>> ---
>>>>>>>> v3 changes:
>>>>>>>> - Introduced ARCH_PAGING_MEMPOOL instead of HAS_PAGING_MEMPOOL
>>>>>>>> v2 changes:
>>>>>>>> - make Kconfig HAS_PAGING_MEMPOOL common
>>>>>>>> - protect also "xen,domain-p2m-mem-mb" reading with HAS_PAGING_MEMPOOL
>>>>>>>> - do not define p2m_teardown{_allocation} in this patch
>>>>>>>> - change commit message
>>>>>>>> ---
>>>>>>>> xen/arch/arm/Kconfig | 1 +
>>>>>>>> xen/arch/arm/dom0less-build.c | 74 ++++++++++++++++++++-----------
>>>>>>>> xen/arch/arm/include/asm/domain.h | 2 +
>>>>>>>> xen/arch/riscv/Kconfig | 1 +
>>>>>>>> xen/arch/x86/Kconfig | 1 +
>>>>>>>> xen/common/Kconfig | 3 ++
>>>>>>>> xen/include/xen/domain.h | 17 +++++++
>>>>>>>> 7 files changed, 73 insertions(+), 26 deletions(-)
>>>>>>> For RISC-V:
>>>>>>> Reviewed-by: Oleksii Kurochko<oleksii.kurochko@gmail.com>
>>>>>> Mind me asking then why RISC-V needs this at this point? The stubs surely
>>>>>> were added to address some build issue, not because they are actively
>>>>>> meaningful?
>>>>>
>>>>> Only because we have stubs and not to have redefinition compilation
>>>>> error. And, yes, they are not actively meaningful now, at least. I am
>>>>> okay with not enabling of this config for RISC-V but then seems to me we
>>>>> have to drop stubs in riscv/stubs.c. ~ Oleksii
>>>>
>>>> Well, I don't think it's "have to", but I agree that dropping them would
>>>> make sense then (and be desirable).
>>> @Jan, @Oleksii, is there anything blocking this patch to be committed (Luca
>>> question does not seem to be answered)? Other patches in the series are ready to
>>> be merged.
>>
>> While I think Oleksii's reply has sufficiently clarified things, I still wonder:
>> What question of Luca are you referring to? There's none visible in context here
>> afaics. The two questions that are visible were raised by me, and answered by
>> Oleksii (also visible in context above). There was an implication to draw from
>> that, yes, which Oleksii has now made explicit in his reply to your mail.
> Sure thing. I'll clarify. Here Luca asks question to you if it is possible for
> RISCV guys to handle it afterwards:
> https://lore.kernel.org/xen-devel/D86D58F5-1EDD-4362-B163-5AD25C5DCC51@arm.com/
> https://lore.kernel.org/xen-devel/F827A271-0E9B-4240-BB1E-C039E9EE5656@arm.com/
> and you did not answer to these e-mails.
I simply saw no need after Oleksii had replied.
Jan
^ permalink raw reply [flat|nested] 23+ messages in thread
end of thread, other threads:[~2025-03-26 10:04 UTC | newest]
Thread overview: 23+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-17 20:07 [PATCH v3 0/7] MPU mm subsystem skeleton Luca Fancellu
2025-03-17 20:07 ` [PATCH v3 1/7] arm/mpu: Add HYPERVISOR_VIRT_START and avoid a check in xen.lds.S Luca Fancellu
2025-03-17 20:07 ` [PATCH v3 2/7] xen/arm: Implement virt/maddr conversion in MPU system Luca Fancellu
2025-03-17 20:07 ` [PATCH v3 3/7] xen/arm: Introduce frame_table and virt_to_page Luca Fancellu
2025-03-17 20:07 ` [PATCH v3 4/7] arm/mpu: Kconfig symbols for MPU build Luca Fancellu
2025-03-17 20:07 ` [PATCH v3 5/7] arm/mpu: Implement stubs for ioremap_attr on MPU Luca Fancellu
2025-03-17 20:07 ` [PATCH v3 6/7] xen: introduce Kconfig ARCH_PAGING_MEMPOOL Luca Fancellu
2025-03-18 9:11 ` Orzel, Michal
2025-03-18 13:05 ` Oleksii Kurochko
2025-03-19 11:35 ` Jan Beulich
2025-03-19 12:18 ` Luca Fancellu
2025-03-19 12:24 ` Luca Fancellu
2025-03-19 12:26 ` Luca Fancellu
2025-03-19 16:31 ` Oleksii Kurochko
2025-03-20 7:32 ` Jan Beulich
2025-03-26 9:39 ` Orzel, Michal
2025-03-26 9:46 ` Oleksii Kurochko
2025-03-26 9:53 ` Orzel, Michal
2025-03-26 9:54 ` Jan Beulich
2025-03-26 9:59 ` Orzel, Michal
2025-03-26 10:04 ` Jan Beulich
2025-03-17 20:07 ` [PATCH v3 7/7] arm/mpu: Create the skeleton for MPU compilation Luca Fancellu
2025-03-18 9:27 ` Orzel, Michal
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.