Skip to contentSkip to conversation

drivers: staging: Add support for nCipher HSM devices

PATCH In review Kim, David 2 participants 4 messages Dec 9, 2019

Subsystems (2)
lore
Share & tools
lore

Kim, David

author
#0 lore raw

PATCH 1/1 drivers: staging: Add support for nCipher HSM devices

Hi everybody,
​
This patch introduces a driver for nCipher's Solo and Solo XC range of PCIe hardware security modules (HSM), which provide key creation/management and cryptography services.

Upstreaming the nCipher driver into the kernel will allow early adopters of the latest kernel to upgrade and maintain their working systems when using an nCipher PCIe HSM. Further, having this driver in the kernel will be more convenient to our users and make a Linux based solution a more attractive option for others.​

Regards,
Dave Kim

 MAINTAINERS                       |    8 +
 drivers/staging/Kconfig           |    1 +
 drivers/staging/Makefile          |    1 +
 drivers/staging/ncipher/Kconfig   |    8 +
 drivers/staging/ncipher/Makefile  |    7 +
 drivers/staging/ncipher/fsl.c     |  911 ++++++++++++++++++++++
 drivers/staging/ncipher/fsl.h     |  117 +++
 drivers/staging/ncipher/hostif.c  | 1521 +++++++++++++++++++++++++++++++++++++
 drivers/staging/ncipher/i21555.c  |  553 ++++++++++++++
 drivers/staging/ncipher/i21555.h  |   68 ++
 drivers/staging/ncipher/solo.h    |  316 ++++++++
 include/uapi/linux/nshield_solo.h |  181 +++++
 12 files changed, 3692 insertions(+)
MAINTAINERS +8 -0
index 061d59a4a80b..c1125c999b95 100644
@@ -12605,6 +12605,14 @@ L: [email protected]
 S: Supported
 F: drivers/pci/controller/vmd.c
 
+PCI DRIVER FOR NSHIELD SOLO AND SOLO XC HARDWARE SECURITY MODULES (HSM)
+M: Tim Magee <[email protected]>
+M: David Kim <[email protected]>
+M: Hamish Cameron <[email protected]>
+L: [email protected]
+S: Supported
+F: drivers/staging/ncipher/
+
 PCI DRIVER FOR MICROSEMI SWITCHTEC
 M: Kurt Schwemmer <[email protected]>
 M: Logan Gunthorpe <[email protected]>
drivers/staging/Kconfig +1 -0
index eaf753b70ec5..0b5498d2415c 100644
@@ -124,6 +124,7 @@ source "drivers/staging/uwb/Kconfig"
 source "drivers/staging/exfat/Kconfig"
 
 source "drivers/staging/qlge/Kconfig"
+source "drivers/staging/ncipher/Kconfig"
 
 source "drivers/staging/hp/Kconfig"
 
drivers/staging/Makefile +1 -0
index 0a4396c9067b..be9f2e811528 100644
@@ -55,3 +55,4 @@ obj-$(CONFIG_EXFAT_FS) += exfat/
 obj-$(CONFIG_QLGE) += qlge/
 obj-$(CONFIG_NET_VENDOR_HP) += hp/
 obj-$(CONFIG_WFX) += wfx/
+obj-$(CONFIG_NCIPHER) += ncipher/
drivers/staging/ncipher/Kconfig new file +8 -0
new file mode 100644
index 000000000000..5b466cd1896a
@@ -0,0 +1,8 @@
+# SPDX-License-Identifier: GPL-2.0
+# Enable support for nCipher's nShield Solo and Solo XC
+config HSM_NCIPHER_NSHIELD_SOLO
+ tristate "nCipher Solo and Solo XC family of PCIe HSMs"
+ depends on PCI
+ help
+   Select this as built-in or module if you expect to use
+   a Hardware Security Module from nCipher's Solo or Solo XC range.
drivers/staging/ncipher/Makefile new file +7 -0
new file mode 100644
index 000000000000..b4d5f92addee
@@ -0,0 +1,7 @@
+# SPDX-License-Identifier: GPL-2.0
+#
+# Makefile for nCipher nShield HSM drivers
+#
+
+obj-$(CONFIG_HSM_NCIPHER_NSHIELD_SOLO) := nshield_solo.o
+nshield_solo-y := hostif.o fsl.o i21555.o
drivers/staging/ncipher/fsl.c new file +911 -0

911 lines not on this page · raw message

