From: Shivaprasad G Bhat <sbhat@linux.ibm.com>
To: mpe@ellerman.id.au, tpearson@raptorengineering.com,
alex.williamson@redhat.com, linuxppc-dev@lists.ozlabs.org,
aik@amd.com
Cc: svaidy@linux.ibm.com, robh@kernel.org, jroedel@suse.de,
sbhat@linux.ibm.com, gbatra@linux.vnet.ibm.com, jgg@ziepe.ca,
aik@ozlabs.ru, linux-kernel@vger.kernel.org,
mahesh@linux.ibm.com, aneesh.kumar@kernel.org,
brking@linux.vnet.ibm.com, oohall@gmail.com, npiggin@gmail.com,
kvm@vger.kernel.org, ruscur@russell.cc,
naveen.n.rao@linux.ibm.com, vaibhav@linux.ibm.com,
msuchanek@suse.de, joel@jms.id.au
Subject: [PATCH v3 5/6] powerpc/iommu: Move dev_has_iommu_table() to iommu.c
Date: Tue, 11 Jun 2024 12:30:03 +0000 [thread overview]
Message-ID: <171810899821.1721.10732893379752118244.stgit@linux.ibm.com> (raw)
In-Reply-To: <171810893836.1721.2640631616827396553.stgit@linux.ibm.com>
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>
---
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 6670063a7a6c..d03f17987fca 100644
--- a/arch/powerpc/kernel/eeh.c
+++ b/arch/powerpc/kernel/eeh.c
@@ -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
diff --git a/arch/powerpc/kernel/iommu.c b/arch/powerpc/kernel/iommu.c
index b5febc6c7a5e..ed8204cfa319 100644
--- a/arch/powerpc/kernel/iommu.c
+++ b/arch/powerpc/kernel/iommu.c
@@ -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
*/
next prev parent reply other threads:[~2024-06-11 12:33 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-11 12:28 [PATCH v3 0/6] powerpc: pSeries: vfio: iommu: Re-enable support for SPAPR TCE VFIO Shivaprasad G Bhat
2024-06-11 12:29 ` [PATCH v3 1/6] powerpc/iommu: Move pSeries specific functions to pseries/iommu.c Shivaprasad G Bhat
2024-06-11 12:29 ` [PATCH v3 2/6] powerpc/pseries/iommu: Fix the VFIO_IOMMU_SPAPR_TCE_GET_INFO ioctl output Shivaprasad G Bhat
2024-06-11 12:29 ` [PATCH v3 3/6] powerpc/pseries/iommu: Use the iommu table[0] for IOV VF's DDW Shivaprasad G Bhat
2024-06-11 12:29 ` [PATCH v3 4/6] vfio/spapr: Always clear TCEs before unsetting the window Shivaprasad G Bhat
2024-06-11 12:30 ` Shivaprasad G Bhat [this message]
2024-06-11 12:30 ` [PATCH v3 6/6] powerpc/iommu: Reimplement the iommu_table_group_ops for pSeries Shivaprasad G Bhat
2024-06-12 9:11 ` kernel test robot
2024-06-14 13:24 ` kernel test robot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=171810899821.1721.10732893379752118244.stgit@linux.ibm.com \
--to=sbhat@linux.ibm.com \
--cc=aik@amd.com \
--cc=aik@ozlabs.ru \
--cc=alex.williamson@redhat.com \
--cc=aneesh.kumar@kernel.org \
--cc=brking@linux.vnet.ibm.com \
--cc=gbatra@linux.vnet.ibm.com \
--cc=jgg@ziepe.ca \
--cc=joel@jms.id.au \
--cc=jroedel@suse.de \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mahesh@linux.ibm.com \
--cc=mpe@ellerman.id.au \
--cc=msuchanek@suse.de \
--cc=naveen.n.rao@linux.ibm.com \
--cc=npiggin@gmail.com \
--cc=oohall@gmail.com \
--cc=robh@kernel.org \
--cc=ruscur@russell.cc \
--cc=svaidy@linux.ibm.com \
--cc=tpearson@raptorengineering.com \
--cc=vaibhav@linux.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).