From mboxrd@z Thu Jan 1 00:00:00 1970 From: Hemant Agrawal Subject: FW: [PATCH v3] eal: enable vfio independent of PCI bus Date: Mon, 23 Oct 2017 06:33:14 +0000 Message-ID: References: <1507375221-16271-1-git-send-email-hemant.agrawal@nxp.com> <1507704138-17237-1-git-send-email-hemant.agrawal@nxp.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Cc: "dev@dpdk.org" , Thomas Monjalon To: "anatoly.burakov@intel.com" Return-path: Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01on0072.outbound.protection.outlook.com [104.47.0.72]) by dpdk.org (Postfix) with ESMTP id 0A1A81B397 for ; Mon, 23 Oct 2017 08:33:16 +0200 (CEST) In-Reply-To: <1507704138-17237-1-git-send-email-hemant.agrawal@nxp.com> Content-Language: en-US List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Hi Anatoly, Will you please review the following patch? Regards, Hemant -----Original Message----- From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Hemant Agrawal Sent: Wednesday, October 11, 2017 12:12 PM To: thomas@monjalon.net; anatoly.burakov@intel.com Cc: dev@dpdk.org Subject: [dpdk-dev] [PATCH v3] eal: enable vfio independent of PCI bus VFIO may be used by buses other than PCI. This patch enables the VFIO on th= e basis of vfio root presence. Since vfio_enable should be called only once, pci_vfio_enable is also remov= ed. A debug print is added in case vfio_pci module is not present. Signed-off-by: Hemant Agrawal --- v3: changed the vfio enable for vfio root instead of pci v2: enabled VFIO, independent of no-pci flag as suggested by Thomas removed fslmc specific vfio enable lib/librte_eal/linuxapp/eal/eal.c | 8 ++++++-- lib/librte_eal/linuxapp/eal/eal_pci_vfio.c | 6 ------ lib/librte_eal/linuxapp/eal/eal_vfio.c | 2 +- lib/librte_eal/linuxapp/eal/eal_vfio.h | 1 - 4 files changed, 7 insertions(+), 10 deletions(-) diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/ea= l/eal.c index ec37c52..e0aceba 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 =3D 0; =20 + if (vfio_enable("vfio")) + return -1; + vfio_enabled =3D vfio_is_enabled("vfio"); + if (!internal_config.no_pci) { - pci_vfio_enable(); - vfio_enabled |=3D pci_vfio_is_enabled(); + if (!pci_vfio_is_enabled()) + RTE_LOG(DEBUG, EAL, "vfio pci modules not loaded\n"); } =20 if (vfio_enabled) { diff --git a/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c b/lib/librte_eal/li= nuxapp/eal/eal_pci_vfio.c index aa9d96e..fc84705 100644 --- a/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c +++ b/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c @@ -661,12 +661,6 @@ pci_vfio_ioport_unmap(struct rte_pci_ioport *p) } =20 int -pci_vfio_enable(void) -{ - return vfio_enable("vfio_pci"); -} - -int pci_vfio_is_enabled(void) { return vfio_is_enabled("vfio_pci"); diff --git a/lib/librte_eal/linuxapp/eal/eal_vfio.c b/lib/librte_eal/linuxa= pp/eal/eal_vfio.c index b32cd09..ebb71f0 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"); =20 - /* check if vfio-pci module is loaded */ + /* check if vfio module is loaded */ vfio_available =3D rte_eal_check_module(modname); =20 /* return error directly */ diff --git a/lib/librte_eal/linuxapp/eal/eal_vfio.h b/lib/librte_eal/linuxa= pp/eal/eal_vfio.h index 26ea8e1..4bab363 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 c= har *dev_addr, int fd); int vfio_enable(const char *modname); int vfio_is= _enabled(const char *modname); =20 -int pci_vfio_enable(void); int pci_vfio_is_enabled(void); =20 int vfio_mp_sync_setup(void); -- 2.7.4