Skip to contentSkip to conversation

pci: add and use pci_ioremap_wc_bar()

PATCH Superseded Luis R. Rodriguez 4 participants 17 messages Apr 21, 2015 – Jun 17, 2015

Subsystems (2)

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

v3 cover pci: add and use pci_ioremap_wc_bar()

From: "Luis R. Rodriguez" <[email protected]>

This series adds pci_ioremap_wc_bar() and makes use of it on a few framebuffer device drivers.

Luis R. Rodriguez (4):
pci: add pci_ioremap_wc_bar()
video: fbdev: i740fb: use arch_phys_wc_add() and pci_ioremap_wc_bar()
video: fbdev: kyrofb: use arch_phys_wc_add() and pci_ioremap_wc_bar()
video: fbdev: gxt4500: use pci_ioremap_wc_bar() for framebuffer

 drivers/pci/pci.c                | 14 ++++++++++++++
 drivers/video/fbdev/gxt4500.c    |  2 +-
 drivers/video/fbdev/i740fb.c     | 35 ++++++-----------------------------
 drivers/video/fbdev/kyro/fbdev.c | 33 +++++++++++----------------------
 include/linux/pci.h              |  1 +
 include/video/kyro.h             |  4 +---
 6 files changed, 34 insertions(+), 55 deletions(-)
Signature · 1 line
2.3.2.209.gd67f9d5.dirty
#1 lore raw

PATCH v3 1/4 pci: add pci_ioremap_wc_bar()

From: "Luis R. Rodriguez" <[email protected]>

This lets drivers take advantage of PAT when available. This should help with the transition of converting video drivers over to ioremap_wc() to help with the goal of eventually using _PAGE_CACHE_UC over _PAGE_CACHE_UC_MINUS on x86 on ioremap_nocache() (de33c442e titled "x86 PAT: fix performance drop for glx, use UC minus for ioremap(), ioremap_nocache() and pci_mmap_page_range()")

Cc Toshi Kani <[email protected]>
Cc Bjorn Helgaas <[email protected]>
Cc Suresh Siddha <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Juergen Gross <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc Andy Lutomirski <[email protected]>
Cc Dave Airlie <[email protected]>
Cc Antonino Daplas <[email protected]>
Cc Jean-Christophe Plagniol-Villard <[email protected]>
Cc Tomi Valkeinen <[email protected]>
Cc Ville Syrj?l? <[email protected]>
Cc Mel Gorman <[email protected]>
Cc Vlastimil Babka <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc Davidlohr Bueso <[email protected]>
Cc linux-fbdev at vger.kernel.org
Cc linux-kernel at vger.kernel.org
---
 drivers/pci/pci.c   | 14 ++++++++++++++
 include/linux/pci.h |  1 +
 2 files changed, 15 insertions(+)
drivers/pci/pci.c +14 -0
index 687af72..fd14f10 100644
@@ -138,6 +138,20 @@ void __iomem *pci_ioremap_bar(struct pci_dev *pdev, int bar)
 	return ioremap_nocache(res->start, resource_size(res));
 }
 EXPORT_SYMBOL_GPL(pci_ioremap_bar);
+
+void __iomem *pci_ioremap_wc_bar(struct pci_dev *pdev, int bar)
+{
+	/*
+	 * Make sure the BAR is actually a memory resource, not an IO resource
+	 */
+	if (!(pci_resource_flags(pdev, bar) & IORESOURCE_MEM)) {
+		WARN_ON(1);
+		return NULL;
+	}
+	return ioremap_wc(pci_resource_start(pdev, bar),
+			  pci_resource_len(pdev, bar));
+}
+EXPORT_SYMBOL_GPL(pci_ioremap_wc_bar);
 #endif
 
 #define PCI_FIND_CAP_TTL	48
include/linux/pci.h +1 -0
index bc50bb0..490ca41 100644
@@ -1667,6 +1667,7 @@ static inline void pci_mmcfg_late_init(void) { }
 int pci_ext_cfg_avail(void);
 
 void __iomem *pci_ioremap_bar(struct pci_dev *pdev, int bar);
