On 9/29/26 04:25, Yifan Zhang wrote:
> block GPU PCI bar access during mode1 reset on gfx12, to resolve
> the random mode1 reset hang issue.

Interesting idea, that is much simpler than trying to mess with CPU page tables 
in the GPU reset path.

The only downside I can see is that we now drop VRAM and doorbell writes, but I 
think that won't matter since VRAM is lost by a mode1 reset anyway.

MMIO writes are dropped as well which means that we can also drop the 
no_hw_access flag.

And BTW the SMU code should absolutely *NOT* touch that no_hw_access flag in 
any way. Who added that there?

Regards,
Christian.

> 
> Signed-off-by: Yifan Zhang <[email protected]>
> ---
>  .../drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c  | 29 ++++++++++++-------
>  1 file changed, 19 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c 
> b/drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c
> index 072d9c4e202d..25b9085ead71 100644
> --- a/drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c
> +++ b/drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c
> @@ -2078,21 +2078,30 @@ static int smu_v14_0_2_set_df_cstate(struct 
> smu_context *smu,
>  
>  static int smu_v14_0_2_mode1_reset(struct smu_context *smu)
>  {
> +     struct amdgpu_device *adev = smu->adev;
> +     u16 saved_cmd, cmd;
>       int ret = 0;
>  
>       ret = smu_cmn_send_debug_smc_msg(smu, DEBUGSMC_MSG_Mode1Reset);
> -     if (!ret) {
> -             if (amdgpu_emu_mode == 1) {
> -                     msleep(50000);
> -             } else {
> -                     /* disable mmio access while doing mode 1 reset*/
> -                     smu->adev->no_hw_access = true;
> -                     /* ensure no_hw_access is globally visible before any 
> MMIO */
> -                     smp_mb();
> -                     msleep(1000);
> -             }
> +     if (ret)
> +             return ret;
> +
> +     pci_read_config_word(adev->pdev, PCI_COMMAND, &saved_cmd);
> +     cmd = saved_cmd & ~PCI_COMMAND_MEMORY;
> +     pci_write_config_word(adev->pdev, PCI_COMMAND, cmd);
> +
> +     if (amdgpu_emu_mode == 1) {
> +             msleep(50000);
> +     } else {
> +             /* disable mmio access while doing mode 1 reset*/
> +             smu->adev->no_hw_access = true;
> +             /* ensure no_hw_access is globally visible before any MMIO */
> +             smp_mb();
> +             msleep(1000);
>       }
>  
> +     pci_write_config_word(adev->pdev, PCI_COMMAND, saved_cmd);
> +
>       return ret;
>  }
>  

Reply via email to