All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ulf Hansson <ulf.hansson@linaro.org>
To: Jiri Slaby <jslaby@suse.cz>
Cc: Linus <torvalds@linux-foundation.org>,
	"linux-mmc@vger.kernel.org" <linux-mmc@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Jaehoon Chung <jh80.chung@samsung.com>,
	Adrian Hunter <adrian.hunter@intel.com>,
	Linus Walleij <linus.walleij@linaro.org>,
	Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>,
	Geert Uytterhoeven <geert+renesas@glider.be>,
	Konrad Rzeszutek Wilk <konrad@kernel.org>
Subject: Re: sdhci broke in 4.14 [was: MMC fixes for v.4.14-rc4]
Date: Fri, 24 Nov 2017 16:20:24 +0100	[thread overview]
Message-ID: <CAPDyKFqbE63_L_FV1YenjPcis=vpSZ5vBximjF6voAyFbe864w@mail.gmail.com> (raw)
In-Reply-To: <1861ba33-1d08-ef18-8208-174942be5395@suse.cz>

On 24 November 2017 at 16:15, Jiri Slaby <jslaby@suse.cz> wrote:
> On 11/21/2017, 04:08 PM, Ulf Hansson wrote:
>> Subject: [PATCH] mmc: sdhci: Fix bounce buffer overflow
> ...
>> --- a/drivers/mmc/host/sdhci.c
>> +++ b/drivers/mmc/host/sdhci.c
> ...
>> @@ -3651,22 +3652,29 @@ int sdhci_setup_host(struct sdhci_host *host)
>>         spin_lock_init(&host->lock);
>>
>>         /*
>> +        * Maximum number of sectors in one transfer. Limited by SDMA boundary
>> +        * size (512KiB). Note some tuning modes impose a 4MiB limit, but this
>> +        * is less anyway.
>> +        */
>> +       mmc->max_req_size = 524288;
>> +
>> +       /*
>>          * Maximum number of segments. Depends on if the hardware
>>          * can do scatter/gather or not.
>>          */
>> -       if (host->flags & SDHCI_USE_ADMA)
>> +       if (host->flags & SDHCI_USE_ADMA) {
>>                 mmc->max_segs = SDHCI_MAX_SEGS;
>> -       else if (host->flags & SDHCI_USE_SDMA)
>> +       } else if (host->flags & SDHCI_USE_SDMA) {
>>                 mmc->max_segs = 1;
>> -       else /* PIO */
>> +               if (swiotlb_max_segment()) {
>> +                       unsigned int max_req_size = (1 << IO_TLB_SHIFT) *
>> +                                               IO_TLB_SEGSIZE;
>> +                       mmc->max_req_size = min(mmc->max_req_size,
>> +                                               max_req_size);
>> +               }
>> +       } else { /* PIO */
>>                 mmc->max_segs = SDHCI_MAX_SEGS;
>
> It seems to work fine. FWIW the debug output is:
> [    0.708312] mmc0: max_segs=1 max_req_size=262144 h->flags=00004001

Thanks for testing!

I post a proper formatted patch very soon.

Kind regards
Uffe

      reply	other threads:[~2017-11-24 15:20 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-07  7:33 [GIT PULL] MMC fixes for v.4.14-rc4 Ulf Hansson
2017-11-20 13:12 ` sdhci broke in 4.14 [was: MMC fixes for v.4.14-rc4] Jiri Slaby
2017-11-21 15:08   ` Ulf Hansson
2017-11-21 15:13     ` Jiri Slaby
2017-11-21 16:13       ` Ulf Hansson
2017-11-24 15:15     ` Jiri Slaby
2017-11-24 15:20       ` Ulf Hansson [this message]

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='CAPDyKFqbE63_L_FV1YenjPcis=vpSZ5vBximjF6voAyFbe864w@mail.gmail.com' \
    --to=ulf.hansson@linaro.org \
    --cc=adrian.hunter@intel.com \
    --cc=geert+renesas@glider.be \
    --cc=jh80.chung@samsung.com \
    --cc=jslaby@suse.cz \
    --cc=konrad@kernel.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=torvalds@linux-foundation.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.