Skip to content

Commit 1c26357

Browse files
LuBaolujoergroedel
authored andcommitted
iommu: Remove SVA related callbacks from iommu ops
These ops'es have been deprecated. There's no need for them anymore. Remove them to avoid dead code. Signed-off-by: Lu Baolu <[email protected]> Reviewed-by: Jean-Philippe Brucker <[email protected]> Reviewed-by: Kevin Tian <[email protected]> Reviewed-by: Jason Gunthorpe <[email protected]> Reviewed-by: Yi Liu <[email protected]> Tested-by: Zhangfei Gao <[email protected]> Tested-by: Tony Zhu <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Joerg Roedel <[email protected]>
1 parent be51b1d commit 1c26357

File tree

7 files changed

+0
-121
lines changed

7 files changed

+0
-121
lines changed

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

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -344,11 +344,6 @@ __arm_smmu_sva_bind(struct device *dev, struct mm_struct *mm)
344344
if (!bond)
345345
return ERR_PTR(-ENOMEM);
346346

347-
/* Allocate a PASID for this mm if necessary */
348-
ret = iommu_sva_alloc_pasid(mm, 1, (1U << master->ssid_bits) - 1);
349-
if (ret)
350-
goto err_free_bond;
351-
352347
bond->mm = mm;
353348
bond->sva.dev = dev;
354349
refcount_set(&bond->refs, 1);
@@ -367,41 +362,6 @@ __arm_smmu_sva_bind(struct device *dev, struct mm_struct *mm)
367362
return ERR_PTR(ret);
368363
}
369364

