Skip to content

Commit cfcee02

Browse files
bcreeley13Jeff Kirsher
authored andcommitted
ice: Add helper function for clearing VPGEN_VFRTRIG
Create a helper function for clearing VPGEN_VFRTRIG as this needs to be done on reset to notify the VF that we are done resetting it. Also, it needs to be done on SR-IOV initialization/creation in case it was left in a bad state after SR-IOV tear down. Signed-off-by: Brett Creeley <[email protected]> Tested-by: Andrew Bowers <[email protected]> Signed-off-by: Jeff Kirsher <[email protected]>
1 parent 02337f1 commit cfcee02

File tree

1 file changed

+20
-11
lines changed

1 file changed

+20
-11
lines changed

drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -961,6 +961,21 @@ static int ice_set_per_vf_res(struct ice_pf *pf)
961961
return 0;
962962
}
963963

964+
/**
965+
* ice_clear_vf_reset_trigger - enable VF to access hardware
966+
* @vf: VF to enabled hardware access for
967+
*/
968+
static void ice_clear_vf_reset_trigger(struct ice_vf *vf)
969+
{
970+
struct ice_hw *hw = &vf->pf->hw;
971+
u32 reg;
972+
973+
reg = rd32(hw, VPGEN_VFRTRIG(vf->vf_id));
974+
reg &= ~VPGEN_VFRTRIG_VFSWR_M;
975+
wr32(hw, VPGEN_VFRTRIG(vf->vf_id), reg);
976+
ice_flush(hw);
977+
}
978+
964979
/**
965980
* ice_cleanup_and_realloc_vf - Clean up VF and reallocate resources after reset
966981
* @vf: pointer to the VF structure
@@ -974,26 +989,20 @@ static void ice_cleanup_and_realloc_vf(struct ice_vf *vf)
974989
{
975990
struct ice_pf *pf = vf->pf;
976991
struct ice_hw *hw;
977-
u32 reg;
978992

979993
hw = &pf->hw;
980994

981-
/* PF software completes the flow by notifying VF that reset flow is
982-
* completed. This is done by enabling hardware by clearing the reset
983-
* bit in the VPGEN_VFRTRIG reg and setting VFR_STATE in the VFGEN_RSTAT
984-
* register to VFR completed (done at the end of this function)
985-
* By doing this we allow HW to access VF memory at any point. If we
986-
* did it any sooner, HW could access memory while it was being freed
987-
* in ice_free_vf_res(), causing an IOMMU fault.
995+
/* Allow HW to access VF memory after calling
996+
* ice_clear_vf_reset_trigger(). If we did it any sooner, HW could
997+
* access memory while it was being freed in ice_free_vf_res(), causing
998+
* an IOMMU fault.
988999
*
9891000
* On the other hand, this needs to be done ASAP, because the VF driver
9901001
* is waiting for this to happen and may report a timeout. It's
9911002
* harmless, but it gets logged into Guest OS kernel log, so best avoid
9921003
* it.
9931004
*/
994-
reg = rd32(hw, VPGEN_VFRTRIG(vf->vf_id));
995-
reg &= ~VPGEN_VFRTRIG_VFSWR_M;
996-
wr32(hw, VPGEN_VFRTRIG(vf->vf_id), reg);
1005+
ice_clear_vf_reset_trigger(vf);
9971006

9981007
/* reallocate VF resources to finish resetting the VSI state */
9991008
if (!ice_alloc_vf_res(vf)) {

0 commit comments

Comments
 (0)