[kernel] r16735 - in dists/sid/linux-2.6/debian: . patches/features/all/xen patches/series

Ian Campbell ijc-guest at alioth.debian.org
Thu Dec 23 21:23:37 UTC 2010


Author: ijc-guest
Date: Thu Dec 23 21:23:34 2010
New Revision: 16735

Log:
Fix Nouveau and Radeon in Xen dom0 featureset. (Closes: #602418)

Added:
   dists/sid/linux-2.6/debian/patches/features/all/xen/drm-ttm-Add-ttm_tt_free_page.patch
   dists/sid/linux-2.6/debian/patches/features/all/xen/fbmem-VM_IO-set-but-not-propagated.patch
   dists/sid/linux-2.6/debian/patches/features/all/xen/nouveau-ttm-PCIe-Use-dma_addr-if-TTM-has-set-it.patch
   dists/sid/linux-2.6/debian/patches/features/all/xen/radeon-PCIe-Use-the-correct-index-field.patch
   dists/sid/linux-2.6/debian/patches/features/all/xen/radeon-ttm-PCIe-Use-dma_addr-if-TTM-has-set-it.patch
   dists/sid/linux-2.6/debian/patches/features/all/xen/ttm-Change-VMA-flags-if-they-to-the-TTM-flags.patch
   dists/sid/linux-2.6/debian/patches/features/all/xen/ttm-Expand-populate-to-support-an-array-of-DMA-a.patch
   dists/sid/linux-2.6/debian/patches/features/all/xen/ttm-Introduce-a-placeholder-for-DMA-bus-addresses.patch
   dists/sid/linux-2.6/debian/patches/features/all/xen/ttm-Set-VM_IO-only-on-pages-with-TTM_MEMTYPE_FLAG_N.patch
   dists/sid/linux-2.6/debian/patches/features/all/xen/ttm-Utilize-the-dma_addr_t-array-for-pages-that-are.patch
Modified:
   dists/sid/linux-2.6/debian/changelog
   dists/sid/linux-2.6/debian/patches/series/30-extra

Modified: dists/sid/linux-2.6/debian/changelog
==============================================================================
--- dists/sid/linux-2.6/debian/changelog	Thu Dec 23 21:23:27 2010	(r16734)
+++ dists/sid/linux-2.6/debian/changelog	Thu Dec 23 21:23:34 2010	(r16735)
@@ -31,6 +31,10 @@
   * wireless: b43: fix error path in SDIO.
   * drm/radeon/kms: don't apply 7xx HDP flush workaround on AGP.
 
+  [ Ian Campbell ]
+  * xen: backport TTM patches to use PCI API. Fixes PCIe GPU (specifically
+    Radeon and Nouveau) on Xen (Closes: #601341).
+
  -- Ben Hutchings <ben at decadent.org.uk>  Sun, 12 Dec 2010 03:23:48 +0000
 
 linux-2.6 (2.6.32-29) unstable; urgency=high

Added: dists/sid/linux-2.6/debian/patches/features/all/xen/drm-ttm-Add-ttm_tt_free_page.patch
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ dists/sid/linux-2.6/debian/patches/features/all/xen/drm-ttm-Add-ttm_tt_free_page.patch	Thu Dec 23 21:23:34 2010	(r16735)
@@ -0,0 +1,42 @@
+From 99ffe9e8feaedee9abc58427e06d1f17000ce827 Mon Sep 17 00:00:00 2001
+From: Ian Campbell <ijc at hellion.org.uk>
+Date: Mon, 20 Dec 2010 11:31:20 +0000
+Subject: [PATCH] drm/ttm: Add ttm_tt_free_page
+
+Simplifies backport of
+git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen.git#devel/ttm.pci-api-v2
+in the absence of 1403b1a38e8b "drm/ttm: add pool wc/uc page allocator V3".
+
+Signed-off-by: Ian Campbell <ian.campbell at citrix.com>
+---
+ drivers/gpu/drm/ttm/ttm_tt.c |    7 ++++++-
+ 1 files changed, 6 insertions(+), 1 deletions(-)
+
+diff --git a/drivers/gpu/drm/ttm/ttm_tt.c b/drivers/gpu/drm/ttm/ttm_tt.c
+index a759170..48ec9aa 100644
+--- a/drivers/gpu/drm/ttm/ttm_tt.c
++++ b/drivers/gpu/drm/ttm/ttm_tt.c
+@@ -87,6 +87,11 @@ static struct page *ttm_tt_alloc_page(unsigned page_flags)
+ 	return alloc_page(gfp_flags);
+ }
+ 
++static void ttm_tt_free_page(struct page *page, unsigned page_flags)
++{
++	__free_page(page);
++}
++
+ static void ttm_tt_free_user_pages(struct ttm_tt *ttm)
+ {
+ 	int write;
+@@ -314,7 +319,7 @@ static void ttm_tt_free_alloced_pages(struct ttm_tt *ttm)
+ 				       "Leaking pages.\n");
+ 			ttm_mem_global_free_page(ttm->glob->mem_glob,
+ 						 cur_page);
+-			__free_page(cur_page);
++			ttm_tt_free_page(cur_page, ttm->page_flags);
+ 		}
+ 	}
+ 	ttm->state = tt_unpopulated;
+-- 
+1.5.6.5
+

