Skip to contentSkip to conversation

hwrng: add support for Xiphera XIP8001B

PATCH Superseded Atte Tommiska 3 participants 8 messages Aug 20, 2020 – Aug 25, 2020

Subsystems (3)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover hwrng: add support for Xiphera XIP8001B

This patchset introduces a linux driver for Xiphera's XIP8001B IP. The IP is an FPGA-based TRNG which can be used in various FPGA families. The IP is in use in multiple customer projects and in Xiphera's own products.

v2: fixed the 'make dt_binding_check' errors in the devicetree schema.

Atte Tommiska (3):
dt-bindings: vendor-prefixes: Add Xiphera vendor prefix
dt-bindings: rng: add bindings for Xiphera XIP8001B hwnrg
hwrng: xiphera-trng: add support for XIP8001B hwrng

 .../bindings/rng/xiphera,xip8001b-trng.yaml   |  33 ++++
 .../devicetree/bindings/vendor-prefixes.yaml  |   2 +
 drivers/char/hw_random/Kconfig                |  10 ++
 drivers/char/hw_random/Makefile               |   1 +
 drivers/char/hw_random/xiphera-trng.c         | 151 ++++++++++++++++++
 5 files changed, 197 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/rng/xiphera,xip8001b-trng.yaml
 create mode 100644 drivers/char/hw_random/xiphera-trng.c

base-commit: bc752d2f345bf55d71b3422a6a24890ea03168dc

Signature · 1 line
2.28.0
#1 lore raw

PATCH v2 1/3 dt-bindings: vendor-prefixes: Add Xiphera vendor prefix

Xiphera is an FPGA-based cryptographic solutions provider based in Finland.
Website of the company: https://xiphera.com/

---
 Documentation/devicetree/bindings/vendor-prefixes.yaml | 2 ++
 1 file changed, 2 insertions(+)
Documentation/devicetree/bindings/vendor-prefixes.yaml +2 -0
index 2baee2c817c1..28ae913682b5 100644
@@ -1174,6 +1174,8 @@ patternProperties:
     description: Shenzhen Xingbangda Display Technology Co., Ltd
   "^xinpeng,.*":
     description: Shenzhen Xinpeng Technology Co., Ltd
+  "^xiphera,.*":
+    description: Xiphera Ltd.
   "^xlnx,.*":
     description: Xilinx
   "^xnano,.*":
Signature · 1 line
2.28.0
#3 lore raw

PATCH v2 2/3 dt-bindings: rng: add bindings for Xiphera XIP8001B hwnrg

In reply to Atte Tommiska

Document the device tree bindings of Xiphera's XIP8001B-trng IP.

---
 .../bindings/rng/xiphera,xip8001b-trng.yaml   | 33 +++++++++++++++++++
 1 file changed, 33 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/rng/xiphera,xip8001b-trng.yaml
Documentation/devicetree/bindings/rng/xiphera,xip8001b-trng.yaml new file +33 -0
new file mode 100644
index 000000000000..1e17e55762f1
@@ -0,0 +1,33 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/rng/xiphera,xip8001b-trng.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Xiphera XIP8001B-trng bindings
+
+maintainers:
+  - Atte Tommiska <[email protected]>
+
+description: |
+  Xiphera FPGA-based true random number generator intellectual property core.
+
+properties:
+  compatible:
+    const: xiphera,xip8001b-trng
+
+  reg:
+    maxItems: 1
+
+required:
+  - compatible
+  - reg
+
+additionalProperties: false
+
+examples:
+  - |
+    rng@43c00000 {
+        compatible = "xiphera,xip8001b-trng";
+        reg = <0x43c00000 0x10000>;
+    };
Signature · 1 line
2.28.0
maintainer Reviewed-by on v2 2/3
#4 lore raw

Re: [PATCH v2 2/3] dt-bindings: rng: add bindings for Xiphera XIP8001B hwnrg

Quoted 1 line · Atte Tommiska

Document the device tree bindings of Xiphera's XIP8001B-trng IP.

typo in the subject. Otherwise,

Quoted 6 lines
---
 .../bindings/rng/xiphera,xip8001b-trng.yaml   | 33 +++++++++++++++++++
 1 file changed, 33 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/rng/xiphera,xip8001b-trng.yaml
#5 lore raw

