[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251112072910.3716944-3-honglei1.huang@amd.com>
Date: Wed, 12 Nov 2025 15:29:07 +0800
From: Honglei Huang <honglei1.huang@....com>
To: <Felix.Kuehling@....com>, <alexander.deucher@....com>,
<christian.koenig@....com>, <Ray.Huang@....com>
CC: <dmitry.osipenko@...labora.com>, <Xinhui.Pan@....com>,
<airlied@...il.com>, <daniel@...ll.ch>, <amd-gfx@...ts.freedesktop.org>,
<dri-devel@...ts.freedesktop.org>, <linux-kernel@...r.kernel.org>,
<linux-mm@...ck.org>, <akpm@...ux-foundation.org>, <honghuang@....com>,
Honglei Huang <Honglei1.Huang@....com>
Subject: [PATCH 2/5] drm/amdkfd: Add SVM ranges data structures
From: Honglei Huang <Honglei1.Huang@....com>
Add new UAPI data structures to support batch SVM range registration:
- struct kfd_ioctl_svm_range: Describes a single SVM range with its
virtual address and size.
- struct kfd_ioctl_svm_ranges_args: Arguments for batch registration
of multiple non-contiguous SVM ranges. This structure allows
registering multiple ranges with the same set of attributes in a
single ioctl call, improving efficiency over multiple individual
ioctl calls.
The new structures enable userspace to efficiently register scattered
memory buffers (e.g., multiple malloc allocations) to GPU address
space without requiring them to be physically or virtually contiguous.
Signed-off-by: Honglei Huang <Honglei1.Huang@....com>
---
include/uapi/linux/kfd_ioctl.h | 42 ++++++++++++++++++++++++++++++++++
1 file changed, 42 insertions(+)
diff --git a/include/uapi/linux/kfd_ioctl.h b/include/uapi/linux/kfd_ioctl.h
index 320a4a0e10bc..d782bda1d2ca 100644
--- a/include/uapi/linux/kfd_ioctl.h
+++ b/include/uapi/linux/kfd_ioctl.h
@@ -777,6 +777,48 @@ struct kfd_ioctl_svm_args {
struct kfd_ioctl_svm_attribute attrs[];
};
+/**
+ * kfd_ioctl_svm_range - SVM range descriptor
+ *
+ * @addr: starting virtual address of the SVM range
+ * @size: size of the SVM range in bytes
+ * @pad: padding for alignment
+ *
+ */
+struct kfd_ioctl_svm_range {
+ __u64 addr;
+ __u64 size;
+};
+
+/**
+ * kfd_ioctl_svm_ranges_args - Arguments for SVM register ranges ioctl
+ *
+ * @nranges: number of ranges in the @ranges array
+ * @op: operation to perform (see enum @kfd_ioctl_svm_op)
+ * @nattr: number of attributes in the @attrs array
+ * @ranges: variable length array of ranges
+ * @attrs: variable length array of attributes
+ *
+ * This ioctl allows registering multiple SVM ranges with the same
+ * set of attributes. This is more efficient than calling the SVM
+ * ioctl multiple times for each range.
+ *
+ * The semantics of the operations and attributes are the same as
+ * for kfd_ioctl_svm_args.
+ */
+struct kfd_ioctl_svm_ranges_args {
+ __u64 start_addr;
+ __u64 size;
+ __u32 op;
+ __u32 nattr;
+ /* Variable length array of attributes */
+ __u64 attrs_ptr;
+ __u32 nranges;
+ __u32 pad;
+ /* Variable length array of ranges */
+ __u64 ranges_ptr;
+};
+
/**
* kfd_ioctl_set_xnack_mode_args - Arguments for set_xnack_mode
*
--
2.34.1
Powered by blists - more mailing lists