vfio/pci: Move all the SPAPR PCI specific logic to vfio_pci_core.ko
authorJason Gunthorpe <jgg@nvidia.com>
Mon, 5 Dec 2022 15:29:16 +0000 (11:29 -0400)
committerAlex Williamson <alex.williamson@redhat.com>
Mon, 5 Dec 2022 19:04:32 +0000 (12:04 -0700)
The vfio_spapr_pci_eeh_open/release() functions are one line wrappers
around an arch function. Just call them directly. This eliminates some
weird exported symbols that don't need to exist.

Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Link: https://lore.kernel.org/r/1-v5-fc5346cacfd4+4c482-vfio_modules_jgg@nvidia.com
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
drivers/vfio/pci/vfio_pci_core.c
drivers/vfio/vfio_spapr_eeh.c
include/linux/vfio.h

index 189d4930c276d81ce84f717427cb84dfa7402e4b..56501e7ef5645e65402499d4b402d4d7b157c519 100644 (file)
@@ -27,6 +27,9 @@
 #include <linux/vgaarb.h>
 #include <linux/nospec.h>
 #include <linux/sched/mm.h>
+#if IS_ENABLED(CONFIG_VFIO_SPAPR_EEH)
+#include <asm/eeh.h>
+#endif
 
 #include "vfio_pci_priv.h"
 
@@ -686,7 +689,9 @@ void vfio_pci_core_close_device(struct vfio_device *core_vdev)
                vdev->sriov_pf_core_dev->vf_token->users--;
                mutex_unlock(&vdev->sriov_pf_core_dev->vf_token->lock);
        }
-       vfio_spapr_pci_eeh_release(vdev->pdev);
+#if IS_ENABLED(CONFIG_VFIO_SPAPR_EEH)
+       eeh_dev_release(vdev->pdev);
+#endif
        vfio_pci_core_disable(vdev);
 
        mutex_lock(&vdev->igate);
@@ -705,7 +710,9 @@ EXPORT_SYMBOL_GPL(vfio_pci_core_close_device);
 void vfio_pci_core_finish_enable(struct vfio_pci_core_device *vdev)
 {
        vfio_pci_probe_mmaps(vdev);
-       vfio_spapr_pci_eeh_open(vdev->pdev);
+#if IS_ENABLED(CONFIG_VFIO_SPAPR_EEH)
+       eeh_dev_open(vdev->pdev);
+#endif
 
        if (vdev->sriov_pf_core_dev) {
                mutex_lock(&vdev->sriov_pf_core_dev->vf_token->lock);
index 67f55ac1d459cc18a192fa580d9e5e5df2962914..c9d102aafbcd11167bdabef5412318c9ff496de6 100644 (file)
 #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)
 {
index 43b67e46a2cb50fdff3de38597a15755138224a7..9378ca79d54804ef58233be2e05e395776a625d8 100644 (file)
@@ -233,21 +233,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)