]> git.baikalelectronics.ru Git - kernel.git/commit
crypto: atmel-aes - sync the buf used in DMA or CPU
authorLeilei Zhao <leilei.zhao@atmel.com>
Tue, 7 Apr 2015 09:45:10 +0000 (17:45 +0800)
committerHerbert Xu <herbert@gondor.apana.org.au>
Wed, 8 Apr 2015 14:20:04 +0000 (22:20 +0800)
commit7a84ab6ad44bf76f6dfe4806fece052496b5f359
tree6d45df75cece75529ccfd449a9987055e0abfaf6
parentc70f0bbe96afb187c7ce766c6872853866d7a2f1
crypto: atmel-aes - sync the buf used in DMA or CPU

The input buffer and output buffer are mapped for DMA transfer
in Atmel AES driver. But they are also be used by CPU when
the requested crypt length is not bigger than the threshold
value 16. The buffers will be cached in cache line when CPU
accessed them. When DMA uses the buffers again, the memory
can happened to be flushed by cache while DMA starts transfer.

So using API dma_sync_single_for_device and dma_sync_single_for_cpu
in DMA to ensure DMA coherence and CPU always access the correct
value. This fix the issue that the encrypted result periodically goes
wrong when doing performance test with OpenSSH.

Signed-off-by: Leilei Zhao <leilei.zhao@atmel.com>
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/atmel-aes.c