OSDN Git Service

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)
commit289b2623df34ebec4c25b7d31804b70fc90b92c6
tree6d45df75cece75529ccfd449a9987055e0abfaf6
parent8a10eb8d36ffc86512ae66a35c8888f07b8ec921
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