Systems · C · Operating Systems

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.

SpecificationNVMe 1.4
TargetQEMU
LanguageC

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

CLASSROOM KERNEL
↓
NVMe DRIVER
↓
ADMIN QUEUES
Submission · Completion
I/O QUEUES
Submission · Completion
↓
QEMU NVMe 1.4
Synchronization Semaphores
Completions Polling
Initialization Admin → I/O queue

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.

Queue initialization

Builds the administrative submission/completion queue pair and uses administrative commands to establish the I/O queue.

Polling

Uses polling to observe command completions instead of an interrupt-driven completion path.

Concurrency

Uses semaphores to protect shared queue state while allowing the driver to operate in a concurrent kernel environment.

Ring buffers

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.

01

Implement

Co-designed and implemented the NVMe driver and ring-buffer infrastructure with a partner, producing the four project-specific source and header files.

02

Integrate

Personally brought the driver into the classroom version of the kernel and worked through its interactions with the existing kernel environment.

03

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:

The repository contains the larger kernel. The four files above are the files my partner and I created; the subsequent classroom-kernel integration and validation work described here was my individual contribution.