From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <mukawa@igel.co.jp>
Received: from mail-ie0-f178.google.com (mail-ie0-f178.google.com
 [209.85.223.178]) by dpdk.org (Postfix) with ESMTP id EFAFE5A99
 for <dev@dpdk.org>; Fri, 10 Jul 2015 14:12:46 +0200 (CEST)
Received: by iecvh10 with SMTP id vh10so195303738iec.3
 for <dev@dpdk.org>; Fri, 10 Jul 2015 05:12:46 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20130820;
 h=x-gm-message-state:mime-version:in-reply-to:references:date
 :message-id:subject:from:to:cc:content-type;
 bh=qbvmFItqpBn8Ihrf3AoVsc+4MIV9Sp8ARxkEN/CBteI=;
 b=aBonihNzLULaFl8vwYC3E3qRwqhOPowEVR49pkjTxQIBQ/LVO47PMFKu1gnkNnuRnn
 3U2gG3mga87BoX5sypubqU7wJ7bzv7pFXggpQPmFX9F9gGCbwCrrLF0c6bRiL+HwBaKw
 3jFPPRI8g++KyhAlbqSIKYuGw7h4V+lEgJ3ZTjTbEjSnHfNbehg9hbvKEii1j5c8kfy/
 D3tGxroqlUye/2ZRkMBL3E76ikaQ/jRk3KUZzTGxEU2SzB1oWFqdFBbQ+z2rTZjf678A
 ewgNudBIxODj77MrpedXFmdK+yTG3eIUDl4SwRXTS4S1n0K8QvyJ5NKGJ3kDuvkminbA
 y2gA==
X-Gm-Message-State: ALoCoQnpuqpuhrI7U2Pb7WN8TIwo20/QOTEDn3jrN23P7hYI0xorJhYQ5QA0MYmUg3NrUVZDf7Z5
MIME-Version: 1.0
X-Received: by 10.107.170.77 with SMTP id t74mr5293490ioe.107.1436530366370;
 Fri, 10 Jul 2015 05:12:46 -0700 (PDT)
Received: by 10.64.246.166 with HTTP; Fri, 10 Jul 2015 05:12:46 -0700 (PDT)
In-Reply-To: <20150710113826.GA10608@bricha3-MOBL3>
References: <1436514439-4893-1-git-send-email-michael.qiu@intel.com>
 <559F83AE.4050409@igel.co.jp>
 <CALwxeUsTYhjXbsR8XeFuaYeA+nzMHj1esqb_D4nb+49xCD2K7A@mail.gmail.com>
 <20150710113826.GA10608@bricha3-MOBL3>
Date: Fri, 10 Jul 2015 21:12:46 +0900
Message-ID: <CAKU8wkeNLm7-LOHRYA2nWo4in2vCwD+7_-vFE+EqT5eyEWRT=A@mail.gmail.com>
From: Tetsuya Mukawa <mukawa@igel.co.jp>
To: Bruce Richardson <bruce.richardson@intel.com>
Content-Type: text/plain; charset=UTF-8
Cc: "dev@dpdk.org" <dev@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH] BugFix: VFIO never works
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: patches and discussions about DPDK <dev.dpdk.org>
List-Unsubscribe: <http://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <http://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Fri, 10 Jul 2015 12:12:47 -0000

2015-07-10 20:38 GMT+09:00 Bruce Richardson <bruce.richardson@intel.com>:
> On Fri, Jul 10, 2015 at 01:25:49PM +0200, David Marchand wrote:
>> On Fri, Jul 10, 2015 at 10:34 AM, Tetsuya Mukawa <mukawa@igel.co.jp> wrote:
>>
>> > On 2015/07/10 16:47, Michael Qiu wrote:
>> > > Commit 35b3313e322b ("pci: merge mapping functions for linux and bsd")
>> > >
>> > > introduced a bug that all vfio will be
>> > > blocked.
>> > >
>> > > Root cause is that VFIO_PRESENT is unaccessable in eal
>> > > common level.
>> > >
>> > > This patch is to fix this.
>> > >
>> > > Signed-off-by: Michael Qiu <michael.qiu@intel.com>
>> > > ---
>> > >  lib/librte_eal/common/eal_common_pci.c     |  2 --
>> > >  lib/librte_eal/common/eal_private.h        |  3 +++
>> > >  lib/librte_eal/linuxapp/eal/eal_pci_vfio.c | 10 ++++++++++
>> > >  3 files changed, 13 insertions(+), 2 deletions(-)
>> > >
>> > > diff --git a/lib/librte_eal/common/eal_common_pci.c
>> > b/lib/librte_eal/common/eal_common_pci.c
>> > > index 3805aed..f3dc697 100644
>> > > --- a/lib/librte_eal/common/eal_common_pci.c
>> > > +++ b/lib/librte_eal/common/eal_common_pci.c
>> > > @@ -146,10 +146,8 @@ pci_map_device(struct rte_pci_device *dev)
>> > >       /* try mapping the NIC resources using VFIO if it exists */
>> > >       switch (dev->kdrv) {
>> > >       case RTE_KDRV_VFIO:
>> > > -#ifdef VFIO_PRESENT
>> > >               if (pci_vfio_is_enabled())
>> > >                       ret = pci_vfio_map_resource(dev);
>> > > -#endif
>> >
>>
>> This is a common file, vfio is not available on BSD.
>> I missed that during review.
>>
>> Did you test build on BSD ?
>>
> Just tried it. BSD build fails with this patch applied.
>
> Rather than using ifdefs, we could also look at providing dummy functions for
> vfio in BSD. They would never be called by this code as drivers in BSD should
> never have dev->kdrv == RTE_KDRV_VFIO.
>
> /Bruce

I've got it. Right, we need to fix the patch.

I don't have BSD machine within reach now.
So I will write and test a new patch tomorrow.

Tetsuya

>
> diff --git a/lib/librte_eal/bsdapp/eal/eal_pci.c b/lib/librte_eal/bsdapp/eal/eal_pci.c
> index 12f39d9..8c1422c 100644
> --- a/lib/librte_eal/bsdapp/eal/eal_pci.c
> +++ b/lib/librte_eal/bsdapp/eal/eal_pci.c
> @@ -358,6 +358,16 @@ error:
>         return -1;
>  }
>
> +/*
> + * no vfio on BSD, but provide empty functions to avoid compile errors in
> + * common code.
> + */
> +int
> +pci_vfio_is_enabled(void) { return 0; }
> +
> +int
> +pci_vfio_map_resource(struct rte_pci_device *dev __rte_unused) { return -1; }
> +
>  /* Init the PCI EAL subsystem */
>  int
>  rte_eal_pci_init(void)
>