[Intel-gfx] xf86-video-intel: NEWS

Jesse Barnes jbarnes at virtuousgeek.org
Thu Apr 16 18:59:50 CEST 2009


On Thu, 16 Apr 2009 09:28:33 +0200
Brice Goglin <brice.goglin at gmail.com> wrote:
> Could you clarify a bit what's going on with PAT and MTRR in recent
> kernels and intel drivers? Apart from PAT being broken, how are things
> supposed to be setup?
> 
> It looks like many Debian bug reports with latest intel drivers are
> related to a WC MTRR disappearing, likely when upgrading to 2.6.29.
> PAT is disabled at _build_time_ in Debian's 2.6.29 (CONFIG_X86_PAT=n)
> so obviously ioremap_wc never works, and a MTRR is thus needed.  Did
> the kernel DRM drivers stop setting MTRR at all assuming that
> ioremap_WC/PAT always works? Who is actually deciding whether MTRR
> and/or PAT should be used? ddx? drm? i915?

Yes there's been some pretty big miscommunication going on... The APIs
don't do what you think they should (e.g. you'd *think* opening up a
resourceN_wc file in sysfs would give you a write combined file, but it
won't if you don't have PAT and there's no MTRR covering the region).
Similarly with the i915 and drm drivers; setting the WC flag in non-PAT
configs will give you UC!

This patch to libpciaccess makes the wc path set up an MTRR, can you
give it a try?  It should help with some of the cases above, though
you'll still want 2.6.29.1 to get some other related fixes.
-- 
Jesse Barnes, Intel Open Source Technology Center

diff --git a/src/linux_sysfs.c b/src/linux_sysfs.c
index 8c3cf67..3f5f20a 100644
--- a/src/linux_sysfs.c
+++ b/src/linux_sysfs.c
@@ -558,7 +558,7 @@ pci_device_linux_sysfs_map_range(struct pci_device *dev,
     /* For WC mappings, try sysfs resourceN_wc file first */
     if ((map->flags & PCI_DEV_MAP_FLAG_WRITE_COMBINE) &&
 	!pci_device_linux_sysfs_map_range_wc(dev, map))
-	    return 0;
+	    goto mmap_done;
 
     snprintf(name, 255, "%s/%04x:%02x:%02x.%1u/resource%u",
              SYS_BUS_PCI,
@@ -580,7 +580,7 @@ pci_device_linux_sysfs_map_range(struct pci_device *dev,
 	close(fd);
 	return errno;
     }
-
+mmap_done:
 #ifdef HAVE_MTRR
     if ((map->flags & PCI_DEV_MAP_FLAG_CACHABLE) != 0) {
         sentry.type = MTRR_TYPE_WRBACK;




More information about the Intel-gfx mailing list