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 D4B56A0542; Mon, 29 Aug 2022 20:18:59 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7BCC74069D; Mon, 29 Aug 2022 20:18:59 +0200 (CEST) Received: from smartserver.smartsharesystems.com (smartserver.smartsharesystems.com [77.243.40.215]) by mails.dpdk.org (Postfix) with ESMTP id AA9AE4003C for ; Mon, 29 Aug 2022 20:18:58 +0200 (CEST) Content-class: urn:content-classes:message Subject: RE: [PATCH v1 1/4] build: add meson option to configure IOVA mode as VA MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Date: Mon, 29 Aug 2022 20:18:56 +0200 X-MimeOLE: Produced By Microsoft Exchange V6.5 Message-ID: <98CBD80474FA8B44BF855DF32C47DC35D872D0@smartserver.smartshare.dk> In-Reply-To: <20220829151626.2101336-2-sthotton@marvell.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PATCH v1 1/4] build: add meson option to configure IOVA mode as VA Thread-Index: Adi7unrkEuOaADu8S5CyQWrY6KI/nQAF4R6w References: <20220829151626.2101336-2-sthotton@marvell.com> From: =?iso-8859-1?Q?Morten_Br=F8rup?= To: "Shijith Thotton" , Cc: , , , , , , , "Nicolas Chautru" , "Ciara Power" , "Konstantin Ananyev" , "Chengwen Feng" , "Kevin Laatz" , "Reshma Pattan" , "Maxime Coquelin" , "Chenbo Xia" 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 > From: Shijith Thotton [mailto:sthotton@marvell.com] > Sent: Monday, 29 August 2022 17.16 >=20 > 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. >=20 > 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. >=20 > 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; > } >=20 > - badbuf =3D *buf; > - badbuf.buf_iova =3D 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 =3D *buf; > + rte_mbuf_iova_set(&badbuf, 0); > + if (verify_mbuf_check_panics(&badbuf)) { > + printf("Error with bad-physaddr mbuf test\n"); > + return -1; > + } > } >=20 > badbuf =3D *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 >=20 > compile_time_cpuflags =3D [] > 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 =3D [] > pkgconfig_extra_libs =3D [] > testpmd_sources =3D [] > + pmd_iova_as_va =3D false >=20 > if not enable_drivers.contains(drv_path) > build =3D false > @@ -120,6 +121,11 @@ foreach subpath:subdirs > # pull in driver directory which should update all the > local variables > subdir(drv_path) >=20 > + if dpdk_conf.has('RTE_IOVA_AS_VA') and not pmd_iova_as_va > and not always_enable.contains(drv_path) > + build =3D false > + reason =3D 'driver does not support IOVA as VA mode' > + endif > + > # get dependency objs from strings > shared_deps =3D ext_deps > static_deps =3D 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); >=20 > +/** > + * 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?