Skip to content

Commit 35146ea

Browse files
ShivaprasadGBhatmpe
authored andcommitted
powerpc/iommu: Move dev_has_iommu_table() to iommu.c
Move function dev_has_iommu_table() to powerpc/kernel/iommu.c as it is going to be used by machine specific iommu code as well in subsequent patches. Signed-off-by: Shivaprasad G Bhat <sbhat@linux.ibm.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://msgid.link/171923274748.1397.6274953248403106679.stgit@linux.ibm.com
1 parent 4ba2fdf commit 35146ea

3 files changed

Lines changed: 23 additions & 16 deletions

File tree

arch/powerpc/include/asm/iommu.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,7 @@ extern long iommu_tce_xchg_no_kill(struct mm_struct *mm,
222222
enum dma_data_direction *direction);
223223
extern void iommu_tce_kill(struct iommu_table *tbl,
224224
unsigned long entry, unsigned long pages);
225+
int dev_has_iommu_table(struct device *dev, void *data);
225226

226227
#else
227228
static inline void iommu_register_group(struct iommu_table_group *table_group,
@@ -235,6 +236,11 @@ static inline int iommu_add_device(struct iommu_table_group *table_group,
235236
{
236237
return 0;
237238
}
239+
240+
static inline int dev_has_iommu_table(struct device *dev, void *data)
241+
{
242+
return 0;
243+
}
238244
#endif /* !CONFIG_IOMMU_API */
239245

240246
u64 dma_iommu_get_required_mask(struct device *dev);

arch/powerpc/kernel/eeh.c

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1273,22 +1273,6 @@ EXPORT_SYMBOL(eeh_dev_release);
12731273

12741274
#ifdef CONFIG_IOMMU_API
12751275

1276-
static int dev_has_iommu_table(struct device *dev, void *data)
1277-
{
1278-
struct pci_dev *pdev = to_pci_dev(dev);
1279-
struct pci_dev **ppdev = data;
1280-
1281-
if (!dev)
1282-
return 0;
1283-
1284-
if (device_iommu_mapped(dev)) {
1285-
*ppdev = pdev;
1286-
return 1;
1287-
}
1288-
1289-
return 0;
1290-
}
1291-
12921276
/**
12931277
* eeh_iommu_group_to_pe - Convert IOMMU group to EEH PE
12941278
* @group: IOMMU group

arch/powerpc/kernel/iommu.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -988,6 +988,23 @@ unsigned long iommu_direction_to_tce_perm(enum dma_data_direction dir)
988988
EXPORT_SYMBOL_GPL(iommu_direction_to_tce_perm);
989989

990990
#ifdef CONFIG_IOMMU_API
991+
992+
int dev_has_iommu_table(struct device *dev, void *data)
993+
{
994+
struct pci_dev *pdev = to_pci_dev(dev);
995+
struct pci_dev **ppdev = data;
996+
997+
if (!dev)
998+
return 0;
999+
1000+
if (device_iommu_mapped(dev)) {
1001+
*ppdev = pdev;
1002+
return 1;
1003+
}
1004+
1005+
return 0;
1006+
}
1007+
9911008
/*
9921009
* SPAPR TCE API
9931010
*/

0 commit comments

Comments
 (0)