[PATCH v2 00/12] conf, qemu: Add scalable_mode, fsts, pasid_bits, and svm support for intel-iommu

Zhenzhong Duan posted 12 patches 4 days, 19 hours ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/20260909082959.3191720-1-zhenzhong.duan@intel.com
docs/formatdomain.rst                         | 19 ++++++
src/conf/domain_conf.c                        | 64 +++++++++++++++++++
src/conf/domain_conf.h                        |  4 ++
src/conf/domain_validate.c                    | 12 ++++
src/conf/schemas/domaincommon.rng             | 20 ++++++
src/qemu/qemu_capabilities.c                  | 10 +++
src/qemu/qemu_capabilities.h                  |  6 ++
src/qemu/qemu_command.c                       |  4 ++
src/qemu/qemu_validate.c                      | 31 ++++++++-
.../caps_11.0.0_x86_64+sgx.xml                |  1 +
.../caps_11.0.0_x86_64.xml                    |  1 +
.../caps_11.1.0_x86_64.xml                    |  4 ++
.../intel-iommu-fsts.x86_64-latest.args       | 34 ++++++++++
.../intel-iommu-fsts.x86_64-latest.xml        | 37 +++++++++++
tests/qemuxmlconfdata/intel-iommu-fsts.xml    | 37 +++++++++++
.../intel-iommu-pasid-bits.x86_64-latest.args | 34 ++++++++++
.../intel-iommu-pasid-bits.x86_64-latest.xml  | 37 +++++++++++
.../intel-iommu-pasid-bits.xml                | 37 +++++++++++
...tel-iommu-scalable-mode.x86_64-latest.args | 34 ++++++++++
...ntel-iommu-scalable-mode.x86_64-latest.xml | 37 +++++++++++
.../intel-iommu-scalable-mode.xml             | 37 +++++++++++
.../intel-iommu-svm.x86_64-latest.args        | 34 ++++++++++
.../intel-iommu-svm.x86_64-latest.xml         | 37 +++++++++++
tests/qemuxmlconfdata/intel-iommu-svm.xml     | 37 +++++++++++
tests/qemuxmlconftest.c                       |  4 ++
25 files changed, 611 insertions(+), 1 deletion(-)
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
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
create mode 100644 tests/qemuxmlconfdata/intel-iommu-scalable-mode.x86_64-latest.args
create mode 100644 tests/qemuxmlconfdata/intel-iommu-scalable-mode.x86_64-latest.xml
create mode 100644 tests/qemuxmlconfdata/intel-iommu-scalable-mode.xml
create mode 100644 tests/qemuxmlconfdata/intel-iommu-svm.x86_64-latest.args
create mode 100644 tests/qemuxmlconfdata/intel-iommu-svm.x86_64-latest.xml
create mode 100644 tests/qemuxmlconfdata/intel-iommu-svm.xml
[PATCH v2 00/12] conf, qemu: Add scalable_mode, fsts, pasid_bits, and svm support for intel-iommu
Posted by Zhenzhong Duan 4 days, 19 hours ago
Hi,

This series adds support for configuring Intel vIOMMU (VT-d) in domain XML
and formatting them onto the QEMU command line:

  * scalable_mode: Configures scalable mode support ('on'/'off').
  * fsts: Enables First-Stage Translation support ('on'/'off').
  * pasid_bits: Sets the number of supported PASID bits.
  * svm: Enables Shared Virtual Memory (SVM) / PRQ support ('on'/'off').

With these attributes, users can configure advanced vIOMMU features for both
emulated devices and assigned host devices (e.g., vSVA / nested translation via
iommufd and first-stage translation).

Example domain XML configuration:

    <iommu model='intel'>
      <driver caching_mode='on' iotlb='on' scalable_mode='on' fsts='on' pasid_bits='6' svm='on'/>
    </iommu>

Which formats the following QEMU command line options:

    -device {"driver":"intel-iommu","id":"iommu0","caching-mode":true,"device-iotlb":true,"scalable-mode":true,"fsts":true,"pasid-bits":6,"svm":true}

