]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
iommu: Add device ATS supported capability
authorShameer Kolothum <skolothumtho@nvidia.com>
Tue, 17 Mar 2026 11:16:02 +0000 (11:16 +0000)
committerJoerg Roedel <joerg.roedel@amd.com>
Tue, 17 Mar 2026 13:05:05 +0000 (14:05 +0100)
PCIe ATS may be disabled by platform firmware, root complex limitations,
or kernel policy even when a device advertises the ATS capability in its
PCI configuration space.

Add a new IOMMU_CAP_PCI_ATS_SUPPORTED capability to allow IOMMU drivers
to report the effective ATS decision for a device.

When this capability is true for a device, ATS may be enabled for that
device, but it does not imply that ATS is currently enabled.

A subsequent patch will extend iommufd to expose the effective ATS
status to userspace.

Suggested-by: Jason Gunthorpe <jgg@nvidia.com>
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Signed-off-by: Shameer Kolothum <skolothumtho@nvidia.com>
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
drivers/iommu/amd/iommu.c
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
drivers/iommu/intel/iommu.c
include/linux/iommu.h

index 81c4d77338722e50e0b550f02cae7ede992f9475..f1814fee518239b691918076c01042e211ada30f 100644 (file)
@@ -2985,6 +2985,12 @@ static bool amd_iommu_capable(struct device *dev, enum iommu_cap cap)
 
                return amd_iommu_hd_support(iommu);
        }
+       case IOMMU_CAP_PCI_ATS_SUPPORTED: {
+               struct iommu_dev_data *dev_data = dev_iommu_priv_get(dev);
+
+               return amd_iommu_iotlb_sup &&
+                        (dev_data->flags & AMD_IOMMU_DEVICE_FLAG_ATS_SUP);
+       }
        default:
                break;
        }
index 4d00d796f078306ef591999ac75a6dd6eb571840..dec5cac98f7c29effff01d0b63e2ca29559b24ce 100644 (file)
@@ -107,6 +107,7 @@ static const char * const event_class_str[] = {
 };
 
 static int arm_smmu_alloc_cd_tables(struct arm_smmu_master *master);
+static bool arm_smmu_ats_supported(struct arm_smmu_master *master);
 
 static void parse_driver_options(struct arm_smmu_device *smmu)
 {
@@ -2494,6 +2495,8 @@ static bool arm_smmu_capable(struct device *dev, enum iommu_cap cap)
                return true;
        case IOMMU_CAP_DIRTY_TRACKING:
                return arm_smmu_dbm_capable(master->smmu);
+       case IOMMU_CAP_PCI_ATS_SUPPORTED:
+               return arm_smmu_ats_supported(master);
        default:
                return false;
        }
index ef7613b177b9a9ca91adf7d863a1fd4f808804bb..5dca8e525c73c890e8acc1882118bc06279363c7 100644 (file)
@@ -3220,6 +3220,8 @@ static bool intel_iommu_capable(struct device *dev, enum iommu_cap cap)
                return ecap_sc_support(info->iommu->ecap);
        case IOMMU_CAP_DIRTY_TRACKING:
                return ssads_supported(info->iommu);
+       case IOMMU_CAP_PCI_ATS_SUPPORTED:
+               return info->ats_supported;
        default:
                return false;
        }
index 7ca648c0133634ac1072256ed6440479919457b8..a904821ed169d000d2ae2709eddeabdeb0ca0905 100644 (file)
@@ -272,6 +272,8 @@ enum iommu_cap {
         */
        IOMMU_CAP_DEFERRED_FLUSH,
        IOMMU_CAP_DIRTY_TRACKING,       /* IOMMU supports dirty tracking */
+       /* ATS is supported and may be enabled for this device */
+       IOMMU_CAP_PCI_ATS_SUPPORTED,
 };
 
 /* These are the possible reserved region types */