From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id A2441A034C; Tue, 30 Aug 2022 10:32:43 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4EDB940F18; Tue, 30 Aug 2022 10:32:43 +0200 (CEST) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by mails.dpdk.org (Postfix) with ESMTP id 05EDA40F17 for ; Tue, 30 Aug 2022 10:32:41 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1661848362; x=1693384362; h=date:from:to:cc:subject:message-id:references: content-transfer-encoding:in-reply-to:mime-version; bh=KzCbl27SIcjix9Xv9qVY/3VXzSdT09xpbNJgCRDOw0U=; b=F0P/+acynXY3Y8FuU44ddS4r6RGoCejSy2nyODL96US34SyWMHuSkiZB 6NoP3SuAISPvUIlEG9oj1UXW5znzcDkyxoyCk6gpiSTf+DQiQpJ6MfAKU 4JFdtKpqFvPP0KtjQ6RsFL1LWVl7s/maOsEIIIDB8CVijPA6BrIc45QLe NtOJkdYtELZvB6WEA0H34U6Cj2MyFWKGWHNigRj8mtfGepxuERnrdzbFd 8fQgfPVAU+XNVb1tRmXKwhLEApZ45RhceP62yKbCZhDuxynDHUrXwrGQa OwDDBWuUasTGRox5klxQ7QjB9942enhr45SlTyCAdHk+Dwxrvdh5l5bSo Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10454"; a="275518978" X-IronPort-AV: E=Sophos;i="5.93,274,1654585200"; d="scan'208";a="275518978" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Aug 2022 01:32:40 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,274,1654585200"; d="scan'208";a="641282787" Received: from orsmsx602.amr.corp.intel.com ([10.22.229.15]) by orsmga008.jf.intel.com with ESMTP; 30 Aug 2022 01:32:40 -0700 Received: from orsmsx612.amr.corp.intel.com (10.22.229.25) by ORSMSX602.amr.corp.intel.com (10.22.229.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Tue, 30 Aug 2022 01:32:39 -0700 Received: from orsmsx608.amr.corp.intel.com (10.22.229.21) by ORSMSX612.amr.corp.intel.com (10.22.229.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Tue, 30 Aug 2022 01:32:38 -0700 Received: from ORSEDG601.ED.cps.intel.com (10.7.248.6) by orsmsx608.amr.corp.intel.com (10.22.229.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31 via Frontend Transport; Tue, 30 Aug 2022 01:32:38 -0700 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (104.47.58.168) by edgegateway.intel.com (134.134.137.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2375.31; Tue, 30 Aug 2022 01:32:38 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XmDN+GaOAPXD3IHZXrlLqZYRTzK8xQ+syeRZByvYc7x01wAFeUgQc4TnSiiXeAGOurGath0HCKqPpAlBESQUC6KgCrgRAT6Xhyc+pT1ejUYVq57Uy2akYaaC2QW8evQNMY36xaZkyNLsUADxwTAXpnnneTsdAcTdyi+TDi99wohirLv8JYEgcU2VSMywTBk6Blvvikb1NN5ksKcMGYRmI7RxTTUaLaLzq+RcGG3N76RWLOzXvEJBi/wcoM3MVrxk5Qv/T2W8g7xCpn+RiSh2NeojsThMOc1zIDcYIlQBZMPmUUQaQFGVrIOKHXxIwLVMH5jg3rnq9PLHNDjnlDbz5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ohfHTeAoj9Pd2nZ9XQsenYP1OsuRuWEuDExTIOssu4g=; b=dg+qwDsTF4P/H01Ri/cQCTgBLHi+bfs7vY/zPQrWL2WaOHRBciVibjj8jF+plRYba7r+/wmTLXC8zWISVQHGjzNIvpCuF6bq6k5CumG5iK2NWPEbdtywHCchswg40HvbWGOeiF4JfpC/FubguDgmXISuybVt89wNWbIJJ1OEXw7Kmsz8jYA30Lb28qRVoojRjEyFPuBLmoVedVIiELkx8LBGVQ1/FzqNaaJN4AesadVEBCi9R8UFiSsNRnCDbf2xmTejy2JqZ8CtNFC5KGxYyNFzFouE+HwuSxLh7BGWmJaJxl3jRdzyCC47lkTtTe5H5YXPXoKAh0syM/b2tSKH8g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from MWHPR11MB1629.namprd11.prod.outlook.com (2603:10b6:301:d::21) by SN6PR11MB3119.namprd11.prod.outlook.com (2603:10b6:805:cc::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5566.21; Tue, 30 Aug 2022 08:32:36 +0000 Received: from MWHPR11MB1629.namprd11.prod.outlook.com ([fe80::13c:8120:d994:16d2]) by MWHPR11MB1629.namprd11.prod.outlook.com ([fe80::13c:8120:d994:16d2%6]) with mapi id 15.20.5566.021; Tue, 30 Aug 2022 08:32:36 +0000 Date: Tue, 30 Aug 2022 09:32:28 +0100 From: Bruce Richardson To: Morten =?iso-8859-1?Q?Br=F8rup?= CC: Shijith Thotton , , , , , , , , Nicolas Chautru , "Ciara Power" , Konstantin Ananyev , Chengwen Feng , Kevin Laatz , Reshma Pattan , Maxime Coquelin , Chenbo Xia Subject: Re: [PATCH v1 1/4] build: add meson option to configure IOVA mode as VA Message-ID: References: <20220829151626.2101336-2-sthotton@marvell.com> <98CBD80474FA8B44BF855DF32C47DC35D872D0@smartserver.smartshare.dk> Content-Type: text/plain; charset="iso-8859-1" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <98CBD80474FA8B44BF855DF32C47DC35D872D0@smartserver.smartshare.dk> X-ClientProxiedBy: DB6P193CA0021.EURP193.PROD.OUTLOOK.COM (2603:10a6:6:29::31) To MWHPR11MB1629.namprd11.prod.outlook.com (2603:10b6:301:d::21) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0f7aa154-7477-4e8d-3ae6-08da8a6230f2 X-MS-TrafficTypeDiagnostic: SN6PR11MB3119:EE_ X-LD-Processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: M16yUHCn9DLDfNkFnZ76hKtmZvA08IQJ5eLwopSAdHqtk4PR6SMoAsx1TGAyM0isR1WcnLoqJyVMHKfElwDlhncERDYZjr/jM2P/RaPbp2kPp8P3H1+vk3keWpl/HJqoSk8rtxP+qyN6EvW/V+YPCu2g0lUZvlc01NlyG5GCkCGQg0aqOG7JXizzIe5Iv18IJ9RDL2pzpq92Fugmz6XklLHPTBngVlqNz3jGFpeVVYuUw9HTNr6ZeODXHoxcFrfJclz6DVrTO+u0feLqKIrDwFGhxqc+9G0RZEp5d1N3L8FYisygKjGVgY+tfuA1GZciUShw8dKeRXNKPZTebcehw/t7uwj4WGVdF9CjOfQ/4LbvKBQbn8GOtKXzVGjSvg3FuGTCwmAeYAZfrifm4tr4yBQnp2/n/9R29bhop+Y9hw51DhABSxOYsthWT3HL9iRuz862Byankpqgci6nKZEtHG8vrj/we+lngHQHMKXCY3sxsMcBv4PD397RKPWb4jEizQ3RnO/ec7G6g0gJj2djgECHiiTg7XQB7VK8siCy1sFynoeM8ylJE+iZvBC1e0c8Gj0kxo08V7JZR88GSPI2bJtEjwkl3S1VNyUjJ41dl/V7dqZbj0FVoIn9j8076c6DHTvzUXUo1KtQNChgNNXuENQqXNb8h53KBgbfu+g6XXx5cGcJ0gJ42EwoCRGRBCfYxPRjop7ljyadJ377Fqw4nA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MWHPR11MB1629.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230016)(346002)(366004)(396003)(136003)(376002)(39860400002)(478600001)(54906003)(8936002)(6512007)(41300700001)(86362001)(6486002)(6916009)(316002)(7416002)(5660300002)(82960400001)(26005)(107886003)(66476007)(8676002)(66946007)(4326008)(6666004)(6506007)(66556008)(186003)(83380400001)(2906002)(66574015)(38100700002)(44832011); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?iso-8859-1?Q?JG+EcTTZDVD4NBBJ/pJWx8uOfL4WIAGKjoc/yhSs0z264uJZhHfDmjK4Af?= =?iso-8859-1?Q?afEHLZ50KCj4RaSVQ1idVH6difLEbjt4LWgQVWHmb3q8BYYul310uI/fn5?= =?iso-8859-1?Q?zD0jW55Zy/XuatteSGCiKbrD0aQj07NQvKB4Tf/BRWg61ZXysKNtjew9y9?= =?iso-8859-1?Q?TOOQAuUYQDaPQXBWQQHjcTNna3TnWdSdpTssQlyE3gkKJML7jtwVupW/Yy?= =?iso-8859-1?Q?pWgVEIL6gYyYWriSqpY6XKKnnW8KmAKOsV5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zacfuvAlwN0wWI0bBVd8tnmSmXXAkoh02cjKb2/uQw9aHFS9?= =?iso-8859-1?Q?pwY4T3AyvMTJguKSDBt/6nw8wIal8hhCr/r73ht7Vtbhq1X2o57mI6uRmp?= =?iso-8859-1?Q?CbLQi5sMvOX6jLkisUipKn+DOFzc/pEZyhBxp+sUTbP41qU9qPTADQa9bO?= =?iso-8859-1?Q?6vP5T8g4KKvORLEk01VuA/bAuNKdBxPlpPZQlg7gBS00PmvuVF4C9co4K8?= =?iso-8859-1?Q?CNvF1kHNB7/CvdBLL0w+Z7HRfgeSgudNUcgIcWDPc2NmlnPlg5SfuY3GlE?= =?iso-8859-1?Q?zMlm1ulqPa5NjJizAyiv65vMdh1GZwG0GmQohaWqISl5VnDMsc7jJ2SL9b?= =?iso-8859-1?Q?2cUFmf/76zSqRDk5EfVC12VAe8cxDk8pgFn5zX6vCUbVfBI7jiwpa0jCy1?= =?iso-8859-1?Q?caHRI/EQejv+vooSqU6LYkvIddg7b99MQA7By8lIJJ07GfQeMlNA8LUwFQ?= =?iso-8859-1?Q?svxvw8fnNi7GGhRptzlOPinR/KWI1mZevk1yQu99nryBgYBtLMdsO5wA?= =?iso-8859-1?Q?=3D=3D?= X-MS-Exchange-CrossTenant-Network-Message-Id: 0f7aa154-7477-4e8d-3ae6-08da8a6230f2 X-MS-Exchange-CrossTenant-AuthSource: MWHPR11MB1629.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Aug 2022 08:32:36.1924 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: o8Mi6ozCELK+bY6WuJJQHBST77zu5+k/Jzz8oOst/fKfa3n0WDAbjUhXhbMeiyJnisURD75B79QbWIGX4R52liWDkN646xYLW2kVsj8Grn8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR11MB3119 X-OriginatorOrg: intel.com X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On Mon, Aug 29, 2022 at 08:18:56PM +0200, Morten Brørup wrote: > > From: Shijith Thotton [mailto:sthotton@marvell.com] > > Sent: Monday, 29 August 2022 17.16 > > > > IOVA mode in DPDK is either PA or VA. The new build option iova_as_va > > configures the mode to VA at compile time and prevents setting it to PA > > at runtime. For now, all drivers which are not always enabled are > > disabled with this option. Supported driver can set the flag > > pmd_iova_as_va in its build file to enable build. > > > > mbuf structure holds the physical (PA) and virtual address (VA) of a > > buffer. if IOVA mode is set to VA, PA is redundant as it is the same as > > VA. So PA field need not be updated and marked invalid if the build is > > configured to use only VA. > > > > Signed-off-by: Shijith Thotton > > --- > > [...] > > > diff --git a/app/test/test_mbuf.c b/app/test/test_mbuf.c > > index e09b2549ca..992b8c64ab 100644 > > --- a/app/test/test_mbuf.c > > +++ b/app/test/test_mbuf.c > > @@ -1232,11 +1232,13 @@ test_failing_mbuf_sanity_check(struct > > rte_mempool *pktmbuf_pool) > > return -1; > > } > > > > - badbuf = *buf; > > - badbuf.buf_iova = 0; > > - if (verify_mbuf_check_panics(&badbuf)) { > > - printf("Error with bad-physaddr mbuf test\n"); > > - return -1; > > + if (!rte_is_iova_as_va_build()) { > > + badbuf = *buf; > > + rte_mbuf_iova_set(&badbuf, 0); > > + if (verify_mbuf_check_panics(&badbuf)) { > > + printf("Error with bad-physaddr mbuf test\n"); > > + return -1; > > + } > > } > > > > badbuf = *buf; > > diff --git a/config/meson.build b/config/meson.build > > index 7f7b6c92fd..1ff1cd774b 100644 > > --- a/config/meson.build > > +++ b/config/meson.build > > @@ -309,6 +309,9 @@ endif > > if get_option('mbuf_refcnt_atomic') > > dpdk_conf.set('RTE_MBUF_REFCNT_ATOMIC', true) > > endif > > +if get_option('iova_as_va') > > + dpdk_conf.set('RTE_IOVA_AS_VA', true) > > +endif > > > > compile_time_cpuflags = [] > > subdir(arch_subdir) > > diff --git a/drivers/meson.build b/drivers/meson.build > > index b22c2adda7..469e60f1fa 100644 > > --- a/drivers/meson.build > > +++ b/drivers/meson.build > > @@ -103,6 +103,7 @@ foreach subpath:subdirs > > ext_deps = [] > > pkgconfig_extra_libs = [] > > testpmd_sources = [] > > + pmd_iova_as_va = false > > > > if not enable_drivers.contains(drv_path) > > build = false > > @@ -120,6 +121,11 @@ foreach subpath:subdirs > > # pull in driver directory which should update all the > > local variables > > subdir(drv_path) > > > > + if dpdk_conf.has('RTE_IOVA_AS_VA') and not pmd_iova_as_va > > and not always_enable.contains(drv_path) > > + build = false > > + reason = 'driver does not support IOVA as VA mode' > > + endif > > + > > # get dependency objs from strings > > shared_deps = ext_deps > > static_deps = ext_deps > > diff --git a/lib/eal/include/rte_common.h > > b/lib/eal/include/rte_common.h > > index a96cc2a138..0010ad7c7d 100644 > > --- a/lib/eal/include/rte_common.h > > +++ b/lib/eal/include/rte_common.h > > @@ -921,6 +921,23 @@ __rte_noreturn void > > rte_exit(int exit_code, const char *format, ...) > > __rte_format_printf(2, 3); > > > > +/** > > + * Check if build is configured to use IOVA as VA. > > + * > > + * @return > > + * 1 if true, 0 otherwise > > + * > > + */ > > +static inline int > > +rte_is_iova_as_va_build(void) > > +{ > > +#ifdef RTE_IOVA_AS_VA > > + return 1; > > +#else > > + return 0; > > +#endif > > +} > > The rte_is_iova_as_va_build() function is effectively a shadow of the RTE_IOVA_AS_VA definition. Why the need to camouflage RTE_IOVA_AS_VA through a function, instead of just using RTE_IOVA_AS_VA everywhere? > My reading is that it's not quite equivalent, and in the undef case it can't be directly used in C code. You can't do "if (RTE_IOVA_AS_VA)", for example. However, rather than adding a function, in meson you could also add "dpdk_conf.set10(RTE_IOVA....)" to define a second macro that is 0 in the undef case, and which therefore could be used in C conditionals. /Bruce