Testing:
  - Validated with libvirt test suite (ninja test).
  - Tested DSA card passthrough and SVM/vSVA with iommufd backend.

Changelog:
v1:
- Added support for 'pasid_bits' and 'svm' attributes.
- rebased to master branch newest

Thanks,
Zhenzhong

Zhenzhong Duan (12):
  qemu_capabilities: Introduce QEMU_CAPS_INTEL_IOMMU_SCALABLE_MODE
  conf: Add scalable_mode attribute to iommu
  qemu: format scalable-mode on intel-iommu command line
  qemu_capabilities: Introduce QEMU_CAPS_INTEL_IOMMU_FSTS
  conf: Add fsts attribute to iommu
  qemu: format fsts on intel-iommu command line
  qemu_capabilities: Introduce QEMU_CAPS_INTEL_IOMMU_PASID_BITS
  conf: add pasid_bits attribute to iommu
  qemu: format pasid-bits on intel-iommu command line
  qemu_capabilities: Introduce QEMU_CAPS_INTEL_IOMMU_SVM
  conf: add svm attribute to iommu
  qemu: format svm on intel-iommu command line

 docs/formatdomain.rst                         | 19 ++++++
 src/conf/domain_conf.c                        | 64 +++++++++++++++++++
 src/conf/domain_conf.h                        |  4 ++
 src/conf/domain_validate.c                    | 12 ++++
 src/conf/schemas/domaincommon.rng             | 20 ++++++
 src/qemu/qemu_capabilities.c                  | 10 +++
 src/qemu/qemu_capabilities.h                  |  6 ++
 src/qemu/qemu_command.c                       |  4 ++
 src/qemu/qemu_validate.c                      | 31 ++++++++-
 .../caps_11.0.0_x86_64+sgx.xml                |  1 +
 .../caps_11.0.0_x86_64.xml                    |  1 +
 .../caps_11.1.0_x86_64.xml                    |  4 ++
 .../intel-iommu-fsts.x86_64-latest.args       | 34 ++++++++++
 .../intel-iommu-fsts.x86_64-latest.xml        | 37 +++++++++++
 tests/qemuxmlconfdata/intel-iommu-fsts.xml    | 37 +++++++++++
 .../intel-iommu-pasid-bits.x86_64-latest.args | 34 ++++++++++
 .../intel-iommu-pasid-bits.x86_64-latest.xml  | 37 +++++++++++
 .../intel-iommu-pasid-bits.xml                | 37 +++++++++++
 ...tel-iommu-scalable-mode.x86_64-latest.args | 34 ++++++++++
 ...ntel-iommu-scalable-mode.x86_64-latest.xml | 37 +++++++++++
 .../intel-iommu-scalable-mode.xml             | 37 +++++++++++
 .../intel-iommu-svm.x86_64-latest.args        | 34 ++++++++++
 .../intel-iommu-svm.x86_64-latest.xml         | 37 +++++++++++
 tests/qemuxmlconfdata/intel-iommu-svm.xml     | 37 +++++++++++
 tests/qemuxmlconftest.c                       |  4 ++
 25 files changed, 611 insertions(+), 1 deletion(-)
 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
 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
 create mode 100644 tests/qemuxmlconfdata/intel-iommu-scalable-mode.x86_64-latest.args
 create mode 100644 tests/qemuxmlconfdata/intel-iommu-scalable-mode.x86_64-latest.xml
 create mode 100644 tests/qemuxmlconfdata/intel-iommu-scalable-mode.xml
 create mode 100644 tests/qemuxmlconfdata/intel-iommu-svm.x86_64-latest.args
 create mode 100644 tests/qemuxmlconfdata/intel-iommu-svm.x86_64-latest.xml
 create mode 100644 tests/qemuxmlconfdata/intel-iommu-svm.xml

