1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2024-12-22 17:34:18 +03:00

Introduce QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY

Check whether the disable-legacy property is present on the following
devices:
  virtio-balloon-pci
  virtio-blk-pci
  virtio-scsi-pci
  virtio-serial-pci
  virtio-9p-pci
  virtio-net-pci
  virtio-rng-pci
  virtio-gpu-pci
  virtio-input-host-pci
  virtio-keyboard-pci
  virtio-mouse-pci
  virtio-tablet-pci

Assuming that if QEMU knows other virtio devices where this property
is applicable, it will have at least one of these devices.

Added in QEMU by:
commit e266d421490e0ae83044bbebb209b2d3650c0ba6
    virtio-pci: add flags to enable/disable legacy/modern
This commit is contained in:
Ján Tomko 2016-08-08 16:05:27 +02:00
parent d53d465083
commit 41f5c2ca27
9 changed files with 66 additions and 0 deletions

View File

@ -340,6 +340,7 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST,
"display", /* 230 */
"intel-iommu",
"smm",
"virtio-pci-disable-legacy",
);
@ -1741,6 +1742,34 @@ static struct virQEMUCapsObjectTypeProps virQEMUCapsObjectProps[] = {
ARRAY_CARDINALITY(virQEMUCapsObjectPropsUSBNECXHCI) },
};
struct virQEMUCapsPropTypeObjects {
const char *prop;
int flag;
const char **objects;
};
static const char *virQEMUCapsVirtioPCIDisableLegacyObjects[] = {
"virtio-balloon-pci",
"virtio-blk-pci",
"virtio-scsi-pci",
"virtio-serial-pci",
"virtio-9p-pci",
"virtio-net-pci",
"virtio-rng-pci",
"virtio-gpu-pci",
"virtio-input-host-pci",
"virtio-keyboard-pci",
"virtio-mouse-pci",
"virtio-tablet-pci",
NULL
};
static struct virQEMUCapsPropTypeObjects virQEMUCapsPropObjects[] = {
{ "disable-legacy",
QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY,
virQEMUCapsVirtioPCIDisableLegacyObjects }
};
static void
virQEMUCapsProcessStringFlags(virQEMUCapsPtr qemuCaps,
@ -1761,6 +1790,31 @@ virQEMUCapsProcessStringFlags(virQEMUCapsPtr qemuCaps,
}
static void
virQEMUCapsProcessProps(virQEMUCapsPtr qemuCaps,
size_t nprops,
struct virQEMUCapsPropTypeObjects *props,
const char *object,
size_t nvalues,
char *const*values)
{
size_t i, j;
for (i = 0; i < nprops; i++) {
if (virQEMUCapsGet(qemuCaps, props[i].flag))
continue;
for (j = 0; j < nvalues; j++) {
if (STREQ(values[j], props[i].prop)) {
if (virStringArrayHasString(props[i].objects, object))
virQEMUCapsSet(qemuCaps, props[i].flag);
break;
}
}
}
}
static void
virQEMUCapsFreeStringList(size_t len,
char **values)
@ -2470,6 +2524,10 @@ virQEMUCapsProbeQMPObjects(virQEMUCapsPtr qemuCaps,
virQEMUCapsObjectProps[i].nprops,
virQEMUCapsObjectProps[i].props,
nvalues, values);
virQEMUCapsProcessProps(qemuCaps,
ARRAY_CARDINALITY(virQEMUCapsPropObjects),
virQEMUCapsPropObjects, type,
nvalues, values);
virQEMUCapsFreeStringList(nvalues, values);
}

View File

@ -373,6 +373,7 @@ typedef enum {
QEMU_CAPS_DISPLAY, /* -display */
QEMU_CAPS_DEVICE_INTEL_IOMMU, /* -device intel-iommu */
QEMU_CAPS_MACHINE_SMM_OPT, /* -machine xxx,smm=on/off/auto */
QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY, /* virtio-*pci.disable-legacy */
QEMU_CAPS_LAST /* this must always be the last item */
} virQEMUCapsFlags;

View File

@ -184,6 +184,7 @@
<flag name='display'/>
<flag name='intel-iommu'/>
<flag name='smm'/>
<flag name='virtio-pci-disable-legacy'/>
<version>2004000</version>
<kvmVersion>0</kvmVersion>
<package></package>

View File

@ -189,6 +189,7 @@
<flag name='display'/>
<flag name='intel-iommu'/>
<flag name='smm'/>
<flag name='virtio-pci-disable-legacy'/>
<version>2005000</version>
<kvmVersion>0</kvmVersion>
<package></package>

View File

@ -158,6 +158,7 @@
<flag name='tls-creds-x509'/>
<flag name='display'/>
<flag name='smm'/>
<flag name='virtio-pci-disable-legacy'/>
<version>2005094</version>
<kvmVersion>0</kvmVersion>
<package></package>

View File

@ -158,6 +158,7 @@
<flag name='tls-creds-x509'/>
<flag name='display'/>
<flag name='smm'/>
<flag name='virtio-pci-disable-legacy'/>
<version>2005094</version>
<kvmVersion>0</kvmVersion>
<package></package>

View File

@ -152,6 +152,7 @@
<flag name='tls-creds-x509'/>
<flag name='display'/>
<flag name='smm'/>
<flag name='virtio-pci-disable-legacy'/>
<version>2005094</version>
<kvmVersion>0</kvmVersion>
<package></package>

View File

@ -195,6 +195,7 @@
<flag name='display'/>
<flag name='intel-iommu'/>
<flag name='smm'/>
<flag name='virtio-pci-disable-legacy'/>
<version>2006000</version>
<kvmVersion>0</kvmVersion>
<package></package>

View File

@ -192,6 +192,7 @@
<flag name='display'/>
<flag name='intel-iommu'/>
<flag name='smm'/>
<flag name='virtio-pci-disable-legacy'/>
<version>2006091</version>
<kvmVersion>0</kvmVersion>
<package> (v2.7.0-rc1-52-g42e0d60)</package>