<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<font size="2"><span style="font-size:11pt"><span data-markjs="true" class="mark8sv019n2x" data-ogac="" data-ogab="" data-ogsc="" data-ogsb="">Reviewed-by</span>: Horace Chen <horace.chen@amd.com></span></font><br>
</div>
<div>
<div id="appendonsend"></div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font style="font-size:11pt" face="Calibri, sans-serif" color="#000000"><b>发件人:</b> Koenig, Christian <Christian.Koenig@amd.com><br>
<b>发送时间:</b> 2021年6月8日 3:41<br>
<b>收件人:</b> Khaire, Rohit <Rohit.Khaire@amd.com>; amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org>; Kuehling, Felix <Felix.Kuehling@amd.com>; Deucher, Alexander <Alexander.Deucher@amd.com>; Zhang, Hawking <Hawking.Zhang@amd.com>; Deng, Emily <Emily.Deng@amd.com>;
 Liu, Monk <Monk.Liu@amd.com>; Zhou, Peng Ju <PengJu.Zhou@amd.com>; Chen, Horace <Horace.Chen@amd.com><br>
<b>抄送:</b> Ming, Davis <Davis.Ming@amd.com><br>
<b>主题:</b> Re: [PATCH] drm/amdgpu: Use PSP to program IH_RB_CNTL_RING1/2 on SRIOV</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt">
<div class="PlainText"><br>
<br>
Am 07.06.21 um 21:39 schrieb Rohit Khaire:<br>
> This is similar to IH_RB_CNTL programming in<br>
> navi10_ih_toggle_ring_interrupts<br>
><br>
> Signed-off-by: Rohit Khaire <rohit.khaire@amd.com><br>
<br>
Acked-by: Christian König <christian.koenig@amd.com><br>
<br>
> ---<br>
>   drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c |  2 ++<br>
>   drivers/gpu/drm/amd/amdgpu/navi10_ih.c  | 20 +++++++++++++++-----<br>
>   2 files changed, 17 insertions(+), 5 deletions(-)<br>
><br>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c<br>
> index 47ceb783e2a5..058b1b1271e1 100644<br>
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c<br>
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c<br>
> @@ -683,6 +683,8 @@ int psp_reg_program(struct psp_context *psp, enum psp_reg_prog_id reg,<br>
>   <br>
>        psp_prep_reg_prog_cmd_buf(cmd, reg, value);<br>
>        ret = psp_cmd_submit_buf(psp, NULL, cmd, psp->fence_buf_mc_addr);<br>
> +     if (ret)<br>
> +             DRM_ERROR("PSP failed to program reg id %d", reg);<br>
>   <br>
>        kfree(cmd);<br>
>        return ret;<br>
> diff --git a/drivers/gpu/drm/amd/amdgpu/navi10_ih.c b/drivers/gpu/drm/amd/amdgpu/navi10_ih.c<br>
> index eac564e8dd52..376ea281c4a7 100644<br>
> --- a/drivers/gpu/drm/amd/amdgpu/navi10_ih.c<br>
> +++ b/drivers/gpu/drm/amd/amdgpu/navi10_ih.c<br>
> @@ -120,11 +120,23 @@ force_update_wptr_for_self_int(struct amdgpu_device *adev,<br>
>        ih_rb_cntl = REG_SET_FIELD(ih_rb_cntl, IH_RB_CNTL_RING1,<br>
>                                   RB_USED_INT_THRESHOLD, threshold);<br>
>   <br>
> -     WREG32_SOC15(OSSSYS, 0, mmIH_RB_CNTL_RING1, ih_rb_cntl);<br>
> +     if (amdgpu_sriov_vf(adev) && amdgpu_sriov_reg_indirect_ih(adev)) {<br>
> +             if (psp_reg_program(&adev->psp, PSP_REG_IH_RB_CNTL_RING1, ih_rb_cntl))<br>
> +                     return;<br>
> +     } else {<br>
> +             WREG32_SOC15(OSSSYS, 0, mmIH_RB_CNTL_RING1, ih_rb_cntl);<br>
> +     }<br>
> +<br>
>        ih_rb_cntl = RREG32_SOC15(OSSSYS, 0, mmIH_RB_CNTL_RING2);<br>
>        ih_rb_cntl = REG_SET_FIELD(ih_rb_cntl, IH_RB_CNTL_RING2,<br>
>                                   RB_USED_INT_THRESHOLD, threshold);<br>
> -     WREG32_SOC15(OSSSYS, 0, mmIH_RB_CNTL_RING2, ih_rb_cntl);<br>
> +     if (amdgpu_sriov_vf(adev) && amdgpu_sriov_reg_indirect_ih(adev)) {<br>
> +             if (psp_reg_program(&adev->psp, PSP_REG_IH_RB_CNTL_RING2, ih_rb_cntl))<br>
> +                     return;<br>
> +     } else {<br>
> +             WREG32_SOC15(OSSSYS, 0, mmIH_RB_CNTL_RING2, ih_rb_cntl);<br>
> +     }<br>
> +<br>
>        WREG32_SOC15(OSSSYS, 0, mmIH_CNTL2, ih_cntl);<br>
>   }<br>
>   <br>
> @@ -153,10 +165,8 @@ static int navi10_ih_toggle_ring_interrupts(struct amdgpu_device *adev,<br>
>                tmp = REG_SET_FIELD(tmp, IH_RB_CNTL, ENABLE_INTR, (enable ? 1 : 0));<br>
>   <br>
>        if (amdgpu_sriov_vf(adev) && amdgpu_sriov_reg_indirect_ih(adev)) {<br>
> -             if (psp_reg_program(&adev->psp, ih_regs->psp_reg_id, tmp)) {<br>
> -                     DRM_ERROR("PSP program IH_RB_CNTL failed!\n");<br>
> +             if (psp_reg_program(&adev->psp, ih_regs->psp_reg_id, tmp))<br>
>                        return -ETIMEDOUT;<br>
> -             }<br>
>        } else {<br>
>                WREG32(ih_regs->ih_rb_cntl, tmp);<br>
>        }<br>
<br>
</div>
</span></font></div>
</div>
</body>
</html>