+void __iomem *pci_ioremap_wc_bar(struct pci_dev *pdev, int bar);
 
 #ifdef CONFIG_PCI_IOV
 int pci_iov_virtfn_bus(struct pci_dev *dev, int id);
Signature · 1 line
2.3.2.209.gd67f9d5.dirty
#4 lore raw

PATCH v3 2/4 video: fbdev: i740fb: use arch_phys_wc_add() and pci_ioremap_wc_bar()

In reply to Luis R. Rodriguez

From: "Luis R. Rodriguez" <[email protected]>

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 Jingoo Han <[email protected]>
Cc Bjorn Helgaas <[email protected]>
Cc Geert Uytterhoeven <[email protected]>
Cc Rob Clark <[email protected]>
Cc Benoit Taine <[email protected]>
Cc Suresh Siddha <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Juergen Gross <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc Andy Lutomirski <[email protected]>
Cc Dave Airlie <[email protected]>
Cc Antonino Daplas <[email protected]>
Cc Jean-Christophe Plagniol-Villard <[email protected]>
Cc Tomi Valkeinen <[email protected]>
Cc linux-fbdev at vger.kernel.org
Cc linux-kernel at vger.kernel.org
---
 drivers/video/fbdev/i740fb.c | 35 ++++++-----------------------------
 1 file changed, 6 insertions(+), 29 deletions(-)
drivers/video/fbdev/i740fb.c +6 -29
index a2b4204..452e116 100644
@@ -27,24 +27,15 @@
 #include <linux/console.h>
 #include <video/vga.h>
 
-#ifdef CONFIG_MTRR
-#include <asm/mtrr.h>
-#endif
-
 #include "i740_reg.h"
 
 static char *mode_option;
-
-#ifdef CONFIG_MTRR
 static int mtrr = 1;
-#endif
 
 struct i740fb_par {
 	unsigned char __iomem *regs;
 	bool has_sgram;
-#ifdef CONFIG_MTRR
-	int mtrr_reg;
-#endif
+	int wc_cookie;
 	bool ddc_registered;
 	struct i2c_adapter ddc_adapter;
 	struct i2c_algo_bit_data ddc_algo;
@@ -1040,7 +1031,7 @@ static int i740fb_probe(struct pci_dev *dev, const struct pci_device_id *ent)
 		goto err_request_regions;
 	}
 
