ARM MPU system doesn't need to use paging memory pool, as MPU memory mapping table(xen_mpumap) 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.
We wrap all paging-memory-pool-related codes with new Kconfig CONFIG_HAS_PAGING_MEMPOOL in common codes. Signed-off-by: Penny Zheng <penny.zh...@arm.com> Signed-off-by: Wei Chen <wei.c...@arm.com> --- v3: - new patch --- xen/arch/arm/Kconfig | 1 + xen/arch/arm/domain.c | 2 ++ xen/arch/arm/domain_build.c | 2 ++ xen/arch/arm/p2m.c | 2 ++ xen/arch/x86/Kconfig | 1 + xen/common/Kconfig | 3 +++ xen/common/domctl.c | 2 ++ 7 files changed, 13 insertions(+) diff --git a/xen/arch/arm/Kconfig b/xen/arch/arm/Kconfig index a88500fb50..b2710c1c31 100644 --- a/xen/arch/arm/Kconfig +++ b/xen/arch/arm/Kconfig @@ -62,6 +62,7 @@ source "arch/Kconfig" config HAS_MMU bool "Memory Management Unit support in a VMSA system" default y + select HAS_PAGING_MEMPOOL select HAS_PMAP select HAS_VMAP help diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c index add9929b79..7993cefceb 100644 --- a/xen/arch/arm/domain.c +++ b/xen/arch/arm/domain.c @@ -1072,6 +1072,7 @@ int domain_relinquish_resources(struct domain *d) */ p2m_clear_root_pages(&d->arch.p2m); +#ifdef CONFIG_HAS_PAGING_MEMPOOL PROGRESS(p2m): ret = p2m_teardown(d); if ( ret ) @@ -1081,6 +1082,7 @@ int domain_relinquish_resources(struct domain *d) ret = p2m_teardown_allocation(d); if( ret ) return ret; +#endif PROGRESS(done): break; diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c index d0d6be922d..260ef9ba6f 100644 --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c @@ -3830,11 +3830,13 @@ static int __init construct_domU(struct domain *d, p2m_mem_mb << (20 - PAGE_SHIFT) : domain_p2m_pages(mem, d->max_vcpus); +#ifdef CONFIG_PAGING_MEMPOOL spin_lock(&d->arch.paging.lock); rc = p2m_set_allocation(d, p2m_pages, NULL); spin_unlock(&d->arch.paging.lock); if ( rc != 0 ) return rc; +#endif printk("*** LOADING DOMU cpus=%u memory=%#"PRIx64"KB ***\n", d->max_vcpus, mem); diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c index b2771e0bed..e29b11334e 100644 --- a/xen/arch/arm/p2m.c +++ b/xen/arch/arm/p2m.c @@ -361,11 +361,13 @@ void p2m_final_teardown(struct domain *d) * where relinquish_p2m_mapping() has been called. */ +#ifdef CONFIG_HAS_PAGING_MEMPOOL ASSERT(page_list_empty(&p2m->pages)); while ( p2m_teardown_allocation(d) == -ERESTART ) continue; /* No preemption support here */ ASSERT(page_list_empty(&d->arch.paging.p2m_freelist)); +#endif if ( p2m->root ) free_domheap_pages(p2m->root, P2M_ROOT_ORDER); diff --git a/xen/arch/x86/Kconfig b/xen/arch/x86/Kconfig index 033cc2332e..082069f1cc 100644 --- a/xen/arch/x86/Kconfig +++ b/xen/arch/x86/Kconfig @@ -21,6 +21,7 @@ config X86 select HAS_IOPORTS select HAS_KEXEC select HAS_NS16550 + select HAS_PAGING_MEMPOOL select HAS_PASSTHROUGH select HAS_PCI select HAS_PCI_MSI diff --git a/xen/common/Kconfig b/xen/common/Kconfig index 2c29e89b75..019a123320 100644 --- a/xen/common/Kconfig +++ b/xen/common/Kconfig @@ -54,6 +54,9 @@ config HAS_IOPORTS config HAS_KEXEC bool +config HAS_PAGING_MEMPOOL + bool + config HAS_PDX bool diff --git a/xen/common/domctl.c b/xen/common/domctl.c index 505e29c0dc..c5442992b9 100644 --- a/xen/common/domctl.c +++ b/xen/common/domctl.c @@ -844,6 +844,7 @@ long do_domctl(XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl) ret = iommu_do_domctl(op, d, u_domctl); break; +#ifdef CONFIG_HAS_PAGING_MEMPOOL case XEN_DOMCTL_get_paging_mempool_size: ret = arch_get_paging_mempool_size(d, &op->u.paging_mempool.size); if ( !ret ) @@ -857,6 +858,7 @@ long do_domctl(XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl) ret = hypercall_create_continuation( __HYPERVISOR_domctl, "h", u_domctl); break; +#endif default: ret = arch_do_domctl(op, d, u_domctl); -- 2.25.1