get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 808929,
    "url": "http://patchwork.ozlabs.org/api/patches/808929/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20170901180340.30009-13-eblake@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": "<20170901180340.30009-13-eblake@redhat.com>",
    "list_archive_url": null,
    "date": "2017-09-01T18:03:23",
    "name": "[v6,12/29] libqos: Track QTestState with QPCIBus",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "cde7b01f3b8fd5e13795eb1bc69f6a3104a7c00a",
    "submitter": {
        "id": 6591,
        "url": "http://patchwork.ozlabs.org/api/people/6591/?format=api",
        "name": "Eric Blake",
        "email": "eblake@redhat.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20170901180340.30009-13-eblake@redhat.com/mbox/",
    "series": [
        {
            "id": 1089,
            "url": "http://patchwork.ozlabs.org/api/series/1089/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=1089",
            "date": "2017-09-01T18:03:12",
            "name": "Preliminary libqtest cleanups",
            "version": 6,
            "mbox": "http://patchwork.ozlabs.org/series/1089/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/808929/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/808929/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>)",
            "ext-mx10.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com",
            "ext-mx10.extmail.prod.ext.phx2.redhat.com;\n\tspf=fail smtp.mailfrom=eblake@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 3xkSCt0s0lz9sPm\n\tfor <incoming@patchwork.ozlabs.org>;\n\tSat,  2 Sep 2017 04:18:17 +1000 (AEST)",
            "from localhost ([::1]:53166 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 1dnqWF-0003k6-In\n\tfor incoming@patchwork.ozlabs.org; Fri, 01 Sep 2017 14:18:15 -0400",
            "from eggs.gnu.org ([2001:4830:134:3::10]:55975)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <eblake@redhat.com>) id 1dnqIg-0007JD-Jx\n\tfor qemu-devel@nongnu.org; Fri, 01 Sep 2017 14:04:20 -0400",
            "from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <eblake@redhat.com>) id 1dnqIe-0001nc-K0\n\tfor qemu-devel@nongnu.org; Fri, 01 Sep 2017 14:04:14 -0400",
            "from mx1.redhat.com ([209.132.183.28]:55558)\n\tby eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)\n\t(Exim 4.71) (envelope-from <eblake@redhat.com>)\n\tid 1dnqIW-0001eY-P2; Fri, 01 Sep 2017 14:04:04 -0400",
            "from smtp.corp.redhat.com\n\t(int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15])\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 868176148E;\n\tFri,  1 Sep 2017 18:04:03 +0000 (UTC)",
            "from red.redhat.com (ovpn-121-149.rdu2.redhat.com [10.10.121.149])\n\tby smtp.corp.redhat.com (Postfix) with ESMTP id 72B59627DE;\n\tFri,  1 Sep 2017 18:03:59 +0000 (UTC)"
        ],
        "DMARC-Filter": "OpenDMARC Filter v1.3.2 mx1.redhat.com 868176148E",
        "From": "Eric Blake <eblake@redhat.com>",
        "To": "qemu-devel@nongnu.org",
        "Date": "Fri,  1 Sep 2017 13:03:23 -0500",
        "Message-Id": "<20170901180340.30009-13-eblake@redhat.com>",
        "In-Reply-To": "<20170901180340.30009-1-eblake@redhat.com>",
        "References": "<20170901180340.30009-1-eblake@redhat.com>",
        "X-Scanned-By": "MIMEDefang 2.79 on 10.5.11.15",
        "X-Greylist": "Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.5.110.39]);\n\tFri, 01 Sep 2017 18:04:03 +0000 (UTC)",
        "X-detected-operating-system": "by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]\n\t[fuzzy]",
        "X-Received-From": "209.132.183.28",
        "Subject": "[Qemu-devel] [PATCH v6 12/29] libqos: Track QTestState with QPCIBus",
        "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": "\"open list:IDE\" <qemu-block@nongnu.org>, Alexander Graf <agraf@suse.de>, \n\tarmbru@redhat.com, \"open list:sPAPR\" <qemu-ppc@nongnu.org>,\n\tGerd Hoffmann <kraxel@redhat.com>, pbonzini@redhat.com,\n\tJohn Snow <jsnow@redhat.com>, David Gibson <david@gibson.dropbear.id.au>",
        "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": "When initializing a QPCIBus, track which QTestState the bus is\nassociated with (so that a later patch can then explicitly use\nthat test state for all communication on the bus, rather than\nblindly relying on global_qtest).  Update the initialization\nfunctions to take another parameter, and update all callers to\npass in state (for now, most callers get away with passing the\ncurrent global_qtest as the current state, although this required\nfixing the order of initialization to ensure qtest_start() is\ncalled before qpci_init*() in rtl8139-test, and provided an\nopportunity to pass in the allocator in e1000e-test).\n\nSigned-off-by: Eric Blake <eblake@redhat.com>\n---\n tests/libqos/ahci.h       | 2 +-\n tests/libqos/libqos.h     | 2 +-\n tests/libqos/pci-pc.h     | 2 +-\n tests/libqos/pci-spapr.h  | 2 +-\n tests/libqos/pci.h        | 1 +\n tests/ahci-test.c         | 2 +-\n tests/e1000e-test.c       | 6 +++---\n tests/i440fx-test.c       | 2 +-\n tests/ide-test.c          | 2 +-\n tests/libqos/ahci.c       | 4 ++--\n tests/libqos/libqos.c     | 4 ++--\n tests/libqos/pci-pc.c     | 5 ++++-\n tests/libqos/pci-spapr.c  | 6 +++++-\n tests/q35-test.c          | 4 ++--\n tests/rtl8139-test.c      | 5 +++--\n tests/tco-test.c          | 2 +-\n tests/usb-hcd-ehci-test.c | 2 +-\n tests/vhost-user-test.c   | 4 ++--\n 18 files changed, 33 insertions(+), 24 deletions(-)",
    "diff": "diff --git a/tests/libqos/ahci.h b/tests/libqos/ahci.h\nindex 5f9627bb0f..715ca1e226 100644\n--- a/tests/libqos/ahci.h\n+++ b/tests/libqos/ahci.h\n@@ -571,7 +571,7 @@ void ahci_free(AHCIQState *ahci, uint64_t addr);\n void ahci_clean_mem(AHCIQState *ahci);\n\n /* Device management */\n-QPCIDevice *get_ahci_device(uint32_t *fingerprint);\n+QPCIDevice *get_ahci_device(QTestState *qts, uint32_t *fingerprint);\n void free_ahci_device(QPCIDevice *dev);\n void ahci_pci_enable(AHCIQState *ahci);\n void start_ahci_device(AHCIQState *ahci);\ndiff --git a/tests/libqos/libqos.h b/tests/libqos/libqos.h\nindex 231969766f..78e5c044a0 100644\n--- a/tests/libqos/libqos.h\n+++ b/tests/libqos/libqos.h\n@@ -10,7 +10,7 @@ typedef struct QOSState QOSState;\n typedef struct QOSOps {\n     QGuestAllocator *(*init_allocator)(QAllocOpts);\n     void (*uninit_allocator)(QGuestAllocator *);\n-    QPCIBus *(*qpci_init)(QGuestAllocator *alloc);\n+    QPCIBus *(*qpci_init)(QTestState *qts, QGuestAllocator *alloc);\n     void (*qpci_free)(QPCIBus *bus);\n     void (*shutdown)(QOSState *);\n } QOSOps;\ndiff --git a/tests/libqos/pci-pc.h b/tests/libqos/pci-pc.h\nindex 9479b51642..491eeac756 100644\n--- a/tests/libqos/pci-pc.h\n+++ b/tests/libqos/pci-pc.h\n@@ -16,7 +16,7 @@\n #include \"libqos/pci.h\"\n #include \"libqos/malloc.h\"\n\n-QPCIBus *qpci_init_pc(QGuestAllocator *alloc);\n+QPCIBus *qpci_init_pc(QTestState *qts, QGuestAllocator *alloc);\n void     qpci_free_pc(QPCIBus *bus);\n\n #endif\ndiff --git a/tests/libqos/pci-spapr.h b/tests/libqos/pci-spapr.h\nindex 4192126d86..387686dfc8 100644\n--- a/tests/libqos/pci-spapr.h\n+++ b/tests/libqos/pci-spapr.h\n@@ -11,7 +11,7 @@\n #include \"libqos/malloc.h\"\n #include \"libqos/pci.h\"\n\n-QPCIBus *qpci_init_spapr(QGuestAllocator *alloc);\n+QPCIBus *qpci_init_spapr(QTestState *qts, QGuestAllocator *alloc);\n void     qpci_free_spapr(QPCIBus *bus);\n\n #endif\ndiff --git a/tests/libqos/pci.h b/tests/libqos/pci.h\nindex ed480614ff..429c382282 100644\n--- a/tests/libqos/pci.h\n+++ b/tests/libqos/pci.h\n@@ -48,6 +48,7 @@ struct QPCIBus {\n     void (*config_writel)(QPCIBus *bus, int devfn,\n                           uint8_t offset, uint32_t value);\n\n+    QTestState *qts;\n     uint16_t pio_alloc_ptr;\n     uint64_t mmio_alloc_ptr, mmio_limit;\n };\ndiff --git a/tests/ahci-test.c b/tests/ahci-test.c\nindex 999121bb7c..c94d1bd712 100644\n--- a/tests/ahci-test.c\n+++ b/tests/ahci-test.c\n@@ -160,7 +160,7 @@ static AHCIQState *ahci_vboot(const char *cli, va_list ap)\n     alloc_set_flags(s->parent->alloc, ALLOC_LEAK_ASSERT);\n\n     /* Verify that we have an AHCI device present. */\n-    s->dev = get_ahci_device(&s->fingerprint);\n+    s->dev = get_ahci_device(s->parent->qts, &s->fingerprint);\n\n     return s;\n }\ndiff --git a/tests/e1000e-test.c b/tests/e1000e-test.c\nindex c612dc64ec..d8085d944e 100644\n--- a/tests/e1000e-test.c\n+++ b/tests/e1000e-test.c\n@@ -392,12 +392,12 @@ static void data_test_init(e1000e_device *d)\n     qtest_start(cmdline);\n     g_free(cmdline);\n\n-    test_bus = qpci_init_pc(NULL);\n-    g_assert_nonnull(test_bus);\n-\n     test_alloc = pc_alloc_init();\n     g_assert_nonnull(test_alloc);\n\n+    test_bus = qpci_init_pc(global_qtest, test_alloc);\n+    g_assert_nonnull(test_bus);\n+\n     e1000e_device_init(test_bus, d);\n }\n\ndiff --git a/tests/i440fx-test.c b/tests/i440fx-test.c\nindex e9d05c87d1..4390e5591e 100644\n--- a/tests/i440fx-test.c\n+++ b/tests/i440fx-test.c\n@@ -38,7 +38,7 @@ static QPCIBus *test_start_get_bus(const TestData *s)\n     cmdline = g_strdup_printf(\"-smp %d\", s->num_cpus);\n     qtest_start(cmdline);\n     g_free(cmdline);\n-    return qpci_init_pc(NULL);\n+    return qpci_init_pc(global_qtest, NULL);\n }\n\n static void test_i440fx_defaults(gconstpointer opaque)\ndiff --git a/tests/ide-test.c b/tests/ide-test.c\nindex aa9de065fc..b2237b6158 100644\n--- a/tests/ide-test.c\n+++ b/tests/ide-test.c\n@@ -143,7 +143,7 @@ static QPCIDevice *get_pci_device(QPCIBar *bmdma_bar, QPCIBar *ide_bar)\n     uint16_t vendor_id, device_id;\n\n     if (!pcibus) {\n-        pcibus = qpci_init_pc(NULL);\n+        pcibus = qpci_init_pc(global_qtest, NULL);\n     }\n\n     /* Find PCI device and verify it's the right one */\ndiff --git a/tests/libqos/ahci.c b/tests/libqos/ahci.c\nindex 1ca7f456b5..790ef991b3 100644\n--- a/tests/libqos/ahci.c\n+++ b/tests/libqos/ahci.c\n@@ -123,13 +123,13 @@ bool is_atapi(AHCIQState *ahci, uint8_t port)\n /**\n  * Locate, verify, and return a handle to the AHCI device.\n  */\n-QPCIDevice *get_ahci_device(uint32_t *fingerprint)\n+QPCIDevice *get_ahci_device(QTestState *qts, uint32_t *fingerprint)\n {\n     QPCIDevice *ahci;\n     uint32_t ahci_fingerprint;\n     QPCIBus *pcibus;\n\n-    pcibus = qpci_init_pc(NULL);\n+    pcibus = qpci_init_pc(qts, NULL);\n\n     /* Find the AHCI PCI device and verify it's the right one. */\n     ahci = qpci_device_find(pcibus, QPCI_DEVFN(0x1F, 0x02));\ndiff --git a/tests/libqos/libqos.c b/tests/libqos/libqos.c\nindex 6226546c28..c95428e1cb 100644\n--- a/tests/libqos/libqos.c\n+++ b/tests/libqos/libqos.c\n@@ -26,8 +26,8 @@ QOSState *qtest_vboot(QOSOps *ops, const char *cmdline_fmt, va_list ap)\n         if (ops->init_allocator) {\n             qs->alloc = ops->init_allocator(ALLOC_NO_FLAGS);\n         }\n-        if (ops->qpci_init && qs->alloc) {\n-            qs->pcibus = ops->qpci_init(qs->alloc);\n+        if (ops->qpci_init) {\n+            qs->pcibus = ops->qpci_init(qs->qts, qs->alloc);\n         }\n     }\n\ndiff --git a/tests/libqos/pci-pc.c b/tests/libqos/pci-pc.c\nindex 02ce49927a..85b34c6d13 100644\n--- a/tests/libqos/pci-pc.c\n+++ b/tests/libqos/pci-pc.c\n@@ -115,11 +115,14 @@ static void qpci_pc_config_writel(QPCIBus *bus, int devfn, uint8_t offset, uint3\n     outl(0xcfc, value);\n }\n\n-QPCIBus *qpci_init_pc(QGuestAllocator *alloc)\n+QPCIBus *qpci_init_pc(QTestState *qts, QGuestAllocator *alloc)\n {\n     QPCIBusPC *ret;\n\n+    assert(qts);\n+\n     ret = g_malloc(sizeof(*ret));\n+    ret->bus.qts = qts;\n\n     ret->bus.pio_readb = qpci_pc_pio_readb;\n     ret->bus.pio_readw = qpci_pc_pio_readw;\ndiff --git a/tests/libqos/pci-spapr.c b/tests/libqos/pci-spapr.c\nindex 2043f1e123..cd9b8f52d2 100644\n--- a/tests/libqos/pci-spapr.c\n+++ b/tests/libqos/pci-spapr.c\n@@ -154,11 +154,14 @@ static void qpci_spapr_config_writel(QPCIBus *bus, int devfn, uint8_t offset,\n #define SPAPR_PCI_MMIO32_WIN_SIZE    0x80000000 /* 2 GiB */\n #define SPAPR_PCI_IO_WIN_SIZE        0x10000\n\n-QPCIBus *qpci_init_spapr(QGuestAllocator *alloc)\n+QPCIBus *qpci_init_spapr(QTestState *qts, QGuestAllocator *alloc)\n {\n     QPCIBusSPAPR *ret;\n\n+    assert(qts);\n+\n     ret = g_malloc(sizeof(*ret));\n+    ret->bus.qts = qts;\n\n     ret->alloc = alloc;\n\n@@ -201,6 +204,7 @@ QPCIBus *qpci_init_spapr(QGuestAllocator *alloc)\n     ret->bus.mmio_alloc_ptr = ret->mmio32.pci_base;\n     ret->bus.mmio_limit = ret->mmio32.pci_base + ret->mmio32.size;\n\n+\n     return &ret->bus;\n }\n\ndiff --git a/tests/q35-test.c b/tests/q35-test.c\nindex f98bed7a2d..e149c4c51d 100644\n--- a/tests/q35-test.c\n+++ b/tests/q35-test.c\n@@ -86,7 +86,7 @@ static void test_smram_lock(void)\n\n     qtest_start(\"-M q35\");\n\n-    pcibus = qpci_init_pc(NULL);\n+    pcibus = qpci_init_pc(global_qtest, NULL);\n     g_assert(pcibus != NULL);\n\n     pcidev = qpci_device_find(pcibus, 0);\n@@ -145,7 +145,7 @@ static void test_tseg_size(const void *data)\n     g_free(cmdline);\n\n     /* locate the DRAM controller */\n-    pcibus = qpci_init_pc(NULL);\n+    pcibus = qpci_init_pc(global_qtest, NULL);\n     g_assert(pcibus != NULL);\n     pcidev = qpci_device_find(pcibus, 0);\n     g_assert(pcidev != NULL);\ndiff --git a/tests/rtl8139-test.c b/tests/rtl8139-test.c\nindex 7de7dc45ae..68bfc42178 100644\n--- a/tests/rtl8139-test.c\n+++ b/tests/rtl8139-test.c\n@@ -35,7 +35,7 @@ static QPCIDevice *get_device(void)\n {\n     QPCIDevice *dev;\n\n-    pcibus = qpci_init_pc(NULL);\n+    pcibus = qpci_init_pc(global_qtest, NULL);\n     qpci_device_foreach(pcibus, 0x10ec, 0x8139, save_fn, &dev);\n     g_assert(dev != NULL);\n\n@@ -197,11 +197,12 @@ int main(int argc, char **argv)\n {\n     int ret;\n\n+    qtest_start(\"-device rtl8139\");\n+\n     g_test_init(&argc, &argv, NULL);\n     qtest_add_func(\"/rtl8139/nop\", nop);\n     qtest_add_func(\"/rtl8139/timer\", test_init);\n\n-    qtest_start(\"-device rtl8139\");\n     ret = g_test_run();\n\n     qtest_end();\ndiff --git a/tests/tco-test.c b/tests/tco-test.c\nindex f2ed6ed91c..0387971953 100644\n--- a/tests/tco-test.c\n+++ b/tests/tco-test.c\n@@ -64,7 +64,7 @@ static void test_init(TestData *d)\n     qtest_irq_intercept_in(qs, \"ioapic\");\n     g_free(s);\n\n-    d->bus = qpci_init_pc(NULL);\n+    d->bus = qpci_init_pc(qs, NULL);\n     d->dev = qpci_device_find(d->bus, QPCI_DEVFN(0x1f, 0x00));\n     g_assert(d->dev != NULL);\n\ndiff --git a/tests/usb-hcd-ehci-test.c b/tests/usb-hcd-ehci-test.c\nindex 944eb1c088..55d4743a2a 100644\n--- a/tests/usb-hcd-ehci-test.c\n+++ b/tests/usb-hcd-ehci-test.c\n@@ -52,7 +52,7 @@ static void ehci_port_test(struct qhc *hc, int port, uint32_t expect)\n\n static void test_init(void)\n {\n-    pcibus = qpci_init_pc(NULL);\n+    pcibus = qpci_init_pc(global_qtest, NULL);\n     g_assert(pcibus != NULL);\n\n     qusb_pci_init_one(pcibus, &uhci1, QPCI_DEVFN(0x1d, 0), 4);\ndiff --git a/tests/vhost-user-test.c b/tests/vhost-user-test.c\nindex d4da09f147..ea7d38ea44 100644\n--- a/tests/vhost-user-test.c\n+++ b/tests/vhost-user-test.c\n@@ -164,7 +164,7 @@ static void init_virtio_dev(TestServer *s)\n     QVirtioPCIDevice *dev;\n     uint32_t features;\n\n-    s->bus = qpci_init_pc(NULL);\n+    s->bus = qpci_init_pc(global_qtest, NULL);\n     g_assert_nonnull(s->bus);\n\n     dev = qvirtio_pci_device_find(s->bus, VIRTIO_ID_NET);\n@@ -891,7 +891,7 @@ static void test_multiqueue(void)\n     qtest_start(cmd);\n     g_free(cmd);\n\n-    bus = qpci_init_pc(NULL);\n+    bus = qpci_init_pc(global_qtest, NULL);\n     dev = virtio_net_pci_init(bus, PCI_SLOT);\n\n     alloc = pc_alloc_init();\n",
    "prefixes": [
        "v6",
        "12/29"
    ]
}