mirror of
https://github.com/torvalds/linux
synced 2024-11-05 18:23:50 +00:00
775a8a564d
The same area used for MTRR is used for the ioremap() 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: 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: linux-fbdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
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: linux-fbdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Luis R. Rodriguez <mcgrof@suse.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
69 lines
2.1 KiB
C
69 lines
2.1 KiB
C
/*-*- linux-c -*-
|
|
* linux/drivers/video/i810fb_main.h -- Intel 810 frame buffer device
|
|
* main header file
|
|
*
|
|
* Copyright (C) 2001 Antonino Daplas<adaplas@pol.net>
|
|
* All Rights Reserved
|
|
*
|
|
*
|
|
* This file is subject to the terms and conditions of the GNU General Public
|
|
* License. See the file COPYING in the main directory of this archive for
|
|
* more details.
|
|
*/
|
|
|
|
#ifndef __I810_MAIN_H__
|
|
#define __I810_MAIN_H__
|
|
|
|
/* Video Timings */
|
|
extern void round_off_xres (u32 *xres);
|
|
extern void round_off_yres (u32 *xres, u32 *yres);
|
|
extern u32 i810_get_watermark (const struct fb_var_screeninfo *var,
|
|
struct i810fb_par *par);
|
|
extern void i810fb_encode_registers(const struct fb_var_screeninfo *var,
|
|
struct i810fb_par *par, u32 xres, u32 yres);
|
|
extern void i810fb_fill_var_timings(struct fb_var_screeninfo *var);
|
|
|
|
/* Accelerated Functions */
|
|
extern void i810fb_fillrect (struct fb_info *p,
|
|
const struct fb_fillrect *rect);
|
|
extern void i810fb_copyarea (struct fb_info *p,
|
|
const struct fb_copyarea *region);
|
|
extern void i810fb_imageblit(struct fb_info *p, const struct fb_image *image);
|
|
extern int i810fb_sync (struct fb_info *p);
|
|
|
|
extern void i810fb_init_ringbuffer(struct fb_info *info);
|
|
extern void i810fb_load_front (u32 offset, struct fb_info *info);
|
|
|
|
#ifdef CONFIG_FB_I810_I2C
|
|
/* I2C */
|
|
extern int i810_probe_i2c_connector(struct fb_info *info, u8 **out_edid,
|
|
int conn);
|
|
extern void i810_create_i2c_busses(struct i810fb_par *par);
|
|
extern void i810_delete_i2c_busses(struct i810fb_par *par);
|
|
#else
|
|
static inline int i810_probe_i2c_connector(struct fb_info *info, u8 **out_edid,
|
|
int conn)
|
|
{
|
|
return 1;
|
|
}
|
|
static inline void i810_create_i2c_busses(struct i810fb_par *par) { }
|
|
static inline void i810_delete_i2c_busses(struct i810fb_par *par) { }
|
|
#endif
|
|
|
|
/* Conditionals */
|
|
#ifdef CONFIG_X86
|
|
static inline void flush_cache(void)
|
|
{
|
|
asm volatile ("wbinvd":::"memory");
|
|
}
|
|
#else
|
|
#define flush_cache() do { } while(0)
|
|
#endif
|
|
|
|
#ifdef CONFIG_FB_I810_GTF
|
|
#define IS_DVT (0)
|
|
#else
|
|
#define IS_DVT (1)
|
|
#endif
|
|
|
|
#endif /* __I810_MAIN_H__ */
|