>-----Original Message-----
>From: Peter Krempa <[email protected]>
>Subject: Re: [PATCH v2 08/12] conf: add pasid_bits attribute to iommu
>
>On Wed, Sep 09, 2026 at 16:29:55 +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                        | 16 ++++++++
>>  src/conf/domain_conf.h                        |  1 +
>>  src/conf/domain_validate.c                    |  3 ++
>>  src/conf/schemas/domaincommon.rng             |  5 +++
>>  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 +
>>  10 files changed, 150 insertions(+)
>>  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..14fe85e817 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.
>
>Both of these have a dash in the name ...
>
>> +      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)
>> +
>>  In case of ``virtio`` IOMMU device, the ``driver`` element can optionally
>>  contain ``granule`` subelement that allows to choose which granule will be
>>  used by default. It is useful when running guests with different page size
>> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
>> index b6c3df0404..7b8a7e7c68 100644
>> --- a/src/conf/domain_conf.c
>> +++ b/src/conf/domain_conf.c
>> @@ -14786,6 +14786,10 @@
>virDomainIOMMUDefParseXML(virDomainXMLOption *xmlopt,
>>                                       &iommu->fsts) < 0)
>>              return NULL;
>>
>> +        if (virXMLPropUInt(driver, "pasid_bits", 10, VIR_XML_PROP_NONE,
>
>... but the actual parser wants an underscore.

Oh, will fix.

>
>> +                           &iommu->pasid_bits) < 0)
>> +            return NULL;
>> +
>>          if ((granule = virXPathNode("./driver/granule", ctxt))) {
>>              g_autofree char *mode = virXMLPropString(granule, "mode");
>>              unsigned long long size;
>
>[...]
>
>> diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
>> index e2076e7c36..16d3006c6f 100644
>> --- a/src/conf/domain_conf.h
>> +++ b/src/conf/domain_conf.h
>> @@ -3106,6 +3106,7 @@ struct _virDomainIOMMUDef {
>>      virTristateSwitch dma_translation;
>>      virTristateSwitch scalable_mode;
>>      virTristateSwitch fsts;
>> +    virTristateSwitch pasid_bits;
>
>This is parsed as an unsigned integer. I know that it typecasts to an
>enum cleanly but nevertheless needs to use the correct type.

Good catch, will fix.

Thanks
Zhenzhong

Reply via email to