mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 17:34:18 +03:00
qemu: add host-pci-multidomain capability
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).
This commit is contained in:
parent
eb54426659
commit
17133e3702
@ -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
|
||||
|
@ -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 */
|
||||
};
|
||||
|
@ -114,4 +114,5 @@
|
||||
<flag name='kvm-pit-lost-tick-policy'/>
|
||||
<flag name='enable-fips'/>
|
||||
<flag name='usb-kbd'/>
|
||||
<flag name='host-pci-multidomain'/>
|
||||
</qemuCaps>
|
||||
|
@ -127,4 +127,5 @@
|
||||
<flag name='usb-storage.removable'/>
|
||||
<flag name='kvm-pit-lost-tick-policy'/>
|
||||
<flag name='usb-kbd'/>
|
||||
<flag name='host-pci-multidomain'/>
|
||||
</qemuCaps>
|
||||
|
@ -128,4 +128,5 @@
|
||||
<flag name='ich9-intel-hda'/>
|
||||
<flag name='kvm-pit-lost-tick-policy'/>
|
||||
<flag name='usb-kbd'/>
|
||||
<flag name='host-pci-multidomain'/>
|
||||
</qemuCaps>
|
||||
|
@ -136,4 +136,5 @@
|
||||
<flag name='reboot-timeout'/>
|
||||
<flag name='spiceport'/>
|
||||
<flag name='usb-kbd'/>
|
||||
<flag name='host-pci-multidomain'/>
|
||||
</qemuCaps>
|
||||
|
@ -142,4 +142,5 @@
|
||||
<flag name='spice-file-xfer-disable'/>
|
||||
<flag name='spiceport'/>
|
||||
<flag name='usb-kbd'/>
|
||||
<flag name='host-pci-multidomain'/>
|
||||
</qemuCaps>
|
||||
|
@ -140,4 +140,5 @@
|
||||
<flag name='spice-file-xfer-disable'/>
|
||||
<flag name='spiceport'/>
|
||||
<flag name='usb-kbd'/>
|
||||
<flag name='host-pci-multidomain'/>
|
||||
</qemuCaps>
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user