<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<div>Secure part requires PSP load VCN boot sequence which is with indirect sram mode.</div>
<div><br>
</div>
<div>Regards,</div>
<div>Leo</div>
<div><br>
</div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> Alex Deucher <alexdeucher@gmail.com><br>
<b>Sent:</b> January 16, 2023 4:50 PM<br>
<b>To:</b> Guilherme G. Piccoli <gpiccoli@igalia.com><br>
<b>Cc:</b> amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org>; Jiang, Sonny <Sonny.Jiang@amd.com>; kernel@gpiccoli.net <kernel@gpiccoli.net>; Pan, Xinhui <Xinhui.Pan@amd.com>; dri-devel@lists.freedesktop.org <dri-devel@lists.freedesktop.org>; Lazar,
 Lijo <Lijo.Lazar@amd.com>; Limonciello, Mario <Mario.Limonciello@amd.com>; kernel-dev@igalia.com <kernel-dev@igalia.com>; Deucher, Alexander <Alexander.Deucher@amd.com>; Zhu, James <James.Zhu@amd.com>; Liu, Leo <Leo.Liu@amd.com>; Koenig, Christian <Christian.Koenig@amd.com><br>
<b>Subject:</b> Re: [PATCH 3/3] drm/amdgpu/vcn: Add parameter to force (en/dis)abling indirect SRAM mode</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">On Mon, Jan 16, 2023 at 4:21 PM Guilherme G. Piccoli<br>
<gpiccoli@igalia.com> wrote:<br>
><br>
> Currently the FW loading path perform some checks based on IP model<br>
> and in case it is advertised as supported, the VCN indirect SRAM<br>
> mode is used.<br>
><br>
> Happens that in case there's any issue on FW and this mode ends-up<br>
> not being properly supported, the driver probe fails [0]. Debugging<br>
> this requires driver rebuilding, so to allow fast debug and experiments,<br>
> add a parameter to force setting indirect SRAM mode to true/false from<br>
> the kernel command-line; parameter default is -1, which doesn't change<br>
> the current driver's behavior.<br>
<br>
Probably a question for Leo or James, but I was under the impression<br>
non-indirect mode didn't work on production silicon for most chips,<br>
but maybe I'm mis-remembering that.<br>
<br>
Alex<br>
<br>
<br>
><br>
> [0] Example of this issue, observed on Steam Deck:<br>
><br>
> [drm] kiq ring mec 2 pipe 1 q 0<br>
> [drm] failed to load ucode VCN0_RAM(0x3A)<br>
> [drm] psp gfx command LOAD_IP_FW(0x6) failed and response status is (0xFFFF0000)<br>
> amdgpu 0000:04:00.0: [drm:amdgpu_ring_test_helper [amdgpu]] *ERROR* ring vcn_dec_0 test failed (-110)<br>
> [drm:amdgpu_device_init.cold [amdgpu]] *ERROR* hw_init of IP block <vcn_v3_0> failed -110<br>
> amdgpu 0000:04:00.0: amdgpu: amdgpu_device_ip_init failed<br>
> amdgpu 0000:04:00.0: amdgpu: Fatal error during GPU init<br>
><br>
> Cc: James Zhu <James.Zhu@amd.com><br>
> Cc: Lazar Lijo <Lijo.Lazar@amd.com><br>
> Cc: Leo Liu <leo.liu@amd.com><br>
> Cc: Mario Limonciello <mario.limonciello@amd.com><br>
> Cc: Sonny Jiang <sonny.jiang@amd.com><br>
> Signed-off-by: Guilherme G. Piccoli <gpiccoli@igalia.com><br>
> ---<br>
><br>
><br>
> This work is based on agd5f/amd-staging-drm-next branch.<br>
> Thanks in advance for reviews/comments!<br>
> Cheers,<br>
><br>
> Guilherme<br>
><br>
><br>
>  drivers/gpu/drm/amd/amdgpu/amdgpu.h     | 1 +<br>
>  drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 9 +++++++++<br>
>  drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 3 +++<br>
>  3 files changed, 13 insertions(+)<br>
><br>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h<br>
> index 872450a3a164..5d3c92c94f18 100644<br>
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h<br>
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h<br>
> @@ -215,6 +215,7 @@ extern int amdgpu_noretry;<br>
>  extern int amdgpu_force_asic_type;<br>
>  extern int amdgpu_smartshift_bias;<br>
>  extern int amdgpu_use_xgmi_p2p;<br>
> +extern int amdgpu_indirect_sram;<br>
>  #ifdef CONFIG_HSA_AMD<br>
>  extern int sched_policy;<br>
>  extern bool debug_evictions;<br>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c<br>
> index 06aba201d4db..c7182c0bc841 100644<br>
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c<br>
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c<br>
> @@ -187,6 +187,7 @@ int amdgpu_num_kcq = -1;<br>
>  int amdgpu_smartshift_bias;<br>
>  int amdgpu_use_xgmi_p2p = 1;<br>
>  int amdgpu_vcnfw_log;<br>
> +int amdgpu_indirect_sram = -1;<br>
><br>
>  static void amdgpu_drv_delayed_reset_work_handler(struct work_struct *work);<br>
><br>
> @@ -941,6 +942,14 @@ MODULE_PARM_DESC(smu_pptable_id,<br>
>         "specify pptable id to be used (-1 = auto(default) value, 0 = use pptable from vbios, > 0 = soft pptable id)");<br>
>  module_param_named(smu_pptable_id, amdgpu_smu_pptable_id, int, 0444);<br>
><br>
> +/**<br>
> + * DOC: indirect_sram (int)<br>
> + * Allow users to force using (or not) the VCN indirect SRAM mode in the fw load<br>
> + * code. Default is -1, meaning auto (aka, don't mess with driver's behavior).<br>
> + */<br>
> +MODULE_PARM_DESC(indirect_sram, "Force VCN indirect SRAM (-1 = auto (default), 0 = disabled, 1 = enabled)");<br>
> +module_param_named(indirect_sram, amdgpu_indirect_sram, int, 0444);<br>
> +<br>
>  /* These devices are not supported by amdgpu.<br>
>   * They are supported by the mach64, r128, radeon drivers<br>
>   */<br>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c<br>
> index 1f880e162d9d..a2290087e01c 100644<br>
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c<br>
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c<br>
> @@ -137,6 +137,9 @@ int amdgpu_vcn_sw_init(struct amdgpu_device *adev)<br>
>                 return -EINVAL;<br>
>         }<br>
><br>
> +       if (amdgpu_indirect_sram >= 0)<br>
> +               adev->vcn.indirect_sram = (bool)amdgpu_indirect_sram;<br>
> +<br>
>         hdr = (const struct common_firmware_header *)adev->vcn.fw->data;<br>
>         adev->vcn.fw_version = le32_to_cpu(hdr->ucode_version);<br>
><br>
> --<br>
> 2.39.0<br>
><br>
</div>
</span></font></div>
</body>
</html>