[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH v7 for-next 05/12] x86/physdev: enable PHYSDEVOP_pci_mmcfg_reserved for PVH Dom0
So that MMCFG regions not present in the MCFG ACPI table can be added at run time by the hardware domain. Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx> --- Cc: Jan Beulich <jbeulich@xxxxxxxx> Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> --- Changes since v6: - Do not return EEXIST if the same exact region is already tracked by Xen. Changes since v5: - Check for has_vpci before calling register_vpci_mmcfg_handler instead of checking for is_hvm_domain. Changes since v4: - Change the hardware_domain check in hvm_physdev_op to a vpci check. - Only register the MMCFG area, but don't scan it. Changes since v3: - New in this version. --- xen/arch/x86/hvm/hypercall.c | 4 ++++ xen/arch/x86/hvm/io.c | 16 +++++++++++----- xen/arch/x86/physdev.c | 11 +++++++++++ 3 files changed, 26 insertions(+), 5 deletions(-) diff --git a/xen/arch/x86/hvm/hypercall.c b/xen/arch/x86/hvm/hypercall.c index 5742dd1797..d81160c1f7 100644 --- a/xen/arch/x86/hvm/hypercall.c +++ b/xen/arch/x86/hvm/hypercall.c @@ -89,6 +89,10 @@ static long hvm_physdev_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg) if ( !has_pirq(curr->domain) ) return -ENOSYS; break; + case PHYSDEVOP_pci_mmcfg_reserved: + if ( !has_vpci(curr->domain) ) + return -ENOSYS; + break; } if ( !curr->hcall_compat ) diff --git a/xen/arch/x86/hvm/io.c b/xen/arch/x86/hvm/io.c index f853739c7d..ccde922337 100644 --- a/xen/arch/x86/hvm/io.c +++ b/xen/arch/x86/hvm/io.c @@ -505,10 +505,9 @@ static const struct hvm_mmio_ops vpci_mmcfg_ops = { .write = vpci_mmcfg_write, }; -int __hwdom_init register_vpci_mmcfg_handler(struct domain *d, paddr_t addr, - unsigned int start_bus, - unsigned int end_bus, - unsigned int seg) +int register_vpci_mmcfg_handler(struct domain *d, paddr_t addr, + unsigned int start_bus, unsigned int end_bus, + unsigned int seg) { struct hvm_mmcfg *mmcfg, *new = xmalloc(struct hvm_mmcfg); @@ -527,9 +526,16 @@ int __hwdom_init register_vpci_mmcfg_handler(struct domain *d, paddr_t addr, if ( new->addr < mmcfg->addr + mmcfg->size && mmcfg->addr < new->addr + new->size ) { + int ret = -EEXIST; + + if ( new->addr == mmcfg->addr && + new->start_bus == mmcfg->start_bus && + new->segment == mmcfg->segment && + new->size == mmcfg->size ) + ret = 0; write_unlock(&d->arch.hvm_domain.mmcfg_lock); xfree(new); - return -EEXIST; + return ret; } if ( list_empty(&d->arch.hvm_domain.mmcfg_regions) ) diff --git a/xen/arch/x86/physdev.c b/xen/arch/x86/physdev.c index a5fedca671..75aa499c51 100644 --- a/xen/arch/x86/physdev.c +++ b/xen/arch/x86/physdev.c @@ -560,6 +560,17 @@ ret_t do_physdev_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg) ret = pci_mmcfg_reserved(info.address, info.segment, info.start_bus, info.end_bus, info.flags); + if ( !ret && has_vpci(currd) ) + { + /* + * For HVM (PVH) domains try to add the newly found MMCFG to the + * domain. + */ + ret = register_vpci_mmcfg_handler(currd, info.address, + info.start_bus, info.end_bus, + info.segment); + } + break; } -- 2.13.5 (Apple Git-94) _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx https://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |