]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/msm: Remove abuse of drm_exec internals
authorThomas Hellström <thomas.hellstrom@linux.intel.com>
Tue, 31 Mar 2026 09:20:20 +0000 (11:20 +0200)
committerRob Clark <robin.clark@oss.qualcomm.com>
Wed, 1 Apr 2026 03:17:23 +0000 (20:17 -0700)
The code was reading drm_exec internal state to determine whether
the drm_exec structure had been initialized or not, and therefore
needed cleaning up, relying on undocumented behaviour.

Instead add a bool to struct msm_gem_submit to indicate whether
drm_exec cleaning up is needed.

Signed-off-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Acked-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Rob Clark <rob.clark@oss.qualcomm.com>
Patchwork: https://patchwork.freedesktop.org/patch/715502/
Message-ID: <20260331092023.81616-3-thomas.hellstrom@linux.intel.com>
Signed-off-by: Rob Clark <robin.clark@oss.qualcomm.com>
drivers/gpu/drm/msm/msm_gem.h
drivers/gpu/drm/msm/msm_gem_submit.c

index 92ada1d69250d505f50d1c57de3ce211e7039f9e..d8e45ded63ea206f7b0da2aba76c568a0c9ac986 100644 (file)
@@ -452,6 +452,7 @@ struct msm_gem_submit {
        bool bos_pinned : 1;
        bool fault_dumped:1;/* Limit devcoredump dumping to one per submit */
        bool in_rb : 1;     /* "sudo" mode, copy cmds into RB */
+       bool has_exec : 1;  /* @exec is initialized. */
        struct msm_ringbuffer *ring;
        unsigned int nr_cmds;
        unsigned int nr_bos;
index 75d9f357437006ff261db148901e176eae670d41..26ea8a28be47491c31a9a12e9163268355ef63ee 100644 (file)
@@ -278,6 +278,7 @@ static int submit_lock_objects_vmbind(struct msm_gem_submit *submit)
        int ret = 0;
 
        drm_exec_init(&submit->exec, flags, submit->nr_bos);
+       submit->has_exec = true;
 
        drm_exec_until_all_locked (&submit->exec) {
                ret = drm_gpuvm_prepare_vm(submit->vm, exec, 1);
@@ -304,6 +305,7 @@ static int submit_lock_objects(struct msm_gem_submit *submit)
                return submit_lock_objects_vmbind(submit);
 
        drm_exec_init(&submit->exec, flags, submit->nr_bos);
+       submit->has_exec = true;
 
        drm_exec_until_all_locked (&submit->exec) {
                ret = drm_exec_lock_obj(&submit->exec,
@@ -523,7 +525,7 @@ static void submit_cleanup(struct msm_gem_submit *submit, bool error)
        if (error)
                submit_unpin_objects(submit);
 
-       if (submit->exec.objects)
+       if (submit->has_exec)
                drm_exec_fini(&submit->exec);
 
        /* if job wasn't enqueued to scheduler, early retirement: */