Skip to content

Commit ad59382

Browse files
jgunthorpempe
authored andcommitted
powerpc/iommu: Remove iommu_del_device()
Now that power calls iommu_device_register() and populates its groups using iommu_ops->device_group it should not be calling iommu_group_remove_device(). The core code owns the groups and all the other related iommu data, it will clean it up automatically. Remove the bus notifiers and explicit calls to iommu_group_remove_device(). Fixes: a940904 ("powerpc/iommu: Add iommu_ops to report capabilities and allow blocking domains") Signed-off-by: Jason Gunthorpe <[email protected]> Signed-off-by: Michael Ellerman <[email protected]> Link: https://msgid.link/[email protected]
1 parent 8133a3f commit ad59382

File tree

4 files changed

+0
-72
lines changed

4 files changed

+0
-72
lines changed

arch/powerpc/include/asm/iommu.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,6 @@ extern void iommu_register_group(struct iommu_table_group *table_group,
205205
int pci_domain_number, unsigned long pe_num);
206206
extern int iommu_add_device(struct iommu_table_group *table_group,
207207
struct device *dev);
208-
extern void iommu_del_device(struct device *dev);
209208
extern long iommu_tce_xchg(struct mm_struct *mm, struct iommu_table *tbl,
210209
unsigned long entry, unsigned long *hpa,
211210
enum dma_data_direction *direction);
@@ -229,10 +228,6 @@ static inline int iommu_add_device(struct iommu_table_group *table_group,
229228
{
230229
return 0;
231230
}
232-
233-
static inline void iommu_del_device(struct device *dev)
234-
{
235-
}
236231
#endif /* !CONFIG_IOMMU_API */
237232

238233
u64 dma_iommu_get_required_mask(struct device *dev);

arch/powerpc/kernel/iommu.c

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1168,23 +1168,6 @@ int iommu_add_device(struct iommu_table_group *table_group, struct device *dev)
11681168
}
11691169
EXPORT_SYMBOL_GPL(iommu_add_device);
11701170

1171-
void iommu_del_device(struct device *dev)
1172-
{
1173-
/*
1174-
* Some devices might not have IOMMU table and group
1175-
* and we needn't detach them from the associated
1176-
* IOMMU groups
1177-
*/
1178-
if (!device_iommu_mapped(dev)) {
1179-
pr_debug("iommu_tce: skipping device %s with no tbl\n",
1180-
dev_name(dev));
1181-
return;
1182-
}
1183-
1184-
iommu_group_remove_device(dev);
1185-
}
1186-
EXPORT_SYMBOL_GPL(iommu_del_device);
1187-
11881171
/*
11891172
* A simple iommu_table_group_ops which only allows reusing the existing
11901173
* iommu_table. This handles VFIO for POWER7 or the nested KVM.

arch/powerpc/platforms/powernv/pci.c

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -865,28 +865,3 @@ void __init pnv_pci_init(void)
865865
/* Configure IOMMU DMA hooks */
866866
set_pci_dma_ops(&dma_iommu_ops);
867867
}
868-
869-
static int pnv_tce_iommu_bus_notifier(struct notifier_block *nb,
870-
unsigned long action, void *data)
871-
{
872-
struct device *dev = data;
873-
874-
switch (action) {
875-
case BUS_NOTIFY_DEL_DEVICE:
876-
iommu_del_device(dev);
877-
return 0;
878-
default:
879-
return 0;
880-
}
881-
}
882-
883-
static struct notifier_block pnv_tce_iommu_bus_nb = {
884-
.notifier_call = pnv_tce_iommu_bus_notifier,
885-
};
886-
887-
static int __init pnv_tce_iommu_bus_notifier_init(void)
888-
{
889-
bus_register_notifier(&pci_bus_type, &pnv_tce_iommu_bus_nb);
890-
return 0;
891-
}
892-
machine_subsys_initcall_sync(powernv, pnv_tce_iommu_bus_notifier_init);

arch/powerpc/platforms/pseries/iommu.c

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1695,31 +1695,6 @@ static int __init disable_multitce(char *str)
16951695

16961696
__setup("multitce=", disable_multitce);
16971697

1698-
static int tce_iommu_bus_notifier(struct notifier_block *nb,
1699-
unsigned long action, void *data)
1700-
{
1701-
struct device *dev = data;
1702-
1703-
switch (action) {
1704-
case BUS_NOTIFY_DEL_DEVICE:
1705-
iommu_del_device(dev);
1706-
return 0;
1707-
default:
1708-
return 0;
1709-
}
1710-
}
1711-
1712-
static struct notifier_block tce_iommu_bus_nb = {
1713-
.notifier_call = tce_iommu_bus_notifier,
1714-
};
1715-
1716-
static int __init tce_iommu_bus_notifier_init(void)
1717-
{
1718-
bus_register_notifier(&pci_bus_type, &tce_iommu_bus_nb);
1719-
return 0;
1720-
}
1721-
machine_subsys_initcall_sync(pseries, tce_iommu_bus_notifier_init);
1722-
17231698
#ifdef CONFIG_SPAPR_TCE_IOMMU
17241699
struct iommu_group *pSeries_pci_device_group(struct pci_controller *hose,
17251700
struct pci_dev *pdev)

0 commit comments

Comments
 (0)