drivers/staging/ncipher/fsl.h new file +117 -0

117 lines not on this page · raw message

drivers/staging/ncipher/hostif.c new file +1521 -0

1,521 lines not on this page · raw message

drivers/staging/ncipher/i21555.c new file +553 -0

411 lines not on this page · raw message

drivers/staging/ncipher/i21555.h new file +68 -0

68 lines not on this page · raw message

drivers/staging/ncipher/solo.h new file +316 -0

316 lines not on this page · raw message

include/uapi/linux/nshield_solo.h new file +181 -0

181 lines not on this page · raw message

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

David Kim
Senior Software Engineer
Tel: +44 1223 703449

nCipher Security
One Station Square
Cambridge CB1 2GA
United Kingdom

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

#1 lore raw
Quoted 7 lines · David

Hi everybody,
​
This patch introduces a driver for nCipher's Solo and Solo XC range of PCIe hardware security modules (HSM), which provide key creation/management and cryptography services.

Quoted 5 lines

Upstreaming the nCipher driver into the kernel will allow early adopters of the latest kernel to upgrade and maintain their working systems when using an nCipher PCIe HSM. Further, having this driver in the kernel will be more convenient to our users and make a Linux based solution a more attractive option for others.​

Odd characters at your line-end here :(

Quoted 3 lines

Regards,
Dave Kim

No need for the "Hi" and "regards" in a changelog text :)

Most importantly, why is this being submitted for the staging directory? What is keeping it from being added to the "real" part of the kernel now?

If you need/want it in drivers/staging/ then you need a TODO file that lists what needs to be done to it in order to get out of drivers/staging/

thanks,

greg k-h

Quoted 4 lines

