On Mon, Sep 14, 2026 at 16:28:57 +0800, Zhenzhong Duan wrote:
> Add fsts attribute to iommu to enable/disable first stage translation
> support for intel-iommu.
> 
> Signed-off-by: Zhenzhong Duan <[email protected]>
> ---
>  docs/formatdomain.rst                         |  4 ++
>  src/conf/domain_conf.c                        | 16 ++++++++
>  src/conf/domain_conf.h                        |  1 +
>  src/conf/domain_validate.c                    | 11 ++++++
>  src/conf/schemas/domaincommon.rng             |  5 +++
>  src/qemu/qemu_command.c                       |  1 +
>  src/qemu/qemu_validate.c                      |  6 +++
>  .../intel-iommu-fsts.x86_64-latest.args       | 34 +++++++++++++++++
>  .../intel-iommu-fsts.x86_64-latest.xml        | 37 +++++++++++++++++++
>  tests/qemuxmlconfdata/intel-iommu-fsts.xml    | 37 +++++++++++++++++++
>  tests/qemuxmlconftest.c                       |  1 +
>  11 files changed, 153 insertions(+)
>  create mode 100644 tests/qemuxmlconfdata/intel-iommu-fsts.x86_64-latest.args
>  create mode 100644 tests/qemuxmlconfdata/intel-iommu-fsts.x86_64-latest.xml
>  create mode 100644 tests/qemuxmlconfdata/intel-iommu-fsts.xml
> 
> diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst
> index 761c5747ed..f376cefc16 100644
> --- a/docs/formatdomain.rst
> +++ b/docs/formatdomain.rst
> @@ -9486,6 +9486,10 @@ Examples:
>        Enable scalable mode DMA translation.
>        :since:`Since 12.8.0` (QEMU/KVM and ``intel`` model only)
>  
> +   ``fsts``
> +      Enable first stage translation.
> +      :since:`Since 12.8.0` (QEMU/KVM and ``intel`` model only)

12.10.0

> @@ -3290,6 +3293,14 @@ virDomainIOMMUDefValidate(const virDomainIOMMUDef 
> *iommu)
>                             virDomainIOMMUModelTypeToString(iommu->model));
>              return -1;
>          }
> +
> +        if (iommu->scalable_mode != VIR_TRISTATE_SWITCH_ON &&
> +            iommu->fsts == VIR_TRISTATE_SWITCH_ON) {

Such conditions since they are hardcoded ought to be documented so that
the user doesn't have to second-guess based on errors.

For this patch I'll commit it as-is as it's a relatively niche feature.
You can then consider fixing the docs in a follow up.


> +            virReportError(VIR_ERR_XML_ERROR,
> +                           _("iommu model '%1$s' 'fsts' requires 
> 'scalable_mode' to be 'on'"),
> +                           virDomainIOMMUModelTypeToString(iommu->model));
> +            return -1;
> +        }
>          break;
>  

Reviewed-by: Peter Krempa <[email protected]>

Reply via email to