summaryrefslogtreecommitdiff
path: root/drivers/crypto
diff options
context:
space:
mode:
authorChenghai Huang <huangchenghai2@huawei.com>2026-01-17 18:18:03 +0800
committerSasha Levin <sashal@kernel.org>2026-03-04 07:20:36 -0500
commit7b9394e49720cc01402546540647b19589f0a98b (patch)
tree3961d8c4471a99faabba49b7ef28d2fa5c33c4ed /drivers/crypto
parent5f007c6acaa7d9a543b492c1e48c48a0ea1d7147 (diff)
downloadlinux-7b9394e49720cc01402546540647b19589f0a98b.tar.gz
linux-7b9394e49720cc01402546540647b19589f0a98b.tar.bz2
linux-7b9394e49720cc01402546540647b19589f0a98b.zip
crypto: hisilicon/qm - move the barrier before writing to the mailbox register
[ Upstream commit ebf35d8f9368816c930f5d70783a72716fab5e19 ] Before sending the data via the mailbox to the hardware, to ensure that the data accessed by the hardware is the most up-to-date, a write barrier should be added before writing to the mailbox register. The current memory barrier is placed after writing to the register, the barrier order should be modified to be before writing to the register. Signed-off-by: Chenghai Huang <huangchenghai2@huawei.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/crypto')
-rw-r--r--drivers/crypto/hisilicon/qm.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/crypto/hisilicon/qm.c b/drivers/crypto/hisilicon/qm.c
index 2c0ca68914e2..e09357fea057 100644
--- a/drivers/crypto/hisilicon/qm.c
+++ b/drivers/crypto/hisilicon/qm.c
@@ -633,9 +633,13 @@ static void qm_mb_write(struct hisi_qm *qm, const void *src)
}
#if IS_ENABLED(CONFIG_ARM64)
+ /*
+ * The dmb oshst instruction ensures that the data in the
+ * mailbox is written before it is sent to the hardware.
+ */
asm volatile("ldp %0, %1, %3\n"
- "stp %0, %1, %2\n"
"dmb oshst\n"
+ "stp %0, %1, %2\n"
: "=&r" (tmp0),
"=&r" (tmp1),
"+Q" (*((char __iomem *)fun_base))