Skip to contentSkip to conversation

NVMe: Initial commit for NVM Express device

PATCH New Keith Busch 1 participant 1 message Dec 15, 2012

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 NVMe: Initial commit for NVM Express device

NVM Express is an open standard for PCI-e attached Non-Volatile Memory storage. This commit adds an emulated device that supports the register interface and command set defined by this standard. The standard can be viewed at nvmexpress.org.

Cc Michael S. Tsirkin <[email protected]>
Cc Keith Busch <[email protected]>

---
Thanks to everyone I've received comments from first attempt. Apparently there are _rules_ my emulated device needs to follow in order to run correctly in this environment. :)

The most major change is none of the routines run in their own threads anymore. They are all timer callbacks that take the BQL. This single threads processes I was trying to parallelize before, so some of the code is simpler, albiet runs a little slower. The device uses the qemu block interface to communicate with the backing storage that represents the non-volatile memory of the nvme device.

I split the code into a header and c file. I know this is fairly large, but I don't see a nice way to significantly split this into multiple commits without crippling the functionality. There are some optional features here that could potenetially be removed from the initial commmit, but they don't take an appreciable amount of code space.

A lot had to change from the first revision, so my apologies if I missed or misunderstood something from the previous comments.

 MAINTAINERS             |    5 +
 default-configs/pci.mak |    1 +
 hw/Makefile.objs        |    2 +
 hw/nvme.c               | 2294 +++++++++++++++++++++++++++++++++++++++++++++++
 hw/nvme.h               |  678 ++++++++++++++
 hw/pci_ids.h            |    1 +
 6 files changed, 2981 insertions(+), 0 deletions(-)
 create mode 100644 hw/nvme.c
 create mode 100644 hw/nvme.h
MAINTAINERS +5 -0
index 2ede20d..ff5eeb5 100644
@@ -563,6 +563,11 @@ S: Supported
 F: hw/virtio-serial*
 F: hw/virtio-console*
 
+nvme
+M: Keith Busch <[email protected]>
+S: Supported
+F: hw/nvme*
+
 Xilinx EDK
 M: Peter Crosthwaite <[email protected]>
 M: Edgar E. Iglesias <[email protected]>
default-configs/pci.mak +1 -0
index ae9d1eb..eb67914 100644
@@ -11,6 +11,7 @@ CONFIG_PCNET_PCI=y
 CONFIG_PCNET_COMMON=y
 CONFIG_LSI_SCSI_PCI=y
 CONFIG_MEGASAS_SCSI_PCI=y
+CONFIG_NVME_PCI=y
 CONFIG_RTL8139_PCI=y
 CONFIG_E1000_PCI=y
 CONFIG_IDE_CORE=y
hw/Makefile.objs +2 -0
index d581d8d..fa5a5b3 100644
@@ -41,6 +41,8 @@ common-obj-$(CONFIG_I8259) += i8259_common.o i8259.o
 common-obj-y += fifo.o
 common-obj-y += pam.o
 
+common-obj-$(CONFIG_NVME_PCI) += nvme.o
+
 # PPC devices
 common-obj-$(CONFIG_PREP_PCI) += prep_pci.o
 common-obj-$(CONFIG_I82378) += i82378.o
hw/nvme.c new file +2294 -0

2,294 lines not on this page · raw message

hw/nvme.h new file +678 -0

678 lines not on this page · raw message

hw/pci_ids.h +1 -0
index 5df7245..bb7ba02 100644
@@ -17,6 +17,7 @@
 #define PCI_CLASS_STORAGE_IDE            0x0101
 #define PCI_CLASS_STORAGE_RAID           0x0104
[… more lines in the raw message]

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Signature · 1 line
1.7.0.4

Part of the diff is not shown here. View the raw message.