On Tue, Aug 11, 2026 at 11:50:44AM -0700, Nathan Chen via Devel wrote:
> From: Nathan Chen <[email protected]>
> 
> Probe the arm-smmuv3 cmdqv device property via device-list-properties,
> gated on QEMU_CAPS_DEVICE_ARM_SMMUV3. Reject domain configs that set
> cmdqv when the QEMU binary lacks the property.
> 
> Signed-off-by: Nathan Chen <[email protected]>
> ---
>  src/qemu/qemu_capabilities.c                       | 4 ++++
>  src/qemu/qemu_capabilities.h                       | 3 +++
>  src/qemu/qemu_validate.c                           | 9 +++++++++
>  tests/qemucapabilitiesdata/caps_11.1.0_aarch64.xml | 1 +
>  4 files changed, 17 insertions(+)
> 
> diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
> index 6abb179951..a0fe9b36a6 100644
> --- a/src/qemu/qemu_capabilities.c
> +++ b/src/qemu/qemu_capabilities.c
> @@ -771,6 +771,9 @@ VIR_ENUM_IMPL(virQEMUCaps,
>                "arm-smmuv3", /* QEMU_CAPS_DEVICE_ARM_SMMUV3 */
>                "arm-smmuv3.smmu_per_bus", /* 
> QEMU_CAPS_ARM_SMMUV3_SMMU_PER_BUS */
>                "arm-smmuv3.accel", /* QEMU_CAPS_ARM_SMMUV3_ACCEL */
> +
> +              /* 500 */
> +              "arm-smmuv3.cmdqv", /* QEMU_CAPS_ARM_SMMUV3_CMDQV */
>      );
>  
>  
> @@ -1651,6 +1654,7 @@ static struct virQEMUCapsDevicePropsFlags 
> virQEMUCapsDevicePropsAMDIOMMU[] = {
>  static struct virQEMUCapsDevicePropsFlags virQEMUCapsDevicePropsArmSmmuv3[] 
> = {
>      { "smmu_per_bus", QEMU_CAPS_ARM_SMMUV3_SMMU_PER_BUS, NULL },
>      { "accel", QEMU_CAPS_ARM_SMMUV3_ACCEL, NULL },
> +    { "cmdqv", QEMU_CAPS_ARM_SMMUV3_CMDQV, NULL },
>  };
>  
>  /* see documentation for virQEMUQAPISchemaPathGet for the query format */
> diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
> index 4563e15156..91c4852ea7 100644
> --- a/src/qemu/qemu_capabilities.h
> +++ b/src/qemu/qemu_capabilities.h
> @@ -746,6 +746,9 @@ typedef enum { /* virQEMUCapsFlags grouping marker for 
> syntax-check */
>      QEMU_CAPS_ARM_SMMUV3_SMMU_PER_BUS, /* arm-smmuv3.smmu_per_bus */
>      QEMU_CAPS_ARM_SMMUV3_ACCEL, /* arm-smmuv3.accel */
>  
> +    /* 500 */
> +    QEMU_CAPS_ARM_SMMUV3_CMDQV, /* arm-smmuv3.cmdqv */
> +
>      QEMU_CAPS_LAST /* this must always be the last item */
>  } virQEMUCapsFlags;
>  
> diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c
> index 61f3bd3278..25527ca2cc 100644
> --- a/src/qemu/qemu_validate.c
> +++ b/src/qemu/qemu_validate.c
> @@ -5829,6 +5829,15 @@ qemuValidateDomainDeviceDefIOMMU(const 
> virDomainIOMMUDef *iommu,
>          return -1;
>      }
>  
> +    /* cmdqv was added after accel; do not treat ACCEL as a proxy for it. */
> +    if (iommu->model == VIR_DOMAIN_IOMMU_MODEL_SMMUV3 &&
> +        iommu->cmdqv != VIR_TRISTATE_SWITCH_ABSENT &&
> +        !virQEMUCapsGet(qemuCaps, QEMU_CAPS_ARM_SMMUV3_CMDQV)) {
> +        virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
> +                       _("iommu: cmdqv is not supported with this QEMU 
> binary"));
> +        return -1;
> +    }
> +
>      if (iommu->granule > 0) {
>          /* QEMU supports only 4KiB, 8KiB, 16KiB and 64KiB granule size */
>          if (!(iommu->granule == 4 ||

This check needs to be moved to PATCH 02, otherwise compilation of this
patch fails because iommu->cmdqv is not defined.

> diff --git a/tests/qemucapabilitiesdata/caps_11.1.0_aarch64.xml 
> b/tests/qemucapabilitiesdata/caps_11.1.0_aarch64.xml
> index e53ad1d461..a7398c39cf 100644
> --- a/tests/qemucapabilitiesdata/caps_11.1.0_aarch64.xml
> +++ b/tests/qemucapabilitiesdata/caps_11.1.0_aarch64.xml
> @@ -191,6 +191,7 @@
>    <flag name='arm-smmuv3'/>
>    <flag name='arm-smmuv3.smmu_per_bus'/>
>    <flag name='arm-smmuv3.accel'/>
> +  <flag name='arm-smmuv3.cmdqv'/>
>    <version>11000090</version>
>    <microcodeVersion>61700287</microcodeVersion>
>    <package>v11.1.0-rc0</package>
> -- 
> 2.43.0
> 

Reply via email to