diff mbox series

[v2,1/4] vfio/pci: Move all the SPAPR PCI specific logic to vfio_pci_core.ko

Message ID 1-v2-18daead6a41e+98-vfio_modules_jgg@nvidia.com (mailing list archive)
State New, archived
Headers show
Series Simplify the module and kconfig structure in vfio | expand

Commit Message

Jason Gunthorpe Oct. 3, 2022, 3:39 p.m. UTC
The vfio_spapr_pci_eeh_open/release() functions are one line wrappers
around an arch function. Just make them static inline and move them into
vfio_pci_priv.h. This eliminates some weird exported symbols that don't
need to exist.

Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
---
 drivers/vfio/pci/vfio_pci_priv.h | 21 +++++++++++++++++++++
 drivers/vfio/vfio_spapr_eeh.c    | 13 -------------
 include/linux/vfio.h             | 11 -----------
 3 files changed, 21 insertions(+), 24 deletions(-)

Comments

Christoph Hellwig Oct. 10, 2022, 7:07 a.m. UTC | #1
On Mon, Oct 03, 2022 at 12:39:30PM -0300, Jason Gunthorpe wrote:
> The vfio_spapr_pci_eeh_open/release() functions are one line wrappers
> around an arch function. Just make them static inline and move them into
> vfio_pci_priv.h.

Please just kill them entirely - the vfio spapr code depends on EEH
anyway.  In fact I have an old patch to do that floating around
somewhere, but it's probably less work to just recreate it.
Jason Gunthorpe Oct. 10, 2022, 6:32 p.m. UTC | #2
On Mon, Oct 10, 2022 at 12:07:15AM -0700, Christoph Hellwig wrote:
> On Mon, Oct 03, 2022 at 12:39:30PM -0300, Jason Gunthorpe wrote:
> > The vfio_spapr_pci_eeh_open/release() functions are one line wrappers
> > around an arch function. Just make them static inline and move them into
> > vfio_pci_priv.h.
> 
> Please just kill them entirely - the vfio spapr code depends on EEH
> anyway.  In fact I have an old patch to do that floating around
> somewhere, but it's probably less work to just recreate it.

How do you mean? You want to put the #ifdef in the vfio_pci_core.c at
the only call site?

Jason
Christoph Hellwig Oct. 11, 2022, 6:30 a.m. UTC | #3
On Mon, Oct 10, 2022 at 03:32:30PM -0300, Jason Gunthorpe wrote:
> On Mon, Oct 10, 2022 at 12:07:15AM -0700, Christoph Hellwig wrote:
> > On Mon, Oct 03, 2022 at 12:39:30PM -0300, Jason Gunthorpe wrote:
> > > The vfio_spapr_pci_eeh_open/release() functions are one line wrappers
> > > around an arch function. Just make them static inline and move them into
> > > vfio_pci_priv.h.
> > 
> > Please just kill them entirely - the vfio spapr code depends on EEH
> > anyway.  In fact I have an old patch to do that floating around
> > somewhere, but it's probably less work to just recreate it.
> 
> How do you mean? You want to put the #ifdef in the vfio_pci_core.c at
> the only call site?

Yes.
diff mbox series

Patch

diff --git a/drivers/vfio/pci/vfio_pci_priv.h b/drivers/vfio/pci/vfio_pci_priv.h
index 5e4fa69aee16c1..24d93b2ac9f52b 100644
--- a/drivers/vfio/pci/vfio_pci_priv.h
+++ b/drivers/vfio/pci/vfio_pci_priv.h
@@ -101,4 +101,25 @@  static inline bool vfio_pci_is_vga(struct pci_dev *pdev)
 	return (pdev->class >> 8) == PCI_CLASS_DISPLAY_VGA;
 }
 
+#if IS_ENABLED(CONFIG_VFIO_SPAPR_EEH)
+#include <asm/eeh.h>
+static inline void vfio_spapr_pci_eeh_open(struct pci_dev *pdev)
+{
+	eeh_dev_open(pdev);
+}
+
+static inline void vfio_spapr_pci_eeh_release(struct pci_dev *pdev)
+{
+	eeh_dev_release(pdev);
+}
+#else
+static inline void vfio_spapr_pci_eeh_open(struct pci_dev *pdev)
+{
+}
+
+static inline void vfio_spapr_pci_eeh_release(struct pci_dev *pdev)
+{
+}
+#endif
+
 #endif
diff --git a/drivers/vfio/vfio_spapr_eeh.c b/drivers/vfio/vfio_spapr_eeh.c
index 67f55ac1d459cc..c9d102aafbcd11 100644
--- a/drivers/vfio/vfio_spapr_eeh.c
+++ b/drivers/vfio/vfio_spapr_eeh.c
@@ -15,19 +15,6 @@ 
 #define DRIVER_AUTHOR	"Gavin Shan, IBM Corporation"
 #define DRIVER_DESC	"VFIO IOMMU SPAPR EEH"
 
-/* We might build address mapping here for "fast" path later */
-void vfio_spapr_pci_eeh_open(struct pci_dev *pdev)
-{
-	eeh_dev_open(pdev);
-}
-EXPORT_SYMBOL_GPL(vfio_spapr_pci_eeh_open);
-
-void vfio_spapr_pci_eeh_release(struct pci_dev *pdev)
-{
-	eeh_dev_release(pdev);
-}
-EXPORT_SYMBOL_GPL(vfio_spapr_pci_eeh_release);
-
 long vfio_spapr_iommu_eeh_ioctl(struct iommu_group *group,
 				unsigned int cmd, unsigned long arg)
 {
diff --git a/include/linux/vfio.h b/include/linux/vfio.h
index ee399a768070d0..b0557e46b777a2 100644
--- a/include/linux/vfio.h
+++ b/include/linux/vfio.h
@@ -230,21 +230,10 @@  int vfio_set_irqs_validate_and_prepare(struct vfio_irq_set *hdr,
 				       int num_irqs, int max_irq_type,
 				       size_t *data_size);
 
-struct pci_dev;
 #if IS_ENABLED(CONFIG_VFIO_SPAPR_EEH)
-void vfio_spapr_pci_eeh_open(struct pci_dev *pdev);
-void vfio_spapr_pci_eeh_release(struct pci_dev *pdev);
 long vfio_spapr_iommu_eeh_ioctl(struct iommu_group *group, unsigned int cmd,
 				unsigned long arg);
 #else
-static inline void vfio_spapr_pci_eeh_open(struct pci_dev *pdev)
-{
-}
-
-static inline void vfio_spapr_pci_eeh_release(struct pci_dev *pdev)
-{
-}
-
 static inline long vfio_spapr_iommu_eeh_ioctl(struct iommu_group *group,
 					      unsigned int cmd,
 					      unsigned long arg)