Message ID | 20230617022920.67173-4-william.zhang@broadcom.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp1754335vqr; Fri, 16 Jun 2023 20:15:16 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ46ed/VFFCdps8fsGA5rAPJfLrap7E/WGi5e6Hz88cCiKiqXVWiA+7bXkvrAfYnKjnmLUcz X-Received: by 2002:a05:6830:1d4:b0:6b2:aa3e:2ed7 with SMTP id r20-20020a05683001d400b006b2aa3e2ed7mr1371344ota.19.1686971716069; Fri, 16 Jun 2023 20:15:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686971716; cv=none; d=google.com; s=arc-20160816; b=COGjGnmUFCnicteM2dypOj/Hf/Qn2RRsNFSulf15dPX8XRrZbJhnkwTqFRjrXGxqgP EQvfPpNVgrWFvJY1ExsIIvU8J3N0PrQRMLJCoxcEnC44p6fRDp3fd+pYo/C7a7oYz1Of bzEiAEYPzD6bRQpOsovaBzKQwInKm6CJXOzBsqUW3rS7h/c3A4ECGvD1XwUb5f4gp/eb SrHR0+uS2QoqN85V8krMqm8qMKzKJthywXe+RpRlJVs6/alqYdLjkV6zTWjiuHbfIDed Ok0A1f0kfeLjVYHFli4j0u1me0Q+pkJQ+moxlND30w6T+jmhjYFbE2aAZXfnNVHZJLt8 z8yA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=vSxxaZtEjn5rV3bppsvJwGxV+2k2QNug6CJhlPL5TKM=; b=mTiivt5f+yqveLREzq41//3b7WSlkEP+KlzuwXu1+5yj5ha1LyE7X5JKH/HP09CdZR nVipeGT3/AkafVKX4cwW5rtTtJ0ApqLvOm+J9CFN/d5Je8cDJ5sfYwj0qYnefN122z8p /0bgb2On/49k9v9SHlerrQFqumyNAJmMt1WnQUvvZeHcOm2NsHvBUanPrzTV15TQsE1u Azr8ly/3u2QOvQnNmpzsyCjS4dGa9sebNeDnztANnGIWJCQ4BCOkZ/CEDt0i9TqP1jen Tvj/O9jMp+mrdGWSqbqgrKYdZISjU1UgIkYwpAOYPW7NIUGreYYy8JdNZr1i+16tIRaH q9nw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=SK+XQt0c; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x66-20020a626345000000b00666b95e38efsi2284567pfb.34.2023.06.16.20.15.02; Fri, 16 Jun 2023 20:15:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=SK+XQt0c; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233825AbjFQCaP (ORCPT <rfc822;maxin.john@gmail.com> + 99 others); Fri, 16 Jun 2023 22:30:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52138 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232772AbjFQCaF (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 16 Jun 2023 22:30:05 -0400 Received: from mail-ot1-x32c.google.com (mail-ot1-x32c.google.com [IPv6:2607:f8b0:4864:20::32c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 422703AA8 for <linux-kernel@vger.kernel.org>; Fri, 16 Jun 2023 19:29:59 -0700 (PDT) Received: by mail-ot1-x32c.google.com with SMTP id 46e09a7af769-6b29b9f5c40so1170225a34.2 for <linux-kernel@vger.kernel.org>; Fri, 16 Jun 2023 19:29:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1686968998; x=1689560998; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=vSxxaZtEjn5rV3bppsvJwGxV+2k2QNug6CJhlPL5TKM=; b=SK+XQt0cAX6bNd8iyDZgiDXHAV/n/iWXvnMjZ5/gYAnF7FGVkZ1XGK/YhgoDVxvsdX yavVwVTvcKUx4QtIULkDpJPjhgrjP9HaMLgDUkrlR73RQVW9h+8kJe+2UlmaKrhBsx2+ vD4GqsBSdZBlLxT6Z5iH1gUKRR+FSvJDjFzFM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686968998; x=1689560998; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=vSxxaZtEjn5rV3bppsvJwGxV+2k2QNug6CJhlPL5TKM=; b=cmsO41482oYagdpEc+B6PvXpzdmL921lpabc1YHMA8ijZn6ulyA0mvn0mB9Opqv7Rp f60DDOkVOQee2ZA7gJJ0iNzXUj3TjfvlcLl0y9qiXYn0P5WhbehEFWOBu63Ar+hhjH5H NFrFoTzaGvmjkNPzMIkTmewhTPrRWpGbBVHTpG99hBb7vcCg+H3wKW1p31vwNr8WfO9d +BYq8l3hs1r1m4kR77Um5wigLyAvX6NHpjq5caU1Z2XEALjneLYncwwgWL6fr/gJVK0K /FgTFBqGgyZNACRZl0Icw2FdIDWl2xR5DZqQ11/Ubp21ZiNhDnSgMiOABBo1+bx/Wy+r JrwA== X-Gm-Message-State: AC+VfDxWGpHWcDTVbzytH5WrOYBZThinWCCEajxAV8PSwoxzbFnISNK3 Y10p9epPwBMcet2saa8zPTN3/g== X-Received: by 2002:a05:6830:1:b0:6b1:5100:557c with SMTP id c1-20020a056830000100b006b15100557cmr1243964otp.34.1686968998558; Fri, 16 Jun 2023 19:29:58 -0700 (PDT) Received: from ubuntu-22.localdomain ([192.19.222.250]) by smtp.gmail.com with ESMTPSA id b2-20020aa78702000000b006668f004420sm3520239pfo.148.2023.06.16.19.29.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Jun 2023 19:29:57 -0700 (PDT) From: William Zhang <william.zhang@broadcom.com> To: Broadcom Kernel List <bcm-kernel-feedback-list@broadcom.com>, Linux MTD List <linux-mtd@lists.infradead.org> Cc: f.fainelli@gmail.com, rafal@milecki.pl, kursad.oney@broadcom.com, joel.peshkin@broadcom.com, computersforpeace@gmail.com, anand.gore@broadcom.com, dregan@mail.com, kamal.dasu@broadcom.com, tomer.yacoby@broadcom.com, dan.beygelman@broadcom.com, William Zhang <william.zhang@broadcom.com>, Florian Fainelli <florian.fainelli@broadcom.com>, Miquel Raynal <miquel.raynal@bootlin.com>, linux-kernel@vger.kernel.org, Vignesh Raghavendra <vigneshr@ti.com>, Richard Weinberger <richard@nod.at>, Kamal Dasu <kdasu.kdev@gmail.com> Subject: [PATCH v2 3/4] mtd: rawnand: brcmnand: Fix crash during the panic_write Date: Fri, 16 Jun 2023 19:29:19 -0700 Message-Id: <20230617022920.67173-4-william.zhang@broadcom.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230617022920.67173-1-william.zhang@broadcom.com> References: <20230617022920.67173-1-william.zhang@broadcom.com> MIME-Version: 1.0 Content-Type: multipart/signed; protocol="application/pkcs7-signature"; micalg=sha-256; boundary="000000000000ebe82505fe4a1398" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768918053645520687?= X-GMAIL-MSGID: =?utf-8?q?1768918053645520687?= |
Series |
mtd: rawnand: brcmnand: driver and doc updates
|
|
Commit Message
William Zhang
June 17, 2023, 2:29 a.m. UTC
During the panic write path to execute another nand command, if there is a pending command, we should wait for the command instead of calling BUG_ON so we don't crash while crashing. Fixes: 27c5b17cd1b1 ("mtd: nand: add NAND driver "library" for Broadcom STB NAND controller") Signed-off-by: William Zhang <william.zhang@broadcom.com> Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com> Reviewed-by: Kursad Oney <kursad.oney@broadcom.com> Reviewed-by: Kamal Dasu <kamal.dasu@broadcom.com> --- Changes in v2: None drivers/mtd/nand/raw/brcmnand/brcmnand.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/drivers/mtd/nand/raw/brcmnand/brcmnand.c b/drivers/mtd/nand/raw/brcmnand/brcmnand.c index 37c2c7cfa00e..ea03104692bf 100644 --- a/drivers/mtd/nand/raw/brcmnand/brcmnand.c +++ b/drivers/mtd/nand/raw/brcmnand/brcmnand.c @@ -1608,7 +1608,17 @@ static void brcmnand_send_cmd(struct brcmnand_host *host, int cmd) dev_dbg(ctrl->dev, "send native cmd %d addr 0x%llx\n", cmd, cmd_addr); - BUG_ON(ctrl->cmd_pending != 0); + /* + * If we came here through _panic_write and there is a pending + * command, try to wait for it. If it times out, rather than + * hitting BUG_ON, just return so we don't crash while crashing. + */ + if (oops_in_progress) { + if (ctrl->cmd_pending && + bcmnand_ctrl_poll_status(ctrl, NAND_CTRL_RDY, NAND_CTRL_RDY, 0)) + return; + } else + BUG_ON(ctrl->cmd_pending != 0); ctrl->cmd_pending = cmd; ret = bcmnand_ctrl_poll_status(ctrl, NAND_CTRL_RDY, NAND_CTRL_RDY, 0);