Skip to contentSkip to conversation

crypto: hisilicon/sgl - align the hardware sgl dma address

PATCH In review Yang Shen 2 participants 2 messages Apr 9, 2022 – Apr 15, 2022

Subsystems (2)
lore
Share & tools
lore

Yang Shen

author
#0 lore raw

PATCH 1/1 crypto: hisilicon/sgl - align the hardware sgl dma address

The hardware needs aligned sgl dma address. So expend the sgl_size to align 64 bytes.

---
 drivers/crypto/hisilicon/sgl.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/crypto/hisilicon/sgl.c +4 -2
index f7efc02b065f..2b6f2281cfd6 100644
@@ -1,5 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0
 /* Copyright (c) 2019 HiSilicon Limited. */
+#include <linux/align.h>
 #include <linux/dma-mapping.h>
 #include <linux/hisi_acc_qm.h>
 #include <linux/module.h>
@@ -64,8 +65,9 @@ struct hisi_acc_sgl_pool *hisi_acc_create_sgl_pool(struct device *dev,
 	if (!dev || !count || !sge_nr || sge_nr > HISI_ACC_SGL_SGE_NR_MAX)
 		return ERR_PTR(-EINVAL);
 
-	sgl_size = sizeof(struct acc_hw_sge) * sge_nr +
-		   sizeof(struct hisi_acc_hw_sgl);
+	sgl_size = ALIGN(sizeof(struct acc_hw_sge) * sge_nr +
+			 sizeof(struct hisi_acc_hw_sgl),
+			 HISI_ACC_SGL_ALIGN_SIZE);
 
 	/*
 	 * the pool may allocate a block of memory of size PAGE_SIZE * 2^(MAX_ORDER - 1),
Signature · 1 line
2.24.0
maintainer
#1 lore raw
Quoted 7 lines · Yang Shen

The hardware needs aligned sgl dma address. So expend the sgl_size to align 64 bytes.

---
 drivers/crypto/hisilicon/sgl.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Patch applied. Thanks.

Signature · 3 lines
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt