diff options
author | Rex Zhu <Rex.Zhu@amd.com> | 2018-02-27 06:15:08 -0500 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2018-03-05 15:39:05 -0500 |
commit | ada6770e956b7f7d298bfef56fed457ade5bad9e (patch) | |
tree | 3fc0ffe8b4a2d384ecac2681496677ed86e8de0f /drivers | |
parent | 6848d73e889bb29cfede51df8c1d0496c9787454 (diff) |
drm/amd/pp: Remove cgs_query_system_info
Get gpu info through adev directly in powerplay
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c | 59 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/include/cgs_common.h | 34 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c | 22 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c | 54 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/powerplay/hwmgr/smu7_clockpowergating.c | 17 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c | 57 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/powerplay/hwmgr/smu7_powertune.c | 9 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c | 18 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/powerplay/hwmgr/vega10_powertune.c | 28 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/powerplay/hwmgr/vega10_processpptables.c | 13 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/powerplay/smumgr/ci_smumgr.c | 14 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/powerplay/smumgr/iceland_smumgr.c | 7 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/powerplay/smumgr/tonga_smumgr.c | 13 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/powerplay/smumgr/vega10_smumgr.c | 13 |
14 files changed, 72 insertions, 286 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c index 795be958cf5e..f37482c76e20 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c | |||
@@ -835,64 +835,6 @@ static int amdgpu_cgs_is_virtualization_enabled(void *cgs_device) | |||
835 | return amdgpu_sriov_vf(adev); | 835 | return amdgpu_sriov_vf(adev); |
836 | } | 836 | } |
837 | 837 | ||
838 | static int amdgpu_cgs_query_system_info(struct cgs_device *cgs_device, | ||
839 | struct cgs_system_info *sys_info) | ||
840 | { | ||
841 | CGS_FUNC_ADEV; | ||
842 | |||
843 | if (NULL == sys_info) | ||
844 | return -ENODEV; | ||
845 | |||
846 | if (sizeof(struct cgs_system_info) != sys_info->size) | ||
847 | return -ENODEV; | ||
848 | |||
849 | switch (sys_info->info_id) { | ||
850 | case CGS_SYSTEM_INFO_ADAPTER_BDF_ID: | ||
851 | sys_info->value = adev->pdev->devfn | (adev->pdev->bus->number << 8); | ||
852 | break; | ||
853 | case CGS_SYSTEM_INFO_PCIE_GEN_INFO: | ||
854 | sys_info->value = adev->pm.pcie_gen_mask; | ||
855 | break; | ||
856 | case CGS_SYSTEM_INFO_PCIE_MLW: | ||
857 | sys_info->value = adev->pm.pcie_mlw_mask; | ||
858 | break; | ||
859 | case CGS_SYSTEM_INFO_PCIE_DEV: | ||
860 | sys_info->value = adev->pdev->device; | ||
861 | break; | ||
862 | case CGS_SYSTEM_INFO_PCIE_REV: | ||
863 | sys_info->value = adev->pdev->revision; | ||
864 | break; | ||
865 | case CGS_SYSTEM_INFO_CG_FLAGS: | ||
866 | sys_info->value = adev->cg_flags; | ||
867 | break; | ||
868 | case CGS_SYSTEM_INFO_PG_FLAGS: | ||
869 | sys_info->value = adev->pg_flags; | ||
870 | break; | ||
871 | case CGS_SYSTEM_INFO_GFX_CU_INFO: | ||
872 | sys_info->value = adev->gfx.cu_info.number; | ||
873 | break; | ||
874 | case CGS_SYSTEM_INFO_GFX_SE_INFO: | ||
875 | sys_info->value = adev->gfx.config.max_shader_engines; | ||
876 | break; | ||
877 | case CGS_SYSTEM_INFO_PCIE_SUB_SYS_ID: | ||
878 | sys_info->value = adev->pdev->subsystem_device; | ||
879 | break; | ||
880 | case CGS_SYSTEM_INFO_PCIE_SUB_SYS_VENDOR_ID: | ||
881 | sys_info->value = adev->pdev->subsystem_vendor; | ||
882 | break; | ||
883 | case CGS_SYSTEM_INFO_PCIE_BUS_DEVFN: | ||
884 | sys_info->value = adev->pdev->devfn; | ||
885 | break; | ||
886 | case CGS_SYSTEM_INFO_VRAM_WIDTH: | ||
887 | sys_info->value = adev->gmc.vram_width; | ||
888 | break; | ||
889 | default: | ||
890 | return -ENODEV; | ||
891 | } | ||
892 | |||
893 | return 0; | ||
894 | } | ||
895 | |||
896 | static int amdgpu_cgs_get_active_displays_info(struct cgs_device *cgs_device, | 838 | static int amdgpu_cgs_get_active_displays_info(struct cgs_device *cgs_device, |
897 | struct cgs_display_info *info) | 839 | struct cgs_display_info *info) |
898 | { | 840 | { |
@@ -996,7 +938,6 @@ static const struct cgs_ops amdgpu_cgs_ops = { | |||
996 | .set_clockgating_state = amdgpu_cgs_set_clockgating_state, | 938 | .set_clockgating_state = amdgpu_cgs_set_clockgating_state, |
997 | .get_active_displays_info = amdgpu_cgs_get_active_displays_info, | 939 | .get_active_displays_info = amdgpu_cgs_get_active_displays_info, |
998 | .notify_dpm_enabled = amdgpu_cgs_notify_dpm_enabled, | 940 | .notify_dpm_enabled = amdgpu_cgs_notify_dpm_enabled, |
999 | .query_system_info = amdgpu_cgs_query_system_info, | ||
1000 | .is_virtualization_enabled = amdgpu_cgs_is_virtualization_enabled, | 941 | .is_virtualization_enabled = amdgpu_cgs_is_virtualization_enabled, |
1001 | .enter_safe_mode = amdgpu_cgs_enter_safe_mode, | 942 | .enter_safe_mode = amdgpu_cgs_enter_safe_mode, |
1002 | .lock_grbm_idx = amdgpu_cgs_lock_grbm_idx, | 943 | .lock_grbm_idx = amdgpu_cgs_lock_grbm_idx, |
diff --git a/drivers/gpu/drm/amd/include/cgs_common.h b/drivers/gpu/drm/amd/include/cgs_common.h index 851168b7b173..113ba6f07171 100644 --- a/drivers/gpu/drm/amd/include/cgs_common.h +++ b/drivers/gpu/drm/amd/include/cgs_common.h | |||
@@ -88,33 +88,6 @@ enum cgs_ucode_id { | |||
88 | CGS_UCODE_ID_MAXIMUM, | 88 | CGS_UCODE_ID_MAXIMUM, |
89 | }; | 89 | }; |
90 | 90 | ||
91 | enum cgs_system_info_id { | ||
92 | CGS_SYSTEM_INFO_ADAPTER_BDF_ID = 1, | ||
93 | CGS_SYSTEM_INFO_PCIE_GEN_INFO, | ||
94 | CGS_SYSTEM_INFO_PCIE_MLW, | ||
95 | CGS_SYSTEM_INFO_PCIE_DEV, | ||
96 | CGS_SYSTEM_INFO_PCIE_REV, | ||
97 | CGS_SYSTEM_INFO_CG_FLAGS, | ||
98 | CGS_SYSTEM_INFO_PG_FLAGS, | ||
99 | CGS_SYSTEM_INFO_GFX_CU_INFO, | ||
100 | CGS_SYSTEM_INFO_GFX_SE_INFO, | ||
101 | CGS_SYSTEM_INFO_PCIE_SUB_SYS_ID, | ||
102 | CGS_SYSTEM_INFO_PCIE_SUB_SYS_VENDOR_ID, | ||
103 | CGS_SYSTEM_INFO_PCIE_BUS_DEVFN, | ||
104 | CGS_SYSTEM_INFO_VRAM_WIDTH, | ||
105 | CGS_SYSTEM_INFO_ID_MAXIMUM, | ||
106 | }; | ||
107 | |||
108 | struct cgs_system_info { | ||
109 | uint64_t size; | ||
110 | enum cgs_system_info_id info_id; | ||
111 | union { | ||
112 | void *ptr; | ||
113 | uint64_t value; | ||
114 | }; | ||
115 | uint64_t padding[13]; | ||
116 | }; | ||
117 | |||
118 | /* | 91 | /* |
119 | * enum cgs_resource_type - GPU resource type | 92 | * enum cgs_resource_type - GPU resource type |
120 | */ | 93 | */ |
@@ -375,9 +348,6 @@ typedef int(*cgs_get_active_displays_info)( | |||
375 | 348 | ||
376 | typedef int (*cgs_notify_dpm_enabled)(struct cgs_device *cgs_device, bool enabled); | 349 | typedef int (*cgs_notify_dpm_enabled)(struct cgs_device *cgs_device, bool enabled); |
377 | 350 | ||
378 | typedef int (*cgs_query_system_info)(struct cgs_device *cgs_device, | ||
379 | struct cgs_system_info *sys_info); | ||
380 | |||
381 | typedef int (*cgs_is_virtualization_enabled_t)(void *cgs_device); | 351 | typedef int (*cgs_is_virtualization_enabled_t)(void *cgs_device); |
382 | 352 | ||
383 | typedef int (*cgs_enter_safe_mode)(struct cgs_device *cgs_device, bool en); | 353 | typedef int (*cgs_enter_safe_mode)(struct cgs_device *cgs_device, bool en); |
@@ -416,8 +386,6 @@ struct cgs_ops { | |||
416 | cgs_get_active_displays_info get_active_displays_info; | 386 | cgs_get_active_displays_info get_active_displays_info; |
417 | /* notify dpm enabled */ | 387 | /* notify dpm enabled */ |
418 | cgs_notify_dpm_enabled notify_dpm_enabled; | 388 | cgs_notify_dpm_enabled notify_dpm_enabled; |
419 | /* get system info */ | ||
420 | cgs_query_system_info query_system_info; | ||
421 | cgs_is_virtualization_enabled_t is_virtualization_enabled; | 389 | cgs_is_virtualization_enabled_t is_virtualization_enabled; |
422 | cgs_enter_safe_mode enter_safe_mode; | 390 | cgs_enter_safe_mode enter_safe_mode; |
423 | cgs_lock_grbm_idx lock_grbm_idx; | 391 | cgs_lock_grbm_idx lock_grbm_idx; |
@@ -483,8 +451,6 @@ struct cgs_device | |||
483 | #define cgs_get_active_displays_info(dev, info) \ | 451 | #define cgs_get_active_displays_info(dev, info) \ |
484 | CGS_CALL(get_active_displays_info, dev, info) | 452 | CGS_CALL(get_active_displays_info, dev, info) |
485 | 453 | ||
486 | #define cgs_query_system_info(dev, sys_info) \ | ||
487 | CGS_CALL(query_system_info, dev, sys_info) | ||
488 | #define cgs_get_pci_resource(cgs_device, resource_type, size, offset, \ | 454 | #define cgs_get_pci_resource(cgs_device, resource_type, size, offset, \ |
489 | resource_base) \ | 455 | resource_base) \ |
490 | CGS_CALL(get_pci_resource, cgs_device, resource_type, size, offset, \ | 456 | CGS_CALL(get_pci_resource, cgs_device, resource_type, size, offset, \ |
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c index 2aa84c728e81..8c1f884ae555 100644 --- a/drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c | |||
@@ -173,8 +173,7 @@ static uint32_t cz_get_max_sclk_level(struct pp_hwmgr *hwmgr) | |||
173 | static int cz_initialize_dpm_defaults(struct pp_hwmgr *hwmgr) | 173 | static int cz_initialize_dpm_defaults(struct pp_hwmgr *hwmgr) |
174 | { | 174 | { |
175 | struct cz_hwmgr *cz_hwmgr = (struct cz_hwmgr *)(hwmgr->backend); | 175 | struct cz_hwmgr *cz_hwmgr = (struct cz_hwmgr *)(hwmgr->backend); |
176 | struct cgs_system_info sys_info = {0}; | 176 | struct amdgpu_device *adev = hwmgr->adev; |
177 | int result; | ||
178 | 177 | ||
179 | cz_hwmgr->gfx_ramp_step = 256*25/100; | 178 | cz_hwmgr->gfx_ramp_step = 256*25/100; |
180 | cz_hwmgr->gfx_ramp_delay = 1; /* by default, we delay 1us */ | 179 | cz_hwmgr->gfx_ramp_delay = 1; /* by default, we delay 1us */ |
@@ -234,17 +233,14 @@ static int cz_initialize_dpm_defaults(struct pp_hwmgr *hwmgr) | |||
234 | PHM_PlatformCaps_UVDPowerGating); | 233 | PHM_PlatformCaps_UVDPowerGating); |
235 | phm_cap_unset(hwmgr->platform_descriptor.platformCaps, | 234 | phm_cap_unset(hwmgr->platform_descriptor.platformCaps, |
236 | PHM_PlatformCaps_VCEPowerGating); | 235 | PHM_PlatformCaps_VCEPowerGating); |
237 | sys_info.size = sizeof(struct cgs_system_info); | 236 | |
238 | sys_info.info_id = CGS_SYSTEM_INFO_PG_FLAGS; | 237 | if (adev->pg_flags & AMD_PG_SUPPORT_UVD) |
239 | result = cgs_query_system_info(hwmgr->device, &sys_info); | 238 | phm_cap_set(hwmgr->platform_descriptor.platformCaps, |
240 | if (!result) { | 239 | PHM_PlatformCaps_UVDPowerGating); |
241 | if (sys_info.value & AMD_PG_SUPPORT_UVD) | 240 | if (adev->pg_flags & AMD_PG_SUPPORT_VCE) |
242 | phm_cap_set(hwmgr->platform_descriptor.platformCaps, | 241 | phm_cap_set(hwmgr->platform_descriptor.platformCaps, |
243 | PHM_PlatformCaps_UVDPowerGating); | 242 | PHM_PlatformCaps_VCEPowerGating); |
244 | if (sys_info.value & AMD_PG_SUPPORT_VCE) | 243 | |
245 | phm_cap_set(hwmgr->platform_descriptor.platformCaps, | ||
246 | PHM_PlatformCaps_VCEPowerGating); | ||
247 | } | ||
248 | 244 | ||
249 | return 0; | 245 | return 0; |
250 | } | 246 | } |
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c index 28897882607e..2c7bb056e57d 100644 --- a/drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c | |||
@@ -64,30 +64,16 @@ uint16_t convert_to_vddc(uint8_t vid) | |||
64 | return (uint16_t) ((6200 - (vid * 25)) / VOLTAGE_SCALE); | 64 | return (uint16_t) ((6200 - (vid * 25)) / VOLTAGE_SCALE); |
65 | } | 65 | } |
66 | 66 | ||
67 | static int phm_get_pci_bus_devfn(struct pp_hwmgr *hwmgr, | ||
68 | struct cgs_system_info *sys_info) | ||
69 | { | ||
70 | sys_info->size = sizeof(struct cgs_system_info); | ||
71 | sys_info->info_id = CGS_SYSTEM_INFO_PCIE_BUS_DEVFN; | ||
72 | |||
73 | return cgs_query_system_info(hwmgr->device, sys_info); | ||
74 | } | ||
75 | |||
76 | static int phm_thermal_l2h_irq(void *private_data, | 67 | static int phm_thermal_l2h_irq(void *private_data, |
77 | unsigned src_id, const uint32_t *iv_entry) | 68 | unsigned src_id, const uint32_t *iv_entry) |
78 | { | 69 | { |
79 | struct pp_hwmgr *hwmgr = (struct pp_hwmgr *)private_data; | 70 | struct pp_hwmgr *hwmgr = (struct pp_hwmgr *)private_data; |
80 | struct cgs_system_info sys_info = {0}; | 71 | struct amdgpu_device *adev = hwmgr->adev; |
81 | int result; | ||
82 | |||
83 | result = phm_get_pci_bus_devfn(hwmgr, &sys_info); | ||
84 | if (result) | ||
85 | return -EINVAL; | ||
86 | 72 | ||
87 | pr_warn("GPU over temperature range detected on PCIe %lld:%lld.%lld!\n", | 73 | pr_warn("GPU over temperature range detected on PCIe %d:%d.%d!\n", |
88 | PCI_BUS_NUM(sys_info.value), | 74 | PCI_BUS_NUM(adev->pdev->devfn), |
89 | PCI_SLOT(sys_info.value), | 75 | PCI_SLOT(adev->pdev->devfn), |
90 | PCI_FUNC(sys_info.value)); | 76 | PCI_FUNC(adev->pdev->devfn)); |
91 | return 0; | 77 | return 0; |
92 | } | 78 | } |
93 | 79 | ||
@@ -95,17 +81,12 @@ static int phm_thermal_h2l_irq(void *private_data, | |||
95 | unsigned src_id, const uint32_t *iv_entry) | 81 | unsigned src_id, const uint32_t *iv_entry) |
96 | { | 82 | { |
97 | struct pp_hwmgr *hwmgr = (struct pp_hwmgr *)private_data; | 83 | struct pp_hwmgr *hwmgr = (struct pp_hwmgr *)private_data; |
98 | struct cgs_system_info sys_info = {0}; | 84 | struct amdgpu_device *adev = hwmgr->adev; |
99 | int result; | ||
100 | |||
101 | result = phm_get_pci_bus_devfn(hwmgr, &sys_info); | ||
102 | if (result) | ||
103 | return -EINVAL; | ||
104 | 85 | ||
105 | pr_warn("GPU under temperature range detected on PCIe %lld:%lld.%lld!\n", | 86 | pr_warn("GPU under temperature range detected on PCIe %d:%d.%d!\n", |
106 | PCI_BUS_NUM(sys_info.value), | 87 | PCI_BUS_NUM(adev->pdev->devfn), |
107 | PCI_SLOT(sys_info.value), | 88 | PCI_SLOT(adev->pdev->devfn), |
108 | PCI_FUNC(sys_info.value)); | 89 | PCI_FUNC(adev->pdev->devfn)); |
109 | return 0; | 90 | return 0; |
110 | } | 91 | } |
111 | 92 | ||
@@ -113,17 +94,12 @@ static int phm_ctf_irq(void *private_data, | |||
113 | unsigned src_id, const uint32_t *iv_entry) | 94 | unsigned src_id, const uint32_t *iv_entry) |
114 | { | 95 | { |
115 | struct pp_hwmgr *hwmgr = (struct pp_hwmgr *)private_data; | 96 | struct pp_hwmgr *hwmgr = (struct pp_hwmgr *)private_data; |
116 | struct cgs_system_info sys_info = {0}; | 97 | struct amdgpu_device *adev = hwmgr->adev; |
117 | int result; | ||
118 | |||
119 | result = phm_get_pci_bus_devfn(hwmgr, &sys_info); | ||
120 | if (result) | ||
121 | return -EINVAL; | ||
122 | 98 | ||
123 | pr_warn("GPU Critical Temperature Fault detected on PCIe %lld:%lld.%lld!\n", | 99 | pr_warn("GPU Critical Temperature Fault detected on PCIe %d:%d.%d!\n", |
124 | PCI_BUS_NUM(sys_info.value), | 100 | PCI_BUS_NUM(adev->pdev->devfn), |
125 | PCI_SLOT(sys_info.value), | 101 | PCI_SLOT(adev->pdev->devfn), |
126 | PCI_FUNC(sys_info.value)); | 102 | PCI_FUNC(adev->pdev->devfn)); |
127 | return 0; | 103 | return 0; |
128 | } | 104 | } |
129 | 105 | ||
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_clockpowergating.c b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_clockpowergating.c index 402aa9cb1f78..f4cbaee4e2ca 100644 --- a/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_clockpowergating.c +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_clockpowergating.c | |||
@@ -472,23 +472,12 @@ int smu7_update_clock_gatings(struct pp_hwmgr *hwmgr, | |||
472 | */ | 472 | */ |
473 | int smu7_enable_per_cu_power_gating(struct pp_hwmgr *hwmgr, bool enable) | 473 | int smu7_enable_per_cu_power_gating(struct pp_hwmgr *hwmgr, bool enable) |
474 | { | 474 | { |
475 | struct cgs_system_info sys_info = {0}; | 475 | struct amdgpu_device *adev = hwmgr->adev; |
476 | uint32_t active_cus; | ||
477 | int result; | ||
478 | |||
479 | sys_info.size = sizeof(struct cgs_system_info); | ||
480 | sys_info.info_id = CGS_SYSTEM_INFO_GFX_CU_INFO; | ||
481 | |||
482 | result = cgs_query_system_info(hwmgr->device, &sys_info); | ||
483 | |||
484 | if (result) | ||
485 | return -EINVAL; | ||
486 | |||
487 | active_cus = sys_info.value; | ||
488 | 476 | ||
489 | if (enable) | 477 | if (enable) |
490 | return smum_send_msg_to_smc_with_parameter(hwmgr, | 478 | return smum_send_msg_to_smc_with_parameter(hwmgr, |
491 | PPSMC_MSG_GFX_CU_PG_ENABLE, active_cus); | 479 | PPSMC_MSG_GFX_CU_PG_ENABLE, |
480 | adev->gfx.cu_info.number); | ||
492 | else | 481 | else |
493 | return smum_send_msg_to_smc(hwmgr, | 482 | return smum_send_msg_to_smc(hwmgr, |
494 | PPSMC_MSG_GFX_CU_PG_DISABLE); | 483 | PPSMC_MSG_GFX_CU_PG_DISABLE); |
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c index 928427d04ebd..f6e1196a6e55 100644 --- a/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c | |||
@@ -1468,8 +1468,7 @@ static void smu7_init_dpm_defaults(struct pp_hwmgr *hwmgr) | |||
1468 | struct smu7_hwmgr *data = (struct smu7_hwmgr *)(hwmgr->backend); | 1468 | struct smu7_hwmgr *data = (struct smu7_hwmgr *)(hwmgr->backend); |
1469 | struct phm_ppt_v1_information *table_info = | 1469 | struct phm_ppt_v1_information *table_info = |
1470 | (struct phm_ppt_v1_information *)(hwmgr->pptable); | 1470 | (struct phm_ppt_v1_information *)(hwmgr->pptable); |
1471 | struct cgs_system_info sys_info = {0}; | 1471 | struct amdgpu_device *adev = hwmgr->adev; |
1472 | int result; | ||
1473 | 1472 | ||
1474 | data->dll_default_on = false; | 1473 | data->dll_default_on = false; |
1475 | data->mclk_dpm0_activity_target = 0xa; | 1474 | data->mclk_dpm0_activity_target = 0xa; |
@@ -1590,17 +1589,13 @@ static void smu7_init_dpm_defaults(struct pp_hwmgr *hwmgr) | |||
1590 | data->pcie_lane_power_saving.max = 0; | 1589 | data->pcie_lane_power_saving.max = 0; |
1591 | data->pcie_lane_power_saving.min = 16; | 1590 | data->pcie_lane_power_saving.min = 16; |
1592 | 1591 | ||
1593 | sys_info.size = sizeof(struct cgs_system_info); | 1592 | |
1594 | sys_info.info_id = CGS_SYSTEM_INFO_PG_FLAGS; | 1593 | if (adev->pg_flags & AMD_PG_SUPPORT_UVD) |
1595 | result = cgs_query_system_info(hwmgr->device, &sys_info); | 1594 | phm_cap_set(hwmgr->platform_descriptor.platformCaps, |
1596 | if (!result) { | 1595 | PHM_PlatformCaps_UVDPowerGating); |
1597 | if (sys_info.value & AMD_PG_SUPPORT_UVD) | 1596 | if (adev->pg_flags & AMD_PG_SUPPORT_VCE) |
1598 | phm_cap_set(hwmgr->platform_descriptor.platformCaps, | 1597 | phm_cap_set(hwmgr->platform_descriptor.platformCaps, |
1599 | PHM_PlatformCaps_UVDPowerGating); | 1598 | PHM_PlatformCaps_VCEPowerGating); |
1600 | if (sys_info.value & AMD_PG_SUPPORT_VCE) | ||
1601 | phm_cap_set(hwmgr->platform_descriptor.platformCaps, | ||
1602 | PHM_PlatformCaps_VCEPowerGating); | ||
1603 | } | ||
1604 | } | 1599 | } |
1605 | 1600 | ||
1606 | /** | 1601 | /** |
@@ -2035,7 +2030,7 @@ static int smu7_patch_voltage_workaround(struct pp_hwmgr *hwmgr) | |||
2035 | struct phm_ppt_v1_voltage_lookup_table *lookup_table; | 2030 | struct phm_ppt_v1_voltage_lookup_table *lookup_table; |
2036 | uint32_t i; | 2031 | uint32_t i; |
2037 | uint32_t hw_revision, sub_vendor_id, sub_sys_id; | 2032 | uint32_t hw_revision, sub_vendor_id, sub_sys_id; |
2038 | struct cgs_system_info sys_info = {0}; | 2033 | struct amdgpu_device *adev = hwmgr->adev; |
2039 | 2034 | ||
2040 | if (table_info != NULL) { | 2035 | if (table_info != NULL) { |
2041 | dep_mclk_table = table_info->vdd_dep_on_mclk; | 2036 | dep_mclk_table = table_info->vdd_dep_on_mclk; |
@@ -2043,19 +2038,9 @@ static int smu7_patch_voltage_workaround(struct pp_hwmgr *hwmgr) | |||
2043 | } else | 2038 | } else |
2044 | return 0; | 2039 | return 0; |
2045 | 2040 | ||
2046 | sys_info.size = sizeof(struct cgs_system_info); | 2041 | hw_revision = adev->pdev->revision; |
2047 | 2042 | sub_sys_id = adev->pdev->subsystem_device; | |
2048 | sys_info.info_id = CGS_SYSTEM_INFO_PCIE_REV; | 2043 | sub_vendor_id = adev->pdev->subsystem_vendor; |
2049 | cgs_query_system_info(hwmgr->device, &sys_info); | ||
2050 | hw_revision = (uint32_t)sys_info.value; | ||
2051 | |||
2052 | sys_info.info_id = CGS_SYSTEM_INFO_PCIE_SUB_SYS_ID; | ||
2053 | cgs_query_system_info(hwmgr->device, &sys_info); | ||
2054 | sub_sys_id = (uint32_t)sys_info.value; | ||
2055 | |||
2056 | sys_info.info_id = CGS_SYSTEM_INFO_PCIE_SUB_SYS_VENDOR_ID; | ||
2057 | cgs_query_system_info(hwmgr->device, &sys_info); | ||
2058 | sub_vendor_id = (uint32_t)sys_info.value; | ||
2059 | 2044 | ||
2060 | if (hwmgr->chip_id == CHIP_POLARIS10 && hw_revision == 0xC7 && | 2045 | if (hwmgr->chip_id == CHIP_POLARIS10 && hw_revision == 0xC7 && |
2061 | ((sub_sys_id == 0xb37 && sub_vendor_id == 0x1002) || | 2046 | ((sub_sys_id == 0xb37 && sub_vendor_id == 0x1002) || |
@@ -2498,7 +2483,7 @@ static int smu7_hwmgr_backend_init(struct pp_hwmgr *hwmgr) | |||
2498 | result = phm_initializa_dynamic_state_adjustment_rule_settings(hwmgr); | 2483 | result = phm_initializa_dynamic_state_adjustment_rule_settings(hwmgr); |
2499 | 2484 | ||
2500 | if (0 == result) { | 2485 | if (0 == result) { |
2501 | struct cgs_system_info sys_info = {0}; | 2486 | struct amdgpu_device *adev = hwmgr->adev; |
2502 | 2487 | ||
2503 | data->is_tlu_enabled = false; | 2488 | data->is_tlu_enabled = false; |
2504 | 2489 | ||
@@ -2507,22 +2492,10 @@ static int smu7_hwmgr_backend_init(struct pp_hwmgr *hwmgr) | |||
2507 | hwmgr->platform_descriptor.hardwarePerformanceLevels = 2; | 2492 | hwmgr->platform_descriptor.hardwarePerformanceLevels = 2; |
2508 | hwmgr->platform_descriptor.minimumClocksReductionPercentage = 50; | 2493 | hwmgr->platform_descriptor.minimumClocksReductionPercentage = 50; |
2509 | 2494 | ||
2510 | sys_info.size = sizeof(struct cgs_system_info); | 2495 | data->pcie_gen_cap = adev->pm.pcie_gen_mask; |
2511 | sys_info.info_id = CGS_SYSTEM_INFO_PCIE_GEN_INFO; | ||
2512 | result = cgs_query_system_info(hwmgr->device, &sys_info); | ||
2513 | if (result) | ||
2514 | data->pcie_gen_cap = AMDGPU_DEFAULT_PCIE_GEN_MASK; | ||
2515 | else | ||
2516 | data->pcie_gen_cap = (uint32_t)sys_info.value; | ||
2517 | if (data->pcie_gen_cap & CAIL_PCIE_LINK_SPEED_SUPPORT_GEN3) | 2496 | if (data->pcie_gen_cap & CAIL_PCIE_LINK_SPEED_SUPPORT_GEN3) |
2518 | data->pcie_spc_cap = 20; | 2497 | data->pcie_spc_cap = 20; |
2519 | sys_info.size = sizeof(struct cgs_system_info); | 2498 | data->pcie_lane_cap = adev->pm.pcie_mlw_mask; |
2520 | sys_info.info_id = CGS_SYSTEM_INFO_PCIE_MLW; | ||
2521 | result = cgs_query_system_info(hwmgr->device, &sys_info); | ||
2522 | if (result) | ||
2523 | data->pcie_lane_cap = AMDGPU_DEFAULT_PCIE_MLW_MASK; | ||
2524 | else | ||
2525 | data->pcie_lane_cap = (uint32_t)sys_info.value; | ||
2526 | 2499 | ||
2527 | hwmgr->platform_descriptor.vbiosInterruptId = 0x20000400; /* IRQ_SOURCE1_SW_INT */ | 2500 | hwmgr->platform_descriptor.vbiosInterruptId = 0x20000400; /* IRQ_SOURCE1_SW_INT */ |
2528 | /* The true clock step depends on the frequency, typically 4.5 or 9 MHz. Here we use 5. */ | 2501 | /* The true clock step depends on the frequency, typically 4.5 or 9 MHz. Here we use 5. */ |
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_powertune.c b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_powertune.c index a93829dfd730..03bc7453f3b1 100644 --- a/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_powertune.c +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_powertune.c | |||
@@ -731,14 +731,9 @@ int smu7_enable_didt_config(struct pp_hwmgr *hwmgr) | |||
731 | int result; | 731 | int result; |
732 | uint32_t num_se = 0; | 732 | uint32_t num_se = 0; |
733 | uint32_t count, value, value2; | 733 | uint32_t count, value, value2; |
734 | struct cgs_system_info sys_info = {0}; | 734 | struct amdgpu_device *adev = hwmgr->adev; |
735 | 735 | ||
736 | sys_info.size = sizeof(struct cgs_system_info); | 736 | num_se = adev->gfx.config.max_shader_engines; |
737 | sys_info.info_id = CGS_SYSTEM_INFO_GFX_SE_INFO; | ||
738 | result = cgs_query_system_info(hwmgr->device, &sys_info); | ||
739 | |||
740 | if (result == 0) | ||
741 | num_se = sys_info.value; | ||
742 | 737 | ||
743 | if (PP_CAP(PHM_PlatformCaps_SQRamping) || | 738 | if (PP_CAP(PHM_PlatformCaps_SQRamping) || |
744 | PP_CAP(PHM_PlatformCaps_DBRamping) || | 739 | PP_CAP(PHM_PlatformCaps_DBRamping) || |
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c index a7c610a0e7e1..26a5bc070989 100644 --- a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c | |||
@@ -190,8 +190,7 @@ static int vega10_set_features_platform_caps(struct pp_hwmgr *hwmgr) | |||
190 | (struct vega10_hwmgr *)(hwmgr->backend); | 190 | (struct vega10_hwmgr *)(hwmgr->backend); |
191 | struct phm_ppt_v2_information *table_info = | 191 | struct phm_ppt_v2_information *table_info = |
192 | (struct phm_ppt_v2_information *)hwmgr->pptable; | 192 | (struct phm_ppt_v2_information *)hwmgr->pptable; |
193 | struct cgs_system_info sys_info = {0}; | 193 | struct amdgpu_device *adev = hwmgr->adev; |
194 | int result; | ||
195 | 194 | ||
196 | phm_cap_set(hwmgr->platform_descriptor.platformCaps, | 195 | phm_cap_set(hwmgr->platform_descriptor.platformCaps, |
197 | PHM_PlatformCaps_SclkDeepSleep); | 196 | PHM_PlatformCaps_SclkDeepSleep); |
@@ -206,15 +205,11 @@ static int vega10_set_features_platform_caps(struct pp_hwmgr *hwmgr) | |||
206 | phm_cap_set(hwmgr->platform_descriptor.platformCaps, | 205 | phm_cap_set(hwmgr->platform_descriptor.platformCaps, |
207 | PHM_PlatformCaps_EnableSMU7ThermalManagement); | 206 | PHM_PlatformCaps_EnableSMU7ThermalManagement); |
208 | 207 | ||
209 | sys_info.size = sizeof(struct cgs_system_info); | 208 | if (adev->pg_flags & AMD_PG_SUPPORT_UVD) |
210 | sys_info.info_id = CGS_SYSTEM_INFO_PG_FLAGS; | ||
211 | result = cgs_query_system_info(hwmgr->device, &sys_info); | ||
212 | |||
213 | if (!result && (sys_info.value & AMD_PG_SUPPORT_UVD)) | ||
214 | phm_cap_set(hwmgr->platform_descriptor.platformCaps, | 209 | phm_cap_set(hwmgr->platform_descriptor.platformCaps, |
215 | PHM_PlatformCaps_UVDPowerGating); | 210 | PHM_PlatformCaps_UVDPowerGating); |
216 | 211 | ||
217 | if (!result && (sys_info.value & AMD_PG_SUPPORT_VCE)) | 212 | if (adev->pg_flags & AMD_PG_SUPPORT_VCE) |
218 | phm_cap_set(hwmgr->platform_descriptor.platformCaps, | 213 | phm_cap_set(hwmgr->platform_descriptor.platformCaps, |
219 | PHM_PlatformCaps_VCEPowerGating); | 214 | PHM_PlatformCaps_VCEPowerGating); |
220 | 215 | ||
@@ -750,7 +745,7 @@ static int vega10_hwmgr_backend_init(struct pp_hwmgr *hwmgr) | |||
750 | struct vega10_hwmgr *data; | 745 | struct vega10_hwmgr *data; |
751 | uint32_t config_telemetry = 0; | 746 | uint32_t config_telemetry = 0; |
752 | struct pp_atomfwctrl_voltage_table vol_table; | 747 | struct pp_atomfwctrl_voltage_table vol_table; |
753 | struct cgs_system_info sys_info = {0}; | 748 | struct amdgpu_device *adev = hwmgr->adev; |
754 | uint32_t reg; | 749 | uint32_t reg; |
755 | 750 | ||
756 | data = kzalloc(sizeof(struct vega10_hwmgr), GFP_KERNEL); | 751 | data = kzalloc(sizeof(struct vega10_hwmgr), GFP_KERNEL); |
@@ -843,10 +838,7 @@ static int vega10_hwmgr_backend_init(struct pp_hwmgr *hwmgr) | |||
843 | hwmgr->platform_descriptor.clockStep.engineClock = 500; | 838 | hwmgr->platform_descriptor.clockStep.engineClock = 500; |
844 | hwmgr->platform_descriptor.clockStep.memoryClock = 500; | 839 | hwmgr->platform_descriptor.clockStep.memoryClock = 500; |
845 | 840 | ||
846 | sys_info.size = sizeof(struct cgs_system_info); | 841 | data->total_active_cus = adev->gfx.cu_info.number; |
847 | sys_info.info_id = CGS_SYSTEM_INFO_GFX_CU_INFO; | ||
848 | result = cgs_query_system_info(hwmgr->device, &sys_info); | ||
849 | data->total_active_cus = sys_info.value; | ||
850 | /* Setup default Overdrive Fan control settings */ | 842 | /* Setup default Overdrive Fan control settings */ |
851 | data->odn_fan_table.target_fan_speed = | 843 | data->odn_fan_table.target_fan_speed = |
852 | hwmgr->thermal_controller.advanceFanControlParameters.usMaxFanRPM; | 844 | hwmgr->thermal_controller.advanceFanControlParameters.usMaxFanRPM; |
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_powertune.c b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_powertune.c index f5ed171d6940..b1f74c7f0943 100644 --- a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_powertune.c +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_powertune.c | |||
@@ -933,13 +933,10 @@ static int vega10_enable_cac_driving_se_didt_config(struct pp_hwmgr *hwmgr) | |||
933 | { | 933 | { |
934 | int result; | 934 | int result; |
935 | uint32_t num_se = 0, count, data; | 935 | uint32_t num_se = 0, count, data; |
936 | struct cgs_system_info sys_info = {0}; | 936 | struct amdgpu_device *adev = hwmgr->adev; |
937 | uint32_t reg; | 937 | uint32_t reg; |
938 | 938 | ||
939 | sys_info.size = sizeof(struct cgs_system_info); | 939 | num_se = adev->gfx.config.max_shader_engines; |
940 | sys_info.info_id = CGS_SYSTEM_INFO_GFX_SE_INFO; | ||
941 | if (cgs_query_system_info(hwmgr->device, &sys_info) == 0) | ||
942 | num_se = sys_info.value; | ||
943 | 940 | ||
944 | cgs_enter_safe_mode(hwmgr->device, true); | 941 | cgs_enter_safe_mode(hwmgr->device, true); |
945 | 942 | ||
@@ -987,13 +984,10 @@ static int vega10_enable_psm_gc_didt_config(struct pp_hwmgr *hwmgr) | |||
987 | { | 984 | { |
988 | int result; | 985 | int result; |
989 | uint32_t num_se = 0, count, data; | 986 | uint32_t num_se = 0, count, data; |
990 | struct cgs_system_info sys_info = {0}; | 987 | struct amdgpu_device *adev = hwmgr->adev; |
991 | uint32_t reg; | 988 | uint32_t reg; |
992 | 989 | ||
993 | sys_info.size = sizeof(struct cgs_system_info); | 990 | num_se = adev->gfx.config.max_shader_engines; |
994 | sys_info.info_id = CGS_SYSTEM_INFO_GFX_SE_INFO; | ||
995 | if (cgs_query_system_info(hwmgr->device, &sys_info) == 0) | ||
996 | num_se = sys_info.value; | ||
997 | 991 | ||
998 | cgs_enter_safe_mode(hwmgr->device, true); | 992 | cgs_enter_safe_mode(hwmgr->device, true); |
999 | 993 | ||
@@ -1052,13 +1046,10 @@ static int vega10_enable_se_edc_config(struct pp_hwmgr *hwmgr) | |||
1052 | { | 1046 | { |
1053 | int result; | 1047 | int result; |
1054 | uint32_t num_se = 0, count, data; | 1048 | uint32_t num_se = 0, count, data; |
1055 | struct cgs_system_info sys_info = {0}; | 1049 | struct amdgpu_device *adev = hwmgr->adev; |
1056 | uint32_t reg; | 1050 | uint32_t reg; |
1057 | 1051 | ||
1058 | sys_info.size = sizeof(struct cgs_system_info); | 1052 | num_se = adev->gfx.config.max_shader_engines; |
1059 | sys_info.info_id = CGS_SYSTEM_INFO_GFX_SE_INFO; | ||
1060 | if (cgs_query_system_info(hwmgr->device, &sys_info) == 0) | ||
1061 | num_se = sys_info.value; | ||
1062 | 1053 | ||
1063 | cgs_enter_safe_mode(hwmgr->device, true); | 1054 | cgs_enter_safe_mode(hwmgr->device, true); |
1064 | 1055 | ||
@@ -1103,13 +1094,10 @@ static int vega10_enable_psm_gc_edc_config(struct pp_hwmgr *hwmgr) | |||
1103 | int result; | 1094 | int result; |
1104 | uint32_t num_se = 0; | 1095 | uint32_t num_se = 0; |
1105 | uint32_t count, data; | 1096 | uint32_t count, data; |
1106 | struct cgs_system_info sys_info = {0}; | 1097 | struct amdgpu_device *adev = hwmgr->adev; |
1107 | uint32_t reg; | 1098 | uint32_t reg; |
1108 | 1099 | ||
1109 | sys_info.size = sizeof(struct cgs_system_info); | 1100 | num_se = adev->gfx.config.max_shader_engines; |
1110 | sys_info.info_id = CGS_SYSTEM_INFO_GFX_SE_INFO; | ||
1111 | if (cgs_query_system_info(hwmgr->device, &sys_info) == 0) | ||
1112 | num_se = sys_info.value; | ||
1113 | 1101 | ||
1114 | cgs_enter_safe_mode(hwmgr->device, true); | 1102 | cgs_enter_safe_mode(hwmgr->device, true); |
1115 | 1103 | ||
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_processpptables.c b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_processpptables.c index 6d44cf043618..c61d0744860d 100644 --- a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_processpptables.c +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_processpptables.c | |||
@@ -688,9 +688,9 @@ static int get_dcefclk_voltage_dependency_table( | |||
688 | uint8_t num_entries; | 688 | uint8_t num_entries; |
689 | struct phm_ppt_v1_clock_voltage_dependency_table | 689 | struct phm_ppt_v1_clock_voltage_dependency_table |
690 | *clk_table; | 690 | *clk_table; |
691 | struct cgs_system_info sys_info = {0}; | ||
692 | uint32_t dev_id; | 691 | uint32_t dev_id; |
693 | uint32_t rev_id; | 692 | uint32_t rev_id; |
693 | struct amdgpu_device *adev = hwmgr->adev; | ||
694 | 694 | ||
695 | PP_ASSERT_WITH_CODE((clk_dep_table->ucNumEntries != 0), | 695 | PP_ASSERT_WITH_CODE((clk_dep_table->ucNumEntries != 0), |
696 | "Invalid PowerPlay Table!", return -1); | 696 | "Invalid PowerPlay Table!", return -1); |
@@ -701,15 +701,8 @@ static int get_dcefclk_voltage_dependency_table( | |||
701 | * This DPM level was added to support 3DPM monitors @ 4K120Hz | 701 | * This DPM level was added to support 3DPM monitors @ 4K120Hz |
702 | * | 702 | * |
703 | */ | 703 | */ |
704 | sys_info.size = sizeof(struct cgs_system_info); | 704 | dev_id = adev->pdev->device; |
705 | sys_info.info_id = CGS_SYSTEM_INFO_PCIE_DEV; | 705 | rev_id = adev->pdev->revision; |
706 | cgs_query_system_info(hwmgr->device, &sys_info); | ||
707 | dev_id = (uint32_t)sys_info.value; | ||
708 | |||
709 | sys_info.size = sizeof(struct cgs_system_info); | ||
710 | sys_info.info_id = CGS_SYSTEM_INFO_PCIE_REV; | ||
711 | cgs_query_system_info(hwmgr->device, &sys_info); | ||
712 | rev_id = (uint32_t)sys_info.value; | ||
713 | 706 | ||
714 | if (dev_id == 0x6863 && rev_id == 0 && | 707 | if (dev_id == 0x6863 && rev_id == 0 && |
715 | clk_dep_table->entries[clk_dep_table->ucNumEntries - 1].ulClk < 90000) | 708 | clk_dep_table->entries[clk_dep_table->ucNumEntries - 1].ulClk < 90000) |
diff --git a/drivers/gpu/drm/amd/powerplay/smumgr/ci_smumgr.c b/drivers/gpu/drm/amd/powerplay/smumgr/ci_smumgr.c index 6cdaed06da0b..76f700fe7491 100644 --- a/drivers/gpu/drm/amd/powerplay/smumgr/ci_smumgr.c +++ b/drivers/gpu/drm/amd/powerplay/smumgr/ci_smumgr.c | |||
@@ -236,13 +236,10 @@ static int ci_send_msg_to_smc_with_parameter(struct pp_hwmgr *hwmgr, | |||
236 | static void ci_initialize_power_tune_defaults(struct pp_hwmgr *hwmgr) | 236 | static void ci_initialize_power_tune_defaults(struct pp_hwmgr *hwmgr) |
237 | { | 237 | { |
238 | struct ci_smumgr *smu_data = (struct ci_smumgr *)(hwmgr->smu_backend); | 238 | struct ci_smumgr *smu_data = (struct ci_smumgr *)(hwmgr->smu_backend); |
239 | struct cgs_system_info sys_info = {0}; | 239 | struct amdgpu_device *adev = hwmgr->adev; |
240 | uint32_t dev_id; | 240 | uint32_t dev_id; |
241 | 241 | ||
242 | sys_info.size = sizeof(struct cgs_system_info); | 242 | dev_id = adev->pdev->device; |
243 | sys_info.info_id = CGS_SYSTEM_INFO_PCIE_DEV; | ||
244 | cgs_query_system_info(hwmgr->device, &sys_info); | ||
245 | dev_id = (uint32_t)sys_info.value; | ||
246 | 243 | ||
247 | switch (dev_id) { | 244 | switch (dev_id) { |
248 | case 0x67BA: | 245 | case 0x67BA: |
@@ -1309,7 +1306,7 @@ static int ci_populate_all_memory_levels(struct pp_hwmgr *hwmgr) | |||
1309 | struct ci_smumgr *smu_data = (struct ci_smumgr *)(hwmgr->smu_backend); | 1306 | struct ci_smumgr *smu_data = (struct ci_smumgr *)(hwmgr->smu_backend); |
1310 | struct smu7_dpm_table *dpm_table = &data->dpm_table; | 1307 | struct smu7_dpm_table *dpm_table = &data->dpm_table; |
1311 | int result; | 1308 | int result; |
1312 | struct cgs_system_info sys_info = {0}; | 1309 | struct amdgpu_device *adev = hwmgr->adev; |
1313 | uint32_t dev_id; | 1310 | uint32_t dev_id; |
1314 | 1311 | ||
1315 | uint32_t level_array_address = smu_data->dpm_table_start + offsetof(SMU7_Discrete_DpmTable, MemoryLevel); | 1312 | uint32_t level_array_address = smu_data->dpm_table_start + offsetof(SMU7_Discrete_DpmTable, MemoryLevel); |
@@ -1330,10 +1327,7 @@ static int ci_populate_all_memory_levels(struct pp_hwmgr *hwmgr) | |||
1330 | 1327 | ||
1331 | smu_data->smc_state_table.MemoryLevel[0].EnabledForActivity = 1; | 1328 | smu_data->smc_state_table.MemoryLevel[0].EnabledForActivity = 1; |
1332 | 1329 | ||
1333 | sys_info.size = sizeof(struct cgs_system_info); | 1330 | dev_id = adev->pdev->device; |
1334 | sys_info.info_id = CGS_SYSTEM_INFO_PCIE_DEV; | ||
1335 | cgs_query_system_info(hwmgr->device, &sys_info); | ||
1336 | dev_id = (uint32_t)sys_info.value; | ||
1337 | 1331 | ||
1338 | if ((dpm_table->mclk_table.count >= 2) | 1332 | if ((dpm_table->mclk_table.count >= 2) |
1339 | && ((dev_id == 0x67B0) || (dev_id == 0x67B1))) { | 1333 | && ((dev_id == 0x67B0) || (dev_id == 0x67B1))) { |
diff --git a/drivers/gpu/drm/amd/powerplay/smumgr/iceland_smumgr.c b/drivers/gpu/drm/amd/powerplay/smumgr/iceland_smumgr.c index 11aeb150a97f..6255edf58721 100644 --- a/drivers/gpu/drm/amd/powerplay/smumgr/iceland_smumgr.c +++ b/drivers/gpu/drm/amd/powerplay/smumgr/iceland_smumgr.c | |||
@@ -281,13 +281,10 @@ static int iceland_smu_init(struct pp_hwmgr *hwmgr) | |||
281 | static void iceland_initialize_power_tune_defaults(struct pp_hwmgr *hwmgr) | 281 | static void iceland_initialize_power_tune_defaults(struct pp_hwmgr *hwmgr) |
282 | { | 282 | { |
283 | struct iceland_smumgr *smu_data = (struct iceland_smumgr *)(hwmgr->smu_backend); | 283 | struct iceland_smumgr *smu_data = (struct iceland_smumgr *)(hwmgr->smu_backend); |
284 | struct cgs_system_info sys_info = {0}; | 284 | struct amdgpu_device *adev = hwmgr->adev; |
285 | uint32_t dev_id; | 285 | uint32_t dev_id; |
286 | 286 | ||
287 | sys_info.size = sizeof(struct cgs_system_info); | 287 | dev_id = adev->pdev->device; |
288 | sys_info.info_id = CGS_SYSTEM_INFO_PCIE_DEV; | ||
289 | cgs_query_system_info(hwmgr->device, &sys_info); | ||
290 | dev_id = (uint32_t)sys_info.value; | ||
291 | 288 | ||
292 | switch (dev_id) { | 289 | switch (dev_id) { |
293 | case DEVICE_ID_VI_ICELAND_M_6900: | 290 | case DEVICE_ID_VI_ICELAND_M_6900: |
diff --git a/drivers/gpu/drm/amd/powerplay/smumgr/tonga_smumgr.c b/drivers/gpu/drm/amd/powerplay/smumgr/tonga_smumgr.c index 9e98c1dff5c4..a268b98abb8e 100644 --- a/drivers/gpu/drm/amd/powerplay/smumgr/tonga_smumgr.c +++ b/drivers/gpu/drm/amd/powerplay/smumgr/tonga_smumgr.c | |||
@@ -1623,19 +1623,12 @@ static int tonga_populate_clock_stretcher_data_table(struct pp_hwmgr *hwmgr) | |||
1623 | struct phm_ppt_v1_clock_voltage_dependency_table *sclk_table = | 1623 | struct phm_ppt_v1_clock_voltage_dependency_table *sclk_table = |
1624 | table_info->vdd_dep_on_sclk; | 1624 | table_info->vdd_dep_on_sclk; |
1625 | uint32_t hw_revision, dev_id; | 1625 | uint32_t hw_revision, dev_id; |
1626 | struct cgs_system_info sys_info = {0}; | 1626 | struct amdgpu_device *adev = hwmgr->adev; |
1627 | 1627 | ||
1628 | stretch_amount = (uint8_t)table_info->cac_dtp_table->usClockStretchAmount; | 1628 | stretch_amount = (uint8_t)table_info->cac_dtp_table->usClockStretchAmount; |
1629 | 1629 | ||
1630 | sys_info.size = sizeof(struct cgs_system_info); | 1630 | hw_revision = adev->pdev->revision; |
1631 | 1631 | dev_id = adev->pdev->device; | |
1632 | sys_info.info_id = CGS_SYSTEM_INFO_PCIE_REV; | ||
1633 | cgs_query_system_info(hwmgr->device, &sys_info); | ||
1634 | hw_revision = (uint32_t)sys_info.value; | ||
1635 | |||
1636 | sys_info.info_id = CGS_SYSTEM_INFO_PCIE_DEV; | ||
1637 | cgs_query_system_info(hwmgr->device, &sys_info); | ||
1638 | dev_id = (uint32_t)sys_info.value; | ||
1639 | 1632 | ||
1640 | /* Read SMU_Eefuse to read and calculate RO and determine | 1633 | /* Read SMU_Eefuse to read and calculate RO and determine |
1641 | * if the part is SS or FF. if RO >= 1660MHz, part is FF. | 1634 | * if the part is SS or FF. if RO >= 1660MHz, part is FF. |
diff --git a/drivers/gpu/drm/amd/powerplay/smumgr/vega10_smumgr.c b/drivers/gpu/drm/amd/powerplay/smumgr/vega10_smumgr.c index 99ad0a25300c..68db5824de2d 100644 --- a/drivers/gpu/drm/amd/powerplay/smumgr/vega10_smumgr.c +++ b/drivers/gpu/drm/amd/powerplay/smumgr/vega10_smumgr.c | |||
@@ -349,7 +349,7 @@ int vega10_set_tools_address(struct pp_hwmgr *hwmgr) | |||
349 | static int vega10_verify_smc_interface(struct pp_hwmgr *hwmgr) | 349 | static int vega10_verify_smc_interface(struct pp_hwmgr *hwmgr) |
350 | { | 350 | { |
351 | uint32_t smc_driver_if_version; | 351 | uint32_t smc_driver_if_version; |
352 | struct cgs_system_info sys_info = {0}; | 352 | struct amdgpu_device *adev = hwmgr->adev; |
353 | uint32_t dev_id; | 353 | uint32_t dev_id; |
354 | uint32_t rev_id; | 354 | uint32_t rev_id; |
355 | 355 | ||
@@ -359,15 +359,8 @@ static int vega10_verify_smc_interface(struct pp_hwmgr *hwmgr) | |||
359 | return -EINVAL); | 359 | return -EINVAL); |
360 | vega10_read_arg_from_smc(hwmgr, &smc_driver_if_version); | 360 | vega10_read_arg_from_smc(hwmgr, &smc_driver_if_version); |
361 | 361 | ||
362 | sys_info.size = sizeof(struct cgs_system_info); | 362 | dev_id = adev->pdev->device; |
363 | sys_info.info_id = CGS_SYSTEM_INFO_PCIE_DEV; | 363 | rev_id = adev->pdev->revision; |
364 | cgs_query_system_info(hwmgr->device, &sys_info); | ||
365 | dev_id = (uint32_t)sys_info.value; | ||
366 | |||
367 | sys_info.size = sizeof(struct cgs_system_info); | ||
368 | sys_info.info_id = CGS_SYSTEM_INFO_PCIE_REV; | ||
369 | cgs_query_system_info(hwmgr->device, &sys_info); | ||
370 | rev_id = (uint32_t)sys_info.value; | ||
371 | 364 | ||
372 | if (!((dev_id == 0x687f) && | 365 | if (!((dev_id == 0x687f) && |
373 | ((rev_id == 0xc0) || | 366 | ((rev_id == 0xc0) || |