stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Boris Brezillon <boris.brezillon@bootlin.com>
To: Miquel Raynal <miquel.raynal@bootlin.com>
Cc: Richard Weinberger <richard@nod.at>,
	David Woodhouse <dwmw2@infradead.org>,
	Brian Norris <computersforpeace@gmail.com>,
	Marek Vasut <marek.vasut@gmail.com>,
	linux-mtd@lists.infradead.org, daniel@zonque.org,
	Chris.Packham@alliedtelesis.co.nz, stable@vger.kernel.org
Subject: Re: [PATCH] mtd: rawnand: marvell: fix the IRQ handler complete() condition
Date: Wed, 3 Oct 2018 14:15:08 +0200	[thread overview]
Message-ID: <20181003141508.0dfdea36@bbrezillon> (raw)
In-Reply-To: <20181003090504.19910-1-miquel.raynal@bootlin.com>

On Wed,  3 Oct 2018 11:05:04 +0200
Miquel Raynal <miquel.raynal@bootlin.com> wrote:

> With the current implementation, the complete() in the IRQ handler is
> supposed to be called only if the register status has one or the other
> RDY bit set. Other events might trigger an interrupt as well if
> enabled, but should not end-up with a complete() call.
> 
> For this purpose, the code was checking if the other bits were set, in
> this case complete() was not called. This is wrong as two events might
> happen in a very tight time-frame and if the NDSR status read reports
> two bits set (eg. RDY(0) and RDDREQ) at the same time, complete() was
> not called.
> 
> This logic would lead to timeouts in marvell_nfc_wait_op() and has
> been observed on PXA boards (NFCv1) in the Hamming write path.
> 
> Fixes: 02f26ecf8c77 ("mtd: nand: add reworked Marvell NAND controller driver")
> Cc: stable@vger.kernel.org
> Reported-by: Daniel Mack <daniel@zonque.org>
> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
> Tested-by: Daniel Mack <daniel@zonque.org>

Reviewed-by: Boris Brezillon <boris.brezillon@bootlin.com>

> ---
>  drivers/mtd/nand/raw/marvell_nand.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/mtd/nand/raw/marvell_nand.c b/drivers/mtd/nand/raw/marvell_nand.c
> index bc2ef5209783..c7573ccdbacd 100644
> --- a/drivers/mtd/nand/raw/marvell_nand.c
> +++ b/drivers/mtd/nand/raw/marvell_nand.c
> @@ -686,7 +686,7 @@ static irqreturn_t marvell_nfc_isr(int irq, void *dev_id)
>  
>  	marvell_nfc_disable_int(nfc, st & NDCR_ALL_INT);
>  
> -	if (!(st & (NDSR_RDDREQ | NDSR_WRDREQ | NDSR_WRCMDREQ)))
> +	if (st & (NDSR_RDY(0) | NDSR_RDY(1)))
>  		complete(&nfc->complete);
>  
>  	return IRQ_HANDLED;

  reply	other threads:[~2018-10-03 19:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-03  9:05 [PATCH] mtd: rawnand: marvell: fix the IRQ handler complete() condition Miquel Raynal
2018-10-03 12:15 ` Boris Brezillon [this message]
2018-10-05 14:39 ` Miquel Raynal

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=20181003141508.0dfdea36@bbrezillon \
    --to=boris.brezillon@bootlin.com \
    --cc=Chris.Packham@alliedtelesis.co.nz \
    --cc=computersforpeace@gmail.com \
    --cc=daniel@zonque.org \
    --cc=dwmw2@infradead.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=marek.vasut@gmail.com \
    --cc=miquel.raynal@bootlin.com \
    --cc=richard@nod.at \
    --cc=stable@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).