linux-crypto.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] crypto: hisilicon/qm - optimize the barrier operation
@ 2022-03-16 11:26 Hui Tang
  2022-04-08  8:31 ` Herbert Xu
  0 siblings, 1 reply; 2+ messages in thread
From: Hui Tang @ 2022-03-16 11:26 UTC (permalink / raw)
  To: herbert, davem; +Cc: linux-crypto, tanghui20, wangzhou1, linux-kernel

A 'dma_wmb' barrier is enough to guarantee previous writes
before accessing by acc device in the outer shareable domain.

A 'smp_wmb' barrier is enough to guarantee previous writes
before accessing by other cpus in the inner shareble domain.

Signed-off-by: Hui Tang <tanghui20@huawei.com>
---
 drivers/crypto/hisilicon/qm.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/crypto/hisilicon/qm.c b/drivers/crypto/hisilicon/qm.c
index 453390044181..aec06810a6e0 100644
--- a/drivers/crypto/hisilicon/qm.c
+++ b/drivers/crypto/hisilicon/qm.c
@@ -710,13 +710,13 @@ static void qm_mb_write(struct hisi_qm *qm, const void *src)
 
 	if (!IS_ENABLED(CONFIG_ARM64)) {
 		memcpy_toio(fun_base, src, 16);
-		wmb();
+		dma_wmb();
 		return;
 	}
 
 	asm volatile("ldp %0, %1, %3\n"
 		     "stp %0, %1, %2\n"
-		     "dsb sy\n"
+		     "dmb oshst\n"
 		     : "=&r" (tmp0),
 		       "=&r" (tmp1),
 		       "+Q" (*((char __iomem *)fun_base))
@@ -1004,7 +1004,7 @@ static void qm_set_qp_disable(struct hisi_qp *qp, int offset)
 	*addr = 1;
 
 	/* make sure setup is completed */
-	mb();
+	smp_wmb();
 }
 
 static void qm_disable_qp(struct hisi_qm *qm, u32 qp_id)
-- 
2.33.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] crypto: hisilicon/qm - optimize the barrier operation
  2022-03-16 11:26 [PATCH] crypto: hisilicon/qm - optimize the barrier operation Hui Tang
@ 2022-04-08  8:31 ` Herbert Xu
  0 siblings, 0 replies; 2+ messages in thread
From: Herbert Xu @ 2022-04-08  8:31 UTC (permalink / raw)
  To: Hui Tang; +Cc: davem, linux-crypto, wangzhou1, linux-kernel

On Wed, Mar 16, 2022 at 07:26:03PM +0800, Hui Tang wrote:
> A 'dma_wmb' barrier is enough to guarantee previous writes
> before accessing by acc device in the outer shareable domain.
> 
> A 'smp_wmb' barrier is enough to guarantee previous writes
> before accessing by other cpus in the inner shareble domain.
> 
> Signed-off-by: Hui Tang <tanghui20@huawei.com>
> ---
>  drivers/crypto/hisilicon/qm.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)

Patch applied.  Thanks.
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-04-08  8:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-16 11:26 [PATCH] crypto: hisilicon/qm - optimize the barrier operation Hui Tang
2022-04-08  8:31 ` Herbert Xu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).