<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<p>No, please lets not add a new nomenclature for PM4 packet versions. GFX versions are agreed on between hardware, firmware, and software and it's generally understood what they mean. If we add a new PM4 packet versioning scheme on our own, then this will
 add a lot of confusion when talking to firmware teams.</p>
<p>You know, this would all be more straight forward if we accepted a little bit of code duplication and had packet writing functions per GFX version. You'll see this pattern a lot in the amdgpu driver where each IP version duplicates a bunch of code. In many
 cases you may be able to save a few lines of code by sharing functions between IP versions. But you'll add some confusion and burden on future maintenance.</p>
<p>This is the price we pay for micro-optimizing minor code duplication.</p>
<p>Regards,<br>
  Felix<br>
</p>
<div class="moz-cite-prefix">On 2019-11-07 12:39, Zhao, Yong wrote:<br>
</div>
<blockquote type="cite" cite="mid:41a6b535-ab7a-44f4-2899-f211f5ddc296@amd.com">
<p>Hi Kent, <br>
</p>
<p>I can't agree more on this. Also, the same applies to the file names. Definitely we need to agree on the naming scheme before making it happen.
<br>
</p>
<p>Yong<br>
</p>
<div class="moz-cite-prefix">On 2019-11-07 12:33 p.m., Russell, Kent wrote:<br>
</div>
<blockquote type="cite" cite="mid:CY4PR1201MB2533087B346C4619F461FF3185780@CY4PR1201MB2533.namprd12.prod.outlook.com">
<meta name="Generator" content="Microsoft Word 15 (filtered
          medium)">
<!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><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:"Segoe UI";
        panose-1:2 11 5 2 4 2 4 2 2 3;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:#0563C1;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:#954F72;
        text-decoration:underline;}
p.msonormal0, li.msonormal0, div.msonormal0
        {mso-style-name:msonormal;
        margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
span.EmailStyle20
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@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]-->
<div class="WordSection1">
<p class="MsoNormal">I think that the versioning is getting a little confusing since we’re using the old GFX versions, but not really sticking to it due to the shareability of certain managers and shaders. Could we look into doing something like gen1 or gen2,
 or some other more ambiguous non-GFX-related versioning? Otherwise we’ll keep having these questions of “why is Hawaii GFX8”, “why is Arcturus GFX9”, etc. Then if things change, we just up the value concretely, instead of maybe doing a v11 if GFX11 changes
 things, and only GFX11 ASICs use those functions/variables. <o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Obviously not high-priority, but maybe something to consider as you continue to consolidate and remove duplicate code.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Kent<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div style="border:none;border-top:solid #E1E1E1
              1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b>From:</b> amd-gfx <a class="moz-txt-link-rfc2396E" href="mailto:amd-gfx-bounces@lists.freedesktop.org" moz-do-not-send="true">
<amd-gfx-bounces@lists.freedesktop.org></a> <b>On Behalf Of </b>Zhao, Yong<br>
<b>Sent:</b> Thursday, November 7, 2019 11:57 AM<br>
<b>To:</b> Kuehling, Felix <a class="moz-txt-link-rfc2396E" href="mailto:Felix.Kuehling@amd.com" moz-do-not-send="true">
<Felix.Kuehling@amd.com></a>; <a class="moz-txt-link-abbreviated" href="mailto:amd-gfx@lists.freedesktop.org" moz-do-not-send="true">
amd-gfx@lists.freedesktop.org</a><br>
<b>Subject:</b> Re: [PATCH 2/3] drm/amdkfd: only keep release_mem function for Hawaii<o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:black">Hi Felix,<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:black"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:black">That's because v8 and v7 share the same
</span><span style="font-family:"Segoe
                UI",sans-serif;color:black;background:white">packet_manager_funcs. In this case, it is better to keep it as it is.</span><span style="font-size:12.0pt;color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:black"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:"Segoe
                UI",sans-serif;color:black;background:white">Regards,</span><span style="font-size:12.0pt;color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:"Segoe
                UI",sans-serif;color:black;background:white">Yong</span><span style="font-size:12.0pt;color:black"><o:p></o:p></span></p>
