Commit 19ea5da0 authored by Dave Airlie's avatar Dave Airlie

Merge branch 'drm-etnaviv-next' of git://git.pengutronix.de:/git/lst/linux into drm-next

not much new stuff this time. A (micro-)optimization to allow the
hangcheck timer to be coalesced with other wakeups in the system and a
fix to handle mmaping of prime imported and userptr buffers correctly. I
don't think we have seen any actual issues going back to this yet, so I
figured it's safer to get this in via drm-next rather than smashing it
into fixes.

* 'drm-etnaviv-next' of git://git.pengutronix.de:/git/lst/linux:
  drm/etnaviv: fix mmap operations for userptr and dma-buf objects
  drm/etnaviv: take etnaviv_gem_obj in etnaviv_gem_mmap_obj
  drm/etnaviv: use deferrable timer for hangcheck handler
  timer: add setup_deferrable_timer macro
parents 2e726dc4 a10e2bde
...@@ -129,10 +129,9 @@ void etnaviv_gem_put_pages(struct etnaviv_gem_object *etnaviv_obj) ...@@ -129,10 +129,9 @@ void etnaviv_gem_put_pages(struct etnaviv_gem_object *etnaviv_obj)
/* when we start tracking the pin count, then do something here */ /* when we start tracking the pin count, then do something here */
} }
static int etnaviv_gem_mmap_obj(struct drm_gem_object *obj, static int etnaviv_gem_mmap_obj(struct etnaviv_gem_object *etnaviv_obj,
struct vm_area_struct *vma) struct vm_area_struct *vma)
{ {
struct etnaviv_gem_object *etnaviv_obj = to_etnaviv_bo(obj);
pgprot_t vm_page_prot; pgprot_t vm_page_prot;
vma->vm_flags &= ~VM_PFNMAP; vma->vm_flags &= ~VM_PFNMAP;
...@@ -151,9 +150,9 @@ static int etnaviv_gem_mmap_obj(struct drm_gem_object *obj, ...@@ -151,9 +150,9 @@ static int etnaviv_gem_mmap_obj(struct drm_gem_object *obj,
* in particular in the case of mmap'd dmabufs) * in particular in the case of mmap'd dmabufs)
*/ */
fput(vma->vm_file); fput(vma->vm_file);
get_file(obj->filp); get_file(etnaviv_obj->base.filp);
vma->vm_pgoff = 0; vma->vm_pgoff = 0;
vma->vm_file = obj->filp; vma->vm_file = etnaviv_obj->base.filp;
vma->vm_page_prot = vm_page_prot; vma->vm_page_prot = vm_page_prot;
} }
...@@ -173,7 +172,7 @@ int etnaviv_gem_mmap(struct file *filp, struct vm_area_struct *vma) ...@@ -173,7 +172,7 @@ int etnaviv_gem_mmap(struct file *filp, struct vm_area_struct *vma)
} }
obj = to_etnaviv_bo(vma->vm_private_data); obj = to_etnaviv_bo(vma->vm_private_data);
return etnaviv_gem_mmap_obj(vma->vm_private_data, vma); return obj->ops->mmap(obj, vma);
} }
int etnaviv_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf) int etnaviv_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
...@@ -545,6 +544,7 @@ static const struct etnaviv_gem_ops etnaviv_gem_shmem_ops = { ...@@ -545,6 +544,7 @@ static const struct etnaviv_gem_ops etnaviv_gem_shmem_ops = {
.get_pages = etnaviv_gem_shmem_get_pages, .get_pages = etnaviv_gem_shmem_get_pages,
.release = etnaviv_gem_shmem_release, .release = etnaviv_gem_shmem_release,
.vmap = etnaviv_gem_vmap_impl, .vmap = etnaviv_gem_vmap_impl,
.mmap = etnaviv_gem_mmap_obj,
}; };
void etnaviv_gem_free_object(struct drm_gem_object *obj) void etnaviv_gem_free_object(struct drm_gem_object *obj)
...@@ -886,10 +886,17 @@ static void etnaviv_gem_userptr_release(struct etnaviv_gem_object *etnaviv_obj) ...@@ -886,10 +886,17 @@ static void etnaviv_gem_userptr_release(struct etnaviv_gem_object *etnaviv_obj)
put_task_struct(etnaviv_obj->userptr.task); put_task_struct(etnaviv_obj->userptr.task);
} }
static int etnaviv_gem_userptr_mmap_obj(struct etnaviv_gem_object *etnaviv_obj,
struct vm_area_struct *vma)
{
return -EINVAL;
}
static const struct etnaviv_gem_ops etnaviv_gem_userptr_ops = { static const struct etnaviv_gem_ops etnaviv_gem_userptr_ops = {
.get_pages = etnaviv_gem_userptr_get_pages, .get_pages = etnaviv_gem_userptr_get_pages,
.release = etnaviv_gem_userptr_release, .release = etnaviv_gem_userptr_release,
.vmap = etnaviv_gem_vmap_impl, .vmap = etnaviv_gem_vmap_impl,
.mmap = etnaviv_gem_userptr_mmap_obj,
}; };
int etnaviv_gem_new_userptr(struct drm_device *dev, struct drm_file *file, int etnaviv_gem_new_userptr(struct drm_device *dev, struct drm_file *file,
......
...@@ -79,6 +79,7 @@ struct etnaviv_gem_ops { ...@@ -79,6 +79,7 @@ struct etnaviv_gem_ops {
int (*get_pages)(struct etnaviv_gem_object *); int (*get_pages)(struct etnaviv_gem_object *);
void (*release)(struct etnaviv_gem_object *); void (*release)(struct etnaviv_gem_object *);
void *(*vmap)(struct etnaviv_gem_object *); void *(*vmap)(struct etnaviv_gem_object *);
int (*mmap)(struct etnaviv_gem_object *, struct vm_area_struct *);
}; };
static inline bool is_active(struct etnaviv_gem_object *etnaviv_obj) static inline bool is_active(struct etnaviv_gem_object *etnaviv_obj)
......
...@@ -84,10 +84,17 @@ static void *etnaviv_gem_prime_vmap_impl(struct etnaviv_gem_object *etnaviv_obj) ...@@ -84,10 +84,17 @@ static void *etnaviv_gem_prime_vmap_impl(struct etnaviv_gem_object *etnaviv_obj)
return dma_buf_vmap(etnaviv_obj->base.import_attach->dmabuf); return dma_buf_vmap(etnaviv_obj->base.import_attach->dmabuf);
} }
static int etnaviv_gem_prime_mmap_obj(struct etnaviv_gem_object *etnaviv_obj,
struct vm_area_struct *vma)
{
return dma_buf_mmap(etnaviv_obj->base.dma_buf, vma, 0);
}
static const struct etnaviv_gem_ops etnaviv_gem_prime_ops = { static const struct etnaviv_gem_ops etnaviv_gem_prime_ops = {
/* .get_pages should never be called */ /* .get_pages should never be called */
.release = etnaviv_gem_prime_release, .release = etnaviv_gem_prime_release,
.vmap = etnaviv_gem_prime_vmap_impl, .vmap = etnaviv_gem_prime_vmap_impl,
.mmap = etnaviv_gem_prime_mmap_obj,
}; };
struct drm_gem_object *etnaviv_gem_prime_import_sg_table(struct drm_device *dev, struct drm_gem_object *etnaviv_gem_prime_import_sg_table(struct drm_device *dev,
......
...@@ -1528,8 +1528,8 @@ static int etnaviv_gpu_bind(struct device *dev, struct device *master, ...@@ -1528,8 +1528,8 @@ static int etnaviv_gpu_bind(struct device *dev, struct device *master,
INIT_WORK(&gpu->recover_work, recover_worker); INIT_WORK(&gpu->recover_work, recover_worker);
init_waitqueue_head(&gpu->fence_event); init_waitqueue_head(&gpu->fence_event);
setup_timer(&gpu->hangcheck_timer, hangcheck_handler, setup_deferrable_timer(&gpu->hangcheck_timer, hangcheck_handler,
(unsigned long)gpu); (unsigned long)gpu);
priv->gpu[priv->num_gpus++] = gpu; priv->gpu[priv->num_gpus++] = gpu;
......
...@@ -145,6 +145,8 @@ static inline void init_timer_on_stack_key(struct timer_list *timer, ...@@ -145,6 +145,8 @@ static inline void init_timer_on_stack_key(struct timer_list *timer,
#define setup_timer(timer, fn, data) \ #define setup_timer(timer, fn, data) \
__setup_timer((timer), (fn), (data), 0) __setup_timer((timer), (fn), (data), 0)
#define setup_deferrable_timer(timer, fn, data) \
__setup_timer((timer), (fn), (data), TIMER_DEFERRABLE)
#define setup_timer_on_stack(timer, fn, data) \ #define setup_timer_on_stack(timer, fn, data) \
__setup_timer_on_stack((timer), (fn), (data), 0) __setup_timer_on_stack((timer), (fn), (data), 0)
#define setup_deferrable_timer_on_stack(timer, fn, data) \ #define setup_deferrable_timer_on_stack(timer, fn, data) \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment