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

From: Andy Shevchenko
Date: Mon Oct 07 2019 - 08:05:23 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?

Tuowen,

since Luis didn't respond, I think we may proceed with v2 after addressing
Mika's comments.

--
With Best Regards,
Andy Shevchenko