From: Hemant Agrawal Date: Wed, 11 Oct 2017 06:42:18 +0000 (+0530) Subject: vfio: enable independently of PCI bus X-Git-Tag: spdx-start~1276 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=229f351a639f846fc688d873747c863346102ea1;p=dpdk.git vfio: enable independently of PCI bus VFIO may be used by buses other than PCI. This patch enables the VFIO on the basis of vfio root presence. Since vfio_enable should be called only once, pci_vfio_enable is also removed. A debug print is added in case vfio_pci module is not present. Signed-off-by: Hemant Agrawal Acked-by: Anatoly Burakov --- diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c index ad7278989a..02381d0d15 100644 --- a/lib/librte_eal/linuxapp/eal/eal.c +++ b/lib/librte_eal/linuxapp/eal/eal.c @@ -710,9 +710,13 @@ static int rte_eal_vfio_setup(void) { int vfio_enabled = 0; + if (vfio_enable("vfio")) + return -1; + vfio_enabled = vfio_is_enabled("vfio"); + if (!internal_config.no_pci) { - pci_vfio_enable(); - vfio_enabled |= pci_vfio_is_enabled(); + if (!pci_vfio_is_enabled()) + RTE_LOG(DEBUG, EAL, "VFIO PCI modules not loaded\n"); } if (vfio_enabled) { diff --git a/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c b/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c index 10a75da6ce..d407c872f5 100644 --- a/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c +++ b/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c @@ -742,12 +742,6 @@ pci_vfio_ioport_unmap(struct rte_pci_ioport *p) return -1; } -int -pci_vfio_enable(void) -{ - return vfio_enable("vfio_pci"); -} - int pci_vfio_is_enabled(void) { diff --git a/lib/librte_eal/linuxapp/eal/eal_vfio.c b/lib/librte_eal/linuxapp/eal/eal_vfio.c index 9d66247bcc..e0d37dce5d 100644 --- a/lib/librte_eal/linuxapp/eal/eal_vfio.c +++ b/lib/librte_eal/linuxapp/eal/eal_vfio.c @@ -489,7 +489,7 @@ vfio_enable(const char *modname) /* inform the user that we are probing for VFIO */ RTE_LOG(INFO, EAL, "Probing VFIO support...\n"); - /* check if vfio-pci module is loaded */ + /* check if vfio module is loaded */ vfio_available = rte_eal_check_module(modname); /* return error directly */ diff --git a/lib/librte_eal/linuxapp/eal/eal_vfio.h b/lib/librte_eal/linuxapp/eal/eal_vfio.h index 26ea8e1197..4bab363d4f 100644 --- a/lib/librte_eal/linuxapp/eal/eal_vfio.h +++ b/lib/librte_eal/linuxapp/eal/eal_vfio.h @@ -207,7 +207,6 @@ int vfio_release_device(const char *sysfs_base, const char *dev_addr, int fd); int vfio_enable(const char *modname); int vfio_is_enabled(const char *modname); -int pci_vfio_enable(void); int pci_vfio_is_enabled(void); int vfio_mp_sync_setup(void);