summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/imagination
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/imagination')
-rw-r--r--drivers/gpu/drm/imagination/pvr_device.h46
-rw-r--r--drivers/gpu/drm/imagination/pvr_hwrt.c27
-rw-r--r--drivers/gpu/drm/imagination/pvr_job.c2
-rw-r--r--drivers/gpu/drm/imagination/pvr_vm.c30
-rw-r--r--drivers/gpu/drm/imagination/pvr_vm_mips.c6
5 files changed, 57 insertions, 54 deletions
diff --git a/drivers/gpu/drm/imagination/pvr_device.h b/drivers/gpu/drm/imagination/pvr_device.h
index 2ca7e535799f..ecdd5767d8ef 100644
--- a/drivers/gpu/drm/imagination/pvr_device.h
+++ b/drivers/gpu/drm/imagination/pvr_device.h
@@ -193,13 +193,14 @@ struct pvr_device {
* @queues: Queue-related fields.
*/
struct {
- /** @active: Active queue list. */
+ /** @queues.active: Active queue list. */
struct list_head active;
- /** @idle: Idle queue list. */
+ /** @queues.idle: Idle queue list. */
struct list_head idle;
- /** @lock: Lock protecting access to the active/idle lists. */
+ /** @queues.lock: Lock protecting access to the active/idle
+ * lists. */
struct mutex lock;
} queues;
@@ -207,18 +208,18 @@ struct pvr_device {
* @watchdog: Watchdog for communications with firmware.
*/
struct {
- /** @work: Work item for watchdog callback. */
+ /** @watchdog.work: Work item for watchdog callback. */
struct delayed_work work;
/**
- * @old_kccb_cmds_executed: KCCB command execution count at last
- * watchdog poll.
+ * @watchdog.old_kccb_cmds_executed: KCCB command execution
+ * count at last watchdog poll.
*/
u32 old_kccb_cmds_executed;
/**
- * @kccb_stall_count: Number of watchdog polls KCCB has been
- * stalled for.
+ * @watchdog.kccb_stall_count: Number of watchdog polls
+ * KCCB has been stalled for.
*/
u32 kccb_stall_count;
} watchdog;
@@ -227,43 +228,46 @@ struct pvr_device {
* @kccb: Circular buffer for communications with firmware.
*/
struct {
- /** @ccb: Kernel CCB. */
+ /** @kccb.ccb: Kernel CCB. */
struct pvr_ccb ccb;
- /** @rtn_q: Waitqueue for KCCB command return waiters. */
+ /** @kccb.rtn_q: Waitqueue for KCCB command return waiters. */
wait_queue_head_t rtn_q;
- /** @rtn_obj: Object representing KCCB return slots. */
+ /** @kccb.rtn_obj: Object representing KCCB return slots. */
struct pvr_fw_object *rtn_obj;
/**
- * @rtn: Pointer to CPU mapping of KCCB return slots. Must be
- * accessed by READ_ONCE()/WRITE_ONCE().
+ * @kccb.rtn: Pointer to CPU mapping of KCCB return slots.
+ * Must be accessed by READ_ONCE()/WRITE_ONCE().
*/
u32 *rtn;
- /** @slot_count: Total number of KCCB slots available. */
+ /** @kccb.slot_count: Total number of KCCB slots available. */
u32 slot_count;
- /** @reserved_count: Number of KCCB slots reserved for future use. */
+ /** @kccb.reserved_count: Number of KCCB slots reserved for
+ * future use. */
u32 reserved_count;
/**
- * @waiters: List of KCCB slot waiters.
+ * @kccb.waiters: List of KCCB slot waiters.
*/
struct list_head waiters;
- /** @fence_ctx: KCCB fence context. */
+ /** @kccb.fence_ctx: KCCB fence context. */
struct {
- /** @id: KCCB fence context ID allocated with dma_fence_context_alloc(). */
+ /** @kccb.fence_ctx.id: KCCB fence context ID
+ * allocated with dma_fence_context_alloc(). */
u64 id;
- /** @seqno: Sequence number incremented each time a fence is created. */
+ /** @kccb.fence_ctx.seqno: Sequence number incremented
+ * each time a fence is created. */
atomic_t seqno;
/**
- * @lock: Lock used to synchronize access to fences allocated by this
- * context.
+ * @kccb.fence_ctx.lock: Lock used to synchronize
+ * access to fences allocated by this context.
*/
spinlock_t lock;
} fence_ctx;
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_job.c b/drivers/gpu/drm/imagination/pvr_job.c
index 04139da6c04d..78c2f3c6dce0 100644
--- a/drivers/gpu/drm/imagination/pvr_job.c
+++ b/drivers/gpu/drm/imagination/pvr_job.c
@@ -746,7 +746,7 @@ pvr_submit_jobs(struct pvr_device *pvr_dev, struct pvr_file *pvr_file,
if (err)
goto out_job_data_cleanup;
- drm_exec_init(&exec, DRM_EXEC_INTERRUPTIBLE_WAIT | DRM_EXEC_IGNORE_DUPLICATES);
+ drm_exec_init(&exec, DRM_EXEC_INTERRUPTIBLE_WAIT | DRM_EXEC_IGNORE_DUPLICATES, 0);
xa_init_flags(&signal_array, XA_FLAGS_ALLOC);
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);