Odd line-end here :(

Quoted 107 lines

 MAINTAINERS                       |    8 +
 drivers/staging/Kconfig           |    1 +
 drivers/staging/Makefile          |    1 +
 drivers/staging/ncipher/Kconfig   |    8 +
 drivers/staging/ncipher/Makefile  |    7 +
 drivers/staging/ncipher/fsl.c     |  911 ++++++++++++++++++++++
 drivers/staging/ncipher/fsl.h     |  117 +++
 drivers/staging/ncipher/hostif.c  | 1521 +++++++++++++++++++++++++++++++++++++
 drivers/staging/ncipher/i21555.c  |  553 ++++++++++++++
 drivers/staging/ncipher/i21555.h  |   68 ++
 drivers/staging/ncipher/solo.h    |  316 ++++++++
 include/uapi/linux/nshield_solo.h |  181 +++++
 12 files changed, 3692 insertions(+)
MAINTAINERS +8 -0
index 061d59a4a80b..c1125c999b95 100644
@@ -12605,6 +12605,14 @@ L: [email protected]
 S: Supported
 F: drivers/pci/controller/vmd.c
 
+PCI DRIVER FOR NSHIELD SOLO AND SOLO XC HARDWARE SECURITY MODULES (HSM)
+M: Tim Magee <[email protected]>
+M: David Kim <[email protected]>
+M: Hamish Cameron <[email protected]>
+L: [email protected]
+S: Supported
+F: drivers/staging/ncipher/
+
 PCI DRIVER FOR MICROSEMI SWITCHTEC
 M: Kurt Schwemmer <[email protected]>
 M: Logan Gunthorpe <[email protected]>
drivers/staging/Kconfig +1 -0
index eaf753b70ec5..0b5498d2415c 100644
@@ -124,6 +124,7 @@ source "drivers/staging/uwb/Kconfig"
 source "drivers/staging/exfat/Kconfig"
 
 source "drivers/staging/qlge/Kconfig"
+source "drivers/staging/ncipher/Kconfig"
 
 source "drivers/staging/hp/Kconfig"
 
drivers/staging/Makefile +1 -0
index 0a4396c9067b..be9f2e811528 100644
@@ -55,3 +55,4 @@ obj-$(CONFIG_EXFAT_FS) += exfat/
 obj-$(CONFIG_QLGE) += qlge/
 obj-$(CONFIG_NET_VENDOR_HP) += hp/
 obj-$(CONFIG_WFX) += wfx/
+obj-$(CONFIG_NCIPHER) += ncipher/
drivers/staging/ncipher/Kconfig new file +8 -0
new file mode 100644
index 000000000000..5b466cd1896a
@@ -0,0 +1,8 @@
+# SPDX-License-Identifier: GPL-2.0
+# Enable support for nCipher's nShield Solo and Solo XC
+config HSM_NCIPHER_NSHIELD_SOLO
+ tristate "nCipher Solo and Solo XC family of PCIe HSMs"
+ depends on PCI
+ help
+   Select this as built-in or module if you expect to use
+   a Hardware Security Module from nCipher's Solo or Solo XC range.
drivers/staging/ncipher/Makefile new file +7 -0
new file mode 100644
index 000000000000..b4d5f92addee
@@ -0,0 +1,7 @@
+# SPDX-License-Identifier: GPL-2.0
+#
+# Makefile for nCipher nShield HSM drivers
+#
+
+obj-$(CONFIG_HSM_NCIPHER_NSHIELD_SOLO) := nshield_solo.o
+nshield_solo-y := hostif.o fsl.o i21555.o
drivers/staging/ncipher/fsl.c new file +16 -0
new file mode 100644
index 000000000000..5c4edeef64c0
@@ -0,0 +1,911 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ *
+ * fsl.c: nCipher PCI HSM FSL command driver
+ * Copyright 2019 nCipher Security Ltd
+ *
+ */
+
+#include "solo.h"
+#include "fsl.h"
+
+/**
+ * Resets FSL device.
+ *
+ * Extra device info is initialized the first time created.
+ *

drivers/staging/ncipher/fsl.c line 26

Quoted 10 lines
drivers/staging/ncipher/fsl.c new file +10 -0
+ * @param ndev common device.
+ * @returns 0 if successful, other value if error.
+ */
+static int fsl_create(struct nfp_dev *ndev)
+{
+ /* check for device */
+ if (!ndev) {
+ pr_err("%s: error: no device", __func__);
+ return -ENODEV;
+ }

Patch is totally corrupted and could not be applied even if I wanted to :(

Can you just use 'git send-email' to send patches out? web clients do not work at all (as you saw with your first attempt in html format...)

thanks,

greg k-h

author
#2 lore raw

Hi Greg,

Thanks for the speedy reply. I was hoping that setting my client to plain text only would actually do plain text only but I will try again with git send-email.

This is our first driver upstreaming and we targeted staging as a first entry point. If you feel it's more appropriate when I re-submit I can go directly to drivers/crypto instead.

Thanks,
Dave

David Kim
Senior Software Engineer
Tel: +44 1223 703449

nCipher Security
One Station Square
Cambridge CB1 2GA
United Kingdom

________________________________________
From: [email protected] <[email protected]> on behalf of [email protected] <[email protected]>
Sent: Monday, December 9, 2019 3:33 PM
To: Kim, David
Cc: [email protected]; [email protected]; Magee, Tim
Subject: Re: [PATCH] drivers: staging: Add support for nCipher HSM devices

Quoted 7 lines · David

Hi everybody,
​
This patch introduces a driver for nCipher's Solo and Solo XC range of PCIe hardware security modules (HSM), which provide key creation/management and cryptography services.

Quoted 5 lines

Upstreaming the nCipher driver into the kernel will allow early adopters of the latest kernel to upgrade and maintain their working systems when using an nCipher PCIe HSM. Further, having this driver in the kernel will be more convenient to our users and make a Linux based solution a more attractive option for others.​

Odd characters at your line-end here :(

Quoted 3 lines

Regards,
Dave Kim

No need for the "Hi" and "regards" in a changelog text :)

Most importantly, why is this being submitted for the staging directory? What is keeping it from being added to the "real" part of the kernel now?

If you need/want it in drivers/staging/ then you need a TODO file that lists what needs to be done to it in order to get out of drivers/staging/

thanks,

greg k-h

Quoted 4 lines

Odd line-end here :(

Quoted 107 lines

 MAINTAINERS                       |    8 +
 drivers/staging/Kconfig           |    1 +
 drivers/staging/Makefile          |    1 +
 drivers/staging/ncipher/Kconfig   |    8 +
 drivers/staging/ncipher/Makefile  |    7 +
 drivers/staging/ncipher/fsl.c     |  911 ++++++++++++++++++++++
 drivers/staging/ncipher/fsl.h     |  117 +++
 drivers/staging/ncipher/hostif.c  | 1521 +++++++++++++++++++++++++++++++++++++
 drivers/staging/ncipher/i21555.c  |  553 ++++++++++++++
 drivers/staging/ncipher/i21555.h  |   68 ++
 drivers/staging/ncipher/solo.h    |  316 ++++++++
 include/uapi/linux/nshield_solo.h |  181 +++++
 12 files changed, 3692 insertions(+)
MAINTAINERS +8 -0
index 061d59a4a80b..c1125c999b95 100644
@@ -12605,6 +12605,14 @@ L: [email protected]
 S: Supported
 F: drivers/pci/controller/vmd.c
 
+PCI DRIVER FOR NSHIELD SOLO AND SOLO XC HARDWARE SECURITY MODULES (HSM)
+M: Tim Magee <[email protected]>
+M: David Kim <[email protected]>
+M: Hamish Cameron <[email protected]>
+L: [email protected]
+S: Supported
+F: drivers/staging/ncipher/
+
 PCI DRIVER FOR MICROSEMI SWITCHTEC
 M: Kurt Schwemmer <[email protected]>
 M: Logan Gunthorpe <[email protected]>
drivers/staging/Kconfig +1 -0
index eaf753b70ec5..0b5498d2415c 100644
@@ -124,6 +124,7 @@ source "drivers/staging/uwb/Kconfig"
 source "drivers/staging/exfat/Kconfig"
 
 source "drivers/staging/qlge/Kconfig"
+source "drivers/staging/ncipher/Kconfig"
 
 source "drivers/staging/hp/Kconfig"
 
drivers/staging/Makefile +1 -0
index 0a4396c9067b..be9f2e811528 100644
@@ -55,3 +55,4 @@ obj-$(CONFIG_EXFAT_FS) += exfat/
 obj-$(CONFIG_QLGE) += qlge/
 obj-$(CONFIG_NET_VENDOR_HP) += hp/
 obj-$(CONFIG_WFX) += wfx/
+obj-$(CONFIG_NCIPHER) += ncipher/
drivers/staging/ncipher/Kconfig new file +8 -0
new file mode 100644
index 000000000000..5b466cd1896a
@@ -0,0 +1,8 @@
+# SPDX-License-Identifier: GPL-2.0
+# Enable support for nCipher's nShield Solo and Solo XC
+config HSM_NCIPHER_NSHIELD_SOLO
+ tristate "nCipher Solo and Solo XC family of PCIe HSMs"
+ depends on PCI
+ help
+   Select this as built-in or module if you expect to use
+   a Hardware Security Module from nCipher's Solo or Solo XC range.
drivers/staging/ncipher/Makefile new file +7 -0
new file mode 100644
index 000000000000..b4d5f92addee
@@ -0,0 +1,7 @@
+# SPDX-License-Identifier: GPL-2.0
+#
+# Makefile for nCipher nShield HSM drivers
+#
+
+obj-$(CONFIG_HSM_NCIPHER_NSHIELD_SOLO) := nshield_solo.o
+nshield_solo-y := hostif.o fsl.o i21555.o
drivers/staging/ncipher/fsl.c new file +16 -0
new file mode 100644
index 000000000000..5c4edeef64c0
@@ -0,0 +1,911 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ *
+ * fsl.c: nCipher PCI HSM FSL command driver
+ * Copyright 2019 nCipher Security Ltd
+ *
+ */
+
+#include "solo.h"
+#include "fsl.h"
+
+/**
+ * Resets FSL device.
+ *
+ * Extra device info is initialized the first time created.
+ *

drivers/staging/ncipher/fsl.c line 26

Quoted 10 lines
drivers/staging/ncipher/fsl.c new file +10 -0
+ * @param ndev common device.
+ * @returns 0 if successful, other value if error.
+ */
+static int fsl_create(struct nfp_dev *ndev)
+{
+ /* check for device */
+ if (!ndev) {
+ pr_err("%s: error: no device", __func__);
+ return -ENODEV;
+ }

Patch is totally corrupted and could not be applied even if I wanted to :(

Can you just use 'git send-email' to send patches out? web clients do not work at all (as you saw with your first attempt in html format...)

thanks,

greg k-h

#3 lore raw
Quoted 9 lines · David

Hi Greg,

Thanks for the speedy reply. I was hoping that setting my client to plain text only would actually do plain text only but I will try again with git send-email.

This is our first driver upstreaming and we targeted staging as a first entry point. If you feel it's more appropriate when I re-submit I can go directly to drivers/crypto instead.

Well why wouldn't it go to drivers/crypto instead? What is wrong with it that still needs to be done? Only stuff that needs work belongs in drivers/staging/.

thanks,

greg k-h