Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp3576137rdb; Wed, 13 Sep 2023 17:04:14 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH1UeGQ10fhDxcwRI6Rf0pe7CBbnmK07/v4am8BqRTM+UoK+404cxuMdPsL4+5omBd8mvBf X-Received: by 2002:a17:902:c38c:b0:1c3:1c74:5d0a with SMTP id g12-20020a170902c38c00b001c31c745d0amr4081538plg.34.1694649853932; Wed, 13 Sep 2023 17:04:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694649853; cv=none; d=google.com; s=arc-20160816; b=mhZqN/1vQEdK2SJwXRssHb6/NVkzwrliy9/G4YRbjAUgi2t9SNnmIGAQAmBBynX9v9 VvBr1TOPi2EgIcgKGBWN6grUTJ76enOf6wtKlgTwY6CzDurT/HLT4BeJHcgys/vTAaCv ovS41nIPZCQWcUnpU/s10GtLjkutkJ0ZDfgbbGLxDebgxhPsXFIlXIW29pcCF98EAeGn hwgU3XxBA4pwej1x52zWh0ZaBmuw8ZcLrEUtLSvcVuKZ6nAiMx6+GdmYb/fFbgAPNGby 6e3+DVTOP/nOhQPwN0g8FddjqV8lfG8/hM0nuBfR3WZJYgxcg0+pOh5dWeIsYXdCQev1 /XaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=c/a2qgjoo2nQUWXb7r5nsgXziNgn55XDSWezlY2qXCA=; fh=ypNhARugSCy9PuHcL/WsKk+I6HTynYlYMm/Bs2MXgAU=; b=AzdjS5WqnDbNrDlxpYsvNVqENroNJ/FPQcMJxOIQG08tzMEx5EH4v/IN40Xwa43CNO WYBYMURkfyWoVQoDuvKBhXpNPfBZLXpS6a/5dYg21wDA+oRP8poTgP3wh1YKR1yE57Pk hgfK9NMsjVIHK9WCz8jZupS1LIzsqN9yCLxjFoyK5J9OUdV9f0KNa4nsNfhkT6nR+lvn PmhASjTjQUuaYanlQ2nR5JEdC3zfRsIBrY1gaqZJzwBgxsU3ZHm6zvbjSpclmQ/G7NGD rnd7S3n0nm4nSJGGQ+jqS3cGiVO/NuuRGKEejQQTajQ2HJPPeO4eV7VycwwhaVAC0Q8s 1qHQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id z12-20020a170903018c00b001c0ab540e67si452070plg.213.2023.09.13.17.04.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Sep 2023 17:04:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id A64D28072454; Wed, 13 Sep 2023 17:03:59 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233187AbjINADw (ORCPT + 99 others); Wed, 13 Sep 2023 20:03:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60520 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229996AbjINADv (ORCPT ); Wed, 13 Sep 2023 20:03:51 -0400 Received: from out28-219.mail.aliyun.com (out28-219.mail.aliyun.com [115.124.28.219]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0C828E6A; Wed, 13 Sep 2023 17:03:46 -0700 (PDT) X-Alimail-AntiSpam: AC=CONTINUE;BC=0.1061964|-1;CH=green;DM=|CONTINUE|false|;DS=CONTINUE|ham_alarm|0.0164707-0.000140752-0.983389;FP=0|0|0|0|0|-1|-1|-1;HT=ay29a033018047205;MF=michael@allwinnertech.com;NM=1;PH=DS;RN=14;RT=14;SR=0;TI=SMTPD_---.UeWrPh0_1694649822; Received: from SunxiBot.allwinnertech.com(mailfrom:michael@allwinnertech.com fp:SMTPD_---.UeWrPh0_1694649822) by smtp.aliyun-inc.com; Thu, 14 Sep 2023 08:03:44 +0800 From: Michael Wu To: ulf.hansson@linaro.org, CLoehle@hyperstone.com, adrian.hunter@intel.com, jinpu.wang@ionos.com, hare@suse.de, victor.shih@genesyslogic.com.tw, avri.altman@wdc.com, asuk4.q@gmail.com Cc: axboe@kernel.dk, brauner@kernel.org, f.fainelli@gmail.com, beanhuo@micron.com, linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] mmc: core: Add new flag to force hardware reset Date: Thu, 14 Sep 2023 08:03:48 +0800 Message-Id: <20230914000348.25790-1-michael@allwinnertech.com> X-Mailer: git-send-email 2.29.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Wed, 13 Sep 2023 17:03:59 -0700 (PDT) X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Entering the recovery system itself indicates a transmission error. In this situation, we intend to execute the mmc_blk_reset function to clear any anomalies that may be caused by errors. We have previously discussed with several MMC device manufacturers, and they expressed their desire for us to reset the device when errors occur to ensure stable operation. We aim to make this code compatible with all devices and ensure its stable performance, so we would like to add this patch Signed-off-by: Michael Wu --- drivers/mmc/core/block.c | 2 +- include/linux/mmc/host.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c index b5b414a71e0b..29fbe0ddeadb 100644 --- a/drivers/mmc/core/block.c +++ b/drivers/mmc/core/block.c @@ -1503,7 +1503,7 @@ void mmc_blk_cqe_recovery(struct mmc_queue *mq) pr_debug("%s: CQE recovery start\n", mmc_hostname(host)); err = mmc_cqe_recovery(host); - if (err) + if (err || host->cqe_recovery_reset_always) mmc_blk_reset(mq->blkdata, host, MMC_BLK_CQE_RECOVERY); mmc_blk_reset_success(mq->blkdata, MMC_BLK_CQE_RECOVERY); diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index 62a6847a3b6f..f578541a06b5 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h @@ -518,6 +518,7 @@ struct mmc_host { int cqe_qdepth; bool cqe_enabled; bool cqe_on; + bool cqe_recovery_reset_always; /* Inline encryption support */ #ifdef CONFIG_MMC_CRYPTO -- 2.29.0