-	info->screen_base = pci_ioremap_bar(dev, 0);
+	info->screen_base = pci_ioremap_wc_bar(dev, 0);
 	if (!info->screen_base) {
 		dev_err(info->device, "error remapping base\n");
 		ret = -ENOMEM;
@@ -1144,13 +1135,9 @@ static int i740fb_probe(struct pci_dev *dev, const struct pci_device_id *ent)
 
 	fb_info(info, "%s frame buffer device\n", info->fix.id);
 	pci_set_drvdata(dev, info);
-#ifdef CONFIG_MTRR
-	if (mtrr) {
-		par->mtrr_reg = -1;
-		par->mtrr_reg = mtrr_add(info->fix.smem_start,
-				info->fix.smem_len, MTRR_TYPE_WRCOMB, 1);
-	}
-#endif
+	if (mtrr)
+		par->wc_cookie = arch_phys_wc_add(info->fix.smem_start,
+						  info->fix.smem_len);
 	return 0;
 
 err_reg_framebuffer:
@@ -1177,13 +1164,7 @@ static void i740fb_remove(struct pci_dev *dev)
 
 	if (info) {
 		struct i740fb_par *par = info->par;
-
-#ifdef CONFIG_MTRR
-		if (par->mtrr_reg >= 0) {
-			mtrr_del(par->mtrr_reg, 0, 0);
-			par->mtrr_reg = -1;
-		}
-#endif
+		arch_phys_wc_del(par->wc_cookie);
 		unregister_framebuffer(info);
 		fb_dealloc_cmap(&info->cmap);
 		if (par->ddc_registered)
@@ -1287,10 +1268,8 @@ static int  __init i740fb_setup(char *options)
 	while ((opt = strsep(&options, ",")) != NULL) {
 		if (!*opt)
 			continue;
-#ifdef CONFIG_MTRR
 		else if (!strncmp(opt, "mtrr:", 5))
 			mtrr = simple_strtoul(opt + 5, NULL, 0);
-#endif
 		else
 			mode_option = opt;
 	}
@@ -1327,7 +1306,5 @@ MODULE_DESCRIPTION("fbdev driver for Intel740");
 module_param(mode_option, charp, 0444);
 MODULE_PARM_DESC(mode_option, "Default video mode ('640x480-8 at 60', etc)");
 
-#ifdef CONFIG_MTRR
 module_param(mtrr, int, 0444);
 MODULE_PARM_DESC(mtrr, "Enable write-combining with MTRR (1=enable, 0=disable, default=1)");
-#endif
Signature · 1 line
2.3.2.209.gd67f9d5.dirty
#5 lore raw

PATCH v3 3/4 video: fbdev: kyrofb: use arch_phys_wc_add() and pci_ioremap_wc_bar()

In reply to Luis R. Rodriguez

From: "Luis R. Rodriguez" <[email protected]>

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 Jingoo Han <[email protected]>
Cc Geert Uytterhoeven <[email protected]>
Cc Laurent Pinchart <[email protected]>
Cc Suresh Siddha <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Juergen Gross <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc Andy Lutomirski <[email protected]>
Cc Dave Airlie <[email protected]>
Cc Antonino Daplas <[email protected]>
Cc Jean-Christophe Plagniol-Villard <[email protected]>
Cc Tomi Valkeinen <[email protected]>
Cc linux-fbdev at vger.kernel.org
Cc linux-kernel at vger.kernel.org
---
 drivers/video/fbdev/kyro/fbdev.c | 33 +++++++++++----------------------
 include/video/kyro.h             |  4 +---
 2 files changed, 12 insertions(+), 25 deletions(-)
drivers/video/fbdev/kyro/fbdev.c +11 -22
index 65041e1..5bb0153 100644
@@ -22,9 +22,6 @@
 #include <linux/pci.h>
 #include <asm/io.h>
 #include <linux/uaccess.h>
-#ifdef CONFIG_MTRR
-#include <asm/mtrr.h>
-#endif
 
 #include <video/kyro.h>
 
@@ -84,9 +81,7 @@ static device_info_t deviceInfo;
 static char *mode_option = NULL;
 static int nopan = 0;
 static int nowrap = 1;
-#ifdef CONFIG_MTRR
 static int nomtrr = 0;
-#endif
 
 /* PCI driver prototypes */
 static int kyrofb_probe(struct pci_dev *pdev, const struct pci_device_id *ent);
@@ -570,10 +565,8 @@ static int __init kyrofb_setup(char *options)
 			nopan = 1;
 		} else if (strcmp(this_opt, "nowrap") == 0) {
 			nowrap = 1;
-#ifdef CONFIG_MTRR
 		} else if (strcmp(this_opt, "nomtrr") == 0) {
 			nomtrr = 1;
-#endif
 		} else {
 			mode_option = this_opt;
 		}
@@ -691,17 +684,16 @@ static int kyrofb_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 
 	currentpar->regbase = deviceInfo.pSTGReg =
 		ioremap_nocache(kyro_fix.mmio_start, kyro_fix.mmio_len);
+	if (!currentpar->regbase)
+		goto out_free_fb;
 
-	info->screen_base = ioremap_nocache(kyro_fix.smem_start,
-					    kyro_fix.smem_len);
+	info->screen_base = pci_ioremap_wc_bar(pdev, 0);
+	if (!info->screen_base)
+		goto out_unmap_regs;
 
-#ifdef CONFIG_MTRR
 	if (!nomtrr)
-		currentpar->mtrr_handle =
-			mtrr_add(kyro_fix.smem_start,
-				 kyro_fix.smem_len,
-				 MTRR_TYPE_WRCOMB, 1);
-#endif
+		currentpar->wc_cookie = arch_phys_wc_add(kyro_fix.smem_start,
+							 kyro_fix.smem_len);
 
 	kyro_fix.ypanstep	= nopan ? 0 : 1;
 	kyro_fix.ywrapstep	= nowrap ? 0 : 1;
@@ -745,8 +737,10 @@ static int kyrofb_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 	return 0;
 
 out_unmap:
-	iounmap(currentpar->regbase);
 	iounmap(info->screen_base);
+out_unmap_regs:
+	iounmap(currentpar->regbase);
+out_free_fb:
 	framebuffer_release(info);
 
 	return -EINVAL;
@@ -770,12 +764,7 @@ static void kyrofb_remove(struct pci_dev *pdev)
 	iounmap(info->screen_base);
 	iounmap(par->regbase);
 
-#ifdef CONFIG_MTRR
-	if (par->mtrr_handle)
-		mtrr_del(par->mtrr_handle,
-			 info->fix.smem_start,
-			 info->fix.smem_len);
-#endif
+	arch_phys_wc_del(par->wc_cookie);
 
 	unregister_framebuffer(info);
 	framebuffer_release(info);
include/video/kyro.h +1 -3
index c563968..b958c2e 100644
@@ -35,9 +35,7 @@ struct kyrofb_info {
 	/* Useful to hold depth here for Linux */
 	u8 PIXDEPTH;
 
-#ifdef CONFIG_MTRR
-	int mtrr_handle;
-#endif
+	int wc_cookie;
 };
 
 extern int kyro_dev_init(void);
Signature · 1 line
2.3.2.209.gd67f9d5.dirty
#6 lore raw

PATCH v3 4/4 video: fbdev: gxt4500: use pci_ioremap_wc_bar() for framebuffer

In reply to Luis R. Rodriguez

From: "Luis R. Rodriguez" <[email protected]>

The driver doesn't use mtrr_add() or arch_phys_wc_add() but since we know the framebuffer is isolated already on an ioremap() we can take advantage of write combining for performance where possible.

In this case there are a few motivations for this:

a) Take advantage of PAT when available

b) 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()")

Cc Laurent Pinchart <[email protected]>
Cc Rob Clark <[email protected]>
Cc Geert Uytterhoeven <[email protected]>
Cc Suresh Siddha <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Juergen Gross <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc Andy Lutomirski <[email protected]>
Cc Dave Airlie <[email protected]>
Cc Antonino Daplas <[email protected]>
Cc Jean-Christophe Plagniol-Villard <[email protected]>
Cc Tomi Valkeinen <[email protected]>
Cc linux-fbdev at vger.kernel.org
Cc linux-kernel at vger.kernel.org
---
 drivers/video/fbdev/gxt4500.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/video/fbdev/gxt4500.c +1 -1
index 135d78a..f19133a 100644
@@ -662,7 +662,7 @@ static int gxt4500_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 
 	info->fix.smem_start = fb_phys;
 	info->fix.smem_len = pci_resource_len(pdev, 1);
-	info->screen_base = pci_ioremap_bar(pdev, 1);
+	info->screen_base = pci_ioremap_wc_bar(pdev, 1);
 	if (!info->screen_base) {
 		dev_err(&pdev->dev, "gxt4500: cannot map framebuffer\n");
 		goto err_unmap_regs;
Signature · 1 line
2.3.2.209.gd67f9d5.dirty
#7 lore raw

v3 cover pci: add and use pci_ioremap_wc_bar()

In reply to Luis R. Rodriguez
Quoted 10 lines · Luis R. Rodriguez

From: "Luis R. Rodriguez" <[email protected]>

This series adds pci_ioremap_wc_bar() and makes use of it on a few framebuffer device drivers.

Luis R. Rodriguez (4):
pci: add pci_ioremap_wc_bar()
video: fbdev: i740fb: use arch_phys_wc_add() and pci_ioremap_wc_bar()
video: fbdev: kyrofb: use arch_phys_wc_add() and pci_ioremap_wc_bar()
video: fbdev: gxt4500: use pci_ioremap_wc_bar() for framebuffer

Bjorn,

any feedback on this series?

Luis

#8 lore raw

v3 cover pci: add and use pci_ioremap_wc_bar()

Quoted 13 lines · Luis R. Rodriguez
Quoted 10 lines · Luis R. Rodriguez

From: "Luis R. Rodriguez" <[email protected]>

This series adds pci_ioremap_wc_bar() and makes use of it on a few framebuffer device drivers.

Luis R. Rodriguez (4):
pci: add pci_ioremap_wc_bar()
video: fbdev: i740fb: use arch_phys_wc_add() and pci_ioremap_wc_bar()
video: fbdev: kyrofb: use arch_phys_wc_add() and pci_ioremap_wc_bar()
video: fbdev: gxt4500: use pci_ioremap_wc_bar() for framebuffer

Quoted 3 lines

Bjorn,

any feedback on this series?

Hey Bjorn, any feedback on this series ?

Luis

#9 lore raw

v3 cover pci: add and use pci_ioremap_wc_bar()

Quoted 14 lines · Luis R. Rodriguez
Quoted 13 lines · Luis R. Rodriguez
Quoted 10 lines · Luis R. Rodriguez

From: "Luis R. Rodriguez" <[email protected]>

This series adds pci_ioremap_wc_bar() and makes use of it on a few framebuffer device drivers.

Luis R. Rodriguez (4):
pci: add pci_ioremap_wc_bar()
video: fbdev: i740fb: use arch_phys_wc_add() and pci_ioremap_wc_bar()
video: fbdev: kyrofb: use arch_phys_wc_add() and pci_ioremap_wc_bar()
video: fbdev: gxt4500: use pci_ioremap_wc_bar() for framebuffer

Quoted 5 lines
Quoted 3 lines

Bjorn,

any feedback on this series?

Hey Bjorn, any feedback on this series ?

I meant this series. Also Tomi, do I get your Acks for these as well? Since they depend on pci parts do you mind if we route them through the PCI tree? I'll poke you soon about another similar type of patch which has dependencies on another development tree.

Luis

maintainer
#2 lore raw

Re: [PATCH v3 1/4] pci: add pci_ioremap_wc_bar()

In reply to Luis R. Rodriguez
Quoted 22 lines · Luis R. Rodriguez

From: "Luis R. Rodriguez" <[email protected]>

This lets drivers take advantage of PAT when available. This should help with the transition of converting video drivers over to ioremap_wc() to help with the goal of eventually using _PAGE_CACHE_UC over _PAGE_CACHE_UC_MINUS on x86 on ioremap_nocache() (de33c442e titled "x86 PAT: fix performance drop for glx, use UC minus for ioremap(), ioremap_nocache() and pci_mmap_page_range()")

Cc Toshi Kani <[email protected]>
Cc Bjorn Helgaas <[email protected]>
Cc Suresh Siddha <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Juergen Gross <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc Andy Lutomirski <[email protected]>
Cc Dave Airlie <[email protected]>
Cc Antonino Daplas <[email protected]>
Cc Jean-Christophe Plagniol-Villard <[email protected]>
Cc Tomi Valkeinen <[email protected]>
Quoted 8 lines
Cc Ville Syrjälä <[email protected]>
Cc Mel Gorman <[email protected]>
Cc Vlastimil Babka <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc Davidlohr Bueso <[email protected]>

I don't have any objection to this, and I can apply the follow-on patches as well, given the appropriate acks and prerequisite patches (ioremap_wc() implementation).

Quoted 45 lines
---
 drivers/pci/pci.c   | 14 ++++++++++++++
 include/linux/pci.h |  1 +
 2 files changed, 15 insertions(+)
drivers/pci/pci.c +14 -0
index 687af72..fd14f10 100644
@@ -138,6 +138,20 @@ void __iomem *pci_ioremap_bar(struct pci_dev *pdev, int bar)
 	return ioremap_nocache(res->start, resource_size(res));
 }
 EXPORT_SYMBOL_GPL(pci_ioremap_bar);
+
+void __iomem *pci_ioremap_wc_bar(struct pci_dev *pdev, int bar)
+{
+	/*
+	 * Make sure the BAR is actually a memory resource, not an IO resource
+	 */
+	if (!(pci_resource_flags(pdev, bar) & IORESOURCE_MEM)) {
+		WARN_ON(1);
+		return NULL;
+	}
+	return ioremap_wc(pci_resource_start(pdev, bar),
+			  pci_resource_len(pdev, bar));
+}
+EXPORT_SYMBOL_GPL(pci_ioremap_wc_bar);
 #endif
 
 #define PCI_FIND_CAP_TTL	48
include/linux/pci.h +1 -0
index bc50bb0..490ca41 100644
@@ -1667,6 +1667,7 @@ static inline void pci_mmcfg_late_init(void) { }
 int pci_ext_cfg_avail(void);
 
 void __iomem *pci_ioremap_bar(struct pci_dev *pdev, int bar);
+void __iomem *pci_ioremap_wc_bar(struct pci_dev *pdev, int bar);
 
 #ifdef CONFIG_PCI_IOV
 int pci_iov_virtfn_bus(struct pci_dev *dev, int id);
Signature · 1 line
2.3.2.209.gd67f9d5.dirty
#3 lore raw

Re: [PATCH v3 1/4] pci: add pci_ioremap_wc_bar()

Quoted 32 lines · Bjorn Helgaas
Quoted 22 lines · Luis R. Rodriguez

From: "Luis R. Rodriguez" <[email protected]>

This lets drivers take advantage of PAT when available. This should help with the transition of converting video drivers over to ioremap_wc() to help with the goal of eventually using _PAGE_CACHE_UC over _PAGE_CACHE_UC_MINUS on x86 on ioremap_nocache() (de33c442e titled "x86 PAT: fix performance drop for glx, use UC minus for ioremap(), ioremap_nocache() and pci_mmap_page_range()")

Cc Toshi Kani <[email protected]>
Cc Bjorn Helgaas <[email protected]>
Cc Suresh Siddha <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Juergen Gross <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc Andy Lutomirski <[email protected]>
Cc Dave Airlie <[email protected]>
Cc Antonino Daplas <[email protected]>
Cc Jean-Christophe Plagniol-Villard <[email protected]>
Cc Tomi Valkeinen <[email protected]>
Quoted 8 lines
Cc Ville Syrjälä <[email protected]>
Cc Mel Gorman <[email protected]>
Cc Vlastimil Babka <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc Davidlohr Bueso <[email protected]>
Quoted 3 lines

I don't have any objection to this, and I can apply the follow-on patches as well, given the appropriate acks and prerequisite patches (ioremap_wc() implementation).

OK great, ioremap_wc() has been upstream for a long time. So I'll wait for Tomi's review of the fbdev changes. Once I get those I can resend in a series bundled together with the other pending pci / fbdev changes we just discussed to make things clear.

Luis

#10 lore raw

v3 cover pci: add and use pci_ioremap_wc_bar()

In reply to Luis R. Rodriguez
Quoted 17 lines · Luis R. Rodriguez
Quoted 16 lines · Luis R. Rodriguez
Quoted 15 lines · Luis R. Rodriguez
Quoted 10 lines · Luis R. Rodriguez

From: "Luis R. Rodriguez" <[email protected]>

This series adds pci_ioremap_wc_bar() and makes use of it on a few framebuffer device drivers.

Luis R. Rodriguez (4):
pci: add pci_ioremap_wc_bar()
video: fbdev: i740fb: use arch_phys_wc_add() and pci_ioremap_wc_bar()
video: fbdev: kyrofb: use arch_phys_wc_add() and pci_ioremap_wc_bar()
video: fbdev: gxt4500: use pci_ioremap_wc_bar() for framebuffer

Bjorn,

Quoted 8 lines
Quoted 3 lines
Quoted 1 line

any feedback on this series?

Hey Bjorn, any feedback on this series ?

I meant this series. Also Tomi, do I get your Acks for these as well? Since they depend on pci parts do you mind if we route them through the PCI tree? I'll poke you soon about another similar type of patch which has dependencies on another development tree.

Bjorn, Tomi, please let me know if this series is OK, if so I'll resubmit rebased onto Bjorn's pci tree.

Luis

#15 lore raw
In reply to Luis R. Rodriguez

Hi Louis,

Quoted 11 lines · Luis R. Rodriguez

From: "Luis R. Rodriguez" <[email protected]>

This series adds pci_ioremap_wc_bar() and makes use of it on a few framebuffer device drivers.

Luis R. Rodriguez (4):
pci: add pci_ioremap_wc_bar()
video: fbdev: i740fb: use arch_phys_wc_add() and pci_ioremap_wc_bar()
video: fbdev: kyrofb: use arch_phys_wc_add() and pci_ioremap_wc_bar()
video: fbdev: gxt4500: use pci_ioremap_wc_bar() for framebuffer

Quoted 7 lines
 drivers/pci/pci.c                | 14 ++++++++++++++
 drivers/video/fbdev/gxt4500.c    |  2 +-
 drivers/video/fbdev/i740fb.c     | 35 ++++++-----------------------------
 drivers/video/fbdev/kyro/fbdev.c | 33 +++++++++++----------------------
 include/linux/pci.h              |  1 +
 include/video/kyro.h             |  4 +---
 6 files changed, 34 insertions(+), 55 deletions(-)

About this and other related series: rather than having multiple different patch series containing fbdev changes, going via separate trees, I would very much prefer to get all the requisite pci/mtrr related patches merged in the next merge window, and only then change the fbdev drivers in one series, merged via fbdev tree.

Tomi

#16 lore raw

v3 cover pci: add and use pci_ioremap_wc_bar()

Quoted 22 lines · Tomi Valkeinen

Hi Louis,

Quoted 11 lines · Luis R. Rodriguez

From: "Luis R. Rodriguez" <[email protected]>

This series adds pci_ioremap_wc_bar() and makes use of it on a few framebuffer device drivers.

Luis R. Rodriguez (4):
pci: add pci_ioremap_wc_bar()
video: fbdev: i740fb: use arch_phys_wc_add() and pci_ioremap_wc_bar()
video: fbdev: kyrofb: use arch_phys_wc_add() and pci_ioremap_wc_bar()
video: fbdev: gxt4500: use pci_ioremap_wc_bar() for framebuffer

Quoted 7 lines
 drivers/pci/pci.c                | 14 ++++++++++++++
 drivers/video/fbdev/gxt4500.c    |  2 +-
 drivers/video/fbdev/i740fb.c     | 35 ++++++-----------------------------
 drivers/video/fbdev/kyro/fbdev.c | 33 +++++++++++----------------------
 include/linux/pci.h              |  1 +
 include/video/kyro.h             |  4 +---
 6 files changed, 34 insertions(+), 55 deletions(-)
Quoted 5 lines

About this and other related series: rather than having multiple different patch series containing fbdev changes, going via separate trees, I would very much prefer to get all the requisite pci/mtrr related patches merged in the next merge window, and only then change the fbdev drivers in one series, merged via fbdev tree.

Tomi, OK, I'll ask Bjorn to drop the framebuffer driver specific changes on the pci_iomap_wc() series then and wait until he takes only the bus specific changes for this and the pci_iomap_wc() series. Likewise I will wait for the x86 require changes (ioremap_uc() and pat_enabled()) stuff to be exported before sending you the changes required for the framebuffer tree.

Luis

Acked-by on the v3 series
#11 lore raw
In reply to Luis R. Rodriguez
Quoted 22 lines · Luis R. Rodriguez
Quoted 21 lines · Luis R. Rodriguez
Quoted 19 lines · Luis R. Rodriguez
Quoted 13 lines · Luis R. Rodriguez
Quoted 10 lines · Luis R. Rodriguez

From: "Luis R. Rodriguez" <[email protected]>

This series adds pci_ioremap_wc_bar() and makes use of it on a few framebuffer device drivers.

Luis R. Rodriguez (4):
pci: add pci_ioremap_wc_bar()
video: fbdev: i740fb: use arch_phys_wc_add() and pci_ioremap_wc_bar()
video: fbdev: kyrofb: use arch_phys_wc_add() and pci_ioremap_wc_bar()
video: fbdev: gxt4500: use pci_ioremap_wc_bar() for framebuffer

Quoted 3 lines

Bjorn,

any feedback on this series?

Hey Bjorn, any feedback on this series ?

Quoted 7 lines
Quoted 4 lines

I meant this series. Also Tomi, do I get your Acks for these as well? Since they depend on pci parts do you mind if we route them through the PCI tree? I'll poke you soon about another similar type of patch which has dependencies on another development tree.

Bjorn, Tomi, please let me know if this series is OK, if so I'll resubmit rebased onto Bjorn's pci tree.

For the fbdev patches:

Tomi

#12 lore raw

v3 cover pci: add and use pci_ioremap_wc_bar()

Quoted 28 lines · Tomi Valkeinen
Quoted 27 lines · Luis R. Rodriguez
Quoted 25 lines · Luis R. Rodriguez
Quoted 14 lines · Luis R. Rodriguez
Quoted 13 lines · Luis R. Rodriguez
Quoted 10 lines · Luis R. Rodriguez

From: "Luis R. Rodriguez" <[email protected]>

This series adds pci_ioremap_wc_bar() and makes use of it on a few framebuffer device drivers.

Luis R. Rodriguez (4):
pci: add pci_ioremap_wc_bar()
video: fbdev: i740fb: use arch_phys_wc_add() and pci_ioremap_wc_bar()
video: fbdev: kyrofb: use arch_phys_wc_add() and pci_ioremap_wc_bar()
video: fbdev: gxt4500: use pci_ioremap_wc_bar() for framebuffer

Quoted 5 lines
Quoted 3 lines

Bjorn,

any feedback on this series?

Hey Bjorn, any feedback on this series ?

I meant this series. Also Tomi, do I get your Acks for these as well? Since they depend on pci parts do you mind if we route them through the PCI tree? I'll poke you soon about another similar type of patch which has dependencies on another development tree.

Quoted 6 lines
Quoted 2 lines

Bjorn, Tomi, please let me know if this series is OK, if so I'll resubmit rebased onto Bjorn's pci tree.

For the fbdev patches:

Thanks Tomi,

there are two fbdev series that depend on PCI symbols I am introducing, this series and the pci_iomap_wc() series [0]. You've now provided Acks for the fbdev part of both series.

Can the fbdev parts go through Bjorn's tree? We last discussed if the series was important to be fully merged or not by v4.2 and I recentlty provided a long winded review of the entire series to help maintainers pick and choose and decide [1].

Based on this can the fbdev patches from both of these series go through Bjorn's tree? Another alternative that seems to be practiced for situations like this is for most of the merge window to trickle in and then towards the end send dependent API changes such as this one, but I think that would then have to go through your tree and since I realize you are busy I am not sure if this would work well to get this in, in time for v4.2.

[0] http://lkml.kernel.org/r/1430415364-19679-1-git-send-email-mcgrof at do-not-panic.com
[1] http://lkml.kernel.org/r/CAB=NE6UgtdSoBsA=8+ueYRAZHDnWUSmQAoHhAaefqudBrSY7Zw at mail.gmail.com

Luis

#13 lore raw

Hi Luis,

Quoted 6 lines · Luis R. Rodriguez

Can the fbdev parts go through Bjorn's tree? We last discussed if the series was important to be fully merged or not by v4.2 and I recentlty provided a long winded review of the entire series to help maintainers pick and choose and decide [1].

Based on this can the fbdev patches from both of these series go through Bjorn's tree?

Yes, they can go through Bjorn's tree if there are no non-trivial conflicts with the main fbdev stuff. linux-next should contain all the fbdev patches going for 4.2.

Tomi

#14 lore raw

v3 cover pci: add and use pci_ioremap_wc_bar()

Quoted 9 lines · Tomi Valkeinen

Hi Luis,

Quoted 5 lines · Luis R. Rodriguez

Can the fbdev parts go through Bjorn's tree? We last discussed if the series was important to be fully merged or not by v4.2 and I recentlty provided a long winded review of the entire series to help maintainers pick and choose and decide [1].

Quoted 5 lines
Quoted 1 line

Based on this can the fbdev patches from both of these series go through Bjorn's tree?

Yes, they can go through Bjorn's tree if there are no non-trivial conflicts with the main fbdev stuff. linux-next should contain all the fbdev patches going for 4.2.

Great, thanks Tomi.

Luis