From: "Luis R. Rodriguez" <mcgrof@do-not-panic.com>
To: luto@amacapital.net, mingo@redhat.com, tglx@linutronix.de,
hpa@zytor.com, jgross@suse.com, JBeulich@suse.com, bp@suse.de,
suresh.b.siddha@intel.com, venkatesh.pallipadi@intel.com,
airlied@redhat.com
Cc: linux-kernel@vger.kernel.org, linux-fbdev@vger.kernel.org,
x86@kernel.org, xen-devel@lists.xenproject.org,
"Luis R. Rodriguez" <mcgrof@suse.com>,
Ingo Molnar <mingo@elte.hu>,
Daniel Vetter <daniel.vetter@ffwll.ch>,
Antonino Daplas <adaplas@gmail.com>,
Jean-Christophe Plagniol-Villard <plagnioj@jcrosoft.com>,
Tomi Valkeinen <tomi.valkeinen@ti.com>
Subject: [PATCH v1 33/47] video: fbdev: savagefb: use arch_phys_wc_add() and ioremap_wc()
Date: Fri, 20 Mar 2015 23:18:23 +0000 [thread overview]
Message-ID: <1426893517-2511-34-git-send-email-mcgrof@do-not-panic.com> (raw)
In-Reply-To: <1426893517-2511-1-git-send-email-mcgrof@do-not-panic.com>
From: "Luis R. Rodriguez" <mcgrof@suse.com>
This driver uses the same area for MTRR as for the ioremap().
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() (de33c442e)
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 <suresh.b.siddha@intel.com>
Cc: Venkatesh Pallipadi <venkatesh.pallipadi@intel.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
Signed-off-by: Luis R. Rodriguez <mcgrof@suse.com>
---
drivers/video/fbdev/savage/savagefb.h | 4 +---
drivers/video/fbdev/savage/savagefb_driver.c | 17 +++--------------
2 files changed, 4 insertions(+), 17 deletions(-)
diff --git a/drivers/video/fbdev/savage/savagefb.h b/drivers/video/fbdev/savage/savagefb.h
index 8ff4ab1..aba04af 100644
--- a/drivers/video/fbdev/savage/savagefb.h
+++ b/drivers/video/fbdev/savage/savagefb.h
@@ -213,9 +213,7 @@ struct savagefb_par {
void __iomem *vbase;
u32 pbase;
u32 len;
-#ifdef CONFIG_MTRR
- int mtrr;
-#endif
+ int wc_cookie;
} video;
struct {
diff --git a/drivers/video/fbdev/savage/savagefb_driver.c b/drivers/video/fbdev/savage/savagefb_driver.c
index 4dbf45f..6c77ab0 100644
--- a/drivers/video/fbdev/savage/savagefb_driver.c
+++ b/drivers/video/fbdev/savage/savagefb_driver.c
@@ -57,10 +57,6 @@
#include <asm/irq.h>
#include <asm/pgtable.h>
-#ifdef CONFIG_MTRR
-#include <asm/mtrr.h>
-#endif
-
#include "savagefb.h"
@@ -1775,7 +1771,7 @@ static int savage_map_video(struct fb_info *info, int video_len)
par->video.pbase = pci_resource_start(par->pcidev, resource);
par->video.len = video_len;
- par->video.vbase = ioremap(par->video.pbase, par->video.len);
+ par->video.vbase = ioremap_wc(par->video.pbase, par->video.len);
if (!par->video.vbase) {
printk("savagefb: unable to map screen memory\n");
@@ -1787,11 +1783,7 @@ static int savage_map_video(struct fb_info *info, int video_len)
info->fix.smem_start = par->video.pbase;
info->fix.smem_len = par->video.len - par->cob_size;
info->screen_base = par->video.vbase;
-
-#ifdef CONFIG_MTRR
- par->video.mtrr = mtrr_add(par->video.pbase, video_len,
- MTRR_TYPE_WRCOMB, 1);
-#endif
+ par->video.wc_cookie = arch_phys_wc_add(par->video.pbase, video_len);
/* Clear framebuffer, it's all white in memory after boot */
memset_io(par->video.vbase, 0, par->video.len);
@@ -1806,10 +1798,7 @@ static void savage_unmap_video(struct fb_info *info)
DBG("savage_unmap_video");
if (par->video.vbase) {
-#ifdef CONFIG_MTRR
- mtrr_del(par->video.mtrr, par->video.pbase, par->video.len);
-#endif
-
+ arch_phys_wc_del(par->video.wc_cookie);
iounmap(par->video.vbase);
par->video.vbase = NULL;
info->screen_base = NULL;
--
2.3.2.209.gd67f9d5.dirty
next prev parent reply other threads:[~2015-03-20 23:18 UTC|newest]
Thread overview: 110+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-20 23:17 [PATCH v1 00/47] mtrr/x86/drivers: bury MTRR Luis R. Rodriguez
2015-03-20 23:17 ` [PATCH v1 01/47] x86: mtrr: annotate mtrr_type_lookup() is only implemented on generic_mtrr_ops Luis R. Rodriguez
2015-03-20 23:17 ` [PATCH v1 02/47] x86: mtrr: generalize run time disabling of MTRR Luis R. Rodriguez
2015-03-25 19:59 ` Konrad Rzeszutek Wilk
2015-03-26 4:38 ` Juergen Gross
2015-03-26 23:35 ` Luis R. Rodriguez
2015-04-02 20:13 ` Bjorn Helgaas
2015-04-02 20:20 ` Luis R. Rodriguez
2015-04-02 20:28 ` Bjorn Helgaas
2015-04-02 21:02 ` Luis R. Rodriguez
2015-04-02 22:09 ` Bjorn Helgaas
2015-04-02 22:12 ` [Xen-devel] " Luis R. Rodriguez
2015-03-27 20:40 ` Toshi Kani
2015-03-27 23:56 ` Luis R. Rodriguez
2015-04-02 21:49 ` Luis R. Rodriguez
2015-04-02 23:52 ` Toshi Kani
2015-04-03 1:08 ` Luis R. Rodriguez
2015-03-20 23:17 ` [PATCH v1 03/47] devres: add devm_ioremap_wc() Luis R. Rodriguez
2015-03-20 23:49 ` Andy Lutomirski
2015-03-25 19:50 ` Luis R. Rodriguez
2015-03-20 23:17 ` [PATCH v1 04/47] pci: add pci_ioremap_wc_bar() Luis R. Rodriguez
2015-03-20 23:50 ` Andy Lutomirski
2015-03-25 20:06 ` Luis R. Rodriguez
2015-03-25 20:03 ` [Xen-devel] " Konrad Rzeszutek Wilk
2015-03-25 20:39 ` Luis R. Rodriguez
2015-03-20 23:17 ` [PATCH v1 05/47] pci: add pci_iomap_wc() variants Luis R. Rodriguez
2015-03-23 17:20 ` Bjorn Helgaas
2015-03-26 3:00 ` Luis R. Rodriguez
2015-03-27 19:18 ` Toshi Kani
2015-04-21 19:25 ` Michael S. Tsirkin
2015-04-21 19:27 ` Luis R. Rodriguez
2015-03-25 20:07 ` Konrad Rzeszutek Wilk
2015-03-27 18:40 ` Luis R. Rodriguez
2015-03-20 23:17 ` [PATCH v1 06/47] mtrr: add __arch_phys_wc_add() Luis R. Rodriguez
2015-03-20 23:48 ` Andy Lutomirski
2015-03-27 19:53 ` Luis R. Rodriguez
2015-03-27 19:58 ` Andy Lutomirski
2015-03-27 20:30 ` Luis R. Rodriguez
2015-03-27 21:23 ` Andy Lutomirski
2015-03-27 23:04 ` Luis R. Rodriguez
2015-03-27 23:10 ` Andy Lutomirski
2015-03-27 23:33 ` Luis R. Rodriguez
2015-04-02 20:21 ` Bjorn Helgaas
2015-04-02 20:55 ` Luis R. Rodriguez
2015-04-02 22:35 ` Bjorn Helgaas
2015-04-02 22:54 ` Luis R. Rodriguez
2015-03-20 23:17 ` [PATCH v1 07/47] video: fbdev: atyfb: move framebuffer length fudging to helper Luis R. Rodriguez
2015-03-20 23:17 ` [PATCH v1 08/47] video: fbdev: atyfb: clarify ioremap() base and length used Luis R. Rodriguez
2015-03-20 23:17 ` [PATCH v1 09/47] vidoe: fbdev: atyfb: remove and fix MTRR MMIO "hole" work around Luis R. Rodriguez
2015-03-20 23:52 ` Andy Lutomirski
2015-03-27 20:12 ` Luis R. Rodriguez
2015-03-27 21:21 ` Andy Lutomirski
2015-03-27 23:31 ` Luis R. Rodriguez
2015-03-21 9:15 ` Ville Syrjälä
2015-03-27 8:37 ` Ville Syrjälä
2015-03-27 19:38 ` Luis R. Rodriguez
2015-03-27 19:38 ` Luis R. Rodriguez
2015-03-27 19:43 ` Andy Lutomirski
2015-03-27 19:57 ` Luis R. Rodriguez
2015-03-27 21:56 ` Ville Syrjälä
2015-03-27 22:02 ` Andy Lutomirski
2015-03-28 0:28 ` Luis R. Rodriguez
2015-03-28 12:23 ` Ville Syrjälä
2015-04-01 23:52 ` Luis R. Rodriguez
2015-04-02 0:04 ` Andy Lutomirski
2015-04-02 19:45 ` Luis R. Rodriguez
2015-04-02 19:50 ` Andy Lutomirski
2015-03-28 0:21 ` Luis R. Rodriguez
2015-03-20 23:18 ` [PATCH v1 10/47] video: fbdev: atyfb: use arch_phys_wc_add() and ioremap_wc() Luis R. Rodriguez
2015-03-20 23:18 ` [PATCH v1 11/47] IB/qib: add acounting for MTRR Luis R. Rodriguez
2015-03-20 23:18 ` [PATCH v1 12/47] IB/qib: use arch_phys_wc_add() Luis R. Rodriguez
2015-03-20 23:18 ` [PATCH v1 13/47] IB/ipath: add counting for MTRR Luis R. Rodriguez
2015-03-20 23:18 ` [PATCH v1 14/47] IB/ipath: use __arch_phys_wc_add() Luis R. Rodriguez
2015-03-20 23:18 ` [PATCH v1 15/47] [media] media: ivtv: " Luis R. Rodriguez
2015-03-20 23:18 ` [PATCH v1 16/47] fusion: " Luis R. Rodriguez
2015-03-20 23:18 ` [PATCH v1 17/47] video: fbdev: vesafb: only support MTRR_TYPE_WRCOMB Luis R. Rodriguez
2015-03-20 23:18 ` [PATCH v1 18/47] vidoe: fbdev: vesafb: add missing mtrr_del() for added MTRR Luis R. Rodriguez
2015-03-20 23:18 ` [PATCH v1 19/47] video: fbdev: vesafb: use arch_phys_wc_add() Luis R. Rodriguez
2015-03-20 23:18 ` [PATCH v1 20/47] mtrr: avoid ifdef'ery with phys_wc_to_mtrr_index() Luis R. Rodriguez
2015-03-20 23:18 ` [PATCH v1 21/47] ethernet: myri10ge: use arch_phys_wc_add() Luis R. Rodriguez
2015-03-21 7:08 ` Hyong-Youb Kim
2015-03-27 20:36 ` Luis R. Rodriguez
2015-03-20 23:18 ` [PATCH v1 22/47] staging: sm750fb: use arch_phys_wc_add() and ioremap_wc() Luis R. Rodriguez
2015-03-20 23:18 ` [PATCH v1 23/47] staging: xgifb: " Luis R. Rodriguez
2015-04-30 17:40 ` Luis R. Rodriguez
2015-03-20 23:18 ` [PATCH v1 24/47] video: fbdev: arkfb: use arch_phys_wc_add() and pci_iomap_wc() Luis R. Rodriguez
2015-03-20 23:18 ` [PATCH v1 25/47] video: fbdev: radeonfb: use arch_phys_wc_add() and ioremap_wc() Luis R. Rodriguez
2015-03-20 23:18 ` [PATCH v1 26/47] video: fbdev: gbefb: add missing mtrr_del() calls Luis R. Rodriguez
2015-03-20 23:18 ` [PATCH v1 27/47] video: fbdev: gbefb: use arch_phys_wc_add() and devm_ioremap_wc() Luis R. Rodriguez
2015-03-20 23:18 ` [PATCH v1 28/47] video: fbdev: intelfb: use arch_phys_wc_add() and ioremap_wc() Luis R. Rodriguez
2015-03-20 23:18 ` [PATCH v1 29/47] video: fbdev: matrox: " Luis R. Rodriguez
2015-03-20 23:18 ` [PATCH v1 30/47] video: fbdev: neofb: " Luis R. Rodriguez
2015-03-20 23:18 ` [PATCH v1 31/47] video: fbdev: s3fb: use arch_phys_wc_add() and pci_iomap_wc() Luis R. Rodriguez
2015-03-20 23:18 ` [PATCH v1 32/47] video: fbdev: nvidia: use arch_phys_wc_add() and ioremap_wc() Luis R. Rodriguez
2015-03-20 23:18 ` Luis R. Rodriguez [this message]
2015-03-20 23:18 ` [PATCH v1 34/47] video: fbdev: sisfb: " Luis R. Rodriguez
2015-03-20 23:18 ` [PATCH v1 35/47] video: fbdev: aty: " Luis R. Rodriguez
2015-03-20 23:18 ` [PATCH v1 36/47] video: fbdev: i810: " Luis R. Rodriguez
2015-03-20 23:18 ` [PATCH v1 37/47] video: fbdev: i740fb: use arch_phys_wc_add() and pci_ioremap_wc_bar() Luis R. Rodriguez
2015-03-20 23:18 ` [PATCH v1 38/47] video: fbdev: kyrofb: " Luis R. Rodriguez
2015-03-20 23:18 ` [PATCH v1 39/47] video: fbdev: pm2fb: use arch_phys_wc_add() and ioremap_wc() Luis R. Rodriguez
2015-03-20 23:18 ` [PATCH v1 40/47] video: fbdev: pm3fb: " Luis R. Rodriguez
2015-03-20 23:18 ` [PATCH v1 41/47] video: fbdev: rivafb: " Luis R. Rodriguez
2015-03-20 23:18 ` [PATCH v1 42/47] video: fbdev: tdfxfb: " Luis R. Rodriguez
2015-03-20 23:18 ` [PATCH v1 43/47] video: fbdev: vt8623fb: use arch_phys_wc_add() and pci_iomap_wc() Luis R. Rodriguez
2015-03-20 23:18 ` [PATCH v1 44/47] video: fbdev: atmel_lcdfb: use ioremap_wc() for framebuffer Luis R. Rodriguez
2015-03-20 23:18 ` [PATCH v1 45/47] video: fbdev: geode gxfb: " Luis R. Rodriguez
2015-03-20 23:18 ` [PATCH v1 46/47] video: fbdev: gxt4500: use pci_ioremap_wc_bar() " Luis R. Rodriguez
2015-03-20 23:18 ` [PATCH v1 47/47] mtrr: bury MTRR - unexport mtrr_add() and mtrr_del() Luis R. Rodriguez
2015-03-21 1:08 ` [PATCH v1 00/47] mtrr/x86/drivers: bury MTRR Andy Lutomirski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1426893517-2511-34-git-send-email-mcgrof@do-not-panic.com \
--to=mcgrof@do-not-panic.com \
--cc=JBeulich@suse.com \
--cc=adaplas@gmail.com \
--cc=airlied@redhat.com \
--cc=bp@suse.de \
--cc=daniel.vetter@ffwll.ch \
--cc=hpa@zytor.com \
--cc=jgross@suse.com \
--cc=linux-fbdev@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@amacapital.net \
--cc=mcgrof@suse.com \
--cc=mingo@elte.hu \
--cc=mingo@redhat.com \
--cc=plagnioj@jcrosoft.com \
--cc=suresh.b.siddha@intel.com \
--cc=tglx@linutronix.de \
--cc=tomi.valkeinen@ti.com \
--cc=venkatesh.pallipadi@intel.com \
--cc=x86@kernel.org \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).