nouveau.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Zimmermann <tzimmermann@suse.de>
To: alexander.deucher@amd.com, christian.koenig@amd.com,
	airlied@linux.ie, daniel@ffwll.ch, bskeggs@redhat.com,
	ray.huang@amd.com, linux-graphics-maintainer@vmware.com,
	sroland@vmware.com, zackr@vmware.com, shashank.sharma@amd.com,
	sam@ravnborg.org, emil.velikov@collabora.com,
	Felix.Kuehling@amd.com, nirmoy.das@amd.com
Cc: nouveau@lists.freedesktop.org, amd-gfx@lists.freedesktop.org,
	dri-devel@lists.freedesktop.org
Subject: [Nouveau] [PATCH v4 1/7] drm/ttm: Don't override vm_ops callbacks, if set
Date: Tue, 25 May 2021 17:10:49 +0200	[thread overview]
Message-ID: <20210525151055.8174-2-tzimmermann@suse.de> (raw)
In-Reply-To: <20210525151055.8174-1-tzimmermann@suse.de>

Drivers may want to set their own callbacks for a VM area. Only set
TTM's callbacks if the vm_ops field is clear.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/ttm/ttm_bo_vm.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/ttm/ttm_bo_vm.c b/drivers/gpu/drm/ttm/ttm_bo_vm.c
index 7ff9fd551357..ff07dbc91c03 100644
--- a/drivers/gpu/drm/ttm/ttm_bo_vm.c
+++ b/drivers/gpu/drm/ttm/ttm_bo_vm.c
@@ -586,7 +586,12 @@ static struct ttm_buffer_object *ttm_bo_vm_lookup(struct ttm_device *bdev,
 
 static void ttm_bo_mmap_vma_setup(struct ttm_buffer_object *bo, struct vm_area_struct *vma)
 {
-	vma->vm_ops = &ttm_bo_vm_ops;
+	/*
+	 * Drivers may want to override the vm_ops field. Otherwise we
+	 * use TTM's default callbacks.
+	 */
+	if (!vma->vm_ops)
+		vma->vm_ops = &ttm_bo_vm_ops;
 
 	/*
 	 * Note: We're transferring the bo reference to
-- 
2.31.1

_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau

  reply	other threads:[~2021-05-25 15:11 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-25 15:10 [Nouveau] [PATCH v4 0/7] drm: Clean up mmap for TTM-based GEM drivers Thomas Zimmermann
2021-05-25 15:10 ` Thomas Zimmermann [this message]
2021-05-25 15:10 ` [Nouveau] [PATCH v4 2/7] drm/amdgpu: Implement mmap as GEM object function Thomas Zimmermann
2021-05-25 15:10 ` [Nouveau] [PATCH v4 3/7] drm/radeon: " Thomas Zimmermann
2021-05-25 15:10 ` [Nouveau] [PATCH v4 4/7] drm/nouveau: " Thomas Zimmermann
2021-05-25 15:10 ` [Nouveau] [PATCH v4 5/7] drm/vmwgfx: Inline ttm_bo_mmap() into vmwgfx driver Thomas Zimmermann
2021-05-25 15:10 ` [Nouveau] [PATCH v4 6/7] drm/vmwgfx: Inline vmw_verify_access() Thomas Zimmermann
2021-05-25 15:10 ` [Nouveau] [PATCH v4 7/7] drm/ttm: Remove ttm_bo_mmap() and friends Thomas Zimmermann
2021-05-25 15:14 ` [Nouveau] [PATCH v4 0/7] drm: Clean up mmap for TTM-based GEM drivers Thomas Zimmermann
2021-05-26 11:59 ` Christian König

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=20210525151055.8174-2-tzimmermann@suse.de \
    --to=tzimmermann@suse.de \
    --cc=Felix.Kuehling@amd.com \
    --cc=airlied@linux.ie \
    --cc=alexander.deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=bskeggs@redhat.com \
    --cc=christian.koenig@amd.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=emil.velikov@collabora.com \
    --cc=linux-graphics-maintainer@vmware.com \
    --cc=nirmoy.das@amd.com \
    --cc=nouveau@lists.freedesktop.org \
    --cc=ray.huang@amd.com \
    --cc=sam@ravnborg.org \
    --cc=shashank.sharma@amd.com \
    --cc=sroland@vmware.com \
    --cc=zackr@vmware.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).