Commit 046ac43f authored by Weili Qian's avatar Weili Qian Committed by JiangShui
Browse files

crypto: hisilicon/qm - disable error report before flr

driver inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I7C6LD


CVE: NA

----------------------------------------------------------------------

Before function level reset, driver first disable device error report
and then waits for the device reset to complete. However, when the
error is recovered, the error bits will be enabled again, resulting in
invalid disable. It is modified to detect that there is no error
before disable error report, and then do FLR.

Fixes: 7ce396fa ("crypto: hisilicon - add FLR support")
Signed-off-by: default avatarWeili Qian <qianweili@huawei.com>
Signed-off-by: default avatarJiangShui Yang <yangjiangshui@h-partners.com>
parent 6cf358af
Loading
Loading
Loading
Loading
+22 −14
Original line number Diff line number Diff line
@@ -4703,22 +4703,30 @@ void hisi_qm_reset_prepare(struct pci_dev *pdev)
	u32 delay = 0;
	int ret;

	hisi_qm_dev_err_uninit(pf_qm);
	while (true) {
		ret = qm_reset_prepare_ready(qm);
		if (ret) {
			pci_err(pdev, "FLR not ready!\n");
			return;
		}

		hisi_qm_dev_err_uninit(pf_qm);
		/*
	 * Check whether there is an ECC mbit error, If it occurs, need to
	 * wait for soft reset to fix it.
		 * Check whether there is an ECC mbit error,
		 * If it occurs, need to wait for soft reset
		 * to fix it.
		 */
	while (qm_check_dev_error(pf_qm)) {
		msleep(++delay);
		if (delay > QM_RESET_WAIT_TIMEOUT)
		if (qm_check_dev_error(pf_qm)) {
			qm_reset_bit_clear(qm);
			if (delay > QM_RESET_WAIT_TIMEOUT) {
				pci_err(pdev, "the hardware error was not recovered!\n");
				return;
			}

	ret = qm_reset_prepare_ready(qm);
	if (ret) {
		pci_err(pdev, "FLR not ready!\n");
		return;
			msleep(++delay);
		} else {
			break;
		}
	}

	/* PF obtains the information of VF by querying the register. */