[PATCH 2/2] iommufd: Report ATS not supported status via IOMMU_GET_HW_INFO

Shameer Kolothum posted 2 patches 1 month, 1 week ago
There is a newer version of this series
[PATCH 2/2] iommufd: Report ATS not supported status via IOMMU_GET_HW_INFO
Posted by Shameer Kolothum 1 month, 1 week ago
If the IOMMU driver reports that ATS is not supported for a device, set
the IOMMU_HW_CAP_PCI_ATS_NOT_SUPPORTED flag in the returned hardware
capabilities.

When this flag is set, ATS is not supported and not used for the device.

Signed-off-by: Shameer Kolothum <skolothumtho@nvidia.com>
---
 include/uapi/linux/iommufd.h   | 3 +++
 drivers/iommu/iommufd/device.c | 3 +++
 2 files changed, 6 insertions(+)

diff --git a/include/uapi/linux/iommufd.h b/include/uapi/linux/iommufd.h
index 1dafbc552d37..d85a2d3e1b40 100644
--- a/include/uapi/linux/iommufd.h
+++ b/include/uapi/linux/iommufd.h
@@ -695,11 +695,14 @@ enum iommu_hw_info_type {
  * @IOMMU_HW_CAP_PCI_PASID_PRIV: Privileged Mode Supported, user ignores it
  *                               when the struct
  *                               iommu_hw_info::out_max_pasid_log2 is zero.
+ * @IOMMU_HW_CAP_PCI_ATS_NOT_SUPPORTED: ATS is not supported and not used on
+ *                                      this device.
  */
 enum iommufd_hw_capabilities {
 	IOMMU_HW_CAP_DIRTY_TRACKING = 1 << 0,
 	IOMMU_HW_CAP_PCI_PASID_EXEC = 1 << 1,
 	IOMMU_HW_CAP_PCI_PASID_PRIV = 1 << 2,
+	IOMMU_HW_CAP_PCI_ATS_NOT_SUPPORTED = 1 << 3,
 };
 
 /**
diff --git a/drivers/iommu/iommufd/device.c b/drivers/iommu/iommufd/device.c
index 344d620cdecc..2e98818806c0 100644
--- a/drivers/iommu/iommufd/device.c
+++ b/drivers/iommu/iommufd/device.c
@@ -1624,6 +1624,9 @@ int iommufd_get_hw_info(struct iommufd_ucmd *ucmd)
 	if (device_iommu_capable(idev->dev, IOMMU_CAP_DIRTY_TRACKING))
 		cmd->out_capabilities |= IOMMU_HW_CAP_DIRTY_TRACKING;
 
+	if (device_iommu_capable(idev->dev, IOMMU_CAP_PCI_ATS_NOT_SUPPORTED))
+		cmd->out_capabilities |= IOMMU_HW_CAP_PCI_ATS_NOT_SUPPORTED;
+
 	cmd->out_max_pasid_log2 = 0;
 	/*
 	 * Currently, all iommu drivers enable PASID in the probe_device()
-- 
2.43.0
Re: [PATCH 2/2] iommufd: Report ATS not supported status via IOMMU_GET_HW_INFO
Posted by Jason Gunthorpe 3 weeks, 6 days ago
On Tue, Mar 03, 2026 at 03:03:48PM +0000, Shameer Kolothum wrote:
> If the IOMMU driver reports that ATS is not supported for a device, set
> the IOMMU_HW_CAP_PCI_ATS_NOT_SUPPORTED flag in the returned hardware
> capabilities.
> 
> When this flag is set, ATS is not supported and not used for the device.
> 
> Signed-off-by: Shameer Kolothum <skolothumtho@nvidia.com>
> ---
>  include/uapi/linux/iommufd.h   | 3 +++
>  drivers/iommu/iommufd/device.c | 3 +++
>  2 files changed, 6 insertions(+)

Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>

> diff --git a/include/uapi/linux/iommufd.h b/include/uapi/linux/iommufd.h
> index 1dafbc552d37..d85a2d3e1b40 100644
> --- a/include/uapi/linux/iommufd.h
> +++ b/include/uapi/linux/iommufd.h
> @@ -695,11 +695,14 @@ enum iommu_hw_info_type {
>   * @IOMMU_HW_CAP_PCI_PASID_PRIV: Privileged Mode Supported, user ignores it
>   *                               when the struct
>   *                               iommu_hw_info::out_max_pasid_log2 is zero.
> + * @IOMMU_HW_CAP_PCI_ATS_NOT_SUPPORTED: ATS is not supported and not used on
> + *                                      this device.

Same comment to clarify what this means. Does it mean ATS can be
turned on if the right HWPT is attached, or does it mean ATS is on
right now.

Jason
Re: [PATCH 2/2] iommufd: Report ATS not supported status via IOMMU_GET_HW_INFO
Posted by Samiullah Khawaja 1 month ago
On Tue, Mar 03, 2026 at 03:03:48PM +0000, Shameer Kolothum wrote:
>If the IOMMU driver reports that ATS is not supported for a device, set
>the IOMMU_HW_CAP_PCI_ATS_NOT_SUPPORTED flag in the returned hardware
>capabilities.
>
>When this flag is set, ATS is not supported and not used for the device.
>
>Signed-off-by: Shameer Kolothum <skolothumtho@nvidia.com>
>---
> include/uapi/linux/iommufd.h   | 3 +++
> drivers/iommu/iommufd/device.c | 3 +++
> 2 files changed, 6 insertions(+)
>
>diff --git a/include/uapi/linux/iommufd.h b/include/uapi/linux/iommufd.h
>index 1dafbc552d37..d85a2d3e1b40 100644
>--- a/include/uapi/linux/iommufd.h
>+++ b/include/uapi/linux/iommufd.h
>@@ -695,11 +695,14 @@ enum iommu_hw_info_type {
>  * @IOMMU_HW_CAP_PCI_PASID_PRIV: Privileged Mode Supported, user ignores it
>  *                               when the struct
>  *                               iommu_hw_info::out_max_pasid_log2 is zero.
>+ * @IOMMU_HW_CAP_PCI_ATS_NOT_SUPPORTED: ATS is not supported and not used on
>+ *                                      this device.
>  */
> enum iommufd_hw_capabilities {
> 	IOMMU_HW_CAP_DIRTY_TRACKING = 1 << 0,
> 	IOMMU_HW_CAP_PCI_PASID_EXEC = 1 << 1,
> 	IOMMU_HW_CAP_PCI_PASID_PRIV = 1 << 2,
>+	IOMMU_HW_CAP_PCI_ATS_NOT_SUPPORTED = 1 << 3,
> };
>
> /**
>diff --git a/drivers/iommu/iommufd/device.c b/drivers/iommu/iommufd/device.c
>index 344d620cdecc..2e98818806c0 100644
>--- a/drivers/iommu/iommufd/device.c
>+++ b/drivers/iommu/iommufd/device.c
>@@ -1624,6 +1624,9 @@ int iommufd_get_hw_info(struct iommufd_ucmd *ucmd)
> 	if (device_iommu_capable(idev->dev, IOMMU_CAP_DIRTY_TRACKING))
> 		cmd->out_capabilities |= IOMMU_HW_CAP_DIRTY_TRACKING;
>
>+	if (device_iommu_capable(idev->dev, IOMMU_CAP_PCI_ATS_NOT_SUPPORTED))
>+		cmd->out_capabilities |= IOMMU_HW_CAP_PCI_ATS_NOT_SUPPORTED;
>+
> 	cmd->out_max_pasid_log2 = 0;
> 	/*
> 	 * Currently, all iommu drivers enable PASID in the probe_device()
>-- 
>2.43.0
>
>

Reviewed-by: Samiullah Khawaja <skhawaja@google.com>