@@ -1305,6 +1305,17 @@ static int panthor_ioctl_vm_get_state(struct drm_device *ddev, void *data,
return 0;
}
+static int panthor_ioctl_group_kick(struct drm_device *ddev, void *data,
+ struct drm_file *file)
+{
+ struct drm_panthor_group_kick *args = data;
+ struct panthor_file *pfile = file->driver_priv;
+
+ panthor_sched_kick(pfile, args->handle, args->queue_mask);
+
+ return 0;
+}
+
static int
panthor_open(struct drm_device *ddev, struct drm_file *file)
{
@@ -1375,6 +1386,7 @@ static const struct drm_ioctl_desc panthor_drm_driver_ioctls[] = {
PANTHOR_IOCTL(TILER_HEAP_CREATE, tiler_heap_create, DRM_RENDER_ALLOW),
PANTHOR_IOCTL(TILER_HEAP_DESTROY, tiler_heap_destroy, DRM_RENDER_ALLOW),
PANTHOR_IOCTL(GROUP_SUBMIT, group_submit, DRM_RENDER_ALLOW),
+ PANTHOR_IOCTL(GROUP_KICK, group_kick, DRM_RENDER_ALLOW),
};
static int panthor_mmap(struct file *filp, struct vm_area_struct *vma)
@@ -2845,6 +2845,33 @@ void panthor_sched_post_reset(struct panthor_device *ptdev, bool reset_failed)
}
}
+void panthor_sched_kick(struct panthor_file *pfile, u32 group_handle, u32 queue_mask)
+{
+ struct panthor_group_pool *gpool = pfile->groups;
+ struct panthor_scheduler *sched = pfile->ptdev->scheduler;
+ struct panthor_group *group;
+
+ group = group_get(xa_load(&gpool->xa, group_handle));
+ if (!group)
+ return;
+
+ if (!group->queue_count)
+ goto err_put_group;
+
+ mutex_lock(&sched->lock);
+
+ if (group->csg_id < 0)
+ group_schedule_locked(group, queue_mask);
+ else
+ /* All queues share same doorbell page (for now), so we just need to ding one */
+ gpu_write(pfile->ptdev, CSF_DOORBELL(group->queues[0]->doorbell_id), 1);
+
+ mutex_unlock(&sched->lock);
+
+err_put_group:
+ group_put(group);
+}
+
static void group_sync_upd_work(struct work_struct *work)
{
struct panthor_group *group =
@@ -48,5 +48,6 @@ void panthor_sched_report_mmu_fault(struct panthor_device *ptdev);
void panthor_sched_report_fw_events(struct panthor_device *ptdev, u32 events);
u8 panthor_sched_doorbell_id(struct panthor_file *pfile, u32 group_handle);
+void panthor_sched_kick(struct panthor_file *pfile, u32 group_handle, u32 queue_mask);
#endif