Keep the directory entry mapped through its cache flush. A 32-bit
HIGHMEM kernel with CONFIG_DEBUG_KMAP_LOCAL_FORCE_MAP maps even the
lowmem PD page through a temporary fixmap slot; clflush after unmapping
can then access a cleared PTE. Use kmap_local_page() under the existing
page-table spinlock and unmap only after the flush.

Fixes: 8c8f1c958ab5 ("gma500: introduce the GTT and MMU handling logic")
Signed-off-by: Gabriel Gama <[email protected]>
---
diff --git a/drivers/gpu/drm/gma500/mmu.c b/drivers/gpu/drm/gma500/mmu.c
index 
4fbc22a59ac7a9e76a373b65cd7fcf97aa1605ba..de2dd41ad23884afa486162d3fe8f9c3a4149684
 100644
--- a/drivers/gpu/drm/gma500/mmu.c
+++ b/drivers/gpu/drm/gma500/mmu.c
@@ -331,16 +331,15 @@
                        continue;
                }
 
-               v = kmap_atomic(pd->p);
+               v = kmap_local_page(pd->p);
                pd->tables[index] = pt;
                v[index] = (page_to_pfn(pt->p) << 12) | pd->pd_mask;
                pt->index = index;
-               kunmap_atomic((void *) v);
-
                if (pd->hw_context != -1) {
                        psb_mmu_clflush(pd->driver, (void *)&v[index]);
                        atomic_set(&pd->driver->needs_tlbflush, 1);
                }
+               kunmap_local(v);
        }
        pt->v = kmap_atomic(pt->p);
        return pt;

Reply via email to