On Mon, Sep 14, 2026 at 16:29:00 +0800, Zhenzhong Duan wrote:
> Add pasid_bits attribute to iommu to set pasid bit width or disable
> pasid capability if 0 for intel-iommu.
>
> Signed-off-by: Zhenzhong Duan <[email protected]>
> ---
> docs/formatdomain.rst | 5 +++
> src/conf/domain_conf.c | 15 ++++++++
> src/conf/domain_conf.h | 1 +
> src/conf/domain_validate.c | 23 +++++++++---
> src/conf/schemas/domaincommon.rng | 5 +++
> src/qemu/qemu_command.c | 1 +
> src/qemu/qemu_validate.c | 11 ++++++
> .../intel-iommu-pasid-bits.x86_64-latest.args | 34 +++++++++++++++++
> .../intel-iommu-pasid-bits.x86_64-latest.xml | 37 +++++++++++++++++++
> .../intel-iommu-pasid-bits.xml | 37 +++++++++++++++++++
> tests/qemuxmlconftest.c | 1 +
> 11 files changed, 164 insertions(+), 6 deletions(-)
> create mode 100644
> tests/qemuxmlconfdata/intel-iommu-pasid-bits.x86_64-latest.args
> create mode 100644
> tests/qemuxmlconfdata/intel-iommu-pasid-bits.x86_64-latest.xml
> create mode 100644 tests/qemuxmlconfdata/intel-iommu-pasid-bits.xml
>
> diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst
> index f376cefc16..76ce8f88c3 100644
> --- a/docs/formatdomain.rst
> +++ b/docs/formatdomain.rst
> @@ -9490,6 +9490,11 @@ Examples:
> Enable first stage translation.
> :since:`Since 12.8.0` (QEMU/KVM and ``intel`` model only)
>
> + ``pasid_bits``
> + The ``pasid_bits`` attribute can be used to set the pasid bit width.
> + Max supported value is 20 according to PCI spec, pasid is disabled if
> 0.
> + :since:`Since 12.8.0` (QEMU/KVM and ``intel`` model only)
12.10.0; changed before pushing
> return -1
> }
>
> - if (iommu->scalable_mode != VIR_TRISTATE_SWITCH_ON &&
> - iommu->fsts == VIR_TRISTATE_SWITCH_ON) {
> - virReportError(VIR_ERR_XML_ERROR,
> - _("iommu model '%1$s' 'fsts' requires
> 'scalable_mode' to be 'on'"),
> - virDomainIOMMUModelTypeToString(iommu->model));
> - return -1;
> + if (iommu->scalable_mode != VIR_TRISTATE_SWITCH_ON) {
> + if (iommu->fsts == VIR_TRISTATE_SWITCH_ON) {
> + virReportError(VIR_ERR_XML_ERROR,
> + _("iommu model '%1$s' 'fsts' requires
> 'scalable_mode' to be 'on'"),
> +
> virDomainIOMMUModelTypeToString(iommu->model));
> + return -1;
> + }
> +
> + if (iommu->pasid_bits > 0) {
> + virReportError(VIR_ERR_XML_ERROR,
> + _("iommu model '%1$s' 'pasid_bits' requires
> 'scalable_mode' to be 'on'"),
> +
> virDomainIOMMUModelTypeToString(iommu->model));
> + return -1;
necessity to enable scalable mode oght to be documented
Reviewed-by: Peter Krempa <[email protected]>