[PATCH 4/4] drm/amdgpu: drop runpm from amdgpu_device structure
Lazar, Lijo
lijo.lazar at amd.com
Thu Jul 14 10:52:55 UTC 2022
On 7/14/2022 2:13 PM, Guchun Chen wrote:
> It's redundant, as now switching to rpm_mode to indicate
> runtime power management mode.
>
> Suggested-by: Lijo Lazar <lijo.lazar at amd.com>
> Signed-off-by: Guchun Chen <guchun.chen at amd.com>
Series is:
Reviewed-by: Lijo Lazar <lijo.lazar at amd.com>
Thanks,
Lijo
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu.h | 1 -
> drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 10 +++++-----
> drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 23 ++++++++++-------------
> 3 files changed, 15 insertions(+), 19 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> index 15f290c9523d..9f729a648005 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> @@ -1011,7 +1011,6 @@ struct amdgpu_device {
> uint64_t df_perfmon_config_assign_mask[AMDGPU_MAX_DF_PERFMONS];
>
> /* enable runtime pm on the device */
> - bool runpm;
> bool in_runpm;
> bool has_pr3;
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> index 1cc9260e75de..70a7203a2916 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> @@ -2118,7 +2118,7 @@ static int amdgpu_pci_probe(struct pci_dev *pdev,
> if (ret)
> DRM_ERROR("Creating debugfs files failed (%d).\n", ret);
>
> - if (adev->runpm) {
> + if (adev->pm.rpm_mode != AMDGPU_RUNPM_NONE) {
> /* only need to skip on ATPX */
> if (amdgpu_device_supports_px(ddev))
> dev_pm_set_driver_flags(ddev->dev, DPM_FLAG_NO_DIRECT_COMPLETE);
> @@ -2175,7 +2175,7 @@ amdgpu_pci_remove(struct pci_dev *pdev)
>
> drm_dev_unplug(dev);
>
> - if (adev->runpm) {
> + if (adev->pm.rpm_mode != AMDGPU_RUNPM_NONE) {
> pm_runtime_get_sync(dev->dev);
> pm_runtime_forbid(dev->dev);
> }
> @@ -2458,7 +2458,7 @@ static int amdgpu_pmops_runtime_suspend(struct device *dev)
> struct amdgpu_device *adev = drm_to_adev(drm_dev);
> int ret, i;
>
> - if (!adev->runpm) {
> + if (adev->pm.rpm_mode == AMDGPU_RUNPM_NONE) {
> pm_runtime_forbid(dev);
> return -EBUSY;
> }
> @@ -2527,7 +2527,7 @@ static int amdgpu_pmops_runtime_resume(struct device *dev)
> struct amdgpu_device *adev = drm_to_adev(drm_dev);
> int ret;
>
> - if (!adev->runpm)
> + if (adev->pm.rpm_mode == AMDGPU_RUNPM_NONE)
> return -EINVAL;
>
> /* Avoids registers access if device is physically gone */
> @@ -2571,7 +2571,7 @@ static int amdgpu_pmops_runtime_idle(struct device *dev)
> /* we don't want the main rpm_idle to call suspend - we want to autosuspend */
> int ret = 1;
>
> - if (!adev->runpm) {
> + if (adev->pm.rpm_mode == AMDGPU_RUNPM_NONE) {
> pm_runtime_forbid(dev);
> return -EBUSY;
> }
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
> index 9182e81e3135..a3744c0b632b 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
> @@ -147,14 +147,13 @@ int amdgpu_driver_load_kms(struct amdgpu_device *adev, unsigned long flags)
> goto out;
> }
>
> + adev->pm.rpm_mode = AMDGPU_RUNPM_NONE;
> if (amdgpu_device_supports_px(dev) &&
> - (amdgpu_runtime_pm != 0)) { /* enable runpm by default for atpx */
> - adev->runpm = true;
> + (amdgpu_runtime_pm != 0)) { /* enable PX as runtime mode */
> adev->pm.rpm_mode = AMDGPU_RUNPM_PX;
> dev_info(adev->dev, "Using ATPX for runtime pm\n");
> } else if (amdgpu_device_supports_boco(dev) &&
> - (amdgpu_runtime_pm != 0)) { /* enable runpm by default for boco */
> - adev->runpm = true;
> + (amdgpu_runtime_pm != 0)) { /* enable boco as runtime mode */
> adev->pm.rpm_mode = AMDGPU_RUNPM_BOCO;
> dev_info(adev->dev, "Using BOCO for runtime pm\n");
> } else if (amdgpu_device_supports_baco(dev) &&
> @@ -162,25 +161,23 @@ int amdgpu_driver_load_kms(struct amdgpu_device *adev, unsigned long flags)
> switch (adev->asic_type) {
> case CHIP_VEGA20:
> case CHIP_ARCTURUS:
> - /* enable runpm if runpm=1 */
> + /* enable BACO as runpm mode if runpm=1 */
> if (amdgpu_runtime_pm > 0)
> - adev->runpm = true;
> + adev->pm.rpm_mode = AMDGPU_RUNPM_BACO;
> break;
> case CHIP_VEGA10:
> - /* turn runpm on if noretry=0 */
> + /* enable BACO as runpm mode if noretry=0 */
> if (!adev->gmc.noretry)
> - adev->runpm = true;
> + adev->pm.rpm_mode = AMDGPU_RUNPM_BACO;
> break;
> default:
> - /* enable runpm on CI+ */
> - adev->runpm = true;
> + /* enable BACO as runpm mode on CI+ */
> + adev->pm.rpm_mode = AMDGPU_RUNPM_BACO;
> break;
> }
>
> - if (adev->runpm) {
> - adev->pm.rpm_mode = AMDGPU_RUNPM_BACO;
> + if (adev->pm.rpm_mode == AMDGPU_RUNPM_BACO)
> dev_info(adev->dev, "Using BACO for runtime pm\n");
> - }
> }
>
> /* Call ACPI methods: require modeset init
>
More information about the amd-gfx
mailing list