From 7e434f300d0ca1e385cdfb9018da043b01a623dc Mon Sep 17 00:00:00 2001 From: Gaetan Rivet Date: Thu, 26 Oct 2017 12:05:55 +0200 Subject: [PATCH] vfio: move PCI related symbols These symbols are only relevant to PCI operations. Move them to a private PCI-related header, allowing to remove the dependency of the PCI subsystem upon private eal_vfio.h. Signed-off-by: Gaetan Rivet --- lib/librte_eal/linuxapp/eal/eal_pci_init.h | 14 ++++++++++++++ lib/librte_eal/linuxapp/eal/eal_pci_vfio.c | 3 +-- lib/librte_eal/linuxapp/eal/eal_vfio.h | 12 ------------ 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/lib/librte_eal/linuxapp/eal/eal_pci_init.h b/lib/librte_eal/linuxapp/eal/eal_pci_init.h index a20783d530..99d7a2e86a 100644 --- a/lib/librte_eal/linuxapp/eal/eal_pci_init.h +++ b/lib/librte_eal/linuxapp/eal/eal_pci_init.h @@ -34,6 +34,8 @@ #ifndef EAL_PCI_INIT_H_ #define EAL_PCI_INIT_H_ +#include + #include /** IO resource type: */ @@ -74,6 +76,16 @@ int pci_uio_ioport_unmap(struct rte_pci_ioport *p); #ifdef RTE_EAL_VFIO +#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 10, 0) +#define RTE_PCI_MSIX_TABLE_BIR 0x7 +#define RTE_PCI_MSIX_TABLE_OFFSET 0xfffffff8 +#define RTE_PCI_MSIX_FLAGS_QSIZE 0x07ff +#else +#define RTE_PCI_MSIX_TABLE_BIR PCI_MSIX_TABLE_BIR +#define RTE_PCI_MSIX_TABLE_OFFSET PCI_MSIX_TABLE_OFFSET +#define RTE_PCI_MSIX_FLAGS_QSIZE PCI_MSIX_FLAGS_QSIZE +#endif + /* access config space */ int pci_vfio_read_config(const struct rte_intr_handle *intr_handle, void *buf, size_t len, off_t offs); @@ -92,6 +104,8 @@ int pci_vfio_ioport_unmap(struct rte_pci_ioport *p); int pci_vfio_map_resource(struct rte_pci_device *dev); int pci_vfio_unmap_resource(struct rte_pci_device *dev); +int pci_vfio_is_enabled(void); + #endif #endif /* EAL_PCI_INIT_H_ */ diff --git a/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c b/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c index 8fa101b13e..19994c81c6 100644 --- a/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c +++ b/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c @@ -48,7 +48,6 @@ #include "eal_filesystem.h" #include "eal_pci_init.h" -#include "eal_vfio.h" #include "eal_private.h" /** @@ -61,7 +60,7 @@ * This file is only compiled if CONFIG_RTE_EAL_VFIO is set to "y". */ -#ifdef VFIO_PRESENT +#ifdef RTE_EAL_VFIO #define PAGE_SIZE (sysconf(_SC_PAGESIZE)) #define PAGE_MASK (~(PAGE_SIZE - 1)) diff --git a/lib/librte_eal/linuxapp/eal/eal_vfio.h b/lib/librte_eal/linuxapp/eal/eal_vfio.h index 8eb12db867..766d0042de 100644 --- a/lib/librte_eal/linuxapp/eal/eal_vfio.h +++ b/lib/librte_eal/linuxapp/eal/eal_vfio.h @@ -42,16 +42,6 @@ #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0) #include -#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 10, 0) -#define RTE_PCI_MSIX_TABLE_BIR 0x7 -#define RTE_PCI_MSIX_TABLE_OFFSET 0xfffffff8 -#define RTE_PCI_MSIX_FLAGS_QSIZE 0x07ff -#else -#define RTE_PCI_MSIX_TABLE_BIR PCI_MSIX_TABLE_BIR -#define RTE_PCI_MSIX_TABLE_OFFSET PCI_MSIX_TABLE_OFFSET -#define RTE_PCI_MSIX_FLAGS_QSIZE PCI_MSIX_FLAGS_QSIZE -#endif - #define RTE_VFIO_TYPE1 VFIO_TYPE1_IOMMU #ifndef VFIO_SPAPR_TCE_v2_IOMMU @@ -183,8 +173,6 @@ vfio_get_group_fd(int iommu_group_no); int clear_group(int vfio_group_fd); -int pci_vfio_is_enabled(void); - int vfio_mp_sync_setup(void); #define SOCKET_REQ_CONTAINER 0x100 -- 2.20.1