drm/ttm: powerpc: Fix Highmem cache flushing.
authorThomas Hellstrom <thellstrom@vmware.com>
Fri, 24 Jul 2009 08:22:36 +0000 (10:22 +0200)
committerDave Airlie <airlied@redhat.com>
Wed, 29 Jul 2009 05:56:32 +0000 (15:56 +1000)
Temporarily maps highmem pages while flushing to get a valid virtual
address to flush.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
drivers/gpu/drm/ttm/ttm_tt.c

index 81ab81f030a3df28029b003f0d6be4346611a875..9b2248a80cffa4d5f1b92c4534c5759db5b0550f 100644 (file)
@@ -86,10 +86,16 @@ void ttm_tt_cache_flush(struct page *pages[], unsigned long num_pages)
        unsigned long i;
 
        for (i = 0; i < num_pages; ++i) {
-               if (pages[i]) {
-                       unsigned long start = (unsigned long)page_address(pages[i]);
-                       flush_dcache_range(start, start + PAGE_SIZE);
-               }
+               struct page *page = pages[i];
+               void *page_virtual;
+
+               if (unlikely(page == NULL))
+                       continue;
+
+               page_virtual = kmap_atomic(page, KM_USER0);
+               flush_dcache_range((unsigned long) page_virtual,
+                                  (unsigned long) page_virtual + PAGE_SIZE);
+               kunmap_atomic(page_virtual, KM_USER0);
        }
 #else
        if (on_each_cpu(ttm_tt_ipi_handler, NULL, 1) != 0)