From: "Jorge Ramirez-Ortiz, Foundries" <jorge@foundries.io>
To: Adrian Hunter <adrian.hunter@intel.com>
Cc: "Jorge Ramirez-Ortiz, Foundries" <jorge@foundries.io>,
Avri Altman <Avri.Altman@wdc.com>,
"ulf.hansson@linaro.org" <ulf.hansson@linaro.org>,
michal.simek@amd.com, neal.frager@amd.com,
sai.krishna.potthuri@amd.com,
"linux-mmc@vger.kernel.org" <linux-mmc@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] mmc: rpmb: do not force a retune before RPMB switch
Date: Fri, 5 Jan 2024 09:49:48 +0100 [thread overview]
Message-ID: <ZZfCrLr5isWF/bwN@trux> (raw)
In-Reply-To: <29dc26a4-b95c-42d5-94f8-fbd23c589eaa@intel.com>
On 04/01/24 20:34:09, Adrian Hunter wrote:
> On 3/01/24 11:20, Jorge Ramirez-Ortiz, Foundries wrote:
> > On 03/01/24 10:03:38, Adrian Hunter wrote:
> >> Thanks for doing that! That seems to explain the mystery.
> >>
> >> You could hack the test to get an idea of how many successful
> >> iterations there are before getting an error.
> >>
> >> For SDHCI, one difference between tuning and re-tuning is the
> >> setting of bit-7 "Sampling Clock Select" of "Host Control 2 Register".
> >> It is initially 0 and then set to 1 after the successful tuning.
> >> Essentially, leaving it set to 1 is meant to speed up the re-tuning.
> >> You could try setting it to zero instead, and see if that helps.
> >> e.g.
> >>
> >> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
> >> index c79f73459915..714d8cc39709 100644
> >> --- a/drivers/mmc/host/sdhci.c
> >> +++ b/drivers/mmc/host/sdhci.c
> >> @@ -2732,6 +2732,7 @@ void sdhci_start_tuning(struct sdhci_host *host)
> >> ctrl |= SDHCI_CTRL_EXEC_TUNING;
> >> if (host->quirks2 & SDHCI_QUIRK2_TUNING_WORK_AROUND)
> >> ctrl |= SDHCI_CTRL_TUNED_CLK;
> >> + ctrl &= ~SDHCI_CTRL_TUNED_CLK;
> >> sdhci_writew(host, ctrl, SDHCI_HOST_CONTROL2);
> >>
> >> /*
> >>
> >
> >
> > Yes with that change, the re-tuning reliability test does pass.
> >
> > root@uz3cg-dwg-sec:/sys/kernel/debug/mmc0# echo 52 > /sys/kernel/debug/mmc0/mmc0\:0001/test
> > [ 237.833585] mmc0: Starting tests of card mmc0:0001...
> > [ 237.838759] mmc0: Test case 52. Re-tuning reliability...
> > [ 267.845403] mmc0: Result: OK
> > [ 267.848365] mmc0: Tests completed.
> >
> >
> > Unfortunately I still see the error when looping on RPMB reads.
> >
> > For instance with this test script
> > $ while true; do rpmb_read m4hash; usleep 300; done
> >
> > I can see the error triggering on the serial port after a minute or so.
> > [ 151.682907] sdhci-arasan ff160000.mmc: __mmc_blk_ioctl_cmd: data error -84
> >
> > Causing OP-TEE to panic since the RPMB read returns an error
> > E/TC:? 0
> > E/TC:? 0 TA panicked with code 0xffff0000
> > E/LD: Status of TA 22250a54-0bf1-48fe-8002-7b20f1c9c9b1
> > E/LD: arch: aarch64
> > [...]
> >
> > if anything else springs to your mind I am happy to test of course - there are
> > so many tunnables in this subsystem that experience is this area has exponential
> > value (and I dont have much).
> >
> > Would it make sense if re-tuning requests are rejected unless a minimum number
> > of jiffies have passed? should I try that as a change?
> >
> > or maybe delay a bit longer the RPMB access after a retune request?
>
> It seems re-tuning is not working properly, so ideally the
> SoC vendor / driver implementer would provide a solution.
Makes sense to me too. I am copying Michal on the DL.
>
> There is also mmc_doing_retune() which could be used to skip
> tuning execution entirely in the case of re-tuning.
>
next prev parent reply other threads:[~2024-01-05 8:49 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-04 15:01 [PATCH] mmc: rpmb: do not force a retune before RPMB switch Jorge Ramirez-Ortiz
2023-12-04 16:22 ` Avri Altman
2023-12-04 17:58 ` Avri Altman
2023-12-04 18:14 ` Jorge Ramirez-Ortiz, Foundries
2023-12-05 16:10 ` Jorge Ramirez-Ortiz, Foundries
2023-12-05 20:12 ` Adrian Hunter
2023-12-05 20:14 ` Adrian Hunter
2023-12-06 7:02 ` Avri Altman
2023-12-06 10:00 ` Jorge Ramirez-Ortiz, Foundries
2023-12-11 8:00 ` Jorge Ramirez-Ortiz, Foundries
2023-12-11 10:25 ` Adrian Hunter
2023-12-11 11:06 ` Jorge Ramirez-Ortiz, Foundries
2023-12-11 11:32 ` Adrian Hunter
2023-12-11 15:05 ` Jorge Ramirez-Ortiz, Foundries
2023-12-14 9:15 ` Adrian Hunter
2023-12-14 11:16 ` Jorge Ramirez-Ortiz, Foundries
2024-01-02 10:41 ` Jorge Ramirez-Ortiz, Foundries
2024-01-02 19:01 ` Adrian Hunter
2024-01-02 22:01 ` Jorge Ramirez-Ortiz, Foundries
2024-01-03 8:03 ` Adrian Hunter
2024-01-03 9:20 ` Jorge Ramirez-Ortiz, Foundries
2024-01-04 18:34 ` Adrian Hunter
2024-01-05 8:49 ` Jorge Ramirez-Ortiz, Foundries [this message]
2024-01-05 13:00 ` Michal Simek
2023-12-11 8:03 ` Adrian Hunter
2024-01-02 19:02 ` Adrian Hunter
2024-01-03 8:08 ` Adrian Hunter
-- strict thread matches above, loose matches on Subject: below --
2023-12-04 17:22 Jorge Ramirez-Ortiz
2023-12-04 17:52 ` Christian Loehle
2023-12-04 18:10 ` Jorge Ramirez-Ortiz, Foundries
2023-12-11 16:17 ` Adrian Hunter
2023-12-11 16:55 Jorge Ramirez-Ortiz
2024-01-03 8:08 ` Adrian Hunter
2024-01-03 10:35 ` Ulf Hansson
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=ZZfCrLr5isWF/bwN@trux \
--to=jorge@foundries.io \
--cc=Avri.Altman@wdc.com \
--cc=adrian.hunter@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=michal.simek@amd.com \
--cc=neal.frager@amd.com \
--cc=sai.krishna.potthuri@amd.com \
--cc=ulf.hansson@linaro.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