Message ID | 20230626033443.2943270-22-Penny.Zheng@arm.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | xen/arm: Add Armv8-R64 MPU support to Xen - Part#1 | expand |
On 26.06.2023 05:34, Penny Zheng wrote: > --- 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 > > --- 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 While I'm not outright opposed to doing it this way, I wonder whether it wouldn't be better to leave common code untouched by making arch_get_paging_mempool_size() do what you want done. That's part of what arch hooks are for, after all. Jan
Hi Jan On 2023/6/26 15:01, Jan Beulich wrote: > On 26.06.2023 05:34, Penny Zheng wrote: >> --- 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 >> >> --- 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 > > While I'm not outright opposed to doing it this way, I wonder > whether it wouldn't be better to leave common code untouched by > making arch_get_paging_mempool_size() do what you want done. > That's part of what arch hooks are for, after all. > Sure, I'll try. > Jan
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);