Linux ARM-MSM sub-architecture
 help / color / mirror / Atom feed
* [PATCH 1/2] drm/msm: Disallow foreign mapping of _NO_SHARE
@ 2026-03-24 22:05 Rob Clark
  2026-03-24 22:05 ` [PATCH 2/2] drm/msm: Fix VM_BIND UNMAP locking Rob Clark
  2026-03-24 22:20 ` [PATCH 1/2] drm/msm: Disallow foreign mapping of _NO_SHARE Dmitry Baryshkov
  0 siblings, 2 replies; 7+ messages in thread
From: Rob Clark @ 2026-03-24 22:05 UTC (permalink / raw)
  To: dri-devel
  Cc: linux-arm-msm, freedreno, Rob Clark, Dmitry Baryshkov,
	Abhinav Kumar, Jessica Zhang, Sean Paul, Marijn Suijten,
	David Airlie, Simona Vetter, open list

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>
---
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))) {
+		return ERR_PTR(-EINVAL);
+	}
+
 	drm_gpuvm_resv_assert_held(&vm->base);
 
 	vma = kzalloc(sizeof(*vma), GFP_KERNEL);
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread
* [PATCH 1/2] drm/msm: Disallow foreign mapping of _NO_SHARE
@ 2026-03-24 21:40 Rob Clark
  2026-03-24 21:40 ` [PATCH 2/2] drm/msm: Fix VM_BIND UNMAP locking Rob Clark
  0 siblings, 1 reply; 7+ messages in thread
From: Rob Clark @ 2026-03-24 21:40 UTC (permalink / raw)
  To: dri-devel
  Cc: linux-arm-msm, freedreno, Rob Clark, Dmitry Baryshkov,
	Abhinav Kumar, Jessica Zhang, Sean Paul, Marijn Suijten,
	David Airlie, Simona Vetter, open list

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>
---
 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..68a8f8f592fb 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 ((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);
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-03-25 18:56 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-24 22:05 [PATCH 1/2] drm/msm: Disallow foreign mapping of _NO_SHARE Rob Clark
2026-03-24 22:05 ` [PATCH 2/2] drm/msm: Fix VM_BIND UNMAP locking Rob Clark
2026-03-24 22:20 ` [PATCH 1/2] drm/msm: Disallow foreign mapping of _NO_SHARE Dmitry Baryshkov
2026-03-25 15:17   ` Rob Clark
2026-03-25 18:56     ` Rob Clark
  -- strict thread matches above, loose matches on Subject: below --
2026-03-24 21:40 Rob Clark
2026-03-24 21:40 ` [PATCH 2/2] drm/msm: Fix VM_BIND UNMAP locking Rob Clark
2026-03-24 21:42   ` Rob Clark

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox