]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: add host-pci-multidomain capability
authorLaine Stump <laine@laine.org>
Tue, 29 Apr 2014 15:11:45 +0000 (18:11 +0300)
committerLaine Stump <laine@laine.org>
Tue, 6 May 2014 11:32:33 +0000 (14:32 +0300)
Quite a long time ago, (apparently between qemu 0.12 and 0.13) qemu
quietly began supporting the optional specification of a domain in the
host-side address of all pci passthrough commands (by simply
prepending it to the bus:slot.function format, as
"dddd:bb:ss.f"). Since machines with multiple PCI domains are very
rare, this never came up in practice, so libvirt was never updated to
support it.

This patch takes the first step to supporting specification of a non-0
domain in the host-side address of PCI devices being assigned to a
domain, by adding a capability bit to indicate support
"QEMU_CAPS_HOST_PCI_MULTIDOMAIN", and detect it. Since this support
was added in a version prior to the minimum version required for
QMP-style capabilities detection, the capability is always enabled for
any qemu that uses QMP for capabilities detection. For older qemus,
the only clue that a domain can be specified in the host pci address
is the presence of the string "[seg:]" in the help string for
-pcidevice. (Ironically, libvirt will not be modified to support
specification of domain for -pcidevice, since any qemu new enough for
us to care about also supports "-device pci-assign" or "-device
vfio-pci", which are greatly preferred).

src/qemu/qemu_capabilities.c
src/qemu/qemu_capabilities.h
tests/qemucapabilitiesdata/caps_1.2.2-1.caps
tests/qemucapabilitiesdata/caps_1.3.1-1.caps
tests/qemucapabilitiesdata/caps_1.4.2-1.caps
tests/qemucapabilitiesdata/caps_1.5.3-1.caps
tests/qemucapabilitiesdata/caps_1.6.0-1.caps
tests/qemucapabilitiesdata/caps_1.6.50-1.caps
tests/qemuhelptest.c

index b491f58fe1a234f554fa37746cdfcdaff1093b76..834325854b2ae5fcebc5a931299e012347aa913b 100644 (file)
@@ -254,6 +254,7 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST,
               "spiceport",
 
               "usb-kbd", /* 165 */
+              "host-pci-multidomain",
     );
 
 
@@ -1043,6 +1044,8 @@ virQEMUCapsComputeCmdFlags(const char *help,
         virQEMUCapsSet(qemuCaps, QEMU_CAPS_DRIVE_SERIAL);
     if (strstr(help, "-pcidevice"))
         virQEMUCapsSet(qemuCaps, QEMU_CAPS_PCIDEVICE);
+    if (strstr(help, "host=[seg:]bus"))
+        virQEMUCapsSet(qemuCaps, QEMU_CAPS_HOST_PCI_MULTIDOMAIN);
     if (strstr(help, "-mem-path"))
         virQEMUCapsSet(qemuCaps, QEMU_CAPS_MEM_PATH);
     if (strstr(help, "-chardev")) {
@@ -2970,6 +2973,7 @@ virQEMUCapsInitQMPBasic(virQEMUCapsPtr qemuCaps)
     virQEMUCapsSet(qemuCaps, QEMU_CAPS_MACHINE_OPT);
     virQEMUCapsSet(qemuCaps, QEMU_CAPS_DUMP_GUEST_CORE);
     virQEMUCapsSet(qemuCaps, QEMU_CAPS_VNC_SHARE_POLICY);
+    virQEMUCapsSet(qemuCaps, QEMU_CAPS_HOST_PCI_MULTIDOMAIN);
 }
 
 /* Capabilities that are architecture depending
index 5c63b817f12d0ad1c2240485ee991930467270e3..26400d219aeb70a92fe16d14c06a696d2526a6e1 100644 (file)
@@ -204,6 +204,7 @@ enum virQEMUCapsFlags {
     QEMU_CAPS_SPICE_FILE_XFER_DISABLE = 163, /* -spice disable-agent-file-xfer */
     QEMU_CAPS_CHARDEV_SPICEPORT  = 164, /* -chardev spiceport */
     QEMU_CAPS_DEVICE_USB_KBD     = 165, /* -device usb-kbd */
+    QEMU_CAPS_HOST_PCI_MULTIDOMAIN = 166, /* support domain > 0 in host pci address */
 
     QEMU_CAPS_LAST,                   /* this must always be the last item */
 };
index 436cecdde67d3ecad130211895eac83ddde7f811..ebbfb8269198f27300da8ac8862b0d63ae3a605f 100644 (file)
     <flag name='kvm-pit-lost-tick-policy'/>
     <flag name='enable-fips'/>
     <flag name='usb-kbd'/>
+    <flag name='host-pci-multidomain'/>
   </qemuCaps>
index 6b4a8f001a972b0928313b85c9b16a7f3cb1d601..ab631a2e2858d81edd4d5136049c17ddd39dd250 100644 (file)
     <flag name='usb-storage.removable'/>
     <flag name='kvm-pit-lost-tick-policy'/>
     <flag name='usb-kbd'/>
+    <flag name='host-pci-multidomain'/>
   </qemuCaps>
index e3d004748ae8366f253105720634b80700ed43a6..e710b60c56634a59d91fbdd6142df159d752f0b1 100644 (file)
     <flag name='ich9-intel-hda'/>
     <flag name='kvm-pit-lost-tick-policy'/>
     <flag name='usb-kbd'/>
+    <flag name='host-pci-multidomain'/>
   </qemuCaps>
index 01b4d27a39b7f7b993cce9cf682d31c8608785fa..36758c8e970b02dd4905c9a1e2776a9f59bd722d 100644 (file)
     <flag name='reboot-timeout'/>
     <flag name='spiceport'/>
     <flag name='usb-kbd'/>
+    <flag name='host-pci-multidomain'/>
   </qemuCaps>
index 597f8739e8653cd6ff33821eb46be53281b50cf1..7b86c3b650f8e35aedf83696141419c34cbd8172 100644 (file)
     <flag name='spice-file-xfer-disable'/>
     <flag name='spiceport'/>
     <flag name='usb-kbd'/>
+    <flag name='host-pci-multidomain'/>
   </qemuCaps>
index 0c1dd879d3dddcee2bdbce01a061d302f7c89455..10b8251f0710890d17c4ed00504232584157db6d 100644 (file)
     <flag name='spice-file-xfer-disable'/>
     <flag name='spiceport'/>
     <flag name='usb-kbd'/>
+    <flag name='host-pci-multidomain'/>
   </qemuCaps>
index 6eb8096b4a9588b59018160a6a294de7240e44c1..105a563d54b0eb1c3a1fcd47ca490618c52534de 100644 (file)
@@ -517,7 +517,8 @@ mymain(void)
             QEMU_CAPS_DEVICE_PCI_BRIDGE,
             QEMU_CAPS_DEVICE_SCSI_GENERIC,
             QEMU_CAPS_DEVICE_USB_KBD,
-            QEMU_CAPS_DEVICE_USB_STORAGE);
+            QEMU_CAPS_DEVICE_USB_STORAGE,
+            QEMU_CAPS_HOST_PCI_MULTIDOMAIN);
     DO_TEST("qemu-kvm-0.12.1.2-rhel61", 12001, 1, 0,
             QEMU_CAPS_VNC_COLON,
             QEMU_CAPS_NO_REBOOT,