# Re: \[PATCH v1 06/47\] mtrr: add \_\_arch\_phys\_wc\_add()

- From: Andy Lutomirski \<luto@amacapital.net\>
- Date: 2015-03-20 23:49:11 
- List: linux-fbdev
- Page: https://ratatoskr.run/linux-fbdev/2015/03/4456159
- Thread: https://ratatoskr.run/linux-fbdev/2015/03/4456096/t.md

```text
On Fri, Mar 20, 2015 at 4:17 PM, Luis R. Rodriguez
[ref] wrote:
> From: "Luis R. Rodriguez" <redacted>
>
> Ideally on systems using PAT we can expect a swift
> transition away from MTRR. There can be a few exceptions
> to this, one is where device drivers are known to exist
> on PATs with errata, another situation is observed on
> old device drivers where devices had combined MMIO
> register access with whatever area they typically
> later wanted to end up using MTRR for on the same
> PCI BAR. This situation can still be addressed by
> splitting up ioremap'd PCI BAR into two ioremap'd
> calls, one for MMIO registers, and another for whatever
> is desirable for write-combining -- in order to
> accomplish this though quite a bit of driver
> restructuring is required.
>
> Device drivers which are known to require large
> amount of re-work in order to split ioremap'd areas
> can use __arch_phys_wc_add() to avoid regressions
> when PAT is enabled.
>
> For a good example driver where things are neatly
> split up on a PCI BAR refer the infiniband qib
> driver. For a good example of a driver where good
> amount of work is required refer to the infiniband
> ipath driver.
>
> This is *only* a transitive API -- and as such no new
> drivers are ever expected to use this.

What's the exact layout that this helps?  I'm sceptical that this can
ever be correct.

Is there some awful driver that has a large ioremap that's supposed to
contain multiple different memtypes?  If so, can we ioremap +
set_page_xyz instead?

--Andy
```
