Skip to content

Commit d1e2805

Browse files
committed
crypto: qat - ensure correct order in VF restarting handler
JIRA: https://issues.redhat.com/browse/RHEL-52749 Upstream Status: merged into the linux.git commit cd8d2d7 Author: Michal Witwicki <michal.witwicki@intel.com> Date: Wed Jul 17 07:44:59 2024 -0400 crypto: qat - ensure correct order in VF restarting handler In the process of sending the ADF_PF2VF_MSGTYPE_RESTARTING message to Virtual Functions (VFs), the Physical Function (PF) should set the `vf->restarting` flag to true before dispatching the message. This change is necessary to prevent a race condition where the handling of the ADF_VF2PF_MSGTYPE_RESTARTING_COMPLETE message (which sets the `vf->restarting` flag to false) runs immediately after the message is sent, but before the flag is set to true. Set the `vf->restarting` to true before sending the message ADF_PF2VF_MSGTYPE_RESTARTING, if supported by the version of the protocol and if the VF is started. Fixes: ec26f8e ("crypto: qat - update PFVF protocol for recovery") Signed-off-by: Michal Witwicki <michal.witwicki@intel.com> Reviewed-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com> Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: Vladis Dronov <vdronov@redhat.com>
1 parent 7fc587d commit d1e2805

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

drivers/crypto/intel/qat/qat_common/adf_pfvf_pf_msg.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,17 @@ void adf_pf2vf_notify_restarting(struct adf_accel_dev *accel_dev)
1818

1919
dev_dbg(&GET_DEV(accel_dev), "pf2vf notify restarting\n");
2020
for (i = 0, vf = accel_dev->pf.vf_info; i < num_vfs; i++, vf++) {
21-
vf->restarting = false;
21+
if (vf->init && vf->vf_compat_ver >= ADF_PFVF_COMPAT_FALLBACK)
22+
vf->restarting = true;
23+
else
24+
vf->restarting = false;
25+
2226
if (!vf->init)
2327
continue;
28+
2429
if (adf_send_pf2vf_msg(accel_dev, i, msg))
2530
dev_err(&GET_DEV(accel_dev),
2631
"Failed to send restarting msg to VF%d\n", i);
27-
else if (vf->vf_compat_ver >= ADF_PFVF_COMPAT_FALLBACK)
28-
vf->restarting = true;
2932
}
3033
}
3134

0 commit comments

Comments
 (0)