crypto: hisilicon/qm - inject error before stopping queue
Subsystems (3)
PATCH 1/1 crypto: hisilicon/qm - inject error before stopping queue
From: Weili Qian <[email protected]>
[ Upstream commit b04f06fc0243600665b3b50253869533b7938468 ]
The master ooo cannot be completely closed when the accelerator core reports memory error. Therefore, the driver needs to inject the qm error to close the master ooo. Currently, the qm error is injected after stopping queue, memory may be released immediately after stopping queue, causing the device to access the released memory. Therefore, error is injected to close master ooo before stopping queue to ensure that the device does not access the released memory.
--- drivers/crypto/hisilicon/qm.c | 51 +++++++++++++++++------------------ 1 file changed, 24 insertions(+), 27 deletions(-)
drivers/crypto/hisilicon/qm.c +24 -27
@@ -4638,6 +4638,28 @@ static int qm_set_vf_mse(struct hisi_qm *qm, bool set)return -ETIMEDOUT ; } +static void qm_dev_ecc_mbit_handle (struct hisi_qm *qm) +{ +u32 nfe_enb =0 ; + +/* Kunpeng930 hardware automatically close master ooo when NFE occurs */ +if (qm->ver >=QM_HW_V3 ) +return ; + +if (!qm->err_status.is_dev_ecc_mbit && + qm->err_status.is_qm_ecc_mbit && + qm->err_ini->close_axi_master_ooo) { + qm->err_ini->close_axi_master_ooo (qm); + }else if (qm->err_status.is_dev_ecc_mbit && + !qm->err_status.is_qm_ecc_mbit && + !qm->err_ini->close_axi_master_ooo) { + nfe_enb =readl (qm->io_base +QM_RAS_NFE_ENABLE ); +writel (nfe_enb &QM_RAS_NFE_MBIT_DISABLE , + qm->io_base +QM_RAS_NFE_ENABLE ); +writel (QM_ECC_MBIT , qm->io_base +QM_ABNORMAL_INT_SET ); + } +} +static int qm_vf_reset_prepare (struct hisi_qm *qm,enum qm_stop_reason stop_reason) {
@@ -4742,6 +4764,8 @@ static int qm_controller_reset_prepare(struct hisi_qm *qm)return ret; } +qm_dev_ecc_mbit_handle (qm); +/* PF obtains the information of VF by querying the register. */ qm_cmd_uninit (qm);
@@ -4766,31 +4790,6 @@ static int qm_controller_reset_prepare(struct hisi_qm *qm)return 0 ; } -static void qm_dev_ecc_mbit_handle (struct hisi_qm *qm) -{ -u32 nfe_enb =0 ; - -/* Kunpeng930 hardware automatically close master ooo when NFE occurs */ -if (qm->ver >=QM_HW_V3 ) -return ; - -if (!qm->err_status.is_dev_ecc_mbit && - qm->err_status.is_qm_ecc_mbit && - qm->err_ini->close_axi_master_ooo) { - - qm->err_ini->close_axi_master_ooo (qm); - - }else if (qm->err_status.is_dev_ecc_mbit && - !qm->err_status.is_qm_ecc_mbit && - !qm->err_ini->close_axi_master_ooo) { - - nfe_enb =readl (qm->io_base +QM_RAS_NFE_ENABLE ); -writel (nfe_enb &QM_RAS_NFE_MBIT_DISABLE , - qm->io_base +QM_RAS_NFE_ENABLE ); -writel (QM_ECC_MBIT , qm->io_base +QM_ABNORMAL_INT_SET ); - } -} -static int qm_soft_reset (struct hisi_qm *qm) {struct pci_dev *pdev = qm->pdev;
@@ -4816,8 +4815,6 @@ static int qm_soft_reset(struct hisi_qm *qm)return ret; } -qm_dev_ecc_mbit_handle (qm); -/* OOO register set and check */ writel (ACC_MASTER_GLOBAL_CTRL_SHUTDOWN , qm->io_base +ACC_MASTER_GLOBAL_CTRL );
Signature · 1 line
2.25.1
Please ignore this email. Sorry for wrong subject.
-----Original Message-----
From: Chen, Libo (CN) <[email protected]>
Sent: Wednesday, December 11, 2024 10:55 AM
To: [email protected]
Subject: [PATCH] crypto: hisilicon/qm - inject error before stopping queue
From: Weili Qian <[email protected]>
[ Upstream commit b04f06fc0243600665b3b50253869533b7938468 ]
The master ooo cannot be completely closed when the accelerator core reports memory error. Therefore, the driver needs to inject the qm error to close the master ooo. Currently, the qm error is injected after stopping queue, memory may be released immediately after stopping queue, causing the device to access the released memory. Therefore, error is injected to close master ooo before stopping queue to ensure that the device does not access the released memory.
--- drivers/crypto/hisilicon/qm.c | 51 +++++++++++++++++------------------ 1 file changed, 24 insertions(+), 27 deletions(-)
drivers/crypto/hisilicon/qm.c +21 -0
@@ -4638,6 +4638,28 @@ static int qm_set_vf_mse(struct hisi_qm *qm, bool set)return -ETIMEDOUT ; } +static void qm_dev_ecc_mbit_handle (struct hisi_qm *qm) { +u32 nfe_enb =0 ; + +/* Kunpeng930 hardware automatically close master ooo when NFE occurs */ +if (qm->ver >=QM_HW_V3 ) +return ; + +if (!qm->err_status.is_dev_ecc_mbit && + qm->err_status.is_qm_ecc_mbit && + qm->err_ini->close_axi_master_ooo) { + qm->err_ini->close_axi_master_ooo (qm); + }else if (qm->err_status.is_dev_ecc_mbit && + !qm->err_status.is_qm_ecc_mbit && + !qm->err_ini->close_axi_master_ooo) { + nfe_enb =readl (qm->io_base +QM_RAS_NFE_ENABLE ); +writel (nfe_enb &QM_RAS_NFE_MBIT_DISABLE , + qm->io_base +QM_RAS_NFE_ENABLE ); +writel (QM_ECC_MBIT , qm->io_base +QM_ABNORMAL_INT_SET ); + } +} +static int qm_vf_reset_prepare (struct hisi_qm *qm, enum qm_stop_reason stop_reason) { @@ -4742,6 +4764,8 @@ static int qm_controller_reset_prepare(struct hisi_qm *qm) return ret;
}
+ qm_dev_ecc_mbit_handle(qm);
+
/* PF obtains the information of VF by querying the register. */ qm_cmd_uninit(qm);
@@ -4766,31 +4790,6 @@ static int qm_controller_reset_prepare(struct hisi_qm *qm)
return 0;
}
-static void qm_dev_ecc_mbit_handle(struct hisi_qm *qm) -{
- u32 nfe_enb = 0;
-
- /* Kunpeng930 hardware automatically close master ooo when NFE occurs */
- if (qm->ver >= QM_HW_V3)
- return;
-
- if (!qm->err_status.is_dev_ecc_mbit &&
- qm->err_status.is_qm_ecc_mbit &&
- qm->err_ini->close_axi_master_ooo) {
-
- qm->err_ini->close_axi_master_ooo(qm);
-
- } else if (qm->err_status.is_dev_ecc_mbit &&
- !qm->err_status.is_qm_ecc_mbit &&
- !qm->err_ini->close_axi_master_ooo) {
-
- nfe_enb = readl(qm->io_base + QM_RAS_NFE_ENABLE);
- writel(nfe_enb & QM_RAS_NFE_MBIT_DISABLE,
- qm->io_base + QM_RAS_NFE_ENABLE);
- writel(QM_ECC_MBIT, qm->io_base + QM_ABNORMAL_INT_SET);
- }
-}
-
static int qm_soft_reset(struct hisi_qm *qm) {
struct pci_dev *pdev = qm->pdev;
@@ -4816,8 +4815,6 @@ static int qm_soft_reset(struct hisi_qm *qm)
return ret;
}
- qm_dev_ecc_mbit_handle(qm);
-
/* OOO register set and check */ writel(ACC_MASTER_GLOBAL_CTRL_SHUTDOWN,
qm->io_base + ACC_MASTER_GLOBAL_CTRL);
--
2.25.1
Sasha Levin
maintainer[ Sasha's backport helper bot ]
Hi,
The upstream commit SHA1 provided is correct: b04f06fc0243600665b3b50253869533b7938468
WARNING: Author mismatch between patch and upstream commit:
Backport author: [email protected]
Commit author: Weili Qian <[email protected]>
Status in newer kernel trees:
6.12.y | Present (exact SHA1)
Note: The patch differs from the upstream commit:
---
Failed to apply patch cleanly, falling back to interdiff...
---
Results of testing on various branches:
| Branch | Patch Apply | Build Test | |---------------------------|-------------|------------| | stable/linux-6.12.y | Failed | N/A | | stable/linux-6.6.y | Failed | N/A | | stable/linux-6.1.y | Failed | N/A | | stable/linux-5.15.y | Success | Success | | stable/linux-5.10.y | Failed | N/A | | stable/linux-5.4.y | Failed | N/A |