From: Sarah Walker <sarah.walker@imgtec.com>
To: <dri-devel@lists.freedesktop.org>
Cc: <frank.binns@imgtec.com>, <donald.robson@imgtec.com>,
<boris.brezillon@collabora.com>, <faith.ekstrand@collabora.com>,
<airlied@gmail.com>, <daniel@ffwll.ch>,
<maarten.lankhorst@linux.intel.com>, <mripard@kernel.org>,
<tzimmermann@suse.de>, <afd@ti.com>, <hns@goldelico.com>,
<matthew.brost@intel.com>, <christian.koenig@amd.com>,
<luben.tuikov@amd.com>, <dakr@redhat.com>,
<linux-kernel@vger.kernel.org>, <robh+dt@kernel.org>,
<krzysztof.kozlowski+dt@linaro.org>, <conor+dt@kernel.org>,
<devicetree@vger.kernel.org>, <corbet@lwn.net>,
<linux-doc@vger.kernel.org>
Subject: [PATCH v7 02/20] drm/gpuvm: Helper to get range of unmap from a remap op.
Date: Tue, 10 Oct 2023 14:37:20 +0100 [thread overview]
Message-ID: <20231010133738.35274-3-sarah.walker@imgtec.com> (raw)
In-Reply-To: <20231010133738.35274-1-sarah.walker@imgtec.com>
From: Donald Robson <donald.robson@imgtec.com>
Determining the start and range of the unmap stage of a remap op is a
common piece of code currently implemented by multiple drivers. Add a
helper for this.
Changes since v6:
- Remove use of __always_inline
Signed-off-by: Donald Robson <donald.robson@imgtec.com>
Signed-off-by: Sarah Walker <sarah.walker@imgtec.com>
---
include/drm/drm_gpuvm.h | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
diff --git a/include/drm/drm_gpuvm.h b/include/drm/drm_gpuvm.h
index c7ed6bf441d4..932e942da921 100644
--- a/include/drm/drm_gpuvm.h
+++ b/include/drm/drm_gpuvm.h
@@ -702,4 +702,31 @@ void drm_gpuva_remap(struct drm_gpuva *prev,
void drm_gpuva_unmap(struct drm_gpuva_op_unmap *op);
+/**
+ * drm_gpuva_op_remap_get_unmap_range() - Helper to get the start and range of
+ * the unmap stage of a remap op.
+ * @op: Remap op.
+ * @start_addr: Output pointer for the start of the required unmap.
+ * @range: Output pointer for the length of the required unmap.
+ *
+ * These parameters can then be used by the caller to unmap memory pages that
+ * are no longer required.
+ */
+static inline void
+drm_gpuva_op_remap_get_unmap_range(const struct drm_gpuva_op_remap *op,
+ u64 *start_addr, u64 *range)
+{
+ const u64 va_start = op->prev ?
+ op->prev->va.addr + op->prev->va.range :
+ op->unmap->va->va.addr;
+ const u64 va_end = op->next ?
+ op->next->va.addr :
+ op->unmap->va->va.addr + op->unmap->va->va.range;
+
+ if (start_addr)
+ *start_addr = va_start;
+ if (range)
+ *range = va_end - va_start;
+}
+
#endif /* __DRM_GPUVM_H__ */
--
2.42.0
next prev parent reply other threads:[~2023-10-10 13:38 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-10 13:37 [PATCH v7 00/20] Imagination Technologies PowerVR DRM driver Sarah Walker
2023-10-10 13:37 ` [PATCH v7 01/20] sizes.h: Add entries between SZ_32G and SZ_64T Sarah Walker
2023-10-10 13:37 ` Sarah Walker [this message]
2023-10-10 16:31 ` [PATCH v7 02/20] drm/gpuvm: Helper to get range of unmap from a remap op Danilo Krummrich
2023-10-12 9:57 ` [EXTERNAL] " Donald Robson
2023-10-10 13:37 ` [PATCH v7 03/20] dt-bindings: gpu: Add Imagination Technologies PowerVR/IMG GPU Sarah Walker
2023-10-10 13:37 ` [PATCH v7 04/20] drm/imagination/uapi: Add PowerVR driver UAPI Sarah Walker
2023-10-10 13:37 ` [PATCH v7 05/20] drm/imagination: Add skeleton PowerVR driver Sarah Walker
2023-10-10 13:37 ` [PATCH v7 06/20] drm/imagination: Get GPU resources Sarah Walker
2023-10-10 13:37 ` [PATCH v7 07/20] drm/imagination: Add GPU register headers Sarah Walker
2023-10-10 13:37 ` [PATCH v7 08/20] drm/imagination: Add firmware and MMU related headers Sarah Walker
2023-10-10 13:37 ` [PATCH v7 09/20] drm/imagination: Add FWIF headers Sarah Walker
2023-10-10 13:37 ` [PATCH v7 10/20] drm/imagination: Add GPU ID parsing and firmware loading Sarah Walker
2023-10-12 6:58 ` kernel test robot
2023-10-10 13:37 ` [PATCH v7 11/20] drm/imagination: Add GEM and VM related code Sarah Walker
2023-10-13 12:47 ` kernel test robot
2023-10-10 13:37 ` [PATCH v7 12/20] drm/imagination: Implement power management Sarah Walker
2023-10-10 13:37 ` [PATCH v7 13/20] drm/imagination: Implement firmware infrastructure and META FW support Sarah Walker
2023-10-10 13:37 ` [PATCH v7 14/20] drm/imagination: Implement MIPS firmware processor and MMU support Sarah Walker
2023-10-10 13:37 ` [PATCH v7 15/20] drm/imagination: Implement free list and HWRT create and destroy ioctls Sarah Walker
2023-10-10 13:37 ` [PATCH v7 16/20] drm/imagination: Implement context creation/destruction ioctls Sarah Walker
2023-10-10 13:37 ` [PATCH v7 17/20] drm/imagination: Implement job submission and scheduling Sarah Walker
2023-10-10 13:37 ` [PATCH v7 18/20] drm/imagination: Add firmware trace header Sarah Walker
2023-10-10 13:37 ` [PATCH v7 19/20] drm/imagination: Add firmware trace to debugfs Sarah Walker
2023-10-10 13:37 ` [PATCH v7 20/20] drm/imagination: Add driver documentation Sarah Walker
2023-10-19 10:12 ` [PATCH v7 00/20] Imagination Technologies PowerVR DRM driver Maxim Kochetkov
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=20231010133738.35274-3-sarah.walker@imgtec.com \
--to=sarah.walker@imgtec.com \
--cc=afd@ti.com \
--cc=airlied@gmail.com \
--cc=boris.brezillon@collabora.com \
--cc=christian.koenig@amd.com \
--cc=conor+dt@kernel.org \
--cc=corbet@lwn.net \
--cc=dakr@redhat.com \
--cc=daniel@ffwll.ch \
--cc=devicetree@vger.kernel.org \
--cc=donald.robson@imgtec.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=faith.ekstrand@collabora.com \
--cc=frank.binns@imgtec.com \
--cc=hns@goldelico.com \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luben.tuikov@amd.com \
--cc=maarten.lankhorst@linux.intel.com \
--cc=matthew.brost@intel.com \
--cc=mripard@kernel.org \
--cc=robh+dt@kernel.org \
--cc=tzimmermann@suse.de \
/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
all inboxes | Powered by JetHome®