All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Christian König" <christian.koenig@amd.com>
To: Rob Clark <robin.clark@oss.qualcomm.com>,
	dri-devel@lists.freedesktop.org
Cc: linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org,
	Jianfeng Liu <liujianfeng1994@gmail.com>,
	Dmitry Baryshkov <lumag@kernel.org>,
	Abhinav Kumar <abhinav.kumar@linux.dev>,
	Jessica Zhang <jesszhan0024@gmail.com>,
	Sean Paul <sean@poorly.run>,
	Marijn Suijten <marijn.suijten@somainline.org>,
	David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>,
	Sumit Semwal <sumit.semwal@linaro.org>,
	open list <linux-kernel@vger.kernel.org>,
	"open list:DMA BUFFER SHARING
	FRAMEWORK:Keyword:bdma_(?:buf|fence|resv)b"
	<linux-media@vger.kernel.org>,
	"moderated list:DMA BUFFER SHARING
	FRAMEWORK:Keyword:bdma_(?:buf|fence|resv)b"
	<linaro-mm-sig@lists.linaro.org>
Subject: Re: [PATCH 2/6] drm/msm/gem: Mmap imported dma-bufs via the exporter
Date: Mon, 28 Sep 2026 10:37:54 +0200	[thread overview]
Message-ID: <86ffe7f8-88f6-429f-bc4e-468fba5ed668@amd.com> (raw)
In-Reply-To: <20260926183051.25754-3-robin.clark@oss.qualcomm.com>

On 9/26/26 20:30, Rob Clark wrote:
> This was always the way it was supposed to work, and when we drop the
> page array for imported dma-bufs our fault handling path will no longer
> work.
> 
> Signed-off-by: Rob Clark <robin.clark@oss.qualcomm.com>

Nice to see that finally happening.

Reviewed-by: Christian König <christian.koenig@amd.com> for this patch here, Acked-by: Christian König <christian.koenig@amd.com> for the rest of the series.

Regards,
Christian.

> ---
>  drivers/gpu/drm/msm/msm_gem.c | 24 ++++++++++++++++++++++++
>  1 file changed, 24 insertions(+)
> 
> diff --git a/drivers/gpu/drm/msm/msm_gem.c b/drivers/gpu/drm/msm/msm_gem.c
> index e8390ebd5dd5..c90336b3b231 100644
> --- a/drivers/gpu/drm/msm/msm_gem.c
> +++ b/drivers/gpu/drm/msm/msm_gem.c
> @@ -23,6 +23,8 @@
>  #include "msm_gpu.h"
>  #include "msm_kms.h"
>  
> +MODULE_IMPORT_NS("DMA_BUF");
> +
>  static void update_device_mem(struct msm_drm_private *priv, ssize_t size)
>  {
>  	uint64_t total_mem = atomic64_add_return(size, &priv->total_mem);
> @@ -338,6 +340,9 @@ static vm_fault_t msm_gem_fault(struct vm_fault *vmf)
>  	int err;
>  	vm_fault_t ret;
>  
> +	if (drm_WARN_ON_ONCE(obj->dev, drm_gem_is_imported(obj)))
> +		return VM_FAULT_SIGBUS;
> +
>  	/*
>  	 * vm_ops.open/drm_gem_mmap_obj and close get and put
>  	 * a reference on obj. So, we dont need to hold one here.
> @@ -1126,6 +1131,25 @@ static int msm_gem_object_mmap(struct drm_gem_object *obj, struct vm_area_struct
>  {
>  	struct msm_gem_object *msm_obj = to_msm_bo(obj);
>  
> +	if (drm_gem_is_imported(obj)) {
> +		int ret;
> +
> +		/* Reset both vm_ops and vm_private_data, so we don't end up with
> +		 * vm_ops pointing to our implementation if the dma-buf backend
> +		 * doesn't set those fields.
> +		 */
> +		vma->vm_private_data = NULL;
> +		vma->vm_ops = NULL;
> +
> +		ret = dma_buf_mmap(obj->dma_buf, vma, 0);
> +
> +		/* Drop the reference drm_gem_mmap_obj() acquired.*/
> +		if (!ret)
> +			drm_gem_object_put(obj);
> +
> +		return ret;
> +	}
> +
>  	vm_flags_set(vma, VM_PFNMAP | VM_DONTEXPAND | VM_DONTDUMP);
>  	vma->vm_page_prot = msm_gem_pgprot(msm_obj, vma_get_page_prot(vma));
>  


  reply	other threads:[~2026-09-28  8:38 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-26 18:30 [PATCH 0/6] drm/msm/gem: Drop use of pages for imported dma-bufs Rob Clark
2026-09-26 18:30 ` [PATCH 1/6] drm/msm/gem: Add helper to check if resident Rob Clark
2026-09-26 18:30 ` [PATCH 2/6] drm/msm/gem: Mmap imported dma-bufs via the exporter Rob Clark
2026-09-28  8:37   ` Christian König [this message]
2026-09-26 18:30 ` [PATCH 3/6] drm/msm/gem: Use get_pages() directly in vmap path Rob Clark
2026-09-26 18:30 ` [PATCH 4/6] drm/msm/gem: Stop exposing a page array Rob Clark
2026-09-26 18:40   ` sashiko-bot
2026-09-26 18:30 ` [PATCH 5/6] drm/msm/gem: Stop calling get_pages() for imported dma-bufs Rob Clark
2026-09-26 18:43   ` sashiko-bot
2026-09-26 18:30 ` [PATCH 6/6] drm/msm/gem: Drop use of drm_prime_sg_to_page_array() Rob Clark

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86ffe7f8-88f6-429f-bc4e-468fba5ed668@amd.com \
    --to=christian.koenig@amd.com \
    --cc=abhinav.kumar@linux.dev \
    --cc=airlied@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=freedreno@lists.freedesktop.org \
    --cc=jesszhan0024@gmail.com \
    --cc=linaro-mm-sig@lists.linaro.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=liujianfeng1994@gmail.com \
    --cc=lumag@kernel.org \
    --cc=marijn.suijten@somainline.org \
    --cc=robin.clark@oss.qualcomm.com \
    --cc=sean@poorly.run \
    --cc=simona@ffwll.ch \
    --cc=sumit.semwal@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.