State of EHCI emulation for QEMU
Hi all,
as you may know, there is an experimental git repository at
git://git.kiszka.org/qemu.git ehci
that contains (primarily) David's work on an EHCI model for QEMU, infrequently merges with latest git by me. As both David and I are short on time ATM to drive this towards mainline integration, I'd like to motivate some more contributions.
But first of all a summary of its state:
- works OK for mass storage device pass-through
- gives quite decent performance this way (I've once installed a complete Linux distro onto an USB disk this way)
- reported to fail when passing through certain other host device types (e.g. the iPhone)
- lacks integration with UHCI (currently, only EHCI is provided by that tree, breaking USB 1.1 devices)
David furthermore provided the following to-dos:
- lacks periodic frames support
- lacks isochronous traffic support
- lacks split transactions support
- NAK/reload support is kludgy at best
- throttle interrupt rate based on OS settings
Regarding integration with UHCI: David once posted an RFC patch that basically establishes the foundation for fixed device-to-controller assignment [1][2]. Most real implementations do dynamic hand-over between EHCI and UHCI, however, the spec allows static assignment as well (which simplifies the implementation in QEMU).
Would be really nice to see this upstream rather sooner than later. I think the major blocking point is just the companion controller integration, then we would already be able to use it with USB disks/sticks.
So, if anyone is interested in picking up some open task, every contribution is welcome!
Jan
[1] http://thread.gmane.org/gmane.comp.emulators.qemu/77130
[2] http://thread.gmane.org/gmane.comp.emulators.qemu/76072
Hi,
Quoted 3 lines
as you may know, there is an experimental git repository at
git://git.kiszka.org/qemu.gitehci
Looking into this right now as I'm busy with various usb issues anyway. Current state:
http://cgit.freedesktop.org/spice/qemu/log/?h=usb.1
Quoted 2 lines
- lacks integration with UHCI (currently, only EHCI is provided by that tree, breaking USB 1.1 devices)
Sort-of fixed (see docs/usb2.txt).
Quoted 3 lines
David furthermore provided the following to-dos:
- lacks periodic frames support
- lacks isochronous traffic support
--verbose please. There seems to be some code for that?
Quoted 1 line
- lacks split transactions support
That would need a USB 2.0 HUB emulation to be useful. We lack that one too ;)
Quoted 1 line
- NAK/reload support is kludgy at best
--verbose please.
cheers,
Gerd
Quoted 6 lines · Gerd Hoffmann
Hi,
Quoted 3 lines
as you may know, there is an experimental git repository at
git://git.kiszka.org/qemu.gitehci
Quoted 8 lines
Looking into this right now as I'm busy with various usb issues anyway. Current state:
http://cgit.freedesktop.org/spice/qemu/log/?h=usb.1Quoted 2 lines
- lacks integration with UHCI (currently, only EHCI is provided by that tree, breaking USB 1.1 devices)
Sort-of fixed (see
docs/usb2.txt).
Very nice. Some remarks:
- command line must look like this:
...
-drive if=none,id=usbstick,file=/path/to/image \
-device usb-storage,bus=ehci.0,drive=usbstick ie. register driver device referencing it, and there was a typo id->if
- long-term, "-usb" should become a shorthand for "-device usb-uhci,id=uhci -device usb-ehci,id=ehci" (at least for x86)
Unfortunately, msd is not yet magically healed:
non queue head request in async schedule
processing error - resetting ehci HC
Quoted 7 lines
Quoted 4 lines
David furthermore provided the following to-dos:
- lacks periodic frames support
- lacks isochronous traffic support--verbose please. There seems to be some code for that?
Quoted 9 lines
Quoted 1 line
- lacks split transactions support
That would need a USB 2.0 HUB emulation to be useful. We lack that one too ;)
Quoted 1 line
- NAK/reload support is kludgy at best
--verbose please.
Those are questions for David.
Jan
PS: Your tree lacks conversion of usb-musb.c.
Quoted 11 lines · Jan Kiszka
Quoted 10 lines · Gerd Hoffmann
Hi,
Quoted 3 lines
as you may know, there is an experimental git repository at
git://git.kiszka.org/qemu.gitehciLooking into this right now as I'm busy with various usb issues anyway. Current state:
http://cgit.freedesktop.org/spice/qemu/log/?h=usb.1
It appears that the import of the ehci code to spice has completely lost the development history and code contributions - from the original version by Mark Burkley through the work I've done on it. Would you mind pulling in the patch history instead of just the final code?
I'll respond in --verbose mode for the other questions later this weekend when I get more time.
David
Hi,
Quoted 4 lines
It appears that the import of the ehci code to spice has completely lost the development history and code contributions - from the original version by Mark Burkley through the work I've done on it. Would you mind pulling in the patch history instead of just the final code?
I've first tried to rebase the ehci branch to latest master exactly to keep the history. Was quite messy with lots of conflicts though, so I gave up. For review & upstream merge having the whole history isn't that helpful anyway.
cheers,
Gerd
Quoted 11 lines · Gerd Hoffmann
Hi,
Quoted 4 lines
It appears that the import of the ehci code to spice has completely lost the development history and code contributions - from the original version by Mark Burkley through the work I've done on it. Would you mind pulling in the patch history instead of just the final code?
I've first tried to rebase the ehci branch to latest master exactly to keep the history. Was quite messy with lots of conflicts though, so I gave up. For review & upstream merge having the whole history isn't that helpful anyway.
I'm was regularly merging master into ehci, and that worked quite well. For the development phase, it might be nice to keep the history if possible. But I agree that we need a clean series once upstream submission is in sight.
Jan
Quoted 8 lines · Jan Kiszka
Quoted 7 lines · Gerd Hoffmann
Hi,
Quoted 4 lines
It appears that the import of the ehci code to spice has completely lost the development history and code contributions - from the original version by Mark Burkley through the work I've done on it. Would you mind pulling in the patch history instead of just the final code?
Quoted 4 lines
Quoted 4 lines
I've first tried to rebase the ehci branch to latest master exactly to keep the history. Was quite messy with lots of conflicts though, so I gave up. For review & upstream merge having the whole history isn't that helpful anyway.
Where was the messiness given that most of the changes are to a brand new file? The biggest change after that is to usb-linux to handle large requests.
David
Quoted 8 lines
I'm was regularly merging master into ehci, and that worked quite well. For the development phase, it might be nice to keep the history if possible. But I agree that we need a clean series once upstream submission is in sight.
Jan
Hi,
Quoted 2 lines
Where was the messiness given that most of the changes are to a brand new file?
From the "devel -> merge with upstream -> fixup breakage + commit -> devel" cycle. When rebasing *that* you simply don't get a nice + bisectable patch series. Early patches didn't apply cleanly due to buildsystem changes. After fixing up that ehci didn't build. Of course there are likely fixup patches coming later which solve that which I could try to find + cherry-pick + squash-in. But at that point I felt it simply isn't worth the trouble given that we would squash it all together anyway for patch review + upstream merge.
cheers,
Gerd
-----Original Message-----
From: Gerd Hoffmann [mailto:[email protected]]
Sent: Wed 12/8/2010 10:14 AM
To: David Ahern (daahern)
Cc: Jan Kiszka; qemu-devel; Jes Sorensen
Subject: Re: [Qemu-devel] State of EHCI emulation for QEMU
Hi,
Quoted 2 lines
Where was the messiness given that most of the changes are to a brand new file?
From the "devel -> merge with upstream -> fixup breakage + commit ->
devel" cycle. When rebasing *that* you simply don't get a nice + bisectable patch series. Early patches didn't apply cleanly due to buildsystem changes. After fixing up that ehci didn't build. Of course there are likely fixup patches coming later which solve that which I could try to find + cherry-pick + squash-in. But at that point I felt it simply isn't worth the trouble given that we would squash it all together anyway for patch review + upstream merge.
cheers,
Gerd
New features developed for the kernel are done in a separate git trees. When a feature is ready for inclusion into the main kernel tree, a pull request is sent. That workflow maintains a complete change history for the feature. Take performance events for example: you can go into Linus' git tree and see the complete history of changes. There's no reason the same methodology cannot be done for qemu.
David
Hi,
Quoted 6 lines
New features developed for the kernel are done in a separate git trees. When a feature is ready for inclusion into the main kernel tree, a pull request is sent. That workflow maintains a complete change history for the feature. Take performance events for example: you can go into Linus' git tree and see the complete history of changes. There's no reason the same methodology cannot be done for qemu.
It is done for qemu, pci and block are maintained that way for example.
The key difference is that the patches which are accepted into the
subsystem branches and then are pulled go through a full review @ qemu-devel before.
cheers,
Gerd
Quoted 10 lines · Gerd Hoffmann
Hi,
Quoted 6 lines
New features developed for the kernel are done in a separate git trees. When a feature is ready for inclusion into the main kernel tree, a pull request is sent. That workflow maintains a complete change history for the feature. Take performance events for example: you can go into Linus' git tree and see the complete history of changes. There's no reason the same methodology cannot be done for qemu.
Quoted 4 lines
It is done for qemu, pci and block are maintained that way for example.
The key difference is that the patches which are accepted into the
subsystem branches and then are pulled go through a full review @ qemu-devel before.
Yes, I know I've been following qemu and kvm for 3 years now. And there is no reason the same process cannot be done for usb as a subsystem or ehci as a feature branch. Jan already has that started.
I realize this is most likely a moot point given that xhci appears better suited for virtualization than ehci, nonetheless it bugs me that you are not wanting to take the time to maintain the code change and sign-off histories.
David
Quoted 4 lines
cheers,
Gerd
Quoted 18 lines · David S. Ahern
Quoted 10 lines · Gerd Hoffmann
Hi,
Quoted 6 lines
New features developed for the kernel are done in a separate git trees. When a feature is ready for inclusion into the main kernel tree, a pull request is sent. That workflow maintains a complete change history for the feature. Take performance events for example: you can go into Linus' git tree and see the complete history of changes. There's no reason the same methodology cannot be done for qemu.
Quoted 4 lines
It is done for qemu, pci and block are maintained that way for example. The key difference is that the patches which are accepted into the subsystem branches and then are pulled go through a full review @ qemu-devel before.
Quoted 8 lines
Yes, I know I've been following qemu and kvm for 3 years now. And there is no reason the same process cannot be done for usb as a subsystem or ehci as a feature branch. Jan already has that started.
I realize this is most likely a moot point given that xhci appears better suited for virtualization than ehci, nonetheless it bugs me that you are not wanting to take the time to maintain the code change and sign-off histories.
The problem with that approach is that the introduction of new features becomes a single commit. From bisectability point of view this is bad, especially with big features. So I'm much more interested in having a lot of small commits than huge commits or merges, even at the expense of loss of some history information. If we can have both, for example by doing some kind of partial pull, that would be the best of both. I may as well be ignorant about some great git features.
Hi,
Quoted 5 lines
- command line must look like this:
... -drive if=none,id=usbstick,file=/path/to/image \ -device usb-storage,bus=ehci.0,drive=usbstickie. register driver device referencing it, and there was a typo
id->if
I'll fix.
Quoted 2 lines
- long-term, "-usb" should become a shorthand for "-device usb-uhci,id=uhci -device usb-ehci,id=ehci" (at least for x86)
Hmm, I'd tend to leave '-M pc' as-is and enable ehci by default in the upcoming q35 emulation, especially in case both make it into 0.15.
Quoted 4 lines
Unfortunately, msd is not yet magically healed:
non queue head request in async schedule
processing error - resetting ehci HC
Yea, I've seen a flaw in async handling. Just need to dig some more into the code to fix it properly, also the packet workflow (including async handling) is one of the spots where the qemu usb subsystem needs some work ...
Quoted 1 line
PS: Your tree lacks conversion of
usb-musb.c.
Huh? 'git diff kiszka/master kiszka/ehci hw/usb-musb.c' is empty.
cheers,
Gerd
Quoted 8 lines · Gerd Hoffmann
Hi,
Quoted 5 lines
- command line must look like this:
... -drive if=none,id=usbstick,file=/path/to/image \ -device usb-storage,bus=ehci.0,drive=usbstickie. register driver device referencing it, and there was a typo
id->if
Quoted 7 lines
I'll fix.
Quoted 2 lines
- long-term, "-usb" should become a shorthand for "-device usb-uhci,id=uhci -device usb-ehci,id=ehci" (at least for x86)
Hmm, I'd tend to leave '-M pc' as-is and enable ehci by default in the upcoming q35 emulation, especially in case both make it into 0.15.
I'm was concerned about the semantic of -usb. If ehci&uhci is going to be on by default in the future, we should obsolete and finally drop this switch.
Quoted 6 lines
Quoted 5 lines
Unfortunately, msd is not yet magically healed:
non queue head request in async schedule
processing error - resetting ehci HC
Quoted 8 lines
Yea, I've seen a flaw in async handling. Just need to dig some more into the code to fix it properly, also the packet workflow (including async handling) is one of the spots where the qemu usb subsystem needs some work ...
Quoted 1 line
PS: Your tree lacks conversion of
usb-musb.c.Huh? 'git diff kiszka/master kiszka/ehci
hw/usb-musb.c' is empty.
The breakage comes from one of your patches. Just try to build an ARM target.
Jan