Re: [PATCH] mfd: intel-lpss: use devm_ioremap_uc for mmio

From: Luis Chamberlain
Date: Tue Oct 08 2019 - 07:18:20 EST


On Mon, Sep 30, 2019 at 02:05:22PM +0300, Andy Shevchenko wrote:
> On Fri, Sep 27, 2019 at 11:55:13AM -0600, Tuowen Zhao wrote:
> > Write-combining BAR for intel-lpss-pci in MTRR causes system hangs
> > during boot.
> >
> > This patch adds devm_ioremap_uc as a new managed wrapper to ioremap_uc
> > and with it forces the use of strongly uncachable mmio in intel-lpss.
> >
> > This bahavior is seen on Dell XPS 13 7390 2-in-1:
> >
> > [ 0.001734] 5 base 4000000000 mask 6000000000 write-combining
> >
> > 4000000000-7fffffffff : PCI Bus 0000:00
> > 4000000000-400fffffff : 0000:00:02.0 (i915)
> > 4010000000-4010000fff : 0000:00:15.0 (intel-lpss-pci)
>
> +Cc: Luis as author of UC flavour of ioremap.
>
> Luis, some BIOSes in the wild have wrong MTRR setting for PCI resource window
> and thus when Linux tries to allocate 64-bit MMIO address space (and in
> opposite to Windows, which does this from the end of available space towards
> beginning, Linux do this from the beginning towards end). Ideally we have to
> push vendors to fix firmware.
>
> This patch AFAIU overrides MTTR/PAT settings for those pages and makes it
> possible to workaround firmware bug.
>
> What do you think is the best approach here?

Indeed, such cases can come up, and yes _uc can be a workaround for such
cases.

> > +EXPORT_SYMBOL(devm_ioremap_uc);

EXPORT_SYMBOL_GPL() would be my preference. But other than that, this
makes sense.

Luis