aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/agp
diff options
context:
space:
mode:
authorAndy Lutomirski <luto@amacapital.net>2013-05-13 19:58:43 -0400
committerDave Airlie <airlied@redhat.com>2013-05-30 23:37:31 -0400
commitf435046d38af631920b299455db9e95dfc06d055 (patch)
tree34ed84a701acbb024af166e553743901f0b29cc1 /drivers/char/agp
parentff47eaf24d01b5753e4964b10c606e0d711b143e (diff)
drm, agpgart: Use pgprot_writecombine for AGP maps and make the MTRR optional
I'm not sure I understand the intent of the previous behavior. mmap on /dev/agpgart and DRM_AGP maps had no cache flags set, so they would be fully cacheable. But the DRM code (most of the time) would add a write-combining MTRR that would change the effective memory type to WC. The new behavior just requests WC explicitly for all AGP maps. If there is any code out there that expects cacheable access to the AGP aperture (because the drm driver doesn't request an MTRR or because it's using /dev/agpgart directly), then it will now end up with a UC or WC mapping, depending on the architecture and PAT availability. But cacheable access to the aperture seems like it's asking for trouble, because, AIUI, the aperture is an alias of RAM. Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> Signed-off-by: Andy Lutomirski <luto@amacapital.net> Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/char/agp')
-rw-r--r--drivers/char/agp/frontend.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/char/agp/frontend.c b/drivers/char/agp/frontend.c
index 2e044338753c..1b192395a90c 100644
--- a/drivers/char/agp/frontend.c
+++ b/drivers/char/agp/frontend.c
@@ -603,7 +603,8 @@ static int agp_mmap(struct file *file, struct vm_area_struct *vma)
603 vma->vm_ops = kerninfo.vm_ops; 603 vma->vm_ops = kerninfo.vm_ops;
604 } else if (io_remap_pfn_range(vma, vma->vm_start, 604 } else if (io_remap_pfn_range(vma, vma->vm_start,
605 (kerninfo.aper_base + offset) >> PAGE_SHIFT, 605 (kerninfo.aper_base + offset) >> PAGE_SHIFT,
606 size, vma->vm_page_prot)) { 606 size,
607 pgprot_writecombine(vma->vm_page_prot))) {
607 goto out_again; 608 goto out_again;
608 } 609 }
609 mutex_unlock(&(agp_fe.agp_mutex)); 610 mutex_unlock(&(agp_fe.agp_mutex));
@@ -618,8 +619,9 @@ static int agp_mmap(struct file *file, struct vm_area_struct *vma)
618 if (kerninfo.vm_ops) { 619 if (kerninfo.vm_ops) {
619 vma->vm_ops = kerninfo.vm_ops; 620 vma->vm_ops = kerninfo.vm_ops;
620 } else if (io_remap_pfn_range(vma, vma->vm_start, 621 } else if (io_remap_pfn_range(vma, vma->vm_start,
621 kerninfo.aper_base >> PAGE_SHIFT, 622 kerninfo.aper_base >> PAGE_SHIFT,
622 size, vma->vm_page_prot)) { 623 size,
624 pgprot_writecombine(vma->vm_page_prot))) {
623 goto out_again; 625 goto out_again;
624 } 626 }
625 mutex_unlock(&(agp_fe.agp_mutex)); 627 mutex_unlock(&(agp_fe.agp_mutex));