Message ID | 20230606231252.94838-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 k13csp3731541vqr; Tue, 6 Jun 2023 16:21:34 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7/Bkm/A1PdlH5GJmQUc5vARb/txuXJ09jfftKsLBMawjKCx66UmylK5eturpUpJcZPVLRF X-Received: by 2002:a05:6a00:1883:b0:646:9232:df6 with SMTP id x3-20020a056a00188300b0064692320df6mr4865092pfh.33.1686093693863; Tue, 06 Jun 2023 16:21:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686093693; cv=none; d=google.com; s=arc-20160816; b=DPkKoC1Jvdu4pGfemIFO2CtjWprdp4mSwqkscDpqzcGQRLZTqZmwDsAo9o1R9CHUZD Uf5OWlCPOB/Er9JJuj34sIweFoxg+LjtESahBHXAKJ04zZcX+K4B+Hei2hwYrBgSjdml Qz6S3aX9Vb634/WRFNsecLCBoADxGFu8jtopONIE9FCVJcTEQJ0SXkH20+6RLv9E/une Ku4e4u35VcYgdv+z9RBdlya578Pq7kzrjDpK8qrquVwiTt/pRA1pxbITlEbIwnPQRRmN Sfo/Y5A9Vm+4Gxac3HCLlVABCt0qy3VIz+0spDF2kpJ31mW0pNSrVkI9kriquOxcHFo9 /X/g== 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=19YeYuGMdrBP8BcBy6qvZnJ7POtkzTzxfbLYppbf8ls=; b=qCfnuXjUleobNolM1/Ke9n3auRcLMvlNIfhU5FeMLckV8wKOW9Ka3nQXy8aHikx52v 9+j64ZTeaQP9MpJZLrQCUnnpaMtkXauYSb0IyhBzBg8BZCo+5PEsJKUmqCzoUbHYjbCd /246cSIid/X2nmQ+8uXVRSgTYzIWcfJGls+tZy+YvOdisrG4IALq54is0+nvdPs9+VmJ A4nTwXII7Agrkz/w7rNTv45UmYiXtmjYlgGxkFnjSaWpjWOMMVgU524xfoKld6YZaUi0 UWMxspf0AfuQTAOw3SL6ufSPYDj79oaGLkk2LuUsJsrdGKJvzxBOUGi3jVyk9Ne+QLds euKQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=XTaBro+q; 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 c15-20020a624e0f000000b0063354a65327si7486381pfb.395.2023.06.06.16.21.18; Tue, 06 Jun 2023 16:21:33 -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=XTaBro+q; 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 S240213AbjFFXOk (ORCPT <rfc822;xxoosimple@gmail.com> + 99 others); Tue, 6 Jun 2023 19:14:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49024 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240224AbjFFXO0 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 6 Jun 2023 19:14:26 -0400 Received: from mail-qk1-x730.google.com (mail-qk1-x730.google.com [IPv6:2607:f8b0:4864:20::730]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3C31D1706 for <linux-kernel@vger.kernel.org>; Tue, 6 Jun 2023 16:14:24 -0700 (PDT) Received: by mail-qk1-x730.google.com with SMTP id af79cd13be357-75da00a1eddso358228485a.3 for <linux-kernel@vger.kernel.org>; Tue, 06 Jun 2023 16:14:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1686093263; x=1688685263; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=19YeYuGMdrBP8BcBy6qvZnJ7POtkzTzxfbLYppbf8ls=; b=XTaBro+qytTMBqU4ZbSvlbNy8RGzZcUL1hgm8bVRNKP/7A3xPDL42lLvyHseJANKCy 3VDmAAs0LZkqKpNgE5+LTNVTQ0u0ZVgTUMXoCyymgVb+jSiuFFCBRDr+/YPPQ2htNnSs PbVPW35NL0hJnD+X5ClGbPmqR/iKL0K6hQMJo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686093263; x=1688685263; 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=19YeYuGMdrBP8BcBy6qvZnJ7POtkzTzxfbLYppbf8ls=; b=CgBZrOWVdXnmUuAy5GKCv0Lsc5Ll6eIEtpGXvdF5YzUng8O1lsUNr/AcMtCmoRyA32 bdDPKHXyjtrxMmtXPJJqL2RYPdQyyRLa3IMocP46cjlZiPBcvgSoFCEPgxZmAGT/HdZQ N0cdM4IiwUEoFlWURRHjy/RQACbTnuSQ5KEUu86ce9zH3nOGtbOzK7Dr/TGeTXJZWMNO 0sZmaGIbq/m2viGW3+dYP6ht7yLt5bcm7fWfTYLbEvM7fn309m8AjDUnUlFpA6L+JZ9i S1x76Abu/9+7EwAzkzt+3dm2v22f7YUSg4C88Z0DCY2RE183eMq8Nq2erPVc8Ymw2iBm BO1Q== X-Gm-Message-State: AC+VfDzfwFahoci6CDH8MDuvmChu0aqaHsKe+MY53coSIFWR8S7oXQk7 yU+DH1hNx6r5YGXMNYYy837mrA== X-Received: by 2002:a05:620a:88a:b0:75d:4699:756e with SMTP id b10-20020a05620a088a00b0075d4699756emr110283qka.56.1686093263318; Tue, 06 Jun 2023 16:14:23 -0700 (PDT) Received: from ubuntu-22.localdomain ([192.19.222.250]) by smtp.gmail.com with ESMTPSA id x9-20020ae9e909000000b0075b23e55640sm5221519qkf.123.2023.06.06.16.14.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Jun 2023 16:14:22 -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 03/12] mtd: rawnand: brcmnand: Fix crash during the panic_write Date: Tue, 6 Jun 2023 16:12:43 -0700 Message-Id: <20230606231252.94838-4-william.zhang@broadcom.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230606231252.94838-1-william.zhang@broadcom.com> References: <20230606231252.94838-1-william.zhang@broadcom.com> MIME-Version: 1.0 Content-Type: multipart/signed; protocol="application/pkcs7-signature"; micalg=sha-256; boundary="00000000000009324e05fd7e2e58" 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?1767997381185680919?= X-GMAIL-MSGID: =?utf-8?q?1767997381185680919?= |
Series |
mtd: rawnand: brcmnand: driver and doc updates
|
|
Commit Message
William Zhang
June 6, 2023, 11:12 p.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> --- 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 b6346a8b9833..20832857c4aa 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);