netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michael Chan <michael.chan@broadcom.com>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, kuba@kernel.org, gospo@broadcom.com,
	Edwin Peer <edwin.peer@broadcom.com>
Subject: [PATCH net-next 04/11] bnxt_en: perform no master recovery during startup
Date: Sun,  4 Oct 2020 15:22:54 -0400	[thread overview]
Message-ID: <1601839381-10446-5-git-send-email-michael.chan@broadcom.com> (raw)
In-Reply-To: <1601839381-10446-1-git-send-email-michael.chan@broadcom.com>

[-- Attachment #1: Type: text/plain, Size: 2657 bytes --]

From: Edwin Peer <edwin.peer@broadcom.com>

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 <vasundhara-v.volam@broadcom.com>
Signed-off-by: Edwin Peer <edwin.peer@broadcom.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
---
 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;
 	}
 
-- 
2.18.1


[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4166 bytes --]

  parent reply	other threads:[~2020-10-04 19:23 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-04 19:22 [PATCH net-next 00/11] bnxt_en: net-next updates Michael Chan
2020-10-04 19:22 ` [PATCH net-next 01/11] bnxt_en: Update firmware interface spec to 1.10.1.68 Michael Chan
2020-10-04 19:22 ` [PATCH net-next 02/11] bnxt_en: refactor bnxt_alloc_fw_health() Michael Chan
2020-10-04 19:22 ` [PATCH net-next 03/11] bnxt_en: log firmware status on firmware init failure Michael Chan
2020-10-04 19:22 ` Michael Chan [this message]
2020-10-04 19:22 ` [PATCH net-next 05/11] bnxt_en: Log FW health status info, if reset is aborted Michael Chan
2020-10-04 19:22 ` [PATCH net-next 06/11] bnxt_en: Refactor bnxt_free_rx_skbs() Michael Chan
2020-10-04 19:22 ` [PATCH net-next 07/11] bnxt_en: Refactor bnxt_init_one_rx_ring() Michael Chan
2020-10-04 19:22 ` [PATCH net-next 08/11] bnxt_en: Implement RX ring reset in response to buffer errors Michael Chan
2020-10-04 19:22 ` [PATCH net-next 09/11] bnxt_en: Add a software counter for RX ring reset Michael Chan
2020-10-04 19:23 ` [PATCH net-next 10/11] bnxt_en: Reduce unnecessary message log during RX errors Michael Chan
2020-10-04 19:23 ` [PATCH net-next 11/11] bnxt_en: Eliminate unnecessary RX resets Michael Chan
2020-10-04 21:41 ` [PATCH net-next 00/11] bnxt_en: net-next updates David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1601839381-10446-5-git-send-email-michael.chan@broadcom.com \
    --to=michael.chan@broadcom.com \
    --cc=davem@davemloft.net \
    --cc=edwin.peer@broadcom.com \
    --cc=gospo@broadcom.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).