]> git.itanic.dy.fi Git - linux-stable/commitdiff
drm/amdgpu: drop runpm from amdgpu_device structure
authorGuchun Chen <guchun.chen@amd.com>
Thu, 14 Jul 2022 08:37:29 +0000 (16:37 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 18 Jul 2022 20:42:39 +0000 (16:42 -0400)
It's redundant, as now switching to rpm_mode to indicate
runtime power management mode.

Suggested-by: Lijo Lazar <lijo.lazar@amd.com>
Signed-off-by: Guchun Chen <guchun.chen@amd.com>
Reviewed-by: Lijo Lazar <lijo.lazar@amd.com>
Reviewed-by: Evan Quan <evan.quan@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu.h
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c

index 2871a3e3801f8a68ca616c96110e241e83fcc73b..3aa8ae1bc35afd6301bfb1fb54856efd6a650a65 100644 (file)
@@ -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;
 
index e3d1397081606271f5610b087989100ef745c27f..4c66aff11a400292cab0ac7bf6f15e8cb5b15529 100644 (file)
@@ -2121,7 +2121,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);
@@ -2178,7 +2178,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);
        }
@@ -2461,7 +2461,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;
        }
@@ -2530,7 +2530,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 */
@@ -2574,7 +2574,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;
        }
index a74fa195b3790de337c10d83f46e464c6bc84d19..b8ba59c93fc0c8abe17b9d817a0a72850b32c701 100644 (file)
@@ -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