</div>
<div class="MsoNormal" style="text-align:center" align="center">
<hr width="98%" size="2" align="center">
</div>
<div id="divRplyFwdMsg">
<p class="MsoNormal"><b><span style="color:black">From:</span></b><span style="color:black"> Kuehling, Felix <<a href="mailto:Felix.Kuehling@amd.com" moz-do-not-send="true">Felix.Kuehling@amd.com</a>><br>
<b>Sent:</b> Wednesday, November 6, 2019 11:45 PM<br>
<b>To:</b> Zhao, Yong <<a href="mailto:Yong.Zhao@amd.com" moz-do-not-send="true">Yong.Zhao@amd.com</a>>;
<a href="mailto:amd-gfx@lists.freedesktop.org" moz-do-not-send="true">amd-gfx@lists.freedesktop.org</a> <<a href="mailto:amd-gfx@lists.freedesktop.org" moz-do-not-send="true">amd-gfx@lists.freedesktop.org</a>><br>
<b>Subject:</b> Re: [PATCH 2/3] drm/amdkfd: only keep release_mem function for Hawaii</span>
<o:p></o:p></p>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal">On 2019-10-30 20:17, Zhao, Yong wrote:<br>
> release_mem won't be used at all on GFX9 and GFX10, so delete it.<br>
<br>
Hawaii was GFXv7. So we're not using the release_mem packet on GFXv8 <br>
either. Why arbitrarily limit this change to GFXv9 and 10?<br>
<br>
Regards,<br>
   Felix<br>
