Merge branch 'etnaviv/next' of https://git.pengutronix.de/git/lst/linux into drm...
authorDave Airlie <airlied@redhat.com>
Wed, 28 Jun 2017 07:08:12 +0000 (17:08 +1000)
committerDave Airlie <airlied@redhat.com>
Wed, 28 Jun 2017 07:08:12 +0000 (17:08 +1000)
- a fix from Eric for synchronization with etnaviv exported dma-bufs
- thermal throttle support for newer GPU cores
- updated module clock gating to work around GPU errata
- a fix to restore userspace buffer cache performance

* 'etnaviv/next' of https://git.pengutronix.de/git/lst/linux:
  drm/etnaviv: restore ETNA_PREP_NOSYNC behaviour
  drm/etnaviv: implement cooling support for new GPU cores
  drm/etnaviv: update MLCG disables with info from newer Vivante driver
  drm/etnaviv: update common.xml.h
  drm/etnaviv: Expose our reservation object when exporting a dmabuf.

1  2 
drivers/gpu/drm/etnaviv/etnaviv_gem.c
drivers/gpu/drm/etnaviv/etnaviv_gem_prime.c

index d6fb724fc3ccc9ca8760c8590f7c963a9d134dc7,f0efc5db793f2bb8eddffaf7f3ad7920f63b1cc7..9a3bea738330208841b4e2a7a50aa73f8999c64d
@@@ -411,16 -411,20 +411,20 @@@ int etnaviv_gem_cpu_prep(struct drm_gem
        struct etnaviv_gem_object *etnaviv_obj = to_etnaviv_bo(obj);
        struct drm_device *dev = obj->dev;
        bool write = !!(op & ETNA_PREP_WRITE);
-       unsigned long remain =
-               op & ETNA_PREP_NOSYNC ? 0 : etnaviv_timeout_to_jiffies(timeout);
-       long lret;
-       lret = reservation_object_wait_timeout_rcu(etnaviv_obj->resv,
-                                                  write, true, remain);
-       if (lret < 0)
-               return lret;
-       else if (lret == 0)
-               return remain == 0 ? -EBUSY : -ETIMEDOUT;
+       int ret;
+       if (op & ETNA_PREP_NOSYNC) {
+               if (!reservation_object_test_signaled_rcu(etnaviv_obj->resv,
+                                                         write))
+                       return -EBUSY;
+       } else {
+               unsigned long remain = etnaviv_timeout_to_jiffies(timeout);
+               ret = reservation_object_wait_timeout_rcu(etnaviv_obj->resv,
+                                                         write, true, remain);
+               if (ret <= 0)
+                       return ret == 0 ? -ETIMEDOUT : ret;
+       }
  
        if (etnaviv_obj->flags & ETNA_BO_CACHED) {
                if (!etnaviv_obj->sgt) {
@@@ -748,7 -752,7 +752,7 @@@ static struct page **etnaviv_gem_userpt
        uintptr_t ptr;
        unsigned int flags = 0;
  
 -      pvec = drm_malloc_ab(npages, sizeof(struct page *));
 +      pvec = kvmalloc_array(npages, sizeof(struct page *), GFP_KERNEL);
        if (!pvec)
                return ERR_PTR(-ENOMEM);
  
  
        if (ret < 0) {
                release_pages(pvec, pinned, 0);
 -              drm_free_large(pvec);
 +              kvfree(pvec);
                return ERR_PTR(ret);
        }
  
@@@ -823,7 -827,7 +827,7 @@@ static int etnaviv_gem_userptr_get_page
        mm = get_task_mm(etnaviv_obj->userptr.task);
        pinned = 0;
        if (mm == current->mm) {
 -              pvec = drm_malloc_ab(npages, sizeof(struct page *));
 +              pvec = kvmalloc_array(npages, sizeof(struct page *), GFP_KERNEL);
                if (!pvec) {
                        mmput(mm);
                        return -ENOMEM;
                pinned = __get_user_pages_fast(etnaviv_obj->userptr.ptr, npages,
                                               !etnaviv_obj->userptr.ro, pvec);
                if (pinned < 0) {
 -                      drm_free_large(pvec);
 +                      kvfree(pvec);
                        mmput(mm);
                        return pinned;
                }
        }
  
        release_pages(pvec, pinned, 0);
 -      drm_free_large(pvec);
 +      kvfree(pvec);
  
        work = kmalloc(sizeof(*work), GFP_KERNEL);
        if (!work) {
@@@ -879,7 -883,7 +883,7 @@@ static void etnaviv_gem_userptr_release
                int npages = etnaviv_obj->base.size >> PAGE_SHIFT;
  
                release_pages(etnaviv_obj->pages, npages, 0);
 -              drm_free_large(etnaviv_obj->pages);
 +              kvfree(etnaviv_obj->pages);
        }
        put_task_struct(etnaviv_obj->userptr.task);
  }
index 367bf952f61a18e2945e505f1c14c5539336fdd9,abed6f781281d30b0444784bbb6f77ba1e233d31..e5da4f2300ba13b3450627c1f2c2239e5fe3aeb4
@@@ -87,7 -87,7 +87,7 @@@ static void etnaviv_gem_prime_release(s
         * ours, just free the array we allocated:
         */
        if (etnaviv_obj->pages)
 -              drm_free_large(etnaviv_obj->pages);
 +              kvfree(etnaviv_obj->pages);
  
        drm_prime_gem_destroy(&etnaviv_obj->base, etnaviv_obj->sgt);
  }
@@@ -128,7 -128,7 +128,7 @@@ struct drm_gem_object *etnaviv_gem_prim
        npages = size / PAGE_SIZE;
  
        etnaviv_obj->sgt = sgt;
 -      etnaviv_obj->pages = drm_malloc_ab(npages, sizeof(struct page *));
 +      etnaviv_obj->pages = kvmalloc_array(npages, sizeof(struct page *), GFP_KERNEL);
        if (!etnaviv_obj->pages) {
                ret = -ENOMEM;
                goto fail;
@@@ -150,3 -150,10 +150,10 @@@ fail
  
        return ERR_PTR(ret);
  }
+ struct reservation_object *etnaviv_gem_prime_res_obj(struct drm_gem_object *obj)
+ {
+       struct etnaviv_gem_object *etnaviv_obj = to_etnaviv_bo(obj);
+       return etnaviv_obj->resv;
+ }