Merge branch 'master' of ../../drm into modesetting-101
authorDave Airlie <airlied@redhat.com>
Fri, 7 Mar 2008 00:59:21 +0000 (11:59 +1100)
committerDave Airlie <airlied@redhat.com>
Fri, 7 Mar 2008 00:59:21 +0000 (11:59 +1100)
linux-core/ati_pcigart.c
linux-core/drm_bo.c
linux-core/drm_compat.h
linux-core/drm_scatter.c
linux-core/drm_vm.c

index 6802963..93519e5 100644 (file)
@@ -224,6 +224,12 @@ int drm_ati_pcigart_init(struct drm_device *dev, struct drm_ati_pcigart_info *ga
                }
        }
 
+       if (gart_info->gart_table_location == DRM_ATI_GART_MAIN)
+               dma_sync_single_for_device(&dev->pdev->dev,
+                                          bus_address,
+                                          max_pages * sizeof(u32),
+                                          PCI_DMA_TODEVICE);
+
        ret = 1;
 
 #if defined(__i386__) || defined(__x86_64__)
index c41f726..1d3f87e 100644 (file)
@@ -969,7 +969,7 @@ static int drm_bo_modify_proposed_flags (struct drm_buffer_object *bo,
                return -EINVAL;
        }
 
-       if ((new_mask & DRM_BO_FLAG_NO_EVICT) && !DRM_SUSER(DRM_CURPROC)) {
+       if (bo->type != drm_bo_type_kernel && (new_mask & DRM_BO_FLAG_NO_EVICT) && !DRM_SUSER(DRM_CURPROC)) {
                DRM_ERROR("DRM_BO_FLAG_NO_EVICT is only available to priviliged processes.\n");
                return -EPERM;
        }
index 86f1159..03838a1 100644 (file)
@@ -348,4 +348,9 @@ extern struct pci_dev * pci_get_bus_and_slot(unsigned int bus, unsigned int devf
 extern void *kmap_atomic_prot_pfn(unsigned long pfn, enum km_type type,
                                  pgprot_t protection);
 #endif
+
+#if !defined(flush_agp_mappings)
+#define flush_agp_mappings() do {} while(0)
+#endif
+
 #endif
index 77b9f95..dfae4b8 100644 (file)
 
 #define DEBUG_SCATTER 0
 
+static inline void *drm_vmalloc_dma(unsigned long size)
+{
+#if defined(__powerpc__) && defined(CONFIG_NOT_COHERENT_CACHE)
+       return __vmalloc(size, GFP_KERNEL, PAGE_KERNEL | _PAGE_NO_CACHE);
+#else
+       return vmalloc_32(size);
+#endif
+}
+
 void drm_sg_cleanup(struct drm_sg_mem *entry)
 {
        struct page *page;
@@ -105,7 +114,7 @@ int drm_sg_alloc(struct drm_device *dev, struct drm_scatter_gather * request)
        }
        memset((void *)entry->busaddr, 0, pages * sizeof(*entry->busaddr));
 
-       entry->virtual = vmalloc_32(pages << PAGE_SHIFT);
+       entry->virtual = drm_vmalloc_dma(pages << PAGE_SHIFT);
        if (!entry->virtual) {
                drm_free(entry->busaddr,
                         entry->pages * sizeof(*entry->busaddr), DRM_MEM_PAGES);
index 15e1c0f..ffda828 100644 (file)
@@ -59,17 +59,27 @@ pgprot_t drm_io_prot(uint32_t map_type, struct vm_area_struct *vma)
        pgprot_val(tmp) |= _PAGE_NO_CACHE;
        if (map_type == _DRM_REGISTERS)
                pgprot_val(tmp) |= _PAGE_GUARDED;
-#endif
-#if defined(__ia64__)
+#elif defined(__ia64__)
        if (efi_range_is_wc(vma->vm_start, vma->vm_end -
                                    vma->vm_start))
                tmp = pgprot_writecombine(tmp);
        else
                tmp = pgprot_noncached(tmp);
+#elif defined(__sparc__)
+       tmp = pgprot_noncached(tmp);
 #endif
        return tmp;
 }
 
+static pgprot_t drm_dma_prot(uint32_t map_type, struct vm_area_struct *vma)
+{
+       pgprot_t tmp = vm_get_page_prot(vma->vm_flags);
+
+#if defined(__powerpc__) && defined(CONFIG_NOT_COHERENT_CACHE)
+       tmp |= _PAGE_NO_CACHE;
+#endif
+       return tmp;
+}
 
 /**
  * \c nopage method for AGP virtual memory.
@@ -628,9 +638,6 @@ static int drm_mmap_locked(struct file *filp, struct vm_area_struct *vma)
                offset = dev->driver->get_reg_ofs(dev);
                vma->vm_flags |= VM_IO; /* not in core dump */
                vma->vm_page_prot = drm_io_prot(map->type, vma);
-#ifdef __sparc__
-               vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
-#endif
                if (io_remap_pfn_range(vma, vma->vm_start,
                                       (map->offset + offset) >> PAGE_SHIFT,
                                       vma->vm_end - vma->vm_start,
@@ -649,6 +656,7 @@ static int drm_mmap_locked(struct file *filp, struct vm_area_struct *vma)
                    page_to_pfn(virt_to_page(map->handle)),
                    vma->vm_end - vma->vm_start, vma->vm_page_prot))
                        return -EAGAIN;
+               vma->vm_page_prot = drm_dma_prot(map->type, vma);
        /* fall through to _DRM_SHM */
        case _DRM_SHM:
                vma->vm_ops = &drm_vm_shm_ops;
@@ -661,6 +669,7 @@ static int drm_mmap_locked(struct file *filp, struct vm_area_struct *vma)
                vma->vm_ops = &drm_vm_sg_ops;
                vma->vm_private_data = (void *)map;
                vma->vm_flags |= VM_RESERVED;
+               vma->vm_page_prot = drm_dma_prot(map->type, vma);
                break;
        case _DRM_TTM:
                return drm_bo_mmap_locked(vma, filp, map);