qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Huth <thuth@redhat.com>
To: Eric Blake <eblake@redhat.com>, qemu-devel@nongnu.org
Cc: pbonzini@redhat.com, Laurent Vivier <lvivier@redhat.com>,
	qemu-ppc@nongnu.org, armbru@redhat.com,
	David Gibson <david@gibson.dropbear.id.au>
Subject: Re: [Qemu-devel] [PATCH v6 15/29] libqos: Use explicit QTestState for rtas operations
Date: Tue, 5 Sep 2017 12:16:20 +0200	[thread overview]
Message-ID: <7ba1c642-f17d-8f55-ae14-18b8bd55fa9d@redhat.com> (raw)
In-Reply-To: <20170901180340.30009-16-eblake@redhat.com>

On 01.09.2017 20:03, Eric Blake wrote:
> Drop one more client of global_qtest by teaching all rtas test
> functionality to pass in an explicit QTestState, adjusting all
> callers.
> 
> Signed-off-by: Eric Blake <eblake@redhat.com>
> ---
>  tests/libqos/rtas.h      |  9 ++++++---
>  tests/libqos/pci-spapr.c | 18 ++++++++++++------
>  tests/libqos/rtas.c      | 21 ++++++++++++---------
>  tests/rtas-test.c        |  2 +-
>  4 files changed, 31 insertions(+), 19 deletions(-)
> 
> diff --git a/tests/libqos/rtas.h b/tests/libqos/rtas.h
> index 498eb19230..e3d0f850a7 100644
> --- a/tests/libqos/rtas.h
> +++ b/tests/libqos/rtas.h
> @@ -7,9 +7,12 @@
>  #define LIBQOS_RTAS_H
>  #include "libqos/malloc.h"
> 
> -int qrtas_get_time_of_day(QGuestAllocator *alloc, struct tm *tm, uint32_t *ns);
> -uint32_t qrtas_ibm_read_pci_config(QGuestAllocator *alloc, uint64_t buid,
> +int qrtas_get_time_of_day(QTestState *qts, QGuestAllocator *alloc,
> +                          struct tm *tm, uint32_t *ns);
> +uint32_t qrtas_ibm_read_pci_config(QTestState *qts, QGuestAllocator *alloc,
> +                                   uint64_t buid,
>                                     uint32_t addr, uint32_t size);
> -int qrtas_ibm_write_pci_config(QGuestAllocator *alloc, uint64_t buid,
> +int qrtas_ibm_write_pci_config(QTestState *qts, QGuestAllocator *alloc,
> +                               uint64_t buid,
>                                 uint32_t addr, uint32_t size, uint32_t val);
>  #endif /* LIBQOS_RTAS_H */
> diff --git a/tests/libqos/pci-spapr.c b/tests/libqos/pci-spapr.c
> index d7b2aa75e6..b7199501b4 100644
> --- a/tests/libqos/pci-spapr.c
> +++ b/tests/libqos/pci-spapr.c
> @@ -108,21 +108,24 @@ static uint8_t qpci_spapr_config_readb(QPCIBus *bus, int devfn, uint8_t offset)
>  {
>      QPCIBusSPAPR *s = container_of(bus, QPCIBusSPAPR, bus);
>      uint32_t config_addr = (devfn << 8) | offset;
> -    return qrtas_ibm_read_pci_config(s->alloc, s->buid, config_addr, 1);
> +    return qrtas_ibm_read_pci_config(bus->qts, s->alloc, s->buid,
> +                                     config_addr, 1);
>  }
> 
>  static uint16_t qpci_spapr_config_readw(QPCIBus *bus, int devfn, uint8_t offset)
>  {
>      QPCIBusSPAPR *s = container_of(bus, QPCIBusSPAPR, bus);
>      uint32_t config_addr = (devfn << 8) | offset;
> -    return qrtas_ibm_read_pci_config(s->alloc, s->buid, config_addr, 2);
> +    return qrtas_ibm_read_pci_config(bus->qts, s->alloc, s->buid,
> +                                     config_addr, 2);
>  }
> 
>  static uint32_t qpci_spapr_config_readl(QPCIBus *bus, int devfn, uint8_t offset)
>  {
>      QPCIBusSPAPR *s = container_of(bus, QPCIBusSPAPR, bus);
>      uint32_t config_addr = (devfn << 8) | offset;
> -    return qrtas_ibm_read_pci_config(s->alloc, s->buid, config_addr, 4);
> +    return qrtas_ibm_read_pci_config(bus->qts, s->alloc, s->buid,
> +                                     config_addr, 4);
>  }
> 
>  static void qpci_spapr_config_writeb(QPCIBus *bus, int devfn, uint8_t offset,
> @@ -130,7 +133,8 @@ static void qpci_spapr_config_writeb(QPCIBus *bus, int devfn, uint8_t offset,
>  {
>      QPCIBusSPAPR *s = container_of(bus, QPCIBusSPAPR, bus);
>      uint32_t config_addr = (devfn << 8) | offset;
> -    qrtas_ibm_write_pci_config(s->alloc, s->buid, config_addr, 1, value);
> +    qrtas_ibm_write_pci_config(bus->qts, s->alloc, s->buid,
> +                               config_addr, 1, value);
>  }
> 
>  static void qpci_spapr_config_writew(QPCIBus *bus, int devfn, uint8_t offset,
> @@ -138,7 +142,8 @@ static void qpci_spapr_config_writew(QPCIBus *bus, int devfn, uint8_t offset,
>  {
>      QPCIBusSPAPR *s = container_of(bus, QPCIBusSPAPR, bus);
>      uint32_t config_addr = (devfn << 8) | offset;
> -    qrtas_ibm_write_pci_config(s->alloc, s->buid, config_addr, 2, value);
> +    qrtas_ibm_write_pci_config(bus->qts, s->alloc, s->buid,
> +                               config_addr, 2, value);
>  }
> 
>  static void qpci_spapr_config_writel(QPCIBus *bus, int devfn, uint8_t offset,
> @@ -146,7 +151,8 @@ static void qpci_spapr_config_writel(QPCIBus *bus, int devfn, uint8_t offset,
>  {
>      QPCIBusSPAPR *s = container_of(bus, QPCIBusSPAPR, bus);
>      uint32_t config_addr = (devfn << 8) | offset;
> -    qrtas_ibm_write_pci_config(s->alloc, s->buid, config_addr, 4, value);
> +    qrtas_ibm_write_pci_config(bus->qts, s->alloc, s->buid,
> +                               config_addr, 4, value);
>  }
> 
>  #define SPAPR_PCI_BASE               (1ULL << 45)
> diff --git a/tests/libqos/rtas.c b/tests/libqos/rtas.c
> index 0269803ce0..fb25f91723 100644
> --- a/tests/libqos/rtas.c
> +++ b/tests/libqos/rtas.c
> @@ -26,7 +26,8 @@ static void qrtas_copy_ret(uint64_t target_ret, uint32_t nret, uint32_t *ret)
>      }
>  }
> 
> -static uint64_t qrtas_call(QGuestAllocator *alloc, const char *name,
> +static uint64_t qrtas_call(QTestState *qts, QGuestAllocator *alloc,
> +                           const char *name,
>                             uint32_t nargs, uint32_t *args,
>                             uint32_t nret, uint32_t *ret)
>  {
> @@ -37,8 +38,7 @@ static uint64_t qrtas_call(QGuestAllocator *alloc, const char *name,
>      target_ret = guest_alloc(alloc, nret * sizeof(uint32_t));
> 
>      qrtas_copy_args(target_args, nargs, args);
> -    res = qtest_rtas_call(global_qtest, name,
> -                          nargs, target_args, nret, target_ret);
> +    res = qtest_rtas_call(qts, name, nargs, target_args, nret, target_ret);
>      qrtas_copy_ret(target_ret, nret, ret);
> 
>      guest_free(alloc, target_ret);
> @@ -47,12 +47,13 @@ static uint64_t qrtas_call(QGuestAllocator *alloc, const char *name,
>      return res;
>  }
> 
> -int qrtas_get_time_of_day(QGuestAllocator *alloc, struct tm *tm, uint32_t *ns)
> +int qrtas_get_time_of_day(QTestState *qts, QGuestAllocator *alloc,
> +                          struct tm *tm, uint32_t *ns)
>  {
>      int res;
>      uint32_t ret[8];
> 
> -    res = qrtas_call(alloc, "get-time-of-day", 0, NULL, 8, ret);
> +    res = qrtas_call(qts, alloc, "get-time-of-day", 0, NULL, 8, ret);
>      if (res != 0) {
>          return res;
>      }
> @@ -70,7 +71,8 @@ int qrtas_get_time_of_day(QGuestAllocator *alloc, struct tm *tm, uint32_t *ns)
>      return res;
>  }
> 
> -uint32_t qrtas_ibm_read_pci_config(QGuestAllocator *alloc, uint64_t buid,
> +uint32_t qrtas_ibm_read_pci_config(QTestState *qts, QGuestAllocator *alloc,
> +                                   uint64_t buid,
>                                     uint32_t addr, uint32_t size)
>  {
>      int res;
> @@ -80,7 +82,7 @@ uint32_t qrtas_ibm_read_pci_config(QGuestAllocator *alloc, uint64_t buid,
>      args[1] = buid >> 32;
>      args[2] = buid & 0xffffffff;
>      args[3] = size;
> -    res = qrtas_call(alloc, "ibm,read-pci-config", 4, args, 2, ret);
> +    res = qrtas_call(qts, alloc, "ibm,read-pci-config", 4, args, 2, ret);
>      if (res != 0) {
>          return -1;
>      }
> @@ -92,7 +94,8 @@ uint32_t qrtas_ibm_read_pci_config(QGuestAllocator *alloc, uint64_t buid,
>      return ret[1];
>  }
> 
> -int qrtas_ibm_write_pci_config(QGuestAllocator *alloc, uint64_t buid,
> +int qrtas_ibm_write_pci_config(QTestState *qts, QGuestAllocator *alloc,
> +                               uint64_t buid,
>                                 uint32_t addr, uint32_t size, uint32_t val)
>  {
>      int res;
> @@ -103,7 +106,7 @@ int qrtas_ibm_write_pci_config(QGuestAllocator *alloc, uint64_t buid,
>      args[2] = buid & 0xffffffff;
>      args[3] = size;
>      args[4] = val;
> -    res = qrtas_call(alloc, "ibm,write-pci-config", 5, args, 1, ret);
> +    res = qrtas_call(qts, alloc, "ibm,write-pci-config", 5, args, 1, ret);
>      if (res != 0) {
>          return -1;
>      }
> diff --git a/tests/rtas-test.c b/tests/rtas-test.c
> index 276c87ef84..34a692163f 100644
> --- a/tests/rtas-test.c
> +++ b/tests/rtas-test.c
> @@ -16,7 +16,7 @@ static void test_rtas_get_time_of_day(void)
>      qs = qtest_spapr_boot("-machine pseries");
> 
>      t1 = time(NULL);
> -    ret = qrtas_get_time_of_day(qs->alloc, &tm, &ns);
> +    ret = qrtas_get_time_of_day(qs->qts, qs->alloc, &tm, &ns);
>      g_assert_cmpint(ret, ==, 0);
>      t2 = mktimegm(&tm);
>      g_assert(t2 - t1 < 5); /* 5 sec max to run the test */
> 

Reviewed-by: Thomas Huth <thuth@redhat.com>

  reply	other threads:[~2017-09-05 10:16 UTC|newest]

Thread overview: 99+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-01 18:03 [Qemu-devel] [PATCH v6 00/29] Preliminary libqtest cleanups Eric Blake
2017-09-01 18:03 ` [Qemu-devel] [PATCH v6 01/29] tests: Improve .gitignore for tests/multiboot Eric Blake
2017-09-04 14:03   ` Thomas Huth
2017-09-06 19:33     ` Eric Blake
2017-09-01 18:03 ` [Qemu-devel] [PATCH v6 02/29] tests: Sort .gitignore Eric Blake
2017-09-05  7:20   ` Thomas Huth
2017-09-05  9:53     ` Markus Armbruster
2017-09-05  9:58       ` Thomas Huth
2017-09-05 10:10       ` Daniel P. Berrange
2017-09-05 10:44         ` Thomas Huth
2017-09-05 14:22         ` Eric Blake
2017-09-01 18:03 ` [Qemu-devel] [PATCH v6 03/29] test-qga: Kill broken and dead QGA_TEST_SIDE_EFFECTING code Eric Blake
2017-09-05  7:43   ` Thomas Huth
2017-09-01 18:03 ` [Qemu-devel] [PATCH v6 04/29] qtest: Don't perform side effects inside assertion Eric Blake
2017-09-04 14:06   ` Thomas Huth
2017-09-01 18:03 ` [Qemu-devel] [PATCH v6 05/29] numa-test: Use hmp() Eric Blake
2017-09-05  7:44   ` Thomas Huth
2017-09-01 18:03 ` [Qemu-devel] [PATCH v6 06/29] tests: Clean up wait for event Eric Blake
2017-09-01 18:03 ` [Qemu-devel] [PATCH v6 07/29] libqtest: Remove dead qtest_instances variable Eric Blake
2017-09-04 17:02   ` Thomas Huth
2017-09-01 18:03 ` [Qemu-devel] [PATCH v6 08/29] libqtest: Let socket_send() compute length Eric Blake
2017-09-05  8:12   ` Thomas Huth
2017-09-05  9:54     ` Markus Armbruster
2017-09-05 22:20       ` Eric Blake
2017-09-01 18:03 ` [Qemu-devel] [PATCH v6 09/29] libqtest: Use qemu_strtoul() Eric Blake
2017-09-05  9:11   ` Thomas Huth
2017-09-01 18:03 ` [Qemu-devel] [PATCH v6 10/29] libqtest: Topologically sort functions Eric Blake
2017-09-05  9:22   ` Thomas Huth
2017-09-05 10:01     ` Markus Armbruster
2017-09-01 18:03 ` [Qemu-devel] [PATCH v6 11/29] libqtest: Inline qtest_query_target_endianness() Eric Blake
2017-09-02  0:10   ` Philippe Mathieu-Daudé
2017-09-05  9:25   ` Thomas Huth
2017-09-06 20:12     ` Eric Blake
2017-09-01 18:03 ` [Qemu-devel] [PATCH v6 12/29] libqos: Track QTestState with QPCIBus Eric Blake
2017-09-01 19:20   ` Philippe Mathieu-Daudé
2017-09-06 20:48     ` Eric Blake
2017-09-01 23:06   ` John Snow
2017-09-05  9:36   ` Thomas Huth
2017-09-06 21:00     ` Eric Blake
2017-09-07  5:35       ` Thomas Huth
2017-09-07 13:32         ` Eric Blake
2017-09-01 18:03 ` [Qemu-devel] [PATCH v6 13/29] libqos: Use explicit QTestState for pci operations Eric Blake
2017-09-01 19:22   ` Philippe Mathieu-Daudé
2017-09-05 10:03   ` Thomas Huth
2017-09-01 18:03 ` [Qemu-devel] [PATCH v6 14/29] libqos: Use explicit QTestState for fw_cfg operations Eric Blake
2017-09-01 19:21   ` [Qemu-devel] [PATCH v6 14.5/29] fixup! " Eric Blake
2017-09-01 19:24   ` [Qemu-devel] [PATCH v6 14/29] " Philippe Mathieu-Daudé
2017-09-01 23:06   ` John Snow
2017-09-05 10:12   ` Thomas Huth
2017-09-05 11:03     ` Thomas Huth
2017-09-06 21:10       ` Eric Blake
2017-09-06 21:25         ` Eric Blake
2017-09-01 18:03 ` [Qemu-devel] [PATCH v6 15/29] libqos: Use explicit QTestState for rtas operations Eric Blake
2017-09-05 10:16   ` Thomas Huth [this message]
2017-09-01 18:03 ` [Qemu-devel] [PATCH v6 16/29] libqos: Use explicit QTestState for virtio operations Eric Blake
2017-09-05 10:26   ` Thomas Huth
2017-09-05 12:43     ` [Qemu-devel] [Qemu-block] " Paolo Bonzini
2017-09-06 21:42       ` Eric Blake
2017-09-01 18:03 ` [Qemu-devel] [PATCH v6 17/29] ahci-test: Drop dependence on global_qtest Eric Blake
2017-09-01 23:11   ` John Snow
2017-09-05 10:32   ` Thomas Huth
2017-09-07 20:19     ` Eric Blake
2017-09-01 18:03 ` [Qemu-devel] [PATCH v6 18/29] ivshmem-test: " Eric Blake
2017-09-05 10:36   ` Thomas Huth
2017-09-01 18:03 ` [Qemu-devel] [PATCH v6 19/29] postcopy-test: " Eric Blake
2017-09-05 10:41   ` Thomas Huth
2017-09-01 18:03 ` [Qemu-devel] [PATCH v6 20/29] vhost-user-test: " Eric Blake
2017-09-05 10:49   ` Thomas Huth
2017-09-01 18:03 ` [Qemu-devel] [PATCH v6 21/29] qmp-test: " Eric Blake
2017-09-05  7:11   ` Thomas Huth
2017-09-01 18:03 ` [Qemu-devel] [PATCH v6 22/29] tests/boot-sector: " Eric Blake
2017-09-05  7:04   ` Thomas Huth
2017-09-08 12:48   ` Michael S. Tsirkin
2017-09-01 18:03 ` [Qemu-devel] [PATCH v6 23/29] tests/acpi-utils: " Eric Blake
2017-09-05 10:57   ` Thomas Huth
2017-09-08 12:48   ` Michael S. Tsirkin
2017-09-01 18:03 ` [Qemu-devel] [PATCH v6 24/29] bios-tables-test: " Eric Blake
2017-09-05 10:59   ` Thomas Huth
2017-09-07 21:30     ` Eric Blake
2017-09-08 12:49   ` Michael S. Tsirkin
2017-09-01 18:03 ` [Qemu-devel] [PATCH v6 25/29] wdt_ib700-test: " Eric Blake
2017-09-05 11:01   ` Thomas Huth
2017-09-01 18:03 ` [Qemu-devel] [PATCH v6 26/29] fw_cfg-test: " Eric Blake
2017-09-02  0:07   ` Philippe Mathieu-Daudé
2017-09-05 11:05   ` Thomas Huth
2017-09-06 21:45     ` Eric Blake
2017-09-01 18:03 ` [Qemu-devel] [PATCH v6 27/29] libqtest: Make qtest_init() accept format string Eric Blake
2017-09-05 12:46   ` Thomas Huth
2017-09-07 18:00     ` Eric Blake
2017-09-07 19:07       ` Thomas Huth
2017-09-01 18:03 ` [Qemu-devel] [PATCH v6 28/29] libqtest: Remove qtest_start() and qtest_end() shortcuts Eric Blake
2017-09-01 23:16   ` John Snow
2017-09-05 13:06   ` Thomas Huth
2017-09-01 18:03 ` [Qemu-devel] [PATCH v6 29/29] libqtest: Rename qtest_init() to qtest_start() Eric Blake
2017-09-01 23:17   ` John Snow
2017-09-05 13:10   ` Thomas Huth
2017-09-07  2:57     ` Eric Blake
2017-09-01 18:31 ` [Qemu-devel] [PATCH v6 00/29] Preliminary libqtest cleanups no-reply
2017-09-01 18:44   ` Eric Blake

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7ba1c642-f17d-8f55-ae14-18b8bd55fa9d@redhat.com \
    --to=thuth@redhat.com \
    --cc=armbru@redhat.com \
    --cc=david@gibson.dropbear.id.au \
    --cc=eblake@redhat.com \
    --cc=lvivier@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).