diff options
Diffstat (limited to 'drivers/gpu/drm/lima')
-rw-r--r-- | drivers/gpu/drm/lima/lima_device.c | 41 | ||||
-rw-r--r-- | drivers/gpu/drm/lima/lima_drv.c | 20 | ||||
-rw-r--r-- | drivers/gpu/drm/lima/lima_gem.c | 12 | ||||
-rw-r--r-- | drivers/gpu/drm/lima/lima_gem_prime.c | 3 | ||||
-rw-r--r-- | drivers/gpu/drm/lima/lima_object.c | 9 | ||||
-rw-r--r-- | drivers/gpu/drm/lima/lima_object.h | 3 | ||||
-rw-r--r-- | drivers/gpu/drm/lima/lima_vm.h | 4 |
7 files changed, 44 insertions, 48 deletions
diff --git a/drivers/gpu/drm/lima/lima_device.c b/drivers/gpu/drm/lima/lima_device.c index 570d0e93f9a9..d86b8d81a483 100644 --- a/drivers/gpu/drm/lima/lima_device.c +++ b/drivers/gpu/drm/lima/lima_device.c @@ -80,26 +80,23 @@ const char *lima_ip_name(struct lima_ip *ip) static int lima_clk_init(struct lima_device *dev) { int err; - unsigned long bus_rate, gpu_rate; dev->clk_bus = devm_clk_get(dev->dev, "bus"); if (IS_ERR(dev->clk_bus)) { - dev_err(dev->dev, "get bus clk failed %ld\n", PTR_ERR(dev->clk_bus)); - return PTR_ERR(dev->clk_bus); + err = PTR_ERR(dev->clk_bus); + if (err != -EPROBE_DEFER) + dev_err(dev->dev, "get bus clk failed %d\n", err); + return err; } dev->clk_gpu = devm_clk_get(dev->dev, "core"); if (IS_ERR(dev->clk_gpu)) { - dev_err(dev->dev, "get core clk failed %ld\n", PTR_ERR(dev->clk_gpu)); - return PTR_ERR(dev->clk_gpu); + err = PTR_ERR(dev->clk_gpu); + if (err != -EPROBE_DEFER) + dev_err(dev->dev, "get core clk failed %d\n", err); + return err; } - bus_rate = clk_get_rate(dev->clk_bus); - dev_info(dev->dev, "bus rate = %lu\n", bus_rate); - - gpu_rate = clk_get_rate(dev->clk_gpu); - dev_info(dev->dev, "mod rate = %lu", gpu_rate); - err = clk_prepare_enable(dev->clk_bus); if (err) return err; @@ -111,11 +108,17 @@ static int lima_clk_init(struct lima_device *dev) dev->reset = devm_reset_control_get_optional(dev->dev, NULL); if (IS_ERR(dev->reset)) { err = PTR_ERR(dev->reset); + if (err != -EPROBE_DEFER) + dev_err(dev->dev, "get reset controller failed %d\n", + err); goto error_out1; } else if (dev->reset != NULL) { err = reset_control_deassert(dev->reset); - if (err) + if (err) { + dev_err(dev->dev, + "reset controller deassert failed %d\n", err); goto error_out1; + } } return 0; @@ -145,7 +148,8 @@ static int lima_regulator_init(struct lima_device *dev) dev->regulator = NULL; if (ret == -ENODEV) return 0; - dev_err(dev->dev, "failed to get regulator: %d\n", ret); + if (ret != -EPROBE_DEFER) + dev_err(dev->dev, "failed to get regulator: %d\n", ret); return ret; } @@ -291,16 +295,12 @@ int lima_device_init(struct lima_device *ldev) dma_set_coherent_mask(ldev->dev, DMA_BIT_MASK(32)); err = lima_clk_init(ldev); - if (err) { - dev_err(ldev->dev, "clk init fail %d\n", err); + if (err) return err; - } err = lima_regulator_init(ldev); - if (err) { - dev_err(ldev->dev, "regulator init fail %d\n", err); + if (err) goto err_out0; - } ldev->empty_vm = lima_vm_create(ldev); if (!ldev->empty_vm) { @@ -343,6 +343,9 @@ int lima_device_init(struct lima_device *ldev) if (err) goto err_out5; + dev_info(ldev->dev, "bus rate = %lu\n", clk_get_rate(ldev->clk_bus)); + dev_info(ldev->dev, "mod rate = %lu", clk_get_rate(ldev->clk_gpu)); + return 0; err_out5: diff --git a/drivers/gpu/drm/lima/lima_drv.c b/drivers/gpu/drm/lima/lima_drv.c index b29c26cd13b2..75ec703d22e0 100644 --- a/drivers/gpu/drm/lima/lima_drv.c +++ b/drivers/gpu/drm/lima/lima_drv.c @@ -231,13 +231,13 @@ static void lima_drm_driver_postclose(struct drm_device *dev, struct drm_file *f } static const struct drm_ioctl_desc lima_drm_driver_ioctls[] = { - DRM_IOCTL_DEF_DRV(LIMA_GET_PARAM, lima_ioctl_get_param, DRM_AUTH|DRM_RENDER_ALLOW), - DRM_IOCTL_DEF_DRV(LIMA_GEM_CREATE, lima_ioctl_gem_create, DRM_AUTH|DRM_RENDER_ALLOW), - DRM_IOCTL_DEF_DRV(LIMA_GEM_INFO, lima_ioctl_gem_info, DRM_AUTH|DRM_RENDER_ALLOW), - DRM_IOCTL_DEF_DRV(LIMA_GEM_SUBMIT, lima_ioctl_gem_submit, DRM_AUTH|DRM_RENDER_ALLOW), - DRM_IOCTL_DEF_DRV(LIMA_GEM_WAIT, lima_ioctl_gem_wait, DRM_AUTH|DRM_RENDER_ALLOW), - DRM_IOCTL_DEF_DRV(LIMA_CTX_CREATE, lima_ioctl_ctx_create, DRM_AUTH|DRM_RENDER_ALLOW), - DRM_IOCTL_DEF_DRV(LIMA_CTX_FREE, lima_ioctl_ctx_free, DRM_AUTH|DRM_RENDER_ALLOW), + DRM_IOCTL_DEF_DRV(LIMA_GET_PARAM, lima_ioctl_get_param, DRM_RENDER_ALLOW), + DRM_IOCTL_DEF_DRV(LIMA_GEM_CREATE, lima_ioctl_gem_create, DRM_RENDER_ALLOW), + DRM_IOCTL_DEF_DRV(LIMA_GEM_INFO, lima_ioctl_gem_info, DRM_RENDER_ALLOW), + DRM_IOCTL_DEF_DRV(LIMA_GEM_SUBMIT, lima_ioctl_gem_submit, DRM_RENDER_ALLOW), + DRM_IOCTL_DEF_DRV(LIMA_GEM_WAIT, lima_ioctl_gem_wait, DRM_RENDER_ALLOW), + DRM_IOCTL_DEF_DRV(LIMA_CTX_CREATE, lima_ioctl_ctx_create, DRM_RENDER_ALLOW), + DRM_IOCTL_DEF_DRV(LIMA_CTX_FREE, lima_ioctl_ctx_free, DRM_RENDER_ALLOW), }; static const struct file_operations lima_drm_driver_fops = { @@ -252,7 +252,7 @@ static const struct file_operations lima_drm_driver_fops = { }; static struct drm_driver lima_drm_driver = { - .driver_features = DRIVER_RENDER | DRIVER_GEM | DRIVER_PRIME | DRIVER_SYNCOBJ, + .driver_features = DRIVER_RENDER | DRIVER_GEM | DRIVER_SYNCOBJ, .open = lima_drm_driver_open, .postclose = lima_drm_driver_postclose, .ioctls = lima_drm_driver_ioctls, @@ -307,10 +307,8 @@ static int lima_pdev_probe(struct platform_device *pdev) ldev->ddev = ddev; err = lima_device_init(ldev); - if (err) { - dev_err(&pdev->dev, "Fatal error during GPU init\n"); + if (err) goto err_out1; - } /* * Register the DRM device with the core and the connectors with diff --git a/drivers/gpu/drm/lima/lima_gem.c b/drivers/gpu/drm/lima/lima_gem.c index 477c0f766663..4da21353c3a2 100644 --- a/drivers/gpu/drm/lima/lima_gem.c +++ b/drivers/gpu/drm/lima/lima_gem.c @@ -24,7 +24,7 @@ int lima_gem_create_handle(struct drm_device *dev, struct drm_file *file, struct lima_bo *bo; struct lima_device *ldev = to_lima_dev(dev); - bo = lima_bo_create(ldev, size, flags, NULL, NULL); + bo = lima_bo_create(ldev, size, flags, NULL); if (IS_ERR(bo)) return PTR_ERR(bo); @@ -136,7 +136,7 @@ static int lima_gem_sync_bo(struct lima_sched_task *task, struct lima_bo *bo, int err = 0; if (!write) { - err = reservation_object_reserve_shared(bo->gem.resv, 1); + err = dma_resv_reserve_shared(bo->gem.resv, 1); if (err) return err; } @@ -296,9 +296,9 @@ int lima_gem_submit(struct drm_file *file, struct lima_submit *submit) for (i = 0; i < submit->nr_bos; i++) { if (submit->bos[i].flags & LIMA_SUBMIT_BO_WRITE) - reservation_object_add_excl_fence(bos[i]->gem.resv, fence); + dma_resv_add_excl_fence(bos[i]->gem.resv, fence); else - reservation_object_add_shared_fence(bos[i]->gem.resv, fence); + dma_resv_add_shared_fence(bos[i]->gem.resv, fence); } lima_gem_unlock_bos(bos, submit->nr_bos, &ctx); @@ -341,8 +341,8 @@ int lima_gem_wait(struct drm_file *file, u32 handle, u32 op, s64 timeout_ns) timeout = drm_timeout_abs_to_jiffies(timeout_ns); - ret = drm_gem_reservation_object_wait(file, handle, write, timeout); - if (ret == 0) + ret = drm_gem_dma_resv_wait(file, handle, write, timeout); + if (ret == -ETIME) ret = timeout ? -ETIMEDOUT : -EBUSY; return ret; diff --git a/drivers/gpu/drm/lima/lima_gem_prime.c b/drivers/gpu/drm/lima/lima_gem_prime.c index 9c6d9f1dba55..e3eb251e0a12 100644 --- a/drivers/gpu/drm/lima/lima_gem_prime.c +++ b/drivers/gpu/drm/lima/lima_gem_prime.c @@ -18,8 +18,7 @@ struct drm_gem_object *lima_gem_prime_import_sg_table( struct lima_device *ldev = to_lima_dev(dev); struct lima_bo *bo; - bo = lima_bo_create(ldev, attach->dmabuf->size, 0, sgt, - attach->dmabuf->resv); + bo = lima_bo_create(ldev, attach->dmabuf->size, 0, sgt); if (IS_ERR(bo)) return ERR_CAST(bo); diff --git a/drivers/gpu/drm/lima/lima_object.c b/drivers/gpu/drm/lima/lima_object.c index 5c41f859a72f..87123b1d083c 100644 --- a/drivers/gpu/drm/lima/lima_object.c +++ b/drivers/gpu/drm/lima/lima_object.c @@ -33,8 +33,7 @@ void lima_bo_destroy(struct lima_bo *bo) kfree(bo); } -static struct lima_bo *lima_bo_create_struct(struct lima_device *dev, u32 size, u32 flags, - struct reservation_object *resv) +static struct lima_bo *lima_bo_create_struct(struct lima_device *dev, u32 size, u32 flags) { struct lima_bo *bo; int err; @@ -47,7 +46,6 @@ static struct lima_bo *lima_bo_create_struct(struct lima_device *dev, u32 size, mutex_init(&bo->lock); INIT_LIST_HEAD(&bo->va); - bo->gem.resv = resv; err = drm_gem_object_init(dev->ddev, &bo->gem, size); if (err) { @@ -59,14 +57,13 @@ static struct lima_bo *lima_bo_create_struct(struct lima_device *dev, u32 size, } struct lima_bo *lima_bo_create(struct lima_device *dev, u32 size, - u32 flags, struct sg_table *sgt, - struct reservation_object *resv) + u32 flags, struct sg_table *sgt) { int i, err; size_t npages; struct lima_bo *bo, *ret; - bo = lima_bo_create_struct(dev, size, flags, resv); + bo = lima_bo_create_struct(dev, size, flags); if (IS_ERR(bo)) return bo; diff --git a/drivers/gpu/drm/lima/lima_object.h b/drivers/gpu/drm/lima/lima_object.h index 6738724afb7b..31ca2d8dc0a1 100644 --- a/drivers/gpu/drm/lima/lima_object.h +++ b/drivers/gpu/drm/lima/lima_object.h @@ -27,8 +27,7 @@ to_lima_bo(struct drm_gem_object *obj) } struct lima_bo *lima_bo_create(struct lima_device *dev, u32 size, - u32 flags, struct sg_table *sgt, - struct reservation_object *resv); + u32 flags, struct sg_table *sgt); void lima_bo_destroy(struct lima_bo *bo); void *lima_bo_vmap(struct lima_bo *bo); void lima_bo_vunmap(struct lima_bo *bo); diff --git a/drivers/gpu/drm/lima/lima_vm.h b/drivers/gpu/drm/lima/lima_vm.h index caee2f8a29b4..e0bdedcf14dd 100644 --- a/drivers/gpu/drm/lima/lima_vm.h +++ b/drivers/gpu/drm/lima/lima_vm.h @@ -15,9 +15,9 @@ #define LIMA_VM_NUM_PT_PER_BT (1 << LIMA_VM_NUM_PT_PER_BT_SHIFT) #define LIMA_VM_NUM_BT (LIMA_PAGE_ENT_NUM >> LIMA_VM_NUM_PT_PER_BT_SHIFT) -#define LIMA_VA_RESERVE_START 0xFFF00000 +#define LIMA_VA_RESERVE_START 0x0FFF00000ULL #define LIMA_VA_RESERVE_DLBU LIMA_VA_RESERVE_START -#define LIMA_VA_RESERVE_END 0x100000000 +#define LIMA_VA_RESERVE_END 0x100000000ULL struct lima_device; |