get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 57087,
    "url": "http://patches.dpdk.org/api/patches/57087/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/b0259319e149f537b60d446cee2e58f65613e2f0.1564048328.git.anatoly.burakov@intel.com/",
    "project": {
        "id": 1,
        "url": "http://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": "<b0259319e149f537b60d446cee2e58f65613e2f0.1564048328.git.anatoly.burakov@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/b0259319e149f537b60d446cee2e58f65613e2f0.1564048328.git.anatoly.burakov@intel.com",
    "date": "2019-07-25T09:52:24",
    "name": "[v2] eal: pick IOVA as PA if IOMMU is not available",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "2af05d19cdfed45ec77823a752d87f7c5fd02a6f",
    "submitter": {
        "id": 4,
        "url": "http://patches.dpdk.org/api/people/4/?format=api",
        "name": "Anatoly Burakov",
        "email": "anatoly.burakov@intel.com"
    },
    "delegate": null,
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/b0259319e149f537b60d446cee2e58f65613e2f0.1564048328.git.anatoly.burakov@intel.com/mbox/",
    "series": [
        {
            "id": 5741,
            "url": "http://patches.dpdk.org/api/series/5741/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=5741",
            "date": "2019-07-25T09:52:24",
            "name": "[v2] eal: pick IOVA as PA if IOMMU is not available",
            "version": 2,
            "mbox": "http://patches.dpdk.org/series/5741/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/57087/comments/",
    "check": "warning",
    "checks": "http://patches.dpdk.org/api/patches/57087/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@dpdk.org",
        "Delivered-To": "patchwork@dpdk.org",
        "Received": [
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 897B31C2D3;\n\tThu, 25 Jul 2019 11:52:29 +0200 (CEST)",
            "from mga05.intel.com (mga05.intel.com [192.55.52.43])\n\tby dpdk.org (Postfix) with ESMTP id C5DD91C2D3\n\tfor <dev@dpdk.org>; Thu, 25 Jul 2019 11:52:27 +0200 (CEST)",
            "from orsmga003.jf.intel.com ([10.7.209.27])\n\tby fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t25 Jul 2019 02:52:25 -0700",
            "from silpixa00399498.ir.intel.com (HELO\n\tsilpixa00399498.ger.corp.intel.com) ([10.237.223.125])\n\tby orsmga003.jf.intel.com with ESMTP; 25 Jul 2019 02:52:25 -0700"
        ],
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.64,306,1559545200\"; d=\"scan'208\";a=\"172588349\"",
        "From": "Anatoly Burakov <anatoly.burakov@intel.com>",
        "To": "dev@dpdk.org",
        "Cc": "david.marchand@redhat.com,\n\tjerinj@marvell.com,\n\tthomas@monjalon.net",
        "Date": "Thu, 25 Jul 2019 10:52:24 +0100",
        "Message-Id": "<b0259319e149f537b60d446cee2e58f65613e2f0.1564048328.git.anatoly.burakov@intel.com>",
        "X-Mailer": "git-send-email 2.17.1",
        "In-Reply-To": "<5d8f83fb7dd574d83a044c6a01e2613798f256c3.1563986790.git.anatoly.burakov@intel.com>",
        "References": "<5d8f83fb7dd574d83a044c6a01e2613798f256c3.1563986790.git.anatoly.burakov@intel.com>",
        "Subject": "[dpdk-dev] [PATCH v2] eal: pick IOVA as PA if IOMMU is not available",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n\t<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\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "When IOMMU is not available, /sys/kernel/iommu_groups will not be\npopulated. This is happening since at least 3.6 when VFIO support\nwas added. If the directory is empty, EAL should not pick IOVA as\nVA as the default IOVA mode.\n\nSigned-off-by: Anatoly Burakov <anatoly.burakov@intel.com>\n---\n\nNotes:\n    v2:\n    - Decouple IOMMU from VFIO\n    - Add a check for physical addresses availability\n\n lib/librte_eal/linux/eal/eal.c      | 21 ++++++++++++++++++--\n lib/librte_eal/linux/eal/eal_vfio.c | 30 +++++++++++++++++++++++++++++\n lib/librte_eal/linux/eal/eal_vfio.h |  2 ++\n 3 files changed, 51 insertions(+), 2 deletions(-)",
    "diff": "diff --git a/lib/librte_eal/linux/eal/eal.c b/lib/librte_eal/linux/eal/eal.c\nindex 34db78753..207ee0b1c 100644\n--- a/lib/librte_eal/linux/eal/eal.c\n+++ b/lib/librte_eal/linux/eal/eal.c\n@@ -1061,8 +1061,25 @@ rte_eal_init(int argc, char **argv)\n \t\tenum rte_iova_mode iova_mode = rte_bus_get_iommu_class();\n \n \t\tif (iova_mode == RTE_IOVA_DC) {\n-\t\t\tiova_mode = RTE_IOVA_VA;\n-\t\t\tRTE_LOG(DEBUG, EAL, \"Buses did not request a specific IOVA mode, select IOVA as VA mode.\\n\");\n+\t\t\tRTE_LOG(DEBUG, EAL, \"Buses did not request a specific IOVA mode.\\n\");\n+\n+\t\t\tif (!phys_addrs) {\n+\t\t\t\t/* if we have no access to physical addreses,\n+\t\t\t\t * pick IOVA as VA mode.\n+\t\t\t\t */\n+\t\t\t\tiova_mode = RTE_IOVA_VA;\n+\t\t\t\tRTE_LOG(DEBUG, EAL, \"Physical addresses are unavailable, selecting IOVA as VA mode.\\n\");\n+\t\t\t} else if (vfio_iommu_enabled()) {\n+\t\t\t\t/* we have an IOMMU, pick IOVA as VA mode */\n+\t\t\t\tiova_mode = RTE_IOVA_VA;\n+\t\t\t\tRTE_LOG(DEBUG, EAL, \"IOMMU is available, selecting IOVA as VA mode.\\n\");\n+\t\t\t} else {\n+\t\t\t\t/* physical addresses available, and no IOMMU\n+\t\t\t\t * found, so pick IOVA as PA.\n+\t\t\t\t */\n+\t\t\t\tiova_mode = RTE_IOVA_PA;\n+\t\t\t\tRTE_LOG(DEBUG, EAL, \"IOMMU is not available, selecting IOVA as PA mode.\\n\");\n+\t\t\t}\n \t\t}\n #ifdef RTE_LIBRTE_KNI\n \t\t/* Workaround for KNI which requires physical address to work */\ndiff --git a/lib/librte_eal/linux/eal/eal_vfio.c b/lib/librte_eal/linux/eal/eal_vfio.c\nindex 501c74f23..92d290284 100644\n--- a/lib/librte_eal/linux/eal/eal_vfio.c\n+++ b/lib/librte_eal/linux/eal/eal_vfio.c\n@@ -2,6 +2,7 @@\n  * Copyright(c) 2010-2018 Intel Corporation\n  */\n \n+#include <dirent.h>\n #include <inttypes.h>\n #include <string.h>\n #include <fcntl.h>\n@@ -19,6 +20,8 @@\n #include \"eal_vfio.h\"\n #include \"eal_private.h\"\n \n+#define VFIO_KERNEL_IOMMU_GROUPS_PATH \"/sys/kernel/iommu_groups\"\n+\n #ifdef VFIO_PRESENT\n \n #define VFIO_MEM_EVENT_CLB_NAME \"vfio_mem_event_clb\"\n@@ -2147,3 +2150,30 @@ rte_vfio_container_dma_unmap(__rte_unused int container_fd,\n }\n \n #endif /* VFIO_PRESENT */\n+\n+/*\n+ * on Linux 3.6+, even if VFIO is not loaded, whenever IOMMU is enabled in the\n+ * BIOS and in the kernel, /sys/kernel/iommu_groups path will contain kernel\n+ * IOMMU groups. If IOMMU is not enabled, that path would be empty. Therefore,\n+ * checking if the path is empty will tell us if IOMMU is enabled.\n+ */\n+int\n+vfio_iommu_enabled(void)\n+{\n+\tDIR *dir = opendir(VFIO_KERNEL_IOMMU_GROUPS_PATH);\n+\tstruct dirent *d;\n+\tint n = 0;\n+\n+\t/* if directory doesn't exist, assume IOMMU is not enabled */\n+\tif (dir == NULL)\n+\t\treturn 0;\n+\n+\twhile ((d = readdir(dir)) != NULL) {\n+\t\t/* skip dot and dot-dot */\n+\t\tif (++n > 2)\n+\t\t\tbreak;\n+\t}\n+\tclosedir(dir);\n+\n+\treturn n > 2;\n+}\ndiff --git a/lib/librte_eal/linux/eal/eal_vfio.h b/lib/librte_eal/linux/eal/eal_vfio.h\nindex cb2d35fb1..58c7a7309 100644\n--- a/lib/librte_eal/linux/eal/eal_vfio.h\n+++ b/lib/librte_eal/linux/eal/eal_vfio.h\n@@ -133,6 +133,8 @@ vfio_has_supported_extensions(int vfio_container_fd);\n \n int vfio_mp_sync_setup(void);\n \n+int vfio_iommu_enabled(void);\n+\n #define EAL_VFIO_MP \"eal_vfio_mp_sync\"\n \n #define SOCKET_REQ_CONTAINER 0x100\n",
    "prefixes": [
        "v2"
    ]
}