Page MenuHomeFreeBSD

bhyve: usb: properly handle port init/deinit/power-on
Needs ReviewPublic

Authored by kevans on Fri, Sep 18, 2:28 AM.
Tags
None
Referenced Files
F172635421: D59785.diff
Sat, Sep 19, 9:00 PM
F172568251: D59785.id187025.diff
Sat, Sep 19, 8:07 AM
F172566524: D59785.id187025.diff
Sat, Sep 19, 7:49 AM
F172549957: D59785.id187025.diff
Sat, Sep 19, 4:57 AM
F172498825: D59785.id187025.diff
Fri, Sep 18, 9:20 PM
Unknown Object (File)
Fri, Sep 18, 8:13 PM
Unknown Object (File)
Fri, Sep 18, 8:12 PM
Unknown Object (File)
Fri, Sep 18, 8:12 PM

Details

Reviewers
None
Group Reviewers
bhyve
Summary

These also largely won't happen with the USB devices available today,
but will become relevant when we support passthru / non-static devices.

Attaching and removing devices should obviously init or deinit the port
and post an event back to the guest to force re-enumeration. The bit
in portregs_write is technically a fix: writing to an unpowered port is
perfectly valid, if said write is intended to transition PP from 0 to
1 to power the port. In that case, we init the port much as we do in
the device-attach case and post an event back.

Sponsored by: The FreeBSD Foundation (aokblast)

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 77051
Build 73934: arc lint + arc unit

Event Timeline

markj added inline comments.
usr.sbin/bhyve/pci_xhci.c
2738

Are you supposed to be clearing all of the bits in the PLS mask? XHCI_PS_PLS_SET(UPS_PORT_LS_U0) is zero.

2830

What is synchronizing this with pci_xhci_portregs_write()?

kevans added inline comments.
usr.sbin/bhyve/pci_xhci.c
2830

This is a little bit of a rabbit hole, and I think that'll be a separate commit since it may require some shuffling in other places (and we don't actually have the second thread to make it a practical problem yet). I'll prep that and update this shortly.