提交 04284e8e 编写于 作者: H Huazhong Tan 提交者: Xie XiuQi

net: hns3: fix bug about PF and VF handshake when global reset

driver inclusion
category: bugfix
bugzilla: NA
CVE: NA

There will be race when there is continuous global reset. So this
patch fixes it.

When global reset occurs, VF set up its HCLGEVF_VF_RST_ING_BIT,
PF send command to IMP to clear HCLGEVF_VF_RST_ING_BIT when
PF initializes done.

Feature or Bugfix:Bugfix
Signed-off-by: NHuazhong Tan <tanhuazhong@huawei.com>
Reviewed-by: Nlipeng <lipeng321@huawei.com>
Reviewed-by: NXie XiuQi <xiexiuqi@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 b390b26f
...@@ -1331,12 +1331,9 @@ static int hclgevf_reset_wait(struct hclgevf_dev *hdev) ...@@ -1331,12 +1331,9 @@ static int hclgevf_reset_wait(struct hclgevf_dev *hdev)
if (hdev->reset_type == HNAE3_VF_RESET) { if (hdev->reset_type == HNAE3_VF_RESET) {
ret = readl_poll_timeout(hdev->hw.io_base + ret = readl_poll_timeout(hdev->hw.io_base +
HCLGEVF_VF_RST_ING, val, HCLGEVF_VF_RST_ING, val,
(val & HCLGEVF_VF_RST_ING_BIT), !(val & HCLGEVF_VF_RST_ING_BIT),
HCLGEVF_RESET_WAIT_US, HCLGEVF_RESET_WAIT_US,
HCLGEVF_RESET_WAIT_TIMEOUT_US); HCLGEVF_RESET_WAIT_TIMEOUT_US);
val = hclgevf_read_dev(&hdev->hw, HCLGEVF_VF_RST_ING);
hclgevf_write_dev(&hdev->hw, HCLGEVF_VF_RST_ING,
val & ~HCLGEVF_VF_RST_ING_BIT);
} else { } else {
ret = readl_poll_timeout(hdev->hw.io_base + ret = readl_poll_timeout(hdev->hw.io_base +
HCLGEVF_RST_ING, val, HCLGEVF_RST_ING, val,
...@@ -1801,7 +1798,7 @@ static void hclgevf_clear_event_cause(struct hclgevf_dev *hdev, u32 regclr) ...@@ -1801,7 +1798,7 @@ static void hclgevf_clear_event_cause(struct hclgevf_dev *hdev, u32 regclr)
static enum hclgevf_evt_cause hclgevf_check_evt_cause(struct hclgevf_dev *hdev, static enum hclgevf_evt_cause hclgevf_check_evt_cause(struct hclgevf_dev *hdev,
u32 *clearval) u32 *clearval)
{ {
u32 cmdq_src_reg, rst_ing_reg; u32 val, cmdq_src_reg, rst_ing_reg;
/* fetch the events from their corresponding regs */ /* fetch the events from their corresponding regs */
cmdq_src_reg = hclgevf_read_dev(&hdev->hw, cmdq_src_reg = hclgevf_read_dev(&hdev->hw,
...@@ -1817,6 +1814,9 @@ static enum hclgevf_evt_cause hclgevf_check_evt_cause(struct hclgevf_dev *hdev, ...@@ -1817,6 +1814,9 @@ static enum hclgevf_evt_cause hclgevf_check_evt_cause(struct hclgevf_dev *hdev,
cmdq_src_reg &= ~BIT(HCLGEVF_VECTOR0_RST_INT_B); cmdq_src_reg &= ~BIT(HCLGEVF_VECTOR0_RST_INT_B);
*clearval = cmdq_src_reg; *clearval = cmdq_src_reg;
hdev->rst_stats.vf_rst_cnt++; hdev->rst_stats.vf_rst_cnt++;
val = hclgevf_read_dev(&hdev->hw, HCLGEVF_VF_RST_ING);
hclgevf_write_dev(&hdev->hw, HCLGEVF_VF_RST_ING,
val | HCLGEVF_VF_RST_ING_BIT);
return HCLGEVF_VECTOR0_EVENT_RST; return HCLGEVF_VECTOR0_EVENT_RST;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册