get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 908468,
    "url": "http://patchwork.ozlabs.org/api/patches/908468/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20180504030811.28111-6-peterx@redhat.com/",
    "project": {
        "id": 14,
        "url": "http://patchwork.ozlabs.org/api/projects/14/?format=api",
        "name": "QEMU Development",
        "link_name": "qemu-devel",
        "list_id": "qemu-devel.nongnu.org",
        "list_email": "qemu-devel@nongnu.org",
        "web_url": "",
        "scm_url": "",
        "webscm_url": "",
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<20180504030811.28111-6-peterx@redhat.com>",
    "list_archive_url": null,
    "date": "2018-05-04T03:08:06",
    "name": "[v2,05/10] intel-iommu: introduce vtd_page_walk_info",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "e0c93ab4bfc57f7093fce591b643badfaa78579c",
    "submitter": {
        "id": 67717,
        "url": "http://patchwork.ozlabs.org/api/people/67717/?format=api",
        "name": "Peter Xu",
        "email": "peterx@redhat.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20180504030811.28111-6-peterx@redhat.com/mbox/",
    "series": [
        {
            "id": 42502,
            "url": "http://patchwork.ozlabs.org/api/series/42502/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=42502",
            "date": "2018-05-04T03:08:01",
            "name": "intel-iommu: nested vIOMMU, cleanups, bug fixes",
            "version": 2,
            "mbox": "http://patchwork.ozlabs.org/series/42502/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/908468/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/908468/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>",
        "X-Original-To": "incoming@patchwork.ozlabs.org",
        "Delivered-To": "patchwork-incoming@bilbo.ozlabs.org",
        "Authentication-Results": [
            "ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)",
            "ozlabs.org;\n\tdmarc=fail (p=none dis=none) header.from=redhat.com"
        ],
        "Received": [
            "from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 40ccZv4mGvz9s35\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri,  4 May 2018 13:15:19 +1000 (AEST)",
            "from localhost ([::1]:60194 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1fERBl-0006Uh-6B\n\tfor incoming@patchwork.ozlabs.org; Thu, 03 May 2018 23:15:17 -0400",
            "from eggs.gnu.org ([2001:4830:134:3::10]:33291)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <peterx@redhat.com>) id 1fER5a-0001lX-08\n\tfor qemu-devel@nongnu.org; Thu, 03 May 2018 23:08:56 -0400",
            "from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <peterx@redhat.com>) id 1fER5Y-0005c9-Mw\n\tfor qemu-devel@nongnu.org; Thu, 03 May 2018 23:08:53 -0400",
            "from mx3-rdu2.redhat.com ([66.187.233.73]:45882\n\thelo=mx1.redhat.com)\n\tby eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)\n\t(Exim 4.71) (envelope-from <peterx@redhat.com>) id 1fER5Y-0005bk-Gu\n\tfor qemu-devel@nongnu.org; Thu, 03 May 2018 23:08:52 -0400",
            "from smtp.corp.redhat.com\n\t(int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby mx1.redhat.com (Postfix) with ESMTPS id 326FBF641F;\n\tFri,  4 May 2018 03:08:52 +0000 (UTC)",
            "from xz-mi.redhat.com (ovpn-12-46.pek2.redhat.com [10.72.12.46])\n\tby smtp.corp.redhat.com (Postfix) with ESMTP id 4778211166E0;\n\tFri,  4 May 2018 03:08:48 +0000 (UTC)"
        ],
        "From": "Peter Xu <peterx@redhat.com>",
        "To": "qemu-devel@nongnu.org",
        "Date": "Fri,  4 May 2018 11:08:06 +0800",
        "Message-Id": "<20180504030811.28111-6-peterx@redhat.com>",
        "In-Reply-To": "<20180504030811.28111-1-peterx@redhat.com>",
        "References": "<20180504030811.28111-1-peterx@redhat.com>",
        "X-Scanned-By": "MIMEDefang 2.78 on 10.11.54.3",
        "X-Greylist": [
            "Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.11.55.1]);\n\tFri, 04 May 2018 03:08:52 +0000 (UTC)",
            "inspected by milter-greylist-4.5.16 (mx1.redhat.com\n\t[10.11.55.1]); \n\tFri, 04 May 2018 03:08:52 +0000 (UTC) for IP:'10.11.54.3'\n\tDOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com'\n\tHELO:'smtp.corp.redhat.com' FROM:'peterx@redhat.com' RCPT:''"
        ],
        "X-detected-operating-system": "by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]\n\t[fuzzy]",
        "X-Received-From": "66.187.233.73",
        "Subject": "[Qemu-devel] [PATCH v2 05/10] intel-iommu: introduce\n\tvtd_page_walk_info",
        "X-BeenThere": "qemu-devel@nongnu.org",
        "X-Mailman-Version": "2.1.21",
        "Precedence": "list",
        "List-Id": "<qemu-devel.nongnu.org>",
        "List-Unsubscribe": "<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>",
        "List-Archive": "<http://lists.nongnu.org/archive/html/qemu-devel/>",
        "List-Post": "<mailto:qemu-devel@nongnu.org>",
        "List-Help": "<mailto:qemu-devel-request@nongnu.org?subject=help>",
        "List-Subscribe": "<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>",
        "Cc": "Tian Kevin <kevin.tian@intel.com>, \"Michael S . Tsirkin\" <mst@redhat.com>,\n\tJason Wang <jasowang@redhat.com>, peterx@redhat.com,\n\tAlex Williamson <alex.williamson@redhat.com>,\n\tJintack Lim <jintack@cs.columbia.edu>",
        "Errors-To": "qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org",
        "Sender": "\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>"
    },
    "content": "During the recursive page walking of IOVA page tables, some stack\nvariables are constant variables and never changed during the whole page\nwalking procedure.  Isolate them into a struct so that we don't need to\npass those contants down the stack every time and multiple times.\n\nSigned-off-by: Peter Xu <peterx@redhat.com>\n---\n hw/i386/intel_iommu.c | 56 ++++++++++++++++++++++++++++---------------\n 1 file changed, 37 insertions(+), 19 deletions(-)",
    "diff": "diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c\nindex 9a418abfb6..b2b2a0a441 100644\n--- a/hw/i386/intel_iommu.c\n+++ b/hw/i386/intel_iommu.c\n@@ -747,9 +747,27 @@ static int vtd_iova_to_slpte(VTDContextEntry *ce, uint64_t iova, bool is_write,\n \n typedef int (*vtd_page_walk_hook)(IOMMUTLBEntry *entry, void *private);\n \n+/**\n+ * Constant information used during page walking\n+ *\n+ * @hook_fn: hook func to be called when detected page\n+ * @private: private data to be passed into hook func\n+ * @notify_unmap: whether we should notify invalid entries\n+ * @aw: maximum address width\n+ */\n+typedef struct {\n+    vtd_page_walk_hook hook_fn;\n+    void *private;\n+    bool notify_unmap;\n+    uint8_t aw;\n+} vtd_page_walk_info;\n+\n static int vtd_page_walk_one(IOMMUTLBEntry *entry, int level,\n-                             vtd_page_walk_hook hook_fn, void *private)\n+                             vtd_page_walk_info *info)\n {\n+    vtd_page_walk_hook hook_fn = info->hook_fn;\n+    void *private = info->private;\n+\n     assert(hook_fn);\n     trace_vtd_page_walk_one(level, entry->iova, entry->translated_addr,\n                             entry->addr_mask, entry->perm);\n@@ -762,17 +780,13 @@ static int vtd_page_walk_one(IOMMUTLBEntry *entry, int level,\n  * @addr: base GPA addr to start the walk\n  * @start: IOVA range start address\n  * @end: IOVA range end address (start <= addr < end)\n- * @hook_fn: hook func to be called when detected page\n- * @private: private data to be passed into hook func\n  * @read: whether parent level has read permission\n  * @write: whether parent level has write permission\n- * @notify_unmap: whether we should notify invalid entries\n- * @aw: maximum address width\n+ * @info: constant information for the page walk\n  */\n static int vtd_page_walk_level(dma_addr_t addr, uint64_t start,\n-                               uint64_t end, vtd_page_walk_hook hook_fn,\n-                               void *private, uint32_t level, bool read,\n-                               bool write, bool notify_unmap, uint8_t aw)\n+                               uint64_t end, uint32_t level, bool read,\n+                               bool write, vtd_page_walk_info *info)\n {\n     bool read_cur, write_cur, entry_valid;\n     uint32_t offset;\n@@ -822,24 +836,24 @@ static int vtd_page_walk_level(dma_addr_t addr, uint64_t start,\n \n         if (vtd_is_last_slpte(slpte, level)) {\n             /* NOTE: this is only meaningful if entry_valid == true */\n-            entry.translated_addr = vtd_get_slpte_addr(slpte, aw);\n-            if (!entry_valid && !notify_unmap) {\n+            entry.translated_addr = vtd_get_slpte_addr(slpte, info->aw);\n+            if (!entry_valid && !info->notify_unmap) {\n                 trace_vtd_page_walk_skip_perm(iova, iova_next);\n                 goto next;\n             }\n-            ret = vtd_page_walk_one(&entry, level, hook_fn, private);\n+            ret = vtd_page_walk_one(&entry, level, info);\n             if (ret < 0) {\n                 return ret;\n             }\n         } else {\n             if (!entry_valid) {\n-                if (notify_unmap) {\n+                if (info->notify_unmap) {\n                     /*\n                      * The whole entry is invalid; unmap it all.\n                      * Translated address is meaningless, zero it.\n                      */\n                     entry.translated_addr = 0x0;\n-                    ret = vtd_page_walk_one(&entry, level, hook_fn, private);\n+                    ret = vtd_page_walk_one(&entry, level, info);\n                     if (ret < 0) {\n                         return ret;\n                     }\n@@ -848,10 +862,9 @@ static int vtd_page_walk_level(dma_addr_t addr, uint64_t start,\n                 }\n                 goto next;\n             }\n-            ret = vtd_page_walk_level(vtd_get_slpte_addr(slpte, aw), iova,\n-                                      MIN(iova_next, end), hook_fn, private,\n-                                      level - 1, read_cur, write_cur,\n-                                      notify_unmap, aw);\n+            ret = vtd_page_walk_level(vtd_get_slpte_addr(slpte, info->aw),\n+                                      iova, MIN(iova_next, end), level - 1,\n+                                      read_cur, write_cur, info);\n             if (ret < 0) {\n                 return ret;\n             }\n@@ -880,6 +893,12 @@ static int vtd_page_walk(VTDContextEntry *ce, uint64_t start, uint64_t end,\n {\n     dma_addr_t addr = vtd_ce_get_slpt_base(ce);\n     uint32_t level = vtd_ce_get_level(ce);\n+    vtd_page_walk_info info = {\n+        .hook_fn = hook_fn,\n+        .private = private,\n+        .notify_unmap = notify_unmap,\n+        .aw = aw,\n+    };\n \n     if (!vtd_iova_range_check(start, ce, aw)) {\n         return -VTD_FR_ADDR_BEYOND_MGAW;\n@@ -890,8 +909,7 @@ static int vtd_page_walk(VTDContextEntry *ce, uint64_t start, uint64_t end,\n         end = vtd_iova_limit(ce, aw);\n     }\n \n-    return vtd_page_walk_level(addr, start, end, hook_fn, private,\n-                               level, true, true, notify_unmap, aw);\n+    return vtd_page_walk_level(addr, start, end, level, true, true, &info);\n }\n \n /* Map a device to its corresponding domain (context-entry) */\n",
    "prefixes": [
        "v2",
        "05/10"
    ]
}