crypto: add sun8i-ss driver for Allwinner Security System
Subsystems (4)
Corentin Labbe
maintainerv2 cover crypto: add sun8i-ss driver for Allwinner Security System
Hello
This patch serie adds support for the second version of Allwinner Security System. The first generation of the Security System is already handled by the sun4i-ss driver. Due to major change, the first driver cannot handle the second one.
This new Security System is present on A80 and A83T SoCs.
For the moment, the driver support only DES3/AES in ECB/CBC mode. Patchs for CTR/CTS, RSA and RNGs will came later.
This serie is tested with CRYPTO_MANAGER_EXTRA_TESTS and tested on:
sun8i-a83t-bananapi-m3
sun9i-a80-cubieboard4
This serie is based on top of the "crypto: add sun8i-ce driver for Allwinner crypto engine" serie.
Regards
Changes since v1:
- fixed uninitialized err in sun8i_ss_allocate_chanlist
- Added missing commit description on DT Documentation patch
Corentin Labbe (4):
crypto: Add Allwinner sun8i-ss cryptographic offloader
dt-bindings: crypto: Add DT bindings documentation for sun8i-ss
Security System
ARM: dts: sun8i: a83t: Add Security System node
ARM: dts: sun9i: a80: Add Security System node
.../bindings/crypto/allwinner,sun8i-ss.yaml | 64 ++ arch/arm/boot/dts/sun8i-a83t.dtsi | 10 + arch/arm/boot/dts/sun9i-a80.dtsi | 10 + drivers/crypto/allwinner/Kconfig | 28 + drivers/crypto/allwinner/Makefile | 1 + drivers/crypto/allwinner/sun8i-ss/Makefile | 2 + .../allwinner/sun8i-ss/sun8i-ss-cipher.c | 438 ++++++++++++ .../crypto/allwinner/sun8i-ss/sun8i-ss-core.c | 642 ++++++++++++++++++ drivers/crypto/allwinner/sun8i-ss/sun8i-ss.h | 218 ++++++ 9 files changed, 1413 insertions(+) create mode 100644 Documentation/devicetree/bindings/crypto/allwinner,sun8i-ss.yaml create mode 100644 drivers/crypto/allwinner/sun8i-ss/Makefile create mode 100644 drivers/crypto/allwinner/sun8i-ss/sun8i-ss-cipher.c create mode 100644 drivers/crypto/allwinner/sun8i-ss/sun8i-ss-core.c create mode 100644 drivers/crypto/allwinner/sun8i-ss/sun8i-ss.h
Signature · 1 line
2.21.0
Corentin Labbe
maintainerPATCH v2 1/4 crypto: Add Allwinner sun8i-ss cryptographic offloader
The Security System is an hardware cryptographic offloader present on Allwinner SoCs A80 and A83T.
It is different from the previous sun4i-ss.
This driver supports AES cipher in CBC and ECB mode.
--- drivers/crypto/allwinner/Kconfig | 28 + drivers/crypto/allwinner/Makefile | 1 + drivers/crypto/allwinner/sun8i-ss/Makefile | 2 + .../allwinner/sun8i-ss/sun8i-ss-cipher.c | 438 ++++++++++++ .../crypto/allwinner/sun8i-ss/sun8i-ss-core.c | 642 ++++++++++++++++++ drivers/crypto/allwinner/sun8i-ss/sun8i-ss.h | 218 ++++++ 6 files changed, 1329 insertions(+) create mode 100644 drivers/crypto/allwinner/sun8i-ss/Makefile create mode 100644 drivers/crypto/allwinner/sun8i-ss/sun8i-ss-cipher.c create mode 100644 drivers/crypto/allwinner/sun8i-ss/sun8i-ss-core.c create mode 100644 drivers/crypto/allwinner/sun8i-ss/sun8i-ss.h
drivers/crypto/allwinner/Kconfig +28 -0
@@ -58,3 +58,31 @@ config CRYPTO_DEV_SUN8I_CE_DEBUG Say y to enable sun8i-ce debug stats. This will create /sys/kernel/debug/sun8i-ce/stats for displaying the number of requests per flow and per algorithm. + +config CRYPTO_DEV_SUN8I_SS + tristate "Support for Allwinner Security System cryptographic offloader" + select CRYPTO_BLKCIPHER + select CRYPTO_ENGINE + select CRYPTO_ECB + select CRYPTO_CBC + select CRYPTO_AES + select CRYPTO_DES + depends on CRYPTO_DEV_ALLWINNER + depends on PM + help + Select y here to have support for the Security System available on + Allwinner SoC A80, A83T. + The Security System handle AES/3DES ciphers in ECB/CBC mode. + + To compile this driver as a module, choose M here: the module + will be called sun8i-ss. + +config CRYPTO_DEV_SUN8I_SS_DEBUG + bool "Enable sun8i-ss stats" + depends on CRYPTO_DEV_SUN8I_SS + depends on DEBUG_FS + help + Say y to enable sun8i-ss debug stats. + This will create /sys/kernel/debug/sun8i-ss/stats for displaying + the number of requests per flow and per algorithm. +
drivers/crypto/allwinner/Makefile +1 -0
@@ -1,2 +1,3 @@ obj-$(CONFIG_CRYPTO_DEV_SUN4I_SS) += sun4i-ss/ obj-$(CONFIG_CRYPTO_DEV_SUN8I_CE) += sun8i-ce/ +obj-$(CONFIG_CRYPTO_DEV_SUN8I_SS) += sun8i-ss/
drivers/crypto/allwinner/sun8i-ss/Makefile new file +2 -0
@@ -0,0 +1,2 @@ +obj-$(CONFIG_CRYPTO_DEV_SUN8I_SS) += sun8i-ss.o +sun8i-ss-y += sun8i-ss-core.o sun8i-ss-cipher.o
drivers/crypto/allwinner/sun8i-ss/sun8i-ss-cipher.c new file +438 -0
438 lines not on this page · raw message
drivers/crypto/allwinner/sun8i-ss/sun8i-ss-core.c new file +642 -0
642 lines not on this page · raw message
drivers/crypto/allwinner/sun8i-ss/sun8i-ss.h new file +218 -0
218 lines not on this page · raw message
Signature · 1 line
2.21.0
Corentin Labbe
maintainerPATCH v2 2/4 dt-bindings: crypto: Add DT bindings documentation for sun8i-ss Security System
In reply to Corentin LabbeThis patch adds documentation for Device-Tree bindings of the Security System cryptographic offloader driver.
--- .../bindings/crypto/allwinner,sun8i-ss.yaml | 64 +++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 Documentation/devicetree/bindings/crypto/allwinner,sun8i-ss.yaml
Documentation/devicetree/bindings/crypto/allwinner,sun8i-ss.yaml new file +64 -0
@@ -0,0 +1,64 @@ +# SPDX-License-Identifier: GPL-2.0 +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/crypto/allwinner,sun8i-ss.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Allwinner Security System v2 driver + +maintainers: + - Corentin Labbe <[email protected]> + +properties: + compatible: + enum: + - allwinner,sun8i-a83t-crypto + - allwinner,sun9i-a80-crypto + + reg: + maxItems: 1 + + interrupts: + maxItems: 1 + + clocks: + items: + - description: Bus clock + - description: Module clock + + clock-names: + items: + - const: bus + - const: mod + + resets: + maxItems: 1 + + reset-names: + const: bus + +required: + - compatible + - reg + - interrupts + - clocks + - clock-names + +additionalProperties: false + +examples: + - | + #include <dt-bindings/interrupt-controller/arm-gic.h> + #include <dt-bindings/clock/sun8i-a83t-ccu.h> + #include <dt-bindings/reset/sun8i-a83t-ccu.h> + + crypto: crypto@1c15000 { + compatible = "allwinner,sun8i-a83t-crypto"; + reg = <0x01c15000 0x1000>; + interrupts = <GIC_SPI 94 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&ccu CLK_BUS_SS>, <&ccu CLK_SS>; + clock-names = "bus", "mod"; + resets = <&ccu RST_BUS_SS>; + reset-names = "bus"; + }; +
Signature · 1 line
2.21.0
Re: [PATCH v2 2/4] dt-bindings: crypto: Add DT bindings documentation for sun8i-ss Security System
Hi,
Quoted 40 lines · Corentin Labbe
This patch adds documentation for Device-Tree bindings of the Security System cryptographic offloader driver.
Signed-off-by Corentin Labbe <[email protected]>--- .../bindings/crypto/allwinner,sun8i-ss.yaml | 64 +++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 Documentation/devicetree/bindings/crypto/allwinner,sun8i-ss.yamlDocumentation/devicetree/bindings/crypto/allwinner,sun8i-ss.yaml new file +25
-0@@ -0,0 +1,64 @@ +# SPDX-License-Identifier: GPL-2.0 +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/crypto/allwinner,sun8i-ss.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Allwinner Security System v2 driver + +maintainers: + - Corentin Labbe <[email protected]> + +properties: + compatible: + enum: + - allwinner,sun8i-a83t-crypto + - allwinner,sun9i-a80-crypto + + reg: + maxItems: 1 + + interrupts: + maxItems: 1 + + clocks: + items:
Documentation/devicetree/bindings/crypto/allwinner,sun8i-ss.yaml line 35
Quoted 10 lines
Documentation/devicetree/bindings/crypto/allwinner,sun8i-ss.yaml new file +10
-0+ - description: Bus clock + - description: Module clock + + clock-names: + items: + - const: bus + - const: mod + + resets: + maxItems: 1
The A83t at least has a reset line, so please make a condition to have it required.
Documentation/devicetree/bindings/crypto/allwinner,sun8i-ss.yaml line 38
Quoted 2 lines
Documentation/devicetree/bindings/crypto/allwinner,sun8i-ss.yaml new file +2
-0+ reset-names: + const: bus
You don't need reset-names at all in that binding.
Maxime
Corentin Labbe
maintainerRe: [PATCH v2 2/4] dt-bindings: crypto: Add DT bindings documentation for sun8i-ss Security System
Quoted 48 lines · Maxime Ripard
Hi,
Quoted 45 lines · Corentin Labbe
This patch adds documentation for Device-Tree bindings of the Security System cryptographic offloader driver.
Signed-off-by Corentin Labbe <[email protected]>--- .../bindings/crypto/allwinner,sun8i-ss.yaml | 64 +++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 Documentation/devicetree/bindings/crypto/allwinner,sun8i-ss.yamlDocumentation/devicetree/bindings/crypto/allwinner,sun8i-ss.yaml new file +30
-0@@ -0,0 +1,64 @@ +# SPDX-License-Identifier: GPL-2.0 +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/crypto/allwinner,sun8i-ss.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Allwinner Security System v2 driver + +maintainers: + - Corentin Labbe <[email protected]> + +properties: + compatible: + enum: + - allwinner,sun8i-a83t-crypto + - allwinner,sun9i-a80-crypto + + reg: + maxItems: 1 + + interrupts: + maxItems: 1 + + clocks: + items: + - description: Bus clock + - description: Module clock + + clock-names: + items:
Quoted 9 lines
Documentation/devicetree/bindings/crypto/allwinner,sun8i-ss.yaml line 35
Quoted 5 lines
Documentation/devicetree/bindings/crypto/allwinner,sun8i-ss.yaml new file +5
-0+ - const: bus + - const: mod + + resets: + maxItems: 1The A83t at least has a reset line, so please make a condition to have it required.
Hello
The A80 have one also, so I need to set minItems: 1
But setting both minItems: 1 and maxItems:1 lead to a check failure:
properties:resets: {'minItems': 1, 'maxItems': 1} is not valid under any of the given schemas
How to do that ?
Furthermore, I try to do that for interrupts and reg, since they are also mandatory and same failure.
Quoted 4 lines
Documentation/devicetree/bindings/crypto/allwinner,sun8i-ss.yaml line 38
Quoted 2 lines
Documentation/devicetree/bindings/crypto/allwinner,sun8i-ss.yaml new file +2
-0+ reset-names: + const: busYou don't need reset-names at all in that binding.
Fixed
Thanks
Re: [PATCH v2 2/4] dt-bindings: crypto: Add DT bindings documentation for sun8i-ss Security System
Quoted 61 lines · Corentin Labbe
Quoted 48 lines · Maxime Ripard
Hi,
Quoted 45 lines · Corentin Labbe
This patch adds documentation for Device-Tree bindings of the Security System cryptographic offloader driver.
Signed-off-by Corentin Labbe <[email protected]>--- .../bindings/crypto/allwinner,sun8i-ss.yaml | 64 +++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 Documentation/devicetree/bindings/crypto/allwinner,sun8i-ss.yamlDocumentation/devicetree/bindings/crypto/allwinner,sun8i-ss.yaml new file +30
-0@@ -0,0 +1,64 @@ +# SPDX-License-Identifier: GPL-2.0 +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/crypto/allwinner,sun8i-ss.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Allwinner Security System v2 driver + +maintainers: + - Corentin Labbe <[email protected]> + +properties: + compatible: + enum: + - allwinner,sun8i-a83t-crypto + - allwinner,sun9i-a80-crypto + + reg: + maxItems: 1 + + interrupts: + maxItems: 1 + + clocks: + items: + - description: Bus clock + - description: Module clock + + clock-names: + items:Quoted 9 lines
Documentation/devicetree/bindings/crypto/allwinner,sun8i-ss.yaml line 35
Quoted 5 lines
Documentation/devicetree/bindings/crypto/allwinner,sun8i-ss.yaml new file +5
-0+ - const: bus + - const: mod + + resets: + maxItems: 1The A83t at least has a reset line, so please make a condition to have it required.
Hello
Quoted 7 lines
The A80 have one also, so I need to set minItems: 1
But setting both minItems: 1 and maxItems:1 lead to a check failure:properties:resets: {'minItems': 1, 'maxItems': 1} is not valid under any of the given schemas
How to do that ?
IIRC the meta-schema prevent having both because the tooling will insert it for you.
It doesn't really matter at this level though. maxItems alone will make sure that there's a single element, and the schemas in the tools will make sure that the type for resets is correct.
What you'd need here though would be to add resets to the list of required properties, otherwise it will only be checked against if the property is there.
Corentin Labbe
maintainerPATCH v2 3/4 ARM: dts: sun8i: a83t: Add Security System node
In reply to Corentin LabbeThe Security System is a hardware cryptographic accelerator that support AES/MD5/SHA1/DES/3DES/PRNG/RSA algorithms.
It could be found on Allwinner SoC A80 and A83T
This patch add it on the Allwinner A83T SoC Device-tree.
--- arch/arm/boot/dts/sun8i-a83t.dtsi | 10 ++++++++++ 1 file changed, 10 insertions(+)
arch/arm/boot/dts/sun8i-a83t.dtsi +10 -0
@@ -583,6 +583,16 @@ reg = <0x1c14000 0x400>; }; + crypto: crypto@1c15000 { + compatible = "allwinner,sun8i-a83t-crypto"; + reg = <0x01c15000 0x1000>; + interrupts = <GIC_SPI 80 IRQ_TYPE_LEVEL_HIGH>; + resets = <&ccu RST_BUS_SS>; + reset-names = "bus"; + clocks = <&ccu CLK_BUS_SS>, <&ccu CLK_SS>; + clock-names = "bus", "mod"; + }; + usb_otg: usb@1c19000 { compatible = "allwinner,sun8i-a83t-musb", "allwinner,sun8i-a33-musb";
Signature · 1 line
2.21.0
Corentin Labbe
maintainerPATCH v2 4/4 ARM: dts: sun9i: a80: Add Security System node
In reply to Corentin LabbeThis patchs the node for sun8i-ss which is availlable on the A80.
--- arch/arm/boot/dts/sun9i-a80.dtsi | 10 ++++++++++ 1 file changed, 10 insertions(+)
arch/arm/boot/dts/sun9i-a80.dtsi +10 -0
@@ -457,6 +457,16 @@ reg = <0x01700000 0x100>; }; + crypto: crypto@1c02000 { + compatible = "allwinner,sun9i-a80-crypto"; + reg = <0x01c02000 0x1000>; + interrupts = <GIC_SPI 80 IRQ_TYPE_LEVEL_HIGH>; + resets = <&ccu RST_BUS_SS>; + reset-names = "bus"; + clocks = <&ccu CLK_BUS_SS>, <&ccu CLK_SS>; + clock-names = "bus", "mod"; + }; + mmc0: mmc@1c0f000 { compatible = "allwinner,sun9i-a80-mmc"; reg = <0x01c0f000 0x1000>;
Signature · 1 line
2.21.0