get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/116049/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 116049,
    "url": "https://patches.dpdk.org/api/patches/116049/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/20220907134340.3629224-2-sthotton@marvell.com/",
    "project": {
        "id": 1,
        "url": "https://patches.dpdk.org/api/projects/1/?format=api",
        "name": "DPDK",
        "link_name": "dpdk",
        "list_id": "dev.dpdk.org",
        "list_email": "dev@dpdk.org",
        "web_url": "http://core.dpdk.org",
        "scm_url": "git://dpdk.org/dpdk",
        "webscm_url": "http://git.dpdk.org/dpdk",
        "list_archive_url": "https://inbox.dpdk.org/dev",
        "list_archive_url_format": "https://inbox.dpdk.org/dev/{}",
        "commit_url_format": ""
    },
    "msgid": "<20220907134340.3629224-2-sthotton@marvell.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20220907134340.3629224-2-sthotton@marvell.com",
    "date": "2022-09-07T13:43:36",
    "name": "[v2,1/5] build: add meson option to configure IOVA mode as VA",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "6b716dcf87ce3531d019cc498d887a46ae3066c9",
    "submitter": {
        "id": 2049,
        "url": "https://patches.dpdk.org/api/people/2049/?format=api",
        "name": "Shijith Thotton",
        "email": "sthotton@marvell.com"
    },
    "delegate": null,
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/20220907134340.3629224-2-sthotton@marvell.com/mbox/",
    "series": [
        {
            "id": 24595,
            "url": "https://patches.dpdk.org/api/series/24595/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=24595",
            "date": "2022-09-07T13:43:36",
            "name": "[v2,1/5] build: add meson option to configure IOVA mode as VA",
            "version": 2,
            "mbox": "https://patches.dpdk.org/series/24595/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/116049/comments/",
    "check": "fail",
    "checks": "https://patches.dpdk.org/api/patches/116049/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@inbox.dpdk.org",
        "Delivered-To": "patchwork@inbox.dpdk.org",
        "Received": [
            "from mails.dpdk.org (mails.dpdk.org [217.70.189.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id A3E29A054F;\n\tWed,  7 Sep 2022 15:44:30 +0200 (CEST)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 25DBD4280D;\n\tWed,  7 Sep 2022 15:44:26 +0200 (CEST)",
            "from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com\n [67.231.148.174])\n by mails.dpdk.org (Postfix) with ESMTP id 5406F427F9\n for <dev@dpdk.org>; Wed,  7 Sep 2022 15:44:24 +0200 (CEST)",
            "from pps.filterd (m0045849.ppops.net [127.0.0.1])\n by mx0a-0016f401.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id\n 2875Zwql029959;\n Wed, 7 Sep 2022 06:44:13 -0700",
            "from dc5-exch02.marvell.com ([199.233.59.182])\n by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3jen9wsnkq-1\n (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT);\n Wed, 07 Sep 2022 06:44:13 -0700",
            "from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH02.marvell.com\n (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.18;\n Wed, 7 Sep 2022 06:44:11 -0700",
            "from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com\n (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.2 via Frontend\n Transport; Wed, 7 Sep 2022 06:44:11 -0700",
            "from localhost.localdomain (unknown [10.28.34.29])\n by maili.marvell.com (Postfix) with ESMTP id 04EFA3F7080;\n Wed,  7 Sep 2022 06:44:06 -0700 (PDT)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com;\n h=from : to : cc :\n subject : date : message-id : in-reply-to : references : mime-version :\n content-transfer-encoding : content-type; s=pfpt0220;\n bh=O9x79y28aQDE6iAkZjFncbHj7ikOSFkRmyPAlEwy/9I=;\n b=XTSxK4I3kuTMqYwAgcHD1lD+qcqeTTUg8dis7aeCOPqY6KHCvXMpDnpaaKQhRbwZv9XY\n spKS1bdw+FTAex/bDAihnphhgxQNpqkgKVSQZzythR2TMkQ5FVYgh70XvuuDkR6PNQzB\n ddpc0+XrN84DXt5JjzWb5OSPUkZHKRNytNkMU0fZsp6VdnsTz6VRndx9WRO5BhFDmNfb\n lc4YdYH4fDDyFfagxRZPsQ8UhS7c3hkYuYkpYXdIxqrhj5aonltC/0LvdGDuvuB/SltP\n z1W08qowJ44pmish5Ag76ehut1PtfM1o1n434tCcgfhF1/DfEQ2njwNdSYtgbtg5rkYy /A==",
        "From": "Shijith Thotton <sthotton@marvell.com>",
        "To": "<dev@dpdk.org>",
        "CC": "<pbhagavatula@marvell.com>, Shijith Thotton <sthotton@marvell.com>,\n <Honnappa.Nagarahalli@arm.com>, <bruce.richardson@intel.com>,\n <jerinj@marvell.com>, <mb@smartsharesystems.com>,\n <olivier.matz@6wind.com>, <stephen@networkplumber.org>,\n <thomas@monjalon.net>, Nicolas Chautru <nicolas.chautru@intel.com>,\n Ciara Power <ciara.power@intel.com>, \"Konstantin\n Ananyev\" <konstantin.v.ananyev@yandex.ru>, Chengwen Feng\n <fengchengwen@huawei.com>, Kevin Laatz <kevin.laatz@intel.com>,\n Reshma Pattan <reshma.pattan@intel.com>,\n Maxime Coquelin <maxime.coquelin@redhat.com>,\n Chenbo Xia <chenbo.xia@intel.com>",
        "Subject": "[PATCH v2 1/5] build: add meson option to configure IOVA mode as VA",
        "Date": "Wed, 7 Sep 2022 19:13:36 +0530",
        "Message-ID": "<20220907134340.3629224-2-sthotton@marvell.com>",
        "X-Mailer": "git-send-email 2.25.1",
        "In-Reply-To": "<20220829151626.2101336-1-sthotton@marvell.com>",
        "References": "<20220829151626.2101336-1-sthotton@marvell.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Content-Type": "text/plain",
        "X-Proofpoint-ORIG-GUID": "LUq9T4EposErYMjRfg23leAJEBKfmHQA",
        "X-Proofpoint-GUID": "LUq9T4EposErYMjRfg23leAJEBKfmHQA",
        "X-Proofpoint-Virus-Version": "vendor=baseguard\n engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.528,FMLib:17.11.122.1\n definitions=2022-09-07_08,2022-09-07_02,2022-06-22_01",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.29",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n <mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://mails.dpdk.org/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n <mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org"
    },
    "content": "IOVA mode in DPDK is either PA or VA. The new build option iova_as_va\nconfigures the mode to VA at compile time and prevents setting it to PA\nat runtime. For now, all drivers which are not always enabled are\ndisabled with this option. Supported driver can set the flag\npmd_iova_as_va in its build file to enable build.\n\nmbuf structure holds the physical (PA) and virtual address (VA) of a\nbuffer. if IOVA mode is set to VA, PA is redundant as it is the same as\nVA. So PA field need not be updated and marked invalid if the build is\nconfigured to use only VA.\n\nSigned-off-by: Shijith Thotton <sthotton@marvell.com>\n---\n app/test-bbdev/test_bbdev_perf.c         |  2 +-\n app/test-crypto-perf/cperf_test_common.c |  5 +--\n app/test/test_bpf.c                      |  2 +-\n app/test/test_dmadev.c                   | 33 ++++++---------\n app/test/test_mbuf.c                     | 12 +++---\n app/test/test_pcapng.c                   |  2 +-\n config/meson.build                       |  1 +\n drivers/meson.build                      |  6 +++\n lib/eal/linux/eal.c                      |  7 +++\n lib/mbuf/rte_mbuf.c                      |  8 ++--\n lib/mbuf/rte_mbuf.h                      | 17 +++++---\n lib/mbuf/rte_mbuf_core.h                 | 10 +++++\n lib/vhost/vhost.h                        |  2 +-\n lib/vhost/vhost_crypto.c                 | 54 ++++++++++++++++++------\n meson_options.txt                        |  2 +\n 15 files changed, 109 insertions(+), 54 deletions(-)",
    "diff": "diff --git a/app/test-bbdev/test_bbdev_perf.c b/app/test-bbdev/test_bbdev_perf.c\nindex 8fab52d821..f6aa25b67d 100644\n--- a/app/test-bbdev/test_bbdev_perf.c\n+++ b/app/test-bbdev/test_bbdev_perf.c\n@@ -1001,7 +1001,7 @@ init_op_data_objs(struct rte_bbdev_op_data *bufs,\n \t\t\t\t\tseg->length);\n \t\t\t\tmemcpy(data, seg->addr, seg->length);\n \t\t\t\tm_head->buf_addr = data;\n-\t\t\t\tm_head->buf_iova = rte_malloc_virt2iova(data);\n+\t\t\t\trte_mbuf_iova_set(m_head, rte_malloc_virt2iova(data));\n \t\t\t\tm_head->data_off = 0;\n \t\t\t\tm_head->data_len = seg->length;\n \t\t\t} else {\ndiff --git a/app/test-crypto-perf/cperf_test_common.c b/app/test-crypto-perf/cperf_test_common.c\nindex 00aadc9a47..27646cd619 100644\n--- a/app/test-crypto-perf/cperf_test_common.c\n+++ b/app/test-crypto-perf/cperf_test_common.c\n@@ -26,8 +26,7 @@ fill_single_seg_mbuf(struct rte_mbuf *m, struct rte_mempool *mp,\n \t/* start of buffer is after mbuf structure and priv data */\n \tm->priv_size = 0;\n \tm->buf_addr = (char *)m + mbuf_hdr_size;\n-\tm->buf_iova = rte_mempool_virt2iova(obj) +\n-\t\tmbuf_offset + mbuf_hdr_size;\n+\trte_mbuf_iova_set(m, rte_mempool_virt2iova(obj) + mbuf_offset + mbuf_hdr_size);\n \tm->buf_len = segment_sz;\n \tm->data_len = data_len;\n \tm->pkt_len = data_len;\n@@ -58,7 +57,7 @@ fill_multi_seg_mbuf(struct rte_mbuf *m, struct rte_mempool *mp,\n \t\t/* start of buffer is after mbuf structure and priv data */\n \t\tm->priv_size = 0;\n \t\tm->buf_addr = (char *)m + mbuf_hdr_size;\n-\t\tm->buf_iova = next_seg_phys_addr;\n+\t\trte_mbuf_iova_set(m, next_seg_phys_addr);\n \t\tnext_seg_phys_addr += mbuf_hdr_size + segment_sz;\n \t\tm->buf_len = segment_sz;\n \t\tm->data_len = data_len;\ndiff --git a/app/test/test_bpf.c b/app/test/test_bpf.c\nindex 97f500809e..f5af5e8a3f 100644\n--- a/app/test/test_bpf.c\n+++ b/app/test/test_bpf.c\n@@ -2600,7 +2600,7 @@ dummy_mbuf_prep(struct rte_mbuf *mb, uint8_t buf[], uint32_t buf_len,\n \tuint8_t *db;\n \n \tmb->buf_addr = buf;\n-\tmb->buf_iova = (uintptr_t)buf;\n+\trte_mbuf_iova_set(mb, (uintptr_t)buf);\n \tmb->buf_len = buf_len;\n \trte_mbuf_refcnt_set(mb, 1);\n \ndiff --git a/app/test/test_dmadev.c b/app/test/test_dmadev.c\nindex 9e8e101f40..8306947eda 100644\n--- a/app/test/test_dmadev.c\n+++ b/app/test/test_dmadev.c\n@@ -110,8 +110,8 @@ do_multi_copies(int16_t dev_id, uint16_t vchan,\n \t\tfor (j = 0; j < COPY_LEN/sizeof(uint64_t); j++)\n \t\t\tsrc_data[j] = rte_rand();\n \n-\t\tif (rte_dma_copy(dev_id, vchan, srcs[i]->buf_iova + srcs[i]->data_off,\n-\t\t\t\tdsts[i]->buf_iova + dsts[i]->data_off, COPY_LEN, 0) != id_count++)\n+\t\tif (rte_dma_copy(dev_id, vchan, rte_pktmbuf_iova_offset(srcs[i], 0),\n+\t\t\t\t rte_pktmbuf_iova_offset(dsts[i], 0), COPY_LEN, 0) != id_count++)\n \t\t\tERR_RETURN(\"Error with rte_dma_copy for buffer %u\\n\", i);\n \t}\n \trte_dma_submit(dev_id, vchan);\n@@ -317,9 +317,8 @@ test_failure_in_full_burst(int16_t dev_id, uint16_t vchan, bool fence,\n \trte_dma_stats_get(dev_id, vchan, &baseline); /* get a baseline set of stats */\n \tfor (i = 0; i < COMP_BURST_SZ; i++) {\n \t\tint id = rte_dma_copy(dev_id, vchan,\n-\t\t\t\t(i == fail_idx ? 0 : (srcs[i]->buf_iova + srcs[i]->data_off)),\n-\t\t\t\tdsts[i]->buf_iova + dsts[i]->data_off,\n-\t\t\t\tCOPY_LEN, OPT_FENCE(i));\n+\t\t\t\t      (i == fail_idx ? 0 : rte_pktmbuf_iova_offset(srcs[i], 0)),\n+\t\t\t\t      rte_pktmbuf_iova_offset(dsts[i], 0), COPY_LEN, OPT_FENCE(i));\n \t\tif (id < 0)\n \t\t\tERR_RETURN(\"Error with rte_dma_copy for buffer %u\\n\", i);\n \t\tif (i == fail_idx)\n@@ -407,9 +406,8 @@ test_individual_status_query_with_failure(int16_t dev_id, uint16_t vchan, bool f\n \n \tfor (j = 0; j < COMP_BURST_SZ; j++) {\n \t\tint id = rte_dma_copy(dev_id, vchan,\n-\t\t\t\t(j == fail_idx ? 0 : (srcs[j]->buf_iova + srcs[j]->data_off)),\n-\t\t\t\tdsts[j]->buf_iova + dsts[j]->data_off,\n-\t\t\t\tCOPY_LEN, OPT_FENCE(j));\n+\t\t\t\t      (j == fail_idx ? 0 : rte_pktmbuf_iova_offset(srcs[j], 0)),\n+\t\t\t\t      rte_pktmbuf_iova_offset(dsts[j], 0), COPY_LEN, OPT_FENCE(j));\n \t\tif (id < 0)\n \t\t\tERR_RETURN(\"Error with rte_dma_copy for buffer %u\\n\", j);\n \t\tif (j == fail_idx)\n@@ -470,9 +468,8 @@ test_single_item_status_query_with_failure(int16_t dev_id, uint16_t vchan,\n \n \tfor (j = 0; j < COMP_BURST_SZ; j++) {\n \t\tint id = rte_dma_copy(dev_id, vchan,\n-\t\t\t\t(j == fail_idx ? 0 : (srcs[j]->buf_iova + srcs[j]->data_off)),\n-\t\t\t\tdsts[j]->buf_iova + dsts[j]->data_off,\n-\t\t\t\tCOPY_LEN, 0);\n+\t\t\t\t      (j == fail_idx ? 0 : rte_pktmbuf_iova_offset(srcs[j], 0)),\n+\t\t\t\t      rte_pktmbuf_iova_offset(dsts[j], 0), COPY_LEN, 0);\n \t\tif (id < 0)\n \t\t\tERR_RETURN(\"Error with rte_dma_copy for buffer %u\\n\", j);\n \t\tif (j == fail_idx)\n@@ -529,15 +526,14 @@ test_multi_failure(int16_t dev_id, uint16_t vchan, struct rte_mbuf **srcs, struc\n \n \t/* enqueue and gather completions in one go */\n \tfor (j = 0; j < COMP_BURST_SZ; j++) {\n-\t\tuintptr_t src = srcs[j]->buf_iova + srcs[j]->data_off;\n+\t\tuintptr_t src = rte_pktmbuf_iova_offset(srcs[j], 0);\n \t\t/* set up for failure if the current index is anywhere is the fails array */\n \t\tfor (i = 0; i < num_fail; i++)\n \t\t\tif (j == fail[i])\n \t\t\t\tsrc = 0;\n \n-\t\tint id = rte_dma_copy(dev_id, vchan,\n-\t\t\t\tsrc, dsts[j]->buf_iova + dsts[j]->data_off,\n-\t\t\t\tCOPY_LEN, 0);\n+\t\tint id = rte_dma_copy(dev_id, vchan, src, rte_pktmbuf_iova_offset(dsts[j], 0),\n+\t\t\t\t      COPY_LEN, 0);\n \t\tif (id < 0)\n \t\t\tERR_RETURN(\"Error with rte_dma_copy for buffer %u\\n\", j);\n \t}\n@@ -565,15 +561,14 @@ test_multi_failure(int16_t dev_id, uint16_t vchan, struct rte_mbuf **srcs, struc\n \n \t/* enqueue and gather completions in bursts, but getting errors one at a time */\n \tfor (j = 0; j < COMP_BURST_SZ; j++) {\n-\t\tuintptr_t src = srcs[j]->buf_iova + srcs[j]->data_off;\n+\t\tuintptr_t src = rte_pktmbuf_iova_offset(srcs[j], 0);\n \t\t/* set up for failure if the current index is anywhere is the fails array */\n \t\tfor (i = 0; i < num_fail; i++)\n \t\t\tif (j == fail[i])\n \t\t\t\tsrc = 0;\n \n-\t\tint id = rte_dma_copy(dev_id, vchan,\n-\t\t\t\tsrc, dsts[j]->buf_iova + dsts[j]->data_off,\n-\t\t\t\tCOPY_LEN, 0);\n+\t\tint id = rte_dma_copy(dev_id, vchan, src, rte_pktmbuf_iova_offset(dsts[j], 0),\n+\t\t\t\t      COPY_LEN, 0);\n \t\tif (id < 0)\n \t\t\tERR_RETURN(\"Error with rte_dma_copy for buffer %u\\n\", j);\n \t}\ndiff --git a/app/test/test_mbuf.c b/app/test/test_mbuf.c\nindex e09b2549ca..45431f2c9c 100644\n--- a/app/test/test_mbuf.c\n+++ b/app/test/test_mbuf.c\n@@ -1232,11 +1232,13 @@ test_failing_mbuf_sanity_check(struct rte_mempool *pktmbuf_pool)\n \t\treturn -1;\n \t}\n \n-\tbadbuf = *buf;\n-\tbadbuf.buf_iova = 0;\n-\tif (verify_mbuf_check_panics(&badbuf)) {\n-\t\tprintf(\"Error with bad-physaddr mbuf test\\n\");\n-\t\treturn -1;\n+\tif (!RTE_IOVA_AS_VA) {\n+\t\tbadbuf = *buf;\n+\t\trte_mbuf_iova_set(&badbuf, 0);\n+\t\tif (verify_mbuf_check_panics(&badbuf)) {\n+\t\t\tprintf(\"Error with bad-physaddr mbuf test\\n\");\n+\t\t\treturn -1;\n+\t\t}\n \t}\n \n \tbadbuf = *buf;\ndiff --git a/app/test/test_pcapng.c b/app/test/test_pcapng.c\nindex 320dacea34..abbf00f6da 100644\n--- a/app/test/test_pcapng.c\n+++ b/app/test/test_pcapng.c\n@@ -40,7 +40,7 @@ dummy_mbuf_prep(struct rte_mbuf *mb, uint8_t buf[], uint32_t buf_len,\n \tuint8_t *db;\n \n \tmb->buf_addr = buf;\n-\tmb->buf_iova = (uintptr_t)buf;\n+\trte_mbuf_iova_set(mb, (uintptr_t)buf);\n \tmb->buf_len = buf_len;\n \trte_mbuf_refcnt_set(mb, 1);\n \ndiff --git a/config/meson.build b/config/meson.build\nindex 7f7b6c92fd..6b6c3e7eb6 100644\n--- a/config/meson.build\n+++ b/config/meson.build\n@@ -309,6 +309,7 @@ endif\n if get_option('mbuf_refcnt_atomic')\n     dpdk_conf.set('RTE_MBUF_REFCNT_ATOMIC', true)\n endif\n+dpdk_conf.set10('RTE_IOVA_AS_VA', get_option('iova_as_va'))\n \n compile_time_cpuflags = []\n subdir(arch_subdir)\ndiff --git a/drivers/meson.build b/drivers/meson.build\nindex 376a64f4da..989770cffd 100644\n--- a/drivers/meson.build\n+++ b/drivers/meson.build\n@@ -105,6 +105,7 @@ foreach subpath:subdirs\n         ext_deps = []\n         pkgconfig_extra_libs = []\n         testpmd_sources = []\n+        pmd_iova_as_va = false\n \n         if not enable_drivers.contains(drv_path)\n             build = false\n@@ -122,6 +123,11 @@ foreach subpath:subdirs\n             # pull in driver directory which should update all the local variables\n             subdir(drv_path)\n \n+            if dpdk_conf.get('RTE_IOVA_AS_VA') == 1 and not pmd_iova_as_va and not always_enable.contains(drv_path)\n+                build = false\n+                reason = 'driver does not support IOVA as VA mode'\n+            endif\n+\n             # get dependency objs from strings\n             shared_deps = ext_deps\n             static_deps = ext_deps\ndiff --git a/lib/eal/linux/eal.c b/lib/eal/linux/eal.c\nindex 37d29643a5..b70c4dcc5f 100644\n--- a/lib/eal/linux/eal.c\n+++ b/lib/eal/linux/eal.c\n@@ -1127,6 +1127,13 @@ rte_eal_init(int argc, char **argv)\n \t\treturn -1;\n \t}\n \n+\tif (rte_eal_iova_mode() == RTE_IOVA_PA && RTE_IOVA_AS_VA) {\n+\t\trte_eal_init_alert(\n+\t\t\t\"Cannot use IOVA as 'PA' since build is configured to use only 'VA'\");\n+\t\trte_errno = EINVAL;\n+\t\treturn -1;\n+\t}\n+\n \tRTE_LOG(INFO, EAL, \"Selected IOVA mode '%s'\\n\",\n \t\trte_eal_iova_mode() == RTE_IOVA_PA ? \"PA\" : \"VA\");\n \ndiff --git a/lib/mbuf/rte_mbuf.c b/lib/mbuf/rte_mbuf.c\nindex a2307cebe6..5af290c53a 100644\n--- a/lib/mbuf/rte_mbuf.c\n+++ b/lib/mbuf/rte_mbuf.c\n@@ -89,7 +89,7 @@ rte_pktmbuf_init(struct rte_mempool *mp,\n \t/* start of buffer is after mbuf structure and priv data */\n \tm->priv_size = priv_size;\n \tm->buf_addr = (char *)m + mbuf_size;\n-\tm->buf_iova = rte_mempool_virt2iova(m) + mbuf_size;\n+\trte_mbuf_iova_set(m, rte_mempool_virt2iova(m) + mbuf_size);\n \tm->buf_len = (uint16_t)buf_len;\n \n \t/* keep some headroom between start of buffer and data */\n@@ -187,8 +187,8 @@ __rte_pktmbuf_init_extmem(struct rte_mempool *mp,\n \tRTE_ASSERT(ctx->off + ext_mem->elt_size <= ext_mem->buf_len);\n \n \tm->buf_addr = RTE_PTR_ADD(ext_mem->buf_ptr, ctx->off);\n-\tm->buf_iova = ext_mem->buf_iova == RTE_BAD_IOVA ?\n-\t\t      RTE_BAD_IOVA : (ext_mem->buf_iova + ctx->off);\n+\trte_mbuf_iova_set(m, ext_mem->buf_iova == RTE_BAD_IOVA ? RTE_BAD_IOVA :\n+\t\t\t\t\t\t\t\t (ext_mem->buf_iova + ctx->off));\n \n \tctx->off += ext_mem->elt_size;\n \tif (ctx->off + ext_mem->elt_size > ext_mem->buf_len) {\n@@ -388,7 +388,7 @@ int rte_mbuf_check(const struct rte_mbuf *m, int is_header,\n \t\t*reason = \"bad mbuf pool\";\n \t\treturn -1;\n \t}\n-\tif (m->buf_iova == 0) {\n+\tif (m->buf_iova == 0 && !RTE_IOVA_AS_VA) {\n \t\t*reason = \"bad IO addr\";\n \t\treturn -1;\n \t}\ndiff --git a/lib/mbuf/rte_mbuf.h b/lib/mbuf/rte_mbuf.h\nindex 9811e8c760..05be146bc2 100644\n--- a/lib/mbuf/rte_mbuf.h\n+++ b/lib/mbuf/rte_mbuf.h\n@@ -146,7 +146,7 @@ static inline uint16_t rte_pktmbuf_priv_size(struct rte_mempool *mp);\n static inline rte_iova_t\n rte_mbuf_data_iova(const struct rte_mbuf *mb)\n {\n-\treturn mb->buf_iova + mb->data_off;\n+\treturn (RTE_IOVA_AS_VA ? (uint64_t)mb->buf_addr : mb->buf_iova) + mb->data_off;\n }\n \n /**\n@@ -164,7 +164,7 @@ rte_mbuf_data_iova(const struct rte_mbuf *mb)\n static inline rte_iova_t\n rte_mbuf_data_iova_default(const struct rte_mbuf *mb)\n {\n-\treturn mb->buf_iova + RTE_PKTMBUF_HEADROOM;\n+\treturn (RTE_IOVA_AS_VA ? (uint64_t)mb->buf_addr : mb->buf_iova) + RTE_PKTMBUF_HEADROOM;\n }\n \n /**\n@@ -469,6 +469,13 @@ rte_mbuf_ext_refcnt_update(struct rte_mbuf_ext_shared_info *shinfo,\n \t\t\t\t __ATOMIC_ACQ_REL);\n }\n \n+static inline void\n+rte_mbuf_iova_set(struct rte_mbuf *m, rte_iova_t iova)\n+{\n+\tif (!RTE_IOVA_AS_VA)\n+\t\tm->buf_iova = iova;\n+}\n+\n /** Mbuf prefetch */\n #define RTE_MBUF_PREFETCH_TO_FREE(m) do {       \\\n \tif ((m) != NULL)                        \\\n@@ -1056,7 +1063,7 @@ rte_pktmbuf_attach_extbuf(struct rte_mbuf *m, void *buf_addr,\n \tRTE_ASSERT(shinfo->free_cb != NULL);\n \n \tm->buf_addr = buf_addr;\n-\tm->buf_iova = buf_iova;\n+\trte_mbuf_iova_set(m, buf_iova);\n \tm->buf_len = buf_len;\n \n \tm->data_len = 0;\n@@ -1143,7 +1150,7 @@ static inline void rte_pktmbuf_attach(struct rte_mbuf *mi, struct rte_mbuf *m)\n \n \tmi->data_off = m->data_off;\n \tmi->data_len = m->data_len;\n-\tmi->buf_iova = m->buf_iova;\n+\trte_mbuf_iova_set(mi, m->buf_iova);\n \tmi->buf_addr = m->buf_addr;\n \tmi->buf_len = m->buf_len;\n \n@@ -1245,7 +1252,7 @@ static inline void rte_pktmbuf_detach(struct rte_mbuf *m)\n \n \tm->priv_size = priv_size;\n \tm->buf_addr = (char *)m + mbuf_size;\n-\tm->buf_iova = rte_mempool_virt2iova(m) + mbuf_size;\n+\trte_mbuf_iova_set(m, rte_mempool_virt2iova(m) + mbuf_size);\n \tm->buf_len = (uint16_t)buf_len;\n \trte_pktmbuf_reset_headroom(m);\n \tm->data_len = 0;\ndiff --git a/lib/mbuf/rte_mbuf_core.h b/lib/mbuf/rte_mbuf_core.h\nindex 3d6ddd6773..c6292e7252 100644\n--- a/lib/mbuf/rte_mbuf_core.h\n+++ b/lib/mbuf/rte_mbuf_core.h\n@@ -581,6 +581,8 @@ struct rte_mbuf {\n \tvoid *buf_addr;           /**< Virtual address of segment buffer. */\n \t/**\n \t * Physical address of segment buffer.\n+\t * This field is invalid if the build is configured to use only\n+\t * virtual address as IOVA (i.e. RTE_IOVA_AS_VA is 1).\n \t * Force alignment to 8-bytes, so as to ensure we have the exact\n \t * same mbuf cacheline0 layout for 32-bit and 64-bit. This makes\n \t * working on vector drivers easier.\n@@ -848,8 +850,12 @@ struct rte_mbuf_ext_shared_info {\n  * @param o\n  *   The offset into the data to calculate address from.\n  */\n+#if RTE_IOVA_AS_VA\n+#define rte_pktmbuf_iova_offset(m, o) rte_pktmbuf_mtod_offset(m, rte_iova_t, o)\n+#else\n #define rte_pktmbuf_iova_offset(m, o) \\\n \t(rte_iova_t)((m)->buf_iova + (m)->data_off + (o))\n+#endif\n \n /**\n  * A macro that returns the IO address that points to the start of the\n@@ -858,7 +864,11 @@ struct rte_mbuf_ext_shared_info {\n  * @param m\n  *   The packet mbuf.\n  */\n+#if RTE_IOVA_AS_VA\n+#define rte_pktmbuf_iova(m) rte_pktmbuf_mtod(m, rte_iova_t)\n+#else\n #define rte_pktmbuf_iova(m) rte_pktmbuf_iova_offset(m, 0)\n+#endif\n \n #ifdef __cplusplus\n }\ndiff --git a/lib/vhost/vhost.h b/lib/vhost/vhost.h\nindex 40fac3b7c6..e8f7c76c0c 100644\n--- a/lib/vhost/vhost.h\n+++ b/lib/vhost/vhost.h\n@@ -962,7 +962,7 @@ restore_mbuf(struct rte_mbuf *m)\n \t\t/* start of buffer is after mbuf structure and priv data */\n \n \t\tm->buf_addr = (char *)m + mbuf_size;\n-\t\tm->buf_iova = rte_mempool_virt2iova(m) + mbuf_size;\n+\t\trte_mbuf_iova_set(m, rte_mempool_virt2iova(m) + mbuf_size);\n \t\tm = m->next;\n \t}\n }\ndiff --git a/lib/vhost/vhost_crypto.c b/lib/vhost/vhost_crypto.c\nindex 54946f46d9..7b50735796 100644\n--- a/lib/vhost/vhost_crypto.c\n+++ b/lib/vhost/vhost_crypto.c\n@@ -823,11 +823,17 @@ prepare_sym_cipher_op(struct vhost_crypto *vcrypto, struct rte_crypto_op *op,\n \tswitch (vcrypto->option) {\n \tcase RTE_VHOST_CRYPTO_ZERO_COPY_ENABLE:\n \t\tm_src->data_len = cipher->para.src_data_len;\n-\t\tm_src->buf_iova = gpa_to_hpa(vcrypto->dev, desc->addr,\n-\t\t\t\tcipher->para.src_data_len);\n+\t\tif (!RTE_IOVA_AS_VA) {\n+\t\t\tm_src->buf_iova =\n+\t\t\t\tgpa_to_hpa(vcrypto->dev, desc->addr, cipher->para.src_data_len);\n+\t\t\tif (unlikely(m_src->buf_iova == 0)) {\n+\t\t\t\tVC_LOG_ERR(\"zero_copy may fail due to cross page data\");\n+\t\t\t\tret = VIRTIO_CRYPTO_ERR;\n+\t\t\t\tgoto error_exit;\n+\t\t\t}\n+\t\t}\n \t\tm_src->buf_addr = get_data_ptr(vc_req, desc, VHOST_ACCESS_RO);\n-\t\tif (unlikely(m_src->buf_iova == 0 ||\n-\t\t\t\tm_src->buf_addr == NULL)) {\n+\t\tif (unlikely(m_src->buf_addr == NULL)) {\n \t\t\tVC_LOG_ERR(\"zero_copy may fail due to cross page data\");\n \t\t\tret = VIRTIO_CRYPTO_ERR;\n \t\t\tgoto error_exit;\n@@ -867,10 +873,17 @@ prepare_sym_cipher_op(struct vhost_crypto *vcrypto, struct rte_crypto_op *op,\n \n \tswitch (vcrypto->option) {\n \tcase RTE_VHOST_CRYPTO_ZERO_COPY_ENABLE:\n-\t\tm_dst->buf_iova = gpa_to_hpa(vcrypto->dev,\n-\t\t\t\tdesc->addr, cipher->para.dst_data_len);\n+\t\tif (!RTE_IOVA_AS_VA) {\n+\t\t\tm_dst->buf_iova =\n+\t\t\t\tgpa_to_hpa(vcrypto->dev, desc->addr, cipher->para.dst_data_len);\n+\t\t\tif (unlikely(m_dst->buf_iova == 0)) {\n+\t\t\t\tVC_LOG_ERR(\"zero_copy may fail due to cross page data\");\n+\t\t\t\tret = VIRTIO_CRYPTO_ERR;\n+\t\t\t\tgoto error_exit;\n+\t\t\t}\n+\t\t}\n \t\tm_dst->buf_addr = get_data_ptr(vc_req, desc, VHOST_ACCESS_RW);\n-\t\tif (unlikely(m_dst->buf_iova == 0 || m_dst->buf_addr == NULL)) {\n+\t\tif (unlikely(m_dst->buf_addr == NULL)) {\n \t\t\tVC_LOG_ERR(\"zero_copy may fail due to cross page data\");\n \t\t\tret = VIRTIO_CRYPTO_ERR;\n \t\t\tgoto error_exit;\n@@ -980,11 +993,17 @@ prepare_sym_chain_op(struct vhost_crypto *vcrypto, struct rte_crypto_op *op,\n \tcase RTE_VHOST_CRYPTO_ZERO_COPY_ENABLE:\n \t\tm_src->data_len = chain->para.src_data_len;\n \t\tm_dst->data_len = chain->para.dst_data_len;\n-\n-\t\tm_src->buf_iova = gpa_to_hpa(vcrypto->dev, desc->addr,\n-\t\t\t\tchain->para.src_data_len);\n+\t\tif (!RTE_IOVA_AS_VA) {\n+\t\t\tm_src->buf_iova =\n+\t\t\t\tgpa_to_hpa(vcrypto->dev, desc->addr, chain->para.src_data_len);\n+\t\t\tif (unlikely(m_src->buf_iova == 0)) {\n+\t\t\t\tVC_LOG_ERR(\"zero_copy may fail due to cross page data\");\n+\t\t\t\tret = VIRTIO_CRYPTO_ERR;\n+\t\t\t\tgoto error_exit;\n+\t\t\t}\n+\t\t}\n \t\tm_src->buf_addr = get_data_ptr(vc_req, desc, VHOST_ACCESS_RO);\n-\t\tif (unlikely(m_src->buf_iova == 0 || m_src->buf_addr == NULL)) {\n+\t\tif (unlikely(m_src->buf_addr == NULL)) {\n \t\t\tVC_LOG_ERR(\"zero_copy may fail due to cross page data\");\n \t\t\tret = VIRTIO_CRYPTO_ERR;\n \t\t\tgoto error_exit;\n@@ -1024,10 +1043,17 @@ prepare_sym_chain_op(struct vhost_crypto *vcrypto, struct rte_crypto_op *op,\n \n \tswitch (vcrypto->option) {\n \tcase RTE_VHOST_CRYPTO_ZERO_COPY_ENABLE:\n-\t\tm_dst->buf_iova = gpa_to_hpa(vcrypto->dev,\n-\t\t\t\tdesc->addr, chain->para.dst_data_len);\n+\t\tif (!RTE_IOVA_AS_VA) {\n+\t\t\tm_dst->buf_iova =\n+\t\t\t\tgpa_to_hpa(vcrypto->dev, desc->addr, chain->para.dst_data_len);\n+\t\t\tif (unlikely(m_dst->buf_iova == 0)) {\n+\t\t\t\tVC_LOG_ERR(\"zero_copy may fail due to cross page data\");\n+\t\t\t\tret = VIRTIO_CRYPTO_ERR;\n+\t\t\t\tgoto error_exit;\n+\t\t\t}\n+\t\t}\n \t\tm_dst->buf_addr = get_data_ptr(vc_req, desc, VHOST_ACCESS_RW);\n-\t\tif (unlikely(m_dst->buf_iova == 0 || m_dst->buf_addr == NULL)) {\n+\t\tif (unlikely(m_dst->buf_addr == NULL)) {\n \t\t\tVC_LOG_ERR(\"zero_copy may fail due to cross page data\");\n \t\t\tret = VIRTIO_CRYPTO_ERR;\n \t\t\tgoto error_exit;\ndiff --git a/meson_options.txt b/meson_options.txt\nindex 7c220ad68d..f0fa6cf04c 100644\n--- a/meson_options.txt\n+++ b/meson_options.txt\n@@ -44,6 +44,8 @@ option('platform', type: 'string', value: 'native', description:\n        'Platform to build, either \"native\", \"generic\" or a SoC. Please refer to the Linux build guide for more information.')\n option('enable_trace_fp', type: 'boolean', value: false, description:\n        'enable fast path trace points.')\n+option('iova_as_va', type: 'boolean', value: false, description:\n+       'Build which only supports IOVA as VA mode. Unsupported drivers are disabled.')\n option('tests', type: 'boolean', value: true, description:\n        'build unit tests')\n option('use_hpet', type: 'boolean', value: false, description:\n",
    "prefixes": [
        "v2",
        "1/5"
    ]
}