MPU mm subsystem skeleton
v3 cover MPU mm subsystem skeleton
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=yCONFIG_MPU=yCONFIG_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
Signature · 1 line
2.34.1
PATCH v3 1/7 arm/mpu: Add HYPERVISOR_VIRT_START and avoid a check in xen.lds.S
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.
---
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(+)
xen/arch/arm/include/asm/mpu/layout.h +2 -0
@@ -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:
xen/arch/arm/xen.lds.S +2 -0
@@ -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
Signature · 1 line
2.34.1
PATCH v3 2/7 xen/arm: Implement virt/maddr conversion in MPU system
In reply to Luca FancelluFrom: Penny Zheng <[email protected]>
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.
---
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
xen/arch/arm/include/asm/mm.h +9 -55
@@ -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) {
xen/arch/arm/include/asm/mmu/mm.h +56 -0
68 lines not on this page · raw message
xen/arch/arm/include/asm/mpu/mm.h new file +27 -0
@@ -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: +*/
Signature · 1 line
2.34.1
PATCH v3 3/7 xen/arm: Introduce frame_table and virt_to_page
In reply to Luca FancelluIntroduce 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.
---
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(-)
xen/arch/arm/include/asm/mm.h +0 -14
@@ -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)));
xen/arch/arm/include/asm/mmu/mm.h +14 -0
@@ -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 *
xen/arch/arm/include/asm/mpu/layout.h +3 -0
@@ -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/*
xen/arch/arm/include/asm/mpu/mm.h +14 -0
@@ -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__ */ /*
xen/arch/arm/mpu/mm.c +13 -1
@@ -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: +*/
Signature · 1 line
2.34.1
PATCH v3 4/7 arm/mpu: Kconfig symbols for MPU build
In reply to Luca FancelluThe 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.
---
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(-)
xen/arch/arm/Kconfig +2 -1
@@ -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
Signature · 1 line
2.34.1
PATCH v3 5/7 arm/mpu: Implement stubs for ioremap_attr on MPU
In reply to Luca FancelluImplement 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.
---
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(-)
xen/arch/arm/mm.c +5 -0
@@ -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
xen/arch/arm/mmu/pt.c +0 -5
@@ -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;
xen/arch/arm/mpu/mm.c +6 -0
@@ -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
Signature · 1 line
2.34.1
PATCH v3 6/7 xen: introduce Kconfig ARCH_PAGING_MEMPOOL
In reply to Luca FancelluFrom: Penny Zheng <[email protected]>
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.
---
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(-)
xen/arch/arm/Kconfig +1 -0
@@ -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
xen/arch/arm/dom0less-build.c +48 -26
98 lines not on this page · raw message
xen/arch/arm/include/asm/domain.h +2 -0
@@ -75,7 +75,9 @@ struct arch_domainstruct hvm_domain hvm; +#ifdef CONFIG_ARCH_PAGING_MEMPOOL struct paging_domain paging; +#endif struct vmmio vmmio;
xen/arch/riscv/Kconfig +1 -0
@@ -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
xen/arch/x86/Kconfig +1 -0
@@ -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
xen/common/Kconfig +3 -0
@@ -44,6 +44,9 @@ config ALTERNATIVE_CALL config ARCH_MAP_DOMAIN_PAGE bool +config ARCH_PAGING_MEMPOOL + bool + config GENERIC_BUG_FRAME bool
xen/include/xen/domain.h +17 -0
@@ -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);
Signature · 1 line
2.34.1
Re: [PATCH v3 6/7] xen: introduce Kconfig ARCH_PAGING_MEMPOOL
Quoted 83 lines · Luca Fancellu
From: Penny Zheng <[email protected]>
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_MEMPOOLKconfigcommon 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 byARCH_PAGING_MEMPOOL, this is done in this way to prevent polluting the former function with #ifdefs and improve readabilityIntroduce arch_{get,set}_paging_mempool_size stubs for architecture with !ARCH_PAGING_MEMPOOL.
Remove 'struct
paging_domain' from Arm 'structarch_domain' when the field is not required.Signed-off-by Penny Zheng <[email protected]>Signed-off-by Wei Chen <[email protected]>Signed-off-by Luca Fancellu <[email protected]>---
v3 changes:
- IntroducedARCH_PAGING_MEMPOOLinstead ofHAS_PAGING_MEMPOOL
v2 changes:
- makeKconfigHAS_PAGING_MEMPOOLcommon
- protect also "xen,domain-p2m-mem-mb" reading withHAS_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(-)xen/arch/arm/Kconfig +1
-0@@ -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_VMAPxen/arch/arm/dom0less-build.c +0
-15@@ -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;
xen/arch/arm/dom0less-build.c static void __init domain_vcpu_affinity(struct domain *d, · line 830
Quoted 5 lines
xen/arch/arm/dom0less-build.c +2
-0@@ -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:
~Michal
Re: [PATCH v3 6/7] xen: introduce Kconfig ARCH_PAGING_MEMPOOL
In reply to Luca FancelluQuoted 32 lines · Luca Fancellu
From: Penny Zheng<[email protected]>
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_MEMPOOLKconfigcommon 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 byARCH_PAGING_MEMPOOL, this is done in this way to prevent polluting the former function with #ifdefs and improve readabilityIntroduce arch_{get,set}_paging_mempool_size stubs for architecture with !ARCH_PAGING_MEMPOOL.
Remove 'struct
paging_domain' from Arm 'structarch_domain' when the field is not required.Signed-off-by Penny Zheng<[email protected]>Signed-off-by Wei Chen<[email protected]>Signed-off-by Luca Fancellu<[email protected]>---
v3 changes:
- IntroducedARCH_PAGING_MEMPOOLinstead ofHAS_PAGING_MEMPOOL
v2 changes:
- makeKconfigHAS_PAGING_MEMPOOLcommon
- protect also "xen,domain-p2m-mem-mb" reading withHAS_PAGING_MEMPOOL
- do not define p2m_teardown{_allocation} in this patch
- change commit message
Quoted 9 lines
--- 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:
Thanks.
~ Oleksii
Quoted 208 lines
xen/arch/arm/Kconfig +1
-0@@ -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_VMAPxen/arch/arm/dom0less-build.c +48
-26@@ -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;xen/arch/arm/include/asm/domain.h +2
-0@@ -75,7 +75,9 @@ struct arch_domainstruct hvm_domain hvm; +#ifdef CONFIG_ARCH_PAGING_MEMPOOL struct paging_domain paging; +#endif struct vmmio vmmio;xen/arch/riscv/Kconfig +1
-0@@ -1,5 +1,6 @@ config RISCV def_bool y + select ARCH_PAGING_MEMPOOL select FUNCTION_ALIGNMENT_16B select GENERIC_BUG_FRAME select HAS_DEVICE_TREExen/arch/x86/Kconfig +1
-0@@ -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_16Bxen/common/Kconfig +3
-0@@ -44,6 +44,9 @@ config ALTERNATIVE_CALL config ARCH_MAP_DOMAIN_PAGE bool +config ARCH_PAGING_MEMPOOL + bool + config GENERIC_BUG_FRAME boolxen/include/xen/domain.h +17
-0@@ -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);
Re: [PATCH v3 6/7] xen: introduce Kconfig ARCH_PAGING_MEMPOOL
Quoted 44 lines · Oleksii Kurochko
Quoted 32 lines · Luca Fancellu
From: Penny Zheng<[email protected]>
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_MEMPOOLKconfigcommon 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 byARCH_PAGING_MEMPOOL, this is done in this way to prevent polluting the former function with #ifdefs and improve readabilityIntroduce arch_{get,set}_paging_mempool_size stubs for architecture with !ARCH_PAGING_MEMPOOL.
Remove 'struct
paging_domain' from Arm 'structarch_domain' when the field is not required.Signed-off-by Penny Zheng<[email protected]>Signed-off-by Wei Chen<[email protected]>Signed-off-by Luca Fancellu<[email protected]>---
v3 changes:
- IntroducedARCH_PAGING_MEMPOOLinstead ofHAS_PAGING_MEMPOOL
v2 changes:
- makeKconfigHAS_PAGING_MEMPOOLcommon
- protect also "xen,domain-p2m-mem-mb" reading withHAS_PAGING_MEMPOOL
- do not define p2m_teardown{_allocation} in this patch
- change commit messageQuoted 9 lines
--- 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(-)
Quoted 2 lines
For RISC-V:
Reviewed-by Oleksii Kurochko<[email protected]>
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
Re: [PATCH v3 6/7] xen: introduce Kconfig ARCH_PAGING_MEMPOOL
Hi Jan,
Quoted 47 lines · Jan Beulich
Quoted 44 lines · Oleksii Kurochko
Quoted 41 lines · Luca Fancellu
From: Penny Zheng<[email protected]>
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_MEMPOOLKconfigcommon 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 byARCH_PAGING_MEMPOOL, this is done in this way to prevent polluting the former function with #ifdefs and improve readabilityIntroduce arch_{get,set}_paging_mempool_size stubs for architecture with !ARCH_PAGING_MEMPOOL.
Remove 'struct
paging_domain' from Arm 'structarch_domain' when the field is not required.Signed-off-by Penny Zheng<[email protected]>Signed-off-by Wei Chen<[email protected]>Signed-off-by Luca Fancellu<[email protected]>---
v3 changes:
- IntroducedARCH_PAGING_MEMPOOLinstead ofHAS_PAGING_MEMPOOL
v2 changes:
- makeKconfigHAS_PAGING_MEMPOOLcommon
- protect also "xen,domain-p2m-mem-mb" reading withHAS_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(-)
Quoted 6 lines
Quoted 2 lines
For RISC-V:
Reviewed-by Oleksii Kurochko<[email protected]>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
Quoted 2 lines
Jan
Re: [PATCH v3 6/7] xen: introduce Kconfig ARCH_PAGING_MEMPOOL
Quoted 56 lines · Luca Fancellu
Hi Jan,
Quoted 50 lines · Jan Beulich
Quoted 46 lines · Oleksii Kurochko
Quoted 33 lines · Luca Fancellu
From: Penny Zheng<[email protected]>
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_MEMPOOLKconfigcommon 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 byARCH_PAGING_MEMPOOL, this is done in this way to prevent polluting the former function with #ifdefs and improve readabilityIntroduce arch_{get,set}_paging_mempool_size stubs for architecture with !ARCH_PAGING_MEMPOOL.
Remove 'struct
paging_domain' from Arm 'structarch_domain' when the field is not required.Signed-off-by Penny Zheng<[email protected]>Signed-off-by Wei Chen<[email protected]>Signed-off-by Luca Fancellu<[email protected]>---
v3 changes:
- IntroducedARCH_PAGING_MEMPOOLinstead ofHAS_PAGING_MEMPOOLv2 changes:
- makeKconfigHAS_PAGING_MEMPOOLcommon
- protect also "xen,domain-p2m-mem-mb" reading withHAS_PAGING_MEMPOOL
- do not define p2m_teardown{_allocation} in this patch
- change commit message
---Quoted 8 lines
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<[email protected]>
Quoted 8 lines
Quoted 3 lines
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.
Quoted 7 lines
Cheers,
LucaQuoted 2 lines
Jan
Re: [PATCH v3 6/7] xen: introduce Kconfig ARCH_PAGING_MEMPOOL
In reply to Luca FancelluQuoted 56 lines · Luca Fancellu
Hi Jan,
Quoted 50 lines · Jan Beulich
Quoted 46 lines · Oleksii Kurochko
Quoted 33 lines · Luca Fancellu
From: Penny Zheng<[email protected]>
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_MEMPOOLKconfigcommon 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 byARCH_PAGING_MEMPOOL, this is done in this way to prevent polluting the former function with #ifdefs and improve readabilityIntroduce arch_{get,set}_paging_mempool_size stubs for architecture with !ARCH_PAGING_MEMPOOL.
Remove 'struct
paging_domain' from Arm 'structarch_domain' when the field is not required.Signed-off-by Penny Zheng<[email protected]>Signed-off-by Wei Chen<[email protected]>Signed-off-by Luca Fancellu<[email protected]>---
v3 changes:
- IntroducedARCH_PAGING_MEMPOOLinstead ofHAS_PAGING_MEMPOOLv2 changes:
- makeKconfigHAS_PAGING_MEMPOOLcommon
- protect also "xen,domain-p2m-mem-mb" reading withHAS_PAGING_MEMPOOL
- do not define p2m_teardown{_allocation} in this patch
- change commit message
---Quoted 8 lines
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<[email protected]>
Quoted 8 lines
Quoted 3 lines
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.
Quoted 7 lines
Cheers,
LucaQuoted 2 lines
Jan
Re: [PATCH v3 6/7] xen: introduce Kconfig ARCH_PAGING_MEMPOOL
In reply to Jan BeulichQuoted 43 lines · Jan Beulich
Quoted 42 lines · Oleksii Kurochko
Quoted 41 lines · Luca Fancellu
From: Penny Zheng<[email protected]>
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_MEMPOOLKconfigcommon 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 byARCH_PAGING_MEMPOOL, this is done in this way to prevent polluting the former function with #ifdefs and improve readabilityIntroduce arch_{get,set}_paging_mempool_size stubs for architecture with !ARCH_PAGING_MEMPOOL.
Remove 'struct
paging_domain' from Arm 'structarch_domain' when the field is not required.Signed-off-by Penny Zheng<[email protected]>Signed-off-by Wei Chen<[email protected]>Signed-off-by Luca Fancellu<[email protected]>---
v3 changes:
- IntroducedARCH_PAGING_MEMPOOLinstead ofHAS_PAGING_MEMPOOL
v2 changes:
- makeKconfigHAS_PAGING_MEMPOOLcommon
- protect also "xen,domain-p2m-mem-mb" reading withHAS_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(-)
Quoted 5 lines
Quoted 2 lines
For RISC-V:
Reviewed-by Oleksii Kurochko<[email protected]>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
Re: [PATCH v3 6/7] xen: introduce Kconfig ARCH_PAGING_MEMPOOL
Quoted 47 lines · Oleksii Kurochko
Quoted 45 lines · Jan Beulich
Quoted 44 lines · Oleksii Kurochko
Quoted 32 lines · Luca Fancellu
From: Penny Zheng<[email protected]>
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_MEMPOOLKconfigcommon 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 byARCH_PAGING_MEMPOOL, this is done in this way to prevent polluting the former function with #ifdefs and improve readabilityIntroduce arch_{get,set}_paging_mempool_size stubs for architecture with !ARCH_PAGING_MEMPOOL.
Remove 'struct
paging_domain' from Arm 'structarch_domain' when the field is not required.Signed-off-by Penny Zheng<[email protected]>Signed-off-by Wei Chen<[email protected]>Signed-off-by Luca Fancellu<[email protected]>---
v3 changes:
- IntroducedARCH_PAGING_MEMPOOLinstead ofHAS_PAGING_MEMPOOL
v2 changes:
- makeKconfigHAS_PAGING_MEMPOOLcommon
- protect also "xen,domain-p2m-mem-mb" reading withHAS_PAGING_MEMPOOL
- do not define p2m_teardown{_allocation} in this patch
- change commit messageQuoted 9 lines
--- 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<[email protected]>
Quoted 8 lines
Quoted 3 lines
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
Re: [PATCH v3 6/7] xen: introduce Kconfig ARCH_PAGING_MEMPOOL
Quoted 54 lines · Jan Beulich
Quoted 51 lines · Oleksii Kurochko
Quoted 48 lines · Jan Beulich
Quoted 42 lines · Oleksii Kurochko
Quoted 32 lines · Luca Fancellu
From: Penny Zheng<[email protected]>
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_MEMPOOLKconfigcommon 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 byARCH_PAGING_MEMPOOL, this is done in this way to prevent polluting the former function with #ifdefs and improve readabilityIntroduce arch_{get,set}_paging_mempool_size stubs for architecture with !ARCH_PAGING_MEMPOOL.
Remove 'struct
paging_domain' from Arm 'structarch_domain' when the field is not required.Signed-off-by Penny Zheng<[email protected]>Signed-off-by Wei Chen<[email protected]>Signed-off-by Luca Fancellu<[email protected]>---
v3 changes:
- IntroducedARCH_PAGING_MEMPOOLinstead ofHAS_PAGING_MEMPOOL
v2 changes:
- makeKconfigHAS_PAGING_MEMPOOLcommon
- protect also "xen,domain-p2m-mem-mb" reading withHAS_PAGING_MEMPOOL
- do not define p2m_teardown{_allocation} in this patch
- change commit messageQuoted 9 lines
--- 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(-)Quoted 2 lines
For RISC-V:
Reviewed-by Oleksii Kurochko<[email protected]>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?
Quoted 7 lines
Quoted 4 lines
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. ~ OleksiiWell, 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
Re: [PATCH v3 6/7] xen: introduce Kconfig ARCH_PAGING_MEMPOOL
Quoted 57 lines · Michal
Quoted 55 lines · Jan Beulich
Quoted 53 lines · Oleksii Kurochko
Quoted 43 lines · Jan Beulich
Quoted 42 lines · Oleksii Kurochko
Quoted 41 lines · Luca Fancellu
From: Penny Zheng<[email protected]>
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_MEMPOOLKconfigcommon 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 byARCH_PAGING_MEMPOOL, this is done in this way to prevent polluting the former function with #ifdefs and improve readabilityIntroduce arch_{get,set}_paging_mempool_size stubs for architecture with !ARCH_PAGING_MEMPOOL.
Remove 'struct
paging_domain' from Arm 'structarch_domain' when the field is not required.Signed-off-by Penny Zheng<[email protected]>Signed-off-by Wei Chen<[email protected]>Signed-off-by Luca Fancellu<[email protected]>---
v3 changes:
- IntroducedARCH_PAGING_MEMPOOLinstead ofHAS_PAGING_MEMPOOL
v2 changes:
- makeKconfigHAS_PAGING_MEMPOOLcommon
- protect also "xen,domain-p2m-mem-mb" reading withHAS_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(-)Quoted 5 lines
Quoted 2 lines
For RISC-V:
Reviewed-by Oleksii Kurochko<[email protected]>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
Quoted 5 lines
Quoted 2 lines
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
Re: [PATCH v3 6/7] xen: introduce Kconfig ARCH_PAGING_MEMPOOL
Quoted 60 lines · Oleksii Kurochko
Quoted 55 lines · Michal
Quoted 54 lines · Jan Beulich
Quoted 53 lines · Oleksii Kurochko
Quoted 43 lines · Jan Beulich
Quoted 42 lines · Oleksii Kurochko
Quoted 41 lines · Luca Fancellu
From: Penny Zheng<[email protected]>
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_MEMPOOLKconfigcommon 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 byARCH_PAGING_MEMPOOL, this is done in this way to prevent polluting the former function with #ifdefs and improve readabilityIntroduce arch_{get,set}_paging_mempool_size stubs for architecture with !ARCH_PAGING_MEMPOOL.
Remove 'struct
paging_domain' from Arm 'structarch_domain' when the field is not required.Signed-off-by Penny Zheng<[email protected]>Signed-off-by Wei Chen<[email protected]>Signed-off-by Luca Fancellu<[email protected]>---
v3 changes:
- IntroducedARCH_PAGING_MEMPOOLinstead ofHAS_PAGING_MEMPOOL
v2 changes:
- makeKconfigHAS_PAGING_MEMPOOLcommon
- protect also "xen,domain-p2m-mem-mb" reading withHAS_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(-)Quoted 5 lines
Quoted 2 lines
For RISC-V:
Reviewed-by Oleksii Kurochko<[email protected]>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
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
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.cas they are defined inxen/domain.hfor the case whenCONFIG_ARCH_PAGING_MEMPOOL=n.
Ok, thanks for clarification. @Luca, please resend the series with this change.
~Michal
Re: [PATCH v3 6/7] xen: introduce Kconfig ARCH_PAGING_MEMPOOL
In reply to Orzel, MichalQuoted 62 lines · Michal
Quoted 59 lines · Jan Beulich
Quoted 55 lines · Oleksii Kurochko
Quoted 43 lines · Jan Beulich
Quoted 42 lines · Oleksii Kurochko
Quoted 41 lines · Luca Fancellu
From: Penny Zheng<[email protected]>
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_MEMPOOLKconfigcommon 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 byARCH_PAGING_MEMPOOL, this is done in this way to prevent polluting the former function with #ifdefs and improve readabilityIntroduce arch_{get,set}_paging_mempool_size stubs for architecture with !ARCH_PAGING_MEMPOOL.
Remove 'struct
paging_domain' from Arm 'structarch_domain' when the field is not required.Signed-off-by Penny Zheng<[email protected]>Signed-off-by Wei Chen<[email protected]>Signed-off-by Luca Fancellu<[email protected]>---
v3 changes:
- IntroducedARCH_PAGING_MEMPOOLinstead ofHAS_PAGING_MEMPOOL
v2 changes:
- makeKconfigHAS_PAGING_MEMPOOLcommon
- protect also "xen,domain-p2m-mem-mb" reading withHAS_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(-)Quoted 5 lines
Quoted 2 lines
For RISC-V:
Reviewed-by Oleksii Kurochko<[email protected]>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
Quoted 5 lines
Quoted 2 lines
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
Re: [PATCH v3 6/7] xen: introduce Kconfig ARCH_PAGING_MEMPOOL
Quoted 71 lines · Jan Beulich
Quoted 62 lines · Michal
Quoted 59 lines · Jan Beulich
Quoted 55 lines · Oleksii Kurochko
Quoted 43 lines · Jan Beulich
Quoted 42 lines · Oleksii Kurochko
Quoted 41 lines · Luca Fancellu
From: Penny Zheng<[email protected]>
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_MEMPOOLKconfigcommon 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 byARCH_PAGING_MEMPOOL, this is done in this way to prevent polluting the former function with #ifdefs and improve readabilityIntroduce arch_{get,set}_paging_mempool_size stubs for architecture with !ARCH_PAGING_MEMPOOL.
Remove 'struct
paging_domain' from Arm 'structarch_domain' when the field is not required.Signed-off-by Penny Zheng<[email protected]>Signed-off-by Wei Chen<[email protected]>Signed-off-by Luca Fancellu<[email protected]>---
v3 changes:
- IntroducedARCH_PAGING_MEMPOOLinstead ofHAS_PAGING_MEMPOOL
v2 changes:
- makeKconfigHAS_PAGING_MEMPOOLcommon
- protect also "xen,domain-p2m-mem-mb" reading withHAS_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(-)Quoted 5 lines
Quoted 2 lines
For RISC-V:
Reviewed-by Oleksii Kurochko<[email protected]>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. ~ OleksiiQuoted 5 lines
Quoted 2 lines
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.
Quoted 5 lines
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/[email protected]/
https://lore.kernel.org/xen-devel/[email protected]/
and you did not answer to these e-mails.
Quoted 3 lines
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
Re: [PATCH v3 6/7] xen: introduce Kconfig ARCH_PAGING_MEMPOOL
Quoted 70 lines · Michal
Quoted 64 lines · Jan Beulich
Quoted 57 lines · Michal
Quoted 56 lines · Jan Beulich
Quoted 54 lines · Oleksii Kurochko
Quoted 43 lines · Jan Beulich
Quoted 42 lines · Oleksii Kurochko
Quoted 41 lines · Luca Fancellu
From: Penny Zheng<[email protected]>
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_MEMPOOLKconfigcommon 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 byARCH_PAGING_MEMPOOL, this is done in this way to prevent polluting the former function with #ifdefs and improve readabilityIntroduce arch_{get,set}_paging_mempool_size stubs for architecture with !ARCH_PAGING_MEMPOOL.
Remove 'struct
paging_domain' from Arm 'structarch_domain' when the field is not required.Signed-off-by Penny Zheng<[email protected]>Signed-off-by Wei Chen<[email protected]>Signed-off-by Luca Fancellu<[email protected]>---
v3 changes:
- IntroducedARCH_PAGING_MEMPOOLinstead ofHAS_PAGING_MEMPOOL
v2 changes:
- makeKconfigHAS_PAGING_MEMPOOLcommon
- protect also "xen,domain-p2m-mem-mb" reading withHAS_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(-)Quoted 5 lines
Quoted 2 lines
For RISC-V:
Reviewed-by Oleksii Kurochko<[email protected]>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. ~ OleksiiQuoted 5 lines
Quoted 2 lines
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.
Quoted 5 lines
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.
Quoted 5 lines
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/[email protected]/
https://lore.kernel.org/xen-devel/[email protected]/
and you did not answer to these e-mails.
I simply saw no need after Oleksii had replied.
Jan
PATCH v3 7/7 arm/mpu: Create the skeleton for MPU compilation
In reply to Luca FancelluThis commit introduces the skeleton for the MPU memory management subsystem that allows the compilation on Arm64.
---
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
xen/arch/arm/arm64/mpu/Makefile +2 -0
@@ -1 +1,3 @@ obj-y += head.o +obj-y += p2m.o +obj-y += smpboot.o
xen/arch/arm/arm64/mpu/p2m.c new file +19 -0
@@ -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: +*/
xen/arch/arm/arm64/mpu/smpboot.c new file +26 -0
@@ -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: +*/
xen/arch/arm/include/asm/mpu/p2m.h new file +21 -0
@@ -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: +*/
xen/arch/arm/include/asm/p2m.h +1 -1
@@ -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)
xen/arch/arm/mpu/Makefile +3 -0
@@ -1 +1,4 @@ obj-y += mm.o +obj-y += p2m.o +obj-y += setup.init.o +obj-y += vmap.o
xen/arch/arm/mpu/mm.c +25 -0
@@ -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" );
xen/arch/arm/mpu/p2m.c new file +84 -0
84 lines not on this page · raw message
xen/arch/arm/mpu/setup.c new file +40 -0
@@ -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: +*/
xen/arch/arm/mpu/vmap.c new file +26 -0
@@ -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: +*/
Signature · 1 line
2.34.1
Re: [PATCH v3 7/7] arm/mpu: Create the skeleton for MPU compilation
Quoted 6 lines · Luca Fancellu
This commit introduces the skeleton for the MPU memory management subsystem that allows the compilation on Arm64.
Signed-off-by Luca Fancellu <[email protected]>
~Michal