Skip to content

Commit ebf35d8

Browse files
Chenghai Huangherbertx
authored andcommitted
crypto: hisilicon/qm - move the barrier before writing to the mailbox register
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>
1 parent 3d31350 commit ebf35d8

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

  • drivers/crypto/hisilicon

drivers/crypto/hisilicon/qm.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -609,9 +609,13 @@ static void qm_mb_write(struct hisi_qm *qm, const void *src)
609609
}
610610

611611
#if IS_ENABLED(CONFIG_ARM64)
612+
/*
613+
* The dmb oshst instruction ensures that the data in the
614+
* mailbox is written before it is sent to the hardware.
615+
*/
612616
asm volatile("ldp %0, %1, %3\n"
613-
"stp %0, %1, %2\n"
614617
"dmb oshst\n"
618+
"stp %0, %1, %2\n"
615619
: "=&r" (tmp0),
616620
"=&r" (tmp1),
617621
"+Q" (*((char __iomem *)fun_base))

0 commit comments

Comments
 (0)