Re: [PATCH 1/2] drm/msm: Disallow foreign mapping of _NO_SHARE
From: Dmitry Baryshkov
Date: Tue Mar 24 2026 - 18:39:19 EST
On Tue, Mar 24, 2026 at 03:05:17PM -0700, Rob Clark wrote:
> 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@xxxxxxxxxxxxxxxx>
> ---
> v2: Fix issue with MAP_NULL
>
> drivers/gpu/drm/msm/msm_gem_vma.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/drivers/gpu/drm/msm/msm_gem_vma.c b/drivers/gpu/drm/msm/msm_gem_vma.c
> index 1c6b0920c0d8..43d61e0919bd 100644
> --- a/drivers/gpu/drm/msm/msm_gem_vma.c
> +++ b/drivers/gpu/drm/msm/msm_gem_vma.c
> @@ -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))) {
Can this be used to spam the logs?
> + return ERR_PTR(-EINVAL);
> + }
> +
> drm_gpuvm_resv_assert_held(&vm->base);
>
> vma = kzalloc(sizeof(*vma), GFP_KERNEL);
> --
> 2.53.0
>
--
With best wishes
Dmitry