]> git.baikalelectronics.ru Git - kernel.git/commit
crypto: ccp - fix command queuing to TEE ring buffer
authorRijo Thomas <Rijo-john.Thomas@amd.com>
Mon, 15 Mar 2021 08:25:29 +0000 (13:55 +0530)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 26 Mar 2021 09:02:34 +0000 (20:02 +1100)
commit3a9958e398fd3e8f302e2682fa48e1bfee31694f
tree2d94a889e72182f76de5e514e81978eb58123acd
parent60104db5eaf7b27c5ac344aaaa3a133408ba116e
crypto: ccp - fix command queuing to TEE ring buffer

Multiple threads or clients can submit a command to the TEE ring
buffer. This patch helps to synchronize command submission to the
ring.

One thread shall write a command to a TEE ring buffer entry only if:

 - Trusted OS has notified that the TEE command for the given entry
   has been processed and driver has copied the TEE response into
   client buffer.

 - The command entry is empty and can be written into.

After a command has been written to the TEE ring buffer, the global
wptr (mutex protected) shall be incremented for use by next client.

If PSP became unresponsive while processing TEE request from a
client, then further command submission to queue will be disabled.

Fixes: 8e2fccf8946e (crypto: ccp - add TEE support for Raven Ridge)
Reviewed-by: Devaraj Rangasamy <Devaraj.Rangasamy@amd.com>
Signed-off-by: Rijo Thomas <Rijo-john.Thomas@amd.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/ccp/tee-dev.c
drivers/crypto/ccp/tee-dev.h