Skip to content

Commit 7c8896d

Browse files
jgunthorpejoergroedel
authored andcommitted
iommu: Remove IOMMU_DEV_FEAT_SVA
None of the drivers implement anything here anymore, remove the dead code. Signed-off-by: Jason Gunthorpe <[email protected]> Signed-off-by: Lu Baolu <[email protected]> Reviewed-by: Kevin Tian <[email protected]> Reviewed-by: Yi Liu <[email protected]> Tested-by: Zhangfei Gao <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Joerg Roedel <[email protected]>
1 parent cfea71a commit 7c8896d

File tree

8 files changed

+4
-48
lines changed

8 files changed

+4
-48
lines changed

drivers/accel/amdxdna/aie2_pci.c

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -512,12 +512,6 @@ static int aie2_init(struct amdxdna_dev *xdna)
512512
goto release_fw;
513513
}
514514

515-
ret = iommu_dev_enable_feature(&pdev->dev, IOMMU_DEV_FEAT_SVA);
516-
if (ret) {
517-
XDNA_ERR(xdna, "Enable PASID failed, ret %d", ret);
518-
goto free_irq;
519-
}
520-
521515
psp_conf.fw_size = fw->size;
522516
psp_conf.fw_buf = fw->data;
523517
for (i = 0; i < PSP_MAX_REGS; i++)
@@ -526,14 +520,14 @@ static int aie2_init(struct amdxdna_dev *xdna)
526520
if (!ndev->psp_hdl) {
527521
XDNA_ERR(xdna, "failed to create psp");
528522
ret = -ENOMEM;
529-
goto disable_sva;
523+
goto free_irq;
530524
}
531525
xdna->dev_handle = ndev;
532526

533527
ret = aie2_hw_start(xdna);
534528
if (ret) {
535529
XDNA_ERR(xdna, "start npu failed, ret %d", ret);
536-
goto disable_sva;
530+
goto free_irq;
537531
}
538532

539533
ret = aie2_mgmt_fw_query(ndev);
@@ -584,8 +578,6 @@ static int aie2_init(struct amdxdna_dev *xdna)
584578
aie2_error_async_events_free(ndev);
585579
stop_hw:
586580
aie2_hw_stop(xdna);
587-
disable_sva:
588-
iommu_dev_disable_feature(&pdev->dev, IOMMU_DEV_FEAT_SVA);
589581
free_irq:
590582
pci_free_irq_vectors(pdev);
591583
release_fw:
@@ -601,7 +593,6 @@ static void aie2_fini(struct amdxdna_dev *xdna)
601593

602594
aie2_hw_stop(xdna);
603595
aie2_error_async_events_free(ndev);
604-
iommu_dev_disable_feature(&pdev->dev, IOMMU_DEV_FEAT_SVA);
605596
pci_free_irq_vectors(pdev);
606597
}
607598

drivers/dma/idxd/init.c

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -633,17 +633,11 @@ static int idxd_enable_sva(struct pci_dev *pdev)
633633
ret = iommu_dev_enable_feature(&pdev->dev, IOMMU_DEV_FEAT_IOPF);
634634
if (ret)
635635
return ret;
636-
637-
ret = iommu_dev_enable_feature(&pdev->dev, IOMMU_DEV_FEAT_SVA);
638-
if (ret)
639-
iommu_dev_disable_feature(&pdev->dev, IOMMU_DEV_FEAT_IOPF);
640-
641-
return ret;
636+
return 0;
642637
}
643638

644639
static void idxd_disable_sva(struct pci_dev *pdev)
645640
{
646-
iommu_dev_disable_feature(&pdev->dev, IOMMU_DEV_FEAT_SVA);
647641
iommu_dev_disable_feature(&pdev->dev, IOMMU_DEV_FEAT_IOPF);
648642
}
649643

