[libvirt PATCH 5/6] qemu: probe for "acpi-index" property

Igor Mammedov imammedo at redhat.com
Tue Apr 6 18:27:07 UTC 2021


On Tue,  6 Apr 2021 16:31:36 +0100
Daniel P. Berrangé <berrange at redhat.com> wrote:

> This property is exposed by QEMU on any PCI device, but we have to pick
> some specific device(s) to probe it against. We expect that at least one
> of the virtio devices will be present, so probe against them.

Would it be useful to expose capability with MachineInfo in QAPI schema?

At least with this on QEMU side I can imagine a crude check and error out
in case device has acpi-index set but machine doesn't support it.


> 
> Signed-off-by: Daniel P. Berrangé <berrange at redhat.com>
> ---
>  src/qemu/qemu_capabilities.c                     | 8 ++++++++
>  src/qemu/qemu_capabilities.h                     | 3 +++
>  tests/qemucapabilitiesdata/caps_6.0.0.x86_64.xml | 1 +
>  3 files changed, 12 insertions(+)
> 
> diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
> index ea24e2d6a5..f44a06c5c9 100644
> --- a/src/qemu/qemu_capabilities.c
> +++ b/src/qemu/qemu_capabilities.c
> @@ -625,6 +625,9 @@ VIR_ENUM_IMPL(virQEMUCaps,
>                "blockdev-backup",
>                "object.qapified",
>                "rotation-rate",
> +
> +              /* 400 */
> +              "acpi-index",
>      );
>  
>  
> @@ -1363,6 +1366,7 @@ static struct virQEMUCapsDevicePropsFlags virQEMUCapsDevicePropsVirtioBalloon[]
>      { "ats", QEMU_CAPS_VIRTIO_PCI_ATS, NULL },
>      { "packed", QEMU_CAPS_VIRTIO_PACKED_QUEUES, NULL },
>      { "free-page-reporting", QEMU_CAPS_VIRTIO_BALLOON_FREE_PAGE_REPORTING, NULL },
> +    { "acpi-index", QEMU_CAPS_ACPI_INDEX, NULL },
>  };
>  
>  
> @@ -1395,6 +1399,7 @@ static struct virQEMUCapsDevicePropsFlags virQEMUCapsDevicePropsVirtioBlk[] = {
>      { "write-cache", QEMU_CAPS_DISK_WRITE_CACHE, NULL },
>      { "werror", QEMU_CAPS_STORAGE_WERROR, NULL },
>      { "packed", QEMU_CAPS_VIRTIO_PACKED_QUEUES, NULL },
> +    { "acpi-index", QEMU_CAPS_ACPI_INDEX, NULL },
>  };
>  
>  static struct virQEMUCapsDevicePropsFlags virQEMUCapsDevicePropsVirtioNet[] = {
> @@ -1408,6 +1413,7 @@ static struct virQEMUCapsDevicePropsFlags virQEMUCapsDevicePropsVirtioNet[] = {
>      { "ats", QEMU_CAPS_VIRTIO_PCI_ATS, NULL },
>      { "failover", QEMU_CAPS_VIRTIO_NET_FAILOVER, NULL },
>      { "packed", QEMU_CAPS_VIRTIO_PACKED_QUEUES, NULL },
> +    { "acpi-index", QEMU_CAPS_ACPI_INDEX, NULL },
>  };
>  
>  static struct virQEMUCapsDevicePropsFlags virQEMUCapsDevicePropsPCIeRootPort[] = {
> @@ -1428,6 +1434,7 @@ static struct virQEMUCapsDevicePropsFlags virQEMUCapsDevicePropsVirtioSCSI[] = {
>      { "iommu_platform", QEMU_CAPS_VIRTIO_PCI_IOMMU_PLATFORM, NULL },
>      { "ats", QEMU_CAPS_VIRTIO_PCI_ATS, NULL },
>      { "packed", QEMU_CAPS_VIRTIO_PACKED_QUEUES, NULL },
> +    { "acpi-index", QEMU_CAPS_ACPI_INDEX, NULL },
>  };
>  
>  static struct virQEMUCapsDevicePropsFlags virQEMUCapsDevicePropsVfioPCI[] = {
> @@ -1499,6 +1506,7 @@ static struct virQEMUCapsDevicePropsFlags virQEMUCapsDevicePropsVirtioGpu[] = {
>      { "iommu_platform", QEMU_CAPS_VIRTIO_PCI_IOMMU_PLATFORM, NULL },
>      { "ats", QEMU_CAPS_VIRTIO_PCI_ATS, NULL },
>      { "packed", QEMU_CAPS_VIRTIO_PACKED_QUEUES, NULL },
> +    { "acpi-index", QEMU_CAPS_ACPI_INDEX, NULL },
>  };
>  
>  static struct virQEMUCapsDevicePropsFlags virQEMUCapsDevicePropsICH9[] = {
> diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
> index a70c00a265..22ff3a2f15 100644
> --- a/src/qemu/qemu_capabilities.h
> +++ b/src/qemu/qemu_capabilities.h
> @@ -606,6 +606,9 @@ typedef enum { /* virQEMUCapsFlags grouping marker for syntax-check */
>      QEMU_CAPS_OBJECT_QAPIFIED, /* parameters for object-add are formally described */
>      QEMU_CAPS_ROTATION_RATE, /* scsi-disk / ide-drive rotation-rate prop */
>  
> +    /* 400 */
> +    QEMU_CAPS_ACPI_INDEX, /* PCI device 'acpi-index' property */
> +
>      QEMU_CAPS_LAST /* this must always be the last item */
>  } virQEMUCapsFlags;
>  
> diff --git a/tests/qemucapabilitiesdata/caps_6.0.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_6.0.0.x86_64.xml
> index 984a2d5896..592560c3ef 100644
> --- a/tests/qemucapabilitiesdata/caps_6.0.0.x86_64.xml
> +++ b/tests/qemucapabilitiesdata/caps_6.0.0.x86_64.xml
> @@ -261,6 +261,7 @@
>    <flag name='blockdev-backup'/>
>    <flag name='object.qapified'/>
>    <flag name='rotation-rate'/>
> +  <flag name='acpi-index'/>
>    <version>5002091</version>
>    <kvmVersion>0</kvmVersion>
>    <microcodeVersion>43100242</microcodeVersion>





More information about the libvir-list mailing list