All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 1/8] drm/amd/pm: Add u64 throttler status field to gpu_metrics
@ 2021-05-28 19:58 Graham Sider
  2021-05-28 19:58 ` [PATCH v2 2/8] drm/amd/pm: Add ASIC independent throttle bits Graham Sider
                   ` (7 more replies)
  0 siblings, 8 replies; 11+ messages in thread
From: Graham Sider @ 2021-05-28 19:58 UTC (permalink / raw)
  To: amd-gfx; +Cc: Harish.Kasiviswanathan, Graham Sider, Elena.Sakhnovitch

This patch piggybacks off the gpu_metrics_v1_3 bump and adds a new ASIC
independant u64 throttler status field (indep_throttle_status).
Similarly bumps gpu_metrics_v2 version (to v2_2) to add field. The
alternative to adding this new field would be to overwrite the
original u32 throttle_status (would still require a version bump for
gpu_metrics_v2). The benefit to adding a new field is that we can
allocate 16 bits to each "type" of throttler information and have more
leeway for adding additional throttler bits in the future.

Signed-off-by: Graham Sider <Graham.Sider@amd.com>
---
 .../gpu/drm/amd/include/kgd_pp_interface.h    | 58 ++++++++++++++++++-
 drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c        |  3 +
 2 files changed, 60 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/include/kgd_pp_interface.h b/drivers/gpu/drm/amd/include/kgd_pp_interface.h
index b1cd52a9d684..b50d6bd0833c 100644
--- a/drivers/gpu/drm/amd/include/kgd_pp_interface.h
+++ b/drivers/gpu/drm/amd/include/kgd_pp_interface.h
@@ -577,7 +577,7 @@ struct gpu_metrics_v1_3 {
 	uint16_t			current_vclk1;
 	uint16_t			current_dclk1;
 
-	/* Throttle status */
+	/* Throttle status (ASIC dependant) */
 	uint32_t			throttle_status;
 
 	/* Fans */
@@ -602,6 +602,9 @@ struct gpu_metrics_v1_3 {
 	uint16_t			voltage_gfx;
 	uint16_t			voltage_mem;
 
+	/* Throttle status (ASIC independant) */
+	uint64_t			indep_throttle_status;
+
 	uint16_t			padding1;
 };
 
@@ -709,4 +712,57 @@ struct gpu_metrics_v2_1 {
 	uint16_t			padding[3];
 };
 
+struct gpu_metrics_v2_2 {
+	struct metrics_table_header	common_header;
+
+	/* Temperature */
+	uint16_t			temperature_gfx; // gfx temperature on APUs
+	uint16_t			temperature_soc; // soc temperature on APUs
+	uint16_t			temperature_core[8]; // CPU core temperature on APUs
+	uint16_t			temperature_l3[2];
+
+	/* Utilization */
+	uint16_t			average_gfx_activity;
+	uint16_t			average_mm_activity; // UVD or VCN
+
+	/* Driver attached timestamp (in ns) */
+	uint64_t			system_clock_counter;
+
+	/* Power/Energy */
+	uint16_t			average_socket_power; // dGPU + APU power on A + A platform
+	uint16_t			average_cpu_power;
+	uint16_t			average_soc_power;
+	uint16_t			average_gfx_power;
+	uint16_t			average_core_power[8]; // CPU core power on APUs
+
+	/* Average clocks */
+	uint16_t			average_gfxclk_frequency;
+	uint16_t			average_socclk_frequency;
+	uint16_t			average_uclk_frequency;
+	uint16_t			average_fclk_frequency;
+	uint16_t			average_vclk_frequency;
+	uint16_t			average_dclk_frequency;
+
+	/* Current clocks */
+	uint16_t			current_gfxclk;
+	uint16_t			current_socclk;
+	uint16_t			current_uclk;
+	uint16_t			current_fclk;
+	uint16_t			current_vclk;
+	uint16_t			current_dclk;
+	uint16_t			current_coreclk[8]; // CPU core clocks
+	uint16_t			current_l3clk[2];
+
+	/* Throttle status (ASIC dependant) */
+	uint32_t			throttle_status;
+
+	/* Fans */
+	uint16_t			fan_pwm;
+
+	/* Throttle status (ASIC independant) */
+	uint64_t			indep_throttle_status;
+
+	uint16_t			padding[3];
+};
+
 #endif
diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c b/drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c
index 0ceb7329838c..01645537d9ab 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c
@@ -773,6 +773,9 @@ void smu_cmn_init_soft_gpu_metrics(void *table, uint8_t frev, uint8_t crev)
 	case METRICS_VERSION(2, 1):
 		structure_size = sizeof(struct gpu_metrics_v2_1);
 		break;
+	case METRICS_VERSION(2, 2):
+		structure_size = sizeof(struct gpu_metrics_v2_2);
+		break;
 	default:
 		return;
 	}
-- 
2.17.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2021-05-31 13:29 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-28 19:58 [PATCH v2 1/8] drm/amd/pm: Add u64 throttler status field to gpu_metrics Graham Sider
2021-05-28 19:58 ` [PATCH v2 2/8] drm/amd/pm: Add ASIC independent throttle bits Graham Sider
2021-05-28 19:58 ` [PATCH v2 3/8] drm/amd/pm: Add arcturus throttler translation Graham Sider
2021-05-28 19:58 ` [PATCH v2 4/8] drm/amd/pm: Add navi1x " Graham Sider
2021-05-31  5:12   ` Lazar, Lijo
2021-05-31 13:29     ` Sider, Graham
2021-05-28 19:58 ` [PATCH v2 5/8] drm/amd/pm: Add sienna cichlid " Graham Sider
2021-05-28 19:58 ` [PATCH v2 6/8] drm/amd/pm: Add vangogh " Graham Sider
2021-05-28 19:58 ` [PATCH v2 7/8] drm/amd/pm: Add renoir " Graham Sider
2021-05-28 19:58 ` [PATCH v2 8/8] drm/amd/pm: Add aldebaran " Graham Sider
2021-05-31  4:37 ` [PATCH v2 1/8] drm/amd/pm: Add u64 throttler status field to gpu_metrics Lazar, Lijo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.