]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/msm: Disallow foreign mapping of _NO_SHARE
authorRob Clark <robin.clark@oss.qualcomm.com>
Tue, 24 Mar 2026 22:05:17 +0000 (15:05 -0700)
committerRob Clark <robin.clark@oss.qualcomm.com>
Tue, 31 Mar 2026 20:47:27 +0000 (13:47 -0700)
This restriction applies to mapping of _NO_SHARE objs in the kms vm as
well as importing/exporting BOs.  Since the DPU has it's own VM, scanout
counts as "exporting" a BO from outside of it's host VM.

Signed-off-by: Rob Clark <robin.clark@oss.qualcomm.com>
Patchwork: https://patchwork.freedesktop.org/patch/713897/
Message-ID: <20260324220519.1221471-1-robin.clark@oss.qualcomm.com>

drivers/gpu/drm/msm/msm_gem_vma.c

index 1c6b0920c0d8c445349857cf6875703fecbf4f3a..43d61e0919bd899a44c06aee07d6fd99d1cc38c8 100644 (file)
@@ -373,6 +373,12 @@ msm_gem_vma_new(struct drm_gpuvm *gpuvm, struct drm_gem_object *obj,
        struct msm_gem_vma *vma;
        int ret;
 
+       /* _NO_SHARE objs cannot be mapped outside of their "host" vm: */
+       if (obj && (to_msm_bo(obj)->flags & MSM_BO_NO_SHARE) &&
+           GEM_WARN_ON(obj->resv != drm_gpuvm_resv(gpuvm))) {
+               return ERR_PTR(-EINVAL);
+       }
+
        drm_gpuvm_resv_assert_held(&vm->base);
 
        vma = kzalloc(sizeof(*vma), GFP_KERNEL);