370-
struct iommu_sva *arm_smmu_sva_bind(struct device *dev, struct mm_struct *mm)
371-
{
372-
struct iommu_sva *handle;
373-
struct iommu_domain *domain = iommu_get_domain_for_dev(dev);
374-
struct arm_smmu_domain *smmu_domain = to_smmu_domain(domain);
375-
376-
if (smmu_domain->stage != ARM_SMMU_DOMAIN_S1)
377-
return ERR_PTR(-EINVAL);
378-
379-
mutex_lock(&sva_lock);
380-
handle = __arm_smmu_sva_bind(dev, mm);
381-
mutex_unlock(&sva_lock);
382-
return handle;
383-
}
384-
385-
void arm_smmu_sva_unbind(struct iommu_sva *handle)
386-
{
387-
struct arm_smmu_bond *bond = sva_to_bond(handle);
388-
389-
mutex_lock(&sva_lock);
390-
if (refcount_dec_and_test(&bond->refs)) {
391-
list_del(&bond->list);
392-
arm_smmu_mmu_notifier_put(bond->smmu_mn);
393-
kfree(bond);
394-
}
395-
mutex_unlock(&sva_lock);
396-
}
397-
398-
u32 arm_smmu_sva_get_pasid(struct iommu_sva *handle)
399-
{
400-
struct arm_smmu_bond *bond = sva_to_bond(handle);
401-
402-
return bond->mm->pasid;
403-
}
404-
405365
bool arm_smmu_sva_supported(struct arm_smmu_device *smmu)
406366
{
407367
unsigned long reg, fld;

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2863,9 +2863,6 @@ static struct iommu_ops arm_smmu_ops = {
28632863
.remove_dev_pasid = arm_smmu_remove_dev_pasid,
28642864
.dev_enable_feat = arm_smmu_dev_enable_feature,
28652865
.dev_disable_feat = arm_smmu_dev_disable_feature,
2866-
.sva_bind = arm_smmu_sva_bind,
2867-
.sva_unbind = arm_smmu_sva_unbind,
2868-
.sva_get_pasid = arm_smmu_sva_get_pasid,
28692866
.page_response = arm_smmu_page_response,
28702867
.def_domain_type = arm_smmu_def_domain_type,
28712868
.pgsize_bitmap = -1UL, /* Restricted during device attach */

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

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -754,9 +754,6 @@ bool arm_smmu_master_sva_enabled(struct arm_smmu_master *master);
754754
int arm_smmu_master_enable_sva(struct arm_smmu_master *master);
755755
int arm_smmu_master_disable_sva(struct arm_smmu_master *master);
756756
bool arm_smmu_master_iopf_supported(struct arm_smmu_master *master);
757-
struct iommu_sva *arm_smmu_sva_bind(struct device *dev, struct mm_struct *mm);
758-
void arm_smmu_sva_unbind(struct iommu_sva *handle);
759-
u32 arm_smmu_sva_get_pasid(struct iommu_sva *handle);
760757
void arm_smmu_sva_notifier_synchronize(void);
761758
struct iommu_domain *arm_smmu_sva_domain_alloc(void);
762759
void arm_smmu_sva_remove_dev_pasid(struct iommu_domain *domain,
@@ -792,19 +789,6 @@ static inline bool arm_smmu_master_iopf_supported(struct arm_smmu_master *master
792789
return false;
793790
}
794791

795-
static inline struct iommu_sva *
796-
arm_smmu_sva_bind(struct device *dev, struct mm_struct *mm)
797-
{
798-
return ERR_PTR(-ENODEV);
799-
}
800-
801-
static inline void arm_smmu_sva_unbind(struct iommu_sva *handle) {}
802-
803-
static inline u32 arm_smmu_sva_get_pasid(struct iommu_sva *handle)
804-
{
805-
return IOMMU_PASID_INVALID;
806-
}
807-
808792
static inline void arm_smmu_sva_notifier_synchronize(void) {}
809793

810794
static inline struct iommu_domain *arm_smmu_sva_domain_alloc(void)

drivers/iommu/intel/iommu.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4751,9 +4751,6 @@ const struct iommu_ops intel_iommu_ops = {
47514751
.remove_dev_pasid = intel_iommu_remove_dev_pasid,
47524752
.pgsize_bitmap = SZ_4K,
47534753
#ifdef CONFIG_INTEL_IOMMU_SVM
4754-
.sva_bind = intel_svm_bind,
4755-
.sva_unbind = intel_svm_unbind,
4756-
.sva_get_pasid = intel_svm_get_pasid,
47574754
.page_response = intel_svm_page_response,
47584755
#endif
47594756
.default_domain_ops = &(const struct iommu_domain_ops) {

drivers/iommu/intel/iommu.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -748,9 +748,6 @@ struct intel_iommu *device_to_iommu(struct device *dev, u8 *bus, u8 *devfn);
748748
extern void intel_svm_check(struct intel_iommu *iommu);
749749
extern int intel_svm_enable_prq(struct intel_iommu *iommu);
750750
extern int intel_svm_finish_prq(struct intel_iommu *iommu);
751-
struct iommu_sva *intel_svm_bind(struct device *dev, struct mm_struct *mm);
752-
void intel_svm_unbind(struct iommu_sva *handle);
753-
u32 intel_svm_get_pasid(struct iommu_sva *handle);
754751
int intel_svm_page_response(struct device *dev, struct iommu_fault_event *evt,
755752
struct iommu_page_response *msg);
756753
struct iommu_domain *intel_svm_domain_alloc(void);

drivers/iommu/intel/svm.c

Lines changed: 0 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -296,14 +296,6 @@ static int pasid_to_svm_sdev(struct device *dev, unsigned int pasid,
296296
return 0;
297297
}
298298

299-
static int intel_svm_alloc_pasid(struct device *dev, struct mm_struct *mm)
300-
{
301-
ioasid_t max_pasid = dev_is_pci(dev) ?
302-
pci_max_pasids(to_pci_dev(dev)) : intel_pasid_max_id;
303-
304-
return iommu_sva_alloc_pasid(mm, PASID_MIN, max_pasid - 1);
305-
}
306-
307299
static struct iommu_sva *intel_svm_bind_mm(struct intel_iommu *iommu,
308300
struct device *dev,
309301
struct mm_struct *mm)
@@ -771,47 +763,6 @@ static irqreturn_t prq_event_thread(int irq, void *d)
771763
return IRQ_RETVAL(handled);
772764
}
773765

774-
struct iommu_sva *intel_svm_bind(struct device *dev, struct mm_struct *mm)
775-
{
776-
struct intel_iommu *iommu = device_to_iommu(dev, NULL, NULL);
777-
struct iommu_sva *sva;
778-
int ret;
779-
780-
mutex_lock(&pasid_mutex);
781-
ret = intel_svm_alloc_pasid(dev, mm);
782-
if (ret) {
783-
mutex_unlock(&pasid_mutex);
784-
return ERR_PTR(ret);
785-
}
786-
787-
sva = intel_svm_bind_mm(iommu, dev, mm);
788-
mutex_unlock(&pasid_mutex);
789-
790-
return sva;
791-
}
792-
793-
void intel_svm_unbind(struct iommu_sva *sva)
794-
{
795-
struct intel_svm_dev *sdev = to_intel_svm_dev(sva);
796-
797-
mutex_lock(&pasid_mutex);
798-
intel_svm_unbind_mm(sdev->dev, sdev->pasid);
799-
mutex_unlock(&pasid_mutex);
800-
}
801-
802-
u32 intel_svm_get_pasid(struct iommu_sva *sva)
803-
{
804-
struct intel_svm_dev *sdev;
805-
u32 pasid;
806-
807-
mutex_lock(&pasid_mutex);
808-
sdev = to_intel_svm_dev(sva);
809-
pasid = sdev->pasid;
810-
mutex_unlock(&pasid_mutex);
811-
812-
return pasid;
813-
}
814-
815766
int intel_svm_page_response(struct device *dev,
816767
struct iommu_fault_event *evt,
817768
struct iommu_page_response *msg)

include/linux/iommu.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -227,9 +227,6 @@ struct iommu_iotlb_gather {
227227
* driver init to device driver init (default no)
228228
* @dev_enable/disable_feat: per device entries to enable/disable
229229
* iommu specific features.
230-
* @sva_bind: Bind process address space to device
231-
* @sva_unbind: Unbind process address space from device
232-
* @sva_get_pasid: Get PASID associated to a SVA handle
233230
* @page_response: handle page request response
234231
* @def_domain_type: device default domain type, return value:
235232
* - IOMMU_DOMAIN_IDENTITY: must use an identity domain
@@ -263,10 +260,6 @@ struct iommu_ops {
263260
int (*dev_enable_feat)(struct device *dev, enum iommu_dev_features f);
264261
int (*dev_disable_feat)(struct device *dev, enum iommu_dev_features f);
265262

266-
struct iommu_sva *(*sva_bind)(struct device *dev, struct mm_struct *mm);
267-
void (*sva_unbind)(struct iommu_sva *handle);
268-
u32 (*sva_get_pasid)(struct iommu_sva *handle);
269-
270263
int (*page_response)(struct device *dev,
271264
struct iommu_fault_event *evt,
272265
struct iommu_page_response *msg);

0 commit comments

Comments
 (0)