[PATCH] drm: Fix for non-coherent DMA PowerPC

Previous thread: by Derek Lamberty on Tuesday, March 4, 2008 - 10:42 pm. (1 message)

Next thread: Linux 2.6.25-rc4 by Linus Torvalds on Wednesday, March 5, 2008 - 1:03 am. (80 messages)
To: airlied <airlied@...>
Cc: Linux Kernel list <linux-kernel@...>, dri-devel <dri-devel@...>
Date: Wednesday, March 5, 2008 - 12:51 am

This patch fixes bits of the DRM so to make the radeon DRI work on
non-cache coherent PCI DMA variants of the PowerPC processors.

It moves the few places that needs change to wrappers to that
other architectures with similar issues can easily add their
own changes to those wrappers, at least until we have more useful
generic kernel API.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---

This version of the patch removes the use of GFP_HIGHMEM on powerpc
as our implementation of some of the DMA mapping ops on non cache
coherent platforms don't work on highmem.

Index: linux-work/drivers/char/drm/ati_pcigart.c
===================================================================
--- linux-work.orig/drivers/char/drm/ati_pcigart.c 2008-02-18 10:09:27.000000000 +1100
+++ linux-work/drivers/char/drm/ati_pcigart.c 2008-03-05 15:42:02.000000000 +1100
@@ -214,6 +214,12 @@ int drm_ati_pcigart_init(struct drm_devi
}
}

+ if (gart_info->gart_table_location == DRM_ATI_GART_MAIN)
+ dma_sync_single_for_device(&dev->pdev->dev,
+ bus_address,
+ max_pages * sizeof(u32),
+ PCI_DMA_TODEVICE);
+
ret = 1;

#if defined(__i386__) || defined(__x86_64__)
Index: linux-work/drivers/char/drm/drm_scatter.c
===================================================================
--- linux-work.orig/drivers/char/drm/drm_scatter.c 2008-02-18 10:09:27.000000000 +1100
+++ linux-work/drivers/char/drm/drm_scatter.c 2008-03-05 15:48:55.000000000 +1100
@@ -36,6 +36,15 @@

#define DEBUG_SCATTER 0

+static inline void *drm_vmalloc_dma(unsigned long size)
+{
+#if defined(__powerpc__) && defined(CONFIG_NOT_COHERENT_CACHE)
+ return __vmalloc(size, GFP_KERNEL, PAGE_KERNEL | _PAGE_NO_CACHE);
+#else
+ return vmalloc_32(size);
+#endif
+}
+
void drm_sg_cleanup(struct drm_sg_mem * entry)
{
struct page *page;
@@ -104,7 +113,7 @@ int drm_sg_alloc(struct drm_device *dev,
}
memset((void *)entry->busaddr, 0, pages * sizeof(*entr...

Previous thread: by Derek Lamberty on Tuesday, March 4, 2008 - 10:42 pm. (1 message)

Next thread: Linux 2.6.25-rc4 by Linus Torvalds on Wednesday, March 5, 2008 - 1:03 am. (80 messages)