From: <Ludovic.Desroches@microchip.com>
To: <t.schramm@manjaro.org>
Cc: <ulf.hansson@linaro.org>, <Nicolas.Ferre@microchip.com>,
<alexandre.belloni@bootlin.com>, <Claudiu.Beznea@microchip.com>,
<linux-mmc@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/1] mmc: atmel-mci: fix race between stop command and start of next command
Date: Thu, 26 Jan 2023 14:43:59 +0000 [thread overview]
Message-ID: <54b0dcc0-5083-3ee9-6536-e58b8c01e96c@microchip.com> (raw)
In-Reply-To: <20221230194315.809903-2-t.schramm@manjaro.org>
On 30/12/2022 20:43, Tobias Schramm wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
>
> This commit fixes a race between completion of stop command and start of a
> new command.
> Previously the command ready interrupt was enabled before stop command
> was written to the command register. This caused the command ready
> interrupt to fire immediately since the CMDRDY flag is asserted constantly
> while there is no command in progress.
> Consequently the command state machine will immediately advance to the
> next state when the tasklet function is executed again, no matter
> actual completion state of the stop command.
> Thus a new command can then be dispatched immediately, interrupting and
> corrupting the stop command on the CMD line.
> Fix that by dropping the command ready interrupt enable before calling
> atmci_send_stop_cmd. atmci_send_stop_cmd does already enable the
> command ready interrupt, no further writes to ATMCI_IER are necessary.
>
> Signed-off-by: Tobias Schramm <t.schramm@manjaro.org>
Hi,
In theory this changes make sense. I'm always afraid when something is
changed in this driver which handles many version of the IP...
As we never encountered this issue until now, I can't really test this
fix. I checked on an old board at91sam9m10g45-ek that mmc is still
working and it's okay.
So
Acked-by: Ludovic Desroches <ludovic.desroches@microchip.com>
Regards,
Ludovic
> ---
> drivers/mmc/host/atmel-mci.c | 3 ---
> 1 file changed, 3 deletions(-)
>
> diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c
> index bb9bbf1c927b..dd18440a90c5 100644
> --- a/drivers/mmc/host/atmel-mci.c
> +++ b/drivers/mmc/host/atmel-mci.c
> @@ -1817,7 +1817,6 @@ static void atmci_tasklet_func(struct tasklet_struct *t)
> atmci_writel(host, ATMCI_IER, ATMCI_NOTBUSY);
> state = STATE_WAITING_NOTBUSY;
> } else if (host->mrq->stop) {
> - atmci_writel(host, ATMCI_IER, ATMCI_CMDRDY);
> atmci_send_stop_cmd(host, data);
> state = STATE_SENDING_STOP;
> } else {
> @@ -1850,8 +1849,6 @@ static void atmci_tasklet_func(struct tasklet_struct *t)
> * command to send.
> */
> if (host->mrq->stop) {
> - atmci_writel(host, ATMCI_IER,
> - ATMCI_CMDRDY);
> atmci_send_stop_cmd(host, data);
> state = STATE_SENDING_STOP;
> } else {
> --
> 2.30.2
>
next prev parent reply other threads:[~2023-01-26 14:44 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-30 19:43 [PATCH 0/1] Fix race between stop command and start of next command in atmel-mci Tobias Schramm
2022-12-30 19:43 ` [PATCH 1/1] mmc: atmel-mci: fix race between stop command and start of next command Tobias Schramm
2023-01-24 10:45 ` Ulf Hansson
2023-01-26 14:43 ` Ludovic.Desroches [this message]
2023-01-27 10:57 ` 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=54b0dcc0-5083-3ee9-6536-e58b8c01e96c@microchip.com \
--to=ludovic.desroches@microchip.com \
--cc=Claudiu.Beznea@microchip.com \
--cc=Nicolas.Ferre@microchip.com \
--cc=alexandre.belloni@bootlin.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=t.schramm@manjaro.org \
--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
Powered by JetHome