Merge commit '81fd23e2b3ccf71c807e671444e8accaba98ca53' of https://git.pengutronix...
authorDave Airlie <airlied@redhat.com>
Thu, 26 Aug 2021 02:46:52 +0000 (12:46 +1000)
committerDave Airlie <airlied@redhat.com>
Thu, 26 Aug 2021 02:47:05 +0000 (12:47 +1000)
things are still slow in etnaviv land. Just one hardware support
addition for the GPU found on the NXP Layerscape LS1028A SoC from
Michael and the GEM mmap cleanup from Thomas.

Signed-off-by: Dave Airlie <airlied@redhat.com>
From: Lucas Stach <l.stach@pengutronix.de>
Link: https://patchwork.freedesktop.org/patch/msgid/4d16197fa5e4147117fea842f1ed9f0fdadb1d57.camel@pengutronix.de
drivers/gpu/drm/etnaviv/etnaviv_drv.c
drivers/gpu/drm/etnaviv/etnaviv_drv.h
drivers/gpu/drm/etnaviv/etnaviv_gem.c
drivers/gpu/drm/etnaviv/etnaviv_gem_prime.c
drivers/gpu/drm/etnaviv/etnaviv_gpu.c
drivers/gpu/drm/etnaviv/etnaviv_hwdb.c

index f0a0727..7dcc639 100644 (file)
@@ -468,17 +468,7 @@ static const struct drm_ioctl_desc etnaviv_ioctls[] = {
        ETNA_IOCTL(PM_QUERY_SIG, pm_query_sig, DRM_RENDER_ALLOW),
 };
 
