Commit a52db6b2 authored by Michal Swiatkowski's avatar Michal Swiatkowski Committed by Jeff Kirsher

ice: Fix for allowing too many MDD events on VF

Disable VF if any malicious device driver (MDD) event is detected by
hardware. Track vf->num_mdd_events for information about VF MDD events.
Signed-off-by: default avatarMichal Swiatkowski <michal.swiatkowski@intel.com>
Signed-off-by: default avatarAnirudh Venkataramanan <anirudh.venkataramanan@intel.com>
Tested-by: default avatarAndrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
parent 819d8998
...@@ -1185,10 +1185,12 @@ static void ice_handle_mdd_event(struct ice_pf *pf) ...@@ -1185,10 +1185,12 @@ static void ice_handle_mdd_event(struct ice_pf *pf)
for (i = 0; i < pf->num_alloc_vfs && mdd_detected; i++) { for (i = 0; i < pf->num_alloc_vfs && mdd_detected; i++) {
struct ice_vf *vf = &pf->vf[i]; struct ice_vf *vf = &pf->vf[i];
mdd_detected = false;
reg = rd32(hw, VP_MDET_TX_PQM(i)); reg = rd32(hw, VP_MDET_TX_PQM(i));
if (reg & VP_MDET_TX_PQM_VALID_M) { if (reg & VP_MDET_TX_PQM_VALID_M) {
wr32(hw, VP_MDET_TX_PQM(i), 0xFFFF); wr32(hw, VP_MDET_TX_PQM(i), 0xFFFF);
vf->num_mdd_events++; mdd_detected = true;
dev_info(&pf->pdev->dev, "TX driver issue detected on VF %d\n", dev_info(&pf->pdev->dev, "TX driver issue detected on VF %d\n",
i); i);
} }
...@@ -1196,7 +1198,7 @@ static void ice_handle_mdd_event(struct ice_pf *pf) ...@@ -1196,7 +1198,7 @@ static void ice_handle_mdd_event(struct ice_pf *pf)
reg = rd32(hw, VP_MDET_TX_TCLAN(i)); reg = rd32(hw, VP_MDET_TX_TCLAN(i));
if (reg & VP_MDET_TX_TCLAN_VALID_M) { if (reg & VP_MDET_TX_TCLAN_VALID_M) {
wr32(hw, VP_MDET_TX_TCLAN(i), 0xFFFF); wr32(hw, VP_MDET_TX_TCLAN(i), 0xFFFF);
vf->num_mdd_events++; mdd_detected = true;
dev_info(&pf->pdev->dev, "TX driver issue detected on VF %d\n", dev_info(&pf->pdev->dev, "TX driver issue detected on VF %d\n",
i); i);
} }
...@@ -1204,7 +1206,7 @@ static void ice_handle_mdd_event(struct ice_pf *pf) ...@@ -1204,7 +1206,7 @@ static void ice_handle_mdd_event(struct ice_pf *pf)
reg = rd32(hw, VP_MDET_TX_TDPU(i)); reg = rd32(hw, VP_MDET_TX_TDPU(i));
if (reg & VP_MDET_TX_TDPU_VALID_M) { if (reg & VP_MDET_TX_TDPU_VALID_M) {
wr32(hw, VP_MDET_TX_TDPU(i), 0xFFFF); wr32(hw, VP_MDET_TX_TDPU(i), 0xFFFF);
vf->num_mdd_events++; mdd_detected = true;
dev_info(&pf->pdev->dev, "TX driver issue detected on VF %d\n", dev_info(&pf->pdev->dev, "TX driver issue detected on VF %d\n",
i); i);
} }
...@@ -1212,14 +1214,13 @@ static void ice_handle_mdd_event(struct ice_pf *pf) ...@@ -1212,14 +1214,13 @@ static void ice_handle_mdd_event(struct ice_pf *pf)
reg = rd32(hw, VP_MDET_RX(i)); reg = rd32(hw, VP_MDET_RX(i));
if (reg & VP_MDET_RX_VALID_M) { if (reg & VP_MDET_RX_VALID_M) {
wr32(hw, VP_MDET_RX(i), 0xFFFF); wr32(hw, VP_MDET_RX(i), 0xFFFF);
vf->num_mdd_events++; mdd_detected = true;
dev_info(&pf->pdev->dev, "RX driver issue detected on VF %d\n", dev_info(&pf->pdev->dev, "RX driver issue detected on VF %d\n",
i); i);
} }
if (vf->num_mdd_events > ICE_DFLT_NUM_MDD_EVENTS_ALLOWED) { if (mdd_detected) {
dev_info(&pf->pdev->dev, vf->num_mdd_events++;
"Too many MDD events on VF %d, disabled\n", i);
dev_info(&pf->pdev->dev, dev_info(&pf->pdev->dev,
"Use PF Control I/F to re-enable the VF\n"); "Use PF Control I/F to re-enable the VF\n");
set_bit(ICE_VF_STATE_DIS, vf->vf_states); set_bit(ICE_VF_STATE_DIS, vf->vf_states);
......
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