]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
powerpc/iommu: Move dev_has_iommu_table() to iommu.c
authorShivaprasad G Bhat <sbhat@linux.ibm.com>
Mon, 24 Jun 2024 12:39:10 +0000 (12:39 +0000)
committerMichael Ellerman <mpe@ellerman.id.au>
Fri, 28 Jun 2024 07:03:40 +0000 (17:03 +1000)
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
arch/powerpc/include/asm/iommu.h
arch/powerpc/kernel/eeh.c
arch/powerpc/kernel/iommu.c

index f49157effcee7393c1e7c1bec9f72591b56c9da5..6dd5c25c75031a3e3a582083d5454c3d9a3017a6 100644 (file)
@@ -222,6 +222,7 @@ extern long iommu_tce_xchg_no_kill(struct mm_struct *mm,
                enum dma_data_direction *direction);
 extern void iommu_tce_kill(struct iommu_table *tbl,
                unsigned long entry, unsigned long pages);
+int dev_has_iommu_table(struct device *dev, void *data);
 
 #else
 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,
 {
        return 0;
 }
+
+static inline int dev_has_iommu_table(struct device *dev, void *data)
+{
+       return 0;
+}
 #endif /* !CONFIG_IOMMU_API */
 
 u64 dma_iommu_get_required_mask(struct device *dev);
index 6670063a7a6c7d467ee43bea4ffd2df6427f7a36..d03f17987fca7f8177defe8e2b8abf8920eb48a1 100644 (file)
@@ -1273,22 +1273,6 @@ EXPORT_SYMBOL(eeh_dev_release);
 
 #ifdef CONFIG_IOMMU_API
 
-static int dev_has_iommu_table(struct device *dev, void *data)
-{
-       struct pci_dev *pdev = to_pci_dev(dev);
-       struct pci_dev **ppdev = data;
-
-       if (!dev)
-               return 0;
-
-       if (device_iommu_mapped(dev)) {
-               *ppdev = pdev;
-               return 1;
-       }
-
-       return 0;
-}
-
 /**
  * eeh_iommu_group_to_pe - Convert IOMMU group to EEH PE
  * @group: IOMMU group
index b5febc6c7a5ef2a6eafb5859a660bdf49e6879cb..ed8204cfa31973c39f5a04798899bb7a72045720 100644 (file)
@@ -988,6 +988,23 @@ unsigned long iommu_direction_to_tce_perm(enum dma_data_direction dir)
 EXPORT_SYMBOL_GPL(iommu_direction_to_tce_perm);
 
 #ifdef CONFIG_IOMMU_API
+
+int dev_has_iommu_table(struct device *dev, void *data)
+{
+       struct pci_dev *pdev = to_pci_dev(dev);
+       struct pci_dev **ppdev = data;
+
+       if (!dev)
+               return 0;
+
+       if (device_iommu_mapped(dev)) {
+               *ppdev = pdev;
+               return 1;
+       }
+
+       return 0;
+}
+
 /*
  * SPAPR TCE API
  */