]> 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)
commit32e99c658c19e25ffd8431395caa05002df69870
tree2d94a889e72182f76de5e514e81978eb58123acd
parent881b96eb59d646e55a510fb23ef35fd951002479
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: a9224a4d135f (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