I've completed Project 3 of Pintos (scheduler, user programs, and virtual memory) and modified usb.c to disable legacy controller initialization. I'm using QEMU with a Q35 machine and the following setup for testing:
Code: Select all
qemu-system-x86_64 \
-machine q35 \
-drive file=usbdisk.img,format=raw \
-serial file:serial.log \
-display curses \
-m 64M \
-smp cores=1,threads=1,sockets=4 \
-device usb-kbd \
-usb \
-enable-kvm
Goal:
Get USB HID input (e.g., keyboard or mouse) working in Pintos, using the xHCI architecture. Eventually, I’d also like to explore booting Pintos from a USB 3.0 flash drive, but for now, I’m just trying to get basic device enumeration and input working.
My question:
Which parts of the xHCI spec are actually required to get this working?
I've looked through the xHCI spec and the Linux kernel’s implementation, but it's not clear to me which features are strictly necessary and which can be skipped (at least for now). I'm trying to keep things as simple as possible, so I don’t want to implement more than I need to.
For example, do I need to implement:
- All the commands like Configure Endpoint, Evaluate Context, Set TR Dequeue Pointer?
- Just a minimal set of registers (e.g. `USBCMD`, `USBSTS`, `PORTSC`, `CRCR`, `DCBAAP`, etc.)?
- Full Device Contexts with Input/Slot/Endpoint structures?
- All the TRB types, or only specific ones like Setup, Normal, and Event TRBs?
- The Event Ring and Command Ring? If so, how complex do these need to be?
What about features like:
- Streams and Stream Contexts?
- Bandwidth negotiation / latency tolerance?
- Scratchpad buffers?
- Extended Capabilities or Debug capability?
- Any hub-specific logic for root hubs?
What is the subset of these features would be necessary for my goal of basic USB 3.0 support?