Skip to contentSkip to conversation

nvme header reshuffle V2

PATCH New Christoph Hellwig 1 participant 4 messages Oct 3, 2015

Subsystems (2)
lore
Share & tools
lore

Christoph Hellwig

author maintainer
#0 lore raw

This series reworks the header organisation in the nvme driver. Currently there are two headers: include/uapi/linux/nvme.h, which contains the ioctl ABI and a lot of hardware description constants and include/linux/nvme.h which contains more hardware descriptions constants as well as driver internals.

This series splits them into one header each for the ioctl ABI, hardware description and driver internals.

Changes since V1:
- rebase on top of Keith' namespace refcounting changes

author maintainer
#1 lore raw

PATCH 1/3 nvme: add a local nvme.h header

Add a new drivers/block/nvme.h which contains all the driver internal interface.

Signed-off-by Christoph Hellwig <hch at lst.de>
Acked-by Keith Busch <keith.busch at intel.com>
---
 drivers/block/nvme-core.c |   3 +-
 drivers/block/nvme-scsi.c |   2 +-
 drivers/block/nvme.h      | 133 ++++++++++++++++++++++++++++++++++++++++++++++
 include/linux/nvme.h      | 114 ---------------------------------------
 4 files changed, 136 insertions(+), 116 deletions(-)
 create mode 100644 drivers/block/nvme.h
drivers/block/nvme-core.c +2 -1
index 01a6d1b..a20f66a 100644
@@ -12,7 +12,6 @@
  * more details.
  */
 
-#include <linux/nvme.h>
 #include <linux/bitops.h>
 #include <linux/blkdev.h>
 #include <linux/blk-mq.h>
@@ -43,6 +42,8 @@
 #include <scsi/sg.h>
 #include <asm-generic/io-64-nonatomic-lo-hi.h>
 
+#include "nvme.h"
+
 #define NVME_MINORS		(1U << MINORBITS)
 #define NVME_Q_DEPTH		1024
 #define NVME_AQ_DEPTH		256
drivers/block/nvme-scsi.c +1 -1
index e5a63f0..c3d8d38 100644
@@ -17,7 +17,6 @@
  * each command is translated.
  */
 
-#include <linux/nvme.h>
 #include <linux/bio.h>
 #include <linux/bitops.h>
 #include <linux/blkdev.h>
@@ -45,6 +44,7 @@
 #include <scsi/sg.h>
 #include <scsi/scsi.h>
 
+#include "nvme.h"
 
 static int sg_version_num = 30534;	/* 2 digits for each component */
 
drivers/block/nvme.h new file +133 -0

133 lines not on this page · raw message

include/linux/nvme.h +0 -114

124 lines not on this page · raw message

Signature · 1 line
1.9.1
author maintainer
#2 lore raw

PATCH 2/3 nvme: move hardware structures out of the uapi version of nvme.h

In reply to Christoph Hellwig

Currently all NVMe command and completion structures are exposed to userspace through the uapi version of nvme.h. They are not an ABI between the kernel and userspace, and will change in C-incompatible way for future versions of the spec. Move them to the kernel version of the file and rename the uapi header to nvme_ioctl.h so that userspace can easily detect the presence of the new clean header. Nvme-cli already carries a local copy of the header, so it won't be affected by this move.

Signed-off-by Christoph Hellwig <hch at lst.de>
Acked-by Keith Busch <keith.busch at intel.com>
---
 drivers/block/nvme-core.c       |   1 +
 include/linux/nvme.h            | 526 ++++++++++++++++++++++++++++++++++-
 include/uapi/linux/nvme.h       | 589 ----------------------------------------
 include/uapi/linux/nvme_ioctl.h |  65 +++++
 4 files changed, 590 insertions(+), 591 deletions(-)
 delete mode 100644 include/uapi/linux/nvme.h
 create mode 100644 include/uapi/linux/nvme_ioctl.h
drivers/block/nvme-core.c +1 -0
index a20f66a..a526696 100644
@@ -42,6 +42,7 @@
 #include <scsi/sg.h>
 #include <asm-generic/io-64-nonatomic-lo-hi.h>
 
+#include <uapi/linux/nvme_ioctl.h>
 #include "nvme.h"
 
 #define NVME_MINORS		(1U << MINORBITS)
include/linux/nvme.h +524 -2

536 lines not on this page · raw message

include/uapi/linux/nvme.h deleted +0 -589

589 lines not on this page · raw message

include/uapi/linux/nvme_ioctl.h new file +65 -0

65 lines not on this page · raw message

Signature · 1 line
1.9.1
author maintainer
#3 lore raw

PATCH 3/3 nvme.h: add missing nvme_id_ctrl endianess annotations

In reply to Christoph Hellwig
Signed-off-by Christoph Hellwig <hch at lst.de>
Acked-by Keith Busch <keith.busch at intel.com>
---
 include/linux/nvme.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
include/linux/nvme.h +2 -2
index 91a8054..9668d35 100644
@@ -104,8 +104,8 @@ struct nvme_id_ctrl {
 	__u8			ieee[3];
 	__u8			mic;
 	__u8			mdts;
-	__u16			cntlid;
-	__u32			ver;
+	__le16			cntlid;
+	__le32			ver;
 	__u8			rsvd84[172];
 	__le16			oacs;
 	__u8			acl;
Signature · 1 line
1.9.1