-static const struct file_operations fops = {
-       .owner              = THIS_MODULE,
-       .open               = drm_open,
-       .release            = drm_release,
-       .unlocked_ioctl     = drm_ioctl,
-       .compat_ioctl       = drm_compat_ioctl,
-       .poll               = drm_poll,
-       .read               = drm_read,
-       .llseek             = no_llseek,
-       .mmap               = etnaviv_gem_mmap,
-};
+DEFINE_DRM_GEM_FOPS(fops);
 
 static const struct drm_driver etnaviv_drm_driver = {
        .driver_features    = DRIVER_GEM | DRIVER_RENDER,
@@ -487,7 +477,7 @@ static const struct drm_driver etnaviv_drm_driver = {
        .prime_handle_to_fd = drm_gem_prime_handle_to_fd,
        .prime_fd_to_handle = drm_gem_prime_fd_to_handle,
        .gem_prime_import_sg_table = etnaviv_gem_prime_import_sg_table,
-       .gem_prime_mmap     = etnaviv_gem_prime_mmap,
+       .gem_prime_mmap     = drm_gem_prime_mmap,
 #ifdef CONFIG_DEBUG_FS
        .debugfs_init       = etnaviv_debugfs_init,
 #endif
index 003288e..049ae87 100644 (file)
@@ -47,12 +47,9 @@ struct etnaviv_drm_private {
 int etnaviv_ioctl_gem_submit(struct drm_device *dev, void *data,
                struct drm_file *file);
 
-int etnaviv_gem_mmap(struct file *filp, struct vm_area_struct *vma);
 int etnaviv_gem_mmap_offset(struct drm_gem_object *obj, u64 *offset);
 struct sg_table *etnaviv_gem_prime_get_sg_table(struct drm_gem_object *obj);
 int etnaviv_gem_prime_vmap(struct drm_gem_object *obj, struct dma_buf_map *map);
-int etnaviv_gem_prime_mmap(struct drm_gem_object *obj,
-                          struct vm_area_struct *vma);
 struct drm_gem_object *etnaviv_gem_prime_import_sg_table(struct drm_device *dev,
        struct dma_buf_attachment *attach, struct sg_table *sg);
 int etnaviv_gem_prime_pin(struct drm_gem_object *obj);
index b8fa6ed..8f1b5af 100644 (file)
@@ -130,8 +130,7 @@ static int etnaviv_gem_mmap_obj(struct etnaviv_gem_object *etnaviv_obj,
 {
        pgprot_t vm_page_prot;
 
-       vma->vm_flags &= ~VM_PFNMAP;
-       vma->vm_flags |= VM_MIXEDMAP;
+       vma->vm_flags |= VM_IO | VM_MIXEDMAP | VM_DONTEXPAND | VM_DONTDUMP;
 
        vm_page_prot = vm_get_page_prot(vma->vm_flags);
 
@@ -154,19 +153,11 @@ static int etnaviv_gem_mmap_obj(struct etnaviv_gem_object *etnaviv_obj,
        return 0;
 }
 
-int etnaviv_gem_mmap(struct file *filp, struct vm_area_struct *vma)
+static int etnaviv_gem_mmap(struct drm_gem_object *obj, struct vm_area_struct *vma)
 {
-       struct etnaviv_gem_object *obj;
-       int ret;
-
-       ret = drm_gem_mmap(filp, vma);
-       if (ret) {
-               DBG("mmap failed: %d", ret);
-               return ret;
-       }
+       struct etnaviv_gem_object *etnaviv_obj = to_etnaviv_bo(obj);
 
-       obj = to_etnaviv_bo(vma->vm_private_data);
-       return obj->ops->mmap(obj, vma);
+       return etnaviv_obj->ops->mmap(etnaviv_obj, vma);
 }
 
 static vm_fault_t etnaviv_gem_fault(struct vm_fault *vmf)
@@ -567,6 +558,7 @@ static const struct drm_gem_object_funcs etnaviv_gem_object_funcs = {
        .unpin = etnaviv_gem_prime_unpin,
        .get_sg_table = etnaviv_gem_prime_get_sg_table,
        .vmap = etnaviv_gem_prime_vmap,
+       .mmap = etnaviv_gem_mmap,
        .vm_ops = &vm_ops,
 };
 
index d741b1d..6d8bed9 100644 (file)
@@ -34,19 +34,6 @@ int etnaviv_gem_prime_vmap(struct drm_gem_object *obj, struct dma_buf_map *map)
        return 0;
 }
 
-int etnaviv_gem_prime_mmap(struct drm_gem_object *obj,
-                          struct vm_area_struct *vma)
-{
-       struct etnaviv_gem_object *etnaviv_obj = to_etnaviv_bo(obj);
-       int ret;
-
-       ret = drm_gem_mmap_obj(obj, obj->size, vma);
-       if (ret < 0)
-               return ret;
-
-       return etnaviv_obj->ops->mmap(etnaviv_obj, vma);
-}
-
 int etnaviv_gem_prime_pin(struct drm_gem_object *obj)
 {
        if (!obj->import_attach) {
index 4102bce..c297fff 100644 (file)
@@ -613,6 +613,12 @@ static void etnaviv_gpu_enable_mlcg(struct etnaviv_gpu *gpu)
            etnaviv_is_model_rev(gpu, GC2000, 0x5108))
                pmc |= VIVS_PM_MODULE_CONTROLS_DISABLE_MODULE_CLOCK_GATING_TX;
 
+       /* Disable SE, RA and TX clock gating on affected core revisions. */
+       if (etnaviv_is_model_rev(gpu, GC7000, 0x6202))
+               pmc |= VIVS_PM_MODULE_CONTROLS_DISABLE_MODULE_CLOCK_GATING_SE |
+                      VIVS_PM_MODULE_CONTROLS_DISABLE_MODULE_CLOCK_GATING_RA |
+                      VIVS_PM_MODULE_CONTROLS_DISABLE_MODULE_CLOCK_GATING_TX;
+
        pmc |= VIVS_PM_MODULE_CONTROLS_DISABLE_MODULE_CLOCK_GATING_RA_HZ;
        pmc |= VIVS_PM_MODULE_CONTROLS_DISABLE_MODULE_CLOCK_GATING_RA_EZ;
 
index dfc0f53..f2fc645 100644 (file)
@@ -39,6 +39,37 @@ static const struct etnaviv_chip_identity etnaviv_chip_identities[] = {
        },
        {
                .model = 0x7000,
+               .revision = 0x6202,
+               .product_id = 0x70003,
+               .customer_id = 0,
+               .eco_id = 0,
+               .stream_count = 8,
+               .register_max = 64,
+               .thread_count = 512,
+               .shader_core_count = 2,
+               .vertex_cache_size = 16,
+               .vertex_output_buffer_size = 1024,
+               .pixel_pipes = 1,
+               .instruction_count = 512,
+               .num_constants = 320,
+               .buffer_size = 0,
+               .varyings_count = 16,
+               .features = 0xe0287cad,
+               .minor_features0 = 0xc1489eff,
+               .minor_features1 = 0xfefbfad9,
+               .minor_features2 = 0xeb9d4fbf,
+               .minor_features3 = 0xedfffced,
+               .minor_features4 = 0xdb0dafc7,
+               .minor_features5 = 0x3b5ac333,
+               .minor_features6 = 0xfccee201,
+               .minor_features7 = 0x03fffa6f,
+               .minor_features8 = 0x00e10ef0,
+               .minor_features9 = 0x0088003c,
+               .minor_features10 = 0x00004040,
+               .minor_features11 = 0x00000024,
+       },
+       {
+               .model = 0x7000,
                .revision = 0x6204,
                .product_id = ~0U,
                .customer_id = ~0U,