crypto: amlogic: enable working on big endian kernel
Subsystems (2)
Corentin Labbe
maintainerPATCH 1/1 crypto: amlogic: enable working on big endian kernel
On big endian kernel, the GXL crypto driver does not works. This patch do the necessary modification to permit it to work on BE kernel (removing bitfield and adds some cpu_to_le32).
Fixes 48fe583fe541 ("crypto: amlogic - Add crypto accelerator for amlogic GXL")
Signed-off-by Corentin Labbe <[email protected]>
--- drivers/crypto/amlogic/amlogic-gxl-cipher.c | 26 +++++------ drivers/crypto/amlogic/amlogic-gxl.h | 51 +++++++++------------ 2 files changed, 34 insertions(+), 43 deletions(-)
drivers/crypto/amlogic/amlogic-gxl-cipher.c +13 -13
@@ -101,6 +101,7 @@ static int meson_cipher(struct skcipher_request *areq)unsigned int keyivlen, ivsize, offset, tloffset;dma_addr_t phykeyiv;void *backup_iv =NULL , *bkeyiv; +__le32 v; algt = container_of(alg, struct meson_alg_template, alg.skcipher);
@@ -165,11 +166,11 @@ static int meson_cipher(struct skcipher_request *areq) desc = &mc->chanlist[flow].tl[tloffset];memset (desc,0 ,sizeof (struct meson_desc )); todo =min (keyivlen - eat,16u ); - desc->t_src = phykeyiv + i *16 ; - desc->t_dst = i *16 ; - desc->len =16 ; - desc->mode =MODE_KEY ; - desc->owner =1 ; + desc->t_src =cpu_to_le32 (phykeyiv + i *16 ); + desc->t_dst =cpu_to_le32 (i *16 ); + v = (MODE_KEY <<20 ) |DESC_OWN |16 ; + desc->t_status =cpu_to_le32 (v); + eat += todo; i++; tloffset++;
@@ -208,18 +209,17 @@ static int meson_cipher(struct skcipher_request *areq) desc = &mc->chanlist[flow].tl[tloffset];memset (desc,0 ,sizeof (struct meson_desc )); - desc->t_src =sg_dma_address (src_sg); - desc->t_dst =sg_dma_address (dst_sg); + desc->t_src =cpu_to_le32 (sg_dma_address (src_sg)); + desc->t_dst =cpu_to_le32 (sg_dma_address (dst_sg)); todo =min (len,sg_dma_len (src_sg)); - desc->owner =1 ; - desc->len = todo; - desc->mode = op->keymode; - desc->op_mode = algt->blockmode; - desc->enc = rctx->op_dir; + v = (op->keymode <<20 ) |DESC_OWN | todo | (algt->blockmode <<26 ); +if (rctx->op_dir) + v |=DESC_ENCRYPTION ; len -= todo;if (!sg_next (src_sg)) - desc->eoc =1 ; + v |=DESC_LAST ; + desc->t_status =cpu_to_le32 (v); tloffset++; src_sg =sg_next (src_sg); dst_sg =sg_next (dst_sg);
drivers/crypto/amlogic/amlogic-gxl.h +21 -30
64 lines not on this page · raw message
Signature · 1 line
2.23.0
Herbert Xu
maintainerQuoted 10 lines · Corentin Labbe
On big endian kernel, the GXL crypto driver does not works. This patch do the necessary modification to permit it to work on BE kernel (removing bitfield and adds some
cpu_to_le32).Fixes 48fe583fe541 ("crypto: amlogic - Add crypto accelerator for amlogic GXL")Signed-off-by Corentin Labbe <[email protected]>--- drivers/crypto/amlogic/amlogic-gxl-cipher.c | 26 +++++------ drivers/crypto/amlogic/amlogic-gxl.h | 51 +++++++++------------ 2 files changed, 34 insertions(+), 43 deletions(-)
Patch applied. Thanks.
Signature · 3 lines
Email: Herbert Xu <[email protected]> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt