From: Paul Zimmerman <pauldzim@gmail.com>
To: kraxel@redhat.com
Cc: peter.maydell@linaro.org, stefanha@gmail.com,
qemu-devel@nongnu.org, Paul Zimmerman <pauldzim@gmail.com>,
jsnow@redhat.com, f4bug@amsat.org
Subject: [PATCH 0/6] dwc-hsotg (aka dwc2) USB host contoller emulation
Date: Sun, 22 Mar 2020 15:27:20 -0700 [thread overview]
Message-ID: <20200322222726.10244-1-pauldzim@gmail.com> (raw)
This patch series adds emulation for the dwc-hsotg USB controller,
which is used on the Raspberry Pi 3 and earlier, as well as a number
of other development boards. The main benefit for Raspberry Pi is that
this enables networking on these boards, since the network adapter is
attached via USB.
The emulation is working quite well, I have tested with USB network,
mass storage, mouse, keyboard, and tablet. I have tested with the dwc2
driver in the upstream Linux kernel, and with the dwc-otg driver in the
Raspbian kernel. One remaining issue is that USB redirection does not
work, I tried connecting to a USB stick on the host, but the device
generates babble errors and does not work. I will continue to work on
this issue.
The patch series also includes a very basic emulation of the MPHI
device on the Raspberry Pi SOC, which provides the FIQ interrupt that
is used by the dwc-otg driver in the Raspbian kernel. But that driver
still does not work in full FIQ mode, so it is necessary to add a
parameter to the kernel command line ("dwc_otg.fiq_fsm_enable=0") to
make it work.
Some open questions:
1) I have used printf-based debug statements while developing the
code, and have not implemented any tracing statements. I'm not
sure if that is considered acceptable for new code?
2) I have imported the register description file from the Linux
kernel. This file is licensed GPL-2 only, is this OK?
3) The emulation does not respect the max-packet size when
transferring packets. Since the dwc-hsotg controller only has
one root port, and the Qemu USB hub is only full-speed, that
means every device connected has to run at full speed. That
makes mass-storage devices in particular run very slowly. Using
transfers greater than max-packet size alleviates this. Is this
OK? I think the EHCI emulation does the same thing, since its
transfers seem to run at greater than real world transfer rates.
4) I have only implemented host mode for now. Would there be any
benefit to implementing gadget mode as well? It seems it could
be useful to emulate gadget devices in Qemu, but I am not sure
if Qemu currently offers any support for that?
Thanks for your time,
Paul
---
Paul Zimmerman (6):
Add BCM2835 SOC MPHI emulation
dwc-hsotg USB host controller register definitions
dwc-hsotg USB host controller state definitions
dwc-hsotg USB host controller emulation
Add short-packet handling to usb-storage driver
Wire in the dwc-hsotg USB host controller emulation
hw/arm/bcm2835_peripherals.c | 38 +-
hw/misc/Makefile.objs | 1 +
hw/misc/bcm2835_mphi.c | 215 ++++
hw/usb/Kconfig | 5 +
hw/usb/Makefile.objs | 1 +
hw/usb/dev-storage.c | 15 +-
hw/usb/hcd-dwc2.c | 1353 ++++++++++++++++++++++++++
hw/usb/hcd-dwc2.h | 180 ++++
include/hw/arm/bcm2835_peripherals.h | 5 +-
include/hw/misc/bcm2835_mphi.h | 50 +
include/hw/usb/dwc2-regs.h | 895 +++++++++++++++++
11 files changed, 2755 insertions(+), 3 deletions(-)
create mode 100644 hw/misc/bcm2835_mphi.c
create mode 100644 hw/usb/hcd-dwc2.c
create mode 100644 hw/usb/hcd-dwc2.h
create mode 100644 include/hw/misc/bcm2835_mphi.h
create mode 100644 include/hw/usb/dwc2-regs.h
--
2.17.1
next reply other threads:[~2020-03-22 22:29 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-22 22:27 Paul Zimmerman [this message]
2020-03-22 22:27 ` [PATCH 1/6] Add BCM2835 SOC MPHI emulation Paul Zimmerman
2020-03-22 22:27 ` [PATCH 2/6] dwc-hsotg USB host controller register definitions Paul Zimmerman
2020-03-22 22:27 ` [PATCH 3/6] dwc-hsotg USB host controller state definitions Paul Zimmerman
2020-03-22 22:27 ` [PATCH 4/6] dwc-hsotg USB host controller emulation Paul Zimmerman
2020-03-22 22:27 ` [PATCH 5/6] Add short-packet handling to usb-storage driver Paul Zimmerman
2020-03-22 22:27 ` [PATCH 6/6] Wire in the dwc-hsotg USB host controller emulation Paul Zimmerman
2020-03-22 22:39 ` [PATCH 0/6] dwc-hsotg (aka dwc2) USB host contoller emulation Paul Zimmerman
2020-03-22 22:46 ` no-reply
2020-03-23 11:09 ` Gerd Hoffmann
2020-03-24 23:32 ` Paul Zimmerman
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=20200322222726.10244-1-pauldzim@gmail.com \
--to=pauldzim@gmail.com \
--cc=f4bug@amsat.org \
--cc=jsnow@redhat.com \
--cc=kraxel@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@gmail.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).