crypto: hisilicon/qm - fix VF not available after PF FLR
authorShukun Tan <tanshukun1@huawei.com>
Sat, 15 Aug 2020 09:56:14 +0000 (17:56 +0800)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 21 Aug 2020 04:47:52 +0000 (14:47 +1000)
When PF FLR, the hardware will actively trigger the VF FLR. Configuration
space of VF needs to be saved and restored to ensure that it is available
after the PF FLR.

Fixes: 7ce396fa12a9("crypto: hisilicon - add FLR support")
Signed-off-by: Shukun Tan <tanshukun1@huawei.com>
Signed-off-by: Yang Shen <shenyang39@huawei.com>
Reviewed-by: Zhou Wang <wangzhou1@hisilicon.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/hisilicon/qm.c

index 6d233b42c7e20f9adad2f4717af1a9e1b5423e92..3c37e0099a4b3faace5d6e9a5f9aed144ce3b280 100644 (file)
@@ -3318,6 +3318,9 @@ static int qm_vf_reset_prepare(struct hisi_qm *qm,
                        continue;
 
                if (pci_physfn(virtfn) == pdev) {
+                       /* save VFs PCIE BAR configuration */
+                       pci_save_state(virtfn);
+
                        ret = hisi_qm_stop(vf_qm, stop_reason);
                        if (ret)
                                goto stop_fail;
@@ -3481,6 +3484,9 @@ static int qm_vf_reset_done(struct hisi_qm *qm)
                        continue;
 
                if (pci_physfn(virtfn) == pdev) {
+                       /* enable VFs PCIE BAR configuration */
+                       pci_restore_state(virtfn);
+
                        ret = qm_restart(vf_qm);
                        if (ret)
                                goto restart_fail;