PATCH v2 3/3 hwrng: xiphera-trng: add support for XIP8001B hwrng

In reply to Atte Tommiska

Xiphera XIP8001B is an FPGA-based True Random Number Generator Intellectual Property (IP) Core which can be instantiated in multiple FPGA families. This driver adds Linux support for it through the hwrng interface.

---
 drivers/char/hw_random/Kconfig        |  10 ++
 drivers/char/hw_random/Makefile       |   1 +
 drivers/char/hw_random/xiphera-trng.c | 151 ++++++++++++++++++++++++++
 3 files changed, 162 insertions(+)
 create mode 100644 drivers/char/hw_random/xiphera-trng.c
drivers/char/hw_random/Kconfig +10 -0
index f976a49e1fb5..007d765a9253 100644
@@ -512,6 +512,16 @@ config HW_RANDOM_CCTRNG
 	  will be called cctrng.
 	  If unsure, say 'N'.
 
+config HW_RANDOM_XIPHERA
+	tristate "Xiphera FPGA based True Random Number Generator support"
+	depends on HAS_IOMEM
+	help
+	  This driver provides kernel-side support for Xiphera True Random
+	  Number Generator Intellectual Property Core.
+
+	  To compile this driver as a module, choose M here: the
+	  module will be called xiphera-trng.
+
 endif # HW_RANDOM
 
 config UML_RANDOM
drivers/char/hw_random/Makefile +1 -0
index 26ae06844f09..dfdcac81e384 100644
@@ -44,3 +44,4 @@ obj-$(CONFIG_HW_RANDOM_KEYSTONE) += ks-sa-rng.o
 obj-$(CONFIG_HW_RANDOM_OPTEE) += optee-rng.o
 obj-$(CONFIG_HW_RANDOM_NPCM) += npcm-rng.o
 obj-$(CONFIG_HW_RANDOM_CCTRNG) += cctrng.o
+obj-$(CONFIG_HW_RANDOM_XIPHERA) += xiphera-trng.o
drivers/char/hw_random/xiphera-trng.c new file +151 -0

151 lines not on this page · raw message

Signature · 1 line
2.28.0
#6 lore raw

Re: [PATCH v2 3/3] hwrng: xiphera-trng: add support for XIP8001B hwrng

Thank you for the patch! Perhaps something to improve:

Hi Atte,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on bc752d2f345bf55d71b3422a6a24890ea03168dc]

url:    https://github.com/0day-ci/linux/commits/Atte-Tommiska/hwrng-add-support-for-Xiphera-XIP8001B/20200820-190349
base:    bc752d2f345bf55d71b3422a6a24890ea03168dc
config: riscv-randconfig-c003-20200820 (attached as .config)
compiler: riscv32-linux-gcc (GCC) 9.3.0

If you fix the issue, kindly add following tag as appropriate

coccinelle warnings: (new ones prefixed by >>)

>> drivers/char/hw_random/xiphera-trng.c:141:3-8: No need to set .owner here. The core will do it.

Please review and possibly fold the followup patch.

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

#7 lore raw

[PATCH] hwrng: xiphera-trng: fix platform_no_drv_owner.cocci warnings

In reply to Atte Tommiska
drivers/char/hw_random/xiphera-trng.c:141:3-8: No need to set .owner here. The core will do it.

From: kernel test robot <[email protected]>

drivers/char/hw_random/xiphera-trng.c:141:3-8: No need to set .owner here. The core will do it.

Remove .owner field if calls are used which set it automatically

Generated by: scripts/coccinelle/api/platform_no_drv_owner.cocci

---

url:    https://github.com/0day-ci/linux/commits/Atte-Tommiska/hwrng-add-support-for-Xiphera-XIP8001B/20200820-190349
base:    bc752d2f345bf55d71b3422a6a24890ea03168dc
 xiphera-trng.c |    1 -
 1 file changed, 1 deletion(-)
drivers/char/hw_random/xiphera-trng.c +0 -1
@@ -138,7 +138,6 @@ MODULE_DEVICE_TABLE(of, xiphera_trng_of_
 static struct platform_driver xiphera_trng_driver = {
 	.driver = {
 		.name = "xiphera-trng",
-		.owner = THIS_MODULE,
 		.of_match_table	= xiphera_trng_of_match,
 	},
 	.probe = xiphera_trng_probe,