RE: [PATCH 1/2] drm/amdgpu: reposition the gpu reset checking for reuse

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



[Public]

-----Original Message-----
From: Alex Deucher <alexdeucher@xxxxxxxxx>
Sent: Wednesday, March 15, 2023 10:36 PM
To: Huang, Tim <Tim.Huang@xxxxxxx>
Cc: amd-gfx@xxxxxxxxxxxxxxxxxxxxx; Deucher, Alexander <Alexander.Deucher@xxxxxxx>; Zhang, Yifan <Yifan1.Zhang@xxxxxxx>; Limonciello, Mario <Mario.Limonciello@xxxxxxx>
Subject: Re: [PATCH 1/2] drm/amdgpu: reposition the gpu reset checking for reuse

On Wed, Mar 15, 2023 at 7:05 AM Tim Huang <tim.huang@xxxxxxx> wrote:
>
> Move the amdgpu_acpi_should_gpu_reset out of CONFIG_SUSPEND to share
> it with hibernate case.
>
> Signed-off-by: Tim Huang <tim.huang@xxxxxxx>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu.h      |  4 +--
>  drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c | 40
> +++++++++++++-----------
>  2 files changed, 24 insertions(+), 20 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> index 5c6132502f35..5bddc03332b3 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> @@ -1392,10 +1392,12 @@ int amdgpu_acpi_smart_shift_update(struct
> drm_device *dev, enum amdgpu_ss ss_sta  int
> amdgpu_acpi_pcie_notify_device_ready(struct amdgpu_device *adev);
>
>  void amdgpu_acpi_get_backlight_caps(struct amdgpu_dm_backlight_caps
> *caps);
> +bool amdgpu_acpi_should_gpu_reset(struct amdgpu_device *adev);
>  void amdgpu_acpi_detect(void);
>  #else
>  static inline int amdgpu_acpi_init(struct amdgpu_device *adev) {
> return 0; }  static inline void amdgpu_acpi_fini(struct amdgpu_device
> *adev) { }
> +static inline bool amdgpu_acpi_should_gpu_reset(struct amdgpu_device
> +*adev) { return false; }
>  static inline void amdgpu_acpi_detect(void) { }  static inline bool
> amdgpu_acpi_is_power_shift_control_supported(void) { return false; }
> static inline int amdgpu_acpi_power_shift_control(struct amdgpu_device
> *adev, @@ -1406,11 +1408,9 @@ static inline int
> amdgpu_acpi_smart_shift_update(struct drm_device *dev,
>
>  #if defined(CONFIG_ACPI) && defined(CONFIG_SUSPEND)  bool
> amdgpu_acpi_is_s3_active(struct amdgpu_device *adev); -bool
> amdgpu_acpi_should_gpu_reset(struct amdgpu_device *adev);  bool
> amdgpu_acpi_is_s0ix_active(struct amdgpu_device *adev);  #else  static
> inline bool amdgpu_acpi_is_s0ix_active(struct amdgpu_device *adev) {
> return false; } -static inline bool
> amdgpu_acpi_should_gpu_reset(struct amdgpu_device *adev) { return
> false; }  static inline bool amdgpu_acpi_is_s3_active(struct
> amdgpu_device *adev) { return false; }  #endif
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c
> index 25e902077caf..065944bdeee4 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c
> @@ -971,6 +971,28 @@ static bool amdgpu_atcs_pci_probe_handle(struct pci_dev *pdev)
>         return true;
>  }
>
> +
> +/**
> + * amdgpu_acpi_should_gpu_reset
> + *
> + * @adev: amdgpu_device_pointer
> + *
> + * returns true if should reset GPU, false if not  */ bool
> +amdgpu_acpi_should_gpu_reset(struct amdgpu_device *adev) {
> +       if (adev->flags & AMD_IS_APU)
> +               return false;
> +
> +       if (amdgpu_sriov_vf(adev))
> +               return false;
> +
> +#if IS_ENABLED(CONFIG_SUSPEND)
> +       return pm_suspend_target_state != PM_SUSPEND_TO_IDLE; #endif
> +/* CONFIG_SUSPEND */
> +       return true;


Should probably be:
#if IS_ENABLED(CONFIG_SUSPEND)
    return pm_suspend_target_state != PM_SUSPEND_TO_IDLE; #else
    return true;
#endif

Yes, will fix it. Thanks Alex.

With that fixed, series is:
Reviewed-by: Alex Deucher <alexander.deucher@xxxxxxx>

> +}
> +
>  /*
>   * amdgpu_acpi_detect - detect ACPI ATIF/ATCS methods
>   *
> @@ -1042,24 +1064,6 @@ bool amdgpu_acpi_is_s3_active(struct amdgpu_device *adev)
>                 (pm_suspend_target_state == PM_SUSPEND_MEM);  }
>
> -/**
> - * amdgpu_acpi_should_gpu_reset
> - *
> - * @adev: amdgpu_device_pointer
> - *
> - * returns true if should reset GPU, false if not
> - */
> -bool amdgpu_acpi_should_gpu_reset(struct amdgpu_device *adev) -{
> -       if (adev->flags & AMD_IS_APU)
> -               return false;
> -
> -       if (amdgpu_sriov_vf(adev))
> -               return false;
> -
> -       return pm_suspend_target_state != PM_SUSPEND_TO_IDLE;
> -}
> -
>  /**
>   * amdgpu_acpi_is_s0ix_active
>   *
> --
> 2.25.1
>




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux