From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id EE1801B205 for ; Mon, 30 Oct 2017 10:00:46 +0100 (CET) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 Oct 2017 02:00:45 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.44,319,1505804400"; d="scan'208";a="915343405" Received: from fyigit-mobl1.ger.corp.intel.com (HELO [10.254.133.14]) ([10.254.133.14]) by FMSMGA003.fm.intel.com with ESMTP; 30 Oct 2017 02:00:44 -0700 To: =?UTF-8?Q?Ga=c3=abtan_Rivet?= , Jerin Jacob Cc: dev@dpdk.org, thomas@monjalon.net References: <20171028062053.6615-1-jerin.jacob@caviumnetworks.com> <20171030080654.GF10890@bidouze.vm.6wind.com> From: Ferruh Yigit Message-ID: <6e9922c5-9659-a42a-4213-700ebe1e5714@intel.com> Date: Mon, 30 Oct 2017 02:00:43 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <20171030080654.GF10890@bidouze.vm.6wind.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Subject: Re: [dpdk-dev] [PATCH] bus/pci: fix vfio mode X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Oct 2017 09:00:47 -0000 On 10/30/2017 1:06 AM, Gaƫtan Rivet wrote: > Hi Jerin, > > On Sat, Oct 28, 2017 at 11:50:52AM +0530, Jerin Jacob wrote: >> The definition of VFIO_PRESENT is "eal_vfio.h", Fail to >> include eal_vfio.h will result in disabling vfio. >> >> Fixes: 279b581c897d ("vfio: expose functions") >> > > Thanks for the fix, sorry for VFIO. > I tried to let go of VFIO_PRESENT in the PCI patchset, unfortunately I did > not do a good-enough job. > > Instead of reinstating the dependency on the private eal_vfio.h header, > I'd suggest replacing all VFIO_PRESENT references within the PCI bus by > RTE_EAL_VFIO, and make the pci_vfio.c compilation depend on it within > the linux Makefile. Something like: > > ---8<--- > > grep -rl VFIO_PRESENT drivers/bus/pci/linux/ |while read -r file > do sed -i 's;VFIO_PRESENT;RTE_EAL_VFIO;' $file > done VFIO_PRESENT is the combination of the if user enabled VFIO and if Linux kernel supports it. Why not add same check and VFIO_PRESENT definition to rte_vfio.h: --- a/lib/librte_eal/common/include/rte_vfio.h +++ b/lib/librte_eal/common/include/rte_vfio.h @@ -34,7 +34,13 @@ #ifndef _RTE_VFIO_H_ #define _RTE_VFIO_H_ +#if !defined(VFIO_PRESENT) && defined(RTE_EAL_VFIO) +#include +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0) #include +#define VFIO_PRESENT +#endif /* >= 3.6.0 */ +#endif + +#ifdef VFIO_PRESENT ... Need to wrap here in case VFIO disabled ... #endif > > patch -p1 <<___HERE > diff --git a/drivers/bus/pci/linux/Makefile b/drivers/bus/pci/linux/Makefile > index 77c5f97..b5b9c54 100644 > --- a/drivers/bus/pci/linux/Makefile > +++ b/drivers/bus/pci/linux/Makefile > @@ -31,6 +31,8 @@ > > SRCS += pci.c > SRCS += pci_uio.c > +ifeq (\$(CONFIG_RTE_EAL_VFIO),y) > SRCS += pci_vfio.c > +endif +1 Also ? +ifeq ($(CONFIG_RTE_EAL_VFIO),y) SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_vfio.c SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_vfio_mp_sync.c +endif Build shouldn't broken when VFIO disabled form config > > CFLAGS += -D_GNU_SOURCE > ___HERE > > --->8--- > > Do you think it could work? If so, I think it would be preferable > to re-including eal_vfio.h. Private EAL headers are bound to be removed > from other subsystems at some point. I tried to start with VFIO, others > should follow. > >> Cc: Gaetan Rivet >> >> Signed-off-by: Jerin Jacob >> --- >> drivers/bus/pci/linux/pci.c | 1 + >> 1 file changed, 1 insertion(+) >> >> diff --git a/drivers/bus/pci/linux/pci.c b/drivers/bus/pci/linux/pci.c >> index cdf810693..d0ce0207a 100644 >> --- a/drivers/bus/pci/linux/pci.c >> +++ b/drivers/bus/pci/linux/pci.c >> @@ -46,6 +46,7 @@ >> >> #include "eal_private.h" >> #include "eal_filesystem.h" >> +#include "eal_vfio.h" >> >> #include "private.h" >> #include "pci_init.h" >> -- >> 2.14.3 >> >