[PATCH 4/4] crypto: hisilicon/qm - fix GFP flag inconsistency in hisi_qm_memory_init

From: Chenghai Huang

Date: Fri Sep 11 2026 - 06:38:18 EST


From: Wenkai Lin <linwenkai6@xxxxxxxxxxxxx>

hisi_qm_memory_init() is called from hisi_qm_init() (process context)
but uses GFP_ATOMIC for dma_alloc_coherent(). The equivalent
allocation in qm_alloc_xqc_dma() uses GFP_KERNEL.

GFP_ATOMIC cannot reclaim or compact memory, so it fails more easily
under memory pressure even though sleeping is allowed here. Switch
to GFP_KERNEL, which is safe in process context and consistent with
qm_alloc_xqc_dma().

Fixes: 5308f6600a39 ("crypto: hisilicon - QM memory management optimization")
Signed-off-by: Wenkai Lin <linwenkai6@xxxxxxxxxxxxx>
Signed-off-by: Chenghai Huang <huangchenghai2@xxxxxxxxxx>
---
drivers/crypto/hisilicon/qm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/crypto/hisilicon/qm.c b/drivers/crypto/hisilicon/qm.c
index 0448c68dbde4..a5593ee3889c 100644
--- a/drivers/crypto/hisilicon/qm.c
+++ b/drivers/crypto/hisilicon/qm.c
@@ -6067,7 +6067,7 @@ static int hisi_qm_memory_init(struct hisi_qm *qm)
QMC_ALIGN(sizeof(struct qm_sqc) * qm->qp_num) +
QMC_ALIGN(sizeof(struct qm_cqc) * qm->qp_num);
qm->qdma.va = dma_alloc_coherent(dev, qm->qdma.size, &qm->qdma.dma,
- GFP_ATOMIC);
+ GFP_KERNEL);
dev_dbg(dev, "allocate qm dma buf size=%zx)\n", qm->qdma.size);
if (!qm->qdma.va) {
ret = -ENOMEM;
--
2.43.0