From: Shashank Sharma <shashank.sharma@amd.com>
To: <amd-gfx@lists.freedesktop.org>
Cc: Alex Deucher <alexander.deucher@amd.com>,
Christian Koenig <christian.koenig@amd.com>,
arvind.yadav@amd.com, Shashank Sharma <shashank.sharma@amd.com>
Subject: [PATCH v5 01/10] drm/amdgpu: UAPI for user queue management
Date: Thu, 6 Jul 2023 14:35:53 +0200 [thread overview]
Message-ID: <20230706123602.2331-2-shashank.sharma@amd.com> (raw)
In-Reply-To: <20230706123602.2331-1-shashank.sharma@amd.com>
From: Alex Deucher <alexander.deucher@amd.com>
This patch intorduces new UAPI/IOCTL for usermode graphics
queue. The userspace app will fill this structure and request
the graphics driver to add a graphics work queue for it. The
output of this UAPI is a queue id.
This UAPI maps the queue into GPU, so the graphics app can start
submitting work to the queue as soon as the call returns.
V2: Addressed review comments from Alex and Christian
- Make the doorbell offset's comment clearer
- Change the output parameter name to queue_id
V3: Integration with doorbell manager
V4:
- Updated the UAPI doc (Pierre-Eric)
- Created a Union for engine specific MQDs (Alex)
- Added Christian's R-B
V5:
- Add variables for GDS and CSA in MQD structure (Alex)
- Make MQD data a ptr-size pair instead of union (Alex)
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: Christian Koenig <christian.koenig@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Shashank Sharma <shashank.sharma@amd.com>
---
include/uapi/drm/amdgpu_drm.h | 110 ++++++++++++++++++++++++++++++++++
1 file changed, 110 insertions(+)
diff --git a/include/uapi/drm/amdgpu_drm.h b/include/uapi/drm/amdgpu_drm.h
index b6eb90df5d05..4f1178c6ee34 100644
--- a/include/uapi/drm/amdgpu_drm.h
+++ b/include/uapi/drm/amdgpu_drm.h
@@ -54,6 +54,7 @@ extern "C" {
#define DRM_AMDGPU_VM 0x13
#define DRM_AMDGPU_FENCE_TO_HANDLE 0x14
#define DRM_AMDGPU_SCHED 0x15
+#define DRM_AMDGPU_USERQ 0x16
#define DRM_IOCTL_AMDGPU_GEM_CREATE DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_GEM_CREATE, union drm_amdgpu_gem_create)
#define DRM_IOCTL_AMDGPU_GEM_MMAP DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_GEM_MMAP, union drm_amdgpu_gem_mmap)
@@ -71,6 +72,7 @@ extern "C" {
#define DRM_IOCTL_AMDGPU_VM DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_VM, union drm_amdgpu_vm)
#define DRM_IOCTL_AMDGPU_FENCE_TO_HANDLE DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_FENCE_TO_HANDLE, union drm_amdgpu_fence_to_handle)
#define DRM_IOCTL_AMDGPU_SCHED DRM_IOW(DRM_COMMAND_BASE + DRM_AMDGPU_SCHED, union drm_amdgpu_sched)
+#define DRM_IOCTL_AMDGPU_USERQ DRM_IOW(DRM_COMMAND_BASE + DRM_AMDGPU_USERQ, union drm_amdgpu_userq)
/**
* DOC: memory domains
@@ -302,6 +304,114 @@ union drm_amdgpu_ctx {
union drm_amdgpu_ctx_out out;
};
+/* user queue IOCTL */
+#define AMDGPU_USERQ_OP_CREATE 1
+#define AMDGPU_USERQ_OP_FREE 2
+
+/* Flag to indicate secure buffer related workload, unused for now */
+#define AMDGPU_USERQ_MQD_FLAGS_SECURE (1 << 0)
+/* Flag to indicate AQL workload, unused for now */
+#define AMDGPU_USERQ_MQD_FLAGS_AQL (1 << 1)
+
+/*
+ * MQD (memory queue descriptor) is a set of parameters which allow
+ * the GPU to uniquely define and identify a usermode queue. This
+ * structure defines the MQD for GFX-V11 IP ver 0.
+ */
+struct drm_amdgpu_userq_mqd_gfx_v11_0 {
+ /**
+ * @queue_va: Virtual address of the GPU memory which holds the queue
+ * object. The queue holds the workload packets.
+ */
+ __u64 queue_va;
+ /**
+ * @queue_size: Size of the queue in bytes, this needs to be 256-byte
+ * aligned.
+ */
+ __u64 queue_size;
+ /**
+ * @rptr_va : Virtual address of the GPU memory which holds the ring RPTR.
+ * This object must be at least 8 byte in size and aligned to 8-byte offset.
+ */
+ __u64 rptr_va;
+ /**
+ * @wptr_va : Virtual address of the GPU memory which holds the ring WPTR.
+ * This object must be at least 8 byte in size and aligned to 8-byte offset.
+ *
+ * Queue, RPTR and WPTR can come from the same object, as long as the size
+ * and alignment related requirements are met.
+ */
+ __u64 wptr_va;
+ /**
+ * @shadow_va: Virtual address of the GPU memory to hold the shadow buffer.
+ * This must be a from a separate GPU object, and must be at least 4-page
+ * sized.
+ */
+ __u64 shadow_va;
+ /**
+ * @gds_va: Virtual address of the GPU memory to hold the GDS buffer.
+ * This must be a from a separate GPU object, and must be at least 1-page
+ * sized.
+ */
+ __u64 gds_va;
+ /**
+ * @csa_va: Virtual address of the GPU memory to hold the CSA buffer.
+ * This must be a from a separate GPU object, and must be at least 1-page
+ * sized.
+ */
+ __u64 csa_va;
+};
+
+struct drm_amdgpu_userq_in {
+ /** AMDGPU_USERQ_OP_* */
+ __u32 op;
+ /** Queue handle for USERQ_OP_FREE */
+ __u32 queue_id;
+ /** the target GPU engine to execute workload (AMDGPU_HW_IP_*) */
+ __u32 ip_type;
+ /**
+ * @flags: flags to indicate special function for queue like secure
+ * buffer (TMZ). Unused for now.
+ */
+ __u32 flags;
+ /**
+ * @doorbell_handle: the handle of doorbell GEM object
+ * associated to this client.
+ */
+ __u32 doorbell_handle;
+ /**
+ * @doorbell_offset: 32-bit offset of the doorbell in the doorbell bo.
+ * Kernel will generate absolute doorbell offset using doorbell_handle
+ * and doorbell_offset in the doorbell bo.
+ */
+ __u32 doorbell_offset;
+ /**
+ * @mqd: Queue descriptor for USERQ_OP_CREATE
+ * MQD data can be of different size for different GPU IP/engine and
+ * their respective versions/revisions, so this points to a __u64 *
+ * which holds MQD of this usermode queue.
+ */
+ __u64 mqd;
+ /**
+ * @size: size of MQD data in bytes, it must match the MQD structure
+ * size of the respective engine/revision defined in UAPI for ex, for
+ * gfx_v11 workloads, size = sizeof(drm_amdgpu_userq_mqd_gfx_v11).
+ */
+ __u64 mqd_size;
+};
+
+struct drm_amdgpu_userq_out {
+ /** Queue handle */
+ __u32 queue_id;
+ /** Flags */
+ __u32 flags;
+};
+
+union drm_amdgpu_userq {
+ struct drm_amdgpu_userq_in in;
+ struct drm_amdgpu_userq_out out;
+};
+
/* vm ioctl */
#define AMDGPU_VM_OP_RESERVE_VMID 1
#define AMDGPU_VM_OP_UNRESERVE_VMID 2
--
2.40.1
next prev parent reply other threads:[~2023-07-06 12:36 UTC|newest]
Thread overview: 50+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-06 12:35 [PATCH v5 00/10] AMDGPU Usermode queues Shashank Sharma
2023-07-06 12:35 ` Shashank Sharma [this message]
2023-07-06 12:35 ` [PATCH v5 02/10] drm/amdgpu: add usermode queue base code Shashank Sharma
2023-07-06 12:46 ` Christian König
2023-07-06 16:36 ` Alex Deucher
2023-07-06 16:52 ` Shashank Sharma
2023-07-06 17:34 ` Alex Deucher
2023-07-06 12:35 ` [PATCH v5 03/10] drm/amdgpu: add new IOCTL for usermode queue Shashank Sharma
2023-07-06 13:20 ` Christian König
2023-07-06 12:35 ` [PATCH v5 04/10] drm/amdgpu: create GFX-gen11 " Shashank Sharma
2023-07-06 13:22 ` Christian König
2023-07-06 13:37 ` Shashank Sharma
2023-07-06 13:39 ` Christian König
2023-07-06 13:43 ` Shashank Sharma
2023-07-11 19:51 ` Felix Kuehling
2023-07-12 15:55 ` Shashank Sharma
2023-07-12 16:01 ` Felix Kuehling
2023-07-12 16:07 ` Shashank Sharma
2023-07-06 16:27 ` Alex Deucher
2023-07-06 16:29 ` Shashank Sharma
2023-07-07 7:24 ` Christian König
2023-07-07 7:46 ` Shashank Sharma
2023-07-07 8:37 ` Christian König
2023-07-07 10:02 ` Shashank Sharma
2023-07-07 12:28 ` Christian König
2023-07-07 12:46 ` Shashank Sharma
2023-07-06 12:35 ` [PATCH v5 05/10] drm/amdgpu: create context space for " Shashank Sharma
2023-07-06 13:28 ` Christian König
2023-07-06 13:33 ` Shashank Sharma
2023-07-06 13:37 ` Christian König
2023-07-06 16:44 ` Alex Deucher
2023-07-06 12:35 ` [PATCH v5 06/10] drm/amdgpu: map usermode queue into MES Shashank Sharma
2023-07-06 14:47 ` Christian König
2023-07-06 16:52 ` Alex Deucher
2023-07-06 17:15 ` Shashank Sharma
2023-07-06 17:26 ` Alex Deucher
2023-07-06 17:32 ` Shashank Sharma
2023-07-06 17:36 ` Alex Deucher
2023-07-06 12:35 ` [PATCH v5 07/10] drm/amdgpu: map wptr BO into GART Shashank Sharma
2023-07-06 12:36 ` [PATCH v5 08/10] drm/amdgpu: generate doorbell index for userqueue Shashank Sharma
2023-07-07 7:15 ` Christian König
2023-07-07 7:39 ` Shashank Sharma
2023-07-07 7:57 ` Christian König
2023-07-07 9:00 ` Shashank Sharma
2023-07-06 12:36 ` [PATCH v5 09/10] drm/amdgpu: cleanup leftover queues Shashank Sharma
2023-07-07 7:17 ` Christian König
2023-07-07 7:40 ` Shashank Sharma
2023-07-06 12:36 ` [PATCH v5 10/10] drm/amdgpu: add delay after userqueue mapping Shashank Sharma
2023-07-06 17:41 ` Alex Deucher
2023-07-06 18:30 ` Shashank Sharma
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=20230706123602.2331-2-shashank.sharma@amd.com \
--to=shashank.sharma@amd.com \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=arvind.yadav@amd.com \
--cc=christian.koenig@amd.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.