1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-03-07 17:28:15 +00:00

qemu: detect vfio-pci device and its bootindex parameter

QEMU_CAPS_DEVICE_VFIO_PCI is set if the device named "vfio-pci" is
supported in the qemu binary.

QEMU_CAPS_VFIO_PCI_BOOTINDEX is set if the vfio-pci device supports
the "bootindex" parameter;  for some reason, the bootindex parameter
wasn't included in early versions of vfio support (qemu 1.4) so we
have to check for it separately from vfio itself.
This commit is contained in:
Laine Stump 2013-04-17 14:16:28 -04:00
parent 1fbf190554
commit 5b90ef0847
2 changed files with 11 additions and 1 deletions

View File

@ -223,6 +223,8 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST,
"nvram", /* 140 */
"pci-bridge", /* 141 */
"vfio-pci", /* 142 */
"vfio-pci.bootindex", /* 143 */
);
struct _virQEMUCaps {
@ -1352,6 +1354,7 @@ struct virQEMUCapsStringFlags virQEMUCapsObjectTypes[] = {
{ "rng-egd", QEMU_CAPS_OBJECT_RNG_EGD },
{ "spapr-nvram", QEMU_CAPS_DEVICE_NVRAM },
{ "pci-bridge", QEMU_CAPS_DEVICE_PCI_BRIDGE },
{ "vfio-pci", QEMU_CAPS_DEVICE_VFIO_PCI },
};
static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsVirtioBlk[] = {
@ -1374,6 +1377,10 @@ static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsPciAssign[] = {
{ "bootindex", QEMU_CAPS_PCI_BOOTINDEX },
};
static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsVfioPci[] = {
{ "bootindex", QEMU_CAPS_VFIO_PCI_BOOTINDEX },
};
static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsScsiDisk[] = {
{ "channel", QEMU_CAPS_SCSI_DISK_CHANNEL },
{ "wwn", QEMU_CAPS_SCSI_DISK_WWN },
@ -1420,6 +1427,8 @@ static struct virQEMUCapsObjectTypeProps virQEMUCapsObjectProps[] = {
ARRAY_CARDINALITY(virQEMUCapsObjectPropsPciAssign) },
{ "kvm-pci-assign", virQEMUCapsObjectPropsPciAssign,
ARRAY_CARDINALITY(virQEMUCapsObjectPropsPciAssign) },
{ "vfio-pci", virQEMUCapsObjectPropsVfioPci,
ARRAY_CARDINALITY(virQEMUCapsObjectPropsVfioPci) },
{ "scsi-disk", virQEMUCapsObjectPropsScsiDisk,
ARRAY_CARDINALITY(virQEMUCapsObjectPropsScsiDisk) },
{ "ide-drive", virQEMUCapsObjectPropsIDEDrive,

View File

@ -178,9 +178,10 @@ enum virQEMUCapsFlags {
QEMU_CAPS_MACHINE_USB_OPT = 137, /* -machine xxx,usb=on/off */
QEMU_CAPS_DEVICE_TPM_PASSTHROUGH = 138, /* -tpmdev passthrough */
QEMU_CAPS_DEVICE_TPM_TIS = 139, /* -device tpm_tis */
QEMU_CAPS_DEVICE_NVRAM = 140, /* -global spapr-nvram.reg=xxxx */
QEMU_CAPS_DEVICE_PCI_BRIDGE = 141, /* -device pci-bridge */
QEMU_CAPS_DEVICE_VFIO_PCI = 142, /* -device vfio-pci */
QEMU_CAPS_VFIO_PCI_BOOTINDEX = 143, /* bootindex param for vfio-pci device */
QEMU_CAPS_LAST, /* this must always be the last item */
};