Commit 29d42f1f authored by Mitch Williams's avatar Mitch Williams Committed by Jeff Kirsher

ice: Reliably reset VFs

When a PFR (or bigger reset) occurs, the device clears the VF_MBX_ARQLEN
register for all VFs. But if a VFR is triggered by a VF, the device does
NOT clear this register, and the VF driver will never see the reset.

When this happens, the VF driver will eventually timeout and attempt
recovery, and usually it will be successful. But this makes resets take
a long time and there are occasional failures.

We cannot just blithely clear this register on every reset; this has
been shown to cause synchronization problems when a PFR is triggered
with a large number of VFs.

Fix this by clearing VF_MBX_ARQLEN when the reset source is not PFR.
GlobR will trigger PFR, so this test catches that occurrence as well.
Signed-off-by: default avatarMitch Williams <mitch.a.williams@intel.com>
Tested-by: default avatarAndrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
parent 9d56b7fd
...@@ -353,12 +353,13 @@ void ice_free_vfs(struct ice_pf *pf) ...@@ -353,12 +353,13 @@ void ice_free_vfs(struct ice_pf *pf)
* ice_trigger_vf_reset - Reset a VF on HW * ice_trigger_vf_reset - Reset a VF on HW
* @vf: pointer to the VF structure * @vf: pointer to the VF structure
* @is_vflr: true if VFLR was issued, false if not * @is_vflr: true if VFLR was issued, false if not
* @is_pfr: true if the reset was triggered due to a previous PFR
* *
* Trigger hardware to start a reset for a particular VF. Expects the caller * Trigger hardware to start a reset for a particular VF. Expects the caller
* to wait the proper amount of time to allow hardware to reset the VF before * to wait the proper amount of time to allow hardware to reset the VF before
* it cleans up and restores VF functionality. * it cleans up and restores VF functionality.
*/ */
static void ice_trigger_vf_reset(struct ice_vf *vf, bool is_vflr) static void ice_trigger_vf_reset(struct ice_vf *vf, bool is_vflr, bool is_pfr)
{ {
struct ice_pf *pf = vf->pf; struct ice_pf *pf = vf->pf;
u32 reg, reg_idx, bit_idx; u32 reg, reg_idx, bit_idx;
...@@ -379,9 +380,12 @@ static void ice_trigger_vf_reset(struct ice_vf *vf, bool is_vflr) ...@@ -379,9 +380,12 @@ static void ice_trigger_vf_reset(struct ice_vf *vf, bool is_vflr)
*/ */
clear_bit(ICE_VF_STATE_INIT, vf->vf_states); clear_bit(ICE_VF_STATE_INIT, vf->vf_states);
/* Clear the VF's ARQLEN register. This is how the VF detects reset, /* VF_MBX_ARQLEN is cleared by PFR, so the driver needs to clear it
* since the VFGEN_RSTAT register doesn't stick at 0 after reset. * in the case of VFR. If this is done for PFR, it can mess up VF
* resets because the VF driver may already have started cleanup
* by the time we get here.
*/ */
if (!is_pfr)
wr32(hw, VF_MBX_ARQLEN(vf_abs_id), 0); wr32(hw, VF_MBX_ARQLEN(vf_abs_id), 0);
/* In the case of a VFLR, the HW has already reset the VF and we /* In the case of a VFLR, the HW has already reset the VF and we
...@@ -1072,7 +1076,7 @@ bool ice_reset_all_vfs(struct ice_pf *pf, bool is_vflr) ...@@ -1072,7 +1076,7 @@ bool ice_reset_all_vfs(struct ice_pf *pf, bool is_vflr)
/* Begin reset on all VFs at once */ /* Begin reset on all VFs at once */
for (v = 0; v < pf->num_alloc_vfs; v++) for (v = 0; v < pf->num_alloc_vfs; v++)
ice_trigger_vf_reset(&pf->vf[v], is_vflr); ice_trigger_vf_reset(&pf->vf[v], is_vflr, true);
for (v = 0; v < pf->num_alloc_vfs; v++) { for (v = 0; v < pf->num_alloc_vfs; v++) {
struct ice_vsi *vsi; struct ice_vsi *vsi;
...@@ -1172,7 +1176,7 @@ static bool ice_reset_vf(struct ice_vf *vf, bool is_vflr) ...@@ -1172,7 +1176,7 @@ static bool ice_reset_vf(struct ice_vf *vf, bool is_vflr)
if (test_and_set_bit(ICE_VF_STATE_DIS, vf->vf_states)) if (test_and_set_bit(ICE_VF_STATE_DIS, vf->vf_states))
return false; return false;
ice_trigger_vf_reset(vf, is_vflr); ice_trigger_vf_reset(vf, is_vflr, false);
vsi = pf->vsi[vf->lan_vsi_idx]; vsi = pf->vsi[vf->lan_vsi_idx];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment