From c269d560e4d71448cfc9c2ea51eee3d5feafaad4 Mon Sep 17 00:00:00 2001 From: Thomas Hellstrom Date: Fri, 2 Feb 2007 14:47:44 +0100 Subject: Make vm handle buffer objects instead of ttm objects. Remove ttm objects. Make vm aware of PCI memory type buffer objects. (Only works for pre 2.6.16 kernels for now). --- linux-core/drm_compat.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'linux-core/drm_compat.h') diff --git a/linux-core/drm_compat.h b/linux-core/drm_compat.h index 3cb5d202..9048f021 100644 --- a/linux-core/drm_compat.h +++ b/linux-core/drm_compat.h @@ -201,8 +201,8 @@ extern int drm_map_page_into_agp(struct page *page); extern struct page *get_nopage_retry(void); extern void free_nopage_retry(void); struct fault_data; -extern struct page *drm_vm_ttm_fault(struct vm_area_struct *vma, - struct fault_data *data); +extern struct page *drm_bo_vm_fault(struct vm_area_struct *vma, + struct fault_data *data); #define NOPAGE_REFAULT get_nopage_retry() #endif @@ -230,9 +230,9 @@ struct fault_data { extern int vm_insert_pfn(struct vm_area_struct *vma, unsigned long addr, unsigned long pfn, pgprot_t pgprot); -extern struct page *drm_vm_ttm_nopage(struct vm_area_struct *vma, - unsigned long address, - int *type); +extern struct page *drm_bo_vm_nopage(struct vm_area_struct *vma, + unsigned long address, + int *type); #endif -- cgit v1.2.3 From 63f2abd721c40f1cddae555c79b4ab4c55aae006 Mon Sep 17 00:00:00 2001 From: Thomas Hellstrom Date: Fri, 2 Feb 2007 19:49:11 +0100 Subject: Make also later kernels work with buffer object vm and clean up some function names. --- linux-core/drm_compat.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'linux-core/drm_compat.h') diff --git a/linux-core/drm_compat.h b/linux-core/drm_compat.h index 9048f021..313aab85 100644 --- a/linux-core/drm_compat.h +++ b/linux-core/drm_compat.h @@ -238,7 +238,7 @@ extern struct page *drm_bo_vm_nopage(struct vm_area_struct *vma, #ifdef DRM_ODD_MM_COMPAT -struct drm_ttm; +struct drm_buffer_object; /* @@ -246,14 +246,14 @@ struct drm_ttm; * process mm pointer to the ttm mm list. Needs the ttm mutex. */ -extern int drm_ttm_add_vma(struct drm_ttm * ttm, +extern int drm_bo_add_vma(struct drm_buffer_object * bo, struct vm_area_struct *vma); /* * Delete a vma and the corresponding mm pointer from the * ttm lists. Needs the ttm mutex. */ -extern void drm_ttm_delete_vma(struct drm_ttm * ttm, - struct vm_area_struct *vma); +extern void drm_bo_delete_vma(struct drm_buffer_object * bo, + struct vm_area_struct *vma); /* * Attempts to lock all relevant mmap_sems for a ttm, while @@ -262,12 +262,12 @@ extern void drm_ttm_delete_vma(struct drm_ttm * ttm, * schedule() and try again. */ -extern int drm_ttm_lock_mm(struct drm_ttm * ttm); +extern int drm_bo_lock_kmm(struct drm_buffer_object * bo); /* * Unlock all relevant mmap_sems for a ttm. */ -extern void drm_ttm_unlock_mm(struct drm_ttm * ttm); +extern void drm_bo_unlock_kmm(struct drm_buffer_object * bo); /* * If the ttm was bound to the aperture, this function shall be called @@ -277,7 +277,7 @@ extern void drm_ttm_unlock_mm(struct drm_ttm * ttm); * releases the mmap_sems for this ttm. */ -extern void drm_ttm_finish_unmap(struct drm_ttm *ttm); +extern void drm_bo_finish_unmap(struct drm_buffer_object *bo); /* * Remap all vmas of this ttm using io_remap_pfn_range. We cannot @@ -286,14 +286,14 @@ extern void drm_ttm_finish_unmap(struct drm_ttm *ttm); * releases the mmap_sems for this ttm. */ -extern int drm_ttm_remap_bound(struct drm_ttm *ttm); +extern int drm_bo_remap_bound(struct drm_buffer_object *bo); /* * Remap a vma for a bound ttm. Call with the ttm mutex held and * the relevant mmap_sem locked. */ -extern int drm_ttm_map_bound(struct vm_area_struct *vma); +extern int drm_bo_map_bound(struct vm_area_struct *vma); #endif #endif -- cgit v1.2.3 From 7bcb62b45d18ab7b48ad3cb5d13aec3bc577678e Mon Sep 17 00:00:00 2001 From: Thomas Hellstrom Date: Wed, 14 Feb 2007 10:49:37 +0100 Subject: Rework buffer object vm code to use nopfn() for kernels >= 2.6.19. --- linux-core/drm_compat.h | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) (limited to 'linux-core/drm_compat.h') diff --git a/linux-core/drm_compat.h b/linux-core/drm_compat.h index 313aab85..0dee3564 100644 --- a/linux-core/drm_compat.h +++ b/linux-core/drm_compat.h @@ -158,11 +158,14 @@ static __inline__ void *kcalloc(size_t nmemb, size_t size, int flags) #include #include -#if ((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && \ - (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,15))) +#if ((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)) && \ + (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,15))) #define DRM_ODD_MM_COMPAT #endif +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21)) +#define DRM_FULL_MM_COMPAT +#endif /* @@ -200,18 +203,23 @@ extern int drm_map_page_into_agp(struct page *page); #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,15)) extern struct page *get_nopage_retry(void); extern void free_nopage_retry(void); -struct fault_data; -extern struct page *drm_bo_vm_fault(struct vm_area_struct *vma, - struct fault_data *data); #define NOPAGE_REFAULT get_nopage_retry() #endif +#if !defined(DRM_FULL_MM_COMPAT) && \ + ((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,15)) || \ + (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19))) + +struct fault_data; +extern struct page *drm_bo_vm_fault(struct vm_area_struct *vma, + struct fault_data *data); -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) +#endif +#ifndef DRM_FULL_MM_COMPAT /* - * Hopefully, real NOPAGE_RETRY functionality will be in 2.6.19. + * Hopefully, real NOPAGE_RETRY functionality will be in 2.6.19. * For now, just return a dummy page that we've allocated out of * static space. The page will be put by do_nopage() since we've already * filled out the pte. @@ -228,13 +236,17 @@ struct fault_data { extern int vm_insert_pfn(struct vm_area_struct *vma, unsigned long addr, - unsigned long pfn, pgprot_t pgprot); + unsigned long pfn); +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)) extern struct page *drm_bo_vm_nopage(struct vm_area_struct *vma, unsigned long address, int *type); - -#endif +#else +extern unsigned long drm_bo_vm_nopfn(struct vm_area_struct *vma, + unsigned long address); +#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)) */ +#endif /* ndef DRM_FULL_MM_COMPAT */ #ifdef DRM_ODD_MM_COMPAT -- cgit v1.2.3 From a253de2fcfa11abadd4697a9d89137adf3f35f78 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Sun, 18 Feb 2007 17:59:40 +1100 Subject: drm: remove last usage of VM_OFFSET --- linux-core/drm_compat.h | 2 -- 1 file changed, 2 deletions(-) (limited to 'linux-core/drm_compat.h') diff --git a/linux-core/drm_compat.h b/linux-core/drm_compat.h index 0dee3564..9692492d 100644 --- a/linux-core/drm_compat.h +++ b/linux-core/drm_compat.h @@ -97,8 +97,6 @@ #define __GFP_COMP 0 #endif -#define VM_OFFSET(vma) ((vma)->vm_pgoff << PAGE_SHIFT) - #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10) static inline int remap_pfn_range(struct vm_area_struct *vma, unsigned long from, unsigned long pfn, unsigned long size, pgprot_t pgprot) { -- cgit v1.2.3 From 2b7a9afa0977d4a8b21db3d436cec66e5a45764d Mon Sep 17 00:00:00 2001 From: Thomas Hellstrom Date: Thu, 22 Feb 2007 17:04:20 +0100 Subject: Some fencing cleanup. --- linux-core/drm_compat.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'linux-core/drm_compat.h') diff --git a/linux-core/drm_compat.h b/linux-core/drm_compat.h index 9692492d..7741714a 100644 --- a/linux-core/drm_compat.h +++ b/linux-core/drm_compat.h @@ -152,6 +152,13 @@ static __inline__ void *kcalloc(size_t nmemb, size_t size, int flags) (tmp);}) #endif +#ifndef list_for_each_entry_safe_reverse +#define list_for_each_entry_safe_reverse(pos, n, head, member) \ + for (pos = list_entry((head)->prev, typeof(*pos), member), \ + n = list_entry(pos->member.prev, typeof(*pos), member); \ + &pos->member != (head); \ + pos = n, n = list_entry(n->member.prev, typeof(*n), member)) +#endif #include #include -- cgit v1.2.3