<html 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=Windows-1252">
<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:DengXian;
        panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Aptos;
        panose-1:2 11 0 4 2 2 2 2 2 4;}
@font-face
        {font-family:"\@DengXian";
        panose-1:2 1 6 0 3 1 1 1 1 1;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;
        mso-ligatures:none;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style>
</head>
<body lang="en-CN" link="#467886" vlink="#96607D" 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 lang="EN-US" style="font-family:"Aptos",sans-serif">Hi
<a id="OWAAMD5EB853895CF064988F720901BE37DA9" href="mailto:Christian.Koenig@amd.com">
<span style="font-family:"Aptos",sans-serif;text-decoration:none">@Koenig, Christian</span></a>,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Aptos",sans-serif"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Aptos",sans-serif">Thank you for the feedback. I have revised the patch according to your suggestions and sent out the v2 patch list. Please help review. Thank you!<br>
<br>
mail titles of v2 patchlist:<br>
[PATCH v2 0/3] enable switching to new gpu index for hibernate on SRIOV.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Aptos",sans-serif">[PATCH v2 1/3] drm/amdgpu: update XGMI physical node id and GMC configs on resume<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Aptos",sans-serif">[PATCH v2 2/3] drm/amdgpu: update GPU addresses for SMU and PSP<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Aptos",sans-serif">[PATCH v2 3/3] drm/amdgpu: enable pdb0 for hibernation on SRIOV<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Aptos",sans-serif"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Aptos",sans-serif">Regards<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Aptos",sans-serif">Sam<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Aptos",sans-serif"><o:p> </o:p></span></p>
<div id="mail-editor-reference-message-container">
<div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal" style="margin-bottom:12.0pt"><b><span style="font-size:12.0pt;font-family:"Aptos",sans-serif;color:black">From:
</span></b><span style="font-size:12.0pt;font-family:"Aptos",sans-serif;color:black">Koenig, Christian <Christian.Koenig@amd.com><br>
<b>Date: </b>Monday, April 28, 2025 at 19:30<br>
<b>To: </b>Zhang, GuoQing (Sam) <GuoQing.Zhang@amd.com>, Christian König <ckoenig.leichtzumerken@gmail.com>, amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org>, Deucher, Alexander <Alexander.Deucher@amd.com><br>
<b>Cc: </b>Zhao, Victor <Victor.Zhao@amd.com>, Chang, HaiJun <HaiJun.Chang@amd.com>, Deng, Emily <Emily.Deng@amd.com>, Zhang, Owen(SRDC) <Owen.Zhang2@amd.com><br>
<b>Subject: </b>Re: [PATCH 4/6] drm/amdgpu: enable pdb0 for hibernation on SRIOV<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt">On 4/24/25 05:38, Zhang, GuoQing (Sam) wrote:<br>
> Hi Christian,<br>
> <br>
> Thank you for the review and the feedback.I will update the patch according to <br>
> your feedback.<br>
> <br>
> Please see my 2 inline comments below.<br>
<br>
Please make sure to always CC my work mail address, otherwise I will only take a look the next time I work through the mailing lists.<br>
> <br>
>> > index d90e9daf5a50..83a3444c69d9 100644<br>
> <br>
>> > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c<br>
> <br>
>> > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c<br>
> <br>
>> > @@ -287,8 +287,14 @@ int amdgpu_bo_create_reserved(struct amdgpu_device *adev,<br>
> <br>
>> >                goto error_unpin;<br>
> <br>
>> >        }<br>
> <br>
>> >  <br>
> <br>
>> > -     if (gpu_addr)<br>
> <br>
>> > +     if (gpu_addr) {<br>
> <br>
>> >                *gpu_addr = amdgpu_bo_gpu_offset(*bo_ptr);<br>
> <br>
>> > +             if (!adev->gmc.xgmi.connected_to_cpu && adev->gmc.enable_pdb0) {<br>
> <br>
>> > +                     if ((*bo_ptr)->tbo.resource->mem_type == TTM_PL_VRAM) {<br>
> <br>
>> > +                             *gpu_addr -= amdgpu_ttm_domain_start(adev, TTM_PL_VRAM);<br>
> <br>
>> > +                     }<br>
> <br>
>> > +             }<br>
> <br>
>> > +     }<br>
> <br>
>> <br>
> <br>
>> Please NAK to that approach here. The GPU offset should still point into the mapped VRAM.<br>
> <br>
> This change is to change to the default GPU address from FB aperture type to <br>
> pdb0 type in this centralized place so that I don’t need to change every <br>
> callsite of amdgpu_bo_create_reserved().<br>
> <br>
> Could you suggest a better approach if this approach is not acceptable?<br>
<br>
<br>
The whole code is completely superflous. When PDB0 is used the vram_start is adjusted and you don't need to do anything here.<br>
<br>
See function amdgpu_gmc_sysvm_location(). You probably need to adjust that to have a static setup instead of using the XGMI node infos.<br>
<br>
<br>
>> > @@ -1719,6 +1723,14 @@ static void gmc_v9_0_vram_gtt_location(struct amdgpu_device *adev,<br>
> <br>
>> >  {<br>
> <br>
>> >        u64 base = adev->mmhub.funcs->get_fb_location(adev);<br>
> <br>
>> >  <br>
> <br>
>> > +     if (adev->gmc.xgmi.connected_to_cpu || adev->gmc.enable_pdb0) {<br>
> <br>
>> > +             adev->gmc.vmid0_page_table_depth = 1;<br>
> <br>
>> > +             adev->gmc.vmid0_page_table_block_size = 12;<br>
> <br>
>> > +     } else {<br>
> <br>
>> > +             adev->gmc.vmid0_page_table_depth = 0;<br>
> <br>
>> > +             adev->gmc.vmid0_page_table_block_size = 0;<br>
> <br>
>> > +     }<br>
> <br>
>> > +<br>
> <br>
>> <br>
> <br>
>> What is the justification to moving that stuff around?<br>
> <br>
> vmid0_page_table_block_size is used in new code in amdgpu_gmc_sysvm_location().
<br>
> See the call sequence below.<br>
> <br>
> gmc_v9_0_sw_init<br>
> <br>
> - gmc_v9_0_mc_init<br>
> <br>
>                  - gmc_v9_0_vram_gtt_location,<br>
> <br>
>                                  - vmid0_page_table_block_size = 12, **new <br>
> location**<br>
> <br>
>                                  - amdgpu_gmc_sysvm_location<br>
> <br>
>                                                  - use <br>
> **vmid0_page_table_block_size**<br>
> <br>
> - gmc_v9_0_gart_init,<br>
> <br>
>                  - assign vmid0_page_table_block_size, **old location**<br>
<br>
<br>
That is noteven remotely corect.<br>
<br>
See the code in gmc_v9_0_vram_gtt_location(). You use amdgpu_gmc_sysvm_location() when PDB0 is allocted and you use gmc_v9_0_vram_gtt_location() when it isn't.<br>
<br>
But adjusting this function here doesn't make any sense at all.<br>
<br>
Regards,<br>
Christian.</p>
</div>
</div>
</div>
</div>
</div>
</body>
</html>