]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
drm/amdgpu: read hw register to check pg status.
authorRex Zhu <Rex.Zhu@amd.com>
Wed, 8 Feb 2017 09:17:55 +0000 (17:17 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 13 Feb 2017 17:43:04 +0000 (12:43 -0500)
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 files changed:
drivers/gpu/drm/amd/amdgpu/amdgpu.h
drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c
drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c
drivers/gpu/drm/amd/amdgpu/vce_v3_0.c
drivers/gpu/drm/amd/include/asic_reg/smu/smu_7_0_1_sh_mask.h
drivers/gpu/drm/amd/include/asic_reg/smu/smu_7_1_1_d.h
drivers/gpu/drm/amd/include/asic_reg/smu/smu_7_1_1_sh_mask.h
drivers/gpu/drm/amd/include/asic_reg/smu/smu_7_1_2_d.h
drivers/gpu/drm/amd/include/asic_reg/smu/smu_7_1_2_sh_mask.h
drivers/gpu/drm/amd/include/asic_reg/smu/smu_7_1_3_d.h
drivers/gpu/drm/amd/include/asic_reg/smu/smu_7_1_3_sh_mask.h

index 96ad79627dbb1da635cf2203530c87da753b37c7..e9af03113fc3667b2513ea9fe20dcfc55af63a78 100644 (file)
@@ -1037,7 +1037,6 @@ struct amdgpu_uvd {
        bool                    use_ctx_buf;
        struct amd_sched_entity entity;
        uint32_t                srbm_soft_reset;
-       bool                    is_powergated;
 };
 
 /*
@@ -1066,7 +1065,6 @@ struct amdgpu_vce {
        struct amd_sched_entity entity;
        uint32_t                srbm_soft_reset;
        unsigned                num_rings;
-       bool                    is_powergated;
 };
 
 /*
index f15df99f0a06a35d4bbcd5bdec0cdd14daa43d70..97af4827f652b3642f38bde035bf8ccf707a9e1b 100644 (file)
@@ -723,7 +723,8 @@ static int uvd_v4_2_set_powergating_state(void *handle,
        if (state == AMD_PG_STATE_GATE) {
                uvd_v4_2_stop(adev);
                if (adev->pg_flags & AMD_PG_SUPPORT_UVD && amdgpu_dpm == 0) {
-                       if (!(RREG32_SMC(ixCURRENT_PG_STATUS) & 0x4)) {
+                       if (!(RREG32_SMC(ixCURRENT_PG_STATUS) &
+                               CURRENT_PG_STATUS__UVD_PG_STATUS_MASK)) {
                                WREG32(mmUVD_PGFSM_CONFIG, (UVD_PGFSM_CONFIG__UVD_PGFSM_FSM_ADDR_MASK   |
                                                        UVD_PGFSM_CONFIG__UVD_PGFSM_POWER_DOWN_MASK |
                                                        UVD_PGFSM_CONFIG__UVD_PGFSM_P1_SELECT_MASK));
@@ -733,7 +734,8 @@ static int uvd_v4_2_set_powergating_state(void *handle,
                return 0;
        } else {
                if (adev->pg_flags & AMD_PG_SUPPORT_UVD && amdgpu_dpm == 0) {
-                       if (RREG32_SMC(ixCURRENT_PG_STATUS) & 0x4) {
+                       if (RREG32_SMC(ixCURRENT_PG_STATUS) &
+                               CURRENT_PG_STATUS__UVD_PG_STATUS_MASK) {
                                WREG32(mmUVD_PGFSM_CONFIG, (UVD_PGFSM_CONFIG__UVD_PGFSM_FSM_ADDR_MASK   |
                                                UVD_PGFSM_CONFIG__UVD_PGFSM_POWER_UP_MASK |
                                                UVD_PGFSM_CONFIG__UVD_PGFSM_P1_SELECT_MASK));
index 46e715193924328635e11101ef18b0a0227ec1e2..ad8c02e423d4f2c5d2161a1ec2b173185d8b516a 100644 (file)
@@ -825,12 +825,10 @@ static int uvd_v5_0_set_powergating_state(void *handle,
 
        if (state == AMD_PG_STATE_GATE) {
                uvd_v5_0_stop(adev);
-               adev->uvd.is_powergated = true;
        } else {
                ret = uvd_v5_0_start(adev);
                if (ret)
                        goto out;
-               adev->uvd.is_powergated = false;
        }
 
 out:
@@ -844,7 +842,8 @@ static void uvd_v5_0_get_clockgating_state(void *handle, u32 *flags)
 
        mutex_lock(&adev->pm.mutex);
 
-       if (adev->uvd.is_powergated) {
+       if (RREG32_SMC(ixCURRENT_PG_STATUS) &
+                               CURRENT_PG_STATUS__UVD_PG_STATUS_MASK) {
                DRM_INFO("Cannot get clockgating state when UVD is powergated.\n");
                goto out;
        }
index af83ab8c1250a871537e53cf9e460060ab3340f0..18a6de4e1512b189efc153244454763b5b7e5263 100644 (file)
@@ -1051,12 +1051,10 @@ static int uvd_v6_0_set_powergating_state(void *handle,
 
        if (state == AMD_PG_STATE_GATE) {
                uvd_v6_0_stop(adev);
-               adev->uvd.is_powergated = true;
        } else {
                ret = uvd_v6_0_start(adev);
                if (ret)
                        goto out;
-               adev->uvd.is_powergated = false;
        }
 
 out:
@@ -1070,7 +1068,8 @@ static void uvd_v6_0_get_clockgating_state(void *handle, u32 *flags)
 
        mutex_lock(&adev->pm.mutex);
 
-       if (adev->uvd.is_powergated) {
+       if (RREG32_SMC(ixCURRENT_PG_STATUS) &
+                               CURRENT_PG_STATUS__UVD_PG_STATUS_MASK) {
                DRM_INFO("Cannot get clockgating state when UVD is powergated.\n");
                goto out;
        }
index a78298529f07f5aaf501e8fa0eebb9f690ca8877..93ec8815bb1395bf6d8a3db4519f3ab50ac2e65f 100644 (file)
@@ -768,12 +768,10 @@ static int vce_v3_0_set_powergating_state(void *handle,
                ret = vce_v3_0_stop(adev);
                if (ret)
                        goto out;
-               adev->vce.is_powergated = true;
        } else {
                ret = vce_v3_0_start(adev);
                if (ret)
                        goto out;
-               adev->vce.is_powergated = false;
        }
 
 out:
@@ -787,7 +785,8 @@ static void vce_v3_0_get_clockgating_state(void *handle, u32 *flags)
 
        mutex_lock(&adev->pm.mutex);
 
-       if (adev->vce.is_powergated) {
+       if (RREG32_SMC(ixCURRENT_PG_STATUS) &
+                       CURRENT_PG_STATUS__VCE_PG_STATUS_MASK) {
                DRM_INFO("Cannot get clockgating state when VCE is powergated.\n");
                goto out;
        }
index 25882a4dea5d0ebebfb242d3d597b563e2f7a17e..34c6ff52710e745a30433a371f9ac317553eb885 100644 (file)
 #define ROM_SW_DATA_63__ROM_SW_DATA__SHIFT 0x0
 #define ROM_SW_DATA_64__ROM_SW_DATA_MASK 0xffffffff
 #define ROM_SW_DATA_64__ROM_SW_DATA__SHIFT 0x0
+#define CURRENT_PG_STATUS__VCE_PG_STATUS_MASK 0x00000002
+#define CURRENT_PG_STATUS__UVD_PG_STATUS_MASK 0x00000004
 
 #endif /* SMU_7_0_1_SH_MASK_H */
index a9ef1562f43bde57536802d3df0371e444e30672..66597c64f525410b71ab7502b2d5b1d602ff4608 100644 (file)
 #define ixROM_SW_DATA_62                                                        0xc060011c
 #define ixROM_SW_DATA_63                                                        0xc0600120
 #define ixROM_SW_DATA_64                                                        0xc0600124
+#define ixCURRENT_PG_STATUS                                                     0xc020029c
 
 #endif /* SMU_7_1_1_D_H */
index 2c997f7b5d13b10f60852e1660d3f23d55a58370..fb06f2e2f6e66318d8d6bb07ee5aa446e0d65f75 100644 (file)
 #define ROM_SW_DATA_63__ROM_SW_DATA__SHIFT 0x0
 #define ROM_SW_DATA_64__ROM_SW_DATA_MASK 0xffffffff
 #define ROM_SW_DATA_64__ROM_SW_DATA__SHIFT 0x0
+#define CURRENT_PG_STATUS__VCE_PG_STATUS_MASK 0x00000002
+#define CURRENT_PG_STATUS__UVD_PG_STATUS_MASK 0x00000004
 
 #endif /* SMU_7_1_1_SH_MASK_H */
index 22dd4c2b7290647250a7391c9a6dc42a321003c2..4446d43d2a8fbb5f326afff33805f4377950e535 100644 (file)
 #define ixROM_SW_DATA_62                                                        0xc060011c
 #define ixROM_SW_DATA_63                                                        0xc0600120
 #define ixROM_SW_DATA_64                                                        0xc0600124
+#define ixCURRENT_PG_STATUS                                                     0xc020029c
 
 #endif /* SMU_7_1_2_D_H */
index 518fd02e9d356ae2cae4c071dc0bb7589e35745e..627906674fe81f064c99511e40fcc58a222f741d 100644 (file)
 #define ROM_SW_DATA_63__ROM_SW_DATA__SHIFT 0x0
 #define ROM_SW_DATA_64__ROM_SW_DATA_MASK 0xffffffff
 #define ROM_SW_DATA_64__ROM_SW_DATA__SHIFT 0x0
+#define CURRENT_PG_STATUS__VCE_PG_STATUS_MASK 0x00000002
+#define CURRENT_PG_STATUS__UVD_PG_STATUS_MASK 0x00000004
 
 #endif /* SMU_7_1_2_SH_MASK_H */
index eca2b851f25f78c14bb04d850feac1d15b0ff7fa..0333d880bc9ebd021c905ed0d0091ff596c24f7c 100644 (file)
 #define ixGC_CAC_ACC_CU14                                                       0xc8
 #define ixGC_CAC_ACC_CU15                                                       0xc9
 #define ixGC_CAC_OVRD_CU                                                        0xe7
-
+#define ixCURRENT_PG_STATUS                                                     0xc020029c
 #endif /* SMU_7_1_3_D_H */
index 1ede9e2747140383a72d7c1ee98bfc7816a492e4..654c1093d362c7e5876abadf392420c4568eb9b7 100644 (file)
 #define GC_CAC_OVRD_CU__OVRRD_SELECT__SHIFT 0x0
 #define GC_CAC_OVRD_CU__OVRRD_VALUE_MASK 0xffff0000
 #define GC_CAC_OVRD_CU__OVRRD_VALUE__SHIFT 0x10
+#define CURRENT_PG_STATUS__VCE_PG_STATUS_MASK 0x00000002
+#define CURRENT_PG_STATUS__UVD_PG_STATUS_MASK 0x00000004
+
 
 #endif /* SMU_7_1_3_SH_MASK_H */