hw/vfio/pci.h | 1 + include/system/host_iommu_device.h | 9 +++ backends/iommufd.c | 8 +++ hw/vfio/pci.c | 88 ++++++++++++++++++++++++++++-- 4 files changed, 102 insertions(+), 4 deletions(-)
Hi,
This is a follow-up to the series [0] that adds an ATS control property
to vfio-pci and wires iommufd support reporting so vfio-pci can decide
whether to expose the ATS PCIe extended capability to the guest.
The new vfio-pci property is:
ats=on|off|auto (default: auto)
Behavior:
- off: always masks ATS from guest view
- on: requires ATS support; fails realize if kernel reports no ATS
support via IOMMU_HW_CAP_PCI_ATS_NOT_SUPPORTED
- auto: masks ATS only when kernel reports no ATS support via
IOMMU_HW_CAP_PCI_ATS_NOT_SUPPORTED
If the physical device does not have ATS, the ATS cap will not be
present for the device in the guest, and a warning will be emitted when
ats is set to on.
We intentionally omit a legacy ats=on compat override because forcing
the value to "on" on old machine types can turn a host-kernel capability
update (IOMMU_HW_CAP_PCI_ATS_NOT_SUPPORTED) into a new realize-time boot
failure. So we keep the uniform default ats=auto to preserve bootability
and follow effective kernel ATS support rather than preserving the old
behavior of always advertising ATS when available.
Please note that no linux-headers sync patch is included in this series
because IOMMU_HW_CAP_PCI_ATS_NOT_SUPPORTED is already present in
linux-headers/linux/iommufd.h in the current base.
Testing:
Verified ATS capability visibility changes with vfio-pci ats=off/on/auto
on an NVIDIA Grace system:
- ats=on + ATS supported by kernel => propagate ATS extended cap to
guest view
- ats=auto + ATS supported by kernel => propagate ATS extended cap to
guest view
- ats=on + hiod_iommufd_support_ats modified to return false (mimic
kernel-reported unsupported ATS) => realize failure
- ats=auto + hiod_iommufd_support_ats modified to return false (mimic
kernel-reported unsupported ATS) => ATS masked
- ats=off => ATS masked
- ats=on + no ATS support in physical device => warning + no ATS ext cap
Changes from v3:
- Move warning for missing kernel ATS support when ats=auto to after
checking the presence of host device ATS cap. Only emit the warning
about masking ATS cap when ATS cap is present on the host device.
- Emit warning about no ATS support in physical device only when ats=on
instead of both ats=auto and ats=on cases (via ats_needed).
Changes from v2:
- Added R-by tags, thanks all!
- Fixed alignment of two
object_class_property_set_description() blocks in vfio_pci_properties[]
- Removed compat override setting ats=on and added a warning to the case
where ats=auto and kernel reports ATS is not supported.
- Squash patch for warning when ats=on and there is no ATS support in
physical device into patch #2
- Emit warning when ats=auto and no ATS support in physical device
Changes from v1:
- Set ats_needed to false by default in
vfio_pci_ats_requested_and_supported()
- Revise log prefix from "vfio" to "vfio-pci" in
vfio_pci_ats_requested_and_supported()
- Squash compat update patch into patch for introducing ats property for
bisectibility
- Revise comments and descriptions for support_ats(),
vfio_pci_ats_requested_and_supported(), and vfio_pci_class_init() to
be more generic, removing references to
IOMMU_HW_CAP_PCI_ATS_NOT_SUPPORTED
- Emit a warning when ats=on and no ATS support in physical device
Changes from "Resolve AUTO properties" series:
- Split into separate patches for support_ats() handler introduction and
iommufd implementation, "ats" property addition, and compat property fix
- Rebase on vfio-next
- Remove unnecessary includes for hw/vfio/pci.c
- Rename ats_need to ats_needed for vfio_pci_ats_requested_and_supported()
- Move the vfio_pci_ats_requested_and_supported() call to
vfio_pci_add_capabilities() so we can propagate the Error **, and then pass
ats_needed as a new input arg to vfio_add_ext_cap
- Fix indent error in vfio_add_ext_cap()
- Break and add a pcie_add_capability() call for the PASID case in
vfio_add_ext_cap()
- Update comment about return value for support_ats()
Thanks,
Nathan
[0] https://lore.kernel.org/qemu-devel/20260623023540.836825-1-nathanc@nvidia.com/
Nathan Chen (2):
iommufd: Introduce handler for device ATS support
vfio/pci: Add ats property
hw/vfio/pci.h | 1 +
include/system/host_iommu_device.h | 9 +++
backends/iommufd.c | 8 +++
hw/vfio/pci.c | 88 ++++++++++++++++++++++++++++--
4 files changed, 102 insertions(+), 4 deletions(-)
--
2.43.0
On 6/23/26 22:49, Nathan Chen wrote:
> Hi,
>
> This is a follow-up to the series [0] that adds an ATS control property
> to vfio-pci and wires iommufd support reporting so vfio-pci can decide
> whether to expose the ATS PCIe extended capability to the guest.
>
> The new vfio-pci property is:
> ats=on|off|auto (default: auto)
>
> Behavior:
> - off: always masks ATS from guest view
> - on: requires ATS support; fails realize if kernel reports no ATS
> support via IOMMU_HW_CAP_PCI_ATS_NOT_SUPPORTED
> - auto: masks ATS only when kernel reports no ATS support via
> IOMMU_HW_CAP_PCI_ATS_NOT_SUPPORTED
>
> If the physical device does not have ATS, the ATS cap will not be
> present for the device in the guest, and a warning will be emitted when
> ats is set to on.
>
> We intentionally omit a legacy ats=on compat override because forcing
> the value to "on" on old machine types can turn a host-kernel capability
> update (IOMMU_HW_CAP_PCI_ATS_NOT_SUPPORTED) into a new realize-time boot
> failure. So we keep the uniform default ats=auto to preserve bootability
> and follow effective kernel ATS support rather than preserving the old
> behavior of always advertising ATS when available.
>
> Please note that no linux-headers sync patch is included in this series
> because IOMMU_HW_CAP_PCI_ATS_NOT_SUPPORTED is already present in
> linux-headers/linux/iommufd.h in the current base.
>
> Testing:
> Verified ATS capability visibility changes with vfio-pci ats=off/on/auto
> on an NVIDIA Grace system:
> - ats=on + ATS supported by kernel => propagate ATS extended cap to
> guest view
> - ats=auto + ATS supported by kernel => propagate ATS extended cap to
> guest view
> - ats=on + hiod_iommufd_support_ats modified to return false (mimic
> kernel-reported unsupported ATS) => realize failure
> - ats=auto + hiod_iommufd_support_ats modified to return false (mimic
> kernel-reported unsupported ATS) => ATS masked
> - ats=off => ATS masked
> - ats=on + no ATS support in physical device => warning + no ATS ext cap
>
> Changes from v3:
> - Move warning for missing kernel ATS support when ats=auto to after
> checking the presence of host device ATS cap. Only emit the warning
> about masking ATS cap when ATS cap is present on the host device.
> - Emit warning about no ATS support in physical device only when ats=on
> instead of both ats=auto and ats=on cases (via ats_needed).
>
> Changes from v2:
> - Added R-by tags, thanks all!
> - Fixed alignment of two
> object_class_property_set_description() blocks in vfio_pci_properties[]
> - Removed compat override setting ats=on and added a warning to the case
> where ats=auto and kernel reports ATS is not supported.
> - Squash patch for warning when ats=on and there is no ATS support in
> physical device into patch #2
> - Emit warning when ats=auto and no ATS support in physical device
>
> Changes from v1:
> - Set ats_needed to false by default in
> vfio_pci_ats_requested_and_supported()
> - Revise log prefix from "vfio" to "vfio-pci" in
> vfio_pci_ats_requested_and_supported()
> - Squash compat update patch into patch for introducing ats property for
> bisectibility
> - Revise comments and descriptions for support_ats(),
> vfio_pci_ats_requested_and_supported(), and vfio_pci_class_init() to
> be more generic, removing references to
> IOMMU_HW_CAP_PCI_ATS_NOT_SUPPORTED
> - Emit a warning when ats=on and no ATS support in physical device
>
> Changes from "Resolve AUTO properties" series:
> - Split into separate patches for support_ats() handler introduction and
> iommufd implementation, "ats" property addition, and compat property fix
> - Rebase on vfio-next
> - Remove unnecessary includes for hw/vfio/pci.c
> - Rename ats_need to ats_needed for vfio_pci_ats_requested_and_supported()
> - Move the vfio_pci_ats_requested_and_supported() call to
> vfio_pci_add_capabilities() so we can propagate the Error **, and then pass
> ats_needed as a new input arg to vfio_add_ext_cap
> - Fix indent error in vfio_add_ext_cap()
> - Break and add a pcie_add_capability() call for the PASID case in
> vfio_add_ext_cap()
> - Update comment about return value for support_ats()
>
> Thanks,
> Nathan
>
> [0] https://lore.kernel.org/qemu-devel/20260623023540.836825-1-nathanc@nvidia.com/
>
> Nathan Chen (2):
> iommufd: Introduce handler for device ATS support
> vfio/pci: Add ats property
>
> hw/vfio/pci.h | 1 +
> include/system/host_iommu_device.h | 9 +++
> backends/iommufd.c | 8 +++
> hw/vfio/pci.c | 88 ++++++++++++++++++++++++++++--
> 4 files changed, 102 insertions(+), 4 deletions(-)
>
Applied to
https://github.com/legoater/qemu vfio-next
Thanks,
C.
© 2016 - 2026 Red Hat, Inc.