Skip to content

Commit 359ad15

Browse files
rmurphy-armjoergroedel
authored andcommitted
iommu: Retire iommu_capable()
With all callers now converted to the device-specific version, retire the old bus-based interface, and give drivers the chance to indicate accurate per-instance capabilities. Signed-off-by: Robin Murphy <robin.murphy@arm.com> Reviewed-by: Lu Baolu <baolu.lu@linux.intel.com> Link: https://lore.kernel.org/r/d8bd8777d06929ad8f49df7fc80e1b9af32a41b5.1660574547.git.robin.murphy@arm.com Signed-off-by: Joerg Roedel <jroedel@suse.de>
1 parent bf75eb4 commit 359ad15

File tree

9 files changed

+9
-24
lines changed

9 files changed

+9
-24
lines changed

drivers/iommu/amd/iommu.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2251,7 +2251,7 @@ static phys_addr_t amd_iommu_iova_to_phys(struct iommu_domain *dom,
22512251
return ops->iova_to_phys(ops, iova);
22522252
}
22532253

2254-
static bool amd_iommu_capable(enum iommu_cap cap)
2254+
static bool amd_iommu_capable(struct device *dev, enum iommu_cap cap)
22552255
{
22562256
switch (cap) {
22572257
case IOMMU_CAP_CACHE_COHERENCY:

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1992,7 +1992,7 @@ static const struct iommu_flush_ops arm_smmu_flush_ops = {
19921992
};
19931993

19941994
/* IOMMU API */
1995-
static bool arm_smmu_capable(enum iommu_cap cap)
1995+
static bool arm_smmu_capable(struct device *dev, enum iommu_cap cap)
19961996
{
19971997
switch (cap) {
19981998
case IOMMU_CAP_CACHE_COHERENCY:

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1330,7 +1330,7 @@ static phys_addr_t arm_smmu_iova_to_phys(struct iommu_domain *domain,
13301330
return ops->iova_to_phys(ops, iova);
13311331
}
13321332

1333-
static bool arm_smmu_capable(enum iommu_cap cap)
1333+
static bool arm_smmu_capable(struct device *dev, enum iommu_cap cap)
13341334
{
13351335
switch (cap) {
13361336
case IOMMU_CAP_CACHE_COHERENCY:

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -493,7 +493,7 @@ static phys_addr_t qcom_iommu_iova_to_phys(struct iommu_domain *domain,
493493
return ret;
494494
}
495495

496-
static bool qcom_iommu_capable(enum iommu_cap cap)
496+
static bool qcom_iommu_capable(struct device *dev, enum iommu_cap cap)
497497
{
498498
switch (cap) {
499499
case IOMMU_CAP_CACHE_COHERENCY:

drivers/iommu/fsl_pamu_domain.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ static phys_addr_t fsl_pamu_iova_to_phys(struct iommu_domain *domain,
178178
return iova;
179179
}
180180

181-
static bool fsl_pamu_capable(enum iommu_cap cap)
181+
static bool fsl_pamu_capable(struct device *dev, enum iommu_cap cap)
182182
{
183183
return cap == IOMMU_CAP_CACHE_COHERENCY;
184184
}

drivers/iommu/intel/iommu.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4429,7 +4429,7 @@ static bool intel_iommu_enforce_cache_coherency(struct iommu_domain *domain)
44294429
return true;
44304430
}
44314431

4432-
static bool intel_iommu_capable(enum iommu_cap cap)
4432+
static bool intel_iommu_capable(struct device *dev, enum iommu_cap cap)
44334433
{
44344434
if (cap == IOMMU_CAP_CACHE_COHERENCY)
44354435
return true;

drivers/iommu/iommu.c

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1868,19 +1868,10 @@ bool device_iommu_capable(struct device *dev, enum iommu_cap cap)
18681868
if (!ops->capable)
18691869
return false;
18701870

1871-
return ops->capable(cap);
1871+
return ops->capable(dev, cap);
18721872
}
18731873
EXPORT_SYMBOL_GPL(device_iommu_capable);
18741874

1875-
bool iommu_capable(struct bus_type *bus, enum iommu_cap cap)
1876-
{
1877-
if (!bus->iommu_ops || !bus->iommu_ops->capable)
1878-
return false;
1879-
1880-
return bus->iommu_ops->capable(cap);
1881-
}
1882-
EXPORT_SYMBOL_GPL(iommu_capable);
1883-
18841875
/**
18851876
* iommu_set_fault_handler() - set a fault handler for an iommu domain
18861877
* @domain: iommu domain

drivers/iommu/s390-iommu.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ static struct s390_domain *to_s390_domain(struct iommu_domain *dom)
3939
return container_of(dom, struct s390_domain, domain);
4040
}
4141

42-
static bool s390_iommu_capable(enum iommu_cap cap)
42+
static bool s390_iommu_capable(struct device *dev, enum iommu_cap cap)
4343
{
4444
switch (cap) {
4545
case IOMMU_CAP_CACHE_COHERENCY:

include/linux/iommu.h

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ struct iommu_iotlb_gather {
227227
* @owner: Driver module providing these ops
228228
*/
229229
struct iommu_ops {
230-
bool (*capable)(enum iommu_cap);
230+
bool (*capable)(struct device *dev, enum iommu_cap);
231231

232232
/* Domain allocation and freeing by the iommu driver */
233233
struct iommu_domain *(*domain_alloc)(unsigned iommu_domain_type);
@@ -420,7 +420,6 @@ extern int bus_set_iommu(struct bus_type *bus, const struct iommu_ops *ops);
420420
extern int bus_iommu_probe(struct bus_type *bus);
421421
extern bool iommu_present(struct bus_type *bus);
422422
extern bool device_iommu_capable(struct device *dev, enum iommu_cap cap);
423-
extern bool iommu_capable(struct bus_type *bus, enum iommu_cap cap);
424423
extern struct iommu_domain *iommu_domain_alloc(struct bus_type *bus);
425424
extern struct iommu_group *iommu_group_get_by_id(int id);
426425
extern void iommu_domain_free(struct iommu_domain *domain);
@@ -697,11 +696,6 @@ static inline bool device_iommu_capable(struct device *dev, enum iommu_cap cap)
697696
return false;
698697
}
699698

700-
static inline bool iommu_capable(struct bus_type *bus, enum iommu_cap cap)
701-
{
702-
return false;
703-
}
704-
705699
static inline struct iommu_domain *iommu_domain_alloc(struct bus_type *bus)
706700
{
707701
return NULL;

0 commit comments

Comments
 (0)