Skip to content

Commit f984fb0

Browse files
LuBaolujoergroedel
authored andcommitted
iommu: Remove iommu_dev_enable/disable_feature()
No external drivers use these interfaces anymore. Furthermore, no existing iommu drivers implement anything in the callbacks. Remove them to avoid dead code. Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com> Reviewed-by: Jason Gunthorpe <jgg@nvidia.com> Reviewed-by: Kevin Tian <kevin.tian@intel.com> Tested-by: Zhangfei Gao <zhangfei.gao@linaro.org> Reviewed-by: Nicolin Chen <nicolinc@nvidia.com> Link: https://lore.kernel.org/r/20250418080130.1844424-9-baolu.lu@linux.intel.com Signed-off-by: Joerg Roedel <jroedel@suse.de>
1 parent be2a243 commit f984fb0

File tree

5 files changed

+0
-151
lines changed

5 files changed

+0
-151
lines changed

drivers/iommu/amd/iommu.c

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -2984,36 +2984,6 @@ static const struct iommu_dirty_ops amd_dirty_ops = {
29842984
.read_and_clear_dirty = amd_iommu_read_and_clear_dirty,
29852985
};
29862986

2987-
static int amd_iommu_dev_enable_feature(struct device *dev,
2988-
enum iommu_dev_features feat)
2989-
{
2990-
int ret = 0;
2991-
2992-
switch (feat) {
2993-
case IOMMU_DEV_FEAT_IOPF:
2994-
break;
2995-
default:
2996-
ret = -EINVAL;
2997-
break;
2998-
}
2999-
return ret;
3000-
}
3001-
3002-
static int amd_iommu_dev_disable_feature(struct device *dev,
3003-
enum iommu_dev_features feat)
3004-
{
3005-
int ret = 0;
3006-
3007-
switch (feat) {
3008-
case IOMMU_DEV_FEAT_IOPF:
3009-
break;
3010-
default:
3011-
ret = -EINVAL;
3012-
break;
3013-
}
3014-
return ret;
3015-
}
3016-
30172987
const struct iommu_ops amd_iommu_ops = {
30182988
.capable = amd_iommu_capable,
30192989
.blocked_domain = &blocked_domain,
@@ -3027,8 +2997,6 @@ const struct iommu_ops amd_iommu_ops = {
30272997
.get_resv_regions = amd_iommu_get_resv_regions,
30282998
.is_attach_deferred = amd_iommu_is_attach_deferred,
30292999
.def_domain_type = amd_iommu_def_domain_type,
3030-
.dev_enable_feat = amd_iommu_dev_enable_feature,
3031-
.dev_disable_feat = amd_iommu_dev_disable_feature,
30323000
.page_response = amd_iommu_page_response,
30333001
.default_domain_ops = &(const struct iommu_domain_ops) {
30343002
.attach_dev = amd_iommu_attach_device,

drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -3643,38 +3643,6 @@ static void arm_smmu_get_resv_regions(struct device *dev,
36433643
iommu_dma_get_resv_regions(dev, head);
36443644
}
36453645

3646-
static int arm_smmu_dev_enable_feature(struct device *dev,
3647-
enum iommu_dev_features feat)
3648-
{
3649-
struct arm_smmu_master *master = dev_iommu_priv_get(dev);
3650-
3651-
if (!master)
3652-
return -ENODEV;
3653-
3654-
switch (feat) {
3655-
case IOMMU_DEV_FEAT_IOPF:
3656-
return 0;
3657-
default:
3658-
return -EINVAL;
3659-
}
3660-
}
3661-
3662-
static int arm_smmu_dev_disable_feature(struct device *dev,
3663-
enum iommu_dev_features feat)
3664-
{
3665-
struct arm_smmu_master *master = dev_iommu_priv_get(dev);
3666-
3667-
if (!master)
3668-
return -EINVAL;
3669-
3670-
switch (feat) {
3671-
case IOMMU_DEV_FEAT_IOPF:
3672-
return 0;
3673-
default:
3674-
return -EINVAL;
3675-
}
3676-
}
3677-
36783646
/*
36793647
* HiSilicon PCIe tune and trace device can be used to trace TLP headers on the
36803648
* PCIe link and save the data to memory by DMA. The hardware is restricted to
@@ -3707,8 +3675,6 @@ static struct iommu_ops arm_smmu_ops = {
37073675
.device_group = arm_smmu_device_group,
37083676
.of_xlate = arm_smmu_of_xlate,
37093677
.get_resv_regions = arm_smmu_get_resv_regions,
3710-
.dev_enable_feat = arm_smmu_dev_enable_feature,
3711-
.dev_disable_feat = arm_smmu_dev_disable_feature,
37123678
.page_response = arm_smmu_page_response,
37133679
.def_domain_type = arm_smmu_def_domain_type,
37143680
.viommu_alloc = arm_vsmmu_alloc,

drivers/iommu/intel/iommu.c

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3957,29 +3957,6 @@ void intel_iommu_disable_iopf(struct device *dev)
39573957
iopf_queue_remove_device(iommu->iopf_queue, dev);
39583958
}
39593959

3960-
static int
3961-
intel_iommu_dev_enable_feat(struct device *dev, enum iommu_dev_features feat)
3962-
{
3963-
switch (feat) {
3964-
case IOMMU_DEV_FEAT_IOPF:
3965-
return 0;
3966-
default:
3967-
return -ENODEV;
3968-
}
3969-
}
3970-
3971-
static int
3972-
intel_iommu_dev_disable_feat(struct device *dev, enum iommu_dev_features feat)
3973-
{
3974-
switch (feat) {
3975-
case IOMMU_DEV_FEAT_IOPF:
3976-
return 0;
3977-
3978-
default:
3979-
return -ENODEV;
3980-
}
3981-
}
3982-
39833960
static bool intel_iommu_is_attach_deferred(struct device *dev)
39843961
{
39853962
struct device_domain_info *info = dev_iommu_priv_get(dev);
@@ -4421,8 +4398,6 @@ const struct iommu_ops intel_iommu_ops = {
44214398
.release_device = intel_iommu_release_device,
44224399
.get_resv_regions = intel_iommu_get_resv_regions,
44234400
.device_group = intel_iommu_device_group,
4424-
.dev_enable_feat = intel_iommu_dev_enable_feat,
4425-
.dev_disable_feat = intel_iommu_dev_disable_feat,
44264401
.is_attach_deferred = intel_iommu_is_attach_deferred,
44274402
.def_domain_type = device_def_domain_type,
44284403
.pgsize_bitmap = SZ_4K,

drivers/iommu/iommu.c

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -2910,38 +2910,6 @@ int iommu_fwspec_add_ids(struct device *dev, const u32 *ids, int num_ids)
29102910
}
29112911
EXPORT_SYMBOL_GPL(iommu_fwspec_add_ids);
29122912

2913-
/*
2914-
* Per device IOMMU features.
2915-
*/
2916-
int iommu_dev_enable_feature(struct device *dev, enum iommu_dev_features feat)
2917-
{
2918-
if (dev_has_iommu(dev)) {
2919-
const struct iommu_ops *ops = dev_iommu_ops(dev);
2920-
2921-
if (ops->dev_enable_feat)
2922-
return ops->dev_enable_feat(dev, feat);
2923-
}
2924-
2925-
return -ENODEV;
2926-
}
2927-
EXPORT_SYMBOL_GPL(iommu_dev_enable_feature);
2928-
2929-
/*
2930-
* The device drivers should do the necessary cleanups before calling this.
2931-
*/
2932-
int iommu_dev_disable_feature(struct device *dev, enum iommu_dev_features feat)
2933-
{
2934-
if (dev_has_iommu(dev)) {
2935-
const struct iommu_ops *ops = dev_iommu_ops(dev);
2936-
2937-
if (ops->dev_disable_feat)
2938-
return ops->dev_disable_feat(dev, feat);
2939-
}
2940-
2941-
return -EBUSY;
2942-
}
2943-
EXPORT_SYMBOL_GPL(iommu_dev_disable_feature);
2944-
29452913
/**
29462914
* iommu_setup_default_domain - Set the default_domain for the group
29472915
* @group: Group to change

include/linux/iommu.h

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -316,16 +316,6 @@ struct iommu_iort_rmr_data {
316316
u32 num_sids;
317317
};
318318

319-
/**
320-
* enum iommu_dev_features - Per device IOMMU features
321-
* @IOMMU_DEV_FEAT_IOPF: I/O Page Faults such as PRI or Stall.
322-
*
323-
* Device drivers enable a feature using iommu_dev_enable_feature().
324-
*/
325-
enum iommu_dev_features {
326-
IOMMU_DEV_FEAT_IOPF,
327-
};
328-
329319
#define IOMMU_NO_PASID (0U) /* Reserved for DMA w/o PASID */
330320
#define IOMMU_FIRST_GLOBAL_PASID (1U) /*starting range for allocation */
331321
#define IOMMU_PASID_INVALID (-1U)
@@ -657,9 +647,6 @@ struct iommu_ops {
657647
bool (*is_attach_deferred)(struct device *dev);
658648

659649
/* Per device IOMMU features */
660-
int (*dev_enable_feat)(struct device *dev, enum iommu_dev_features f);
661-
int (*dev_disable_feat)(struct device *dev, enum iommu_dev_features f);
662-
663650
void (*page_response)(struct device *dev, struct iopf_fault *evt,
664651
struct iommu_page_response *msg);
665652

@@ -1128,9 +1115,6 @@ void dev_iommu_priv_set(struct device *dev, void *priv);
11281115
extern struct mutex iommu_probe_device_lock;
11291116
int iommu_probe_device(struct device *dev);
11301117

1131-
int iommu_dev_enable_feature(struct device *dev, enum iommu_dev_features f);
1132-
int iommu_dev_disable_feature(struct device *dev, enum iommu_dev_features f);
1133-
11341118
int iommu_device_use_default_domain(struct device *dev);
11351119
void iommu_device_unuse_default_domain(struct device *dev);
11361120

@@ -1415,18 +1399,6 @@ static inline int iommu_fwspec_add_ids(struct device *dev, u32 *ids,
14151399
return -ENODEV;
14161400
}
14171401

1418-
static inline int
1419-
iommu_dev_enable_feature(struct device *dev, enum iommu_dev_features feat)
1420-
{
1421-
return -ENODEV;
1422-
}
1423-
1424-
static inline int
1425-
iommu_dev_disable_feature(struct device *dev, enum iommu_dev_features feat)
1426-
{
1427-
return -ENODEV;
1428-
}
1429-
14301402
static inline struct iommu_fwspec *dev_iommu_fwspec_get(struct device *dev)
14311403
{
14321404
return NULL;

0 commit comments

Comments
 (0)