get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 43447,
    "url": "http://patchwork.dpdk.org/api/patches/43447/?format=api",
    "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/4107730371de4ac30367258cb3419df184d1ec16.1532947452.git.anatoly.burakov@intel.com/",
    "project": {
        "id": 1,
        "url": "http://patchwork.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": "<4107730371de4ac30367258cb3419df184d1ec16.1532947452.git.anatoly.burakov@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/4107730371de4ac30367258cb3419df184d1ec16.1532947452.git.anatoly.burakov@intel.com",
    "date": "2018-07-30T10:59:06",
    "name": "vfio: revert retry logic for MSI-X BAR mapping",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "aa53e9d0548dcdfe462cf2bd071da8dfb2324310",
    "submitter": {
        "id": 4,
        "url": "http://patchwork.dpdk.org/api/people/4/?format=api",
        "name": "Anatoly Burakov",
        "email": "anatoly.burakov@intel.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.dpdk.org/project/dpdk/patch/4107730371de4ac30367258cb3419df184d1ec16.1532947452.git.anatoly.burakov@intel.com/mbox/",
    "series": [
        {
            "id": 818,
            "url": "http://patchwork.dpdk.org/api/series/818/?format=api",
            "web_url": "http://patchwork.dpdk.org/project/dpdk/list/?series=818",
            "date": "2018-07-30T10:59:06",
            "name": "vfio: revert retry logic for MSI-X BAR mapping",
            "version": 1,
            "mbox": "http://patchwork.dpdk.org/series/818/mbox/"
        }
    ],
    "comments": "http://patchwork.dpdk.org/api/patches/43447/comments/",
    "check": "success",
    "checks": "http://patchwork.dpdk.org/api/patches/43447/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 0CFE7532C;\n\tMon, 30 Jul 2018 12:59:12 +0200 (CEST)",
            "from mga18.intel.com (mga18.intel.com [134.134.136.126])\n\tby dpdk.org (Postfix) with ESMTP id D74334F94\n\tfor <dev@dpdk.org>; Mon, 30 Jul 2018 12:59:09 +0200 (CEST)",
            "from orsmga006.jf.intel.com ([10.7.209.51])\n\tby orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t30 Jul 2018 03:59:08 -0700",
            "from irvmail001.ir.intel.com ([163.33.26.43])\n\tby orsmga006.jf.intel.com with ESMTP; 30 Jul 2018 03:59:07 -0700",
            "from sivswdev01.ir.intel.com (sivswdev01.ir.intel.com\n\t[10.237.217.45])\n\tby irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id\n\tw6UAx6g3010593; Mon, 30 Jul 2018 11:59:06 +0100",
            "from sivswdev01.ir.intel.com (localhost [127.0.0.1])\n\tby sivswdev01.ir.intel.com with ESMTP id w6UAx6uQ009402;\n\tMon, 30 Jul 2018 11:59:06 +0100",
            "(from aburakov@localhost)\n\tby sivswdev01.ir.intel.com with LOCAL id w6UAx6i5009398;\n\tMon, 30 Jul 2018 11:59:06 +0100"
        ],
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.51,422,1526367600\"; d=\"scan'208\";a=\"61836385\"",
        "From": "Anatoly Burakov <anatoly.burakov@intel.com>",
        "To": "dev@dpdk.org",
        "Cc": "thomas@monjalon.net, jerin.jacob@caviumnetworks.com,\n\tt.yoshimura8869@gmail.com",
        "Date": "Mon, 30 Jul 2018 11:59:06 +0100",
        "Message-Id": "<4107730371de4ac30367258cb3419df184d1ec16.1532947452.git.anatoly.burakov@intel.com>",
        "X-Mailer": "git-send-email 1.7.0.7",
        "Subject": "[dpdk-dev] [PATCH] vfio: revert retry logic for MSI-X BAR mapping",
        "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": "This reverts commit d4774a568ba0a5923229974a002972c83eb04570.\n\nThe patch is incomplete because kernel 4.16+, while being capable\nof mapping MSI-X BARs, will also report if such a capability is\navailable. Without checking this capability, gratuitous errors\nare displayed on kernels <4.16 while VFIO is attempting to mmap\nMSI-X BAR and fails, which can be confusing to the user.\n\nSigned-off-by: Anatoly Burakov <anatoly.burakov@intel.com>\n---\n drivers/bus/pci/linux/pci_vfio.c | 93 ++++++++++++++------------------\n 1 file changed, 41 insertions(+), 52 deletions(-)",
    "diff": "diff --git a/drivers/bus/pci/linux/pci_vfio.c b/drivers/bus/pci/linux/pci_vfio.c\nindex bb6ef7b67..686386d6a 100644\n--- a/drivers/bus/pci/linux/pci_vfio.c\n+++ b/drivers/bus/pci/linux/pci_vfio.c\n@@ -332,59 +332,50 @@ pci_vfio_mmap_bar(int vfio_dev_fd, struct mapped_pci_resource *vfio_res,\n \tvoid *bar_addr;\n \tstruct pci_msix_table *msix_table = &vfio_res->msix_table;\n \tstruct pci_map *bar = &vfio_res->maps[bar_index];\n-\tbool again = false;\n \n \tif (bar->size == 0)\n \t\t/* Skip this BAR */\n \t\treturn 0;\n \n+\tif (msix_table->bar_index == bar_index) {\n+\t\t/*\n+\t\t * VFIO will not let us map the MSI-X table,\n+\t\t * but we can map around it.\n+\t\t */\n+\t\tuint32_t table_start = msix_table->offset;\n+\t\tuint32_t table_end = table_start + msix_table->size;\n+\t\ttable_end = (table_end + ~PAGE_MASK) & PAGE_MASK;\n+\t\ttable_start &= PAGE_MASK;\n+\n+\t\tif (table_start == 0 && table_end >= bar->size) {\n+\t\t\t/* Cannot map this BAR */\n+\t\t\tRTE_LOG(DEBUG, EAL, \"Skipping BAR%d\\n\", bar_index);\n+\t\t\tbar->size = 0;\n+\t\t\tbar->addr = 0;\n+\t\t\treturn 0;\n+\t\t}\n+\n+\t\tmemreg[0].offset = bar->offset;\n+\t\tmemreg[0].size = table_start;\n+\t\tmemreg[1].offset = bar->offset + table_end;\n+\t\tmemreg[1].size = bar->size - table_end;\n+\n+\t\tRTE_LOG(DEBUG, EAL,\n+\t\t\t\"Trying to map BAR%d that contains the MSI-X \"\n+\t\t\t\"table. Trying offsets: \"\n+\t\t\t\"0x%04lx:0x%04lx, 0x%04lx:0x%04lx\\n\", bar_index,\n+\t\t\tmemreg[0].offset, memreg[0].size,\n+\t\t\tmemreg[1].offset, memreg[1].size);\n+\t} else {\n+\t\tmemreg[0].offset = bar->offset;\n+\t\tmemreg[0].size = bar->size;\n+\t}\n+\n \t/* reserve the address using an inaccessible mapping */\n \tbar_addr = mmap(bar->addr, bar->size, 0, MAP_PRIVATE |\n \t\t\tMAP_ANONYMOUS | additional_flags, -1, 0);\n-\tif (bar_addr == MAP_FAILED) {\n-\t\tRTE_LOG(ERR, EAL,\n-\t\t\t\"Failed to create inaccessible mapping for BAR%d\\n\",\n-\t\t\tbar_index);\n-\t\treturn -1;\n-\t}\n-\n-\tmemreg[0].offset = bar->offset;\n-\tmemreg[0].size = bar->size;\n-\tdo {\n+\tif (bar_addr != MAP_FAILED) {\n \t\tvoid *map_addr = NULL;\n-\t\tif (again) {\n-\t\t\t/*\n-\t\t\t * VFIO did not let us map the MSI-X table,\n-\t\t\t * but we can map around it.\n-\t\t\t */\n-\t\t\tuint32_t table_start = msix_table->offset;\n-\t\t\tuint32_t table_end = table_start + msix_table->size;\n-\t\t\ttable_end = (table_end + ~PAGE_MASK) & PAGE_MASK;\n-\t\t\ttable_start &= PAGE_MASK;\n-\n-\t\t\tif (table_start == 0 && table_end >= bar->size) {\n-\t\t\t\t/* Cannot map this BAR */\n-\t\t\t\tRTE_LOG(DEBUG, EAL, \"Skipping BAR%d\\n\",\n-\t\t\t\t\t\tbar_index);\n-\t\t\t\tmunmap(bar_addr, bar->size);\n-\t\t\t\tbar->size = 0;\n-\t\t\t\tbar->addr = 0;\n-\t\t\t\treturn 0;\n-\t\t\t}\n-\n-\t\t\tmemreg[0].offset = bar->offset;\n-\t\t\tmemreg[0].size = table_start;\n-\t\t\tmemreg[1].offset = bar->offset + table_end;\n-\t\t\tmemreg[1].size = bar->size - table_end;\n-\n-\t\t\tRTE_LOG(DEBUG, EAL,\n-\t\t\t\t\"Trying to map BAR%d that contains the MSI-X \"\n-\t\t\t\t\"table. Trying offsets: \"\n-\t\t\t\t\"0x%04lx:0x%04lx, 0x%04lx:0x%04lx\\n\", bar_index,\n-\t\t\t\tmemreg[0].offset, memreg[0].size,\n-\t\t\t\tmemreg[1].offset, memreg[1].size);\n-\t\t}\n-\n \t\tif (memreg[0].size) {\n \t\t\t/* actual map of first part */\n \t\t\tmap_addr = pci_map_resource(bar_addr, vfio_dev_fd,\n@@ -393,12 +384,6 @@ pci_vfio_mmap_bar(int vfio_dev_fd, struct mapped_pci_resource *vfio_res,\n \t\t\t\t\t\t\tMAP_FIXED);\n \t\t}\n \n-\t\tif (map_addr == MAP_FAILED &&\n-\t\t\tmsix_table->bar_index == bar_index && !again) {\n-\t\t\tagain = true;\n-\t\t\tcontinue;\n-\t\t}\n-\n \t\t/* if there's a second part, try to map it */\n \t\tif (map_addr != MAP_FAILED\n \t\t\t&& memreg[1].offset && memreg[1].size) {\n@@ -419,8 +404,12 @@ pci_vfio_mmap_bar(int vfio_dev_fd, struct mapped_pci_resource *vfio_res,\n \t\t\t\t\tbar_index);\n \t\t\treturn -1;\n \t\t}\n-\t\tbreak;\n-\t} while (again);\n+\t} else {\n+\t\tRTE_LOG(ERR, EAL,\n+\t\t\t\t\"Failed to create inaccessible mapping for BAR%d\\n\",\n+\t\t\t\tbar_index);\n+\t\treturn -1;\n+\t}\n \n \tbar->addr = bar_addr;\n \treturn 0;\n",
    "prefixes": []
}