get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 908466,
    "url": "http://patchwork.ozlabs.org/api/patches/908466/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20180504030811.28111-7-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-7-peterx@redhat.com>",
    "list_archive_url": null,
    "date": "2018-05-04T03:08:07",
    "name": "[v2,06/10] intel-iommu: pass in address space when page walk",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "893f67e6559a69a3187feeb133158fef513771c9",
    "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-7-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/908466/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/908466/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 40ccX370HLz9s35\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri,  4 May 2018 13:12:51 +1000 (AEST)",
            "from localhost ([::1]:60183 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 1fER9N-0004Lv-Ir\n\tfor incoming@patchwork.ozlabs.org; Thu, 03 May 2018 23:12:49 -0400",
            "from eggs.gnu.org ([2001:4830:134:3::10]:33340)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <peterx@redhat.com>) id 1fER5g-0001qW-Mw\n\tfor qemu-devel@nongnu.org; Thu, 03 May 2018 23:09:01 -0400",
            "from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <peterx@redhat.com>) id 1fER5c-0005gQ-NR\n\tfor qemu-devel@nongnu.org; Thu, 03 May 2018 23:09:00 -0400",
            "from mx3-rdu2.redhat.com ([66.187.233.73]:45908\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 1fER5c-0005fv-Hr\n\tfor qemu-devel@nongnu.org; Thu, 03 May 2018 23:08:56 -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 34172EB706;\n\tFri,  4 May 2018 03:08:56 +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 CE7A711166E0;\n\tFri,  4 May 2018 03:08:52 +0000 (UTC)"
        ],
        "From": "Peter Xu <peterx@redhat.com>",
        "To": "qemu-devel@nongnu.org",
        "Date": "Fri,  4 May 2018 11:08:07 +0800",
        "Message-Id": "<20180504030811.28111-7-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:56 +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:56 +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 06/10] intel-iommu: pass in address space\n\twhen page walk",
        "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": "We pass in the VTDAddressSpace to replace the aw bits when doing page\nwalk.  The VTDAddressSpace contains the aw bits information, meanwhile\nwe'll need to do something more in the follow up patches regarding to\nthe address spaces.\n\nSigned-off-by: Peter Xu <peterx@redhat.com>\n---\n hw/i386/intel_iommu.c | 20 +++++++++++---------\n 1 file changed, 11 insertions(+), 9 deletions(-)",
    "diff": "diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c\nindex b2b2a0a441..83769f2b8c 100644\n--- a/hw/i386/intel_iommu.c\n+++ b/hw/i386/intel_iommu.c\n@@ -753,13 +753,13 @@ typedef int (*vtd_page_walk_hook)(IOMMUTLBEntry *entry, void *private);\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+ * @as: VT-d address space of the device\n  */\n typedef struct {\n+    VTDAddressSpace *as;\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@@ -796,6 +796,7 @@ static int vtd_page_walk_level(dma_addr_t addr, uint64_t start,\n     uint64_t iova = start;\n     uint64_t iova_next;\n     int ret = 0;\n+    uint8_t aw = info->as->iommu_state->aw_bits;\n \n     trace_vtd_page_walk_level(addr, level, start, end);\n \n@@ -836,7 +837,7 @@ 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, info->aw);\n+            entry.translated_addr = vtd_get_slpte_addr(slpte, aw);\n             if (!entry_valid && !info->notify_unmap) {\n                 trace_vtd_page_walk_skip_perm(iova, iova_next);\n                 goto next;\n@@ -862,7 +863,7 @@ 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, info->aw),\n+            ret = vtd_page_walk_level(vtd_get_slpte_addr(slpte, aw),\n                                       iova, MIN(iova_next, end), level - 1,\n                                       read_cur, write_cur, info);\n             if (ret < 0) {\n@@ -885,19 +886,20 @@ next:\n  * @end: IOVA range end address (start <= addr < end)\n  * @hook_fn: the hook that to be called for each detected area\n  * @private: private data for the hook function\n- * @aw: maximum address width\n+ * @as: the VT-d address space of the device\n  */\n static int vtd_page_walk(VTDContextEntry *ce, uint64_t start, uint64_t end,\n                          vtd_page_walk_hook hook_fn, void *private,\n-                         bool notify_unmap, uint8_t aw)\n+                         bool notify_unmap, VTDAddressSpace *as)\n {\n     dma_addr_t addr = vtd_ce_get_slpt_base(ce);\n     uint32_t level = vtd_ce_get_level(ce);\n+    uint8_t aw = as->iommu_state->aw_bits;\n     vtd_page_walk_info info = {\n         .hook_fn = hook_fn,\n         .private = private,\n         .notify_unmap = notify_unmap,\n-        .aw = aw,\n+        .as = as,\n     };\n \n     if (!vtd_iova_range_check(start, ce, aw)) {\n@@ -1470,7 +1472,7 @@ static void vtd_iotlb_page_invalidate_notify(IntelIOMMUState *s,\n                  */\n                 vtd_page_walk(&ce, addr, addr + size,\n                               vtd_page_invalidate_notify_hook,\n-                              (void *)&vtd_as->iommu, true, s->aw_bits);\n+                              (void *)&vtd_as->iommu, true, vtd_as);\n             } else {\n                 /*\n                  * For UNMAP-only notifiers, we don't need to walk the\n@@ -2941,7 +2943,7 @@ static void vtd_iommu_replay(IOMMUMemoryRegion *iommu_mr, IOMMUNotifier *n)\n         if (vtd_as_notify_mappings(vtd_as)) {\n             /* This is required only for MAP typed notifiers */\n             vtd_page_walk(&ce, 0, ~0ULL, vtd_replay_hook, (void *)n, false,\n-                          s->aw_bits);\n+                          vtd_as);\n         }\n     } else {\n         trace_vtd_replay_ce_invalid(bus_n, PCI_SLOT(vtd_as->devfn),\n",
    "prefixes": [
        "v2",
        "06/10"
    ]
}