<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<p style="font-family:Arial;font-size:11pt;color:#0078D7;margin:5pt;" align="Left">
[AMD Official Use Only - Internal Distribution Only]<br>
</p>
<br>
<div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Reviewed-by: Alex Deucher <alexander.deucher@amd.com><br>
</div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> Huang, Ray <Ray.Huang@amd.com><br>
<b>Sent:</b> Monday, January 18, 2021 7:32 AM<br>
<b>To:</b> amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org><br>
<b>Cc:</b> Deucher, Alexander <Alexander.Deucher@amd.com>; Huang, Ray <Ray.Huang@amd.com>; Stephen Rothwell <sfr@canb.auug.org.au><br>
<b>Subject:</b> [PATCH v2] drm/amdgpu: fix build error without x86 kconfig (v2)</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">This patch is to fix below build error while we are using the kconfig<br>
without x86.<br>
<br>
drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu11/vangogh_ppt.c: In function<br>
'vangogh_get_smu_metrics_data':<br>
drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu11/vangogh_ppt.c:300:10:<br>
error: 'boot_cpu_data' undeclared (first use in this function); did you<br>
mean 'boot_cpuid'?<br>
300 | boot_cpu_data.x86_max_cores * sizeof(uint16_t));<br>
| ^~~~~~~~~~~~~<br>
| boot_cpuid<br>
drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu11/vangogh_ppt.c: In function<br>
'vangogh_read_sensor':<br>
drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu11/vangogh_ppt.c:1320:11:<br>
error: 'boot_cpu_data' undeclared (first use in this function); did you<br>
mean 'boot_cpuid'?<br>
1320 | *size = boot_cpu_data.x86_max_cores * sizeof(uint16_t);<br>
| ^~~~~~~~~~~~~<br>
| boot_cpuid<br>
drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu11/vangogh_ppt.c: In function<br>
'vangogh_od_edit_dpm_table':<br>
drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu11/vangogh_ppt.c:1460:19:<br>
error: 'boot_cpu_data' undeclared (first use in this function); did you<br>
mean 'boot_cpuid'?<br>
1460 | if (input[0] >= boot_cpu_data.x86_max_cores) {<br>
| ^~~~~~~~~~~~~<br>
| boot_cpuid<br>
<br>
v2: fix #ifdef and add comment for APU only<br>
<br>
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au><br>
Signed-off-by: Huang Rui <ray.huang@amd.com><br>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com><br>
---<br>
drivers/gpu/drm/amd/pm/amdgpu_pm.c | 4 ++--<br>
drivers/gpu/drm/amd/pm/inc/amdgpu_smu.h | 2 ++<br>
.../gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c | 17 ++++++++++++-----<br>
3 files changed, 16 insertions(+), 7 deletions(-)<br>
<br>
diff --git a/drivers/gpu/drm/amd/pm/amdgpu_pm.c b/drivers/gpu/drm/amd/pm/amdgpu_pm.c<br>
index 80d6298912aa..e9b569b76716 100644<br>
--- a/drivers/gpu/drm/amd/pm/amdgpu_pm.c<br>
+++ b/drivers/gpu/drm/amd/pm/amdgpu_pm.c<br>
@@ -3633,12 +3633,12 @@ static void amdgpu_debugfs_prints_cpu_info(struct seq_file *m,<br>
int i;<br>
<br>
if (is_support_cclk_dpm(adev)) {<br>
- p_val = kcalloc(boot_cpu_data.x86_max_cores, sizeof(uint16_t),<br>
+ p_val = kcalloc(adev->smu.cpu_core_num, sizeof(uint16_t),<br>
GFP_KERNEL);<br>
<br>
if (!amdgpu_dpm_read_sensor(adev, AMDGPU_PP_SENSOR_CPU_CLK,<br>
(void *)p_val, &size)) {<br>
- for (i = 0; i < boot_cpu_data.x86_max_cores; i++)<br>
+ for (i = 0; i < adev->smu.cpu_core_num; i++)<br>
seq_printf(m, "\t%u MHz (CPU%d)\n",<br>
*(p_val + i), i);<br>
}<br>
diff --git a/drivers/gpu/drm/amd/pm/inc/amdgpu_smu.h b/drivers/gpu/drm/amd/pm/inc/amdgpu_smu.h<br>
index 25ee9f51813b..a087e00382e6 100644<br>
--- a/drivers/gpu/drm/amd/pm/inc/amdgpu_smu.h<br>
+++ b/drivers/gpu/drm/amd/pm/inc/amdgpu_smu.h<br>
@@ -466,11 +466,13 @@ struct smu_context<br>
uint32_t gfx_actual_hard_min_freq;<br>
uint32_t gfx_actual_soft_max_freq;<br>
<br>
+ /* APU only */<br>
uint32_t cpu_default_soft_min_freq;<br>
uint32_t cpu_default_soft_max_freq;<br>
uint32_t cpu_actual_soft_min_freq;<br>
uint32_t cpu_actual_soft_max_freq;<br>
uint32_t cpu_core_id_select;<br>
+ uint16_t cpu_core_num;<br>
};<br>
<br>
struct i2c_adapter;<br>
diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c<br>
index 2f0cb0ea243b..dc41abe7b1d3 100644<br>
--- a/drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c<br>
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c<br>
@@ -297,7 +297,7 @@ static int vangogh_get_smu_metrics_data(struct smu_context *smu,<br>
break;<br>
case METRICS_AVERAGE_CPUCLK:<br>
memcpy(value, &metrics->CoreFrequency[0],<br>
- boot_cpu_data.x86_max_cores * sizeof(uint16_t));<br>
+ smu->cpu_core_num * sizeof(uint16_t));<br>
break;<br>
default:<br>
*value = UINT_MAX;<br>
@@ -335,6 +335,13 @@ static int vangogh_init_smc_tables(struct smu_context *smu)<br>
if (ret)<br>
return ret;<br>
<br>
+#ifdef CONFIG_X86<br>
+ /* AMD x86 APU only */<br>
+ smu->cpu_core_num = boot_cpu_data.x86_max_cores;<br>
+#else<br>
+ smu->cpu_core_num = 4;<br>
+#endif<br>
+<br>
return smu_v11_0_init_smc_tables(smu);<br>
}<br>
<br>
@@ -1317,7 +1324,7 @@ static int vangogh_read_sensor(struct smu_context *smu,<br>
ret = vangogh_get_smu_metrics_data(smu,<br>
METRICS_AVERAGE_CPUCLK,<br>
(uint32_t *)data);<br>
- *size = boot_cpu_data.x86_max_cores * sizeof(uint16_t);<br>
+ *size = smu->cpu_core_num * sizeof(uint16_t);<br>
break;<br>
default:<br>
ret = -EOPNOTSUPP;<br>
@@ -1457,9 +1464,9 @@ static int vangogh_od_edit_dpm_table(struct smu_context *smu, enum PP_OD_DPM_TAB<br>
dev_err(smu->adev->dev, "Input parameter number not correct (should be 4 for processor)\n");<br>
return -EINVAL;<br>
}<br>
- if (input[0] >= boot_cpu_data.x86_max_cores) {<br>
+ if (input[0] >= smu->cpu_core_num) {<br>
dev_err(smu->adev->dev, "core index is overflow, should be less than %d\n",<br>
- boot_cpu_data.x86_max_cores);<br>
+ smu->cpu_core_num);<br>
}<br>
smu->cpu_core_id_select = input[0];<br>
if (input[1] == 0) {<br>
@@ -1535,7 +1542,7 @@ static int vangogh_od_edit_dpm_table(struct smu_context *smu, enum PP_OD_DPM_TAB<br>
break;<br>
}<br>
<br>
- for (i = 0; i < boot_cpu_data.x86_max_cores; i++) {<br>
+ for (i = 0; i < smu->cpu_core_num; i++) {<br>
ret = smu_cmn_send_smc_msg_with_param(smu, SMU_MSG_SetSoftMinCclk,<br>
(i << 20) | smu->cpu_actual_soft_min_freq,<br>
NULL);<br>
-- <br>
2.25.1<br>
<br>
</div>
</span></font></div>
</div>
</body>
</html>