From nobody Fri Dec 19 16:02:37 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 94C33C25B70 for ; Sat, 28 Oct 2023 03:03:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346751AbjJ1DDH (ORCPT ); Fri, 27 Oct 2023 23:03:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57712 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233155AbjJ1DCm (ORCPT ); Fri, 27 Oct 2023 23:02:42 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ADB4211F; Fri, 27 Oct 2023 20:02:40 -0700 (PDT) Received: from kwepemm000007.china.huawei.com (unknown [172.30.72.53]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4SHPN75JP2zpWWt; Sat, 28 Oct 2023 10:57:43 +0800 (CST) Received: from localhost.localdomain (10.67.165.2) by kwepemm000007.china.huawei.com (7.193.23.189) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Sat, 28 Oct 2023 11:02:38 +0800 From: Jijie Shao To: , , , , , CC: , , , , , Subject: [PATCH net 6/7] net: hns3: fix VF reset fail issue Date: Sat, 28 Oct 2023 10:59:16 +0800 Message-ID: <20231028025917.314305-7-shaojijie@huawei.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20231028025917.314305-1-shaojijie@huawei.com> References: <20231028025917.314305-1-shaojijie@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.67.165.2] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To kwepemm000007.china.huawei.com (7.193.23.189) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Currently the reset process in hns3 and firmware watchdog init process is asynchronous. We think firmware watchdog initialization is completed before VF clear the interrupt source. However, firmware initialization may not complete early. So VF will receive multiple reset interrupts and fail to reset. So we add delay before VF interrupt source and 5 ms delay is enough to avoid second reset interrupt. Fixes: 427900d27d86 ("net: hns3: fix the timing issue of VF clearing interr= upt sources") Signed-off-by: Jijie Shao --- .../ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c b/dr= ivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c index 1c62e58ff6d8..7b87da031be6 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c @@ -1924,8 +1924,14 @@ static void hclgevf_service_task(struct work_struct = *work) hclgevf_mailbox_service_task(hdev); } =20 -static void hclgevf_clear_event_cause(struct hclgevf_dev *hdev, u32 regclr) +static void hclgevf_clear_event_cause(struct hclgevf_dev *hdev, u32 regclr, + bool need_dalay) { +#define HCLGEVF_RESET_DELAY 5 + + if (need_dalay) + mdelay(HCLGEVF_RESET_DELAY); + hclgevf_write_dev(&hdev->hw, HCLGE_COMM_VECTOR0_CMDQ_SRC_REG, regclr); } =20 @@ -1990,7 +1996,8 @@ static irqreturn_t hclgevf_misc_irq_handle(int irq, v= oid *data) hclgevf_enable_vector(&hdev->misc_vector, false); event_cause =3D hclgevf_check_evt_cause(hdev, &clearval); if (event_cause !=3D HCLGEVF_VECTOR0_EVENT_OTHER) - hclgevf_clear_event_cause(hdev, clearval); + hclgevf_clear_event_cause(hdev, clearval, + event_cause =3D=3D HCLGEVF_VECTOR0_EVENT_RST); =20 switch (event_cause) { case HCLGEVF_VECTOR0_EVENT_RST: @@ -2340,7 +2347,7 @@ static int hclgevf_misc_irq_init(struct hclgevf_dev *= hdev) return ret; } =20 - hclgevf_clear_event_cause(hdev, 0); + hclgevf_clear_event_cause(hdev, 0, false); =20 /* enable misc. vector(vector 0) */ hclgevf_enable_vector(&hdev->misc_vector, true); --=20 2.30.0