From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 3A160A046B for ; Thu, 25 Jul 2019 10:05:21 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id A768F1C2A6; Thu, 25 Jul 2019 10:05:20 +0200 (CEST) Received: from mail-io1-f67.google.com (mail-io1-f67.google.com [209.85.166.67]) by dpdk.org (Postfix) with ESMTP id 79FA01C2A5 for ; Thu, 25 Jul 2019 10:05:18 +0200 (CEST) Received: by mail-io1-f67.google.com with SMTP id j6so20208089ioa.5 for ; Thu, 25 Jul 2019 01:05:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=OwL7HFQxPo5rWi/ks7QeyhMQZaLH3bXIDLvqCet/RAQ=; b=BG68usj7XZvmWrAf9MHuaHHT7YmCjaE8XriCswytr7YC7PEOdcq6PvdyAKtdlJbssM 1RWGyr8aaASGXpowKt7Ajw+YWU7E0oPTxxN9fhbkZPr1KfSi6DJvE/f0gw7HHucpjpQV elPK3fBw+c+bWmES96VxoKxgyWyRdOyraqwmzA0JCNedtM8UFk0TOqr667Wp+Rn4PC18 zDIt/C41s6/dUAQWpj/3e2Un/pdQSpa3oaDsE9DmznhdN+UYy9ApQn9W/8lm5n0an/Jl REPbyc1Y0rOZTmKEWYLJl5VGmkyW6SWvxovvgTqBMoWiQgxmDkmgTHgIPsbkDzJyEnkH Vmbg== X-Gm-Message-State: APjAAAVCnLINgxF2hM/bzpl+XmXdjWajs1nKsR060qXxHFXLfOKLTINA O8EfbgKVYrKSAcQ9l9/2WoY4OSOXkaRttGblPVQ30A== X-Google-Smtp-Source: APXvYqwmm4QuRIHvNt1N95Vvs6mM5p491nC2mqu9DYu2cNrLDSFhDHrMJi9BJajnI9hOUgXzeZwuxO7lzPe32R4+DjA= X-Received: by 2002:a5e:9917:: with SMTP id t23mr11248753ioj.23.1564041917779; Thu, 25 Jul 2019 01:05:17 -0700 (PDT) MIME-Version: 1.0 References: <5d8f83fb7dd574d83a044c6a01e2613798f256c3.1563986790.git.anatoly.burakov@intel.com> In-Reply-To: <5d8f83fb7dd574d83a044c6a01e2613798f256c3.1563986790.git.anatoly.burakov@intel.com> From: David Marchand Date: Thu, 25 Jul 2019 10:05:06 +0200 Message-ID: To: Anatoly Burakov Cc: dev , Jerin Jacob Kollanukkaran , Thomas Monjalon Content-Type: text/plain; charset="UTF-8" Subject: Re: [dpdk-dev] [PATCH] eal: pick IOVA as PA if IOMMU is not available 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Wed, Jul 24, 2019 at 6:46 PM Anatoly Burakov wrote: > > When IOMMU is not available, /sys/kernel/iommu_groups will not be > populated. This is happening since at least 3.6 when VFIO support > was added. If the directory is empty, EAL should not pick IOVA as > VA as the default IOVA mode. > > We also assume that VFIO equals IOMMU, so if VFIO support is not > compiled, we always assume IOMMU support is not available. Not sure I agree with this statement. What about unknown (from eal pov) kernel drivers? > > Signed-off-by: Anatoly Burakov > --- > lib/librte_eal/linux/eal/eal.c | 11 ++++++-- > lib/librte_eal/linux/eal/eal_vfio.c | 39 +++++++++++++++++++++++++++++ > lib/librte_eal/linux/eal/eal_vfio.h | 2 ++ > 3 files changed, 50 insertions(+), 2 deletions(-) > > diff --git a/lib/librte_eal/linux/eal/eal.c b/lib/librte_eal/linux/eal/eal.c > index 34db78753..584f97a96 100644 > --- a/lib/librte_eal/linux/eal/eal.c > +++ b/lib/librte_eal/linux/eal/eal.c > @@ -1061,8 +1061,15 @@ rte_eal_init(int argc, char **argv) > enum rte_iova_mode iova_mode = rte_bus_get_iommu_class(); > > if (iova_mode == RTE_IOVA_DC) { > - iova_mode = RTE_IOVA_VA; > - RTE_LOG(DEBUG, EAL, "Buses did not request a specific IOVA mode, select IOVA as VA mode.\n"); > + /* if we have an IOMMU, pick IOVA as VA mode */ > + if (vfio_iommu_enabled()) { > + iova_mode = RTE_IOVA_VA; > + RTE_LOG(DEBUG, EAL, "Buses did not request a specific IOVA mode, selecting IOVA as VA mode.\n"); > + } else { > + iova_mode = RTE_IOVA_PA; > + RTE_LOG(DEBUG, EAL, "Buses did not request a specific IOVA mode, but IOMMU is not available.\n"); > + RTE_LOG(DEBUG, EAL, "Selecting IOVA as PA mode.\n"); > + } Here, since the buses don't care, we can check for physical address availability. -- David Marchand