Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp206088rdb; Thu, 30 Nov 2023 02:35:24 -0800 (PST) X-Google-Smtp-Source: AGHT+IG5XWUb8turQ1Mv7hf2sqa9Ibr+2byMF7o7vJD08D3DuYVWdff/D2gfGEAMw3dQHNpv1DtY X-Received: by 2002:a05:6a00:3986:b0:6c3:415a:5c05 with SMTP id fi6-20020a056a00398600b006c3415a5c05mr30762123pfb.14.1701340524537; Thu, 30 Nov 2023 02:35:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701340524; cv=none; d=google.com; s=arc-20160816; b=yHjWW1erEe+c+uUk/dvcWVSxAYtEeceo3PGi1NNeLYOS4ftDjUR+k0dNrr2Ze1tJ4J tFczzbri2xnayytZc20tnJCTAKcVBM/y3a9nTDWeMV23QzliBliO6R8cU0t+n0yDfsTm qcxLc8LT1jSsFXu+uo728rnEIxu7UyZnWiFmYmWri0/6gnO5eJ5+EseWJ1xgba6tzCTE 0g48Rmh63VHgDQflNQ67pPpvVP/xUBk75Y8xN21xxbNNm9XDzzubUIxmxmRuBBQ2FJca dpHH/uCflZSGiyxvNjeP6QnITtz0zl3w2zResCiSAG8oe3au5Nv13sp/jc/S0vhAtvyJ v5UQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=j350QJDKEuHqSIhgnqrzjS7NiG3vRDy7K5wFB+bsbRE=; fh=tuw2vuNDEQ0otvb1+SthhJbUenEUOJNd3pXwzJNUBlI=; b=RQsMYvFUDWLejO3aSpqFumqe6wipmcXO06FxLwEMChUKuWq2d1RGxSjPyPnE1TK6+3 wobUCjj8Q4YYqj/f87surw51f2M/DqnEXu5fW8S3EgCaqiGZWdeAmAxv6YYVwT3vFNGA +/AOaP3BwXq+49ymCdKJyGc6KQ0EsuGoYUdqRDSYtGbLl7LmyHWW0e1dmzYTcyzkTFVR xhim9dV28AdXhJm3APkN4sPEuF4Ehya1suCQkJrkmZFUxH+HZ5oGI5mI/ylLSkB6RodO TpEP9S6o6pfJlMB6UHIAVt5SEq9cGr7R5XZ84HXk6wNvIQdHnPqm+nqpPEDKq6eUnZHQ h2cg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=neGvdV0Q; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id f4-20020a056a00238400b006cb69513cc5si1016082pfc.254.2023.11.30.02.35.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Nov 2023 02:35:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=neGvdV0Q; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 86F98823B3FB; Thu, 30 Nov 2023 02:35:10 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235072AbjK3Keu (ORCPT + 99 others); Thu, 30 Nov 2023 05:34:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50400 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229462AbjK3Ket (ORCPT ); Thu, 30 Nov 2023 05:34:49 -0500 Received: from mail-yb1-xb2f.google.com (mail-yb1-xb2f.google.com [IPv6:2607:f8b0:4864:20::b2f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5FFEA10D0 for ; Thu, 30 Nov 2023 02:34:55 -0800 (PST) Received: by mail-yb1-xb2f.google.com with SMTP id 3f1490d57ef6-da30fd994fdso1549972276.1 for ; Thu, 30 Nov 2023 02:34:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1701340494; x=1701945294; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=j350QJDKEuHqSIhgnqrzjS7NiG3vRDy7K5wFB+bsbRE=; b=neGvdV0QQLiEVpfl0eQmDr6ELBYno7YaSQTuOBwf12qNB3IdA1/PxvfOtSGkl11UO5 5lGGzMPGEuod6RqhbEICZ0Bjfp2oLnxkFQ4RKzKYacjJCOMQe/fEXs0EA0adW9ny+q1h 5Y90gAwsV0YNuJHh3OYDlSVMVKr3bAHwQz9sic6hV/f1i5gNzBvs5Z6u4OuSoMIiPxbx wD70Ln/ecm9ts0DnrwziKZk4LKh8wXdquqIEIVWgd1FlD0BqFvxhObSXCUzeGE48SAdb ft77Uz693+1lYXBmjnJwS58S0MJVvt/1cGopsVR/ngWcRhBTii/4VNs9wOyRqX1Nnahx SDmw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701340494; x=1701945294; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=j350QJDKEuHqSIhgnqrzjS7NiG3vRDy7K5wFB+bsbRE=; b=q/sYowgpxGwdjYvR3WlPWBjHniAdj9JkDwtRxzvZbPeiW0FmHO+MKJ6Z3IbGjs+Hea vNfZer6AlzEDlW62Etj3H6WafVOpHylC+IdqgU9iqcpNwA47Taz3chp52eiY34bbQHHR K+Ze38LoR4G6aLOgix72vBWiml8Ng4sGB55ELViK/LwAkGtFM0FeEvzKmNjm6Z/70vG0 BA4F1oAcaoCl2tRYzC+8GYhYlCVte+QKzUALTOJMaO9zNpJmMai8X2CJeaotfTF9Y0Qj oOwtvfIJPjdMYpO+tmchZbryvJy6LG9lb2BxQVC0rMPXIhaWqPKtALitJuSWgR9W7S6w yuAQ== X-Gm-Message-State: AOJu0YyMY99zEjasBrrbeAYB8dtKyp1IpbasKhjif+QC10IuViYc3hCw uVuYQJeKvriGsuuSGlFKAVokfQtOjRP7L/WJb2JjXQ== X-Received: by 2002:a25:9708:0:b0:db4:354b:77b1 with SMTP id d8-20020a259708000000b00db4354b77b1mr16979757ybo.32.1701340494561; Thu, 30 Nov 2023 02:34:54 -0800 (PST) MIME-Version: 1.0 References: <20231129160533.2827458-1-jorge@foundries.io> In-Reply-To: <20231129160533.2827458-1-jorge@foundries.io> From: Ulf Hansson Date: Thu, 30 Nov 2023 11:34:18 +0100 Message-ID: Subject: Re: [PATCHv2] mmc: rpmb: add quirk MMC_QUIRK_BROKEN_RPMB_RETUNE To: Jorge Ramirez-Ortiz Cc: CLoehle@hyperstone.com, adrian.hunter@intel.com, jinpu.wang@ionos.com, hare@suse.de, beanhuo@micron.com, yangyingliang@huawei.com, asuk4.q@gmail.com, yibin.ding@unisoc.com, victor.shih@genesyslogic.com.tw, marex@denx.de, rafael.beims@toradex.com, robimarko@gmail.com, ricardo@foundries.io, linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email 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 (pete.vger.email [0.0.0.0]); Thu, 30 Nov 2023 02:35:10 -0800 (PST) On Wed, 29 Nov 2023 at 17:05, Jorge Ramirez-Ortiz wrote: > > On the eMMC SanDisk iNAND 7250 configured with HS200, requesting a > re-tune before switching to the RPMB partition would randomly cause > subsequent RPMB requests to fail with EILSEQ: > * data error -84, tigggered in __mmc_blk_ioctl_cmd() > > This commit skips the retune when switching to RPMB. > Tested over several days with per minute RPMB reads. This sounds weird to me and needs more testing/debugging in my opinion, especially at the host driver level. Perhaps add some new tests in mmc_test, that does a partition switch to/from any partition and then run regular I/O again to see if the problem is easier to reproduce? The point is, I wonder what is so special with RPMB here? Note that, it has been quite common that host drivers/controllers have had issues with their tuning support, so I would not be surprised if that is the case here too. Certainly I would be surprised if the problem is at the eMMC card side, but I may be wrong. Kind regards Uffe > > Signed-off-by: Jorge Ramirez-Ortiz > --- > Fixes v1: kernel test robot identified typo causing build failure > CIF_MANFID_SANDISK_SD --> CID_MANFID_SANDISK_SD > > drivers/mmc/core/block.c | 6 +++++- > drivers/mmc/core/card.h | 7 +++++++ > drivers/mmc/core/quirks.h | 7 +++++++ > include/linux/mmc/card.h | 1 + > 4 files changed, 20 insertions(+), 1 deletion(-) > > diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c > index 152dfe593c43..9b7ba6562a3b 100644 > --- a/drivers/mmc/core/block.c > +++ b/drivers/mmc/core/block.c > @@ -860,6 +860,11 @@ static int mmc_blk_part_switch_pre(struct mmc_card *card, > return ret; > } > mmc_retune_pause(card->host); > + > + /* Do not force retune before RPMB switch */ > + if (mmc_can_retune(card->host) && > + mmc_card_broken_rpmb_retune(card)) > + card->host->need_retune = 0; > } > > return ret; > @@ -3143,4 +3148,3 @@ module_exit(mmc_blk_exit); > > MODULE_LICENSE("GPL"); > MODULE_DESCRIPTION("Multimedia Card (MMC) block device driver"); > - > diff --git a/drivers/mmc/core/card.h b/drivers/mmc/core/card.h > index b7754a1b8d97..1e1555a15de9 100644 > --- a/drivers/mmc/core/card.h > +++ b/drivers/mmc/core/card.h > @@ -85,6 +85,7 @@ struct mmc_fixup { > #define CID_MANFID_MICRON 0x13 > #define CID_MANFID_SAMSUNG 0x15 > #define CID_MANFID_APACER 0x27 > +#define CID_MANFID_SANDISK2 0x45 > #define CID_MANFID_KINGSTON 0x70 > #define CID_MANFID_HYNIX 0x90 > #define CID_MANFID_KINGSTON_SD 0x9F > @@ -284,4 +285,10 @@ static inline int mmc_card_broken_cache_flush(const struct mmc_card *c) > { > return c->quirks & MMC_QUIRK_BROKEN_CACHE_FLUSH; > } > + > +static inline int mmc_card_broken_rpmb_retune(const struct mmc_card *c) > +{ > + return c->quirks & MMC_QUIRK_BROKEN_RPMB_RETUNE; > +} > + > #endif > diff --git a/drivers/mmc/core/quirks.h b/drivers/mmc/core/quirks.h > index cca71867bc4a..56c79b6b3537 100644 > --- a/drivers/mmc/core/quirks.h > +++ b/drivers/mmc/core/quirks.h > @@ -130,6 +130,13 @@ static const struct mmc_fixup __maybe_unused mmc_blk_fixups[] = { > MMC_FIXUP(CID_NAME_ANY, CID_MANFID_SANDISK_SD, 0x5344, add_quirk_sd, > MMC_QUIRK_BROKEN_SD_DISCARD), > > + /* > + * SanDisk iNAND 7250 DG4064, this quirk shall disable the retune > + * operation enforced by default when switching to RPMB. > + */ > + MMC_FIXUP("DG4064", CID_MANFID_SANDISK2, 0x100, add_quirk_mmc, > + MMC_QUIRK_BROKEN_RPMB_RETUNE), > + > END_FIXUP > }; > > diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h > index 7b12eebc5586..bd6986189e8b 100644 > --- a/include/linux/mmc/card.h > +++ b/include/linux/mmc/card.h > @@ -296,6 +296,7 @@ struct mmc_card { > #define MMC_QUIRK_BROKEN_SD_DISCARD (1<<14) /* Disable broken SD discard support */ > #define MMC_QUIRK_BROKEN_SD_CACHE (1<<15) /* Disable broken SD cache support */ > #define MMC_QUIRK_BROKEN_CACHE_FLUSH (1<<16) /* Don't flush cache until the write has occurred */ > +#define MMC_QUIRK_BROKEN_RPMB_RETUNE (1<<17) /* Don't force a retune before switching to RPMB */ > > bool written_flag; /* Indicates eMMC has been written since power on */ > bool reenable_cmdq; /* Re-enable Command Queue */ > -- > 2.34.1