<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Aptos;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        font-size:12.0pt;
        font-family:"Aptos",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
code
        {mso-style-priority:99;
        font-family:"Courier New";}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0in;
        font-size:10.0pt;
        font-family:"Courier New";}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:Consolas;}
span.EmailStyle22
        {mso-style-type:personal-reply;
        font-family:"Arial",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;
        mso-ligatures:none;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple" style="word-wrap:break-word">
<p style="font-family:Calibri;font-size:10pt;color:#0000FF;margin:5pt;font-style:normal;font-weight:normal;text-decoration:none;" align="Left">
[AMD Official Use Only - AMD Internal Distribution Only]<br>
</p>
<br>
<div>
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Arial",sans-serif"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Arial",sans-serif"><o:p> </o:p></span></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">From:</span></b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"> Prosyak, Vitaly <Vitaly.Prosyak@amd.com>
<br>
<b>Sent:</b> Tuesday, April 1, 2025 12:42 AM<br>
<b>To:</b> Khatri, Sunil <Sunil.Khatri@amd.com>; igt-dev@lists.freedesktop.org<br>
<b>Cc:</b> Deucher, Alexander <Alexander.Deucher@amd.com>; Koenig, Christian <Christian.Koenig@amd.com>; Prosyak, Vitaly <Vitaly.Prosyak@amd.com>; Zhang, Jesse(Jie) <Jesse.Zhang@amd.com><br>
<b>Subject:</b> Re: [PATCH v3 02/19] drm-uapi/amdgpu: sync with drm-next<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p><o:p> </o:p></p>
<div>
<p class="MsoNormal">On 2025-03-28 04:23, Sunil Khatri wrote:<o:p></o:p></p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<pre>Sync with drm-next commit ("866fc4f7e772c4a397f9459754ed1b1872b3a3c6")<o:p></o:p></pre>
<pre><o:p> </o:p></pre>
<pre>Added support of UAPI for user queue secure semaphore.<o:p></o:p></pre>
<pre>The semaphore is used to synchronize between the caller and<o:p></o:p></pre>
<pre>the gpu hw and user wait for the semaphore.<o:p></o:p></pre>
<pre><o:p> </o:p></pre>
<pre>Signed-off-by: Sunil Khatri <a href="mailto:sunil.khatri@amd.com"><sunil.khatri@amd.com></a><o:p></o:p></pre>
<pre>---<o:p></o:p></pre>
<pre> include/drm-uapi/amdgpu_drm.h | 117 ++++++++++++++++++++++++++++++++++<o:p></o:p></pre>
<pre> 1 file changed, 117 insertions(+)<o:p></o:p></pre>
<pre><o:p> </o:p></pre>
<pre>diff --git a/include/drm-uapi/amdgpu_drm.h b/include/drm-uapi/amdgpu_drm.h<o:p></o:p></pre>
<pre>index d780e1f2a..fed39c9b4 100644<o:p></o:p></pre>
<pre>--- a/include/drm-uapi/amdgpu_drm.h<o:p></o:p></pre>
<pre>+++ b/include/drm-uapi/amdgpu_drm.h<o:p></o:p></pre>
<pre>@@ -55,6 +55,8 @@ extern "C" {<o:p></o:p></pre>
<pre> #define DRM_AMDGPU_FENCE_TO_HANDLE     0x14<o:p></o:p></pre>
<pre> #define DRM_AMDGPU_SCHED               0x15<o:p></o:p></pre>
<pre> #define DRM_AMDGPU_USERQ               0x16<o:p></o:p></pre>
<pre>+#define DRM_AMDGPU_USERQ_SIGNAL        0x17<o:p></o:p></pre>
<pre>+#define DRM_AMDGPU_USERQ_WAIT          0x18<o:p></o:p></pre>
<pre> <o:p></o:p></pre>
<pre> #define DRM_IOCTL_AMDGPU_GEM_CREATE  DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_GEM_CREATE, union drm_amdgpu_gem_create)<o:p></o:p></pre>
<pre> #define DRM_IOCTL_AMDGPU_GEM_MMAP  DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_GEM_MMAP, union drm_amdgpu_gem_mmap)<o:p></o:p></pre>
<pre>@@ -73,6 +75,8 @@ extern "C" {<o:p></o:p></pre>
<pre> #define DRM_IOCTL_AMDGPU_FENCE_TO_HANDLE DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_FENCE_TO_HANDLE, union drm_amdgpu_fence_to_handle)<o:p></o:p></pre>
<pre> #define DRM_IOCTL_AMDGPU_SCHED   DRM_IOW(DRM_COMMAND_BASE + DRM_AMDGPU_SCHED, union drm_amdgpu_sched)<o:p></o:p></pre>
<pre> #define DRM_IOCTL_AMDGPU_USERQ   DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_USERQ, union drm_amdgpu_userq)<o:p></o:p></pre>
<pre>+#define DRM_IOCTL_AMDGPU_USERQ_SIGNAL  DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_USERQ_SIGNAL, struct drm_amdgpu_userq_signal)<o:p></o:p></pre>
<pre>+#define DRM_IOCTL_AMDGPU_USERQ_WAIT  DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_USERQ_WAIT, struct drm_amdgpu_userq_wait)<o:p></o:p></pre>
<pre> <o:p></o:p></pre>
<pre> /**<o:p></o:p></pre>
<pre>  * DOC: memory domains<o:p></o:p></pre>
<pre>@@ -442,6 +446,119 @@ struct drm_amdgpu_userq_mqd_compute_gfx11 {<o:p></o:p></pre>
<pre>  __u64   eop_va;<o:p></o:p></pre>
<pre> };<o:p></o:p></pre>
<pre> <o:p></o:p></pre>
<pre>+/* userq signal/wait ioctl */<o:p></o:p></pre>
<pre>+struct drm_amdgpu_userq_signal {<o:p></o:p></pre>
<pre>+ /**<o:p></o:p></pre>
<pre>+  * @queue_id: Queue handle used by the userq fence creation function<o:p></o:p></pre>
<pre>+  * to retrieve the WPTR.<o:p></o:p></pre>
<pre>+  */<o:p></o:p></pre>
<pre>+ __u32   queue_id;<o:p></o:p></pre>
<pre>+ __u32   pad;<o:p></o:p></pre>
<pre>+ /**<o:p></o:p></pre>
<pre>+  * @syncobj_handles: The list of syncobj handles submitted by the user queue<o:p></o:p></pre>
<pre>+  * job to be signaled.<o:p></o:p></pre>
<pre>+  */<o:p></o:p></pre>
</blockquote>
<p>I am not sure about the correctness of the 'list of syncobj handles.' If it is a list, the field should be of type
<code><span style="font-size:10.0pt">list_head</span></code>; if it's an array, it should be
<code><span style="font-size:10.0pt">__u64*</span></code>, since the next field declares
<code><span style="font-size:10.0pt">num_syncobj_handles</span></code>. Could you clarify this?<o:p></o:p></p>
<p>There are several fields like this ?<o:p></o:p></p>
<p><span style="font-size:11.0pt;font-family:"Arial",sans-serif">Hello Vitaly<br>
<br>
These are the headers defined in the kernel and directly ported to the IGT lib drm header as various others in past.<br>
<br>
These are being discussed between various stake holders like Marel, Alex and Christian and then these types and objects are defined.
<br>
<br>
Regards<br>
Sunil khatri<o:p></o:p></span></p>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<pre><o:p> </o:p></pre>
<pre>+ __u64   syncobj_handles;<o:p></o:p></pre>
<pre>+ /**<o:p></o:p></pre>
<pre>+  * @num_syncobj_handles: A count that represents the number of syncobj handles in<o:p></o:p></pre>
<pre>+  * @syncobj_handles.<o:p></o:p></pre>
<pre>+  */<o:p></o:p></pre>
<pre>+ __u64   num_syncobj_handles;<o:p></o:p></pre>
<pre>+ /**<o:p></o:p></pre>
<pre>+  * @bo_read_handles: The list of BO handles that the submitted user queue job<o:p></o:p></pre>
<pre>+  * is using for read only. This will update BO fences in the kernel.<o:p></o:p></pre>
<pre>+  */<o:p></o:p></pre>
<pre>+ __u64   bo_read_handles;<o:p></o:p></pre>
<pre>+ /**<o:p></o:p></pre>
<pre>+  * @bo_write_handles: The list of BO handles that the submitted user queue job<o:p></o:p></pre>
<pre>+  * is using for write only. This will update BO fences in the kernel.<o:p></o:p></pre>
<pre>+  */<o:p></o:p></pre>
<pre>+ __u64   bo_write_handles;<o:p></o:p></pre>
<pre>+ /**<o:p></o:p></pre>
<pre>+  * @num_bo_read_handles: A count that represents the number of read BO handles in<o:p></o:p></pre>
<pre>+  * @bo_read_handles.<o:p></o:p></pre>
<pre>+  */<o:p></o:p></pre>
<pre>+ __u32   num_bo_read_handles;<o:p></o:p></pre>
<pre>+ /**<o:p></o:p></pre>
<pre>+  * @num_bo_write_handles: A count that represents the number of write BO handles in<o:p></o:p></pre>
<pre>+  * @bo_write_handles.<o:p></o:p></pre>
<pre>+  */<o:p></o:p></pre>
<pre>+ __u32   num_bo_write_handles;<o:p></o:p></pre>
<pre>+};<o:p></o:p></pre>
<pre>+<o:p></o:p></pre>
<pre>+struct drm_amdgpu_userq_fence_info {<o:p></o:p></pre>
<pre>+ /**<o:p></o:p></pre>
<pre>+  * @va: A gpu address allocated for each queue which stores the<o:p></o:p></pre>
<pre>+  * read pointer (RPTR) value.<o:p></o:p></pre>
<pre>+  */<o:p></o:p></pre>
<pre>+ __u64   va;<o:p></o:p></pre>
<pre>+ /**<o:p></o:p></pre>
<pre>+  * @value: A 64 bit value represents the write pointer (WPTR) of the<o:p></o:p></pre>
<pre>+  * queue commands which compared with the RPTR value to signal the<o:p></o:p></pre>
<pre>+  * fences.<o:p></o:p></pre>
<pre>+  */<o:p></o:p></pre>
<pre>+ __u64   value;<o:p></o:p></pre>
<pre>+};<o:p></o:p></pre>
<pre>+<o:p></o:p></pre>
<pre>+struct drm_amdgpu_userq_wait {<o:p></o:p></pre>
<pre>+ /**<o:p></o:p></pre>
<pre>+  * @syncobj_handles: The list of syncobj handles submitted by the user queue<o:p></o:p></pre>
<pre>+  * job to get the va/value pairs.<o:p></o:p></pre>
<pre>+  */<o:p></o:p></pre>
<pre>+ __u64   syncobj_handles;<o:p></o:p></pre>
<pre>+ /**<o:p></o:p></pre>
<pre>+  * @syncobj_timeline_handles: The list of timeline syncobj handles submitted by<o:p></o:p></pre>
<pre>+  * the user queue job to get the va/value pairs at given @syncobj_timeline_points.<o:p></o:p></pre>
<pre>+  */<o:p></o:p></pre>
<pre>+ __u64   syncobj_timeline_handles;<o:p></o:p></pre>
<pre>+ /**<o:p></o:p></pre>
<pre>+  * @syncobj_timeline_points: The list of timeline syncobj points submitted by the<o:p></o:p></pre>
<pre>+  * user queue job for the corresponding @syncobj_timeline_handles.<o:p></o:p></pre>
<pre>+  */<o:p></o:p></pre>
<pre>+ __u64   syncobj_timeline_points;<o:p></o:p></pre>
<pre>+ /**<o:p></o:p></pre>
<pre>+  * @bo_read_handles: The list of read BO handles submitted by the user queue<o:p></o:p></pre>
<pre>+  * job to get the va/value pairs.<o:p></o:p></pre>
<pre>+  */<o:p></o:p></pre>
<pre>+ __u64   bo_read_handles;<o:p></o:p></pre>
<pre>+ /**<o:p></o:p></pre>
<pre>+  * @bo_write_handles: The list of write BO handles submitted by the user queue<o:p></o:p></pre>
<pre>+  * job to get the va/value pairs.<o:p></o:p></pre>
<pre>+  */<o:p></o:p></pre>
<pre>+ __u64   bo_write_handles;<o:p></o:p></pre>
<pre>+ /**<o:p></o:p></pre>
<pre>+  * @num_syncobj_timeline_handles: A count that represents the number of timeline<o:p></o:p></pre>
<pre>+  * syncobj handles in @syncobj_timeline_handles.<o:p></o:p></pre>
<pre>+  */<o:p></o:p></pre>
<pre>+ __u16   num_syncobj_timeline_handles;<o:p></o:p></pre>
<pre>+ /**<o:p></o:p></pre>
<pre>+  * @num_fences: This field can be used both as input and output. As input it defines<o:p></o:p></pre>
<pre>+  * the maximum number of fences that can be returned and as output it will specify<o:p></o:p></pre>
<pre>+  * how many fences were actually returned from the ioctl.<o:p></o:p></pre>
<pre>+  */<o:p></o:p></pre>
<pre>+ __u16   num_fences;<o:p></o:p></pre>
<pre>+ /**<o:p></o:p></pre>
<pre>+  * @num_syncobj_handles: A count that represents the number of syncobj handles in<o:p></o:p></pre>
<pre>+  * @syncobj_handles.<o:p></o:p></pre>
<pre>+  */<o:p></o:p></pre>
<pre>+ __u32   num_syncobj_handles;<o:p></o:p></pre>
<pre>+ /**<o:p></o:p></pre>
<pre>+  * @num_bo_read_handles: A count that represents the number of read BO handles in<o:p></o:p></pre>
<pre>+  * @bo_read_handles.<o:p></o:p></pre>
<pre>+  */<o:p></o:p></pre>
<pre>+ __u32   num_bo_read_handles;<o:p></o:p></pre>
<pre>+ /**<o:p></o:p></pre>
<pre>+  * @num_bo_write_handles: A count that represents the number of write BO handles in<o:p></o:p></pre>
<pre>+  * @bo_write_handles.<o:p></o:p></pre>
<pre>+  */<o:p></o:p></pre>
<pre>+ __u32   num_bo_write_handles;<o:p></o:p></pre>
<pre>+ /**<o:p></o:p></pre>
<pre>+  * @out_fences: The field is a return value from the ioctl containing the list of<o:p></o:p></pre>
<pre>+  * address/value pairs to wait for.<o:p></o:p></pre>
<pre>+  */<o:p></o:p></pre>
<pre>+ __u64   out_fences;<o:p></o:p></pre>
<pre>+};<o:p></o:p></pre>
<pre>+<o:p></o:p></pre>
<pre> /* vm ioctl */<o:p></o:p></pre>
<pre> #define AMDGPU_VM_OP_RESERVE_VMID      1<o:p></o:p></pre>
<pre> #define AMDGPU_VM_OP_UNRESERVE_VMID    2<o:p></o:p></pre>
</blockquote>
</div>
</div>
</body>
</html>