summaryrefslogtreecommitdiff
path: root/include/uapi/drm
diff options
context:
space:
mode:
authorAdrián Larumbe <adrian.larumbe@collabora.com>2026-05-22 19:51:59 +0100
committerSteven Price <steven.price@arm.com>2026-06-05 10:59:07 +0100
commit12cf826bf1dd9275773cbef02c81ec1c67def7c3 (patch)
treef775613775e9f71cfde96d1610cec1098656d23e /include/uapi/drm
parentd074bf042083d1a14995b3305b95bf1b4c96ae69 (diff)
downloadlinux-next-12cf826bf1dd9275773cbef02c81ec1c67def7c3.tar.gz
linux-next-12cf826bf1dd9275773cbef02c81ec1c67def7c3.zip
drm/panthor: Support sparse mappings
Allow UM to bind sparsely populated memory regions by cyclically mapping virtual ranges over a kernel-allocated dummy BO. This alternative is preferable to the old method of handling sparseness in the UMD, because it relied on the creation of a buffer object to the same end, despite the fact Vulkan sparse resources don't need to be backed by a driver BO. The choice of backing sparsely-bound regions with a Panthor BO was made so as to profit from the existing shrinker reclaim code. That way no special treatment must be given to the dummy sparse BOs when reclaiming memory, as would be the case if we had chosen a raw kernel page implementation. A new dummy BO is allocated per open file context, because even though the Vulkan spec mandates that writes into sparsely bound regions must be discarded, our implementation is still a workaround over the fact Mali CSF GPUs cannot support this behaviour on the hardware level, so writes still make it into the backing BO. If we had a global one, then it could be a venue for information leaks between file contexts, which should never happen in DRM. As a side note, care was put to adjust dummy BO offsets for sparse mappings so that all addresses in the new VA are mapped aligned against it. Signed-off-by: Adrián Larumbe <adrian.larumbe@collabora.com> Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com> Reviewed-by: Steven Price <steven.price@arm.com> Link: https://patch.msgid.link/20260522185206.2798288-6-adrian.larumbe@collabora.com Signed-off-by: Steven Price <steven.price@arm.com>
Diffstat (limited to 'include/uapi/drm')
-rw-r--r--include/uapi/drm/panthor_drm.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/include/uapi/drm/panthor_drm.h b/include/uapi/drm/panthor_drm.h
index 14a93a4ef6ff..a2ff0f4ec691 100644
--- a/include/uapi/drm/panthor_drm.h
+++ b/include/uapi/drm/panthor_drm.h
@@ -615,6 +615,18 @@ enum drm_panthor_vm_bind_op_flags {
DRM_PANTHOR_VM_BIND_OP_MAP_UNCACHED = 1 << 2,
/**
+ * @DRM_PANTHOR_VM_BIND_OP_MAP_SPARSE: Sparsely map a virtual memory range
+ *
+ * Only valid with DRM_PANTHOR_VM_BIND_OP_TYPE_MAP.
+ *
+ * When this flag is set, the whole vm_bind range is mapped over a dummy object in a cyclic
+ * fashion, and all GPU reads from addresses in the range return undefined values. This flag
+ * being set means drm_panthor_vm_bind_op::bo_offset and drm_panthor_vm_bind_op::bo_handle
+ * must both be set to 0. DRM_PANTHOR_VM_BIND_OP_MAP_NOEXEC must also be set.
+ */
+ DRM_PANTHOR_VM_BIND_OP_MAP_SPARSE = 1 << 3,
+
+ /**
* @DRM_PANTHOR_VM_BIND_OP_TYPE_MASK: Mask used to determine the type of operation.
*/
DRM_PANTHOR_VM_BIND_OP_TYPE_MASK = (int)(0xfu << 28),