Skip to content

drivers/usbhost: Separate the xHCI driver from the PCI bus. - #19860

Merged
acassis merged 2 commits into
apache:masterfrom
Fishwaldo:upstream-xhci-pci-split
Aug 18, 2026
Merged

drivers/usbhost: Separate the xHCI driver from the PCI bus.#19860
acassis merged 2 commits into
apache:masterfrom
Fishwaldo:upstream-xhci-pci-split

Conversation

@Fishwaldo

@Fishwaldo Fishwaldo commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

Summary

Nothing in the xHCI controller driver is PCI-specific beyond finding the
registers and the interrupt, so an SoC that wires a controller directly could
not use any of it.

Two commits deliberately. The first is a pure git mv of usbhost_xhci_pci.c
to usbhost_xhci.c, recorded as a rename so git log --follow keeps reaching
the original driver history, together with the two build-file references so the
commit still builds on its own. The second adds the new usbhost_xhci_pci.c -
the ID table, the BAR mapping and the MSI-X vector - and makes the generic
edits.

include/nuttx/usb/xhci.h carries what passes between them: the register base,
a way to attach the interrupt, and a name to report the controller by, since a
system may have more than one. The interrupt belongs to the bus, which attaches
and detaches it; the driver never holds an interrupt number, so there is
nothing for the two sides to disagree about.

USBHOST_XHCI is the driver and is not selectable on its own;
USBHOST_XHCI_PCI selects it. Another bus adds its own symbol beside it.

Impact

No functional change intended. Existing configurations keep working through
USBHOST_XHCI_PCI.

Testing

Built for qemu-intel64:nsh at both commits with the driver compiled and
linked; the rename commit builds on its own, so the series stays bisectable.

Run at the tip under QEMU with -device qemu-xhci and a usb-storage device,
reading back qemu-xhci-regression-ok - unchanged from #19745, which is the
point of a move.

History is preserved:

$ git log --follow --oneline drivers/usbhost/usbhost_xhci.c | tail -3
...
0dccc8ba21 include/debug.h: Move to include/nuttx/debug.h
fab4f68b6f drivers/usbhost: add xHCI support

@github-actions github-actions Bot added Size: XL The size of the change in this PR is very large. Consider breaking down the PR into smaller pieces. Area: USB labels Aug 16, 2026
@github-actions

github-actions Bot commented Aug 16, 2026

Copy link
Copy Markdown

MemBrowse Memory Report

No memory changes detected for:

@github-actions

Copy link
Copy Markdown

🔗 Cross-repo PR dependencies

The read-only Build run reported the following dependent PR(s) and fetched head SHA(s):

CI run: https://github.com/apache/nuttx/actions/runs/31938194969

@jerpelea jerpelea left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please remove the commits belonging to
#19745

@Fishwaldo

Fishwaldo commented Aug 17, 2026

Copy link
Copy Markdown
Contributor Author

@jerpelea I tried to remove #19745's commits from this branch, and it does not work: this PR splits the file that #19745 fixes, so my commits only exist on top of #19745 - Depends-On: mechanism does not help either.

These PR's have to merge in order #19745, 19860, 19861 and 19862. Thats the reason I originally opened as a single PR do avoid these stacked PR... But I was asked to split it up.

So... either one large PR doing all the work, or 4 smaller PR's that will have to go through a cycle till we get xhci in a form that can be used on other platforms that Qemu.

(i'll rebase each PR as each parent gets merged if needed so any conflicts are resolved)

(replying here - but same justification for your comments on the other PR about removing commits)

Pure rename, so that the history of the driver follows it into the file
that keeps the bulk of the code.  The PCI attachment is added back as a
new usbhost_xhci_pci.c in the commit that follows.

Assisted-by: Claude:claude-opus-5
Signed-off-by: Justin Hammond <justin@dynam.ac>
Nothing in the controller driver is PCI-specific beyond finding the
registers and the interrupt, so an SoC wiring an xHCI controller
directly could not use any of it.

usbhost_xhci.c is now the driver; usbhost_xhci_pci.c is the PCI
attachment, holding the ID table, the BAR mapping and the MSI-X vector.
include/nuttx/usb/xhci.h carries what passes between them: the register
base, a way to attach the interrupt, and a name to report the controller
by, since a system may have more than one.

The interrupt belongs to the bus: the bus attaches and detaches it, and
the driver never holds an interrupt number.

USBHOST_XHCI is the driver and is not selectable on its own;
USBHOST_XHCI_PCI selects it.  Another bus adds its own symbol beside it.

No functional change intended.

Assisted-by: Claude:claude-opus-5
Signed-off-by: Justin Hammond <justin@dynam.ac>
@Fishwaldo
Fishwaldo force-pushed the upstream-xhci-pci-split branch from c6bc536 to c69170f Compare August 17, 2026 13:15
@Fishwaldo

Copy link
Copy Markdown
Contributor Author

Rebased after #19745 landed.

@xiaoxiang781216

Copy link
Copy Markdown
Contributor

@jerpelea I tried to remove #19745's commits from this branch, and it does not work: this PR splits the file that #19745 fixes, so my commits only exist on top of #19745 - Depends-On: mechanism does not help either.

These PR's have to merge in order #19745, 19860, 19861 and 19862. Thats the reason I originally opened as a single PR do avoid these stacked PR... But I was asked to split it up.

So... either one large PR doing all the work, or 4 smaller PR's that will have to go through a cycle till we get xhci in a form that can be used on other platforms that Qemu.

(i'll rebase each PR as each parent gets merged if needed so any conflicts are resolved)

(replying here - but same justification for your comments on the other PR about removing commits)

@Fishwaldo you can keep these pr in the draft state until the dependence pr is merged, so the maintainer can know which pr they should review first.

@Fishwaldo

Copy link
Copy Markdown
Contributor Author

Done. Thanks

Comment thread drivers/usbhost/CMakeLists.txt
@acassis
acassis merged commit 82fb0d8 into apache:master Aug 18, 2026
69 of 91 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: USB Size: XL The size of the change in this PR is very large. Consider breaking down the PR into smaller pieces.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants