Kernel-Space NVMe Driver
A focused NVMe 1.4 implementation for the Nautilus research operating system, followed by hands-on kernel integration and end-to-end validation.
The problem
We needed a working NVMe block device for the Nautilus operating system environment used in the project. Rather than attempting to implement the entire NVMe specification, my partner and I built a deliberately small implementation around the functionality needed by the target QEMU device.
Architecture
The driver first creates an administrative submission/completion queue pair. It then submits the administrative commands required to create an I/O queue. I/O is handled through polling rather than interrupts, while semaphores guard the shared queues and provide the synchronization needed for concurrent access.
Implementation
The original driver and ring-buffer work was a joint effort with my partner. The implementation is intentionally focused: enough of NVMe 1.4 to communicate with the QEMU device and provide the block-device functionality required by the surrounding kernel.
Builds the administrative submission/completion queue pair and uses administrative commands to establish the I/O queue.
Uses polling to observe command completions instead of an interrupt-driven completion path.
Uses semaphores to protect shared queue state while allowing the driver to operate in a concurrent kernel environment.
Includes a small ring-buffer abstraction used by the driver to manage queue-oriented data structures.
My contributions
The project had two distinct phases for me: joint implementation of the driver, followed by individual integration and validation work.
Implement
Co-designed and implemented the NVMe driver and ring-buffer infrastructure with a partner, producing the four project-specific source and header files.
Integrate
Personally brought the driver into the classroom version of the kernel and worked through its interactions with the existing kernel environment.
Validate
Got higher-level systems working on top of the driver, including a filesystem and a memory-paging system, and verified that the integrated implementation passed the relevant tests.
Code
The original implementation lives inside a larger Nautilus kernel repository. These are the four files my partner and I created: