Re: [Intel-gfx] [PATCH 2/2] mmio: Limit the uc- mapping to only map the registers

2012-08-27 Thread Daniel Vetter
On Sun, Aug 26, 2012 at 09:22:15PM +0100, Chris Wilson wrote:
 In the future, we may like to enable wc mapping of at least the GATT,
 and so causing a conflict if we attempt to map the entire bar as uc-
 here. Obviously we need a better fallback plan, but for the moment only
 attempt to map the portion of the pci space that we use for register
 access.
 
 Signed-off-by: Chris Wilson ch...@chris-wilson.co.uk
Both applied, thanks for the patches.
-Daniel
-- 
Daniel Vetter
Mail: dan...@ffwll.ch
Mobile: +41 (0)79 365 57 48
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH 2/2] mmio: Limit the uc- mapping to only map the registers

2012-08-26 Thread Chris Wilson
In the future, we may like to enable wc mapping of at least the GATT,
and so causing a conflict if we attempt to map the entire bar as uc-
here. Obviously we need a better fallback plan, but for the moment only
attempt to map the portion of the pci space that we use for register
access.

Signed-off-by: Chris Wilson ch...@chris-wilson.co.uk
---
 lib/intel_mmio.c |   20 ++--
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/lib/intel_mmio.c b/lib/intel_mmio.c
index b266847..ecb049b 100644
--- a/lib/intel_mmio.c
+++ b/lib/intel_mmio.c
@@ -80,8 +80,8 @@ intel_map_file(char *file)
 void
 intel_get_mmio(struct pci_device *pci_dev)
 {
-   uint32_t devid;
-   int mmio_bar;
+   uint32_t devid, gen;
+   int mmio_bar, mmio_size;
int error;
 
devid = pci_dev-device_id;
@@ -90,11 +90,19 @@ intel_get_mmio(struct pci_device *pci_dev)
else
mmio_bar = 0;
 
+   gen = intel_gen(devid);
+   if (gen  3)
+   mmio_size = 64*1024;
+   else if (gen  5)
+   mmio_size = 512*1024;
+   else
+   mmio_size = 2*1024*1024;
+
error = pci_device_map_range (pci_dev,
-   pci_dev-regions[mmio_bar].base_addr,
-   pci_dev-regions[mmio_bar].size,
-   PCI_DEV_MAP_FLAG_WRITABLE,
-   mmio);
+ pci_dev-regions[mmio_bar].base_addr,
+ mmio_size,
+ PCI_DEV_MAP_FLAG_WRITABLE,
+ mmio);
 
if (error != 0) {
fprintf(stderr, Couldn't map MMIO region: %s\n,
-- 
1.7.10.4

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx