iommu.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
From: Konrad Rzeszutek Wilk <konrad@kernel.org>
To: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>,
	Konrad Rzeszutek Wilk <konrad@darnok.org>,
	Linux-Renesas <linux-renesas-soc@vger.kernel.org>,
	Wolfram Sang <wsa+renesas@sang-engineering.com>,
	Ulf Hansson <ulf.hansson@linaro.org>,
	Linux MMC List <linux-mmc@vger.kernel.org>,
	"iommu@lists.linux-foundation.org"
	<iommu@lists.linux-foundation.org>
Subject: Re: [PATCH 1/2] mmc: renesas_sdhi: fix swiotlb buffer is full
Date: Wed, 1 Nov 2017 09:26:39 -0400	[thread overview]
Message-ID: <20171101132639.GA24821@x230.dumpdata.com> (raw)
In-Reply-To: <TY1PR06MB09929A4BF1E2A5DBD54845DED8430@TY1PR06MB0992.apcprd06.prod.outlook.com>

On Fri, Oct 20, 2017 at 03:18:55AM +0000, Yoshihiro Shimoda wrote:
> Hi again!
> 
> > From: Yoshihiro Shimoda, Sent: Thursday, October 19, 2017 8:39 PM
> > 
> > Hi Geert-san, Konrad-san,
> > 
> > > From: Geert Uytterhoeven, Sent: Thursday, October 19, 2017 5:34 PM
> > >
> > > Hi Konrad,
> > >
> > > On Thu, Oct 19, 2017 at 2:24 AM, Konrad Rzeszutek Wilk
> > > <konrad@darnok.org> wrote:
> < snip >
> > > >> > diff --git a/drivers/mmc/host/renesas_sdhi_internal_dmac.c b/drivers/mmc/host/renesas_sdhi_internal_dmac.c
> > > >> > index f905f23..6c9b4b2 100644
> > > >> > --- a/drivers/mmc/host/renesas_sdhi_internal_dmac.c
> > > >> > +++ b/drivers/mmc/host/renesas_sdhi_internal_dmac.c
> > > >> > @@ -80,8 +80,9 @@
> > > >> >         .scc_offset     = 0x1000,
> > > >> >         .taps           = rcar_gen3_scc_taps,
> > > >> >         .taps_num       = ARRAY_SIZE(rcar_gen3_scc_taps),
> > > >> > -       /* Gen3 SDHI DMAC can handle 0xffffffff blk count, but seg = 1 */
> > > >> > -       .max_blk_count  = 0xffffffff,
> > > >> > +       /* The swiotlb can handle memory size up to 256 kbytes for now. */
> > > >> > +       .max_blk_count  = 512,
> > > >>
> > > >> Fixing this in the individual drivers feels like the wrong solution to me.
> > > >>
> > > >> iommu: Is there a better (generic) way to handle this?
> > > >
> > > > Yes. See 7453c549f5f6485c0d79cad7844870dcc7d1b34d, aka swiotlb_max_segment
> > >
> > > Thanks for the pointer!
> > >
> > > While I agree this can be used to avoid the swiotlb buffer full issue,
> > > I believe it is a suboptimal solution if the device actually uses an IOMMU.
> > > It limits the mapping size if CONFIG_SWIOTLB=y, which is always the
> > > case for arm/arm64 these days.
> > 
> > I'm afraid but I misunderstood this API's spec when I read it at first.
> > After I tried to use it, I found the API cannot be used for a workaround because
> > this API returns total size of swiotlb.
> > 
> > For example:
> >  - The swiotlb_max_segment() returns 64M bytes from the API when a default setting.
> >   - In this case, the maximum size per a map is 256k bytes.
> >  - The swiotlb_max_segment() returns 128M bytes from the API when I added swiotlb=65536
> >    into the kernel parameter on arm64.
> >   - In this case, the maximum size per a map is still 256k bytes because
> >     the swiotlb has hardcoded the size by the following code:
> >      https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/lib/swiotlb.c?h=v4.14-rc5#n254
> > 
> > So, how do we handle to resolve (or avoid) the issue?
> 
> Anyway, I made v2 patches by using swiotlb related definitions. Would you check it?

Did I miss that email? As in was I cc-ed?

> https://patchwork.kernel.org/patch/10018879/

Why not use IO_TLB_SEGSIZE << IO_TLB_SHIFT or alternatively
swiotlb_max_segment?  See 5584f1b1d73e9

  reply	other threads:[~2017-11-01 13:26 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1508225421-25405-1-git-send-email-yoshihiro.shimoda.uh@renesas.com>
     [not found] ` <1508225421-25405-2-git-send-email-yoshihiro.shimoda.uh@renesas.com>
     [not found]   ` <1508225421-25405-2-git-send-email-yoshihiro.shimoda.uh-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>
2017-10-17  8:02     ` [PATCH 1/2] mmc: renesas_sdhi: fix swiotlb buffer is full Geert Uytterhoeven
     [not found]       ` <CAMuHMdXyY-gvQGn2UxhUDsdhdWUMmTA80z73PF14otvcKuTMaw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-10-19  0:24         ` Konrad Rzeszutek Wilk
     [not found]           ` <20171019002412.GA14493-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2017-10-19  8:34             ` Geert Uytterhoeven
2017-10-19 11:39               ` Yoshihiro Shimoda
2017-10-20  3:18                 ` Yoshihiro Shimoda
2017-11-01 13:26                   ` Konrad Rzeszutek Wilk [this message]
     [not found]                     ` <20171101132639.GA24821-sHAKZZqAc8NKMcnDSFYBzAC/G2K4zDHf@public.gmane.org>
2017-11-02  4:10                       ` Yoshihiro Shimoda
2017-11-03 13:23                         ` Konrad Rzeszutek Wilk
     [not found]                           ` <20171103132322.GA19352-sHAKZZqAc8NKMcnDSFYBzAC/G2K4zDHf@public.gmane.org>
2017-11-03 14:01                             ` Geert Uytterhoeven
     [not found]                               ` <CAMuHMdWxWu-6Hi+4P2GhEyjfu=mhbNUUOoBUC7JrsL=ki35c5w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-11-03 14:17                                 ` Konrad Rzeszutek Wilk

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=20171101132639.GA24821@x230.dumpdata.com \
    --to=konrad@kernel.org \
    --cc=geert@linux-m68k.org \
    --cc=iommu@lists.linux-foundation.org \
    --cc=konrad@darnok.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=ulf.hansson@linaro.org \
    --cc=wsa+renesas@sang-engineering.com \
    --cc=yoshihiro.shimoda.uh@renesas.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).