WSL2-Linux-Kernel/drivers/staging
Luis R. Rodriguez 3fb0767172 staging: xgifb: use arch_phys_wc_add() and ioremap_wc()
The same area used for ioremap() is used for the MTRR area.
Convert the driver from using the x86 specific MTRR code to
the architecture agnostic arch_phys_wc_add(). arch_phys_wc_add()
will avoid MTRR if write-combining is available, in order to
take advantage of that also ensure the ioremap'd area is requested
as write-combining.

There are a few motivations for this:

a) Take advantage of PAT when available

b) Help bury MTRR code away, MTRR is architecture specific and on
   x86 its replaced by PAT

c) Help with the goal of eventually using _PAGE_CACHE_UC over
   _PAGE_CACHE_UC_MINUS on x86 on ioremap_nocache() (see commit
   de33c442e titled "x86 PAT: fix performance drop for glx,
   use UC minus for ioremap(), ioremap_nocache() and
   pci_mmap_page_range()")

The conversion done is expressed by the following Coccinelle
SmPL patch, it additionally required manual intervention to
address all the #ifdery and removal of redundant things which
arch_phys_wc_add() already addresses such as verbose message
about when MTRR fails and doing nothing when we didn't get
an MTRR.

@ mtrr_found @
expression index, base, size;
@@

-index = mtrr_add(base, size, MTRR_TYPE_WRCOMB, 1);
+index = arch_phys_wc_add(base, size);

@ mtrr_rm depends on mtrr_found @
expression mtrr_found.index, mtrr_found.base, mtrr_found.size;
@@

-mtrr_del(index, base, size);
+arch_phys_wc_del(index);

@ mtrr_rm_zero_arg depends on mtrr_found @
expression mtrr_found.index;
@@

-mtrr_del(index, 0, 0);
+arch_phys_wc_del(index);

@ mtrr_rm_fb_info depends on mtrr_found @
struct fb_info *info;
expression mtrr_found.index;
@@

-mtrr_del(index, info->fix.smem_start, info->fix.smem_len);
+arch_phys_wc_del(index);

@ ioremap_replace_nocache depends on mtrr_found @
struct fb_info *info;
expression base, size;
@@

-info->screen_base = ioremap_nocache(base, size);
+info->screen_base = ioremap_wc(base, size);

@ ioremap_replace_default depends on mtrr_found @
struct fb_info *info;
expression base, size;
@@

-info->screen_base = ioremap(base, size);
+info->screen_base = ioremap_wc(base, size);

Generated-by: Coccinelle SmPL
Cc: Arnaud Patard <arnaud.patard@rtp-net.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Aaro Koskinen <aaro.koskinen@iki.fi>
Cc: Brian Vandre <bvandre@gmail.com>
Cc: Thomas Gummerer <t.gummerer@gmail.com>
Cc: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
Cc: Lubomir Rintel <lkundrak@v3.sk>
Cc: Vitor Braga <vitorpybraga@gmail.com>
Cc: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
Cc: Suresh Siddha <sbsiddha@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Juergen Gross <jgross@suse.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Dave Airlie <airlied@redhat.com>
Cc: Antonino Daplas <adaplas@gmail.com>
Cc: Jean-Christophe Plagniol-Villard <plagnioj@jcrosoft.com>
Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
Cc: devel@driverdev.osuosl.org
Cc: linux-fbdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Luis R. Rodriguez <mcgrof@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-05-31 10:30:40 +09:00
..
android Staging:Android:ion - Fix for memory leak if ion device registration get failed. 2015-05-24 13:27:13 -07:00
board
clocking-wizard
comedi staging: comedi/drivers/pcl.* coding style fixes 2015-05-31 10:07:18 +09:00
dgap staging: dgap: remove unused code 2015-05-10 15:17:50 +02:00
dgnc staging: dgnc: delete all references to 'flipbuf' 2015-05-31 10:26:27 +09:00
emxx_udc
fbtft
fsl-mc
ft1000
fwserial
gdm72xx
gdm724x staging: gdm724x: Correction of variable usage after applying ALIGN() 2015-05-10 15:23:02 +02:00
goldfish
gs_fpgaboot
iio Staging: iio: Allow compile test of GPIO consumers if !GPIOLIB 2015-05-10 20:31:43 +01:00
lustre staging: lustre: remove unused variable warning 2015-05-31 09:42:27 +09:00
media Merge 4.1-rc4 into staging-next 2015-05-18 13:52:44 -07:00
mt29f_spinand
netlogic
nvec
octeon
octeon-usb
olpc_dcon
ozwpan
panel staging: panel: fix stackdump 2015-05-24 13:35:25 -07:00
rtl8188eu
rtl8192e staging: rtl8192e: Change cpu_to_le16 to le16_to_cpu 2015-05-10 15:00:41 +02:00
rtl8192u
rtl8712 Merge 4.1-rc4 into staging-next 2015-05-18 13:52:44 -07:00
rtl8723au staging: rtl8723au: remove useless comment 2015-05-31 09:22:45 +09:00
rts5208
skein Drivers: staging: skein: skein_api: Fixed spelling errors 2015-05-31 10:30:40 +09:00
slicoss staging: slicoss: fix occasionally writing out only half of a dma address 2015-05-13 16:13:24 -07:00
sm7xxfb
sm750fb staging: sm750: Fix lynxfb_ops_imageblit() if image->depth != 1 2015-05-24 13:34:49 -07:00
speakup
ste_rmi4
unisys staging: unisys: cleanup UNISYS_VISORUTIL 2015-05-24 13:32:15 -07:00
vme
vt6655 Merge 4.1-rc4 into staging-next 2015-05-18 13:52:44 -07:00
vt6656
wilc1000 staging: wilc1000: off by one in wilc_wfi_cfg80211_mgmt_types 2015-05-31 09:00:15 +09:00
wlan-ng staging: wlan-ng: fix checkpatch warnings 2015-05-31 10:01:51 +09:00
xgifb staging: xgifb: use arch_phys_wc_add() and ioremap_wc() 2015-05-31 10:30:40 +09:00
Kconfig staging: wilc1000: Add SDIO/SPI 802.11 driver 2015-05-24 13:36:53 -07:00
Makefile staging: wilc1000: Add SDIO/SPI 802.11 driver 2015-05-24 13:36:53 -07:00
staging.c