[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <171450759893.10851.5001066111916146610.stgit@linux.ibm.com>
Date: Tue, 30 Apr 2024 15:06:42 -0500
From: Shivaprasad G Bhat <sbhat@...ux.ibm.com>
To: mpe@...erman.id.au, tpearson@...torengineering.com,
alex.williamson@...hat.com, linuxppc-dev@...ts.ozlabs.org, aik@....com
Cc: npiggin@...il.com, christophe.leroy@...roup.eu, aneesh.kumar@...nel.org,
naveen.n.rao@...ux.ibm.com, gbatra@...ux.vnet.ibm.com,
brking@...ux.vnet.ibm.com, sbhat@...ux.ibm.com, aik@...abs.ru,
jgg@...pe.ca, ruscur@...sell.cc, robh@...nel.org,
linux-kernel@...r.kernel.org, joel@....id.au, kvm@...r.kernel.org,
msuchanek@...e.de, oohall@...il.com, mahesh@...ux.ibm.com,
jroedel@...e.de, vaibhav@...ux.ibm.com, svaidy@...ux.ibm.com
Subject: [RFC PATCH v2 5/6] 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@...ux.ibm.com>
---
arch/powerpc/include/asm/iommu.h | 1 +
arch/powerpc/kernel/eeh.c | 16 ----------------
arch/powerpc/kernel/iommu.c | 17 +++++++++++++++++
3 files changed, 18 insertions(+), 16 deletions(-)
diff --git a/arch/powerpc/include/asm/iommu.h b/arch/powerpc/include/asm/iommu.h
index 744cc5fc22d3..784809e34abe 100644
--- a/arch/powerpc/include/asm/iommu.h
+++ b/arch/powerpc/include/asm/iommu.h
@@ -220,6 +220,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,
diff --git a/arch/powerpc/kernel/eeh.c b/arch/powerpc/kernel/eeh.c
index ab316e155ea9..37bfbef929b5 100644
--- a/arch/powerpc/kernel/eeh.c
+++ b/arch/powerpc/kernel/eeh.c
@@ -1264,22 +1264,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
diff --git a/arch/powerpc/kernel/iommu.c b/arch/powerpc/kernel/iommu.c
index bc4584e73061..31dc663be0cc 100644
--- a/arch/powerpc/kernel/iommu.c
+++ b/arch/powerpc/kernel/iommu.c
@@ -987,6 +987,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
*/
Powered by blists - more mailing lists