From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44642) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bp4tb-0004aD-Q9 for qemu-devel@nongnu.org; Tue, 27 Sep 2016 22:46:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bp4tX-0001Ss-GY for qemu-devel@nongnu.org; Tue, 27 Sep 2016 22:46:54 -0400 Date: Wed, 28 Sep 2016 12:45:54 +1000 From: David Gibson Message-ID: <20160928024554.GE18880@umbus> References: <1475002559-392-1-git-send-email-lvivier@redhat.com> <1475002559-392-7-git-send-email-lvivier@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="M/SuVGWktc5uNpra" Content-Disposition: inline In-Reply-To: <1475002559-392-7-git-send-email-lvivier@redhat.com> Subject: Re: [Qemu-devel] [Qemu-ppc] [PATCH v2 6/6] tests: enable ohci/uhci/xhci tests on PPC64 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Laurent Vivier Cc: qemu-devel@nongnu.org, thuth@redhat.com, Greg Kurz , qemu-ppc@nongnu.org, Gerd Hoffmann , dgibson@redhat.com --M/SuVGWktc5uNpra Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Sep 27, 2016 at 08:55:59PM +0200, Laurent Vivier wrote: > Signed-off-by: Laurent Vivier > --- > tests/Makefile.include | 8 +++++++- > tests/libqos/usb.c | 2 +- > tests/usb-hcd-uhci-test.c | 24 ++++++++++++++++-------- > 3 files changed, 24 insertions(+), 10 deletions(-) >=20 > diff --git a/tests/Makefile.include b/tests/Makefile.include > index bca2cbc..4136959 100644 > --- a/tests/Makefile.include > +++ b/tests/Makefile.include > @@ -270,6 +270,12 @@ check-qtest-ppc64-y +=3D tests/drive_del-test$(EXESU= F) > check-qtest-ppc64-y +=3D tests/postcopy-test$(EXESUF) > check-qtest-ppc64-y +=3D tests/boot-serial-test$(EXESUF) > check-qtest-ppc64-y +=3D tests/rtas-test$(EXESUF) > +check-qtest-ppc64-y +=3D tests/usb-hcd-ohci-test$(EXESUF) > +gcov-files-ppc64-y +=3D hw/usb/hcd-ohci.c > +check-qtest-ppc64-y +=3D tests/usb-hcd-uhci-test$(EXESUF) > +gcov-files-ppc64-y +=3D hw/usb/hcd-uhci.c > +check-qtest-ppc64-y +=3D tests/usb-hcd-xhci-test$(EXESUF) > +gcov-files-ppc64-y +=3D hw/usb/hcd-xhci.c > =20 > check-qtest-sh4-y =3D tests/endianness-test$(EXESUF) > =20 > @@ -595,7 +601,7 @@ libqos-pc-obj-y +=3D tests/libqos/malloc-pc.o tests/l= ibqos/libqos-pc.o > libqos-pc-obj-y +=3D tests/libqos/ahci.o > libqos-omap-obj-y =3D $(libqos-obj-y) tests/libqos/i2c-omap.o > libqos-imx-obj-y =3D $(libqos-obj-y) tests/libqos/i2c-imx.o > -libqos-usb-obj-y =3D $(libqos-pc-obj-y) tests/libqos/usb.o > +libqos-usb-obj-y =3D $(libqos-spapr-obj-y) $(libqos-pc-obj-y) tests/libq= os/usb.o > libqos-virtio-obj-y =3D $(libqos-pc-obj-y) tests/libqos/virtio.o tests/l= ibqos/virtio-pci.o tests/libqos/virtio-mmio.o tests/libqos/malloc-generic.o > =20 > tests/device-introspect-test$(EXESUF): tests/device-introspect-test.o > diff --git a/tests/libqos/usb.c b/tests/libqos/usb.c > index f794d92..25e5f38 100644 > --- a/tests/libqos/usb.c > +++ b/tests/libqos/usb.c > @@ -28,7 +28,7 @@ void qusb_pci_init_one(QPCIBus *pcibus, struct qhc *hc,= uint32_t devfn, int bar) > void uhci_port_test(struct qhc *hc, int port, uint16_t expect) > { > void *addr =3D hc->base + 0x10 + 2 * port; > - uint16_t value =3D qpci_io_readw(hc->dev, addr); > + uint16_t value =3D target_le16_to_cpu(qpci_io_readw(hc->dev, addr)); This doesn't look right. Judging by the code using qpci_io_readw() in qpci_device_foreach() and in other tests I'm looking at, qpci_io_readw() (and the others) are expected to return results in *host native* order - i.e. suitable for immediate comparisons and masks within qtest code executing on the host. > uint16_t mask =3D ~(UHCI_PORT_WRITE_CLEAR | UHCI_PORT_RSVD1); > =20 > g_assert((value & mask) =3D=3D (expect & mask)); > diff --git a/tests/usb-hcd-uhci-test.c b/tests/usb-hcd-uhci-test.c > index c24063e..4b951ce 100644 > --- a/tests/usb-hcd-uhci-test.c > +++ b/tests/usb-hcd-uhci-test.c > @@ -9,9 +9,13 @@ > =20 > #include "qemu/osdep.h" > #include "libqtest.h" > +#include "libqos/libqos.h" > #include "libqos/usb.h" > +#include "libqos/libqos-pc.h" > +#include "libqos/libqos-spapr.h" > #include "hw/usb/uhci-regs.h" > =20 > +static QOSState *qs; > =20 > static void test_uhci_init(void) > { > @@ -19,13 +23,10 @@ static void test_uhci_init(void) > =20 > static void test_port(int port) > { > - QPCIBus *pcibus; > struct qhc uhci; > =20 > g_assert(port > 0); > - pcibus =3D qpci_init_pc(NULL); > - g_assert(pcibus !=3D NULL); > - qusb_pci_init_one(pcibus, &uhci, QPCI_DEVFN(0x1d, 0), 4); > + qusb_pci_init_one(qs->pcibus, &uhci, QPCI_DEVFN(0x1d, 0), 4); > uhci_port_test(&uhci, port - 1, UHCI_PORT_CCS); > } > =20 > @@ -75,6 +76,7 @@ static void test_usb_storage_hotplug(void) > =20 > int main(int argc, char **argv) > { > + const char *arch =3D qtest_get_arch(); > int ret; > =20 > g_test_init(&argc, &argv, NULL); > @@ -84,11 +86,17 @@ int main(int argc, char **argv) > qtest_add_func("/uhci/pci/hotplug", test_uhci_hotplug); > qtest_add_func("/uhci/pci/hotplug/usb-storage", test_usb_storage_hot= plug); > =20 > - qtest_start("-device piix3-usb-uhci,id=3Duhci,addr=3D1d.0" > - " -drive id=3Ddrive0,if=3Dnone,file=3D/dev/null,format= =3Draw" > - " -device usb-tablet,bus=3Duhci.0,port=3D1"); > + if (strcmp(arch, "i386") =3D=3D 0 || strcmp(arch, "x86_64") =3D=3D 0= ) { > + qs =3D qtest_pc_boot("-device piix3-usb-uhci,id=3Duhci,addr=3D1d= =2E0" > + " -drive id=3Ddrive0,if=3Dnone,file=3D/dev/nu= ll,format=3Draw" > + " -device usb-tablet,bus=3Duhci.0,port=3D1"); > + } else if (strcmp(arch, "ppc64") =3D=3D 0) { > + qs =3D qtest_spapr_boot("-device piix3-usb-uhci,id=3Duhci,addr= =3D1d.0" > + " -drive id=3Ddrive0,if=3Dnone,file=3D/dev/nu= ll,format=3Draw" > + " -device usb-tablet,bus=3Duhci.0,port=3D1"); Why aren't there similar ifs needed for ohci, ehci and/or xhci? > + } > ret =3D g_test_run(); > - qtest_end(); > + qtest_shutdown(qs); > =20 > return ret; > } --=20 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 --M/SuVGWktc5uNpra Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJX6y7iAAoJEGw4ysog2bOSjxIP/iaGci2Q9N/ffQZZyiMPI67d ngxG8gsGosLLljZHNCZLQ0pcY+q/OK/9xTk2jD4btzWyC/HsDcMQ2qx5XtnlZpqn qmY1HJaBmvoRp5Mx5yWWUeiebwjQNFov0KxwKB3DwpSjTK9lMvyDOIKvNF2qNBiC 1vukIEfyhfrYiSkWwYnM8hx+RZwsayI7p9/Cq2wJNO7xkkjRZ4hfdCPsYrG/mEYi eXeIlxYOsByAJpsLI3Era+gCBbrryT4YfbJwX3r8MUoG/Vd0NY7aoxO/YTgqfQ5W ozLgKp6xV7q9PZdwv9P1Ns3CBM+zS1ilUWaXLjdBYZ/BidjpS0C7GYzLuzh0xOol 98xSwEmiRmDj/Jqt6SgyaT+dUorcot7ibLypMAgu7AYAWjMdYFUKNnbRHi/K73PI g8FMImlTnhSkLT0tMF3PixqIAP2BqlQfsvZmZSgozr5z7NKJL0mhzWR2TKdcnRvz /mGP7NPmTWsj9VOgvrR8ZppExUIMLmHqep5jA8bpIEl0XCOmZbriX6H9Hr8Rc6N/ mpmQagW0dGFYa9Ed/fW63dGdGSvZxdhm/Cu3OFLisRifTaHdESFfP2ecm1vESQUB q2vvlCPc14h2CvWojiLPQC065zGQWGJuEsjWdFS0RrP+YmKpD1fbC/toEPwXlrRk FeLJj2U8RImgTlYASiC4 =/7/V -----END PGP SIGNATURE----- --M/SuVGWktc5uNpra--