linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Boris Brezillon <boris.brezillon@collabora.com>
To: Kamal Dasu <kdasu.kdev@gmail.com>
Cc: Brian Norris <computersforpeace@gmail.com>,
	Miquel Raynal <miquel.raynal@bootlin.com>,
	Richard Weinberger <richard@nod.at>,
	David Woodhouse <dwmw2@infradead.org>,
	Marek Vasut <marek.vasut@gmail.com>,
	Vignesh Raghavendra <vigneshr@ti.com>,
	Boris Brezillon <bbrezillon@kernel.org>,
	Frieder Schrempf <frieder.schrempf@kontron.de>,
	MTD Maling List <linux-mtd@lists.infradead.org>,
	bcm-kernel-feedback-list@broadcom.com,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2/2] mtd: rawnand: use bounce buffer when vmalloced data buf detected
Date: Mon, 30 Sep 2019 18:24:58 +0200	[thread overview]
Message-ID: <20190930182458.761e8077@collabora.com> (raw)
In-Reply-To: <CAC=U0a1qvKO+t_62df_JcQBETAuNq0pwRkAb-Ofi3ski2rfdEQ@mail.gmail.com>

On Mon, 30 Sep 2019 12:01:28 -0400
Kamal Dasu <kdasu.kdev@gmail.com> wrote:

> Does anyone have any comments on this patch ?.
> 
> Kamal
> 
> On Fri, Sep 6, 2019 at 3:49 PM Kamal Dasu <kdasu.kdev@gmail.com> wrote:
> >
> > For controller drivers that use DMA and set NAND_USE_BOUNCE_BUFFER
> > option use data buffers that are not vmalloced, aligned and have
> > valid virtual address to be able to do DMA transfers. This change
> > adds additional check and makes use of data buffer allocated
> > in nand_base driver when it is passed a vmalloced data buffer for
> > DMA transfers.
> >
> > Signed-off-by: Kamal Dasu <kdasu.kdev@gmail.com>
> > ---
> >  drivers/mtd/nand/raw/nand_base.c | 14 ++++++++------
> >  1 file changed, 8 insertions(+), 6 deletions(-)
> >
> > diff --git a/drivers/mtd/nand/raw/nand_base.c b/drivers/mtd/nand/raw/nand_base.c
> > index 91f046d4d452..46f6965a896a 100644
> > --- a/drivers/mtd/nand/raw/nand_base.c
> > +++ b/drivers/mtd/nand/raw/nand_base.c
> > @@ -45,6 +45,12 @@
> >
> >  #include "internals.h"
> >
> > +static int nand_need_bounce_buf(const void *buf, struct nand_chip *chip)
> > +{
> > +       return !virt_addr_valid(buf) || is_vmalloc_addr(buf) ||

I thought virt_addr_valid() was implying !is_vmalloc_addr(), are you
sure you need that test, and can you tell me on which arch(es) this is
needed.

> > +               !IS_ALIGNED((unsigned long)buf, chip->buf_align);
> > +}
> > +
> >  /* Define default oob placement schemes for large and small page devices */
> >  static int nand_ooblayout_ecc_sp(struct mtd_info *mtd, int section,
> >                                  struct mtd_oob_region *oobregion)
> > @@ -3183,9 +3189,7 @@ static int nand_do_read_ops(struct nand_chip *chip, loff_t from,
> >                 if (!aligned)
> >                         use_bufpoi = 1;
> >                 else if (chip->options & NAND_USE_BOUNCE_BUFFER)
> > -                       use_bufpoi = !virt_addr_valid(buf) ||
> > -                                    !IS_ALIGNED((unsigned long)buf,
> > -                                                chip->buf_align);
> > +                       use_bufpoi = nand_need_bounce_buf(buf, chip);
> >                 else
> >                         use_bufpoi = 0;
> >
> > @@ -4009,9 +4013,7 @@ static int nand_do_write_ops(struct nand_chip *chip, loff_t to,
> >                 if (part_pagewr)
> >                         use_bufpoi = 1;
> >                 else if (chip->options & NAND_USE_BOUNCE_BUFFER)
> > -                       use_bufpoi = !virt_addr_valid(buf) ||
> > -                                    !IS_ALIGNED((unsigned long)buf,
> > -                                                chip->buf_align);
> > +                       use_bufpoi = nand_need_bounce_buf(buf, chip);
> >                 else
> >                         use_bufpoi = 0;
> >
> > --
> > 2.17.1
> >  


  reply	other threads:[~2019-09-30 16:25 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-06 19:47 [PATCH 1/2] mtd: nand: brcmnand: Add support for flash-dma v0 Kamal Dasu
2019-09-06 19:47 ` [PATCH 2/2] mtd: rawnand: use bounce buffer when vmalloced data buf detected Kamal Dasu
2019-09-30 16:01   ` Kamal Dasu
2019-09-30 16:24     ` Boris Brezillon [this message]
2019-09-30 16:33       ` Kamal Dasu
2019-09-30 19:39         ` Richard Weinberger
2019-10-01 17:07           ` Kamal Dasu
2019-10-04 16:04 ` [PATCH 1/2] mtd: nand: brcmnand: Add support for flash-dma v0 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=20190930182458.761e8077@collabora.com \
    --to=boris.brezillon@collabora.com \
    --cc=bbrezillon@kernel.org \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=computersforpeace@gmail.com \
    --cc=dwmw2@infradead.org \
    --cc=frieder.schrempf@kontron.de \
    --cc=kdasu.kdev@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=marek.vasut@gmail.com \
    --cc=miquel.raynal@bootlin.com \
    --cc=richard@nod.at \
    --cc=vigneshr@ti.com \
    /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).