[kernel] r14940 - in dists/trunk/linux-2.6/debian: . patches/bugfix/all patches/series

Ben Hutchings benh at alioth.debian.org
Wed Jan 13 22:24:00 UTC 2010


Author: benh
Date: Wed Jan 13 22:23:57 2010
New Revision: 14940

Log:
Fix DMA mapping for i915 driver (Closes: #558237)

Added:
   dists/trunk/linux-2.6/debian/patches/bugfix/all/drm-remove-address-mask-param-for-drm_pci_alloc.patch
   dists/trunk/linux-2.6/debian/patches/bugfix/all/intel-agp-Clear-entire-GTT-on-startup.patch
Modified:
   dists/trunk/linux-2.6/debian/changelog
   dists/trunk/linux-2.6/debian/patches/series/6

Modified: dists/trunk/linux-2.6/debian/changelog
==============================================================================
--- dists/trunk/linux-2.6/debian/changelog	Wed Jan 13 19:17:02 2010	(r14939)
+++ dists/trunk/linux-2.6/debian/changelog	Wed Jan 13 22:23:57 2010	(r14940)
@@ -13,6 +13,9 @@
   * saa7134: Add device id and description for Asus Europa DVB-T card
   * x86/iTCO-wdt: Add device ids for Intel 'Ibex Peak' PCH
   * Documentation/3c509: document ethtool support (Closes: #564743)
+  * Fix DMA mapping for i915 driver (Closes: #558237)
+    - agp/intel-agp: Clear entire GTT on startup
+    - drm: remove address mask param for drm_pci_alloc()
 
   [ Ian Campbell ]
   * xen: Enable up to 32G of guest memory on i386.

Added: dists/trunk/linux-2.6/debian/patches/bugfix/all/drm-remove-address-mask-param-for-drm_pci_alloc.patch
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ dists/trunk/linux-2.6/debian/patches/bugfix/all/drm-remove-address-mask-param-for-drm_pci_alloc.patch	Wed Jan 13 22:23:57 2010	(r14940)
@@ -0,0 +1,141 @@
+From e6be8d9d17bd44061116f601fe2609b3ace7aa69 Mon Sep 17 00:00:00 2001
+From: Zhenyu Wang <zhenyu.z.wang at intel.com>
+Date: Tue, 5 Jan 2010 11:25:05 +0800
+Subject: [PATCH] drm: remove address mask param for drm_pci_alloc()
+
+drm_pci_alloc() has input of address mask for setting pci dma
+mask on the device, which should be properly setup by drm driver.
+And leave it as a param for drm_pci_alloc() would cause confusion
+or mistake would corrupt the correct dma mask setting, as seen on
+intel hw which set wrong dma mask for hw status page. So remove
+it from drm_pci_alloc() function.
+
+Signed-off-by: Zhenyu Wang <zhenyuw at linux.intel.com>
+Signed-off-by: Dave Airlie <airlied at redhat.com>
+---
+ drivers/gpu/drm/ati_pcigart.c   |   10 ++++++++--
+ drivers/gpu/drm/drm_bufs.c      |    4 ++--
+ drivers/gpu/drm/drm_pci.c       |    8 +-------
+ drivers/gpu/drm/i915/i915_dma.c |    2 +-
+ drivers/gpu/drm/i915/i915_gem.c |    2 +-
+ include/drm/drmP.h              |    2 +-
+ 6 files changed, 14 insertions(+), 14 deletions(-)
+
+diff --git a/drivers/gpu/drm/ati_pcigart.c b/drivers/gpu/drm/ati_pcigart.c
+index 628eae3..a1fce68 100644
+--- a/drivers/gpu/drm/ati_pcigart.c
++++ b/drivers/gpu/drm/ati_pcigart.c
+@@ -39,8 +39,7 @@ static int drm_ati_alloc_pcigart_table(struct drm_device *dev,
+ 				       struct drm_ati_pcigart_info *gart_info)
+ {
+ 	gart_info->table_handle = drm_pci_alloc(dev, gart_info->table_size,
+-						PAGE_SIZE,
+-						gart_info->table_mask);
++						PAGE_SIZE);
+ 	if (gart_info->table_handle == NULL)
+ 		return -ENOMEM;
+ 
+@@ -112,6 +111,13 @@ int drm_ati_pcigart_init(struct drm_device *dev, struct drm_ati_pcigart_info *ga
+ 	if (gart_info->gart_table_location == DRM_ATI_GART_MAIN) {
+ 		DRM_DEBUG("PCI: no table in VRAM: using normal RAM\n");
+ 
++		if (pci_set_dma_mask(dev->pdev, gart_info->table_mask)) {
++			DRM_ERROR("fail to set dma mask to 0x%Lx\n",
++				  gart_info->table_mask);
++			ret = 1;
++			goto done;
++		}
++
+ 		ret = drm_ati_alloc_pcigart_table(dev, gart_info);
+ 		if (ret) {
+ 			DRM_ERROR("cannot allocate PCI GART page!\n");
+diff --git a/drivers/gpu/drm/drm_bufs.c b/drivers/gpu/drm/drm_bufs.c
+index 3d09e30..8417cc4 100644
+--- a/drivers/gpu/drm/drm_bufs.c
++++ b/drivers/gpu/drm/drm_bufs.c
+@@ -326,7 +326,7 @@ static int drm_addmap_core(struct drm_device * dev, resource_size_t offset,
+ 		 * As we're limiting the address to 2^32-1 (or less),
+ 		 * casting it down to 32 bits is no problem, but we
+ 		 * need to point to a 64bit variable first. */
+-		dmah = drm_pci_alloc(dev, map->size, map->size, 0xffffffffUL);
++		dmah = drm_pci_alloc(dev, map->size, map->size);
+ 		if (!dmah) {
+ 			kfree(map);
+ 			return -ENOMEM;
+@@ -885,7 +885,7 @@ int drm_addbufs_pci(struct drm_device * dev, struct drm_buf_desc * request)
+ 
+ 	while (entry->buf_count < count) {
+ 
+-		dmah = drm_pci_alloc(dev, PAGE_SIZE << page_order, 0x1000, 0xfffffffful);
++		dmah = drm_pci_alloc(dev, PAGE_SIZE << page_order, 0x1000);
+ 
+ 		if (!dmah) {
+ 			/* Set count correctly so we free the proper amount. */
+diff --git a/drivers/gpu/drm/drm_pci.c b/drivers/gpu/drm/drm_pci.c
+index 577094f..e68ebf9 100644
+--- a/drivers/gpu/drm/drm_pci.c
++++ b/drivers/gpu/drm/drm_pci.c
+@@ -47,8 +47,7 @@
+ /**
+  * \brief Allocate a PCI consistent memory block, for DMA.
+  */
+-drm_dma_handle_t *drm_pci_alloc(struct drm_device * dev, size_t size, size_t align,
+-				dma_addr_t maxaddr)
++drm_dma_handle_t *drm_pci_alloc(struct drm_device * dev, size_t size, size_t align)
+ {
+ 	drm_dma_handle_t *dmah;
+ #if 1
+@@ -63,11 +62,6 @@ drm_dma_handle_t *drm_pci_alloc(struct drm_device * dev, size_t size, size_t ali
+ 	if (align > size)
+ 		return NULL;
+ 
+-	if (pci_set_dma_mask(dev->pdev, maxaddr) != 0) {
+-		DRM_ERROR("Setting pci dma mask failed\n");
+-		return NULL;
+-	}
+-
+ 	dmah = kmalloc(sizeof(drm_dma_handle_t), GFP_KERNEL);
+ 	if (!dmah)
+ 		return NULL;
+diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
+index 701bfea..02607ed 100644
+--- a/drivers/gpu/drm/i915/i915_dma.c
++++ b/drivers/gpu/drm/i915/i915_dma.c
+@@ -123,7 +123,7 @@ static int i915_init_phys_hws(struct drm_device *dev)
+ 	drm_i915_private_t *dev_priv = dev->dev_private;
+ 	/* Program Hardware Status Page */
+ 	dev_priv->status_page_dmah =
+-		drm_pci_alloc(dev, PAGE_SIZE, PAGE_SIZE, 0xffffffff);
++		drm_pci_alloc(dev, PAGE_SIZE, PAGE_SIZE);
+ 
+ 	if (!dev_priv->status_page_dmah) {
+ 		DRM_ERROR("Can not allocate hardware status page\n");
+diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
+index 917b837..c7f0cbe 100644
+--- a/drivers/gpu/drm/i915/i915_gem.c
++++ b/drivers/gpu/drm/i915/i915_gem.c
+@@ -4708,7 +4708,7 @@ int i915_gem_init_phys_object(struct drm_device *dev,
+ 
+ 	phys_obj->id = id;
+ 
+-	phys_obj->handle = drm_pci_alloc(dev, size, 0, 0xffffffff);
++	phys_obj->handle = drm_pci_alloc(dev, size, 0);
+ 	if (!phys_obj->handle) {
+ 		ret = -ENOMEM;
+ 		goto kfree_obj;
+diff --git a/include/drm/drmP.h b/include/drm/drmP.h
+index 71dafb6..ffac157 100644
+--- a/include/drm/drmP.h
++++ b/include/drm/drmP.h
+@@ -1408,7 +1408,7 @@ extern int drm_ati_pcigart_cleanup(struct drm_device *dev,
+ 				   struct drm_ati_pcigart_info * gart_info);
+ 
+ extern drm_dma_handle_t *drm_pci_alloc(struct drm_device *dev, size_t size,
+-				       size_t align, dma_addr_t maxaddr);
++				       size_t align);
+ extern void __drm_pci_free(struct drm_device *dev, drm_dma_handle_t * dmah);
+ extern void drm_pci_free(struct drm_device *dev, drm_dma_handle_t * dmah);
+ 
+-- 
+1.6.5.7
+

Added: dists/trunk/linux-2.6/debian/patches/bugfix/all/intel-agp-Clear-entire-GTT-on-startup.patch
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ dists/trunk/linux-2.6/debian/patches/bugfix/all/intel-agp-Clear-entire-GTT-on-startup.patch	Wed Jan 13 22:23:57 2010	(r14940)
@@ -0,0 +1,59 @@
+From fc61901373987ad61851ed001fe971f3ee8d96a3 Mon Sep 17 00:00:00 2001
+From: David Woodhouse <dwmw2 at infradead.org>
+Date: Wed, 2 Dec 2009 11:00:05 +0000
+Subject: [PATCH] agp/intel-agp: Clear entire GTT on startup
+
+Some BIOSes fail to initialise the GTT, which will cause DMA faults when
+the IOMMU is enabled. We need to clear the whole thing to point at the
+scratch page, not just the part that Linux is going to use.
+
+Signed-off-by: David Woodhouse <David.Woodhouse at intel.com>
+[anholt: Note that this may also help with stability in the presence of
+driver bugs, by not drawing to memory we don't own]
+Signed-off-by: Eric Anholt <eric at anholt.net>
+---
+ drivers/char/agp/intel-agp.c |    7 ++++++-
+ 1 files changed, 6 insertions(+), 1 deletions(-)
+
+diff --git a/drivers/char/agp/intel-agp.c b/drivers/char/agp/intel-agp.c
+index 37cb4e2..33b4853 100644
+--- a/drivers/char/agp/intel-agp.c
++++ b/drivers/char/agp/intel-agp.c
+@@ -176,6 +176,7 @@ static struct _intel_private {
+ 	 * popup and for the GTT.
+ 	 */
+ 	int gtt_entries;			/* i830+ */
++	int gtt_total_size;
+ 	union {
+ 		void __iomem *i9xx_flush_page;
+ 		void *i8xx_flush_page;
+@@ -1151,7 +1152,7 @@ static int intel_i915_configure(void)
+ 	readl(intel_private.registers+I810_PGETBL_CTL);	/* PCI Posting. */
+ 
+ 	if (agp_bridge->driver->needs_scratch_page) {
+-		for (i = intel_private.gtt_entries; i < current_size->num_entries; i++) {
++		for (i = intel_private.gtt_entries; i < intel_private.gtt_total_size; i++) {
+ 			writel(agp_bridge->scratch_page, intel_private.gtt+i);
+ 		}
+ 		readl(intel_private.gtt+i-1);	/* PCI Posting. */
+@@ -1312,6 +1313,8 @@ static int intel_i915_create_gatt_table(struct agp_bridge_data *bridge)
+ 	if (!intel_private.gtt)
+ 		return -ENOMEM;
+ 
++	intel_private.gtt_total_size = gtt_map_size / 4;
++
+ 	temp &= 0xfff80000;
+ 
+ 	intel_private.registers = ioremap(temp, 128 * 4096);
+@@ -1398,6 +1401,8 @@ static int intel_i965_create_gatt_table(struct agp_bridge_data *bridge)
+ 	if (!intel_private.gtt)
+ 		return -ENOMEM;
+ 
++	intel_private.gtt_total_size = gtt_size / 4;
++
+ 	intel_private.registers = ioremap(temp, 128 * 4096);
+ 	if (!intel_private.registers) {
+ 		iounmap(intel_private.gtt);
+-- 
+1.6.5.7
+

Modified: dists/trunk/linux-2.6/debian/patches/series/6
==============================================================================
--- dists/trunk/linux-2.6/debian/patches/series/6	Wed Jan 13 19:17:02 2010	(r14939)
+++ dists/trunk/linux-2.6/debian/patches/series/6	Wed Jan 13 22:23:57 2010	(r14940)
@@ -12,3 +12,5 @@
 + features/x86/iTCO_wdt-Add-support-for-Intel-Ibex-Peak.patch
 + bugfix/all/Documentation-3c509-document-ethtool-support.patch
 + bugfix/all/drm-i915-disable-powersave.patch
++ bugfix/all/intel-agp-Clear-entire-GTT-on-startup.patch
++ bugfix/all/drm-remove-address-mask-param-for-drm_pci_alloc.patch



More information about the Kernel-svn-changes mailing list