diff options
-rw-r--r-- | linux-core/drm_bo.c | 7 | ||||
-rw-r--r-- | linux-core/drm_compat.c | 104 | ||||
-rw-r--r-- | linux-core/drm_compat.h | 24 | ||||
-rw-r--r-- | linux-core/drm_drv.c | 3 | ||||
-rw-r--r-- | linux-core/drm_ttm.c | 6 |
5 files changed, 2 insertions, 142 deletions
diff --git a/linux-core/drm_bo.c b/linux-core/drm_bo.c index 88b2ee66..3fb43fcb 100644 --- a/linux-core/drm_bo.c +++ b/linux-core/drm_bo.c @@ -2362,9 +2362,6 @@ int drm_bo_driver_finish(struct drm_device *dev) if (list_empty(&bm->unfenced)) DRM_DEBUG("Unfenced list was clean\n"); -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,15)) - ClearPageReserved(bm->dummy_read_page); -#endif __free_page(bm->dummy_read_page); out: @@ -2397,10 +2394,6 @@ int drm_bo_driver_init(struct drm_device *dev) goto out_unlock; } -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,15)) - SetPageReserved(bm->dummy_read_page); -#endif - /* * Initialize the system memory buffer type. * Other types need to be driver / IOCTL initialized. diff --git a/linux-core/drm_compat.c b/linux-core/drm_compat.c index 67baac5e..e90338f0 100644 --- a/linux-core/drm_compat.c +++ b/linux-core/drm_compat.c @@ -27,32 +27,6 @@ #include "drmP.h" -#if defined(CONFIG_X86) && (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,15)) - -/* - * These have bad performance in the AGP module for the indicated kernel versions. - */ - -int drm_map_page_into_agp(struct page *page) -{ - int i; - i = change_page_attr(page, 1, PAGE_KERNEL_NOCACHE); - /* Caller's responsibility to call global_flush_tlb() for - * performance reasons */ - return i; -} - -int drm_unmap_page_from_agp(struct page *page) -{ - int i; - i = change_page_attr(page, 1, PAGE_KERNEL); - /* Caller's responsibility to call global_flush_tlb() for - * performance reasons */ - return i; -} -#endif - - #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)) /* @@ -76,84 +50,8 @@ pgprot_t vm_get_page_prot(unsigned long vm_flags) #endif -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,15)) - -/* - * vm code for kernels below 2.6.15 in which version a major vm write - * occured. This implement a simple straightforward - * version similar to what's going to be - * in kernel 2.6.19+ - * Kernels below 2.6.15 use nopage whereas 2.6.19 and upwards use - * nopfn. - */ - -static struct { - spinlock_t lock; - struct page *dummy_page; - atomic_t present; -} drm_np_retry = -{SPIN_LOCK_UNLOCKED, NOPAGE_OOM, ATOMIC_INIT(0)}; - - -static struct page *drm_bo_vm_fault(struct vm_area_struct *vma, - struct fault_data *data); - - -struct page * get_nopage_retry(void) -{ - if (atomic_read(&drm_np_retry.present) == 0) { - struct page *page = alloc_page(GFP_KERNEL); - if (!page) - return NOPAGE_OOM; - spin_lock(&drm_np_retry.lock); - drm_np_retry.dummy_page = page; - atomic_set(&drm_np_retry.present,1); - spin_unlock(&drm_np_retry.lock); - } - get_page(drm_np_retry.dummy_page); - return drm_np_retry.dummy_page; -} - -void free_nopage_retry(void) -{ - if (atomic_read(&drm_np_retry.present) == 1) { - spin_lock(&drm_np_retry.lock); - __free_page(drm_np_retry.dummy_page); - drm_np_retry.dummy_page = NULL; - atomic_set(&drm_np_retry.present, 0); - spin_unlock(&drm_np_retry.lock); - } -} - -struct page *drm_bo_vm_nopage(struct vm_area_struct *vma, - unsigned long address, - int *type) -{ - struct fault_data data; - - if (type) - *type = VM_FAULT_MINOR; - - data.address = address; - data.vma = vma; - drm_bo_vm_fault(vma, &data); - switch (data.type) { - case VM_FAULT_OOM: - return NOPAGE_OOM; - case VM_FAULT_SIGBUS: - return NOPAGE_SIGBUS; - default: - break; - } - - return NOPAGE_REFAULT; -} - -#endif - #if !defined(DRM_FULL_MM_COMPAT) && \ - ((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,15)) || \ - (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19))) + (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19)) static int drm_pte_is_clear(struct vm_area_struct *vma, unsigned long addr) diff --git a/linux-core/drm_compat.h b/linux-core/drm_compat.h index 937908aa..d265ad12 100644 --- a/linux-core/drm_compat.h +++ b/linux-core/drm_compat.h @@ -152,8 +152,7 @@ #include <linux/mm.h> #include <asm/page.h> -#if ((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)) && \ - (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,15))) +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)) #define DRM_ODD_MM_COMPAT #endif @@ -184,27 +183,6 @@ extern pgprot_t vm_get_page_prot(unsigned long vm_flags); #define __GFP_DMA32 GFP_KERNEL #endif -#if defined(CONFIG_X86) && (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,15)) - -/* - * These are too slow in earlier kernels. - */ - -extern int drm_unmap_page_from_agp(struct page *page); -extern int drm_map_page_into_agp(struct page *page); - -#define map_page_into_agp drm_map_page_into_agp -#define unmap_page_from_agp drm_unmap_page_from_agp -#endif - -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,15)) -extern struct page *get_nopage_retry(void); -extern void free_nopage_retry(void); - -#define NOPAGE_REFAULT get_nopage_retry() -#endif - - #ifndef DRM_FULL_MM_COMPAT /* diff --git a/linux-core/drm_drv.c b/linux-core/drm_drv.c index a32bfa3c..c68e237c 100644 --- a/linux-core/drm_drv.c +++ b/linux-core/drm_drv.c @@ -457,9 +457,6 @@ void drm_exit(struct drm_driver *driver) idr_for_each(&drm_minors_idr, &drm_minors_cleanup, driver); } else pci_unregister_driver(&driver->pci_driver); -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,15)) - free_nopage_retry(); -#endif DRM_INFO("Module unloaded\n"); } EXPORT_SYMBOL(drm_exit); diff --git a/linux-core/drm_ttm.c b/linux-core/drm_ttm.c index 054a7ce8..cb3e7505 100644 --- a/linux-core/drm_ttm.c +++ b/linux-core/drm_ttm.c @@ -132,9 +132,6 @@ static struct page *drm_ttm_alloc_page(void) drm_free_memctl(PAGE_SIZE); return NULL; } -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,15)) - SetPageReserved(page); -#endif return page; } @@ -215,9 +212,6 @@ static void drm_ttm_free_alloced_pages(struct drm_ttm *ttm) for (i = 0; i < ttm->num_pages; ++i) { cur_page = ttm->pages + i; if (*cur_page) { -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,15)) - ClearPageReserved(*cur_page); -#endif if (page_count(*cur_page) != 1) DRM_ERROR("Erroneous page count. Leaking pages.\n"); if (page_mapped(*cur_page)) |