<br>
><br>
> Change-Id: I13787a8a29b83e7516c582a7401f2e14721edf5f<br>
> Signed-off-by: Yong Zhao <<a href="mailto:Yong.Zhao@amd.com" moz-do-not-send="true">Yong.Zhao@amd.com</a>><br>
> ---<br>
>   .../gpu/drm/amd/amdkfd/kfd_kernel_queue_v10.c | 35 ++-----------------<br>
>   .../gpu/drm/amd/amdkfd/kfd_kernel_queue_v9.c  | 33 ++---------------<br>
>   2 files changed, 4 insertions(+), 64 deletions(-)<br>
><br>
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue_v10.c b/drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue_v10.c<br>
> index aed32ab7102e..bfd6221acae9 100644<br>
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue_v10.c<br>
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue_v10.c<br>
> @@ -298,37 +298,6 @@ static int pm_query_status_v10(struct packet_manager *pm, uint32_t *buffer,<br>
>        return 0;<br>
>   }<br>
>   <br>
> -<br>
> -static int pm_release_mem_v10(uint64_t gpu_addr, uint32_t *buffer)<br>
> -{<br>
> -     struct pm4_mec_release_mem *packet;<br>
> -<br>
> -     WARN_ON(!buffer);<br>
> -<br>
> -     packet = (struct pm4_mec_release_mem *)buffer;<br>
> -     memset(buffer, 0, sizeof(struct pm4_mec_release_mem));<br>
> -<br>
> -     packet->header.u32All = pm_build_pm4_header(IT_RELEASE_MEM,<br>
> -                                     sizeof(struct pm4_mec_release_mem));<br>
> -<br>
> -     packet->bitfields2.event_type = CACHE_FLUSH_AND_INV_TS_EVENT;<br>
> -     packet->bitfields2.event_index = event_index__mec_release_mem__end_of_pipe;<br>
> -     packet->bitfields2.tcl1_action_ena = 1;<br>
> -     packet->bitfields2.tc_action_ena = 1;<br>
> -     packet->bitfields2.cache_policy = cache_policy__mec_release_mem__lru;<br>
> -<br>
> -     packet->bitfields3.data_sel = data_sel__mec_release_mem__send_32_bit_low;<br>
> -     packet->bitfields3.int_sel =<br>
> -             int_sel__mec_release_mem__send_interrupt_after_write_confirm;<br>
> -<br>
> -     packet->bitfields4.address_lo_32b = (gpu_addr & 0xffffffff) >> 2;<br>
> -     packet->address_hi = upper_32_bits(gpu_addr);<br>
> -<br>
> -     packet->data_lo = 0;<br>
> -<br>
> -     return sizeof(struct pm4_mec_release_mem) / sizeof(unsigned int);<br>
> -}<br>
> -<br>
>   const struct packet_manager_funcs kfd_v10_pm_funcs = {<br>
>        .map_process                    = pm_map_process_v10,<br>
>        .runlist                        = pm_runlist_v10,<br>
> @@ -336,13 +305,13 @@ const struct packet_manager_funcs kfd_v10_pm_funcs = {<br>
>        .map_queues                     = pm_map_queues_v10,<br>
>        .unmap_queues                   = pm_unmap_queues_v10,<br>
>        .query_status                   = pm_query_status_v10,<br>
> -     .release_mem                    = pm_release_mem_v10,<br>
> +     .release_mem                    = NULL,<br>
>        .map_process_size               = sizeof(struct pm4_mes_map_process),<br>
>        .runlist_size                   = sizeof(struct pm4_mes_runlist),<br>
>        .set_resources_size             = sizeof(struct pm4_mes_set_resources),<br>
>        .map_queues_size                = sizeof(struct pm4_mes_map_queues),<br>
>        .unmap_queues_size              = sizeof(struct pm4_mes_unmap_queues),<br>
>        .query_status_size              = sizeof(struct pm4_mes_query_status),<br>
> -     .release_mem_size               = sizeof(struct pm4_mec_release_mem)<br>
> +     .release_mem_size               = 0,<br>
>   };<br>
>   <br>
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue_v9.c b/drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue_v9.c<br>
> index 3b5ca2b1d7a6..f0e4910a8865 100644<br>
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue_v9.c<br>
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue_v9.c<br>
> @@ -336,35 +336,6 @@ static int pm_query_status_v9(struct packet_manager *pm, uint32_t *buffer,<br>
>        return 0;<br>
>   }<br>
>   <br>
> -<br>
> -static int pm_release_mem_v9(uint64_t gpu_addr, uint32_t *buffer)<br>
> -{<br>
> -     struct pm4_mec_release_mem *packet;<br>
> -<br>
> -     packet = (struct pm4_mec_release_mem *)buffer;<br>
> -     memset(buffer, 0, sizeof(struct pm4_mec_release_mem));<br>
> -<br>
> -     packet->header.u32All = pm_build_pm4_header(IT_RELEASE_MEM,<br>
> -                                     sizeof(struct pm4_mec_release_mem));<br>
> -<br>
> -     packet->bitfields2.event_type = CACHE_FLUSH_AND_INV_TS_EVENT;<br>
> -     packet->bitfields2.event_index = event_index__mec_release_mem__end_of_pipe;<br>
> -     packet->bitfields2.tcl1_action_ena = 1;<br>
> -     packet->bitfields2.tc_action_ena = 1;<br>
> -     packet->bitfields2.cache_policy = cache_policy__mec_release_mem__lru;<br>
> -<br>
> -     packet->bitfields3.data_sel = data_sel__mec_release_mem__send_32_bit_low;<br>
> -     packet->bitfields3.int_sel =<br>
> -             int_sel__mec_release_mem__send_interrupt_after_write_confirm;<br>
> -<br>
> -     packet->bitfields4.address_lo_32b = (gpu_addr & 0xffffffff) >> 2;<br>
> -     packet->address_hi = upper_32_bits(gpu_addr);<br>
> -<br>
> -     packet->data_lo = 0;<br>
> -<br>
> -     return 0;<br>
> -}<br>
> -<br>
>   const struct packet_manager_funcs kfd_v9_pm_funcs = {<br>
>        .map_process            = pm_map_process_v9,<br>
>        .runlist                = pm_runlist_v9,<br>
> @@ -372,12 +343,12 @@ const struct packet_manager_funcs kfd_v9_pm_funcs = {<br>
>        .map_queues             = pm_map_queues_v9,<br>
>        .unmap_queues           = pm_unmap_queues_v9,<br>
>        .query_status           = pm_query_status_v9,<br>
> -     .release_mem            = pm_release_mem_v9,<br>
> +     .release_mem            = NULL,<br>
>        .map_process_size       = sizeof(struct pm4_mes_map_process),<br>
>        .runlist_size           = sizeof(struct pm4_mes_runlist),<br>
>        .set_resources_size     = sizeof(struct pm4_mes_set_resources),<br>
>        .map_queues_size        = sizeof(struct pm4_mes_map_queues),<br>
>        .unmap_queues_size      = sizeof(struct pm4_mes_unmap_queues),<br>
>        .query_status_size      = sizeof(struct pm4_mes_query_status),<br>
> -     .release_mem_size       = sizeof(struct pm4_mec_release_mem)<br>
> +     .release_mem_size       = 0,<br>
>   };<o:p></o:p></p>
</div>
</div>
</div>
</blockquote>
</blockquote>
</body>
</html>