-- 
2.52.0
Re: [PATCH v2 00/12] conf, qemu: Add scalable_mode, fsts, pasid_bits, and svm support for intel-iommu
Posted by Peter Krempa via Devel 4 days, 17 hours ago
On Wed, Sep 09, 2026 at 16:29:47 +0800, Zhenzhong Duan wrote:
> Hi,
> 
> This series adds support for configuring Intel vIOMMU (VT-d) in domain XML
> and formatting them onto the QEMU command line:

I've got couple of high-level questions:

> 
>   * scalable_mode: Configures scalable mode support ('on'/'off').
>   * fsts: Enables First-Stage Translation support ('on'/'off').
>   * pasid_bits: Sets the number of supported PASID bits.
>   * svm: Enables Shared Virtual Memory (SVM) / PRQ support ('on'/'off').

Are users actually expected to set these? The libvirt documentation that
is added by this series doesn't really describe what the feature does,
just names them.

So ...

> With these attributes, users can configure advanced vIOMMU features for both
> emulated devices and assigned host devices (e.g., vSVA / nested translation via
> iommufd and first-stage translation).

... can users meaningfully influence what they get? Arent't the defaults
enough?

I'll also add some style/code comments inline.
RE: [PATCH v2 00/12] conf, qemu: Add scalable_mode, fsts, pasid_bits, and svm support for intel-iommu
Posted by Duan, Zhenzhong 3 days, 20 hours ago

>-----Original Message-----
>From: Peter Krempa <pkrempa@redhat.com>
>Subject: Re: [PATCH v2 00/12] conf, qemu: Add scalable_mode, fsts, pasid_bits, and
>svm support for intel-iommu
>
>On Wed, Sep 09, 2026 at 16:29:47 +0800, Zhenzhong Duan wrote:
>> Hi,
>>
>> This series adds support for configuring Intel vIOMMU (VT-d) in domain XML
>> and formatting them onto the QEMU command line:
>
>I've got couple of high-level questions:
>
>>
>>   * scalable_mode: Configures scalable mode support ('on'/'off').
>>   * fsts: Enables First-Stage Translation support ('on'/'off').
>>   * pasid_bits: Sets the number of supported PASID bits.
>>   * svm: Enables Shared Virtual Memory (SVM) / PRQ support ('on'/'off').
>
>Are users actually expected to set these? The libvirt documentation that
>is added by this series doesn't really describe what the feature does,
>just names them.
>
>So ...
>
>> With these attributes, users can configure advanced vIOMMU features for both
>> emulated devices and assigned host devices (e.g., vSVA / nested translation via
>> iommufd and first-stage translation).
>
>... can users meaningfully influence what they get? Arent't the defaults
>enough?

The default of value of pasid_bits is 0, default of other three properties are 'off' in qemu.
So these properties need to be set explicitly to use the advanced vIOMMU
features. To summarize:

- `scalable_mode='on'`:
  Required whenever a guest wants to use Intel Scalable Mode (VT-d 3.0+). Legacy
  mode only supports single address spaces per PCI device; scalable mode allows
  multiple process address spaces (via PASIDs) and 1st-stage/2nd-stage translation.

- `fsts='on'`:
  Enables first-stage (GVA -> GPA) translation in vIOMMU. This is mandatory for
  nested translation (FLPT - First Level Page Table) when assigning devices via
  IOMMUFD and allowing the guest kernel to manage its own stage-1 page tables.

- `pasid_bits`:
  Configures the PASID width supported by the virtual IOMMU (1 to 20 bits). Users
  need to tune this depending on the guest OS scalability requirements or match
  the physical host device capabilities during device assignment (e.g., if a host
  accelerator or physical IOMMU only supports a specific PASID width).

- `svm='on'`:
  Enables Shared Virtual Memory (SVM), which advertises Page Request Interface (PRI)
  and Page Request Queue (PRQ) capabilities. This allows user-space applications inside
  the guest to directly submit work to physical/emulated devices using virtual
  addresses without explicit pinning (shared virtual addressing / SVA).

Thanks
Zhenzhong