drivers/iommu/amd/iommu.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2991,7 +2991,6 @@ static int amd_iommu_dev_enable_feature(struct device *dev,
29912991

29922992
switch (feat) {
29932993
case IOMMU_DEV_FEAT_IOPF:
2994-
case IOMMU_DEV_FEAT_SVA:
29952994
break;
29962995
default:
29972996
ret = -EINVAL;
@@ -3007,7 +3006,6 @@ static int amd_iommu_dev_disable_feature(struct device *dev,
30073006

30083007
switch (feat) {
30093008
case IOMMU_DEV_FEAT_IOPF:
3010-
case IOMMU_DEV_FEAT_SVA:
30113009
break;
30123010
default:
30133011
ret = -EINVAL;

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3653,7 +3653,6 @@ static int arm_smmu_dev_enable_feature(struct device *dev,
36533653

36543654
switch (feat) {
36553655
case IOMMU_DEV_FEAT_IOPF:
3656-
case IOMMU_DEV_FEAT_SVA:
36573656
return 0;
36583657
default:
36593658
return -EINVAL;
@@ -3670,7 +3669,6 @@ static int arm_smmu_dev_disable_feature(struct device *dev,
36703669

36713670
switch (feat) {
36723671
case IOMMU_DEV_FEAT_IOPF:
3673-
case IOMMU_DEV_FEAT_SVA:
36743672
return 0;
36753673
default:
36763674
return -EINVAL;

drivers/iommu/intel/iommu.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3950,9 +3950,6 @@ intel_iommu_dev_enable_feat(struct device *dev, enum iommu_dev_features feat)
39503950
case IOMMU_DEV_FEAT_IOPF:
39513951
return intel_iommu_enable_iopf(dev);
39523952

3953-
case IOMMU_DEV_FEAT_SVA:
3954-
return 0;
3955-
39563953
default:
39573954
return -ENODEV;
39583955
}
@@ -3966,9 +3963,6 @@ intel_iommu_dev_disable_feat(struct device *dev, enum iommu_dev_features feat)
39663963
intel_iommu_disable_iopf(dev);
39673964
return 0;
39683965

3969-
case IOMMU_DEV_FEAT_SVA:
3970-
return 0;
3971-
39723966
default:
39733967
return -ENODEV;
39743968
}

drivers/iommu/iommu-sva.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,6 @@ static struct iommu_mm_data *iommu_alloc_mm_data(struct mm_struct *mm, struct de
6363
* reference is taken. Caller must call iommu_sva_unbind_device()
6464
* to release each reference.
6565
*
66-
* iommu_dev_enable_feature(dev, IOMMU_DEV_FEAT_SVA) must be called first, to
67-
* initialize the required SVA features.
68-
*
6966
* On error, returns an ERR_PTR value.
7067
*/
7168
struct iommu_sva *iommu_sva_bind_device(struct device *dev, struct mm_struct *mm)

drivers/misc/uacce/uacce.c

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -479,14 +479,6 @@ static unsigned int uacce_enable_sva(struct device *parent, unsigned int flags)
479479
dev_err(parent, "failed to enable IOPF feature! ret = %pe\n", ERR_PTR(ret));
480480
return flags;
481481
}
482-
483-
ret = iommu_dev_enable_feature(parent, IOMMU_DEV_FEAT_SVA);
484-
if (ret) {
485-
dev_err(parent, "failed to enable SVA feature! ret = %pe\n", ERR_PTR(ret));
486-
iommu_dev_disable_feature(parent, IOMMU_DEV_FEAT_IOPF);
487-
return flags;
488-
}
489-
490482
return flags | UACCE_DEV_SVA;
491483
}
492484

@@ -495,7 +487,6 @@ static void uacce_disable_sva(struct uacce_device *uacce)
495487
if (!(uacce->flags & UACCE_DEV_SVA))
496488
return;
497489

498-
iommu_dev_disable_feature(uacce->parent, IOMMU_DEV_FEAT_SVA);
499490
iommu_dev_disable_feature(uacce->parent, IOMMU_DEV_FEAT_IOPF);
500491
}
501492

include/linux/iommu.h

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -318,18 +318,11 @@ struct iommu_iort_rmr_data {
318318

319319
/**
320320
* enum iommu_dev_features - Per device IOMMU features
321-
* @IOMMU_DEV_FEAT_SVA: Shared Virtual Addresses
322-
* @IOMMU_DEV_FEAT_IOPF: I/O Page Faults such as PRI or Stall. Generally
323-
* enabling %IOMMU_DEV_FEAT_SVA requires
324-
* %IOMMU_DEV_FEAT_IOPF, but some devices manage I/O Page
325-
* Faults themselves instead of relying on the IOMMU. When
326-
* supported, this feature must be enabled before and
327-
* disabled after %IOMMU_DEV_FEAT_SVA.
321+
* @IOMMU_DEV_FEAT_IOPF: I/O Page Faults such as PRI or Stall.
328322
*
329323
* Device drivers enable a feature using iommu_dev_enable_feature().
330324
*/
331325
enum iommu_dev_features {
332-
IOMMU_DEV_FEAT_SVA,
333326
IOMMU_DEV_FEAT_IOPF,
334327
};
335328

0 commit comments

Comments
 (0)