From: David Gibson <david@gibson.dropbear.id.au>
To: Laurent Vivier <lvivier@redhat.com>
Cc: qemu-devel@nongnu.org, thuth@redhat.com,
Greg Kurz <groug@kaod.org>,
qemu-ppc@nongnu.org, Gerd Hoffmann <kraxel@redhat.com>,
dgibson@redhat.com
Subject: Re: [Qemu-devel] [Qemu-ppc] [PATCH 4/4] tests: enable ohci/uhci/xhci tests on PPC64
Date: Wed, 28 Sep 2016 13:05:23 +1000 [thread overview]
Message-ID: <20160928030523.GF18880@umbus> (raw)
In-Reply-To: <e3ba35a8-e300-4460-33de-6ee5a9c42689@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 2139 bytes --]
On Tue, Sep 27, 2016 at 09:43:27AM +0200, Laurent Vivier wrote:
>
>
> On 27/09/2016 05:53, David Gibson wrote:
> > On Mon, Sep 26, 2016 at 04:10:49PM +0200, Laurent Vivier wrote:
>
> >> void qusb_pci_init_one(QPCIBus *pcibus, struct qhc *hc, uint32_t devfn, int bar)
> >> {
> >> hc->dev = qpci_device_find(pcibus, devfn);
> >> @@ -31,6 +38,13 @@ void uhci_port_test(struct qhc *hc, int port, uint16_t expect)
> >> uint16_t value = qpci_io_readw(hc->dev, addr);
> >> uint16_t mask = ~(UHCI_PORT_WRITE_CLEAR | UHCI_PORT_RSVD1);
> >>
> >> + if (qtest_big_endian() && host_big_endian) {
> >> + /* little endian device on big endian guest
> >> + * must be swapped on big endian host
> >> + */
> >> + value = bswap16(value);
> >> + }
> >> +
> >
> > Hm.. should the qpci_io_*() helpers handle the endian conversion?
>
> I'm really wondering how to manage correctly this case (I've the same
> kind of issue with virtio).
>
> The protocol between guest and test program reads/writes data using the
> guest CPU endianess, so it works in the overall case.
Oh.. That seems bogus; maybe we should change that. IIUC the protocol
is transferring whole word values as strings. In which case we should
be transferring whole word values - endianness should only come into
play if we're associating bytes in the value with addresses.
So using (poorly defined) guest endianness is a design error here - we
should use "host endianness"; really "no endianness".
> But in this case,
> hcd-uhci is a little-endian device (.endianness = DEVICE_LITTLE_ENDIAN)
> on a big endian machine, so I think in the linux driver we should have a
> "le16_to_cpu()". But in our case we can't use "le16_to_cpu()" because
> endianess of the host cpu is not the same has the one of the guest CPU.
> Perhaps I should add a "target_le16_to_cpu()"?
>
> Thanks,
> Laurent
>
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
next prev parent reply other threads:[~2016-09-28 3:33 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-26 14:10 [Qemu-devel] [PATCH 0/4] tests: enable ohci/uhci/xhci tests on PPC64 Laurent Vivier
2016-09-26 14:10 ` [Qemu-devel] [PATCH 1/4] libqos: add PPC64 PCI support Laurent Vivier
2016-09-27 3:48 ` [Qemu-devel] [Qemu-ppc] " David Gibson
2016-09-26 14:10 ` [Qemu-devel] [PATCH 2/4] libqos: add PCI management in qtest_vboot()/qtest_shutdown() Laurent Vivier
2016-09-27 3:48 ` [Qemu-devel] [Qemu-ppc] " David Gibson
2016-09-27 7:33 ` Laurent Vivier
2016-09-27 8:29 ` David Gibson
2016-09-26 14:10 ` [Qemu-devel] [PATCH 3/4] libqos: use generic qtest_shutdown() Laurent Vivier
2016-09-27 3:49 ` [Qemu-devel] [Qemu-ppc] " David Gibson
2016-09-26 14:10 ` [Qemu-devel] [PATCH 4/4] tests: enable ohci/uhci/xhci tests on PPC64 Laurent Vivier
2016-09-27 3:53 ` [Qemu-devel] [Qemu-ppc] " David Gibson
2016-09-27 7:43 ` Laurent Vivier
2016-09-27 12:23 ` Laurent Vivier
2016-09-28 3:05 ` David Gibson [this message]
2016-09-26 15:12 ` [Qemu-devel] [PATCH 0/4] " no-reply
2016-09-27 3:54 ` [Qemu-devel] [Qemu-ppc] " 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=20160928030523.GF18880@umbus \
--to=david@gibson.dropbear.id.au \
--cc=dgibson@redhat.com \
--cc=groug@kaod.org \
--cc=kraxel@redhat.com \
--cc=lvivier@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
--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).