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 3C2F7A046B for ; Thu, 25 Jul 2019 11:31:48 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id AAAED1C2B1; Thu, 25 Jul 2019 11:31:47 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 3C4F71C2A7 for ; Thu, 25 Jul 2019 11:31:46 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 25 Jul 2019 02:31:35 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,306,1559545200"; d="scan'208";a="193750096" Received: from aburakov-mobl1.ger.corp.intel.com (HELO [10.237.220.83]) ([10.237.220.83]) by fmsmga004.fm.intel.com with ESMTP; 25 Jul 2019 02:31:34 -0700 To: David Marchand Cc: dev , Jerin Jacob Kollanukkaran , Thomas Monjalon References: <5d8f83fb7dd574d83a044c6a01e2613798f256c3.1563986790.git.anatoly.burakov@intel.com> From: "Burakov, Anatoly" Message-ID: <61fe76fd-beb8-6074-32e1-16b47170a6ef@intel.com> Date: Thu, 25 Jul 2019 10:31:33 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit 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 25-Jul-19 9:05 AM, David Marchand wrote: > 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? Are there any cases where we can use IOVA as VA mode without having VFIO compiled? > > >> >> 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. > Good point, if PA are not available, we can't use IOVA as PA mode. -- Thanks, Anatoly