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 4C6F3A0555; Wed, 19 Feb 2020 02:10:49 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id F334B1C0BF; Wed, 19 Feb 2020 02:10:28 +0100 (CET) Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by dpdk.org (Postfix) with ESMTP id F1F731C030 for ; Wed, 19 Feb 2020 02:10:23 +0100 (CET) Received: from pps.filterd (m0098420.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 01J1AJat070612; Tue, 18 Feb 2020 20:10:21 -0500 Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com with ESMTP id 2y8qhnwey7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 18 Feb 2020 20:10:20 -0500 Received: from m0098420.ppops.net (m0098420.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 01J1AJ6M070631; Tue, 18 Feb 2020 20:10:19 -0500 Received: from ppma03dal.us.ibm.com (b.bd.3ea9.ip4.static.sl-reverse.com [169.62.189.11]) by mx0b-001b2d01.pphosted.com with ESMTP id 2y8qhnwexg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 18 Feb 2020 20:10:19 -0500 Received: from pps.filterd (ppma03dal.us.ibm.com [127.0.0.1]) by ppma03dal.us.ibm.com (8.16.0.27/8.16.0.27) with SMTP id 01J19p2H001744; Wed, 19 Feb 2020 01:10:17 GMT Received: from b03cxnp08026.gho.boulder.ibm.com (b03cxnp08026.gho.boulder.ibm.com [9.17.130.18]) by ppma03dal.us.ibm.com with ESMTP id 2y6896xcks-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 19 Feb 2020 01:10:16 +0000 Received: from b03ledav001.gho.boulder.ibm.com (b03ledav001.gho.boulder.ibm.com [9.17.130.232]) by b03cxnp08026.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 01J1AFtX48300538 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 19 Feb 2020 01:10:15 GMT Received: from b03ledav001.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6B36A6E05B; Wed, 19 Feb 2020 01:10:15 +0000 (GMT) Received: from b03ledav001.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id EA2676E053; Wed, 19 Feb 2020 01:10:14 +0000 (GMT) Received: from oc8377887825.ibm.com (unknown [9.70.82.120]) by b03ledav001.gho.boulder.ibm.com (Postfix) with ESMTP; Wed, 19 Feb 2020 01:10:14 +0000 (GMT) From: David Wilder To: aconole@redhat.com, maicolgabriel@hotmail.com, thomas@monjalon.net, ferruh.yigit@intel.com, arybchenko@solarflare.com Cc: dev@dpdk.org, ruifeng.wang@arm.com, david.marchand@redhat.com, drc@linux.vnet.ibm.com, wilder@us.ibm.com Date: Tue, 18 Feb 2020 17:10:05 -0800 Message-Id: <20200219011007.8611-2-dwilder@us.ibm.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200219011007.8611-1-dwilder@us.ibm.com> References: <20200219011007.8611-1-dwilder@us.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138, 18.0.572 definitions=2020-02-18_08:2020-02-18, 2020-02-18 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 mlxscore=0 bulkscore=0 impostorscore=0 mlxlogscore=999 suspectscore=0 priorityscore=1501 adultscore=0 spamscore=0 lowpriorityscore=0 phishscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2001150001 definitions=main-2002190004 Subject: [dpdk-dev] [PATCH v2 1/3] eal/linux: select iova-mode va with no-huge option 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" If --no-huge is set and iova-mode has not been specified force VA mode. If --no-huge and --iova-mode=PA is requested error out as this is an impossible configuration. Signed-off-by: David Wilder --- lib/librte_eal/linux/eal/eal.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/lib/librte_eal/linux/eal/eal.c b/lib/librte_eal/linux/eal/eal.c index 9530ee55f..d3a0a1731 100644 --- a/lib/librte_eal/linux/eal/eal.c +++ b/lib/librte_eal/linux/eal/eal.c @@ -1062,9 +1062,16 @@ rte_eal_init(int argc, char **argv) /* if no EAL option "--iova-mode=", use bus IOVA scheme */ if (internal_config.iova_mode == RTE_IOVA_DC) { + /* autodetect the IOVA mapping mode */ enum rte_iova_mode iova_mode = rte_bus_get_iommu_class(); + if (iova_mode == RTE_IOVA_PA && !rte_eal_has_hugepages()) { + iova_mode = RTE_IOVA_VA; + RTE_LOG(WARNING, EAL, "Some buses want 'PA' but forcing 'VA' because --no-huge is requested.\n"); + RTE_LOG(WARNING, EAL, "Not all buses may be able to initialize.\n"); + } + if (iova_mode == RTE_IOVA_DC) { RTE_LOG(DEBUG, EAL, "Buses did not request a specific IOVA mode.\n"); @@ -1111,6 +1118,13 @@ rte_eal_init(int argc, char **argv) internal_config.iova_mode; } + if (rte_eal_iova_mode() == RTE_IOVA_PA && + rte_eal_has_hugepages() == 0) { + rte_eal_init_alert("Cannot use IOVA as 'PA' with --no-huge"); + rte_errno = EINVAL; + return -1; + } + if (rte_eal_iova_mode() == RTE_IOVA_PA && !phys_addrs) { rte_eal_init_alert("Cannot use IOVA as 'PA' since physical addresses are not available"); rte_errno = EINVAL; -- 2.25.0