Skip to content

Commit 0a625fd

Browse files
davem330herbertx
authored andcommitted
crypto: n2 - Add Niagara2 crypto driver
Current deficiencies: 1) No HMAC hash support yet. 2) Although the algs are registered as ASYNC they always run synchronously. Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
1 parent bf06099 commit 0a625fd

5 files changed

Lines changed: 2423 additions & 0 deletions

File tree

‎drivers/crypto/Kconfig‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,18 @@ config CRYPTO_DEV_MV_CESA
170170

171171
Currently the driver supports AES in ECB and CBC mode without DMA.
172172

173+
config CRYPTO_DEV_NIAGARA2
174+
tristate "Niagara2 Stream Processing Unit driver"
175+
select CRYPTO_ALGAPI
176+
depends on SPARC64
177+
help
178+
Each core of a Niagara2 processor contains a Stream
179+
Processing Unit, which itself contains several cryptographic
180+
sub-units. One set provides the Modular Arithmetic Unit,
181+
used for SSL offload. The other set provides the Cipher
182+
Group, which can perform encryption, decryption, hashing,
183+
checksumming, and raw copies.
184+
173185
config CRYPTO_DEV_HIFN_795X
174186
tristate "Driver HIFN 795x crypto accelerator chips"
175187
select CRYPTO_DES

‎drivers/crypto/Makefile‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
obj-$(CONFIG_CRYPTO_DEV_PADLOCK_AES) += padlock-aes.o
22
obj-$(CONFIG_CRYPTO_DEV_PADLOCK_SHA) += padlock-sha.o
33
obj-$(CONFIG_CRYPTO_DEV_GEODE) += geode-aes.o
4+
obj-$(CONFIG_CRYPTO_DEV_NIAGARA2) += n2_crypto.o
5+
n2_crypto-objs := n2_core.o n2_asm.o
46
obj-$(CONFIG_CRYPTO_DEV_HIFN_795X) += hifn_795x.o
57
obj-$(CONFIG_CRYPTO_DEV_MV_CESA) += mv_cesa.o
68
obj-$(CONFIG_CRYPTO_DEV_TALITOS) += talitos.o

‎drivers/crypto/n2_asm.S‎

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
/* n2_asm.S: Hypervisor calls for NCS support.
2+
*
3+
* Copyright (C) 2009 David S. Miller <davem@davemloft.net>
4+
*/
5+
6+
#include <linux/linkage.h>
7+
#include <asm/hypervisor.h>
8+
#include "n2_core.h"
9+
10+
/* o0: queue type
11+
* o1: RA of queue
12+
* o2: num entries in queue
13+
* o3: address of queue handle return
14+
*/
15+
ENTRY(sun4v_ncs_qconf)
16+
mov HV_FAST_NCS_QCONF, %o5
17+
ta HV_FAST_TRAP
18+
stx %o1, [%o3]
19+
retl
20+
nop
21+
ENDPROC(sun4v_ncs_qconf)
22+
23+
/* %o0: queue handle
24+
* %o1: address of queue type return
25+
* %o2: address of queue base address return
26+
* %o3: address of queue num entries return
27+
*/
28+
ENTRY(sun4v_ncs_qinfo)
29+
mov %o1, %g1
30+
mov %o2, %g2
31+
mov %o3, %g3
32+
mov HV_FAST_NCS_QINFO, %o5
33+
ta HV_FAST_TRAP
34+
stx %o1, [%g1]
35+
stx %o2, [%g2]
36+
stx %o3, [%g3]
37+
retl
38+
nop
39+
ENDPROC(sun4v_ncs_qinfo)
40+
41+
/* %o0: queue handle
42+
* %o1: address of head offset return
43+
*/
44+
ENTRY(sun4v_ncs_gethead)
45+
mov %o1, %o2
46+
mov HV_FAST_NCS_GETHEAD, %o5
47+
ta HV_FAST_TRAP
48+
stx %o1, [%o2]
49+
retl
50+
nop
51+
ENDPROC(sun4v_ncs_gethead)
52+
53+
/* %o0: queue handle
54+
* %o1: address of tail offset return
55+
*/
56+
ENTRY(sun4v_ncs_gettail)
57+
mov %o1, %o2
58+
mov HV_FAST_NCS_GETTAIL, %o5
59+
ta HV_FAST_TRAP
60+
stx %o1, [%o2]
61+
retl
62+
nop
63+
ENDPROC(sun4v_ncs_gettail)
64+
65+
/* %o0: queue handle
66+
* %o1: new tail offset
67+
*/
68+
ENTRY(sun4v_ncs_settail)
69+
mov HV_FAST_NCS_SETTAIL, %o5
70+
ta HV_FAST_TRAP
71+
retl
72+
nop
73+
ENDPROC(sun4v_ncs_settail)
74+
75+
/* %o0: queue handle
76+
* %o1: address of devino return
77+
*/
78+
ENTRY(sun4v_ncs_qhandle_to_devino)
79+
mov %o1, %o2
80+
mov HV_FAST_NCS_QHANDLE_TO_DEVINO, %o5
81+
ta HV_FAST_TRAP
82+
stx %o1, [%o2]
83+
retl
84+
nop
85+
ENDPROC(sun4v_ncs_qhandle_to_devino)
86+
87+
/* %o0: queue handle
88+
* %o1: new head offset
89+
*/
90+
ENTRY(sun4v_ncs_sethead_marker)
91+
mov HV_FAST_NCS_SETHEAD_MARKER, %o5
92+
ta HV_FAST_TRAP
93+
retl
94+
nop
95+
ENDPROC(sun4v_ncs_sethead_marker)

0 commit comments

Comments
 (0)