On Tue, Feb 24, 2026 at 10:03:01AM -0800, Nathan Chen wrote:
> Hi Pavel,

Hi Nathan,

> On 2/23/2026 12:21 PM, Pavel Hrdina wrote:
> > > +   ``ril``
> > > +      The ``ril`` attribute with possible values ``on`` and ``off`` can 
> > > be used
> > > +      to report whether Range Invalidation for smmuv3Dev IOMMU devices 
> > > with
> > > +      ``accel`` set to ``on`` is compatible with host SMMUv3 support.
> > > +      (QEMU/KVM and ``smmuv3`` model only)
> > Current default in QEMU is `on` but if `accel` is enabled it has to match
> > what is supported by host SMMUv3 and QEMU errors out if incorrect value
> > is used.
> > 
> > I wonder why QEMU cannot figure out the default value if nothing is
> > specified? This way when acceleration is enabled and host SMMUv3 doesn't
> > support RIL user needs to manually set this option as well.
> > 
> > > +
> > > +   ``ssidSize``
> > > +      The ``ssidSize`` attribute sets the number of bits used to 
> > > represent
> > > +      SubstreamIDs. A value of N allows SSIDs in the range [0 .. 2^N - 
> > > 1].
> > > +      The valid range is 0-20, and a value greater than 0 is required for
> > > +      enabling PASID support, as doing so advertises PASID capability to
> > > +      the vIOMMU. (QEMU/KVM and ``smmuv3`` model only)
> > By default this is disabled in QEMU and can be used only with accel
> > enabled. If user picks 20 it can be still rejected by QEMU if the host
> > doesn't support that size.
> > 
> > Is this necessary to be enabled and what is reasonable default user
> > should use?
> > 
> > > +   ``oas``
> > > +      The ``oas`` attribute sets the output address size in units of 
> > > bits.
> > > +      (QEMU/KVM and ``smmuv3`` model only)
> > Currently supported values in QEMU are 44 and 48
> > bits. QEMU defaults to 44, if accel is off it has to be 44, if accel
> > is on it can be 48. In addition QEMU also errors out if user sets OAS
> > greater than what is supported by host.
> > 
> > How is user supposed to figure this out and why QEMU cannot pick
> > reasonable default?
> > 
> > >   The ``virtio`` IOMMU devices can further have ``address`` element as 
> > > described
> > >   in `Device addresses`_ (address has to by type of ``pci``).
> > For all these options we should store the default value in XML if user
> > doesn't provide it to make sure that existing VMs will not change if
> > QEMU changes its defaults.
> 
> There has been some discussion on supporting an 'auto' value for these
> properties in the QEMU layer [0]. I think it would make sense to refresh
> this series with support for the 'auto' value, deriving these properties
> from host IOMMU capabilities so Libvirt users do not have to introspect host
> settings.
> 
> Would you suggest consolidating this implementation into a single 'accel'
> driver attribute, and then setting the values for ril, ssidsize, and oas to
> 'auto' in the qemu command line when accel=on? Or still supporting
> user-defined values for ril, ssidsize, and oas but also supporting 'auto'?

That depends if it's expected from users to change these values and why
would they change them.

For example ssidSize set to 0 disables PASID support, is it expected
from users to disable this feature or set ssidsize to any specific
value? If yes we need to have this attribute in XML but we should also
use reasonable default that is supported by current host.

RIL currently needs to be disabled but my guess is in the future it will
be possible to have it enabled.

OAS currently can be only 44 when accel is disabled, but can be 48 if
accel is enabled, is it expected from users to use 44 with accel
enabled? And in the future will there be any other value supported and
possible used as default?

Same for ATS, is it expected from users to disable it when accel is
enabled?

It also depends if migration of running VM with accelerated SMMUv3
is/will be supported. If yes we will need to have the current values in
XML to make sure migration to different host with possibly different
supported values will be rejected as otherwise the VM device would
change.

I would say it should be enough to set only `accel='on'` and the rest
should be filled in using reasonable defaults unless it is explicitly
specified in XML and every default should be stored in the XML.

That should be ideally done when the VM is defined, so all values are
stored in config XML, otherwise we would have to read the values from
running QEMU process every time the VM is started.

This would require QEMU to report the default values based on what host
and QEMU supports via QAPI so libvirt can ask QEMU when defining new VM
or libvirt would have to figure this out probing host directly.
This means libvirt doesn't need adding `auto` as possible value for
these properties.

We could add `mode='host'` like it was done for virtio-iommu granule but
IMO that should translate to `accel=host` on QEMU command line and QEMU
should error out if any other property is set.

Pavel

> Thanks,
> Nathan
> 
> [0] 
> https://lore.kernel.org/qemu-devel/[email protected]/

Attachment: signature.asc
Description: PGP signature

Reply via email to