Make sure CMA (Can't map aperture) pages are mapped uncached.
authorThomas Hellstrom <thomas-at-tungstengraphics-dot-com>
Thu, 29 Mar 2007 19:33:41 +0000 (21:33 +0200)
committerThomas Hellstrom <thomas-at-tungstengraphics-dot-com>
Tue, 3 Apr 2007 08:29:14 +0000 (10:29 +0200)
(Should really make this write-combined using PATs, at some point).

linux-core/drm_compat.c
linux-core/drm_vm.c

index 2344181..9ac5658 100644 (file)
@@ -275,12 +275,14 @@ static struct page *drm_bo_vm_fault(struct vm_area_struct *vma,
                        goto out_unlock;
                }
                pfn = page_to_pfn(page);
-               vma->vm_page_prot = vm_get_page_prot(vma->vm_flags);
+               vma->vm_page_prot = (bo->mem.flags & DRM_BO_FLAG_CACHED) ?
+                       vm_get_page_prot(vma->vm_flags) :
+                       drm_io_prot(_DRM_TTM, vma);
        }
-       
+
        err = vm_insert_pfn(vma, address, pfn);
 
-       if (!err || err == -EBUSY) 
+       if (!err || err == -EBUSY)
                data->type = VM_FAULT_MINOR; 
        else
                data->type = VM_FAULT_OOM;
index 54a0849..1f905fb 100644 (file)
@@ -796,7 +796,9 @@ static unsigned long drm_bo_vm_nopfn(struct vm_area_struct *vma,
                        goto out_unlock;
                }
                pfn = page_to_pfn(page);
-               vma->vm_page_prot = vm_get_page_prot(vma->vm_flags);
+               vma->vm_page_prot = (bo->mem.flags & DRM_BO_FLAG_CACHED) ?
+                       vm_get_page_prot(vma->vm_flags) :
+                       drm_io_prot(_DRM_TTM, vma);
        }
 
        err = vm_insert_pfn(vma, address, pfn);