lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230906095542.3280699-3-sarah.walker@imgtec.com>
Date:   Wed,  6 Sep 2023 10:55:24 +0100
From:   Sarah Walker <sarah.walker@...tec.com>
To:     <dri-devel@...ts.freedesktop.org>
CC:     <frank.binns@...tec.com>, <donald.robson@...tec.com>,
        <boris.brezillon@...labora.com>, <airlied@...il.com>,
        <daniel@...ll.ch>, <robh+dt@...nel.org>,
        <krzysztof.kozlowski+dt@...aro.org>, <conor+dt@...nel.org>,
        <maarten.lankhorst@...ux.intel.com>, <mripard@...nel.org>,
        <tzimmermann@...e.de>, <corbet@....net>,
        <christian.koenig@....com>, <linus.walleij@...aro.org>,
        <matt.coster@...tec.com>, <linux-kernel@...r.kernel.org>,
        <devicetree@...r.kernel.org>, <linux-doc@...r.kernel.org>,
        <faith.ekstrand@...labora.com>, <afd@...com>, <hns@...delico.com>,
        <matthew.brost@...el.com>, <luben.tuikov@....com>,
        <dakr@...hat.com>
Subject: [PATCH v6 02/20] drm/gpuva_mgr: Helper to get range of unmap from a remap op.

From: Donald Robson <donald.robson@...tec.com>

Signed-off-by: Donald Robson <donald.robson@...tec.com>
---
 include/drm/drm_gpuva_mgr.h | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/include/drm/drm_gpuva_mgr.h b/include/drm/drm_gpuva_mgr.h
index ed8d50200cc3..be7b3a6d7e67 100644
--- a/include/drm/drm_gpuva_mgr.h
+++ b/include/drm/drm_gpuva_mgr.h
@@ -703,4 +703,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 __always_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_GPUVA_MGR_H__ */
-- 
2.42.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