]> xenbits.xensource.com Git - people/royger/xen.git/commitdiff
x86/physdev: enable PHYSDEVOP_pci_mmcfg_reserved for PVH Dom0
authorRoger Pau Monne <roger.pau@citrix.com>
Mon, 18 Sep 2017 14:04:23 +0000 (15:04 +0100)
committerRoger Pau Monne <roger.pau@citrix.com>
Mon, 18 Sep 2017 15:21:48 +0000 (16:21 +0100)
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@citrix.com>
---
Cc: Jan Beulich <jbeulich@suse.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
---
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
xen/arch/x86/hvm/io.c
xen/arch/x86/physdev.c

index 5742dd1797b47d98e137fa72fea1c3c002ec4dff..d81160c1f7937f7eb99c52c33f644d43047b72a2 100644 (file)
@@ -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 )
index 7ee20eb5d467bdf52287f1ef01d073fe0ca8e206..ff167bdfc73293e36b5d1768887b842fbbf7543e 100644 (file)
@@ -496,10 +496,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;
 
index 0eb409758fa792b3bb0fd52100ec4264507b6e28..b36add32f15fcf6b64a19992797c0e454293461b 100644 (file)
@@ -559,6 +559,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;
     }