diff options
author | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2008-03-28 17:23:07 -0400 |
---|---|---|
committer | Dave Airlie <airlied@linux.ie> | 2008-03-29 17:57:57 -0400 |
commit | 6876b3bacaaa4c73fb8752b47c84b2b7fad5422a (patch) | |
tree | b3f0a1795a3c0c66de99642ba0e1c233c872823c /drivers/char/drm/drm_vm.c | |
parent | 2b46278b6af0a4df43016f01a0741d8e0a76bfd4 (diff) |
drm: fix for non-coherent DMA PowerPC
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>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: "Luck, Tony" <tony.luck@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Dave Airlie <airlied@linux.ie>
Diffstat (limited to 'drivers/char/drm/drm_vm.c')
-rw-r--r-- | drivers/char/drm/drm_vm.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/drivers/char/drm/drm_vm.c b/drivers/char/drm/drm_vm.c index 3d65c4dcd0c6..945df72a51a9 100644 --- a/drivers/char/drm/drm_vm.c +++ b/drivers/char/drm/drm_vm.c | |||
@@ -54,13 +54,24 @@ static pgprot_t drm_io_prot(uint32_t map_type, struct vm_area_struct *vma) | |||
54 | pgprot_val(tmp) |= _PAGE_NO_CACHE; | 54 | pgprot_val(tmp) |= _PAGE_NO_CACHE; |
55 | if (map_type == _DRM_REGISTERS) | 55 | if (map_type == _DRM_REGISTERS) |
56 | pgprot_val(tmp) |= _PAGE_GUARDED; | 56 | pgprot_val(tmp) |= _PAGE_GUARDED; |
57 | #endif | 57 | #elif defined(__ia64__) |
58 | #if defined(__ia64__) | ||
59 | if (efi_range_is_wc(vma->vm_start, vma->vm_end - | 58 | if (efi_range_is_wc(vma->vm_start, vma->vm_end - |
60 | vma->vm_start)) | 59 | vma->vm_start)) |
61 | tmp = pgprot_writecombine(tmp); | 60 | tmp = pgprot_writecombine(tmp); |
62 | else | 61 | else |
63 | tmp = pgprot_noncached(tmp); | 62 | tmp = pgprot_noncached(tmp); |
63 | #elif defined(__sparc__) | ||
64 | tmp = pgprot_noncached(tmp); | ||
65 | #endif | ||
66 | return tmp; | ||
67 | } | ||
68 | |||
69 | static pgprot_t drm_dma_prot(uint32_t map_type, struct vm_area_struct *vma) | ||
70 | { | ||
71 | pgprot_t tmp = vm_get_page_prot(vma->vm_flags); | ||
72 | |||
73 | #if defined(__powerpc__) && defined(CONFIG_NOT_COHERENT_CACHE) | ||
74 | tmp |= _PAGE_NO_CACHE; | ||
64 | #endif | 75 | #endif |
65 | return tmp; | 76 | return tmp; |
66 | } | 77 | } |
@@ -603,9 +614,6 @@ static int drm_mmap_locked(struct file *filp, struct vm_area_struct *vma) | |||
603 | offset = dev->driver->get_reg_ofs(dev); | 614 | offset = dev->driver->get_reg_ofs(dev); |
604 | vma->vm_flags |= VM_IO; /* not in core dump */ | 615 | vma->vm_flags |= VM_IO; /* not in core dump */ |
605 | vma->vm_page_prot = drm_io_prot(map->type, vma); | 616 | vma->vm_page_prot = drm_io_prot(map->type, vma); |
606 | #ifdef __sparc__ | ||
607 | vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); | ||
608 | #endif | ||
609 | if (io_remap_pfn_range(vma, vma->vm_start, | 617 | if (io_remap_pfn_range(vma, vma->vm_start, |
610 | (map->offset + offset) >> PAGE_SHIFT, | 618 | (map->offset + offset) >> PAGE_SHIFT, |
611 | vma->vm_end - vma->vm_start, | 619 | vma->vm_end - vma->vm_start, |
@@ -624,6 +632,7 @@ static int drm_mmap_locked(struct file *filp, struct vm_area_struct *vma) | |||
624 | page_to_pfn(virt_to_page(map->handle)), | 632 | page_to_pfn(virt_to_page(map->handle)), |
625 | vma->vm_end - vma->vm_start, vma->vm_page_prot)) | 633 | vma->vm_end - vma->vm_start, vma->vm_page_prot)) |
626 | return -EAGAIN; | 634 | return -EAGAIN; |
635 | vma->vm_page_prot = drm_dma_prot(map->type, vma); | ||
627 | /* fall through to _DRM_SHM */ | 636 | /* fall through to _DRM_SHM */ |
628 | case _DRM_SHM: | 637 | case _DRM_SHM: |
629 | vma->vm_ops = &drm_vm_shm_ops; | 638 | vma->vm_ops = &drm_vm_shm_ops; |
@@ -631,6 +640,7 @@ static int drm_mmap_locked(struct file *filp, struct vm_area_struct *vma) | |||
631 | /* Don't let this area swap. Change when | 640 | /* Don't let this area swap. Change when |
632 | DRM_KERNEL advisory is supported. */ | 641 | DRM_KERNEL advisory is supported. */ |
633 | vma->vm_flags |= VM_RESERVED; | 642 | vma->vm_flags |= VM_RESERVED; |
643 | vma->vm_page_prot = drm_dma_prot(map->type, vma); | ||
634 | break; | 644 | break; |
635 | case _DRM_SCATTER_GATHER: | 645 | case _DRM_SCATTER_GATHER: |
636 | vma->vm_ops = &drm_vm_sg_ops; | 646 | vma->vm_ops = &drm_vm_sg_ops; |