From 2f9048da1937a836186503130e4efd573ebc35ba Mon Sep 17 00:00:00 2001 From: tanshukun Date: Wed, 14 Aug 2019 17:11:16 +0800 Subject: [PATCH] crypto/hisilicon/qm: clear queues need protection of critical section driver inclusion category: bugfix bugzilla: NA CVE: NA We always clear queues when reset, it is better to protect this operation in critical section. Feature or Bugfix:Bugfix Signed-off-by: tanshukun (A) Signed-off-by: tanshukun (A) Reviewed-by: wangzhou Reviewed-by: Yang Yingliang Signed-off-by: Yang Yingliang --- drivers/crypto/hisilicon/hpre/hpre_main.c | 3 --- drivers/crypto/hisilicon/qm.c | 1 + drivers/crypto/hisilicon/zip/zip_main.c | 4 ---- 3 files changed, 1 insertion(+), 7 deletions(-) diff --git a/drivers/crypto/hisilicon/hpre/hpre_main.c b/drivers/crypto/hisilicon/hpre/hpre_main.c index f9e36727572f..f5310c834b3b 100644 --- a/drivers/crypto/hisilicon/hpre/hpre_main.c +++ b/drivers/crypto/hisilicon/hpre/hpre_main.c @@ -1259,7 +1259,6 @@ static int hpre_vf_reset_done(struct pci_dev *pdev) if (pci_physfn(dev) == pdev) { qm = &hpre->qm; - hisi_qm_clear_queues(qm); ret = hisi_qm_restart(qm); if (ret) goto reset_fail; @@ -1277,7 +1276,6 @@ static int hpre_controller_reset_done(struct hpre *hpre) struct pci_dev *pdev = qm->pdev; int ret; - hisi_qm_clear_queues(qm); ret = hpre_set_user_domain_and_cache(hpre); if (ret) return ret; @@ -1416,7 +1414,6 @@ static void hpre_reset_done(struct pci_dev *pdev) struct device *dev = &pdev->dev; int ret; - hisi_qm_clear_queues(qm); ret = hisi_qm_restart(qm); if (ret) { dev_err(dev, "Failed to start QM!\n"); diff --git a/drivers/crypto/hisilicon/qm.c b/drivers/crypto/hisilicon/qm.c index 180f80886cc9..9a22c0646a75 100644 --- a/drivers/crypto/hisilicon/qm.c +++ b/drivers/crypto/hisilicon/qm.c @@ -2521,6 +2521,7 @@ int hisi_qm_stop(struct hisi_qm *qm, enum qm_stop_reason r) } } + hisi_qm_clear_queues(qm); atomic_set(&qm->status.flags, QM_STOP); err_unlock: up_write(&qm->qps_lock); diff --git a/drivers/crypto/hisilicon/zip/zip_main.c b/drivers/crypto/hisilicon/zip/zip_main.c index 796b52c935df..3cbaefabcc0a 100644 --- a/drivers/crypto/hisilicon/zip/zip_main.c +++ b/drivers/crypto/hisilicon/zip/zip_main.c @@ -1215,7 +1215,6 @@ static int hisi_zip_vf_reset_done(struct hisi_zip *hisi_zip) if (pci_physfn(dev) == pdev) { qm = &hisi_zip->qm; - hisi_qm_clear_queues(qm); ret = hisi_qm_restart(qm); if (ret) goto reset_fail; @@ -1233,8 +1232,6 @@ static int hisi_zip_controller_reset_done(struct hisi_zip *hisi_zip) struct device *dev = &qm->pdev->dev; int ret; - hisi_qm_clear_queues(qm); - hisi_zip_set_user_domain_and_cache(hisi_zip); hisi_zip_hw_error_init(hisi_zip); @@ -1359,7 +1356,6 @@ static void hisi_zip_reset_done(struct pci_dev *pdev) struct device *dev = &pdev->dev; int ret; - hisi_qm_clear_queues(qm); ret = hisi_qm_restart(qm); if (ret) { dev_err(dev, "Failed to start QM!\n"); -- GitLab