[PATCH v6 10/23] drivers: crypto: meson: avoid kzalloc in engine thread

Herbert Xu herbert at gondor.apana.org.au
Thu Apr 4 23:55:48 PDT 2024


On Tue, Mar 26, 2024 at 06:32:06PM +0300, Alexey Romanov wrote:
>
>  /*
>   * struct meson_cipher_tfm_ctx - context for a skcipher TFM
> - * @key:		pointer to key data
> + * @keyiv:		key data
>   * @keylen:		len of the key
>   * @keymode:		The keymode(type and size of key) associated with this TFM
>   * @mc:			pointer to the private data of driver handling this TFM
>   * @fallback_tfm:	pointer to the fallback TFM
>   */
>  struct meson_cipher_tfm_ctx {
> -	u32 *key;
> -	u32 keylen;
> +	u8 keyiv[AES_MAX_KEY_SIZE + AES_BLOCK_SIZE] ____cacheline_aligned;
> +	u32 keylen ____cacheline_aligned;

This doesn't do anything to guarantee that tfm_ctx is aligned.

You either need to align this by hand, or you could use the
crypto_skcipher_ctx_dma helper if DMA alignment is what you're
actually looking for.

Cheers,
-- 
Email: Herbert Xu <herbert at gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt



More information about the linux-amlogic mailing list