get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 69766,
    "url": "http://patches.dpdk.org/api/patches/69766/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/e092c8e06b192c629f906ef0ae128f41f62c1028.1588693697.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": "<e092c8e06b192c629f906ef0ae128f41f62c1028.1588693697.git.anatoly.burakov@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/e092c8e06b192c629f906ef0ae128f41f62c1028.1588693697.git.anatoly.burakov@intel.com",
    "date": "2020-05-05T15:48:56",
    "name": "mem: check DMA mask for user-supplied IOVA addresses",
    "commit_ref": null,
    "pull_url": null,
    "state": "changes-requested",
    "archived": true,
    "hash": "e539ae6b1560dcc3970d6a40b31031727300753a",
    "submitter": {
        "id": 4,
        "url": "http://patches.dpdk.org/api/people/4/?format=api",
        "name": "Anatoly Burakov",
        "email": "anatoly.burakov@intel.com"
    },
    "delegate": {
        "id": 24651,
        "url": "http://patches.dpdk.org/api/users/24651/?format=api",
        "username": "dmarchand",
        "first_name": "David",
        "last_name": "Marchand",
        "email": "david.marchand@redhat.com"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/e092c8e06b192c629f906ef0ae128f41f62c1028.1588693697.git.anatoly.burakov@intel.com/mbox/",
    "series": [
        {
            "id": 9838,
            "url": "http://patches.dpdk.org/api/series/9838/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=9838",
            "date": "2020-05-05T15:48:56",
            "name": "mem: check DMA mask for user-supplied IOVA addresses",
            "version": 1,
            "mbox": "http://patches.dpdk.org/series/9838/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/69766/comments/",
    "check": "fail",
    "checks": "http://patches.dpdk.org/api/patches/69766/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 dpdk.org (dpdk.org [92.243.14.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id B4C71A04B8;\n\tTue,  5 May 2020 17:49:01 +0200 (CEST)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 91A791D628;\n\tTue,  5 May 2020 17:49:01 +0200 (CEST)",
            "from mga11.intel.com (mga11.intel.com [192.55.52.93])\n by dpdk.org (Postfix) with ESMTP id 9904A1D614\n for <dev@dpdk.org>; Tue,  5 May 2020 17:48:59 +0200 (CEST)",
            "from fmsmga004.fm.intel.com ([10.253.24.48])\n by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 05 May 2020 08:48:57 -0700",
            "from aburakov-mobl.ger.corp.intel.com (HELO ubuntu-vm.mshome.net)\n ([10.213.197.31])\n by fmsmga004.fm.intel.com with ESMTP; 05 May 2020 08:48:56 -0700"
        ],
        "IronPort-SDR": [
            "\n zYJrxCl8WwSBu1y0lzKNKlB2n0LH/tzKOqUESj5SnQWh5EkeZd9bc+0aGVGdxDjqDrVvL91vM7\n ibRh8lmXBR7g==",
            "\n hJYs/9XnKs1gmmkglZvH5XjgLHlHr97v8QuUVH9dx4W6rns/SwsIb8+k6SCXlxebCtxedbV91n\n rX1KkQIo+mNg=="
        ],
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.73,355,1583222400\"; d=\"scan'208\";a=\"284294612\"",
        "From": "Anatoly Burakov <anatoly.burakov@intel.com>",
        "To": "dev@dpdk.org",
        "Date": "Tue,  5 May 2020 15:48:56 +0000",
        "Message-Id": "\n <e092c8e06b192c629f906ef0ae128f41f62c1028.1588693697.git.anatoly.burakov@intel.com>",
        "X-Mailer": "git-send-email 2.17.1",
        "Subject": "[dpdk-dev] [PATCH] mem: check DMA mask for user-supplied IOVA\n\taddresses",
        "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 <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",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "Currently, external memory API will silently succeed if the IOVA\naddresses supplied by the user do not fit into the DMA mask. This\ncan cause difficult to debug issues or accepting failed kernel\nVFIO DMA mappings.\n\nFix it so that if the IOVA addresses are provided, they are checked\nto see if they fit into the DMA mask.\n\nSigned-off-by: Anatoly Burakov <anatoly.burakov@intel.com>\n---\n lib/librte_eal/common/rte_malloc.c | 29 +++++++++++++++++++++++++++++\n 1 file changed, 29 insertions(+)",
    "diff": "diff --git a/lib/librte_eal/common/rte_malloc.c b/lib/librte_eal/common/rte_malloc.c\nindex f1b73168bd..0d3a3ef93f 100644\n--- a/lib/librte_eal/common/rte_malloc.c\n+++ b/lib/librte_eal/common/rte_malloc.c\n@@ -392,6 +392,29 @@ find_named_heap(const char *name)\n \treturn NULL;\n }\n \n+static int\n+check_iova_addrs_dma_mask(rte_iova_t iova_addrs[], unsigned int n_pages,\n+\t\tsize_t page_sz)\n+{\n+\tunsigned int i, bits;\n+\trte_iova_t max = 0;\n+\n+\t/* we only care for the biggest address we will get */\n+\tfor (i = 0; i < n_pages; i++) {\n+\t\trte_iova_t first = iova_addrs[i];\n+\t\trte_iova_t last = first + page_sz - 1;\n+\t\tmax = RTE_MAX(last, max);\n+\t}\n+\n+\tbits = rte_fls_u64(max);\n+\tif (rte_mem_check_dma_mask(bits) != 0) {\n+\t\tRTE_LOG(ERR, EAL, \"IOVA 0x%zx does not fit into the DMA mask\\n\",\n+\t\t\t\tmax);\n+\t\treturn -1;\n+\t}\n+\treturn 0;\n+}\n+\n int\n rte_malloc_heap_memory_add(const char *heap_name, void *va_addr, size_t len,\n \t\trte_iova_t iova_addrs[], unsigned int n_pages, size_t page_sz)\n@@ -412,6 +435,12 @@ rte_malloc_heap_memory_add(const char *heap_name, void *va_addr, size_t len,\n \t\trte_errno = EINVAL;\n \t\treturn -1;\n \t}\n+\t/* check if all IOVA's fit into the DMA mask */\n+\tif (iova_addrs != NULL && check_iova_addrs_dma_mask(iova_addrs,\n+\t\t\tn_pages, page_sz) != 0) {\n+\t\trte_errno = EINVAL;\n+\t\treturn -1;\n+\t}\n \trte_mcfg_mem_write_lock();\n \n \t/* find our heap */\n",
    "prefixes": []
}