[PATCH v3 2/3] hisi_acc_vfio_pci: clear set_reset_flag after reset completed
From: Longfang Liu
Date: Mon Aug 31 2026 - 05:14:17 EST
set_reset_flag is a sticky latch set in reset_prepare() when this driver
acquires the QM_RESETTING lock, but it is never cleared. If a later reset
attempt times out in reset_prepare() because another agent already holds
the lock, aer_reset_done() sees the stale true flag and calls clear_bit()
on QM_RESETTING, prematurely releasing a lock owned by the other agent.
Clear set_reset_flag right after clearing the QM_RESETTING bit in
aer_reset_done(), so every reset cycle is self-contained and a timed-out
reset cannot release a foreign lock.
Fixes: a22099ed7936f ("hisi_acc_vfio_pci: fix VF reset timeout issue")
Signed-off-by: Longfang Liu <liulongfang@xxxxxxxxxx>
---
drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c b/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c
index e95d0ab0f11a..4abed2e49986 100644
--- a/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c
+++ b/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c
@@ -1180,10 +1180,12 @@ static void hisi_acc_vf_pci_aer_reset_done(struct pci_dev *pdev)
struct hisi_qm *qm = hisi_acc_vdev->pf_qm;
if (hisi_acc_vdev->set_reset_flag) {
- if (qm && qm->io_base)
+ if (qm && qm->io_base) {
clear_bit(QM_RESETTING, &qm->misc_ctl);
- else
+ hisi_acc_vdev->set_reset_flag = false;
+ } else {
dev_err(&pdev->dev, "PF QM not available for reset done\n");
+ }
}
if (!hisi_acc_vdev->core_device.vdev.mig_ops)
--
2.43.0