diff --git a/drivers/crypto/ccp/hygon/psp-dev.c b/drivers/crypto/ccp/hygon/psp-dev.c index 9ed26a06dd2ef60846ab411e93b2453145becb77..c704d36d10244153aae13184e9b756d5e5dfb727 100644 --- a/drivers/crypto/ccp/hygon/psp-dev.c +++ b/drivers/crypto/ccp/hygon/psp-dev.c @@ -75,14 +75,21 @@ int psp_mutex_trylock(struct psp_mutex *mutex) int psp_mutex_lock_timeout(struct psp_mutex *mutex, uint64_t ms) { int ret = 0; - unsigned long je; + unsigned long je, last_je; + last_je = jiffies + msecs_to_jiffies(100); je = jiffies + msecs_to_jiffies(ms); do { if (psp_mutex_trylock(mutex)) { ret = 1; break; } + + // avoid triggering soft lockup warning + if (time_before(jiffies, last_je)) { + schedule(); + last_je = jiffies + msecs_to_jiffies(100); + } } while ((ms == 0) || time_before(jiffies, je)); return ret;