Added: dists/sid/linux-2.6/debian/patches/features/all/xen/fbmem-VM_IO-set-but-not-propagated.patch
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ dists/sid/linux-2.6/debian/patches/features/all/xen/fbmem-VM_IO-set-but-not-propagated.patch	Thu Dec 23 21:23:34 2010	(r16735)
@@ -0,0 +1,46 @@
+From c07fbfd17e614a76b194f371c5331e21e6cffb54 Mon Sep 17 00:00:00 2001
+From: Daniel De Graaf <dgdegra at tycho.nsa.gov>
+Date: Tue, 10 Aug 2010 18:02:45 -0700
+Subject: [PATCH] fbmem: VM_IO set, but not propagated
+
+When we setup up the VMA flags for the mmap flag and we end up using the
+fallback mmap functionality we set the vma->vm_flags |= VM_IO.  However we
+neglect to propagate the flag to the vma->vm_page_prot.
+
+This bug was found when Linux kernel was running under Xen.  In that
+scenario, any page that has VM_IO flag to it, means that it MUST be a
+MMIO/VRAM backend memory , _not_ System RAM.  That is what the fbmem.c
+does: sets VM_IO, ioremaps the region - everything is peachy.
+
+Well, not exactly.  The vm_page_prot does not get the relevant PTE flags
+set (_PAGE_IOMAP) which under Xen is a death-kneel to pages that are
+referencing real physical devices but don't have that flag set.
+
+This patch fixes this.
+
+Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk at oracle.com>
+Signed-off-by: Daniel De Graaf <dgdegra at tycho.nsa.gov>
+Tested-by: Eamon Walsh <ewalsh at tycho.nsa.gov>
+Cc: Florian Tobias Schandinat <FlorianSchandinat at gmx.de>
+Cc: Dave Airlie <airlied at linux.ie>
+Signed-off-by: Andrew Morton <akpm at linux-foundation.org>
+Signed-off-by: Linus Torvalds <torvalds at linux-foundation.org>
+---
+ drivers/video/fbmem.c |    1 +
+ 1 files changed, 1 insertions(+), 0 deletions(-)
+
+diff --git a/drivers/video/fbmem.c b/drivers/video/fbmem.c
+index a8500c6..b066475 100644
+--- a/drivers/video/fbmem.c
++++ b/drivers/video/fbmem.c
+@@ -1362,6 +1362,7 @@ fb_mmap(struct file *file, struct vm_area_struct * vma)
+ 	vma->vm_pgoff = off >> PAGE_SHIFT;
+ 	/* This is an IO map - tell maydump to skip this VMA */
+ 	vma->vm_flags |= VM_IO | VM_RESERVED;
++	vma->vm_page_prot = vm_get_page_prot(vma->vm_flags);
+ 	fb_pgprotect(file, vma, off);
+ 	if (io_remap_pfn_range(vma, vma->vm_start, off >> PAGE_SHIFT,
+ 			     vma->vm_end - vma->vm_start, vma->vm_page_prot))
+-- 
+1.5.6.5
+

Added: dists/sid/linux-2.6/debian/patches/features/all/xen/nouveau-ttm-PCIe-Use-dma_addr-if-TTM-has-set-it.patch
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ dists/sid/linux-2.6/debian/patches/features/all/xen/nouveau-ttm-PCIe-Use-dma_addr-if-TTM-has-set-it.patch	Thu Dec 23 21:23:34 2010	(r16735)
@@ -0,0 +1,86 @@
+From a51f54d4bf6f9e8fd1c584730316fba1aab29d77 Mon Sep 17 00:00:00 2001
+From: Konrad Rzeszutek Wilk <konrad.wilk at oracle.com>
+Date: Thu, 2 Dec 2010 11:36:24 -0500
+Subject: [PATCH] nouveau/ttm/PCIe: Use dma_addr if TTM has set it.
+
+If the TTM layer has used the DMA API to setup pages that are
+TTM_PAGE_FLAG_DMA32 (look at patch titled: "ttm: Utilize the dma_addr_t
+array for pages that are to in DMA32 pool."), lets use it
+when programming the GART in the PCIe type cards.
+
+This patch skips doing the pci_map_page (and pci_unmap_page) if
+there is a DMA addresses passed in for that page. If the dma_address
+is zero (or DMA_ERROR_CODE), then we continue on with our old
+behaviour.
+
+Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk at oracle.com>
+Signed-off-by: Ian Campbell <ian.campbell at citrix.com>
+(cherry picked from commit b47cde0e9a0e2289a91bacd524b8e10163a10ebb in
+git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen.git#devel/ttm.pci-api-v2)
+---
+ drivers/gpu/drm/nouveau/nouveau_sgdma.c |   28 +++++++++++++++++++++-------
+ 1 files changed, 21 insertions(+), 7 deletions(-)
+
+diff --git a/drivers/gpu/drm/nouveau/nouveau_sgdma.c b/drivers/gpu/drm/nouveau/nouveau_sgdma.c
+index 351582b..947edda 100644
+--- a/drivers/gpu/drm/nouveau/nouveau_sgdma.c
++++ b/drivers/gpu/drm/nouveau/nouveau_sgdma.c
+@@ -11,6 +11,7 @@ struct nouveau_sgdma_be {
+ 	struct drm_device *dev;
+ 
+ 	dma_addr_t *pages;
++	bool *ttm_alloced;
+ 	unsigned nr_pages;
+ 
+ 	unsigned pte_start;
+@@ -34,15 +35,25 @@ nouveau_sgdma_populate(struct ttm_backend *be, unsigned long num_pages,
+ 	if (!nvbe->pages)
+ 		return -ENOMEM;
+ 
++	nvbe->ttm_alloced = kmalloc(sizeof(bool) * num_pages, GFP_KERNEL);
++	if (!nvbe->ttm_alloced)
++		return -ENOMEM;
++
+ 	nvbe->nr_pages = 0;
+ 	while (num_pages--) {
+-		nvbe->pages[nvbe->nr_pages] =
+-			pci_map_page(dev->pdev, pages[nvbe->nr_pages], 0,
++		if (dma_addrs[nvbe->nr_pages] != DMA_ERROR_CODE) {
++			nvbe->pages[nvbe->nr_pages] =
++					dma_addrs[nvbe->nr_pages];
++		 	nvbe->ttm_alloced[nvbe->nr_pages] = true;
++		} else {
++			nvbe->pages[nvbe->nr_pages] =
++				pci_map_page(dev->pdev, pages[nvbe->nr_pages], 0,
+ 				     PAGE_SIZE, PCI_DMA_BIDIRECTIONAL);
+-		if (pci_dma_mapping_error(dev->pdev,
+-					  nvbe->pages[nvbe->nr_pages])) {
+-			be->func->clear(be);
+-			return -EFAULT;
++			if (pci_dma_mapping_error(dev->pdev,
++						  nvbe->pages[nvbe->nr_pages])) {
++				be->func->clear(be);
++				return -EFAULT;
++			}
+ 		}
+ 
+ 		nvbe->nr_pages++;
+@@ -65,11 +76,14 @@ nouveau_sgdma_clear(struct ttm_backend *be)
+ 			be->func->unbind(be);
+ 
+ 		while (nvbe->nr_pages--) {
+-			pci_unmap_page(dev->pdev, nvbe->pages[nvbe->nr_pages],
++			if (!nvbe->ttm_alloced[nvbe->nr_pages])
++				pci_unmap_page(dev->pdev, nvbe->pages[nvbe->nr_pages],
+ 				       PAGE_SIZE, PCI_DMA_BIDIRECTIONAL);
+ 		}
+ 		kfree(nvbe->pages);
++		kfree(nvbe->ttm_alloced);
+ 		nvbe->pages = NULL;
++		nvbe->ttm_alloced = NULL;
+ 		nvbe->nr_pages = 0;
+ 	}
+ }
+-- 
+1.5.6.5
+

Added: dists/sid/linux-2.6/debian/patches/features/all/xen/radeon-PCIe-Use-the-correct-index-field.patch
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ dists/sid/linux-2.6/debian/patches/features/all/xen/radeon-PCIe-Use-the-correct-index-field.patch	Thu Dec 23 21:23:34 2010	(r16735)
@@ -0,0 +1,35 @@
+From 95e42c51203e87c247d6d601c63b4dab0f52ba5d Mon Sep 17 00:00:00 2001
+From: Konrad Rzeszutek Wilk <konrad.wilk at oracle.com>
+Date: Fri, 3 Dec 2010 15:30:27 -0500
+Subject: [PATCH] radeon/PCIe: Use the correct index field.
+
+We were using the wrong index field causing us to ignore
+when DMA addresses were passed in.
+
+Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk at oracle.com>
+Signed-off-by: Ian Campbell <ian.campbell at citrix.com>
+(cherry-picked from 8db353a504ed6bc4473e559cd3249830fae988aa in
+git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen.git#devel/ttm.pci-api-v2)
+---
+ drivers/gpu/drm/radeon/radeon_gart.c |    4 ++--
+ 1 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/gpu/drm/radeon/radeon_gart.c b/drivers/gpu/drm/radeon/radeon_gart.c
+index f5d513d..2f01168 100644
+--- a/drivers/gpu/drm/radeon/radeon_gart.c
++++ b/drivers/gpu/drm/radeon/radeon_gart.c
+@@ -180,9 +180,9 @@ int radeon_gart_bind(struct radeon_device *rdev, unsigned offset,
+ 	for (i = 0; i < pages; i++, p++) {
+ 		/* On TTM path, we only use the DMA API if TTM_PAGE_FLAG_DMA32
+ 		 * is requested. */
+-		if (dma_addr[p] != DMA_ERROR_CODE) {
++		if (dma_addr[i] != DMA_ERROR_CODE) {
+ 			rdev->gart.ttm_alloced[p] = true;
+-			rdev->gart.pages_addr[p] = dma_addr[p];
++			rdev->gart.pages_addr[p] = dma_addr[i];
+ 		} else {
+ 			/* we need to support large memory configurations */
+ 			/* assume that unbind have already been call on the range */
+-- 
+1.5.6.5
+

Added: dists/sid/linux-2.6/debian/patches/features/all/xen/radeon-ttm-PCIe-Use-dma_addr-if-TTM-has-set-it.patch
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ dists/sid/linux-2.6/debian/patches/features/all/xen/radeon-ttm-PCIe-Use-dma_addr-if-TTM-has-set-it.patch	Thu Dec 23 21:23:34 2010	(r16735)
@@ -0,0 +1,164 @@
+From f36895d8ad906e8fffc28a7f66012f8d77fed644 Mon Sep 17 00:00:00 2001
+From: Konrad Rzeszutek Wilk <konrad.wilk at oracle.com>
+Date: Thu, 2 Dec 2010 11:04:29 -0500
+Subject: [PATCH] radeon/ttm/PCIe: Use dma_addr if TTM has set it.
+
+If the TTM layer has used the DMA API to setup pages that are
+TTM_PAGE_FLAG_DMA32 (look at patch titled: "ttm: Utilize the dma_addr_t
+array for pages that are to in DMA32 pool."), lets use it
+when programming the GART in the PCIe type cards.
+
+This patch skips doing the pci_map_page (and pci_unmap_page) if
+there is a DMA addresses passed in for that page. If the dma_address
+is zero (or DMA_ERROR_CODE), then we continue on with our old
+behaviour.
+
+Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk at oracle.com>
+Signed-off-by: Ian Campbell <ian.campbell at citrix.com>
+(cherry picked from commit 289030bd1c000fa46388ca31bc67b223aacf90f2 in
+git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen.git#devel/ttm.pci-api-v2)
+---
+ drivers/gpu/drm/radeon/radeon.h      |    4 ++-
+ drivers/gpu/drm/radeon/radeon_gart.c |   36 ++++++++++++++++++++++++---------
+ drivers/gpu/drm/radeon/radeon_ttm.c  |    5 +++-
+ 3 files changed, 33 insertions(+), 12 deletions(-)
+
+diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h
+index cba2497..a002f3c 100644
+--- a/drivers/gpu/drm/radeon/radeon.h
++++ b/drivers/gpu/drm/radeon/radeon.h
+@@ -284,6 +284,7 @@ struct radeon_gart {
+ 	union radeon_gart_table		table;
+ 	struct page			**pages;
+ 	dma_addr_t			*pages_addr;
++	bool				*ttm_alloced;
+ 	bool				ready;
+ };
+ 
+@@ -296,7 +297,8 @@ void radeon_gart_fini(struct radeon_device *rdev);
+ void radeon_gart_unbind(struct radeon_device *rdev, unsigned offset,
+ 			int pages);
+ int radeon_gart_bind(struct radeon_device *rdev, unsigned offset,
+-		     int pages, struct page **pagelist);
++		     int pages, struct page **pagelist,
++		     dma_addr_t *dma_addr);
+ 
+ 
+ /*
+diff --git a/drivers/gpu/drm/radeon/radeon_gart.c b/drivers/gpu/drm/radeon/radeon_gart.c
+index e73d56e..f5d513d 100644
+--- a/drivers/gpu/drm/radeon/radeon_gart.c
++++ b/drivers/gpu/drm/radeon/radeon_gart.c
+@@ -148,8 +148,9 @@ void radeon_gart_unbind(struct radeon_device *rdev, unsigned offset,
+ 	p = t / (PAGE_SIZE / RADEON_GPU_PAGE_SIZE);
+ 	for (i = 0; i < pages; i++, p++) {
+ 		if (rdev->gart.pages[p]) {
+-			pci_unmap_page(rdev->pdev, rdev->gart.pages_addr[p],
+-				       PAGE_SIZE, PCI_DMA_BIDIRECTIONAL);
++			if (!rdev->gart.ttm_alloced[p])
++				pci_unmap_page(rdev->pdev, rdev->gart.pages_addr[p],
++				       		PAGE_SIZE, PCI_DMA_BIDIRECTIONAL);
+ 			rdev->gart.pages[p] = NULL;
+ 			rdev->gart.pages_addr[p] = 0;
+ 			for (j = 0; j < (PAGE_SIZE / RADEON_GPU_PAGE_SIZE); j++, t++) {
+@@ -162,7 +163,7 @@ void radeon_gart_unbind(struct radeon_device *rdev, unsigned offset,
+ }
+ 
+ int radeon_gart_bind(struct radeon_device *rdev, unsigned offset,
+-		     int pages, struct page **pagelist)
++		     int pages, struct page **pagelist, dma_addr_t *dma_addr)
+ {
+ 	unsigned t;
+ 	unsigned p;
+@@ -177,15 +178,22 @@ int radeon_gart_bind(struct radeon_device *rdev, unsigned offset,
+ 	p = t / (PAGE_SIZE / RADEON_GPU_PAGE_SIZE);
+ 
+ 	for (i = 0; i < pages; i++, p++) {
+-		/* we need to support large memory configurations */
+-		/* assume that unbind have already been call on the range */
+-		rdev->gart.pages_addr[p] = pci_map_page(rdev->pdev, pagelist[i],
++		/* On TTM path, we only use the DMA API if TTM_PAGE_FLAG_DMA32
++		 * is requested. */
++		if (dma_addr[p] != DMA_ERROR_CODE) {
++			rdev->gart.ttm_alloced[p] = true;
++			rdev->gart.pages_addr[p] = dma_addr[p];
++		} else {
++			/* we need to support large memory configurations */
++			/* assume that unbind have already been call on the range */
++			rdev->gart.pages_addr[p] = pci_map_page(rdev->pdev, pagelist[i],
+ 							0, PAGE_SIZE,
+ 							PCI_DMA_BIDIRECTIONAL);
+-		if (pci_dma_mapping_error(rdev->pdev, rdev->gart.pages_addr[p])) {
+-			/* FIXME: failed to map page (return -ENOMEM?) */
+-			radeon_gart_unbind(rdev, offset, pages);
+-			return -ENOMEM;
++			if (pci_dma_mapping_error(rdev->pdev, rdev->gart.pages_addr[p])) {
++				/* FIXME: failed to map page (return -ENOMEM?) */
++				radeon_gart_unbind(rdev, offset, pages);
++				return -ENOMEM;
++			}
+ 		}
+ 		rdev->gart.pages[p] = pagelist[i];
+ 		page_base = rdev->gart.pages_addr[p];
+@@ -227,6 +235,12 @@ int radeon_gart_init(struct radeon_device *rdev)
+ 		radeon_gart_fini(rdev);
+ 		return -ENOMEM;
+ 	}
++	rdev->gart.ttm_alloced = kzalloc(sizeof(bool) *
++					rdev->gart.num_cpu_pages, GFP_KERNEL);
++	if (rdev->gart.ttm_alloced == NULL) {
++		radeon_gart_fini(rdev);
++		return -ENOMEM;
++	}
+ 	return 0;
+ }
+ 
+@@ -239,6 +253,8 @@ void radeon_gart_fini(struct radeon_device *rdev)
+ 	rdev->gart.ready = false;
+ 	kfree(rdev->gart.pages);
+ 	kfree(rdev->gart.pages_addr);
++	kfree(rdev->gart.ttm_alloced);
+ 	rdev->gart.pages = NULL;
+ 	rdev->gart.pages_addr = NULL;
++	rdev->gart.ttm_alloced = NULL;
+ }
+diff --git a/drivers/gpu/drm/radeon/radeon_ttm.c b/drivers/gpu/drm/radeon/radeon_ttm.c
+index 70c2402..10d24bb 100644
+--- a/drivers/gpu/drm/radeon/radeon_ttm.c
++++ b/drivers/gpu/drm/radeon/radeon_ttm.c
+@@ -618,6 +618,7 @@ struct radeon_ttm_backend {
+ 	unsigned long			num_pages;
+ 	struct page			**pages;
+ 	struct page			*dummy_read_page;
++	dma_addr_t			*dma_addrs;
+ 	bool				populated;
+ 	bool				bound;
+ 	unsigned			offset;
+@@ -633,6 +634,7 @@ static int radeon_ttm_backend_populate(struct ttm_backend *backend,
+ 
+ 	gtt = container_of(backend, struct radeon_ttm_backend, backend);
+ 	gtt->pages = pages;
++	gtt->dma_addrs = dma_addrs;
+ 	gtt->num_pages = num_pages;
+ 	gtt->dummy_read_page = dummy_read_page;
+ 	gtt->populated = true;
+@@ -645,6 +647,7 @@ static void radeon_ttm_backend_clear(struct ttm_backend *backend)
+ 
+ 	gtt = container_of(backend, struct radeon_ttm_backend, backend);
+ 	gtt->pages = NULL;
++	gtt->dma_addrs = NULL;
+ 	gtt->num_pages = 0;
+ 	gtt->dummy_read_page = NULL;
+ 	gtt->populated = false;
+@@ -664,7 +667,7 @@ static int radeon_ttm_backend_bind(struct ttm_backend *backend,
+ 		WARN(1, "nothing to bind %lu pages for mreg %p back %p!\n", gtt->num_pages, bo_mem, backend);
+ 	}
+ 	r = radeon_gart_bind(gtt->rdev, gtt->offset,
+-			     gtt->num_pages, gtt->pages);
++			     gtt->num_pages, gtt->pages, gtt->dma_addrs);
+ 	if (r) {
+ 		DRM_ERROR("failed to bind %lu pages at 0x%08X\n",
+ 			  gtt->num_pages, gtt->offset);
+-- 
+1.5.6.5
+

Added: dists/sid/linux-2.6/debian/patches/features/all/xen/ttm-Change-VMA-flags-if-they-to-the-TTM-flags.patch
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ dists/sid/linux-2.6/debian/patches/features/all/xen/ttm-Change-VMA-flags-if-they-to-the-TTM-flags.patch	Thu Dec 23 21:23:34 2010	(r16735)
@@ -0,0 +1,71 @@
+From c54d5aa10b7a96d182c6dff5160834a0374f9b31 Mon Sep 17 00:00:00 2001
+From: Konrad Rzeszutek Wilk <konrad.wilk at oracle.com>
+Date: Thu, 1 Jul 2010 12:33:20 -0400
+Subject: [PATCH] ttm: Change VMA flags if they != to the TTM flags.
+
+During PCI suspend the graphic cards purge their VRAM and
+move their graphic objects to the TT. They also unmap all of the
+objects, meaning that when an user application is unfrozen it will
+re-fault and call here.
+
+What this means is that the VMA for the graphic object might
+have been set for VRAM TTM but now it is with the TT (normal RAM)
+meaning that the vma->vm_flags could be inappropiate (say, VM_IO
+on TT - which is no good).
+
+Virtual Computer (http://www.virtualcomputer.com) provided this
+patch to the community.
+
+Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk at oracle.com>
+---
+ drivers/gpu/drm/ttm/ttm_bo_vm.c |   22 ++++++++++++++++++++++
+ 1 files changed, 22 insertions(+), 0 deletions(-)
+
+diff --git a/drivers/gpu/drm/ttm/ttm_bo_vm.c b/drivers/gpu/drm/ttm/ttm_bo_vm.c
+index ea3b8fb..e3555bf 100644
+--- a/drivers/gpu/drm/ttm/ttm_bo_vm.c
++++ b/drivers/gpu/drm/ttm/ttm_bo_vm.c
+@@ -87,6 +87,9 @@ static int ttm_bo_vm_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
+ 	bool is_iomem;
+ 	unsigned long address = (unsigned long)vmf->virtual_address;
+ 	int retval = VM_FAULT_NOPAGE;
++	bool vm_io = (vma->vm_flags & VM_IO) && VM_IO;
++	bool pte_iomap = (pgprot_val(vma->vm_page_prot) & _PAGE_IOMAP)
++			&& _PAGE_IOMAP;
+ 
+ 	/*
+ 	 * Work around locking order reversal in fault / nopfn
+@@ -158,11 +161,30 @@ static int ttm_bo_vm_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
+ 	if (is_iomem) {
+ 		vma->vm_page_prot = ttm_io_prot(bo->mem.placement,
+ 						vma->vm_page_prot);
++		if (!vm_io || !pte_iomap) {
++			vma->vm_flags |= VM_IO;
++			pgprot_val(vma->vm_page_prot) |= _PAGE_IOMAP;
++		}
+ 	} else {
+ 		ttm = bo->ttm;
+ 		vma->vm_page_prot = (bo->mem.placement & TTM_PL_FLAG_CACHED) ?
+ 		    vm_get_page_prot(vma->vm_flags) :
+ 		    ttm_io_prot(bo->mem.placement, vma->vm_page_prot);
++		/*
++		 * During PCI suspend the graphic cards purge their VRAM and
++		 * move their graphic objects to the TT. They also unmap all
++		 * of the objects, meaning that when an user application is
++		 * unfrozen it will re-fault  and call here.
++		 *
++		 * What this means is that the VMA for the graphic object might
++		 * have been set for VRAM TTM but now it is with the TT
++		 * (normal RAM) meaning that the vma->vm_flags could be
++		 * inappropiate (say, VM_IO on TT - no good).
++		 */
++		if (vm_io || pte_iomap) {
++			vma->vm_flags &= ~VM_IO;
++			pgprot_val(vma->vm_page_prot) &= ~_PAGE_IOMAP;
++		}
+ 	}
+ 
+ 	/*
+-- 
+1.5.6.5
+

Added: dists/sid/linux-2.6/debian/patches/features/all/xen/ttm-Expand-populate-to-support-an-array-of-DMA-a.patch
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ dists/sid/linux-2.6/debian/patches/features/all/xen/ttm-Expand-populate-to-support-an-array-of-DMA-a.patch	Thu Dec 23 21:23:34 2010	(r16735)
@@ -0,0 +1,126 @@
+From 3bfb518265c4f5a7828ad0d9b47db41eaf7d2ef7 Mon Sep 17 00:00:00 2001
+From: Konrad Rzeszutek Wilk <konrad.wilk at oracle.com>
+Date: Thu, 2 Dec 2010 10:24:13 -0500
+Subject: [PATCH] ttm: Expand (*populate) to support an array of DMA addresses.
+
+We pass in the array of ttm pages to be populated in the GART/MM
+of the card (or AGP). Patch titled: "ttm: Utilize the dma_addr_t array
+for pages that are to in DMA32 pool." uses the DMA API to make those
+pages have a proper DMA addresses (in the situation where
+page_to_phys or virt_to_phys do not give use the DMA (bus) address).
+
+Since we are using the DMA API on those pages, we should pass in the
+DMA address to this function so it can save it in its proper fields
+(later patches use it).
+
+This fixes the issues on AGP hardware with Xen where when
+we call (*populate), the code ends up calling agp_allocate_memory
+with AGP_USER_MEMORY, which allocates a GART but no pages.
+We then hook up the pages we want the GART to know about, but we
+do not fill the DMA address. This allows us to do so.
+
+Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk at oracle.com>
+(cherry picked from commit 860bcca9ce1b3479fd8d1a761b195b6a8511ab8a in
+git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen.git#devel/ttm.pci-api-v2)
+---
+ drivers/gpu/drm/nouveau/nouveau_sgdma.c |    3 ++-
+ drivers/gpu/drm/radeon/radeon_ttm.c     |    3 ++-
+ drivers/gpu/drm/ttm/ttm_agp_backend.c   |    3 ++-
+ drivers/gpu/drm/ttm/ttm_tt.c            |    2 +-
+ drivers/gpu/drm/vmwgfx/vmwgfx_buffer.c  |    3 ++-
+ include/drm/ttm/ttm_bo_driver.h         |    4 +++-
+ 6 files changed, 12 insertions(+), 6 deletions(-)
+
+diff --git a/drivers/gpu/drm/nouveau/nouveau_sgdma.c b/drivers/gpu/drm/nouveau/nouveau_sgdma.c
+index ed15905..351582b 100644
+--- a/drivers/gpu/drm/nouveau/nouveau_sgdma.c
++++ b/drivers/gpu/drm/nouveau/nouveau_sgdma.c
+@@ -19,7 +19,8 @@ struct nouveau_sgdma_be {
+ 
+ static int
+ nouveau_sgdma_populate(struct ttm_backend *be, unsigned long num_pages,
+-		       struct page **pages, struct page *dummy_read_page)
++		       struct page **pages, struct page *dummy_read_page,
++		       dma_addr_t *dma_addrs)
+ {
+ 	struct nouveau_sgdma_be *nvbe = (struct nouveau_sgdma_be *)be;
+ 	struct drm_device *dev = nvbe->dev;
+diff --git a/drivers/gpu/drm/radeon/radeon_ttm.c b/drivers/gpu/drm/radeon/radeon_ttm.c
+index 58b5adf..70c2402 100644
+--- a/drivers/gpu/drm/radeon/radeon_ttm.c
++++ b/drivers/gpu/drm/radeon/radeon_ttm.c
+@@ -626,7 +626,8 @@ struct radeon_ttm_backend {
+ static int radeon_ttm_backend_populate(struct ttm_backend *backend,
+ 				       unsigned long num_pages,
+ 				       struct page **pages,
+-				       struct page *dummy_read_page)
++				       struct page *dummy_read_page,
++				       dma_addr_t *dma_addrs)
+ {
+ 	struct radeon_ttm_backend *gtt;
+ 
+diff --git a/drivers/gpu/drm/ttm/ttm_agp_backend.c b/drivers/gpu/drm/ttm/ttm_agp_backend.c
+index 4648ed2..666cf2e 100644
+--- a/drivers/gpu/drm/ttm/ttm_agp_backend.c
++++ b/drivers/gpu/drm/ttm/ttm_agp_backend.c
+@@ -46,7 +46,8 @@ struct ttm_agp_backend {
+ 
+ static int ttm_agp_populate(struct ttm_backend *backend,
+ 			    unsigned long num_pages, struct page **pages,
+-			    struct page *dummy_read_page)
++			    struct page *dummy_read_page,
++			    dma_addr_t *dma_addrs)
+ {
+ 	struct ttm_agp_backend *agp_be =
+ 	    container_of(backend, struct ttm_agp_backend, backend);
+diff --git a/drivers/gpu/drm/ttm/ttm_tt.c b/drivers/gpu/drm/ttm/ttm_tt.c
+index dc257bf..37291c7 100644
+--- a/drivers/gpu/drm/ttm/ttm_tt.c
++++ b/drivers/gpu/drm/ttm/ttm_tt.c
+@@ -230,7 +230,7 @@ int ttm_tt_populate(struct ttm_tt *ttm)
+ 	}
+ 
+ 	be->func->populate(be, ttm->num_pages, ttm->pages,
+-			   ttm->dummy_read_page);
++			   ttm->dummy_read_page, ttm->dma_address);
+ 	ttm->state = tt_unbound;
+ 	return 0;
+ }
+diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_buffer.c b/drivers/gpu/drm/vmwgfx/vmwgfx_buffer.c
+index 825ebe3..0a475b4 100644
+--- a/drivers/gpu/drm/vmwgfx/vmwgfx_buffer.c
++++ b/drivers/gpu/drm/vmwgfx/vmwgfx_buffer.c
+@@ -81,7 +81,8 @@ struct vmw_ttm_backend {
+ 
+ static int vmw_ttm_populate(struct ttm_backend *backend,
+ 			    unsigned long num_pages, struct page **pages,
+-			    struct page *dummy_read_page)
++			    struct page *dummy_read_page,
++			    dma_addr_t *dma_addrs)
+ {
+ 	return 0;
+ }
+diff --git a/include/drm/ttm/ttm_bo_driver.h b/include/drm/ttm/ttm_bo_driver.h
+index 114707b..4727b73 100644
+--- a/include/drm/ttm/ttm_bo_driver.h
++++ b/include/drm/ttm/ttm_bo_driver.h
+@@ -49,13 +49,15 @@ struct ttm_backend_func {
+ 	 * @pages: Array of pointers to ttm pages.
+ 	 * @dummy_read_page: Page to be used instead of NULL pages in the
+ 	 * array @pages.
++	 * @dma_addrs: Array of DMA (bus) address of the ttm pages.
+ 	 *
+ 	 * Populate the backend with ttm pages. Depending on the backend,
+ 	 * it may or may not copy the @pages array.
+ 	 */
+ 	int (*populate) (struct ttm_backend *backend,
+ 			 unsigned long num_pages, struct page **pages,
+-			 struct page *dummy_read_page);
++			 struct page *dummy_read_page,
++			 dma_addr_t *dma_addrs);
+ 	/**
+ 	 * struct ttm_backend_func member clear
+ 	 *
+-- 
+1.5.6.5
+

Added: dists/sid/linux-2.6/debian/patches/features/all/xen/ttm-Introduce-a-placeholder-for-DMA-bus-addresses.patch
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ dists/sid/linux-2.6/debian/patches/features/all/xen/ttm-Introduce-a-placeholder-for-DMA-bus-addresses.patch	Thu Dec 23 21:23:34 2010	(r16735)
@@ -0,0 +1,125 @@
+From 1ce376e6406e408d8870d6cb49425bb498c1f184 Mon Sep 17 00:00:00 2001
+From: Konrad Rzeszutek Wilk <konrad.wilk at oracle.com>
+Date: Mon, 29 Nov 2010 13:52:18 -0500
+Subject: [PATCH] ttm: Introduce a placeholder for DMA (bus) addresses.
+
+This is right now limited to only non-pool constructs.
+
+Based on 0bffe70f91d6 from
+git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen.git#devel/ttm.pci-api-v2
+by Konrad Rzeszutek Wilk <konrad.wilk at oracle.com> but completely rewritten due
+to the absence of 1403b1a38e8b19a "drm/ttm: add pool wc/uc page allocator V3"
+in this tree.
+
+Signed-off-by: Ian Campbell <ian.campbell at citrix.com>
+---
+ drivers/gpu/drm/ttm/ttm_tt.c    |   26 ++++++++++++++++++++++----
+ include/drm/ttm/ttm_bo_driver.h |    3 +++
+ 2 files changed, 25 insertions(+), 4 deletions(-)
+
+diff --git a/drivers/gpu/drm/ttm/ttm_tt.c b/drivers/gpu/drm/ttm/ttm_tt.c
+index 48ec9aa..4ff26c6 100644
+--- a/drivers/gpu/drm/ttm/ttm_tt.c
++++ b/drivers/gpu/drm/ttm/ttm_tt.c
+@@ -49,7 +49,9 @@ static int ttm_tt_swapin(struct ttm_tt *ttm);
+ static void ttm_tt_alloc_page_directory(struct ttm_tt *ttm)
+ {
+ 	unsigned long size = ttm->num_pages * sizeof(*ttm->pages);
++	unsigned long dma_size = ttm->num_pages * sizeof(*ttm->dma_address);
+ 	ttm->pages = NULL;
++	ttm->dma_address = NULL;
+ 
+ 	if (size <= PAGE_SIZE)
+ 		ttm->pages = kzalloc(size, GFP_KERNEL);
+@@ -59,6 +61,15 @@ static void ttm_tt_alloc_page_directory(struct ttm_tt *ttm)
+ 		if (ttm->pages)
+ 			ttm->page_flags |= TTM_PAGE_FLAG_VMALLOC;
+ 	}
++
++	if (dma_size <= PAGE_SIZE)
++		ttm->dma_address = kzalloc(dma_size, GFP_KERNEL);
++
++	if (!ttm->dma_address) {
++		ttm->dma_address = vmalloc_user(dma_size);
++		if (ttm->dma_address)
++			ttm->page_flags |= TTM_PAGE_FLAG_VMALLOC_DMA;
++	}
+ }
+ 
+ static void ttm_tt_free_page_directory(struct ttm_tt *ttm)
+@@ -70,9 +81,16 @@ static void ttm_tt_free_page_directory(struct ttm_tt *ttm)
+ 		kfree(ttm->pages);
+ 	}
+ 	ttm->pages = NULL;
++	if (ttm->page_flags & TTM_PAGE_FLAG_VMALLOC_DMA) {
++		vfree(ttm->dma_address);
++		ttm->page_flags &= ~TTM_PAGE_FLAG_VMALLOC_DMA;
++	} else {
++		kfree(ttm->dma_address);
++	}
++	ttm->dma_address = NULL;
+ }
+ 
+-static struct page *ttm_tt_alloc_page(unsigned page_flags)
++static struct page *ttm_tt_alloc_page(unsigned page_flags, dma_addr_t *dma_address)
+ {
+ 	gfp_t gfp_flags = GFP_USER;
+ 
+@@ -87,7 +105,7 @@ static struct page *ttm_tt_alloc_page(unsigned page_flags)
+ 	return alloc_page(gfp_flags);
+ }
+ 
+-static void ttm_tt_free_page(struct page *page, unsigned page_flags)
++static void ttm_tt_free_page(struct page *page, unsigned page_flags, dma_addr_t *dma_address)
+ {
+ 	__free_page(page);
+ }
+@@ -136,7 +154,7 @@ static struct page *__ttm_tt_get_page(struct ttm_tt *ttm, int index)
+ 	int ret;
+ 
+ 	while (NULL == (p = ttm->pages[index])) {
+-		p = ttm_tt_alloc_page(ttm->page_flags);
++		p = ttm_tt_alloc_page(ttm->page_flags, &ttm->dma_address[index]);
+ 
+ 		if (!p)
+ 			return NULL;
+@@ -319,7 +337,7 @@ static void ttm_tt_free_alloced_pages(struct ttm_tt *ttm)
+ 				       "Leaking pages.\n");
+ 			ttm_mem_global_free_page(ttm->glob->mem_glob,
+ 						 cur_page);
+-			ttm_tt_free_page(cur_page, ttm->page_flags);
++			ttm_tt_free_page(cur_page, ttm->page_flags, &ttm->dma_address[i]);
+ 		}
+ 	}
+ 	ttm->state = tt_unpopulated;
+diff --git a/include/drm/ttm/ttm_bo_driver.h b/include/drm/ttm/ttm_bo_driver.h
+index 4c4e0f8..114707b 100644
+--- a/include/drm/ttm/ttm_bo_driver.h
++++ b/include/drm/ttm/ttm_bo_driver.h
+@@ -123,6 +123,7 @@ struct ttm_backend {
+ #define TTM_PAGE_FLAG_PERSISTANT_SWAP (1 << 5)
+ #define TTM_PAGE_FLAG_ZERO_ALLOC      (1 << 6)
+ #define TTM_PAGE_FLAG_DMA32           (1 << 7)
++#define TTM_PAGE_FLAG_VMALLOC_DMA     (1 << 8)
+ 
+ enum ttm_caching_state {
+ 	tt_uncached,
+@@ -149,6 +150,7 @@ enum ttm_caching_state {
+  * @swap_storage: Pointer to shmem struct file for swap storage.
+  * @caching_state: The current caching state of the pages.
+  * @state: The current binding state of the pages.
++ * @dma_address: The DMA (bus) addresses of the pages (if TTM_PAGE_FLAG_DMA32)
+  *
+  * This is a structure holding the pages, caching- and aperture binding
+  * status for a buffer object that isn't backed by fixed (VRAM / AGP)
+@@ -173,6 +175,7 @@ struct ttm_tt {
+ 		tt_unbound,
+ 		tt_unpopulated,
+ 	} state;
++	dma_addr_t *dma_address;
+ };
+ 
+ #define TTM_MEMTYPE_FLAG_FIXED         (1 << 0)	/* Fixed (on-card) PCI memory */
+-- 
+1.5.6.5
+

Added: dists/sid/linux-2.6/debian/patches/features/all/xen/ttm-Set-VM_IO-only-on-pages-with-TTM_MEMTYPE_FLAG_N.patch
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ dists/sid/linux-2.6/debian/patches/features/all/xen/ttm-Set-VM_IO-only-on-pages-with-TTM_MEMTYPE_FLAG_N.patch	Thu Dec 23 21:23:34 2010	(r16735)
@@ -0,0 +1,63 @@
+From 9551827190db2d34f106255f0b5bfdc452e85cd8 Mon Sep 17 00:00:00 2001
+From: Konrad Rzeszutek Wilk <konrad.wilk at oracle.com>
+Date: Mon, 26 Jul 2010 14:15:55 -0400
+Subject: [PATCH] ttm: Set VM_IO only on pages with TTM_MEMTYPE_FLAG_NEEDS_IOREMAP set.
+
+This patch is based on "[Patch RFC] ttm: nouveau accelerated on Xen
+pv-ops kernel"
+http://lists.freedesktop.org/archives/nouveau/2010-March/005326.html
+
+Under Xen, the PFN of page is virtualized. The physical addresses used
+for DMA programming needs to be the Machine Frame Number (MFN).
+Xen transparently does the correct translation using the _PAGE_IOMEM
+PTE bit. If the bit is set, Xen assumes that the backing memory is in
+the IOMEM space, and PFN equals MFN. If not set, page_to_pfn() returns
+a phantom MFN.
+
+The patch enables the ttm_bo_vm_fault() handler to behave correctly
+under Xen, and has no side-effects on normal (not under Xen) operations.
+
+The use of TTM_MEMTYPE_FLAG_NEEDS_IOREMAP in the check assumes that
+only pages which have this flag are backed by device memory or IO.
+
+Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk at oracle.com>
+Signed-off-by: Arvind R <arvino55 at gmail.com>
+---
+ drivers/gpu/drm/ttm/ttm_bo_vm.c |    7 +++++--
+ 1 files changed, 5 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/gpu/drm/ttm/ttm_bo_vm.c b/drivers/gpu/drm/ttm/ttm_bo_vm.c
+index 3dc8d6b..ea3b8fb 100644
+--- a/drivers/gpu/drm/ttm/ttm_bo_vm.c
++++ b/drivers/gpu/drm/ttm/ttm_bo_vm.c
+@@ -239,6 +239,7 @@ int ttm_bo_mmap(struct file *filp, struct vm_area_struct *vma,
+ {
+ 	struct ttm_bo_driver *driver;
+ 	struct ttm_buffer_object *bo;
++	struct ttm_mem_type_manager *man;
+ 	int ret;
+ 
+ 	read_lock(&bdev->vm_lock);
+@@ -271,7 +272,10 @@ int ttm_bo_mmap(struct file *filp, struct vm_area_struct *vma,
+ 	 */
+ 
+ 	vma->vm_private_data = bo;
+-	vma->vm_flags |= VM_RESERVED | VM_IO | VM_MIXEDMAP | VM_DONTEXPAND;
++	vma->vm_flags |= VM_RESERVED | VM_MIXEDMAP | VM_DONTEXPAND;
++	man = &bdev->man[bo->mem.mem_type];
++	if (man->flags & TTM_MEMTYPE_FLAG_NEEDS_IOREMAP)
++		vma->vm_flags |= VM_IO;
+ 	vma->vm_page_prot = vm_get_page_prot(vma->vm_flags);
+ 	return 0;
+ out_unref:
+@@ -288,7 +292,6 @@ int ttm_fbdev_mmap(struct vm_area_struct *vma, struct ttm_buffer_object *bo)
+ 	vma->vm_ops = &ttm_bo_vm_ops;
+ 	vma->vm_private_data = ttm_bo_reference(bo);
+ 	vma->vm_flags |= VM_RESERVED | VM_IO | VM_MIXEDMAP | VM_DONTEXPAND;
+-	vma->vm_page_prot = vm_get_page_prot(vma->vm_flags);
+ 	return 0;
+ }
+ EXPORT_SYMBOL(ttm_fbdev_mmap);
+-- 
+1.5.6.5
+

Added: dists/sid/linux-2.6/debian/patches/features/all/xen/ttm-Utilize-the-dma_addr_t-array-for-pages-that-are.patch
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ dists/sid/linux-2.6/debian/patches/features/all/xen/ttm-Utilize-the-dma_addr_t-array-for-pages-that-are.patch	Thu Dec 23 21:23:34 2010	(r16735)
@@ -0,0 +1,66 @@
+From 77e3d0b95d708542afa3dd3845b841268a2e0b80 Mon Sep 17 00:00:00 2001
+From: Konrad Rzeszutek Wilk <konrad.wilk at oracle.com>
+Date: Mon, 29 Nov 2010 14:03:30 -0500
+Subject: [PATCH] ttm: Utilize the dma_addr_t array for pages that are to in DMA32 pool.
+
+We only use the "if (pool == NULL)" path for right now.
+
+Based on fcba97cde2f from
+git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen.git#devel/ttm.pci-api-v2
+by Konrad Rzeszutek Wilk <konrad.wilk at oracle.com> but completely rewritten due
+to the absence of 1403b1a38e8b19a "drm/ttm: add pool wc/uc page allocator V3"
+in this tree.
+
+Signed-off-by: Ian Campbell <ian.campbell at citrix.com>
+---
+ drivers/gpu/drm/ttm/ttm_tt.c |   23 +++++++++++++++++++++--
+ 1 files changed, 21 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/gpu/drm/ttm/ttm_tt.c b/drivers/gpu/drm/ttm/ttm_tt.c
+index 4ff26c6..dc257bf 100644
+--- a/drivers/gpu/drm/ttm/ttm_tt.c
++++ b/drivers/gpu/drm/ttm/ttm_tt.c
+@@ -34,6 +34,7 @@
+ #include <linux/pagemap.h>
+ #include <linux/file.h>
+ #include <linux/swap.h>
++#include <linux/dma-mapping.h>
+ #include "drm_cache.h"
+ #include "ttm/ttm_module.h"
+ #include "ttm/ttm_bo_driver.h"
+@@ -102,12 +103,30 @@ static struct page *ttm_tt_alloc_page(unsigned page_flags, dma_addr_t *dma_addre
+ 	else
+ 		gfp_flags |= __GFP_HIGHMEM;
+ 
+-	return alloc_page(gfp_flags);
++	if ((page_flags & TTM_PAGE_FLAG_DMA32) && dma_address) {
++		void *addr;
++		addr = dma_alloc_coherent(NULL, PAGE_SIZE,
++					  dma_address,
++					  gfp_flags);
++		if (addr == NULL)
++			return NULL;
++		return virt_to_page(addr);
++	} else
++		return alloc_page(gfp_flags);
+ }
+ 
+ static void ttm_tt_free_page(struct page *page, unsigned page_flags, dma_addr_t *dma_address)
+ {
+-	__free_page(page);
++	if ((page_flags & TTM_PAGE_FLAG_DMA32) && dma_address) {
++		void *addr = page_address(page);
++		WARN_ON(!addr || !(*dma_address));
++		if (addr)
++			dma_free_coherent(NULL, PAGE_SIZE,
++					 addr,
++					 *dma_address);
++		*dma_address = 0;
++	} else
++		__free_page(page);
+ }
+ 
+ static void ttm_tt_free_user_pages(struct ttm_tt *ttm)
+-- 
+1.5.6.5
+

Modified: dists/sid/linux-2.6/debian/patches/series/30-extra
==============================================================================
--- dists/sid/linux-2.6/debian/patches/series/30-extra	Thu Dec 23 21:23:27 2010	(r16734)
+++ dists/sid/linux-2.6/debian/patches/series/30-extra	Thu Dec 23 21:23:34 2010	(r16735)
@@ -12,3 +12,13 @@
 + features/all/xen/xen-allocate-irq-descs-on-any-NUMA-node.patch featureset=xen
 + features/all/xen/xen-disable-ACPI-NUMA-for-PV-guests.patch featureset=xen
 + features/all/xen/xen-acpi-Add-cpu-hotplug-support.patch featureset=xen
++ features/all/xen/fbmem-VM_IO-set-but-not-propagated.patch featureset=xen
++ features/all/xen/ttm-Set-VM_IO-only-on-pages-with-TTM_MEMTYPE_FLAG_N.patch featureset=xen
++ features/all/xen/ttm-Change-VMA-flags-if-they-to-the-TTM-flags.patch featureset=xen
++ features/all/xen/drm-ttm-Add-ttm_tt_free_page.patch featureset=xen
++ features/all/xen/ttm-Introduce-a-placeholder-for-DMA-bus-addresses.patch featureset=xen
++ features/all/xen/ttm-Utilize-the-dma_addr_t-array-for-pages-that-are.patch featureset=xen
++ features/all/xen/ttm-Expand-populate-to-support-an-array-of-DMA-a.patch featureset=xen
++ features/all/xen/radeon-ttm-PCIe-Use-dma_addr-if-TTM-has-set-it.patch featureset=xen
++ features/all/xen/nouveau-ttm-PCIe-Use-dma_addr-if-TTM-has-set-it.patch featureset=xen
++ features/all/xen/radeon-PCIe-Use-the-correct-index-field.patch featureset=xen



More information about the Kernel-svn-changes mailing list