[{"id":1761936,"web_url":"http://patchwork.ozlabs.org/comment/1761936/","msgid":"<13667793-2b90-2e9d-4582-6087258adfc2@amsat.org>","list_archive_url":null,"date":"2017-09-01T19:20:46","subject":"Re: [Qemu-devel] [PATCH v6 12/29] libqos: Track QTestState with\n\tQPCIBus","submitter":{"id":70924,"url":"http://patchwork.ozlabs.org/api/people/70924/","name":"Philippe Mathieu-Daudé","email":"f4bug@amsat.org"},"content":"Hi Eric,\n\nOn 09/01/2017 03:03 PM, Eric Blake wrote:\n> When initializing a QPCIBus, track which QTestState the bus is\n> associated with (so that a later patch can then explicitly use\n> that test state for all communication on the bus, rather than\n> blindly relying on global_qtest).  Update the initialization\n> functions to take another parameter, and update all callers to\n> pass in state (for now, most callers get away with passing the\n> current global_qtest as the current state, although this required\n> fixing the order of initialization to ensure qtest_start() is\n> called before qpci_init*() in rtl8139-test, and provided an\n> opportunity to pass in the allocator in e1000e-test).\n> \n> Signed-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(-)\n> \n> diff --git a/tests/libqos/ahci.h b/tests/libqos/ahci.h\n> index 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);\n> diff --git a/tests/libqos/libqos.h b/tests/libqos/libqos.h\n> index 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;\n> diff --git a/tests/libqos/pci-pc.h b/tests/libqos/pci-pc.h\n> index 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\n> diff --git a/tests/libqos/pci-spapr.h b/tests/libqos/pci-spapr.h\n> index 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\n> diff --git a/tests/libqos/pci.h b/tests/libqos/pci.h\n> index 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>   };\n> diff --git a/tests/ahci-test.c b/tests/ahci-test.c\n> index 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>   }\n> diff --git a/tests/e1000e-test.c b/tests/e1000e-test.c\n> index 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> \n> diff --git a/tests/i440fx-test.c b/tests/i440fx-test.c\n> index 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)\n> diff --git a/tests/ide-test.c b/tests/ide-test.c\n> index 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 */\n> diff --git a/tests/libqos/ahci.c b/tests/libqos/ahci.c\n> index 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));\n> diff --git a/tests/libqos/libqos.c b/tests/libqos/libqos.c\n> index 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> \n> diff --git a/tests/libqos/pci-pc.c b/tests/libqos/pci-pc.c\n> index 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\nI'd rather use g_malloc0() here (safer!)\n\n> +    ret->bus.qts = qts;\n> \n>       ret->bus.pio_readb = qpci_pc_pio_readb;\n>       ret->bus.pio_readw = qpci_pc_pio_readw;\n\nor init qts field in same order than struct:\n\n...\n         ret->bus.config_writel = qpci_pc_config_writel;\n\n+       ret->bus.qts = qts;\n\n         ret->bus.pio_alloc_ptr = 0xc000;\n...\n\n> diff --git a/tests/libqos/pci-spapr.c b/tests/libqos/pci-spapr.c\n> index 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\nsame\n\nEither ways:\nReviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>\n\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> \n> diff --git a/tests/q35-test.c b/tests/q35-test.c\n> index 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);\n> diff --git a/tests/rtl8139-test.c b/tests/rtl8139-test.c\n> index 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();\n> diff --git a/tests/tco-test.c b/tests/tco-test.c\n> index 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> \n> diff --git a/tests/usb-hcd-ehci-test.c b/tests/usb-hcd-ehci-test.c\n> index 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);\n> diff --git a/tests/vhost-user-test.c b/tests/vhost-user-test.c\n> index 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>","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\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"a51zoSri\"; dkim-atps=neutral"],"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 3xkTd120rfz9sPt\n\tfor <incoming@patchwork.ozlabs.org>;\n\tSat,  2 Sep 2017 05:21:41 +1000 (AEST)","from localhost ([::1]:56368 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 1dnrVb-0002Zd-8z\n\tfor incoming@patchwork.ozlabs.org; Fri, 01 Sep 2017 15:21:39 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:37633)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <philippe.mathieu.daude@gmail.com>)\n\tid 1dnrV3-0002O2-85\n\tfor qemu-devel@nongnu.org; Fri, 01 Sep 2017 15:21:10 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <philippe.mathieu.daude@gmail.com>)\n\tid 1dnrUz-0002wU-Vu\n\tfor qemu-devel@nongnu.org; Fri, 01 Sep 2017 15:21:05 -0400","from mail-qk0-x244.google.com ([2607:f8b0:400d:c09::244]:33294)\n\tby eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)\n\t(Exim 4.71) (envelope-from <philippe.mathieu.daude@gmail.com>)\n\tid 1dnrUq-0002qo-6T; Fri, 01 Sep 2017 15:20:52 -0400","by mail-qk0-x244.google.com with SMTP id k126so842814qkb.0;\n\tFri, 01 Sep 2017 12:20:52 -0700 (PDT)","from [192.168.1.10] ([181.93.89.178])\n\tby smtp.gmail.com with ESMTPSA id\n\tq11sm706670qtf.16.2017.09.01.12.20.47\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tFri, 01 Sep 2017 12:20:50 -0700 (PDT)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;\n\th=sender:subject:to:cc:references:from:message-id:date:user-agent\n\t:mime-version:in-reply-to:content-language:content-transfer-encoding; \n\tbh=pPD+7ZRHwNJkM665d0qRh3WNfLtDnS9h40Ui0aJLeRA=;\n\tb=a51zoSriB7XmDVv7iWl3VXhael1MMGIxRF2IzDqAJrECka3tP6WCBG5ztT7KEkcXeA\n\tzK+GoI461mRye3nPdznyXa/tleyuiTsftb2aNPs2jb/M+ObR1bhhgb2BWs4+MNxcKz+T\n\tkidpTF9IDA9q4hfiH42ZzTUc5Pq36vTGw1noMeS92zuRPPtl97X93GSppjM3MzfP8irm\n\t9nfEvuxICgJlyXN6fTI1pQrpzPQgYiZ1IqeZ6tbTshNbtbWbsy0Ehd7j78dqo6U7iHsW\n\tq9nrdZGiYp+G64mBXRwby9v1DzlMSfPNWkYX8gR022f4b4PiO1AR6w+3R/Bx8zWssEUo\n\tmf/Q==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:sender:subject:to:cc:references:from:message-id\n\t:date:user-agent:mime-version:in-reply-to:content-language\n\t:content-transfer-encoding;\n\tbh=pPD+7ZRHwNJkM665d0qRh3WNfLtDnS9h40Ui0aJLeRA=;\n\tb=G5XBXgxJ9+HfZEs9ud22HYbuV+Xux/FaY0NOGlusChYNbmS+vV/CPGDV4mojAGr+T8\n\tV4cHgEITcN+Nrqj+g0DleuJaHZJBZNZERdN50P8XtwErFNE5U2mWh6SDqSWzrcQOyAO3\n\tlEQmoIwtp2NiHc/JKpLgQiYjRMmYWTQfsIe/BdYex1pt43r/5tSCQVvMnI2au+Sfa+PR\n\tNWx1Aw/e5loDkNNy82lt/Sbw2ZIfi7ckvhxn9Xe8NLexSuzwIGr9VzItZSLBDRPA4d9t\n\tA4tYapZcpo8XIeZ8gyxgPOIjCnGZOhkGz9b/SxMKl/MwovODAnBHvYy5/ZvQWCxzreW9\n\tURDg==","X-Gm-Message-State":"AHPjjUiKcLdzmAEQLRGOq1CcPu1p7rKBZnXthCwxYKSAHKqQAn8hn0ff\n\tInaiX+7tX89NNg==","X-Google-Smtp-Source":"ADKCNb5vzPQFCciRvfia5Smuj1ZStgQku3k/Zl1zMyoSMpullEghjVDwmgjO+U6xCZ3JYDEK8Qiwkw==","X-Received":"by 10.55.18.101 with SMTP id c98mr4485305qkh.12.1504293651333;\n\tFri, 01 Sep 2017 12:20:51 -0700 (PDT)","To":"Eric Blake <eblake@redhat.com>, qemu-devel@nongnu.org","References":"<20170901180340.30009-1-eblake@redhat.com>\n\t<20170901180340.30009-13-eblake@redhat.com>","From":"=?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= <f4bug@amsat.org>","Message-ID":"<13667793-2b90-2e9d-4582-6087258adfc2@amsat.org>","Date":"Fri, 1 Sep 2017 16:20:46 -0300","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101\n\tThunderbird/52.3.0","MIME-Version":"1.0","In-Reply-To":"<20170901180340.30009-13-eblake@redhat.com>","Content-Type":"text/plain; charset=utf-8; format=flowed","Content-Language":"en-US","Content-Transfer-Encoding":"8bit","X-detected-operating-system":"by eggs.gnu.org: Genre and OS details not\n\trecognized.","X-Received-From":"2607:f8b0:400d:c09::244","Subject":"Re: [Qemu-devel] [PATCH v6 12/29] libqos: Track QTestState with\n\tQPCIBus","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>"}},{"id":1762027,"web_url":"http://patchwork.ozlabs.org/comment/1762027/","msgid":"<2d7182a4-f425-f330-8b8f-d13982af6531@redhat.com>","list_archive_url":null,"date":"2017-09-01T23:06:14","subject":"Re: [Qemu-devel] [PATCH v6 12/29] libqos: Track QTestState with\n\tQPCIBus","submitter":{"id":64343,"url":"http://patchwork.ozlabs.org/api/people/64343/","name":"John Snow","email":"jsnow@redhat.com"},"content":"On 09/01/2017 02:03 PM, Eric Blake wrote:\n> When initializing a QPCIBus, track which QTestState the bus is\n> associated with (so that a later patch can then explicitly use\n> that test state for all communication on the bus, rather than\n> blindly relying on global_qtest).  Update the initialization\n> functions to take another parameter, and update all callers to\n> pass in state (for now, most callers get away with passing the\n> current global_qtest as the current state, although this required\n> fixing the order of initialization to ensure qtest_start() is\n> called before qpci_init*() in rtl8139-test, and provided an\n> opportunity to pass in the allocator in e1000e-test).\n> \n> Signed-off-by: Eric Blake <eblake@redhat.com>\n\nReviewed-by: John Snow <jsnow@redhat.com>","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-mx09.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com","ext-mx09.extmail.prod.ext.phx2.redhat.com;\n\tspf=fail smtp.mailfrom=jsnow@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 3xkZdF0xZCz9sMN\n\tfor <incoming@patchwork.ozlabs.org>;\n\tSat,  2 Sep 2017 09:07:13 +1000 (AEST)","from localhost ([::1]:37634 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 1dnv1q-00039Q-8z\n\tfor incoming@patchwork.ozlabs.org; Fri, 01 Sep 2017 19:07:10 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:57368)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <jsnow@redhat.com>) id 1dnv1C-00036y-CS\n\tfor qemu-devel@nongnu.org; Fri, 01 Sep 2017 19:06:33 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <jsnow@redhat.com>) id 1dnv1B-0007sV-Ep\n\tfor qemu-devel@nongnu.org; Fri, 01 Sep 2017 19:06:30 -0400","from mx1.redhat.com ([209.132.183.28]:44726)\n\tby eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)\n\t(Exim 4.71) (envelope-from <jsnow@redhat.com>)\n\tid 1dnv13-0007nt-Eh; Fri, 01 Sep 2017 19:06:21 -0400","from smtp.corp.redhat.com\n\t(int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11])\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 452EB404302;\n\tFri,  1 Sep 2017 23:06:20 +0000 (UTC)","from [10.18.17.130] (dhcp-17-130.bos.redhat.com [10.18.17.130])\n\tby smtp.corp.redhat.com (Postfix) with ESMTP id 3DB4E19E6B;\n\tFri,  1 Sep 2017 23:06:14 +0000 (UTC)"],"DMARC-Filter":"OpenDMARC Filter v1.3.2 mx1.redhat.com 452EB404302","To":"Eric Blake <eblake@redhat.com>, qemu-devel@nongnu.org","References":"<20170901180340.30009-1-eblake@redhat.com>\n\t<20170901180340.30009-13-eblake@redhat.com>","From":"John Snow <jsnow@redhat.com>","Message-ID":"<2d7182a4-f425-f330-8b8f-d13982af6531@redhat.com>","Date":"Fri, 1 Sep 2017 19:06:14 -0400","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101\n\tThunderbird/52.2.1","MIME-Version":"1.0","In-Reply-To":"<20170901180340.30009-13-eblake@redhat.com>","Content-Type":"text/plain; charset=utf-8","Content-Language":"en-US","Content-Transfer-Encoding":"7bit","X-Scanned-By":"MIMEDefang 2.79 on 10.5.11.11","X-Greylist":"Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.5.110.38]);\n\tFri, 01 Sep 2017 23:06:20 +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":"Re: [Qemu-devel] [PATCH v6 12/29] libqos: Track QTestState with\n\tQPCIBus","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\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>"}},{"id":1763136,"web_url":"http://patchwork.ozlabs.org/comment/1763136/","msgid":"<28a1f49b-ed07-8c46-eb0c-be9b92d106fe@redhat.com>","list_archive_url":null,"date":"2017-09-05T09:36:00","subject":"Re: [Qemu-devel] [PATCH v6 12/29] libqos: Track QTestState with\n\tQPCIBus","submitter":{"id":66152,"url":"http://patchwork.ozlabs.org/api/people/66152/","name":"Thomas Huth","email":"thuth@redhat.com"},"content":"On 01.09.2017 20:03, Eric Blake wrote:\n> When initializing a QPCIBus, track which QTestState the bus is\n> associated with (so that a later patch can then explicitly use\n> that test state for all communication on the bus, rather than\n> blindly relying on global_qtest).  Update the initialization\n> functions to take another parameter, and update all callers to\n> pass in state (for now, most callers get away with passing the\n> current global_qtest as the current state, although this required\n> fixing the order of initialization to ensure qtest_start() is\n> called before qpci_init*() in rtl8139-test, and provided an\n> opportunity to pass in the allocator in e1000e-test).\n> \n> Signed-off-by: Eric Blake <eblake@redhat.com>\n> ---\n[...]\n> diff --git a/tests/libqos/libqos.c b/tests/libqos/libqos.c\n> index 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\nWhy did you remove the check for qs->alloc?\n\n> +            qs->pcibus = ops->qpci_init(qs->qts, qs->alloc);\n>          }\n>      }\n> \n> diff --git a/tests/libqos/pci-pc.c b/tests/libqos/pci-pc.c\n> index 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;\n> diff --git a/tests/libqos/pci-spapr.c b/tests/libqos/pci-spapr.c\n> index 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\n+1 for using g_malloc0 here instead.\n\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\nSuperfluous white space change.\n\n>      return &ret->bus;\n>  }\n\n Thomas","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-mx05.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com","ext-mx05.extmail.prod.ext.phx2.redhat.com;\n\tspf=fail smtp.mailfrom=thuth@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 3xmhVh1NLZz9s75\n\tfor <incoming@patchwork.ozlabs.org>;\n\tTue,  5 Sep 2017 19:38:51 +1000 (AEST)","from localhost ([::1]:57738 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 1dpAJk-0006Kw-Hd\n\tfor incoming@patchwork.ozlabs.org; Tue, 05 Sep 2017 05:38:48 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:50459)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <thuth@redhat.com>) id 1dpAHX-00050Q-OQ\n\tfor qemu-devel@nongnu.org; Tue, 05 Sep 2017 05:36:37 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <thuth@redhat.com>) id 1dpAHT-0004Qu-17\n\tfor qemu-devel@nongnu.org; Tue, 05 Sep 2017 05:36:31 -0400","from mx1.redhat.com ([209.132.183.28]:8588)\n\tby eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)\n\t(Exim 4.71) (envelope-from <thuth@redhat.com>)\n\tid 1dpAHF-0004Eo-Il; Tue, 05 Sep 2017 05:36:13 -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 7919E5CE;\n\tTue,  5 Sep 2017 09:36:12 +0000 (UTC)","from [10.36.116.114] (ovpn-116-114.ams2.redhat.com [10.36.116.114])\n\tby smtp.corp.redhat.com (Postfix) with ESMTPS id 5C3E884D83;\n\tTue,  5 Sep 2017 09:36:02 +0000 (UTC)"],"DMARC-Filter":"OpenDMARC Filter v1.3.2 mx1.redhat.com 7919E5CE","To":"Eric Blake <eblake@redhat.com>, qemu-devel@nongnu.org","References":"<20170901180340.30009-1-eblake@redhat.com>\n\t<20170901180340.30009-13-eblake@redhat.com>","From":"Thomas Huth <thuth@redhat.com>","Message-ID":"<28a1f49b-ed07-8c46-eb0c-be9b92d106fe@redhat.com>","Date":"Tue, 5 Sep 2017 11:36:00 +0200","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101\n\tThunderbird/52.3.0","MIME-Version":"1.0","In-Reply-To":"<20170901180340.30009-13-eblake@redhat.com>","Content-Type":"text/plain; charset=utf-8","Content-Language":"en-US","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.29]);\n\tTue, 05 Sep 2017 09:36:12 +0000 (UTC)","Content-Transfer-Encoding":"quoted-printable","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":"Re: [Qemu-devel] [PATCH v6 12/29] libqos: Track QTestState with\n\tQPCIBus","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>"}},{"id":1764364,"web_url":"http://patchwork.ozlabs.org/comment/1764364/","msgid":"<757785c4-8a8b-ad76-75f9-48bbec4187b8@redhat.com>","list_archive_url":null,"date":"2017-09-06T20:48:23","subject":"Re: [Qemu-devel] [PATCH v6 12/29] libqos: Track QTestState with\n\tQPCIBus","submitter":{"id":6591,"url":"http://patchwork.ozlabs.org/api/people/6591/","name":"Eric Blake","email":"eblake@redhat.com"},"content":"On 09/01/2017 02:20 PM, Philippe Mathieu-Daudé wrote:\n> Hi Eric,\n> \n> On 09/01/2017 03:03 PM, Eric Blake wrote:\n>> When initializing a QPCIBus, track which QTestState the bus is\n>> associated with (so that a later patch can then explicitly use\n>> that test state for all communication on the bus, rather than\n>> blindly relying on global_qtest).  Update the initialization\n>> functions to take another parameter, and update all callers to\n>> pass in state (for now, most callers get away with passing the\n>> current global_qtest as the current state, although this required\n>> fixing the order of initialization to ensure qtest_start() is\n>> called before qpci_init*() in rtl8139-test, and provided an\n>> opportunity to pass in the allocator in e1000e-test).\n>>\n\n>> +++ b/tests/libqos/pci-pc.c\n>> @@ -115,11 +115,14 @@ static void qpci_pc_config_writel(QPCIBus *bus,\n>> 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> \n> I'd rather use g_malloc0() here (safer!)\n\nPre-existing, but yes, I can touch it while in the area.\n\n> \n>> +    ret->bus.qts = qts;\n>>\n>>       ret->bus.pio_readb = qpci_pc_pio_readb;\n>>       ret->bus.pio_readw = qpci_pc_pio_readw;\n> \n> or init qts field in same order than struct:\n\nOkay.\n\n> \n> Either ways:\n> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>\n>","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-mx09.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com","ext-mx09.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 3xnbKg4PBqz9sRY\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu,  7 Sep 2017 06:49:11 +1000 (AEST)","from localhost ([::1]:37734 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 1dphG1-0002Zy-MT\n\tfor incoming@patchwork.ozlabs.org; Wed, 06 Sep 2017 16:49:09 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:57627)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <eblake@redhat.com>) id 1dphFX-0002Xu-Bs\n\tfor qemu-devel@nongnu.org; Wed, 06 Sep 2017 16:48:40 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <eblake@redhat.com>) id 1dphFW-0004g2-AW\n\tfor qemu-devel@nongnu.org; Wed, 06 Sep 2017 16:48:39 -0400","from mx1.redhat.com ([209.132.183.28]:14907)\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 1dphFQ-0004dp-92; Wed, 06 Sep 2017 16:48:32 -0400","from smtp.corp.redhat.com\n\t(int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11])\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 0FC174E34A;\n\tWed,  6 Sep 2017 20:48:31 +0000 (UTC)","from [10.10.120.228] (ovpn-120-228.rdu2.redhat.com [10.10.120.228])\n\tby smtp.corp.redhat.com (Postfix) with ESMTP id E16046031A;\n\tWed,  6 Sep 2017 20:48:24 +0000 (UTC)"],"DMARC-Filter":"OpenDMARC Filter v1.3.2 mx1.redhat.com 0FC174E34A","To":"=?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= <f4bug@amsat.org>,\n\tqemu-devel@nongnu.org","References":"<20170901180340.30009-1-eblake@redhat.com>\n\t<20170901180340.30009-13-eblake@redhat.com>\n\t<13667793-2b90-2e9d-4582-6087258adfc2@amsat.org>","From":"Eric Blake <eblake@redhat.com>","Openpgp":"url=http://people.redhat.com/eblake/eblake.gpg","Organization":"Red Hat, Inc.","Message-ID":"<757785c4-8a8b-ad76-75f9-48bbec4187b8@redhat.com>","Date":"Wed, 6 Sep 2017 15:48:23 -0500","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101\n\tThunderbird/52.3.0","MIME-Version":"1.0","In-Reply-To":"<13667793-2b90-2e9d-4582-6087258adfc2@amsat.org>","Content-Type":"multipart/signed; micalg=pgp-sha256;\n\tprotocol=\"application/pgp-signature\";\n\tboundary=\"WPXFrUrWWltjwb5XUgP8J1HhIhThEr4Pg\"","X-Scanned-By":"MIMEDefang 2.79 on 10.5.11.11","X-Greylist":"Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.5.110.38]);\n\tWed, 06 Sep 2017 20:48:31 +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","X-Content-Filtered-By":"Mailman/MimeDel 2.1.21","Subject":"Re: [Qemu-devel] [PATCH v6 12/29] libqos: Track QTestState with\n\tQPCIBus","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>"}},{"id":1764374,"web_url":"http://patchwork.ozlabs.org/comment/1764374/","msgid":"<1a55f8d5-b4d3-85c7-dab4-472ccc4dca52@redhat.com>","list_archive_url":null,"date":"2017-09-06T21:00:06","subject":"Re: [Qemu-devel] [PATCH v6 12/29] libqos: Track QTestState with\n\tQPCIBus","submitter":{"id":6591,"url":"http://patchwork.ozlabs.org/api/people/6591/","name":"Eric Blake","email":"eblake@redhat.com"},"content":"On 09/05/2017 04:36 AM, Thomas Huth wrote:\n> On 01.09.2017 20:03, Eric Blake wrote:\n>> When initializing a QPCIBus, track which QTestState the bus is\n>> associated with (so that a later patch can then explicitly use\n>> that test state for all communication on the bus, rather than\n>> blindly relying on global_qtest).  Update the initialization\n>> functions to take another parameter, and update all callers to\n>> pass in state (for now, most callers get away with passing the\n>> current global_qtest as the current state, although this required\n>> fixing the order of initialization to ensure qtest_start() is\n>> called before qpci_init*() in rtl8139-test, and provided an\n>> opportunity to pass in the allocator in e1000e-test).\n>>\n>> Signed-off-by: Eric Blake <eblake@redhat.com>\n>> ---\n> [...]\n>> diff --git a/tests/libqos/libqos.c b/tests/libqos/libqos.c\n>> index 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> \n> Why did you remove the check for qs->alloc?\n> \n>> +            qs->pcibus = ops->qpci_init(qs->qts, qs->alloc);\n\nBecause we want to ensure qpci_init() is called to set qs->qts\n(presumably, whether or not qs->alloc is set).  Furthermore, only two\nfiles declare a 'static QOSOps' structure in the first place\n(libqos-pc.c and libqos-spapr.c); where both files set both the\n.init_allocator and .qpci_init callbacks; a little bit of auditing shows\nthat the .init_allocator() never returns NULL (although that requires\nbrowsing yet more files for malloc-{pc,spapr}.c).","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-mx02.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com","ext-mx02.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 3xnbbX3QtPz9s7C\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu,  7 Sep 2017 07:01:12 +1000 (AEST)","from localhost ([::1]:37757 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 1dphRe-0005VV-IT\n\tfor incoming@patchwork.ozlabs.org; Wed, 06 Sep 2017 17:01:10 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:59902)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <eblake@redhat.com>) id 1dphQz-0005Rh-KS\n\tfor qemu-devel@nongnu.org; Wed, 06 Sep 2017 17:00:33 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <eblake@redhat.com>) id 1dphQy-00029Q-Ga\n\tfor qemu-devel@nongnu.org; Wed, 06 Sep 2017 17:00:29 -0400","from mx1.redhat.com ([209.132.183.28]:51502)\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 1dphQp-00023E-9B; Wed, 06 Sep 2017 17:00:19 -0400","from smtp.corp.redhat.com\n\t(int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12])\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 D6145883A0;\n\tWed,  6 Sep 2017 21:00:17 +0000 (UTC)","from [10.10.120.228] (ovpn-120-228.rdu2.redhat.com [10.10.120.228])\n\tby smtp.corp.redhat.com (Postfix) with ESMTP id E98441880B;\n\tWed,  6 Sep 2017 21:00:08 +0000 (UTC)"],"DMARC-Filter":"OpenDMARC Filter v1.3.2 mx1.redhat.com D6145883A0","To":"Thomas Huth <thuth@redhat.com>, qemu-devel@nongnu.org","References":"<20170901180340.30009-1-eblake@redhat.com>\n\t<20170901180340.30009-13-eblake@redhat.com>\n\t<28a1f49b-ed07-8c46-eb0c-be9b92d106fe@redhat.com>","From":"Eric Blake <eblake@redhat.com>","Openpgp":"url=http://people.redhat.com/eblake/eblake.gpg","Organization":"Red Hat, Inc.","Message-ID":"<1a55f8d5-b4d3-85c7-dab4-472ccc4dca52@redhat.com>","Date":"Wed, 6 Sep 2017 16:00:06 -0500","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101\n\tThunderbird/52.3.0","MIME-Version":"1.0","In-Reply-To":"<28a1f49b-ed07-8c46-eb0c-be9b92d106fe@redhat.com>","Content-Type":"multipart/signed; micalg=pgp-sha256;\n\tprotocol=\"application/pgp-signature\";\n\tboundary=\"Wv8QlqHUme5KXPQ4PupFMKlIrwFwI5Bur\"","X-Scanned-By":"MIMEDefang 2.79 on 10.5.11.12","X-Greylist":"Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.5.110.26]);\n\tWed, 06 Sep 2017 21:00:18 +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","X-Content-Filtered-By":"Mailman/MimeDel 2.1.21","Subject":"Re: [Qemu-devel] [PATCH v6 12/29] libqos: Track QTestState with\n\tQPCIBus","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>"}},{"id":1764510,"web_url":"http://patchwork.ozlabs.org/comment/1764510/","msgid":"<a0e0335b-2d2f-6220-e2f7-24ef01bc2bad@redhat.com>","list_archive_url":null,"date":"2017-09-07T05:35:01","subject":"Re: [Qemu-devel] [PATCH v6 12/29] libqos: Track QTestState with\n\tQPCIBus","submitter":{"id":66152,"url":"http://patchwork.ozlabs.org/api/people/66152/","name":"Thomas Huth","email":"thuth@redhat.com"},"content":"On 06.09.2017 23:00, Eric Blake wrote:\n> On 09/05/2017 04:36 AM, Thomas Huth wrote:\n>> On 01.09.2017 20:03, Eric Blake wrote:\n>>> When initializing a QPCIBus, track which QTestState the bus is\n>>> associated with (so that a later patch can then explicitly use\n>>> that test state for all communication on the bus, rather than\n>>> blindly relying on global_qtest).  Update the initialization\n>>> functions to take another parameter, and update all callers to\n>>> pass in state (for now, most callers get away with passing the\n>>> current global_qtest as the current state, although this required\n>>> fixing the order of initialization to ensure qtest_start() is\n>>> called before qpci_init*() in rtl8139-test, and provided an\n>>> opportunity to pass in the allocator in e1000e-test).\n>>>\n>>> Signed-off-by: Eric Blake <eblake@redhat.com>\n>>> ---\n>> [...]\n>>> diff --git a/tests/libqos/libqos.c b/tests/libqos/libqos.c\n>>> index 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>>\n>> Why did you remove the check for qs->alloc?\n>>\n>>> +            qs->pcibus = ops->qpci_init(qs->qts, qs->alloc);\n> \n> Because we want to ensure qpci_init() is called to set qs->qts\n> (presumably, whether or not qs->alloc is set).  Furthermore, only two\n> files declare a 'static QOSOps' structure in the first place\n> (libqos-pc.c and libqos-spapr.c); where both files set both the\n> .init_allocator and .qpci_init callbacks; a little bit of auditing shows\n> that the .init_allocator() never returns NULL (although that requires\n> browsing yet more files for malloc-{pc,spapr}.c).\n\nOK, thanks for the explanation! ... but maybe we should\ng_assert(gs->alloc) somewhere instead? ... just an idea, I'm also fine\nif you leave it away.\n\n Thomas","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-mx05.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com","ext-mx05.extmail.prod.ext.phx2.redhat.com;\n\tspf=fail smtp.mailfrom=thuth@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 3xnq1W0Sp8z9sNV\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu,  7 Sep 2017 15:35:55 +1000 (AEST)","from localhost ([::1]:38900 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 1dppTi-0000r5-Bk\n\tfor incoming@patchwork.ozlabs.org; Thu, 07 Sep 2017 01:35:50 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:32958)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <thuth@redhat.com>) id 1dppTJ-0000p0-Mc\n\tfor qemu-devel@nongnu.org; Thu, 07 Sep 2017 01:35:30 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <thuth@redhat.com>) id 1dppTI-0002dX-N0\n\tfor qemu-devel@nongnu.org; Thu, 07 Sep 2017 01:35:25 -0400","from mx1.redhat.com ([209.132.183.28]:38044)\n\tby eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)\n\t(Exim 4.71) (envelope-from <thuth@redhat.com>)\n\tid 1dppTA-0002am-8L; Thu, 07 Sep 2017 01:35:16 -0400","from smtp.corp.redhat.com\n\t(int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12])\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 419E513A91;\n\tThu,  7 Sep 2017 05:35:14 +0000 (UTC)","from [10.36.116.66] (ovpn-116-66.ams2.redhat.com [10.36.116.66])\n\tby smtp.corp.redhat.com (Postfix) with ESMTPS id C905C18A47;\n\tThu,  7 Sep 2017 05:35:07 +0000 (UTC)"],"DMARC-Filter":"OpenDMARC Filter v1.3.2 mx1.redhat.com 419E513A91","To":"Eric Blake <eblake@redhat.com>, qemu-devel@nongnu.org","References":"<20170901180340.30009-1-eblake@redhat.com>\n\t<20170901180340.30009-13-eblake@redhat.com>\n\t<28a1f49b-ed07-8c46-eb0c-be9b92d106fe@redhat.com>\n\t<1a55f8d5-b4d3-85c7-dab4-472ccc4dca52@redhat.com>","From":"Thomas Huth <thuth@redhat.com>","Message-ID":"<a0e0335b-2d2f-6220-e2f7-24ef01bc2bad@redhat.com>","Date":"Thu, 7 Sep 2017 07:35:01 +0200","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101\n\tThunderbird/52.3.0","MIME-Version":"1.0","In-Reply-To":"<1a55f8d5-b4d3-85c7-dab4-472ccc4dca52@redhat.com>","Content-Type":"multipart/signed; micalg=pgp-sha1;\n\tprotocol=\"application/pgp-signature\";\n\tboundary=\"W2CKhcAKGrFw176w37XndFR58q8QHXm1H\"","X-Scanned-By":"MIMEDefang 2.79 on 10.5.11.12","X-Greylist":"Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.5.110.29]);\n\tThu, 07 Sep 2017 05:35:14 +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":"Re: [Qemu-devel] [PATCH v6 12/29] libqos: Track QTestState with\n\tQPCIBus","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>"}},{"id":1764729,"web_url":"http://patchwork.ozlabs.org/comment/1764729/","msgid":"<b601702b-1a77-27cb-64f3-ffd6f441d0b3@redhat.com>","list_archive_url":null,"date":"2017-09-07T13:32:41","subject":"Re: [Qemu-devel] [PATCH v6 12/29] libqos: Track QTestState with\n\tQPCIBus","submitter":{"id":6591,"url":"http://patchwork.ozlabs.org/api/people/6591/","name":"Eric Blake","email":"eblake@redhat.com"},"content":"On 09/07/2017 12:35 AM, Thomas Huth wrote:\n> On 06.09.2017 23:00, Eric Blake wrote:\n>> On 09/05/2017 04:36 AM, Thomas Huth wrote:\n>>> On 01.09.2017 20:03, Eric Blake wrote:\n>>>> When initializing a QPCIBus, track which QTestState the bus is\n>>>> associated with (so that a later patch can then explicitly use\n>>>> that test state for all communication on the bus, rather than\n>>>> blindly relying on global_qtest).  Update the initialization\n>>>> functions to take another parameter, and update all callers to\n>>>> pass in state (for now, most callers get away with passing the\n>>>> current global_qtest as the current state, although this required\n>>>> fixing the order of initialization to ensure qtest_start() is\n>>>> called before qpci_init*() in rtl8139-test, and provided an\n>>>> opportunity to pass in the allocator in e1000e-test).\n>>>>\n\n>>>\n>>> Why did you remove the check for qs->alloc?\n>>>\n>>>> +            qs->pcibus = ops->qpci_init(qs->qts, qs->alloc);\n>>\n>> Because we want to ensure qpci_init() is called to set qs->qts\n>> (presumably, whether or not qs->alloc is set).  Furthermore, only two\n>> files declare a 'static QOSOps' structure in the first place\n>> (libqos-pc.c and libqos-spapr.c); where both files set both the\n>> .init_allocator and .qpci_init callbacks; a little bit of auditing shows\n>> that the .init_allocator() never returns NULL (although that requires\n>> browsing yet more files for malloc-{pc,spapr}.c).\n> \n> OK, thanks for the explanation! ... but maybe we should\n> g_assert(gs->alloc) somewhere instead? ... just an idea, I'm also fine\n> if you leave it away.\n\nUsers of QOSOps always supply qs->alloc, but there are tests that\nsuccessfully use NULL for qs->alloc (because they did not go through\nQOSOps).  At any rate, I can certainly update the commit message.","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-mx04.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com","ext-mx04.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 3xp1r96Nslz9sRV\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu,  7 Sep 2017 23:43:37 +1000 (AEST)","from localhost ([::1]:40548 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 1dpx5j-0005bJ-RI\n\tfor incoming@patchwork.ozlabs.org; Thu, 07 Sep 2017 09:43:35 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:58620)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <eblake@redhat.com>) id 1dpwvd-00051Z-2t\n\tfor qemu-devel@nongnu.org; Thu, 07 Sep 2017 09:33:18 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <eblake@redhat.com>) id 1dpwvY-0001dw-5o\n\tfor qemu-devel@nongnu.org; Thu, 07 Sep 2017 09:33:09 -0400","from mx1.redhat.com ([209.132.183.28]:45190)\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 1dpwvL-0001ZI-1V; Thu, 07 Sep 2017 09:32:51 -0400","from smtp.corp.redhat.com\n\t(int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12])\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 C849B85550;\n\tThu,  7 Sep 2017 13:32:49 +0000 (UTC)","from [10.10.120.228] (ovpn-120-228.rdu2.redhat.com [10.10.120.228])\n\tby smtp.corp.redhat.com (Postfix) with ESMTP id 16F4F18B23;\n\tThu,  7 Sep 2017 13:32:41 +0000 (UTC)"],"DMARC-Filter":"OpenDMARC Filter v1.3.2 mx1.redhat.com C849B85550","To":"Thomas Huth <thuth@redhat.com>, qemu-devel@nongnu.org","References":"<20170901180340.30009-1-eblake@redhat.com>\n\t<20170901180340.30009-13-eblake@redhat.com>\n\t<28a1f49b-ed07-8c46-eb0c-be9b92d106fe@redhat.com>\n\t<1a55f8d5-b4d3-85c7-dab4-472ccc4dca52@redhat.com>\n\t<a0e0335b-2d2f-6220-e2f7-24ef01bc2bad@redhat.com>","From":"Eric Blake <eblake@redhat.com>","Openpgp":"url=http://people.redhat.com/eblake/eblake.gpg","Organization":"Red Hat, Inc.","Message-ID":"<b601702b-1a77-27cb-64f3-ffd6f441d0b3@redhat.com>","Date":"Thu, 7 Sep 2017 08:32:41 -0500","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101\n\tThunderbird/52.3.0","MIME-Version":"1.0","In-Reply-To":"<a0e0335b-2d2f-6220-e2f7-24ef01bc2bad@redhat.com>","Content-Type":"multipart/signed; micalg=pgp-sha256;\n\tprotocol=\"application/pgp-signature\";\n\tboundary=\"rc06sNRGVPXfGJe2kkIva9n7LTJC6mvd5\"","X-Scanned-By":"MIMEDefang 2.79 on 10.5.11.12","X-Greylist":"Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.5.110.28]);\n\tThu, 07 Sep 2017 13:32:50 +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","X-Content-Filtered-By":"Mailman/MimeDel 2.1.21","Subject":"Re: [Qemu-devel] [PATCH v6 12/29] libqos: Track QTestState with\n\tQPCIBus","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>"}}]