From patchwork Sun Oct 4 19:22:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 267624 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, MIME_HEADER_CTYPE_ONLY, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, T_TVD_MIME_NO_HEADERS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CF79FC47095 for ; Sun, 4 Oct 2020 19:23:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 93CC9205ED for ; Sun, 4 Oct 2020 19:23:31 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="fWvW6puk" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726755AbgJDTXa (ORCPT ); Sun, 4 Oct 2020 15:23:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60812 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726476AbgJDTX2 (ORCPT ); Sun, 4 Oct 2020 15:23:28 -0400 Received: from mail-pf1-x443.google.com (mail-pf1-x443.google.com [IPv6:2607:f8b0:4864:20::443]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 47CA3C0613CF for ; Sun, 4 Oct 2020 12:23:28 -0700 (PDT) Received: by mail-pf1-x443.google.com with SMTP id x22so5059725pfo.12 for ; Sun, 04 Oct 2020 12:23:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=/p+wy/m0moriUeJwAze8D8G9TDkvSYQ2TTc4XsGJiDo=; b=fWvW6pukAb6wjVsiIGgnVRpPTEgijVSvX2iCoxqLtk2hKZck3wAfqiggP7g70v8pzv ex5ZbyWjVKKX4NKBBkO9Zo4+r5lqzOa9oOdGPeRU0EZjWn+0+t2dDh+rfddLR1uBZHxg 5erOTSJV5Zf2h5FZrcISFQMMhLsTsbmptuMg8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=/p+wy/m0moriUeJwAze8D8G9TDkvSYQ2TTc4XsGJiDo=; b=VmdC/YGU/WPG9JG2LowQ/Moj4JwwOPh7BaTqqUjN9CzKJpeR5crYTYEUm0zztLDDoa 3EZs7Kff6+LdkapeIFRHh9M/KWkfdJD32cXH35kzV2EH6uUvW3/sbQ6AkH3mareLtyxh WKBFRfqHfbyojixMvq55AONDrQ7UdttwULZ1SGOyxLNbyXZyuZDI17Ed9mhetDZe8Opw 3ZZQY6CSK7EEGquoDalXv7wd40aUIkSpQcjtILAVkOXKc7jVf4Jym+gpv/1xopQgobey 6q99ZjMTE7L9j+siNKepDLn3FTq8IrxLFKdLG1owjx1K7iLUedr49QLA+Xd3Mpca0ygX pNiw== X-Gm-Message-State: AOAM533WCLbHaidl3qJr/D3o2F1W2jn5jPIPJWAef21DciYpNxOcWBqm Gb5URPNuMb549DOvBrMM50zUaFe0D0XG/Q== X-Google-Smtp-Source: ABdhPJw3nPM7iwemefRUBO6+W/9IMD59NiUscm0b2+eMteDExA9Xvbq85Zd4WgH/enbZmpodNOl3xg== X-Received: by 2002:a63:c20f:: with SMTP id b15mr10919710pgd.8.1601839407515; Sun, 04 Oct 2020 12:23:27 -0700 (PDT) Received: from localhost.swdvt.lab.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id 138sm9824234pfu.180.2020.10.04.12.23.26 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 04 Oct 2020 12:23:26 -0700 (PDT) From: Michael Chan To: davem@davemloft.net Cc: netdev@vger.kernel.org, kuba@kernel.org, gospo@broadcom.com, Edwin Peer Subject: [PATCH net-next 04/11] bnxt_en: perform no master recovery during startup Date: Sun, 4 Oct 2020 15:22:54 -0400 Message-Id: <1601839381-10446-5-git-send-email-michael.chan@broadcom.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1601839381-10446-1-git-send-email-michael.chan@broadcom.com> References: <1601839381-10446-1-git-send-email-michael.chan@broadcom.com> Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Edwin Peer The NS3 SoC platforms require assistance from the OP-TEE to recover firmware if a crash occurs while no driver is bound. The CRASHED_NO_MASTER condition is recorded in the firmware status register during the crash to indicate when driver intervension is needed to coordinate a firmware reload. This condition is detected during early driver initialization in order to effect a firmware fastboot on supported platforms when necessary. Reviewed-by: Vasundhara Volam Signed-off-by: Edwin Peer Signed-off-by: Michael Chan --- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 38 +++++++++++++++++------ 1 file changed, 29 insertions(+), 9 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index 224f76e784b8..afa425375cd0 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -11035,6 +11035,21 @@ static void bnxt_init_dflt_coal(struct bnxt *bp) bp->stats_coal_ticks = BNXT_DEF_STATS_COAL_TICKS; } +static int bnxt_fw_reset_via_optee(struct bnxt *bp) +{ +#ifdef CONFIG_TEE_BNXT_FW + int rc = tee_bnxt_fw_load(); + + if (rc) + netdev_err(bp->dev, "Failed FW reset via OP-TEE, rc=%d\n", rc); + + return rc; +#else + netdev_err(bp->dev, "OP-TEE not supported\n"); + return -ENODEV; +#endif +} + static int bnxt_fw_init_one_p1(struct bnxt *bp) { int rc; @@ -11043,12 +11058,21 @@ static int bnxt_fw_init_one_p1(struct bnxt *bp) rc = bnxt_hwrm_ver_get(bp); bnxt_try_map_fw_health_reg(bp); if (rc) { - if (bp->fw_health && bp->fw_health->status_reliable) + if (bp->fw_health && bp->fw_health->status_reliable) { + u32 sts = bnxt_fw_health_readl(bp, BNXT_FW_HEALTH_REG); + netdev_err(bp->dev, "Firmware not responding, status: 0x%x\n", - bnxt_fw_health_readl(bp, - BNXT_FW_HEALTH_REG)); - return rc; + sts); + if (sts & FW_STATUS_REG_CRASHED_NO_MASTER) { + netdev_warn(bp->dev, "Firmware recover via OP-TEE requested\n"); + rc = bnxt_fw_reset_via_optee(bp); + if (!rc) + rc = bnxt_hwrm_ver_get(bp); + } + } + if (rc) + return rc; } if (bp->fw_cap & BNXT_FW_CAP_KONG_MB_CHNL) { @@ -11221,12 +11245,8 @@ static void bnxt_reset_all(struct bnxt *bp) int i, rc; if (bp->fw_cap & BNXT_FW_CAP_ERR_RECOVER_RELOAD) { -#ifdef CONFIG_TEE_BNXT_FW - rc = tee_bnxt_fw_load(); - if (rc) - netdev_err(bp->dev, "Unable to reset FW rc=%d\n", rc); + bnxt_fw_reset_via_optee(bp); bp->fw_reset_timestamp = jiffies; -#endif return; }