[SRU][J:linux-bluefield][PATCH v1 1/1] UBUNTU: SAUCE: mlxbf-ptm: use single SMC for total power

Jitendra Lanka jlanka at nvidia.com
Thu Jun 13 15:18:15 UTC 2024


BugLink: https://bugs.launchpad.net/bugs/2069303

update total power reporting to use a single secure
monitor call

Signed-off-by: Jitendra Lanka <jlanka at nvidia.com>
---
 drivers/platform/mellanox/mlxbf-ptm.c | 13 ++-----------
 1 file changed, 2 insertions(+), 11 deletions(-)

diff --git a/drivers/platform/mellanox/mlxbf-ptm.c b/drivers/platform/mellanox/mlxbf-ptm.c
index 26f883bf71f3..ba8167c652a6 100644
--- a/drivers/platform/mellanox/mlxbf-ptm.c
+++ b/drivers/platform/mellanox/mlxbf-ptm.c
@@ -29,8 +29,7 @@
 #define MLNX_PTM_GET_DDR_TTHROTTLE      0x8200010E
 #define MLNX_PTM_GET_DDR_TEMP_EVT_CTR   0x8200010F
 #define MLNX_PTM_GET_TEMP_ENVELOPE	0x82000110
-
-#define MLNX_POWER_ERROR		300
+#define MLNX_PTM_GET_TOTAL_POWER	0x82000111
 
 struct dentry *monitors;
 
@@ -117,15 +116,7 @@ DEFINE_SIMPLE_ATTRIBUTE(vr1_power_fops, vr1_power_show, NULL, "%llu\n");
 
 static int total_power_show(void *data, u64 *val)
 {
-	u64 v0, v1;
-
-	v0 = smc_call0(MLNX_PTM_GET_VR0_POWER);
-	if (v0 > MLNX_POWER_ERROR)
-		v0 = 0;
-	v1 = smc_call0(MLNX_PTM_GET_VR1_POWER);
-	if (v1 > MLNX_POWER_ERROR)
-		v1 = 0;
-	*val = (v0 + v1);
+	*val = smc_call0(MLNX_PTM_GET_TOTAL_POWER);
 
 	return 0;
 }
-- 
2.30.1




More information about the kernel-team mailing list