From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Deucher, Alexander" Subject: Re: [PATCH] drm/amd/powerplay: change smu_read_sensor sequence in smu Date: Tue, 23 Jul 2019 15:06:13 +0000 Message-ID: References: <1563874746-6318-1-git-send-email-kenneth.feng@amd.com>, Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1101161715==" Return-path: In-Reply-To: Content-Language: en-US List-Id: Discussion list for AMD gfx List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org Sender: "amd-gfx" To: "Wang, Kevin(Yang)" , "Feng, Kenneth" , "amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org" --===============1101161715== Content-Language: en-US Content-Type: multipart/alternative; boundary="_000_BN6PR12MB1809826E34BDEAA5E1F5D7AFF7C70BN6PR12MB1809namp_" --_000_BN6PR12MB1809826E34BDEAA5E1F5D7AFF7C70BN6PR12MB1809namp_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Looks good to me. Acked-by: Alex Deucher ________________________________ From: Wang, Kevin(Yang) Sent: Tuesday, July 23, 2019 5:43 AM To: Feng, Kenneth ; amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org ; Deucher, Alexander Subject: Re: [PATCH] drm/amd/powerplay: change smu_read_sensor sequence in = smu it looks fine for me, please @Deucher, Alexander double check c= onfirm. Reviewed-by: Kevin Wang Best Regards, Kevin ________________________________ From: amd-gfx on behalf of Kenneth = Feng Sent: Tuesday, July 23, 2019 5:39 PM To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org Cc: Feng, Kenneth Subject: [PATCH] drm/amd/powerplay: change smu_read_sensor sequence in smu change the smu_read_sensor sequence to: asic specific sensor read -> smu v11 specific sensor read -> smu v11 common= sensor read Signed-off-by: Kenneth Feng --- drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 3 +++ drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h | 4 ++-- drivers/gpu/drm/amd/powerplay/navi10_ppt.c | 5 ++++- drivers/gpu/drm/amd/powerplay/smu_v11_0.c | 8 ++++---- drivers/gpu/drm/amd/powerplay/vega20_ppt.c | 5 ++++- 5 files changed, 17 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c b/drivers/gpu/drm/a= md/powerplay/amdgpu_smu.c index 416f9a8..8ff18c8 100644 --- a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +++ b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c @@ -315,6 +315,9 @@ int smu_common_read_sensor(struct smu_context *smu, enu= m amd_pp_sensors sensor, { int ret =3D 0; + if(!data || !size) + return -EINVAL; + switch (sensor) { case AMDGPU_PP_SENSOR_STABLE_PSTATE_SCLK: *((uint32_t *)data) =3D smu->pstate_sclk; diff --git a/drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h b/drivers/gpu/d= rm/amd/powerplay/inc/amdgpu_smu.h index b702c9e..fabb373 100644 --- a/drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h +++ b/drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h @@ -819,9 +819,9 @@ struct smu_funcs #define smu_start_thermal_control(smu) \ ((smu)->funcs->start_thermal_control? (smu)->funcs->start_thermal_= control((smu)) : 0) #define smu_read_sensor(smu, sensor, data, size) \ - ((smu)->funcs->read_sensor? (smu)->funcs->read_sensor((smu), (senso= r), (data), (size)) : 0) -#define smu_asic_read_sensor(smu, sensor, data, size) \ ((smu)->ppt_funcs->read_sensor? (smu)->ppt_funcs->read_sensor((smu= ), (sensor), (data), (size)) : 0) +#define smu_smc_read_sensor(smu, sensor, data, size) \ + ((smu)->funcs->read_sensor? (smu)->funcs->read_sensor((smu), (senso= r), (data), (size)) : -EINVAL) #define smu_get_power_profile_mode(smu, buf) \ ((smu)->ppt_funcs->get_power_profile_mode ? (smu)->ppt_funcs->get_= power_profile_mode((smu), buf) : 0) #define smu_set_power_profile_mode(smu, param, param_size) \ diff --git a/drivers/gpu/drm/amd/powerplay/navi10_ppt.c b/drivers/gpu/drm/a= md/powerplay/navi10_ppt.c index c8ce9bb..6409718 100644 --- a/drivers/gpu/drm/amd/powerplay/navi10_ppt.c +++ b/drivers/gpu/drm/amd/powerplay/navi10_ppt.c @@ -1366,6 +1366,9 @@ static int navi10_read_sensor(struct smu_context *smu= , struct smu_table_context *table_context =3D &smu->smu_table; PPTable_t *pptable =3D table_context->driver_pptable; + if(!data || !size) + return -EINVAL; + switch (sensor) { case AMDGPU_PP_SENSOR_MAX_FAN_RPM: *(uint32_t *)data =3D pptable->FanMaximumRpm; @@ -1387,7 +1390,7 @@ static int navi10_read_sensor(struct smu_context *smu= , *size =3D 4; break; default: - return -EINVAL; + ret =3D smu_smc_read_sensor(smu, sensor, data, size); } return ret; diff --git a/drivers/gpu/drm/amd/powerplay/smu_v11_0.c b/drivers/gpu/drm/am= d/powerplay/smu_v11_0.c index e3a1784..5267b68 100644 --- a/drivers/gpu/drm/amd/powerplay/smu_v11_0.c +++ b/drivers/gpu/drm/amd/powerplay/smu_v11_0.c @@ -1267,6 +1267,10 @@ static int smu_v11_0_read_sensor(struct smu_context = *smu, void *data, uint32_t *size) { int ret =3D 0; + + if(!data || !size) + return -EINVAL; + switch (sensor) { case AMDGPU_PP_SENSOR_GFX_MCLK: ret =3D smu_get_current_clk_freq(smu, SMU_UCLK, (uint32_t = *)data); @@ -1289,10 +1293,6 @@ static int smu_v11_0_read_sensor(struct smu_context = *smu, break; } - /* try get sensor data by asic */ - if (ret) - ret =3D smu_asic_read_sensor(smu, sensor, data, size); - if (ret) *size =3D 0; diff --git a/drivers/gpu/drm/amd/powerplay/vega20_ppt.c b/drivers/gpu/drm/a= md/powerplay/vega20_ppt.c index 9ead361..e864a54 100644 --- a/drivers/gpu/drm/amd/powerplay/vega20_ppt.c +++ b/drivers/gpu/drm/amd/powerplay/vega20_ppt.c @@ -3163,6 +3163,9 @@ static int vega20_read_sensor(struct smu_context *smu= , struct smu_table_context *table_context =3D &smu->smu_table; PPTable_t *pptable =3D table_context->driver_pptable; + if(!data || !size) + return -EINVAL; + switch (sensor) { case AMDGPU_PP_SENSOR_MAX_FAN_RPM: *(uint32_t *)data =3D pptable->FanMaximumRpm; @@ -3186,7 +3189,7 @@ static int vega20_read_sensor(struct smu_context *smu= , *size =3D 4; break; default: - return -EINVAL; + ret =3D smu_smc_read_sensor(smu, sensor, data, size); } return ret; -- 2.7.4 _______________________________________________ amd-gfx mailing list amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org https://lists.freedesktop.org/mailman/listinfo/amd-gfx amd-gfx Info Page - freedesktop.org lists.freedesktop.org To see the collection of prior postings to the list, visit the amd-gfx Arch= ives.. Using amd-gfx: To post a message to all the list members, send email= to amd-gfx-PD4FTy7X32lNgt0PjOBp9xlNPtJONSTn@public.gmane.org You can subscribe to the list, or change= your existing subscription, in the sections below. --_000_BN6PR12MB1809826E34BDEAA5E1F5D7AFF7C70BN6PR12MB1809namp_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable
Looks good to me.

Acked-by: Alex Deucher <alexander.deucher-5C7GfCeVMHo@public.gmane.org>

From: Wang, Kevin(Yang) <= ;Kevin1.Wang-5C7GfCeVMHo@public.gmane.org>
Sent: Tuesday, July 23, 2019 5:43 AM
To: Feng, Kenneth <Kenneth.Feng-5C7GfCeVMHo@public.gmane.org>; amd-gfx-PD4FTy7X32lMiVNPc3mojA@public.gmane.org= sktop.org <amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org>; Deucher, Alexander <Ale= xander.Deucher-5C7GfCeVMHo@public.gmane.org>
Subject: Re: [PATCH] drm/amd/powerplay: change smu_read_sensor seque= nce in smu
 

i= t looks fine for me, 

please @Deucher, Alexander double check confirm.

Reviewed-by: Kevin Wang <kevin1.wang-5C7GfCeVMHo@public.gmane.org>

Best Regards,
Kevin


From: amd-gfx <amd-gfx= -bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org> on behalf of Kenneth Feng <kenneth.fe= ng-5C7GfCeVMHo@public.gmane.org>
Sent: Tuesday, July 23, 2019 5:39 PM
To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org <amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org&= gt;
Cc: Feng, Kenneth <Kenneth.Feng-5C7GfCeVMHo@public.gmane.org>
Subject: [PATCH] drm/amd/powerplay: change smu_read_sensor sequence = in smu
 
change the smu_read_sensor sequence to:

asic specific sensor read -> smu v11 specific sensor read -> smu v11 = common sensor read

Signed-off-by: Kenneth Feng <kenneth.feng-5C7GfCeVMHo@public.gmane.org>
---
 drivers/gpu/drm/amd/powerplay/amdgpu_smu.c     | = 3 +++
 drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h | 4 ++--
 drivers/gpu/drm/amd/powerplay/navi10_ppt.c     | = 5 ++++-
 drivers/gpu/drm/amd/powerplay/smu_v11_0.c    &nbs= p; | 8 ++++----
 drivers/gpu/drm/amd/powerplay/vega20_ppt.c     | = 5 ++++-
 5 files changed, 17 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c b/drivers/gpu/drm/a= md/powerplay/amdgpu_smu.c
index 416f9a8..8ff18c8 100644
--- a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
+++ b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
@@ -315,6 +315,9 @@ int smu_common_read_sensor(struct smu_context *smu,= enum amd_pp_sensors sensor,
 {
         int ret =3D 0;
 
+       if(!data || !size)
+           &nbs= p;   return -EINVAL;
+
         switch (sensor) {
         case AMDGPU_PP_SENSOR_STAB= LE_PSTATE_SCLK:
            &nb= sp;    *((uint32_t *)data) =3D smu->pstate_sclk;
diff --git a/drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h b/drivers/gpu/d= rm/amd/powerplay/inc/amdgpu_smu.h
index b702c9e..fabb373 100644
--- a/drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h
+++ b/drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h
@@ -819,9 +819,9 @@ struct smu_funcs
 #define smu_start_thermal_control(smu) \
         ((smu)->funcs->start= _thermal_control? (smu)->funcs->start_thermal_control((smu)) : 0)
 #define smu_read_sensor(smu, sensor, data, size) \
-       ((smu)->funcs->read_sensor? (sm= u)->funcs->read_sensor((smu), (sensor), (data), (size)) : 0)
-#define smu_asic_read_sensor(smu, sensor, data, size) \
         ((smu)->ppt_funcs->r= ead_sensor? (smu)->ppt_funcs->read_sensor((smu), (sensor), (data), (s= ize)) : 0)
+#define smu_smc_read_sensor(smu, sensor, data, size) \
+       ((smu)->funcs->read_sensor?= (smu)->funcs->read_sensor((smu), (sensor), (data), (size)) : -EINVAL= )
 #define smu_get_power_profile_mode(smu, buf) \
         ((smu)->ppt_funcs->g= et_power_profile_mode ? (smu)->ppt_funcs->get_power_profile_mode((smu= ), buf) : 0)
 #define smu_set_power_profile_mode(smu, param, param_size) \
diff --git a/drivers/gpu/drm/amd/powerplay/navi10_ppt.c b/drivers/gpu/drm/a= md/powerplay/navi10_ppt.c
index c8ce9bb..6409718 100644
--- a/drivers/gpu/drm/amd/powerplay/navi10_ppt.c
+++ b/drivers/gpu/drm/amd/powerplay/navi10_ppt.c
@@ -1366,6 +1366,9 @@ static int navi10_read_sensor(struct smu_context = *smu,
         struct smu_table_context *= table_context =3D &smu->smu_table;
         PPTable_t *pptable =3D tab= le_context->driver_pptable;
 
+       if(!data || !size)
+           &nbs= p;   return -EINVAL;
+
         switch (sensor) {
         case AMDGPU_PP_SENSOR_MAX_= FAN_RPM:
            &nb= sp;    *(uint32_t *)data =3D pptable->FanMaximumRpm;
@@ -1387,7 +1390,7 @@ static int navi10_read_sensor(struct smu_context = *smu,
            &nb= sp;    *size =3D 4;
            &nb= sp;    break;
         default:
-            &n= bsp;  return -EINVAL;
+           &nbs= p;   ret =3D smu_smc_read_sensor(smu, sensor, data, size);
         }
 
         return ret;
diff --git a/drivers/gpu/drm/amd/powerplay/smu_v11_0.c b/drivers/gpu/drm/am= d/powerplay/smu_v11_0.c
index e3a1784..5267b68 100644
--- a/drivers/gpu/drm/amd/powerplay/smu_v11_0.c
+++ b/drivers/gpu/drm/amd/powerplay/smu_v11_0.c
@@ -1267,6 +1267,10 @@ static int smu_v11_0_read_sensor(struct smu_cont= ext *smu,
            &nb= sp;            =          void *data, uint32_t *size= )
 {
         int ret =3D 0;
+
+       if(!data || !size)
+           &nbs= p;   return -EINVAL;
+
         switch (sensor) {
         case AMDGPU_PP_SENSOR_GFX_= MCLK:
            &nb= sp;    ret =3D smu_get_current_clk_freq(smu, SMU_UCLK, (uint= 32_t *)data);
@@ -1289,10 +1293,6 @@ static int smu_v11_0_read_sensor(struct smu_cont= ext *smu,
            &nb= sp;    break;
         }
 
-       /* try get sensor data by asic */
-       if (ret)
-            &n= bsp;  ret =3D smu_asic_read_sensor(smu, sensor, data, size);
-
         if (ret)
            &nb= sp;    *size =3D 0;
 
diff --git a/drivers/gpu/drm/amd/powerplay/vega20_ppt.c b/drivers/gpu/drm/a= md/powerplay/vega20_ppt.c
index 9ead361..e864a54 100644
--- a/drivers/gpu/drm/amd/powerplay/vega20_ppt.c
+++ b/drivers/gpu/drm/amd/powerplay/vega20_ppt.c
@@ -3163,6 +3163,9 @@ static int vega20_read_sensor(struct smu_context = *smu,
         struct smu_table_context *= table_context =3D &smu->smu_table;
         PPTable_t *pptable =3D tab= le_context->driver_pptable;
 
+       if(!data || !size)
+           &nbs= p;   return -EINVAL;
+
         switch (sensor) {
         case AMDGPU_PP_SENSOR_MAX_= FAN_RPM:
            &nb= sp;    *(uint32_t *)data =3D pptable->FanMaximumRpm;
@@ -3186,7 +3189,7 @@ static int vega20_read_sensor(struct smu_context = *smu,
            &nb= sp;    *size =3D 4;
            &nb= sp;    break;
         default:
-            &n= bsp;  return -EINVAL;
+           &nbs= p;   ret =3D smu_smc_read_sensor(smu, sensor, data, size);
         }
 
         return ret;
--
2.7.4

_______________________________________________
amd-gfx mailing list
amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
https://lists.freedesktop.org/mailman/li= stinfo/amd-gfx
lists.freedesktop.org
To see the collection of prior postings to the list, visit the amd-gfx Arch= ives.. Using amd-gfx: To post a message to all the list members, send email= to amd-gfx-PD4FTy7X32lNgt0PjOBp9xlNPtJONSTn@public.gmane.org You can subscribe to the list, or change= your existing subscription, in the sections below.

--_000_BN6PR12MB1809826E34BDEAA5E1F5D7AFF7C70BN6PR12MB1809namp_-- --===============1101161715== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KYW1kLWdmeCBt YWlsaW5nIGxpc3QKYW1kLWdmeEBsaXN0cy5mcmVlZGVza3RvcC5vcmcKaHR0cHM6Ly9saXN0cy5m cmVlZGVza3RvcC5vcmcvbWFpbG1hbi9saXN0aW5mby9hbWQtZ2Z4 --===============1101161715==--