From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail5.wrs.com (mail5.windriver.com [192.103.53.11]) by dpdk.org (Postfix) with ESMTP id 016491B45B for ; Wed, 3 Oct 2018 22:56:17 +0200 (CEST) Received: from ALA-HCA.corp.ad.wrs.com (ala-hca.corp.ad.wrs.com [147.11.189.40]) by mail5.wrs.com (8.15.2/8.15.2) with ESMTPS id w93KsKgh006330 (version=TLSv1 cipher=AES128-SHA bits=128 verify=FAIL); Wed, 3 Oct 2018 13:55:56 -0700 Received: from yow-ezhang-lx.wrs.com (128.224.56.213) by ALA-HCA.corp.ad.wrs.com (147.11.189.50) with Microsoft SMTP Server (TLS) id 14.3.408.0; Wed, 3 Oct 2018 13:54:32 -0700 From: eric zhang To: , CC: , , Date: Wed, 3 Oct 2018 16:53:13 -0400 Message-ID: <1538599994-23331-3-git-send-email-eric.zhang@windriver.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1538599994-23331-1-git-send-email-eric.zhang@windriver.com> References: <1538599994-23331-1-git-send-email-eric.zhang@windriver.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [128.224.56.213] Subject: [dpdk-dev] [PATCH v3 2/3] eal: force IOVA to a particular 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: Wed, 03 Oct 2018 20:56:18 -0000 This patch uses EAL option "--iova-mode" to force the IOVA mode to a particular value. There exists virtual devices that are not directly attached to the PCI bus, and therefore the auto detectioni of the IOVA mode based on probing the PCI bus and IOMMU configuration may not report the required addressing mode. Using the EAL option permits the mode to be explicitly configured in this scenario. Signed-off-by: eric zhang --- lib/librte_eal/bsdapp/eal/eal.c | 11 +++++++++-- lib/librte_eal/linuxapp/eal/eal.c | 27 +++++++++++++++++---------- 2 files changed, 26 insertions(+), 12 deletions(-) diff --git a/lib/librte_eal/bsdapp/eal/eal.c b/lib/librte_eal/bsdapp/eal/eal.c index 369a682..5392f06 100644 --- a/lib/librte_eal/bsdapp/eal/eal.c +++ b/lib/librte_eal/bsdapp/eal/eal.c @@ -569,8 +569,15 @@ static void rte_eal_init_alert(const char *msg) return -1; } - /* autodetect the iova mapping mode (default is iova_pa) */ - rte_eal_get_configuration()->iova_mode = rte_bus_get_iommu_class(); + /* if no eal option "--iova-mode=", use bus iova scheme */ + if (internal_config.iova_mode == RTE_IOVA_DC) { + /* autodetect the iova mapping mode (default is iova_pa) */ + rte_eal_get_configuration()->iova_mode = + rte_bus_get_iommu_class(); + } else { + rte_eal_get_configuration()->iova_mode = + internal_config.iova_mode; + } if (internal_config.no_hugetlbfs == 0 && internal_config.process_type != RTE_PROC_SECONDARY && diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c index e0b5ae1..1af9458 100644 --- a/lib/librte_eal/linuxapp/eal/eal.c +++ b/lib/librte_eal/linuxapp/eal/eal.c @@ -805,16 +805,23 @@ static void rte_eal_init_alert(const char *msg) return -1; } - /* autodetect the iova mapping mode (default is iova_pa) */ - rte_eal_get_configuration()->iova_mode = rte_bus_get_iommu_class(); - - /* Workaround for KNI which requires physical address to work */ - if (rte_eal_get_configuration()->iova_mode == RTE_IOVA_VA && - rte_eal_check_module("rte_kni") == 1) { - rte_eal_get_configuration()->iova_mode = RTE_IOVA_PA; - RTE_LOG(WARNING, EAL, - "Some devices want IOVA as VA but PA will be used because.. " - "KNI module inserted\n"); + /* if no eal option "--iova-mode=", use bus iova scheme */ + if (internal_config.iova_mode == RTE_IOVA_DC) { + /* autodetect the iova mapping mode (default is iova_pa) */ + rte_eal_get_configuration()->iova_mode = + rte_bus_get_iommu_class(); + + /* Workaround for KNI which requires physical address to work */ + if (rte_eal_get_configuration()->iova_mode == RTE_IOVA_VA && + rte_eal_check_module("rte_kni") == 1) { + rte_eal_get_configuration()->iova_mode = RTE_IOVA_PA; + RTE_LOG(WARNING, EAL, + "Some devices want IOVA as VA but PA will be used because.. " + "KNI module inserted\n"); + } + } else { + rte_eal_get_configuration()->iova_mode = + internal_config.iova_mode; } if (internal_config.no_hugetlbfs == 0 && -- 1.8.3.1