From: Greg Kurz <groug@kaod.org>
To: David Gibson <david@gibson.dropbear.id.au>
Cc: pbonzini@redhat.com, qemu-devel@nongnu.org, qemu-ppc@nongnu.org,
lvivier@redhat.com, agraf@suse.de, stefanha@redhat.com,
mst@redhat.com, aik@ozlabs.ru, mdroth@linux.vnet.ibm.com,
thuth@redhat.com
Subject: Re: [Qemu-devel] [PATCHv5 04/12] libqos: Better handling of PCI legacy IO
Date: Tue, 25 Oct 2016 14:34:37 +0200 [thread overview]
Message-ID: <20161025143437.109e678d@bahia> (raw)
In-Reply-To: <1477285201-10244-5-git-send-email-david@gibson.dropbear.id.au>
On Mon, 24 Oct 2016 15:59:53 +1100
David Gibson <david@gibson.dropbear.id.au> wrote:
> The usual model for PCI IO with libqos is to use qpci_iomap() to map a
> specific BAR for a PCI device, then perform IOs within that BAR using
> qpci_io_{read,write}*().
>
> However, certain devices also have legacy PCI IO. In this case, instead of
> (or as well as) being accessed via PCI BARs, the device can be accessed
> via certain well-known, fixed addresses in PCI IO space.
>
> Two existing tests use legacy PCI IO, and take different flawed approaches
> to it:
> * tco-test manually constructs a tco_io_base value instead of calling
> qpci_iomap(), which assumes internal knowledge of the structure of
> the value it shouldn't have
> * ide-test uses direct in*() and out*() calls instead of using
> qpci_io_*() accessors, meaning it's not portable to non-x86 machine
> types.
>
> This patch implements a new qpci_iomap_legacy() interface which gets a
> handle in the same format as qpci_iomap() but refers to a region in
> the legacy PIO space. For a device which has the same registers
> available both in a BAR and in legacy space (quite common), this
> allows the same test code to test both options with just a different
> iomap() at the beginning.
>
> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
> Reviewed-by: Laurent Vivier <lvivier@redhat.com>
> ---
The explanations provided in 20161022045011.GA19629@umbus.fritz.box are
enough for me.
Reviewed-by: Greg Kurz <groug@kaod.org>
> tests/libqos/pci.c | 5 +++++
> tests/libqos/pci.h | 1 +
> 2 files changed, 6 insertions(+)
>
> diff --git a/tests/libqos/pci.c b/tests/libqos/pci.c
> index bf1c532..98a2e56 100644
> --- a/tests/libqos/pci.c
> +++ b/tests/libqos/pci.c
> @@ -350,6 +350,11 @@ void qpci_iounmap(QPCIDevice *dev, void *data)
> /* FIXME */
> }
>
> +void *qpci_legacy_iomap(QPCIDevice *dev, uint16_t addr)
> +{
> + return (void *)(uintptr_t)addr;
> +}
> +
> void qpci_plug_device_test(const char *driver, const char *id,
> uint8_t slot, const char *opts)
> {
> diff --git a/tests/libqos/pci.h b/tests/libqos/pci.h
> index f6f916d..b6f855e 100644
> --- a/tests/libqos/pci.h
> +++ b/tests/libqos/pci.h
> @@ -94,6 +94,7 @@ void qpci_io_writel(QPCIDevice *dev, void *data, uint32_t value);
>
> void *qpci_iomap(QPCIDevice *dev, int barno, uint64_t *sizeptr);
> void qpci_iounmap(QPCIDevice *dev, void *data);
> +void *qpci_legacy_iomap(QPCIDevice *dev, uint16_t addr);
>
> void qpci_plug_device_test(const char *driver, const char *id,
> uint8_t slot, const char *opts);
next prev parent reply other threads:[~2016-10-25 12:35 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-24 4:59 [Qemu-devel] [PATCHv5 00/12] Cleanups to qtest PCI handling David Gibson
2016-10-24 4:59 ` [Qemu-devel] [PATCHv5 01/12] libqos: Give qvirtio_config_read*() consistent semantics David Gibson
2016-10-24 4:59 ` [Qemu-devel] [PATCHv5 02/12] libqos: Handle PCI IO de-multiplexing in common code David Gibson
2016-10-24 4:59 ` [Qemu-devel] [PATCHv5 03/12] libqos: Move BAR assignment to " David Gibson
2016-10-24 4:59 ` [Qemu-devel] [PATCHv5 04/12] libqos: Better handling of PCI legacy IO David Gibson
2016-10-25 12:34 ` Greg Kurz [this message]
2016-10-24 4:59 ` [Qemu-devel] [PATCHv5 05/12] tests: Adjust tco-test to use qpci_legacy_iomap() David Gibson
2016-10-25 12:35 ` Greg Kurz
2016-10-24 4:59 ` [Qemu-devel] [PATCHv5 06/12] libqos: Add streaming accessors for PCI MMIO David Gibson
2016-10-24 4:59 ` [Qemu-devel] [PATCHv5 07/12] libqos: Implement mmio accessors in terms of mem{read, write} David Gibson
2016-10-25 6:47 ` Alexey Kardashevskiy
2016-10-25 12:16 ` David Gibson
2016-10-26 1:18 ` Alexey Kardashevskiy
2016-10-26 4:22 ` David Gibson
2016-10-24 4:59 ` [Qemu-devel] [PATCHv5 08/12] tests: Clean up IO handling in ide-test David Gibson
2016-10-25 7:01 ` Alexey Kardashevskiy
2016-10-25 12:25 ` David Gibson
2016-10-26 1:57 ` Alexey Kardashevskiy
2016-10-26 4:11 ` David Gibson
2016-10-25 12:36 ` Greg Kurz
2016-10-24 4:59 ` [Qemu-devel] [PATCHv5 09/12] libqos: Add 64-bit PCI IO accessors David Gibson
2016-10-24 4:59 ` [Qemu-devel] [PATCHv5 10/12] tests: Use qpci_mem{read, write} in ivshmem-test David Gibson
2016-10-25 9:23 ` Greg Kurz
2016-10-24 5:00 ` [Qemu-devel] [PATCHv5 11/12] tests: Don't assume structure of PCI IO base in ahci-test David Gibson
2016-10-24 16:50 ` John Snow
2016-10-25 8:58 ` Greg Kurz
2016-10-24 5:00 ` [Qemu-devel] [PATCHv5 12/12] libqos: Change PCI accessors to take opaque BAR handle David Gibson
2016-10-25 9:21 ` Greg Kurz
2016-10-25 3:35 ` [Qemu-devel] [PATCHv5 00/12] Cleanups to qtest PCI handling David Gibson
2016-10-25 13:14 ` Greg Kurz
2016-10-26 4:27 ` 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=20161025143437.109e678d@bahia \
--to=groug@kaod.org \
--cc=agraf@suse.de \
--cc=aik@ozlabs.ru \
--cc=david@gibson.dropbear.id.au \
--cc=lvivier@redhat.com \
--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).