diff options
author | Dave Airlie <airlied@redhat.com> | 2023-12-22 06:13:36 +0300 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2023-12-22 07:36:03 +0300 |
commit | dc83fb6e38fe5a507b4d714a5dfb0902790c3b3f (patch) | |
tree | a44a1673c6501db73df0fae61194f6162ad680e5 /drivers/gpu/drm/imagination | |
parent | ea97a66a221893fb9b4d96688e759d1db2d6e683 (diff) | |
parent | 933a2a376fb3f22ba4774f74233571504ac56b02 (diff) | |
download | linux-dc83fb6e38fe5a507b4d714a5dfb0902790c3b3f.tar.xz |
Merge tag 'drm-misc-next-fixes-2023-12-21' of git://anongit.freedesktop.org/drm/drm-misc into drm-next
More fixes for the new imagination drier, a DT node refcount fix for the
new aux bridge driver and a missing header fix for the LUT management
code.
Signed-off-by: Dave Airlie <airlied@redhat.com>
From: Maxime Ripard <mripard@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/42dw6ok2g5kz5xljrw7t6lzrgafhwslgw3j4rbaaivluv24vkj@k4smx5r3y2gh
Diffstat (limited to 'drivers/gpu/drm/imagination')
-rw-r--r-- | drivers/gpu/drm/imagination/pvr_hwrt.c | 27 | ||||
-rw-r--r-- | drivers/gpu/drm/imagination/pvr_vm.c | 30 | ||||
-rw-r--r-- | drivers/gpu/drm/imagination/pvr_vm_mips.c | 6 |
3 files changed, 31 insertions, 32 deletions
diff --git a/drivers/gpu/drm/imagination/pvr_hwrt.c b/drivers/gpu/drm/imagination/pvr_hwrt.c index c4213c18489e..54f88d6c01e5 100644 --- a/drivers/gpu/drm/imagination/pvr_hwrt.c +++ b/drivers/gpu/drm/imagination/pvr_hwrt.c @@ -458,7 +458,7 @@ pvr_hwrt_dataset_create(struct pvr_file *pvr_file, struct drm_pvr_ioctl_create_hwrt_dataset_args *args) { struct pvr_hwrt_dataset *hwrt; - int err; + int err, i = 0; /* Create and fill out the kernel structure */ hwrt = kzalloc(sizeof(*hwrt), GFP_KERNEL); @@ -466,35 +466,36 @@ pvr_hwrt_dataset_create(struct pvr_file *pvr_file, if (!hwrt) return ERR_PTR(-ENOMEM); - kref_init(&hwrt->ref_count); - err = hwrt_init_kernel_structure(pvr_file, args, hwrt); if (err < 0) goto err_free; err = hwrt_init_common_fw_structure(pvr_file, args, hwrt); if (err < 0) - goto err_free; + goto err_fini_kernel_structure; - for (int i = 0; i < ARRAY_SIZE(hwrt->data); i++) { + for (; i < ARRAY_SIZE(hwrt->data); i++) { err = hwrt_data_init_fw_structure(pvr_file, hwrt, args, &args->rt_data_args[i], &hwrt->data[i]); - if (err < 0) { - i--; - /* Destroy already created structures. */ - for (; i >= 0; i--) - hwrt_data_fini_fw_structure(hwrt, i); - goto err_free; - } + if (err < 0) + goto err_fini_data_structures; hwrt->data[i].hwrt_dataset = hwrt; } + kref_init(&hwrt->ref_count); return hwrt; +err_fini_data_structures: + while (--i >= 0) + hwrt_data_fini_fw_structure(hwrt, i); + +err_fini_kernel_structure: + hwrt_fini_kernel_structure(hwrt); + err_free: - pvr_hwrt_dataset_put(hwrt); + kfree(hwrt); return ERR_PTR(err); } diff --git a/drivers/gpu/drm/imagination/pvr_vm.c b/drivers/gpu/drm/imagination/pvr_vm.c index 82690cee978c..e59517ba039e 100644 --- a/drivers/gpu/drm/imagination/pvr_vm.c +++ b/drivers/gpu/drm/imagination/pvr_vm.c @@ -556,23 +556,12 @@ pvr_vm_create_context(struct pvr_device *pvr_dev, bool is_userspace_context) if (!vm_ctx) return ERR_PTR(-ENOMEM); - drm_gem_private_object_init(&pvr_dev->base, &vm_ctx->dummy_gem, 0); - vm_ctx->pvr_dev = pvr_dev; - kref_init(&vm_ctx->ref_count); - mutex_init(&vm_ctx->lock); - - drm_gpuvm_init(&vm_ctx->gpuvm_mgr, - is_userspace_context ? "PowerVR-user-VM" : "PowerVR-FW-VM", - 0, &pvr_dev->base, &vm_ctx->dummy_gem, - 0, 1ULL << device_addr_bits, 0, 0, &pvr_vm_gpuva_ops); vm_ctx->mmu_ctx = pvr_mmu_context_create(pvr_dev); - err = PTR_ERR_OR_ZERO(&vm_ctx->mmu_ctx); - if (err) { - vm_ctx->mmu_ctx = NULL; - goto err_put_ctx; - } + err = PTR_ERR_OR_ZERO(vm_ctx->mmu_ctx); + if (err) + goto err_free; if (is_userspace_context) { err = pvr_fw_object_create(pvr_dev, sizeof(struct rogue_fwif_fwmemcontext), @@ -583,13 +572,22 @@ pvr_vm_create_context(struct pvr_device *pvr_dev, bool is_userspace_context) goto err_page_table_destroy; } + drm_gem_private_object_init(&pvr_dev->base, &vm_ctx->dummy_gem, 0); + drm_gpuvm_init(&vm_ctx->gpuvm_mgr, + is_userspace_context ? "PowerVR-user-VM" : "PowerVR-FW-VM", + 0, &pvr_dev->base, &vm_ctx->dummy_gem, + 0, 1ULL << device_addr_bits, 0, 0, &pvr_vm_gpuva_ops); + + mutex_init(&vm_ctx->lock); + kref_init(&vm_ctx->ref_count); + return vm_ctx; err_page_table_destroy: pvr_mmu_context_destroy(vm_ctx->mmu_ctx); -err_put_ctx: - pvr_vm_context_put(vm_ctx); +err_free: + kfree(vm_ctx); return ERR_PTR(err); } diff --git a/drivers/gpu/drm/imagination/pvr_vm_mips.c b/drivers/gpu/drm/imagination/pvr_vm_mips.c index 2bc7181a4c3e..b7fef3c797e6 100644 --- a/drivers/gpu/drm/imagination/pvr_vm_mips.c +++ b/drivers/gpu/drm/imagination/pvr_vm_mips.c @@ -152,8 +152,8 @@ pvr_vm_mips_map(struct pvr_device *pvr_dev, struct pvr_fw_object *fw_obj) u64 end; u32 cache_policy; u32 pte_flags; - u32 start_pfn; - u32 end_pfn; + s32 start_pfn; + s32 end_pfn; s32 pfn; int err; @@ -201,7 +201,7 @@ pvr_vm_mips_map(struct pvr_device *pvr_dev, struct pvr_fw_object *fw_obj) return 0; err_unmap_pages: - for (; pfn >= start_pfn; pfn--) + while (--pfn >= start_pfn) WRITE_ONCE(mips_data->pt[pfn], 0); pvr_mmu_flush_request_all(pvr_dev); |