Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/808924/?format=api
{ "id": 808924, "url": "http://patchwork.ozlabs.org/api/patches/808924/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20170901180340.30009-15-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-15-eblake@redhat.com>", "list_archive_url": null, "date": "2017-09-01T18:03:25", "name": "[v6,14/29] libqos: Use explicit QTestState for fw_cfg operations", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "c60d698ddadb8637ee16f26447f425dc0953bb49", "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-15-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/808924/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/808924/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-mx07.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com", "ext-mx07.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 3xkS6G3khmz9s06\n\tfor <incoming@patchwork.ozlabs.org>;\n\tSat, 2 Sep 2017 04:13:26 +1000 (AEST)", "from localhost ([::1]:53131 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 1dnqRY-0007Tb-Cp\n\tfor incoming@patchwork.ozlabs.org; Fri, 01 Sep 2017 14:13:24 -0400", "from eggs.gnu.org ([2001:4830:134:3::10]:56101)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <eblake@redhat.com>) id 1dnqIn-0007Pe-2s\n\tfor qemu-devel@nongnu.org; Fri, 01 Sep 2017 14:04:23 -0400", "from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <eblake@redhat.com>) id 1dnqIh-0001qu-Kn\n\tfor qemu-devel@nongnu.org; Fri, 01 Sep 2017 14:04:21 -0400", "from mx1.redhat.com ([209.132.183.28]:35128)\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 1dnqIZ-0001iK-RB; Fri, 01 Sep 2017 14:04:08 -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 D80BCC0467C4;\n\tFri, 1 Sep 2017 18:04:06 +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 7ACE6627DE;\n\tFri, 1 Sep 2017 18:04:05 +0000 (UTC)" ], "DMARC-Filter": "OpenDMARC Filter v1.3.2 mx1.redhat.com D80BCC0467C4", "From": "Eric Blake <eblake@redhat.com>", "To": "qemu-devel@nongnu.org", "Date": "Fri, 1 Sep 2017 13:03:25 -0500", "Message-Id": "<20170901180340.30009-15-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.31]);\n\tFri, 01 Sep 2017 18:04:07 +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 14/29] libqos: Use explicit QTestState for\n\tfw_cfg operations", "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\tpbonzini@redhat.com, John Snow <jsnow@redhat.com>,\n\tDavid 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": "Drop one more client of global_qtest by teaching all fw_cfg test\nfunctionality (invoked through alloc-pc) to pass in an explicit\nQTestState, adjusting all callers. In particular, fw_cfg-test\nhad to reorder things to create the test state prior to creating\nthe fw_cfg.\n\nSigned-off-by: Eric Blake <eblake@redhat.com>\n---\n tests/libqos/fw_cfg.h | 10 ++++++----\n tests/libqos/libqos.h | 2 +-\n tests/libqos/malloc-pc.h | 4 ++--\n tests/libqos/malloc-spapr.h | 2 +-\n tests/libqos/malloc.h | 1 +\n tests/boot-order-test.c | 6 +++---\n tests/e1000e-test.c | 2 +-\n tests/fw_cfg-test.c | 14 ++++++--------\n tests/ide-test.c | 2 +-\n tests/libqos/fw_cfg.c | 14 ++++++++------\n tests/libqos/libqos.c | 2 +-\n tests/libqos/malloc-pc.c | 8 ++++----\n tests/libqos/malloc-spapr.c | 4 ++--\n tests/vhost-user-test.c | 2 +-\n 14 files changed, 38 insertions(+), 35 deletions(-)", "diff": "diff --git a/tests/libqos/fw_cfg.h b/tests/libqos/fw_cfg.h\nindex e8371b2317..396dd4ee1e 100644\n--- a/tests/libqos/fw_cfg.h\n+++ b/tests/libqos/fw_cfg.h\n@@ -15,10 +15,12 @@\n\n\n typedef struct QFWCFG QFWCFG;\n+typedef struct QTestState QTestState;\n\n struct QFWCFG\n {\n uint64_t base;\n+ QTestState *qts;\n void (*select)(QFWCFG *fw_cfg, uint16_t key);\n void (*read)(QFWCFG *fw_cfg, void *data, size_t len);\n };\n@@ -30,12 +32,12 @@ uint16_t qfw_cfg_get_u16(QFWCFG *fw_cfg, uint16_t key);\n uint32_t qfw_cfg_get_u32(QFWCFG *fw_cfg, uint16_t key);\n uint64_t qfw_cfg_get_u64(QFWCFG *fw_cfg, uint16_t key);\n\n-QFWCFG *mm_fw_cfg_init(uint64_t base);\n-QFWCFG *io_fw_cfg_init(uint16_t base);\n+QFWCFG *mm_fw_cfg_init(QTestState *qts, uint64_t base);\n+QFWCFG *io_fw_cfg_init(QTestState *qts, uint16_t base);\n\n-static inline QFWCFG *pc_fw_cfg_init(void)\n+static inline QFWCFG *pc_fw_cfg_init(QTestState *qts)\n {\n- return io_fw_cfg_init(0x510);\n+ return io_fw_cfg_init(qts, 0x510);\n }\n\n #endif\ndiff --git a/tests/libqos/libqos.h b/tests/libqos/libqos.h\nindex 78e5c044a0..07d4b93d1d 100644\n--- a/tests/libqos/libqos.h\n+++ b/tests/libqos/libqos.h\n@@ -8,7 +8,7 @@\n typedef struct QOSState QOSState;\n\n typedef struct QOSOps {\n- QGuestAllocator *(*init_allocator)(QAllocOpts);\n+ QGuestAllocator *(*init_allocator)(QTestState *qts, QAllocOpts);\n void (*uninit_allocator)(QGuestAllocator *);\n QPCIBus *(*qpci_init)(QTestState *qts, QGuestAllocator *alloc);\n void (*qpci_free)(QPCIBus *bus);\ndiff --git a/tests/libqos/malloc-pc.h b/tests/libqos/malloc-pc.h\nindex 86ab9f0429..10f3da6cf2 100644\n--- a/tests/libqos/malloc-pc.h\n+++ b/tests/libqos/malloc-pc.h\n@@ -15,8 +15,8 @@\n\n #include \"libqos/malloc.h\"\n\n-QGuestAllocator *pc_alloc_init(void);\n-QGuestAllocator *pc_alloc_init_flags(QAllocOpts flags);\n+QGuestAllocator *pc_alloc_init(QTestState *qts);\n+QGuestAllocator *pc_alloc_init_flags(QTestState *qts, QAllocOpts flags);\n void pc_alloc_uninit(QGuestAllocator *allocator);\n\n #endif\ndiff --git a/tests/libqos/malloc-spapr.h b/tests/libqos/malloc-spapr.h\nindex 64d0e770d1..52a9346a26 100644\n--- a/tests/libqos/malloc-spapr.h\n+++ b/tests/libqos/malloc-spapr.h\n@@ -11,7 +11,7 @@\n #include \"libqos/malloc.h\"\n\n QGuestAllocator *spapr_alloc_init(void);\n-QGuestAllocator *spapr_alloc_init_flags(QAllocOpts flags);\n+QGuestAllocator *spapr_alloc_init_flags(QTestState *qts, QAllocOpts flags);\n void spapr_alloc_uninit(QGuestAllocator *allocator);\n\n #endif\ndiff --git a/tests/libqos/malloc.h b/tests/libqos/malloc.h\nindex ae9dac8f61..828fddabdb 100644\n--- a/tests/libqos/malloc.h\n+++ b/tests/libqos/malloc.h\n@@ -14,6 +14,7 @@\n #define LIBQOS_MALLOC_H\n\n #include \"qemu/queue.h\"\n+#include \"libqtest.h\"\n\n typedef enum {\n ALLOC_NO_FLAGS = 0x00,\ndiff --git a/tests/boot-order-test.c b/tests/boot-order-test.c\nindex 9d516830dd..5fc2ca8e9e 100644\n--- a/tests/boot-order-test.c\n+++ b/tests/boot-order-test.c\n@@ -135,7 +135,7 @@ static void test_prep_boot_order(void)\n\n static uint64_t read_boot_order_pmac(void)\n {\n- QFWCFG *fw_cfg = mm_fw_cfg_init(0xf0000510);\n+ QFWCFG *fw_cfg = mm_fw_cfg_init(global_qtest, 0xf0000510);\n\n return qfw_cfg_get_u16(fw_cfg, FW_CFG_BOOT_DEVICE);\n }\n@@ -160,7 +160,7 @@ static void test_pmac_newworld_boot_order(void)\n\n static uint64_t read_boot_order_sun4m(void)\n {\n- QFWCFG *fw_cfg = mm_fw_cfg_init(0xd00000510ULL);\n+ QFWCFG *fw_cfg = mm_fw_cfg_init(global_qtest, 0xd00000510ULL);\n\n return qfw_cfg_get_u16(fw_cfg, FW_CFG_BOOT_DEVICE);\n }\n@@ -172,7 +172,7 @@ static void test_sun4m_boot_order(void)\n\n static uint64_t read_boot_order_sun4u(void)\n {\n- QFWCFG *fw_cfg = io_fw_cfg_init(0x510);\n+ QFWCFG *fw_cfg = io_fw_cfg_init(global_qtest, 0x510);\n\n return qfw_cfg_get_u16(fw_cfg, FW_CFG_BOOT_DEVICE);\n }\ndiff --git a/tests/e1000e-test.c b/tests/e1000e-test.c\nindex d8085d944e..32aa738b72 100644\n--- a/tests/e1000e-test.c\n+++ b/tests/e1000e-test.c\n@@ -392,7 +392,7 @@ static void data_test_init(e1000e_device *d)\n qtest_start(cmdline);\n g_free(cmdline);\n\n- test_alloc = pc_alloc_init();\n+ test_alloc = pc_alloc_init(global_qtest);\n g_assert_nonnull(test_alloc);\n\n test_bus = qpci_init_pc(global_qtest, test_alloc);\ndiff --git a/tests/fw_cfg-test.c b/tests/fw_cfg-test.c\nindex 688342bed5..47596c57a1 100644\n--- a/tests/fw_cfg-test.c\n+++ b/tests/fw_cfg-test.c\n@@ -107,7 +107,11 @@ int main(int argc, char **argv)\n\n g_test_init(&argc, &argv, NULL);\n\n- fw_cfg = pc_fw_cfg_init();\n+ cmdline = g_strdup_printf(\"-uuid 4600cb32-38ec-4b2f-8acb-81c6ea54f2d8 \");\n+ s = qtest_start(cmdline);\n+ g_free(cmdline);\n+\n+ fw_cfg = pc_fw_cfg_init(s);\n\n qtest_add_func(\"fw_cfg/signature\", test_fw_cfg_signature);\n qtest_add_func(\"fw_cfg/id\", test_fw_cfg_id);\n@@ -125,15 +129,9 @@ int main(int argc, char **argv)\n qtest_add_func(\"fw_cfg/numa\", test_fw_cfg_numa);\n qtest_add_func(\"fw_cfg/boot_menu\", test_fw_cfg_boot_menu);\n\n- cmdline = g_strdup_printf(\"-uuid 4600cb32-38ec-4b2f-8acb-81c6ea54f2d8 \");\n- s = qtest_start(cmdline);\n- g_free(cmdline);\n-\n ret = g_test_run();\n\n- if (s) {\n- qtest_quit(s);\n- }\n+ qtest_quit(s);\n\n return ret;\n }\ndiff --git a/tests/ide-test.c b/tests/ide-test.c\nindex b2237b6158..084f6a5f96 100644\n--- a/tests/ide-test.c\n+++ b/tests/ide-test.c\n@@ -125,7 +125,7 @@ static void ide_test_start(const char *cmdline_fmt, ...)\n va_end(ap);\n\n qtest_start(cmdline);\n- guest_malloc = pc_alloc_init();\n+ guest_malloc = pc_alloc_init(global_qtest);\n\n g_free(cmdline);\n }\ndiff --git a/tests/libqos/fw_cfg.c b/tests/libqos/fw_cfg.c\nindex 4d9dc3fd0b..d0889d1e22 100644\n--- a/tests/libqos/fw_cfg.c\n+++ b/tests/libqos/fw_cfg.c\n@@ -56,7 +56,7 @@ uint64_t qfw_cfg_get_u64(QFWCFG *fw_cfg, uint16_t key)\n\n static void mm_fw_cfg_select(QFWCFG *fw_cfg, uint16_t key)\n {\n- writew(fw_cfg->base, key);\n+ qtest_writew(fw_cfg->qts, fw_cfg->base, key);\n }\n\n static void mm_fw_cfg_read(QFWCFG *fw_cfg, void *data, size_t len)\n@@ -65,15 +65,16 @@ static void mm_fw_cfg_read(QFWCFG *fw_cfg, void *data, size_t len)\n int i;\n\n for (i = 0; i < len; i++) {\n- ptr[i] = readb(fw_cfg->base + 2);\n+ ptr[i] = qtest_readb(fw_cfg->qts, fw_cfg->base + 2);\n }\n }\n\n-QFWCFG *mm_fw_cfg_init(uint64_t base)\n+QFWCFG *mm_fw_cfg_init(QTestState *qts, uint64_t base)\n {\n QFWCFG *fw_cfg = g_malloc0(sizeof(*fw_cfg));\n\n fw_cfg->base = base;\n+ fw_cfg->qts = qts;\n fw_cfg->select = mm_fw_cfg_select;\n fw_cfg->read = mm_fw_cfg_read;\n\n@@ -82,7 +83,7 @@ QFWCFG *mm_fw_cfg_init(uint64_t base)\n\n static void io_fw_cfg_select(QFWCFG *fw_cfg, uint16_t key)\n {\n- outw(fw_cfg->base, key);\n+ qtest_outw(fw_cfg->qts, fw_cfg->base, key);\n }\n\n static void io_fw_cfg_read(QFWCFG *fw_cfg, void *data, size_t len)\n@@ -91,15 +92,16 @@ static void io_fw_cfg_read(QFWCFG *fw_cfg, void *data, size_t len)\n int i;\n\n for (i = 0; i < len; i++) {\n- ptr[i] = inb(fw_cfg->base + 1);\n+ ptr[i] = qtest_inb(fw_cfg->qts, fw_cfg->base + 1);\n }\n }\n\n-QFWCFG *io_fw_cfg_init(uint16_t base)\n+QFWCFG *io_fw_cfg_init(QTestState *qts, uint16_t base)\n {\n QFWCFG *fw_cfg = g_malloc0(sizeof(*fw_cfg));\n\n fw_cfg->base = base;\n+ fw_cfg->qts = qts;\n fw_cfg->select = io_fw_cfg_select;\n fw_cfg->read = io_fw_cfg_read;\n\ndiff --git a/tests/libqos/libqos.c b/tests/libqos/libqos.c\nindex c95428e1cb..62d2f39b93 100644\n--- a/tests/libqos/libqos.c\n+++ b/tests/libqos/libqos.c\n@@ -24,7 +24,7 @@ QOSState *qtest_vboot(QOSOps *ops, const char *cmdline_fmt, va_list ap)\n qs->ops = ops;\n if (ops) {\n if (ops->init_allocator) {\n- qs->alloc = ops->init_allocator(ALLOC_NO_FLAGS);\n+ qs->alloc = ops->init_allocator(qs->qts, ALLOC_NO_FLAGS);\n }\n if (ops->qpci_init) {\n qs->pcibus = ops->qpci_init(qs->qts, qs->alloc);\ndiff --git a/tests/libqos/malloc-pc.c b/tests/libqos/malloc-pc.c\nindex dd2b900c5f..634b9c288a 100644\n--- a/tests/libqos/malloc-pc.c\n+++ b/tests/libqos/malloc-pc.c\n@@ -29,11 +29,11 @@ void pc_alloc_uninit(QGuestAllocator *allocator)\n alloc_uninit(allocator);\n }\n\n-QGuestAllocator *pc_alloc_init_flags(QAllocOpts flags)\n+QGuestAllocator *pc_alloc_init_flags(QTestState *qts, QAllocOpts flags)\n {\n QGuestAllocator *s;\n uint64_t ram_size;\n- QFWCFG *fw_cfg = pc_fw_cfg_init();\n+ QFWCFG *fw_cfg = pc_fw_cfg_init(qts);\n\n ram_size = qfw_cfg_get_u64(fw_cfg, FW_CFG_RAM_SIZE);\n s = alloc_init_flags(flags, 1 << 20, MIN(ram_size, 0xE0000000));\n@@ -45,7 +45,7 @@ QGuestAllocator *pc_alloc_init_flags(QAllocOpts flags)\n return s;\n }\n\n-inline QGuestAllocator *pc_alloc_init(void)\n+inline QGuestAllocator *pc_alloc_init(QTestState *qts)\n {\n- return pc_alloc_init_flags(ALLOC_NO_FLAGS);\n+ return pc_alloc_init_flags(qts, ALLOC_NO_FLAGS);\n }\ndiff --git a/tests/libqos/malloc-spapr.c b/tests/libqos/malloc-spapr.c\nindex 006404af33..1c359cea6c 100644\n--- a/tests/libqos/malloc-spapr.c\n+++ b/tests/libqos/malloc-spapr.c\n@@ -22,7 +22,7 @@ void spapr_alloc_uninit(QGuestAllocator *allocator)\n alloc_uninit(allocator);\n }\n\n-QGuestAllocator *spapr_alloc_init_flags(QAllocOpts flags)\n+QGuestAllocator *spapr_alloc_init_flags(QTestState *qts, QAllocOpts flags)\n {\n QGuestAllocator *s;\n\n@@ -34,5 +34,5 @@ QGuestAllocator *spapr_alloc_init_flags(QAllocOpts flags)\n\n QGuestAllocator *spapr_alloc_init(void)\n {\n- return spapr_alloc_init_flags(ALLOC_NO_FLAGS);\n+ return spapr_alloc_init_flags(NULL, ALLOC_NO_FLAGS);\n }\ndiff --git a/tests/vhost-user-test.c b/tests/vhost-user-test.c\nindex ea7d38ea44..562bfaefd2 100644\n--- a/tests/vhost-user-test.c\n+++ b/tests/vhost-user-test.c\n@@ -894,7 +894,7 @@ static void test_multiqueue(void)\n bus = qpci_init_pc(global_qtest, NULL);\n dev = virtio_net_pci_init(bus, PCI_SLOT);\n\n- alloc = pc_alloc_init();\n+ alloc = pc_alloc_init(global_qtest);\n for (i = 0; i < queues * 2; i++) {\n vq[i] = (QVirtQueuePCI *)qvirtqueue_setup(&dev->vdev, alloc, i);\n }\n", "prefixes": [ "v6", "14/29" ] }