From: Laurent Vivier <lvivier@redhat.com>
To: qemu-devel@nongnu.org
Cc: dgibson@redhat.com, thuth@redhat.com, qemu-ppc@nongnu.org,
Gerd Hoffmann <kraxel@redhat.com>, Greg Kurz <groug@kaod.org>,
Laurent Vivier <lvivier@redhat.com>
Subject: [Qemu-devel] [PATCH v3 6/6] tests: enable ohci/uhci/xhci tests on PPC64
Date: Wed, 28 Sep 2016 20:51:33 +0200 [thread overview]
Message-ID: <1475088693-29091-7-git-send-email-lvivier@redhat.com> (raw)
In-Reply-To: <1475088693-29091-1-git-send-email-lvivier@redhat.com>
Signed-off-by: Laurent Vivier <lvivier@redhat.com>
---
tests/Makefile.include | 8 +++++++-
tests/libqos/usb.c | 2 +-
tests/usb-hcd-uhci-test.c | 24 ++++++++++++++++--------
3 files changed, 24 insertions(+), 10 deletions(-)
diff --git a/tests/Makefile.include b/tests/Makefile.include
index 92c82d8..30c4e9e 100644
--- a/tests/Makefile.include
+++ b/tests/Makefile.include
@@ -271,6 +271,12 @@ check-qtest-ppc64-y += tests/drive_del-test$(EXESUF)
check-qtest-ppc64-y += tests/postcopy-test$(EXESUF)
check-qtest-ppc64-y += tests/boot-serial-test$(EXESUF)
check-qtest-ppc64-y += tests/rtas-test$(EXESUF)
+check-qtest-ppc64-y += tests/usb-hcd-ohci-test$(EXESUF)
+gcov-files-ppc64-y += hw/usb/hcd-ohci.c
+check-qtest-ppc64-y += tests/usb-hcd-uhci-test$(EXESUF)
+gcov-files-ppc64-y += hw/usb/hcd-uhci.c
+check-qtest-ppc64-y += tests/usb-hcd-xhci-test$(EXESUF)
+gcov-files-ppc64-y += hw/usb/hcd-xhci.c
check-qtest-sh4-y = tests/endianness-test$(EXESUF)
@@ -596,7 +602,7 @@ libqos-pc-obj-y += tests/libqos/malloc-pc.o tests/libqos/libqos-pc.o
libqos-pc-obj-y += tests/libqos/ahci.o
libqos-omap-obj-y = $(libqos-obj-y) tests/libqos/i2c-omap.o
libqos-imx-obj-y = $(libqos-obj-y) tests/libqos/i2c-imx.o
-libqos-usb-obj-y = $(libqos-pc-obj-y) tests/libqos/usb.o
+libqos-usb-obj-y = $(libqos-spapr-obj-y) $(libqos-pc-obj-y) tests/libqos/usb.o
libqos-virtio-obj-y = $(libqos-pc-obj-y) tests/libqos/virtio.o tests/libqos/virtio-pci.o tests/libqos/virtio-mmio.o tests/libqos/malloc-generic.o
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 = hc->base + 0x10 + 2 * port;
- uint16_t value = qpci_io_readw(hc->dev, addr);
+ uint16_t value = target_le16_to_cpu(qpci_io_readw(hc->dev, addr));
uint16_t mask = ~(UHCI_PORT_WRITE_CLEAR | UHCI_PORT_RSVD1);
g_assert((value & mask) == (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 @@
#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"
+static QOSState *qs;
static void test_uhci_init(void)
{
@@ -19,13 +23,10 @@ static void test_uhci_init(void)
static void test_port(int port)
{
- QPCIBus *pcibus;
struct qhc uhci;
g_assert(port > 0);
- pcibus = qpci_init_pc(NULL);
- g_assert(pcibus != 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);
}
@@ -75,6 +76,7 @@ static void test_usb_storage_hotplug(void)
int main(int argc, char **argv)
{
+ const char *arch = qtest_get_arch();
int ret;
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_hotplug);
- qtest_start("-device piix3-usb-uhci,id=uhci,addr=1d.0"
- " -drive id=drive0,if=none,file=/dev/null,format=raw"
- " -device usb-tablet,bus=uhci.0,port=1");
+ if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) {
+ qs = qtest_pc_boot("-device piix3-usb-uhci,id=uhci,addr=1d.0"
+ " -drive id=drive0,if=none,file=/dev/null,format=raw"
+ " -device usb-tablet,bus=uhci.0,port=1");
+ } else if (strcmp(arch, "ppc64") == 0) {
+ qs = qtest_spapr_boot("-device piix3-usb-uhci,id=uhci,addr=1d.0"
+ " -drive id=drive0,if=none,file=/dev/null,format=raw"
+ " -device usb-tablet,bus=uhci.0,port=1");
+ }
ret = g_test_run();
- qtest_end();
+ qtest_shutdown(qs);
return ret;
}
--
2.5.5
next prev parent reply other threads:[~2016-09-28 18:52 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-28 18:51 [Qemu-devel] [PATCH v3 0/6] tests: enable ohci/uhci/xhci tests on PPC64 Laurent Vivier
2016-09-28 18:51 ` [Qemu-devel] [PATCH v3 1/6] libqos: add PPC64 PCI support Laurent Vivier
2016-09-29 5:27 ` [Qemu-devel] [Qemu-ppc] " David Gibson
2016-10-03 11:23 ` Cédric Le Goater
2016-10-03 11:37 ` Laurent Vivier
2016-10-03 14:03 ` Greg Kurz
2016-10-03 14:14 ` Cédric Le Goater
2016-10-03 17:30 ` Cédric Le Goater
2016-10-04 0:24 ` David Gibson
2016-10-04 6:58 ` Greg Kurz
2016-10-04 7:36 ` Greg Kurz
2016-10-05 1:15 ` David Gibson
2016-10-05 1:14 ` David Gibson
2016-10-05 7:34 ` Greg Kurz
2016-10-05 19:33 ` Greg Kurz
2016-10-06 3:53 ` David Gibson
2016-10-04 0:22 ` David Gibson
2016-10-04 6:44 ` Greg Kurz
2016-10-04 6:45 ` Cédric Le Goater
2016-09-28 18:51 ` [Qemu-devel] [PATCH v3 2/6] libqos: add PCI management in qtest_vboot()/qtest_shutdown() Laurent Vivier
2016-09-29 5:30 ` [Qemu-devel] [Qemu-ppc] " David Gibson
2016-09-28 18:51 ` [Qemu-devel] [PATCH v3 3/6] libqos: use generic qtest_shutdown() Laurent Vivier
2016-09-29 5:31 ` [Qemu-devel] [Qemu-ppc] " David Gibson
2016-09-28 18:51 ` [Qemu-devel] [PATCH v3 4/6] qtest: evaluate endianness of the target in qtest_init() Laurent Vivier
2016-09-29 5:31 ` [Qemu-devel] [Qemu-ppc] " David Gibson
2016-09-28 18:51 ` [Qemu-devel] [PATCH v3 5/6] qtest: define target cpu endianness conversion functions Laurent Vivier
2016-09-29 5:33 ` [Qemu-devel] [Qemu-ppc] " David Gibson
2016-09-29 7:23 ` Laurent Vivier
2016-09-29 7:27 ` David Gibson
2016-09-28 18:51 ` Laurent Vivier [this message]
2016-10-04 13:20 ` [Qemu-devel] [Qemu-ppc] [PATCH v3 6/6] tests: enable ohci/uhci/xhci tests on PPC64 Thomas Huth
2016-10-04 13:36 ` Laurent Vivier
2016-09-28 19:24 ` [Qemu-devel] [PATCH v3 0/6] " no-reply
2016-09-29 5:35 ` [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=1475088693-29091-7-git-send-email-lvivier@redhat.com \
--to=lvivier@redhat.com \
--cc=dgibson@redhat.com \
--cc=groug@kaod.org \
--cc=kraxel@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).