On Tue, Aug 11, 2026 at 11:50:45AM -0700, Nathan Chen via Devel wrote:
> From: Nathan Chen <[email protected]>
> 
> Introduce support for "cmdqv" IOMMU attribute, which
> enables NVIDIA Tegra241 CMDQV, an extension for ARM
> SMMUv3. It supports passthroughs of physical SMMU-CMDQ
> linked command queue from host space to a VM.
> 
> Signed-off-by: Nathan Chen <[email protected]>
> ---
>  docs/formatdomain.rst             |  6 ++++++
>  src/conf/domain_conf.c            | 15 +++++++++++++++
>  src/conf/domain_conf.h            |  1 +
>  src/conf/domain_validate.c        |  6 +++++-
>  src/conf/schemas/domaincommon.rng |  5 +++++
>  src/qemu/qemu_command.c           |  1 +
>  src/qemu/qemu_validate.c          |  1 -
>  7 files changed, 33 insertions(+), 2 deletions(-)
> 
> diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst
> index 0b346a0952..2d5a34cb35 100644
> --- a/docs/formatdomain.rst
> +++ b/docs/formatdomain.rst
> @@ -9436,6 +9436,12 @@ Examples:
>        devices.
>        :since:`Since 12.7.0` (QEMU/KVM and ``smmuv3`` model only)
>  
> +   ``cmdqv``
> +      The ``cmdqv`` attribute with possible values ``on`` and ``off`` can be 
> used
> +      to enable NVIDIA Tegra241 CMDQV, an extension for ARM SMMUv3 that 
> supports
> +      passthrough of physical SMMU-CMDQ linked command queue from host space 
> to VM.
> +      :since:`Since 12.7.0` (QEMU/KVM and ``smmuv3`` model only)
> +

It should mention the default value if accel is enabled like the other
attributes.

>     ``ats``
>        The ``ats`` attribute with possible values ``on`` and ``off`` can be
>        used to enable reporting Address Translation Services capability to
> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> index 9880339e42..42a0faca88 100644
> --- a/src/conf/domain_conf.c
> +++ b/src/conf/domain_conf.c
> @@ -14758,6 +14758,10 @@ virDomainIOMMUDefParseXML(virDomainXMLOption *xmlopt,
>                                       &iommu->accel) < 0)
>              return NULL;
>  
> +        if (virXMLPropTristateSwitch(driver, "cmdqv", VIR_XML_PROP_NONE,
> +                                     &iommu->cmdqv) < 0)
> +            return NULL;
> +
>          if (virXMLPropTristateSwitch(driver, "ats", VIR_XML_PROP_NONE,
>                                       &iommu->ats) < 0)
>              return NULL;
> @@ -16879,6 +16883,7 @@ virDomainIOMMUDefEquals(const virDomainIOMMUDef *a,
>          a->dma_translation != b->dma_translation ||
>          a->pci_bus != b->pci_bus ||
>          a->accel != b->accel ||
> +        a->cmdqv != b->cmdqv ||
>          a->ats != b->ats ||
>          a->ril != b->ril ||
>          a->ssid_size != b->ssid_size ||
> @@ -22773,6 +22778,12 @@ virDomainIOMMUDefCheckABIStability(virDomainIOMMUDef 
> *src,
>                         dst->accel, src->accel);
>          return false;
>      }
> +    if (src->cmdqv != dst->cmdqv) {
> +        virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
> +                       _("Target domain IOMMU device cmdqv value '%1$d' does 
> not match source '%2$d'"),
> +                       dst->cmdqv, src->cmdqv);
> +        return false;
> +    }
>      if (src->ats != dst->ats) {
>          virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
>                         _("Target domain IOMMU device ATS value '%1$d' does 
> not match source '%2$d'"),
> @@ -29271,6 +29282,10 @@ virDomainIOMMUDefFormat(virBuffer *buf,
>          virBufferAsprintf(&driverAttrBuf, " accel='%s'",
>                            virTristateSwitchTypeToString(iommu->accel));
>      }
> +    if (iommu->cmdqv != VIR_TRISTATE_SWITCH_ABSENT) {
> +            virBufferAsprintf(&driverAttrBuf, " cmdqv='%s'",
> +                              virTristateSwitchTypeToString(iommu->cmdqv));
> +        }
>      if (iommu->ats != VIR_TRISTATE_SWITCH_ABSENT) {
>          virBufferAsprintf(&driverAttrBuf, " ats='%s'",
>                            virTristateSwitchTypeToString(iommu->ats));
> diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
> index 2c017738e3..0c79bea015 100644
> --- a/src/conf/domain_conf.h
> +++ b/src/conf/domain_conf.h
> @@ -3106,6 +3106,7 @@ struct _virDomainIOMMUDef {
>      virTristateSwitch pt;
>      int granule; /* -1 means 'host', 0 unset, page size in KiB otherwise */
>      virTristateSwitch accel;
> +    virTristateSwitch cmdqv;
>      virTristateSwitch ats;
>      virTristateSwitch ril;
>      int ssid_size;
> diff --git a/src/conf/domain_validate.c b/src/conf/domain_validate.c
> index 710a891904..59b6c5f6d7 100644
> --- a/src/conf/domain_validate.c
> +++ b/src/conf/domain_validate.c
> @@ -3207,7 +3207,8 @@ virDomainIOMMUDefValidate(const virDomainIOMMUDef 
> *iommu)
>              (iommu->ats != VIR_TRISTATE_SWITCH_ABSENT ||
>               iommu->ril != VIR_TRISTATE_SWITCH_ABSENT ||
>               iommu->ssid_size >= 0 ||
> -             iommu->oas >= 0)) {
> +             iommu->oas >= 0 ||
> +             iommu->cmdqv != VIR_TRISTATE_SWITCH_ABSENT)) {

For consistency with the other conditions I would move the check between
accel and ats.

Otherwise looks good.

Pavel

Reply via email to