From: Tony Lindgren <tony@atomide.com> Date: 2021-07-27 10:24:47
We should not clear FLAGS_DMA_ACTIVE before omap_sham_update_dma_stop() is
done calling dma_unmap_sg(). We already clear FLAGS_DMA_ACTIVE at the
end of omap_sham_update_dma_stop().
The early clearing of FLAGS_DMA_ACTIVE is not causing issues as we do not
need to defer anything based on FLAGS_DMA_ACTIVE currently. So this can be
applied as clean-up.
Cc: Lokesh Vutla <redacted>
Cc: Tero Kristo <kristo@kernel.org>
Signed-off-by: Tony Lindgren <tony@atomide.com>
---
drivers/crypto/omap-sham.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
From: Tony Lindgren <tony@atomide.com> Date: 2021-07-27 10:24:50
Let's only initialize dd->req after omap_sham_hw_init() in case of
errors.
Looks like leaving dd->req initialized on omap_sham_hw_init() errors is
is not causing issues though as we return on errors. So this patch can be
applied as clean-up.
Cc: Lokesh Vutla <redacted>
Cc: Tero Kristo <kristo@kernel.org>
Signed-off-by: Tony Lindgren <tony@atomide.com>
---
drivers/crypto/omap-sham.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
From: Tony Lindgren <tony@atomide.com> Date: 2021-07-27 10:24:57
We should pair the usage of pm_runtime_use_autosuspend() with
pm_runtime_dont_use_autosuspend().
Cc: Lokesh Vutla <redacted>
Cc: Tero Kristo <kristo@kernel.org>
Signed-off-by: Tony Lindgren <tony@atomide.com>
---
drivers/crypto/omap-sham.c | 2 ++
1 file changed, 2 insertions(+)
From: Tony Lindgren <tony@atomide.com> Date: 2021-07-27 10:25:01
Commit b0a3d8986a76 ("crypto: omap-sham - Use pm_runtime_irq_safe()") added
the use of pm_runtime_irq_safe() as pm_runtime_get_sync() was called
from a tasklet.
We now use the crypto engine queue instead of a custom queue since
commit 33c3d434d91 ("crypto: omap-sham - convert to use crypto engine").
We want to drop the use of pm_runtime_irq_safe() in general as it takes a
permanent usage count on the parent device causing issues for power
management.
Based on testing with CONFIG_DEBUG_ATOMIC_SLEEP=y, modprobe omap-sham,
followed by modprobe tcrypt sec=1 mode=423, I have not been able to
reproduce the scheduling while atomic issue seen earlier with current
kernels and we can just drop the call to pm_runtime_irq_safe().
Cc: Lokesh Vutla <redacted>
Cc: Tero Kristo <kristo@kernel.org>
Signed-off-by: Tony Lindgren <tony@atomide.com>
---
drivers/crypto/omap-sham.c | 1 -
1 file changed, 1 deletion(-)
From: Tony Lindgren <tony@atomide.com> Date: 2021-07-27 10:25:11
FLAGS_INIT is now unused and we can just use standard runtime PM
functions instead.
Cc: Lokesh Vutla <redacted>
Cc: Tero Kristo <kristo@kernel.org>
Signed-off-by: Tony Lindgren <tony@atomide.com>
---
drivers/crypto/omap-sham.c | 26 +++++---------------------
1 file changed, 5 insertions(+), 21 deletions(-)
From: Tony Lindgren <tony@atomide.com> Date: 2021-07-27 10:25:13
Let's get rid of the suspend and resume calls to runtime PM as these calls
do not idle the hardware. The runtime suspend has been disabled for
system suspend since commit 88d26136a256 ("PM: Prevent runtime suspend
during system resume").
Instead of runtime PM, the system suspend and resume functions should call
driver internal shared functions to idle the hardware as needed.
Cc: Lokesh Vutla <redacted>
Cc: Tero Kristo <kristo@kernel.org>
Signed-off-by: Tony Lindgren <tony@atomide.com>
---
drivers/crypto/omap-sham.c | 21 ---------------------
1 file changed, 21 deletions(-)
@@ -2221,32 +2221,11 @@ static int omap_sham_remove(struct platform_device *pdev)return0;}-#ifdef CONFIG_PM_SLEEP-staticintomap_sham_suspend(structdevice*dev)-{-pm_runtime_put_sync(dev);-return0;-}--staticintomap_sham_resume(structdevice*dev)-{-interr=pm_runtime_resume_and_get(dev);-if(err<0){-dev_err(dev,"failed to get sync: %d\n",err);-returnerr;-}-return0;-}-#endif--staticSIMPLE_DEV_PM_OPS(omap_sham_pm_ops,omap_sham_suspend,omap_sham_resume);-staticstructplatform_driveromap_sham_driver={.probe=omap_sham_probe,.remove=omap_sham_remove,.driver={.name="omap-sham",-.pm=&omap_sham_pm_ops,.of_match_table=omap_sham_of_match,},};
From: Herbert Xu <herbert@gondor.apana.org.au> Date: 2021-08-06 12:14:37
On Tue, Jul 27, 2021 at 01:23:34PM +0300, Tony Lindgren wrote:
We should not clear FLAGS_DMA_ACTIVE before omap_sham_update_dma_stop() is
done calling dma_unmap_sg(). We already clear FLAGS_DMA_ACTIVE at the
end of omap_sham_update_dma_stop().
The early clearing of FLAGS_DMA_ACTIVE is not causing issues as we do not
need to defer anything based on FLAGS_DMA_ACTIVE currently. So this can be
applied as clean-up.
Cc: Lokesh Vutla <redacted>
Cc: Tero Kristo <kristo@kernel.org>
Signed-off-by: Tony Lindgren <tony@atomide.com>
---
drivers/crypto/omap-sham.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)