From: Junjie Cao <junjie.cao@linux.dev>
To: qemu-devel@nongnu.org
Cc: farosas@suse.de, lvivier@redhat.com, pbonzini@redhat.com,
thuth@redhat.com, peter.maydell@linaro.org, junjie.cao@intel.com
Subject: [PATCH v1 3/7] tests/qtest/usb-hcd-ehci: Cover isochronous OUT to EP0
Date: Thu, 22 Oct 2026 13:45:57 +0000 [thread overview]
Message-ID: <20261022134601.1207204-4-junjie.cao@linux.dev> (raw)
In-Reply-To: <20261022134601.1207204-1-junjie.cao@linux.dev>
From: Junjie Cao <junjie.cao@intel.com>
An isochronous OUT transaction sent to EP0 must leave a pending
control read intact. Extend the IN mismatch test to cover this
direction as well.
Without the endpoint type check, the unexpected OUT packet changes
the control state and the following valid IN qTD halts.
Signed-off-by: Junjie Cao <junjie.cao@intel.com>
---
tests/qtest/usb-hcd-ehci-test.c | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/tests/qtest/usb-hcd-ehci-test.c b/tests/qtest/usb-hcd-ehci-test.c
index 66070ee5c1..6097d470fb 100644
--- a/tests/qtest/usb-hcd-ehci-test.c
+++ b/tests/qtest/usb-hcd-ehci-test.c
@@ -38,6 +38,7 @@ static struct qhc ehci1;
enum EHCIControlScenario {
EHCI_CONTROL_ONLY,
EHCI_ISO_IN_TO_CONTROL,
+ EHCI_ISO_OUT_TO_CONTROL,
};
typedef struct EHCITransferTest {
@@ -147,7 +148,7 @@ static void ehci_control_packet(EHCITransferTest *t, unsigned int pid,
ehci_stop_schedules(t);
}
-static void ehci_iso_to_control(EHCITransferTest *t)
+static void ehci_iso_to_control(EHCITransferTest *t, bool in)
{
QTestState *qts = t->qs->qts;
uint8_t buffer[18];
@@ -159,7 +160,7 @@ static void ehci_iso_to_control(EHCITransferTest *t)
qtest_writel(qts, t->itd + 4, EHCI_ITD_ACTIVE | EHCI_ITD_IOC |
(sizeof(buffer) << 16));
qtest_writel(qts, t->itd + 36, t->isodata); /* Address 0, endpoint 0. */
- qtest_writel(qts, t->itd + 40, 64 | EHCI_ITD_IN);
+ qtest_writel(qts, t->itd + 40, 64 | (in ? EHCI_ITD_IN : 0));
qtest_writel(qts, t->itd + 44, 1); /* One transaction per microframe. */
for (i = 0; i < 1024; i++) {
qtest_writel(qts, t->mem + 4 * i, t->itd);
@@ -176,7 +177,8 @@ static void ehci_iso_to_control(EHCITransferTest *t)
}
g_assert_cmpuint(i, <, 10);
/* A non-iso endpoint must not transfer data or receive the packet. */
- g_assert_cmphex(transaction, ==, EHCI_ITD_IOC);
+ g_assert_cmphex(transaction, ==, EHCI_ITD_IOC |
+ (in ? 0 : sizeof(buffer) << 16));
qtest_memread(qts, t->isodata, buffer, sizeof(buffer));
for (i = 0; i < sizeof(buffer); i++) {
g_assert_cmphex(buffer[i], ==, 0xa5);
@@ -197,7 +199,7 @@ static void test_ehci_control(gconstpointer opaque)
qtest_memwrite(t.qs->qts, t.data, setup, sizeof(setup));
ehci_control_packet(&t, EHCI_QTD_PID_SETUP, sizeof(setup));
if (scenario != EHCI_CONTROL_ONLY) {
- ehci_iso_to_control(&t);
+ ehci_iso_to_control(&t, scenario == EHCI_ISO_IN_TO_CONTROL);
}
/* The invalid iTD must leave the pending control transfer intact. */
qtest_memset(t.qs->qts, t.data, 0xa5, sizeof(descriptor));
@@ -362,6 +364,9 @@ int main(int argc, char **argv)
qtest_add_data_func("/ehci/pci/iso-in-to-control",
GUINT_TO_POINTER(EHCI_ISO_IN_TO_CONTROL),
test_ehci_control);
+ qtest_add_data_func("/ehci/pci/iso-out-to-control",
+ GUINT_TO_POINTER(EHCI_ISO_OUT_TO_CONTROL),
+ test_ehci_control);
}
qtest_start("-machine q35 -device ich9-usb-ehci1,bus=pcie.0,addr=1d.7,"
--
2.43.0
next prev parent reply other threads:[~2026-10-22 13:46 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-22 13:45 [PATCH v1 0/7] tests/qtest: Extend USB host controller transfer coverage Junjie Cao
2026-10-22 13:45 ` [PATCH v1 1/7] tests/qtest/usb-hcd-ehci: Test a control transfer Junjie Cao
2026-10-22 13:45 ` [PATCH v1 2/7] tests/qtest/usb-hcd-ehci: Cover isochronous IN to EP0 Junjie Cao
2026-10-22 13:45 ` Junjie Cao [this message]
2026-10-22 13:45 ` [PATCH v1 4/7] tests/qtest/usb-hcd-uhci: Test interrupt NAK retries Junjie Cao
2026-10-22 13:45 ` [PATCH v1 5/7] tests/qtest/usb-hcd-uhci: Test isochronous NAK completion Junjie Cao
2026-10-22 13:46 ` [PATCH v1 6/7] tests/qtest/usb-hcd-uhci: Test a successful isochronous transfer Junjie Cao
2026-10-22 13:46 ` [PATCH v1 7/7] tests/qtest/usb-hcd-xhci: " Junjie Cao
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=20261022134601.1207204-4-junjie.cao@linux.dev \
--to=junjie.cao@linux.dev \
--cc=farosas@suse.de \
--cc=junjie.cao@intel.com \
--cc=lvivier@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.