<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=us-ascii">
<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:Wingdings;
        panose-1:5 0 0 0 0 0 0 0 0 0;}
@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;}
@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:0in;
        font-size:12.0pt;
        font-family:"Aptos",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:#467886;
        text-decoration:underline;}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
        {mso-style-priority:34;
        margin-top:0in;
        margin-right:0in;
        margin-bottom:0in;
        margin-left:.5in;
        font-size:12.0pt;
        font-family:"Aptos",sans-serif;}
span.EmailStyle21
        {mso-style-type:personal-compose;
        font-family:"Aptos",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.25in 1.0in 1.25in;}
div.WordSection1
        {page:WordSection1;}
/* List Definitions */
@list l0
        {mso-list-id:931626053;
        mso-list-type:hybrid;
        mso-list-template-ids:1848386526 67698689 67698691 67698693 67698689 67698691 67698693 67698689 67698691 67698693;}
@list l0:level1
        {mso-level-number-format:bullet;
        mso-level-text:\F0B7;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;
        font-family:Symbol;}
@list l0:level2
        {mso-level-number-format:bullet;
        mso-level-text:o;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;
        font-family:"Courier New";}
@list l0:level3
        {mso-level-number-format:bullet;
        mso-level-text:\F0A7;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;
        font-family:Wingdings;}
@list l0:level4
        {mso-level-number-format:bullet;
        mso-level-text:\F0B7;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;
        font-family:Symbol;}
@list l0:level5
        {mso-level-number-format:bullet;
        mso-level-text:o;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;
        font-family:"Courier New";}
@list l0:level6
        {mso-level-number-format:bullet;
        mso-level-text:\F0A7;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;
        font-family:Wingdings;}
@list l0:level7
        {mso-level-number-format:bullet;
        mso-level-text:\F0B7;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;
        font-family:Symbol;}
@list l0:level8
        {mso-level-number-format:bullet;
        mso-level-text:o;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;
        font-family:"Courier New";}
@list l0:level9
        {mso-level-number-format:bullet;
        mso-level-text:\F0A7;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;
        font-family:Wingdings;}
ol
        {margin-bottom:0in;}
ul
        {margin-bottom:0in;}
--></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="#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 style="font-size:11.0pt">Hi Lijo,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">Right, 18bits are byte aligned range of local XCC register, 16bites are dword aligned offset range<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">We find the normalization needs to be applied to many functions, like<o:p></o:p></span></p>
<ul style="margin-top:0in" type="disc">
<li class="MsoListParagraph" style="margin-left:0in;mso-list:l0 level1 lfo1"><span style="font-size:11.0pt">KIQ: amdgpu_kiq_r/wreg/
<o:p></o:p></span></li><li class="MsoListParagraph" style="margin-left:0in;mso-list:l0 level1 lfo1"><span style="font-size:11.0pt">RLC: amdgpu_virt_rlcg_reg_rw<o:p></o:p></span></li><li class="MsoListParagraph" style="margin-left:0in;mso-list:l0 level1 lfo1"><span style="font-size:11.0pt">KIQ: amdgpu_gmc_fw_reg_write_reg_wait<o:p></o:p></span></li><li class="MsoListParagraph" style="margin-left:0in;mso-list:l0 level1 lfo1"><span style="font-size:11.0pt">KIQ: amdgpu_ring_emit_reg_write_reg_wait/amdgpu_ring_emit_reg_wait/amdgpu_ring_emit_wreg<o:p></o:p></span></li></ul>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">For sriov gfx register access, it only has 2 ways: rlc or kiq.  Both of the ways can use local xcc offset,  so we think it’s simpler change to init the gfx register offsets with local xcc offset only.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">Thanks,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">HaiJun<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><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"> Lazar, Lijo <Lijo.Lazar@amd.com>
<br>
<b>Sent:</b> Saturday, June 15, 2024 10:09 AM<br>
<b>To:</b> Jian, Jane <Jane.Jian@amd.com>; Chang, HaiJun <HaiJun.Chang@amd.com>; Zhao, Victor <Victor.Zhao@amd.com><br>
<b>Cc:</b> amd-gfx@lists.freedesktop.org<br>
<b>Subject:</b> Re: [PATCH] drm/amdgpu: keep init xcc0 for all xccs under sriov<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p style="margin:5.0pt"><span style="font-size:10.0pt;font-family:"Calibri",sans-serif;color:blue">[AMD Official Use Only - AMD Internal Distribution Only]<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div>
<p class="MsoNormal">Never mind, bit 16 and above is probably because of dword aligned offset.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Any reason not to do this in kiq/rlc based writes to normalise all?<o:p></o:p></p>
</div>
<div id="ms-outlook-mobile-signature">
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Thanks,<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Lijo<o:p></o:p></p>
</div>
</div>
<div class="MsoNormal" align="center" style="text-align:center">
<hr size="2" width="98%" align="center">
</div>
<div id="divRplyFwdMsg">
<p class="MsoNormal"><b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:black">From:</span></b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:black"> Lazar, Lijo<br>
<b>Sent:</b> Friday, June 14, 2024 5:20:30 PM<br>
<b>To:</b> Jian, Jane <<a href="mailto:Jane.Jian@amd.com">Jane.Jian@amd.com</a>>; Chang, HaiJun <<a href="mailto:HaiJun.Chang@amd.com">HaiJun.Chang@amd.com</a>>; Zhao, Victor <<a href="mailto:Victor.Zhao@amd.com">Victor.Zhao@amd.com</a>><br>
<b>Cc:</b> <a href="mailto:amd-gfx@lists.freedesktop.org">amd-gfx@lists.freedesktop.org</a> <<a href="mailto:amd-gfx@lists.freedesktop.org">amd-gfx@lists.freedesktop.org</a>><br>
<b>Subject:</b> Re: [PATCH] drm/amdgpu: keep init xcc0 for all xccs under sriov</span>
<o:p></o:p></p>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt"><br>
<br>
On 6/14/2024 4:40 PM, Jane Jian wrote:<br>
> [WHY]<br>
> sriov has the higher bit violation when flushing tlb<br>
> <br>
> [HOW]<br>
> for sriov only init XCC0(lower 16-bit) for all XCCs to avoid higher bit violation<br>
> since kiq ring is always local, local address without XCC ID is enough to be sent to the XCC KIQ<br>
> <br>
<br>
The description is incorrect.<br>
<br>
Bits 18:20 represent xcc id. To guarantee all paths pass a local<br>
address, you should just strip bits 18:20 in kiq/rlcg read/write<br>
functions rather than here.<br>
<br>
Thanks,<br>
Lijo<br>
<br>
> Signed-off-by: Jane Jian <<a href="mailto:Jane.Jian@amd.com">Jane.Jian@amd.com</a>><br>
> ---<br>
>  drivers/gpu/drm/amd/amdgpu/gfxhub_v1_2.c | 23 +++++++++++++++--------<br>
>  1 file changed, 15 insertions(+), 8 deletions(-)<br>
> <br>
> diff --git a/drivers/gpu/drm/amd/amdgpu/gfxhub_v1_2.c b/drivers/gpu/drm/amd/amdgpu/gfxhub_v1_2.c<br>
> index e14acab5cceb..4e38a66a52f4 100644<br>
> --- a/drivers/gpu/drm/amd/amdgpu/gfxhub_v1_2.c<br>
> +++ b/drivers/gpu/drm/amd/amdgpu/gfxhub_v1_2.c<br>
> @@ -537,29 +537,36 @@ static void gfxhub_v1_2_xcc_init(struct amdgpu_device *adev, uint32_t xcc_mask)<br>
>  {<br>
>        struct amdgpu_vmhub *hub;<br>
>        int i;<br>
> +     uint32_t gc_index;<br>
>  <br>
>        for_each_inst(i, xcc_mask) {<br>
>                hub = &adev->vmhub[AMDGPU_GFXHUB(i)];<br>
>  <br>
> +             /* for sriov only init XCC0(lower 16-bit) to avoid higher bit violation */<br>
> +             if (amdgpu_sriov_vf(adev))<br>
> +                     gc_index = 0;<br>
> +             else<br>
> +                     gc_index = GET_INST(GC, i);<br>
> +<br>
>                hub->ctx0_ptb_addr_lo32 =<br>
> -                     SOC15_REG_OFFSET(GC, GET_INST(GC, i),<br>
> +                     SOC15_REG_OFFSET(GC, gc_index,<br>
>                                regVM_CONTEXT0_PAGE_TABLE_BASE_ADDR_LO32);<br>
>                hub->ctx0_ptb_addr_hi32 =<br>
> -                     SOC15_REG_OFFSET(GC, GET_INST(GC, i),<br>
> +                     SOC15_REG_OFFSET(GC, gc_index,<br>
>                                regVM_CONTEXT0_PAGE_TABLE_BASE_ADDR_HI32);<br>
>                hub->vm_inv_eng0_sem =<br>
> -                     SOC15_REG_OFFSET(GC, GET_INST(GC, i), regVM_INVALIDATE_ENG0_SEM);<br>
> +                     SOC15_REG_OFFSET(GC, gc_index, regVM_INVALIDATE_ENG0_SEM);<br>
>                hub->vm_inv_eng0_req =<br>
> -                     SOC15_REG_OFFSET(GC, GET_INST(GC, i), regVM_INVALIDATE_ENG0_REQ);<br>
> +                     SOC15_REG_OFFSET(GC, gc_index, regVM_INVALIDATE_ENG0_REQ);<br>
>                hub->vm_inv_eng0_ack =<br>
> -                     SOC15_REG_OFFSET(GC, GET_INST(GC, i), regVM_INVALIDATE_ENG0_ACK);<br>
> +                     SOC15_REG_OFFSET(GC, gc_index, regVM_INVALIDATE_ENG0_ACK);<br>
>                hub->vm_context0_cntl =<br>
> -                     SOC15_REG_OFFSET(GC, GET_INST(GC, i), regVM_CONTEXT0_CNTL);<br>
> +                     SOC15_REG_OFFSET(GC, gc_index, regVM_CONTEXT0_CNTL);<br>
>                hub->vm_l2_pro_fault_status =<br>
> -                     SOC15_REG_OFFSET(GC, GET_INST(GC, i),<br>
> +                     SOC15_REG_OFFSET(GC, gc_index,<br>
>                                regVM_L2_PROTECTION_FAULT_STATUS);<br>
>                hub->vm_l2_pro_fault_cntl =<br>
> -                     SOC15_REG_OFFSET(GC, GET_INST(GC, i), regVM_L2_PROTECTION_FAULT_CNTL);<br>
> +                     SOC15_REG_OFFSET(GC, gc_index, regVM_L2_PROTECTION_FAULT_CNTL);<br>
>  <br>
>                hub->ctx_distance = regVM_CONTEXT1_CNTL -<br>
>                                regVM_CONTEXT0_CNTL;<o:p></o:p></span></p>
</div>
</div>
</div>
</div>
</div>
</body>
</html>