Commit 4a5eed17 authored by Rijo Thomas's avatar Rijo Thomas Committed by Herbert Xu

crypto: ccp - reduce tee command status polling interval from 5ms to 1ms

The PSP TEE device driver polls the command status variable every
5ms to check for command completion. Reduce this time to 1ms so that
there is an improvement in driver response time to clients which submit
TEE commands.
Reviewed-by: default avatarDevaraj Rangasamy <Devaraj.Rangasamy@amd.com>
Signed-off-by: default avatarRijo Thomas <Rijo-john.Thomas@amd.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent e656459b
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
* Author: Rijo Thomas <Rijo-john.Thomas@amd.com> * Author: Rijo Thomas <Rijo-john.Thomas@amd.com>
* Author: Devaraj Rangasamy <Devaraj.Rangasamy@amd.com> * Author: Devaraj Rangasamy <Devaraj.Rangasamy@amd.com>
* *
* Copyright 2019 Advanced Micro Devices, Inc. * Copyright (C) 2019,2021 Advanced Micro Devices, Inc.
*/ */
#include <linux/types.h> #include <linux/types.h>
...@@ -309,14 +309,14 @@ static int tee_wait_cmd_completion(struct psp_tee_device *tee, ...@@ -309,14 +309,14 @@ static int tee_wait_cmd_completion(struct psp_tee_device *tee,
struct tee_ring_cmd *resp, struct tee_ring_cmd *resp,
unsigned int timeout) unsigned int timeout)
{ {
/* ~5ms sleep per loop => nloop = timeout * 200 */ /* ~1ms sleep per loop => nloop = timeout * 1000 */
int nloop = timeout * 200; int nloop = timeout * 1000;
while (--nloop) { while (--nloop) {
if (resp->cmd_state == TEE_CMD_STATE_COMPLETED) if (resp->cmd_state == TEE_CMD_STATE_COMPLETED)
return 0; return 0;
usleep_range(5000, 5100); usleep_range(1000, 1100);
} }
dev_err(tee->dev, "tee: command 0x%x timed out, disabling PSP\n", dev_err(tee->dev, "tee: command 0x%x timed out, disabling PSP\n",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment