Re: [PATCH 3/3] drm/amd: Explicitly disable ASPM when dynamic switching disabled

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

 



On Mon, Oct 23, 2023 at 5:12 PM Mario Limonciello
<mario.limonciello@xxxxxxx> wrote:
>
> Currently there are separate but related checks:
> * amdgpu_device_should_use_aspm()
> * amdgpu_device_aspm_support_quirk()
> * amdgpu_device_pcie_dynamic_switching_supported()
>
> Simplify into checking whether DPM was enabled or not in the auto
> case.  This works because amdgpu_device_pcie_dynamic_switching_supported()
> populates that value.
>
> Signed-off-by: Mario Limonciello <mario.limonciello@xxxxxxx>

Series is:
Reviewed-by: Alex Deucher <alexander.deucher@xxxxxxx>

> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu.h        |  2 --
>  drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 21 ++++++---------------
>  drivers/gpu/drm/amd/amdgpu/nv.c            |  7 +++----
>  drivers/gpu/drm/amd/amdgpu/vi.c            |  2 +-
>  4 files changed, 10 insertions(+), 22 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> index 44df1a5bce7f..c1c98bd2d489 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> @@ -1339,9 +1339,7 @@ void amdgpu_device_pci_config_reset(struct amdgpu_device *adev);
>  int amdgpu_device_pci_reset(struct amdgpu_device *adev);
>  bool amdgpu_device_need_post(struct amdgpu_device *adev);
>  bool amdgpu_device_seamless_boot_supported(struct amdgpu_device *adev);
> -bool amdgpu_device_pcie_dynamic_switching_supported(void);
>  bool amdgpu_device_should_use_aspm(struct amdgpu_device *adev);
> -bool amdgpu_device_aspm_support_quirk(void);
>
>  void amdgpu_cs_report_moved_bytes(struct amdgpu_device *adev, u64 num_bytes,
>                                   u64 num_vis_bytes);
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> index 4e144be7f044..7ec32b44df05 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> @@ -1456,14 +1456,14 @@ bool amdgpu_device_seamless_boot_supported(struct amdgpu_device *adev)
>  }
>
>  /*
> - * Intel hosts such as Raptor Lake and Sapphire Rapids don't support dynamic
> - * speed switching. Until we have confirmation from Intel that a specific host
> - * supports it, it's safer that we keep it disabled for all.
> + * Intel hosts such as Rocket Lake, Alder Lake, Raptor Lake and Sapphire Rapids
> + * don't support dynamic speed switching. Until we have confirmation from Intel
> + * that a specific host supports it, it's safer that we keep it disabled for all.
>   *
>   * https://edc.intel.com/content/www/us/en/design/products/platforms/details/raptor-lake-s/13th-generation-core-processors-datasheet-volume-1-of-2/005/pci-express-support/
>   * https://gitlab.freedesktop.org/drm/amd/-/issues/2663
>   */
> -bool amdgpu_device_pcie_dynamic_switching_supported(void)
> +static bool amdgpu_device_pcie_dynamic_switching_supported(void)
>  {
>  #if IS_ENABLED(CONFIG_X86)
>         struct cpuinfo_x86 *c = &cpu_data(0);
> @@ -1498,20 +1498,11 @@ bool amdgpu_device_should_use_aspm(struct amdgpu_device *adev)
>         }
>         if (adev->flags & AMD_IS_APU)
>                 return false;
> +       if (!(adev->pm.pp_feature & PP_PCIE_DPM_MASK))
> +               return false;
>         return pcie_aspm_enabled(adev->pdev);
>  }
>
> -bool amdgpu_device_aspm_support_quirk(void)
> -{
> -#if IS_ENABLED(CONFIG_X86)
> -       struct cpuinfo_x86 *c = &cpu_data(0);
> -
> -       return !(c->x86 == 6 && c->x86_model == INTEL_FAM6_ALDERLAKE);
> -#else
> -       return true;
> -#endif
> -}
> -
>  /* if we get transitioned to only one device, take VGA back */
>  /**
>   * amdgpu_device_vga_set_decode - enable/disable vga decode
> diff --git a/drivers/gpu/drm/amd/amdgpu/nv.c b/drivers/gpu/drm/amd/amdgpu/nv.c
> index 9fa220de1490..4d7976b77767 100644
> --- a/drivers/gpu/drm/amd/amdgpu/nv.c
> +++ b/drivers/gpu/drm/amd/amdgpu/nv.c
> @@ -513,7 +513,7 @@ static int nv_set_vce_clocks(struct amdgpu_device *adev, u32 evclk, u32 ecclk)
>
>  static void nv_program_aspm(struct amdgpu_device *adev)
>  {
> -       if (!amdgpu_device_should_use_aspm(adev) || !amdgpu_device_aspm_support_quirk())
> +       if (!amdgpu_device_should_use_aspm(adev))
>                 return;
>
>         if (adev->nbio.funcs->program_aspm)
> @@ -608,9 +608,8 @@ static int nv_update_umd_stable_pstate(struct amdgpu_device *adev,
>         if (adev->gfx.funcs->update_perfmon_mgcg)
>                 adev->gfx.funcs->update_perfmon_mgcg(adev, !enter);
>
> -       if (!(adev->flags & AMD_IS_APU) &&
> -           (adev->nbio.funcs->enable_aspm) &&
> -            amdgpu_device_should_use_aspm(adev))
> +       if (adev->nbio.funcs->enable_aspm &&
> +           amdgpu_device_should_use_aspm(adev))
>                 adev->nbio.funcs->enable_aspm(adev, !enter);
>
>         return 0;
> diff --git a/drivers/gpu/drm/amd/amdgpu/vi.c b/drivers/gpu/drm/amd/amdgpu/vi.c
> index 1a08052bade3..1a98812981f4 100644
> --- a/drivers/gpu/drm/amd/amdgpu/vi.c
> +++ b/drivers/gpu/drm/amd/amdgpu/vi.c
> @@ -1124,7 +1124,7 @@ static void vi_program_aspm(struct amdgpu_device *adev)
>         bool bL1SS = false;
>         bool bClkReqSupport = true;
>
> -       if (!amdgpu_device_should_use_aspm(adev) || !amdgpu_device_pcie_dynamic_switching_supported())
> +       if (!amdgpu_device_should_use_aspm(adev))
>                 return;
>
>         if (adev->asic_type < CHIP_POLARIS10)
> --
> 2.34.1
>




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

  Powered by Linux