Feature #14294


Want NVMe admin passthru command

Added by Benjamin Naecker 8 months ago. Updated 7 months ago.

driver - device drivers
Start date:
Due date:
% Done:


Estimated time:
Gerrit CR:


Many NVMe devices support vendor-specific commands, such as telemetry or vendor-defined log pages. We'd like to provide a method for writing vendor-specific commands in userspace, and submitting those to the device on the user's behalf.

Files (730 Bytes) Benjamin Naecker, 2022-01-04 09:40 PM
Actions #1

Updated by Electric Monk 8 months ago

  • Gerrit CR set to 1819
Actions #2

Updated by Benjamin Naecker 8 months ago

This ticket tracks work adding a new ioctl to the nvme driver, `NVME_IOC_PASSTHRU`, and a new type to represent the passed-through command. The driver should do some sanity checks on the data, and then submit the data as an entry on the device's admin command queue. The results of the command should be passed back to the caller in the struct provided.

Actions #3

Updated by Benjamin Naecker 7 months ago

The proposed patch modifies some of the internal memory-management of the NVMe driver. Specifically, the deprecated interface for iterating over DMA cookies (`ddi_dma_nextcookie`) has been removed, in favor of the explicit index-based `ddi_dma_cookie_get`. Also, physical-region page (PRP) lists have been implemented, since the passthru command may conceivably require any amount of data up to the limits imposed by the controller.

To verify that these changes don't impact the normal data path, I ran a workload using FIO. The script is attached, which reported zero errors.

Actions #4

Updated by Benjamin Naecker 7 months ago

I've also run a few other tests. I verified the code that does some sanity checks on the passthru command (valid buffer size, valid opcode, device support), with a small C program compiled for both 64-bit and 32-bit. I also ran an actual vendor-specific command on Western Digital drives. Certain models support signal integrity eye-diagrams. I collected and validated a number of these using a Rust userland program.

Actions #5

Updated by Electric Monk 7 months ago

  • Status changed from New to Closed
  • % Done changed from 0 to 100

git commit eb7b3ff7f0a23dbf314498913db23e56237396c0

commit  eb7b3ff7f0a23dbf314498913db23e56237396c0
Author: Benjamin Naecker <>
Date:   2022-01-05T17:50:15.000Z

    14294 Want NVMe admin passthru command
    Reviewed by: Robert Mustacchi <>
    Reviewed by: Toomas Soome <>
    Reviewed by: Hans Rosenfeld <>
    Approved by: Dan McDonald <>


Also available in: Atom PDF