qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Laurent Vivier <lvivier@redhat.com>
To: David Gibson <david@gibson.dropbear.id.au>,
	pbonzini@redhat.com, qemu-devel@nongnu.org
Cc: qemu-ppc@nongnu.org, agraf@suse.de, stefanha@redhat.com,
	mst@redhat.com, aik@ozlabs.ru, mdroth@linux.vnet.ibm.com,
	groug@kaod.org, thuth@redhat.com
Subject: Re: [Qemu-devel] [PATCH 4/8] tests: Better handle legacy IO addresses in tco-test
Date: Tue, 18 Oct 2016 17:14:04 +0200	[thread overview]
Message-ID: <44f479dd-27c7-2723-a551-3c7575f2889b@redhat.com> (raw)
In-Reply-To: <1476787933-7180-5-git-send-email-david@gibson.dropbear.id.au>



On 18/10/2016 12:52, David Gibson wrote:
> tco_test uses the libqos PCI code to access the device.  This makes perfect
> sense for the PCI config space accesses.  However for IO, rather than the
> usual PCI approach of mapping a PCI BAR, then accessing that, it instead
> uses the legacy approach of fixed, known addresses in PCI IO space.
> 
> That doesn't work very well with the qpci_io_{read,write} functions because
> we never use qpci_iomap() and so have to make assumptions about the
> internal encoding of the address tokens iomap() returns.
> 
> This patch avoids that, by directly using the bus's pio_{read,write}
> callbacks, which are defined to take addresses within the PCI IO space.
> 
> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
> ---
>  tests/tco-test.c | 87 ++++++++++++++++++++++++++++----------------------------
>  1 file changed, 44 insertions(+), 43 deletions(-)
> 
> diff --git a/tests/tco-test.c b/tests/tco-test.c
> index 0d201b1..e668630 100644
> --- a/tests/tco-test.c
> +++ b/tests/tco-test.c
> @@ -40,13 +40,13 @@ enum {
>  typedef struct {
>      const char *args;
>      bool noreboot;
> +    QPCIBus *bus;
>      QPCIDevice *dev;
> -    void *tco_io_base;
> +    uint16_t tco_io_base;
>  } TestData;
>  
>  static void test_init(TestData *d)
>  {
> -    QPCIBus *bus;
>      QTestState *qs;
>      char *s;
>  
> @@ -57,8 +57,8 @@ static void test_init(TestData *d)
>      qtest_irq_intercept_in(qs, "ioapic");
>      g_free(s);
>  
> -    bus = qpci_init_pc(NULL);
> -    d->dev = qpci_device_find(bus, QPCI_DEVFN(0x1f, 0x00));
> +    d->bus = qpci_init_pc(NULL);

You can use qtest_pc_boot() now.

> +    d->dev = qpci_device_find(d->bus, QPCI_DEVFN(0x1f, 0x00));
>      g_assert(d->dev != NULL);
>  
>      qpci_device_enable(d->dev);
> @@ -70,42 +70,42 @@ static void test_init(TestData *d)
>      /* set Root Complex BAR */
>      qpci_config_writel(d->dev, ICH9_LPC_RCBA, RCBA_BASE_ADDR | 0x1);
>  
> -    d->tco_io_base = (void *)((uintptr_t)PM_IO_BASE_ADDR + 0x60);
> +    d->tco_io_base = PM_IO_BASE_ADDR + 0x60;

Why don't you use QPCIBar in TestData to store the address?
And you can call qpci_io_XXX() with it.

Thanks,
Laurent

  reply	other threads:[~2016-10-18 15:14 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-18 10:52 [Qemu-devel] [PATCH 0/8] Cleanups to qtest PCI handling David Gibson
2016-10-18 10:52 ` [Qemu-devel] [PATCH 1/8] libqos: Give qvirtio_config_read*() consistent semantics David Gibson
2016-10-18 12:41   ` Laurent Vivier
2016-10-18 13:27   ` Greg Kurz
2016-10-19  2:41     ` David Gibson
2016-10-18 10:52 ` [Qemu-devel] [PATCH 2/8] libqos: Handle PCI IO de-multiplexing in common code David Gibson
2016-10-18 13:28   ` Laurent Vivier
2016-10-19  2:59     ` David Gibson
2016-10-18 10:52 ` [Qemu-devel] [PATCH 3/8] libqos: Move BAR assignment to " David Gibson
2016-10-18 15:00   ` Laurent Vivier
2016-10-19  3:07     ` David Gibson
2016-10-18 10:52 ` [Qemu-devel] [PATCH 4/8] tests: Better handle legacy IO addresses in tco-test David Gibson
2016-10-18 15:14   ` Laurent Vivier [this message]
2016-10-18 16:28     ` Laurent Vivier
2016-10-19  3:19       ` David Gibson
2016-10-19  3:09     ` David Gibson
2016-10-18 10:52 ` [Qemu-devel] [PATCH 5/8] libqos: Add streaming accessors for PCI MMIO David Gibson
2016-10-18 15:17   ` Laurent Vivier
2016-10-18 10:52 ` [Qemu-devel] [PATCH 6/8] libqos: Implement mmio accessors in terms of mem{read, write} David Gibson
2016-10-18 16:04   ` Laurent Vivier
2016-10-18 10:52 ` [Qemu-devel] [PATCH 7/8] tests: Use qpci_mem{read, write} in ivshmem-test David Gibson
2016-10-18 16:14   ` Laurent Vivier
2016-10-19  4:13     ` David Gibson
2016-10-18 10:52 ` [Qemu-devel] [PATCH 8/8] libqos: Change PCI accessors to take opaque BAR handle David Gibson
2016-10-18 16:48   ` Laurent Vivier
2016-10-19  4:06     ` David Gibson
2016-10-18 11:56 ` [Qemu-devel] [PATCH 0/8] Cleanups to qtest PCI handling Laurent Vivier
2016-10-19  1:11   ` David Gibson

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=44f479dd-27c7-2723-a551-3c7575f2889b@redhat.com \
    --to=lvivier@redhat.com \
    --cc=agraf@suse.de \
    --cc=aik@ozlabs.ru \
    --cc=david@gibson.dropbear.id.au \
    --cc=groug@kaod.org \
    --cc=mdroth@linux.vnet.ibm.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=stefanha@redhat.com \
    --cc=thuth@redhat.com \
    /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).