Skip to content

Commit 43d7e8b

Browse files
Asad Kamalalexdeucher
authored andcommitted
drm/amd/pm: Add gpu_metrics_v1_5
Add new gpu_metrics_v1_5 to acquire vcn/jpeg activity & pcie nak error counters Signed-off-by: Asad Kamal <[email protected]> Reviewed-by: Lijo Lazar <[email protected]> Reviewed-by: Le Ma <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent 21ff3cc commit 43d7e8b

File tree

2 files changed

+83
-0
lines changed

2 files changed

+83
-0
lines changed

drivers/gpu/drm/amd/include/kgd_pp_interface.h

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,7 @@ enum pp_xgmi_plpd_mode {
318318
#define MAX_GFX_CLKS 8
319319
#define MAX_CLKS 4
320320
#define NUM_VCN 4
321+
#define NUM_JPEG_ENG 32
321322

322323
struct seq_file;
323324
enum amd_pp_clock_type;
@@ -774,6 +775,85 @@ struct gpu_metrics_v1_4 {
774775
uint16_t padding;
775776
};
776777

778+
struct gpu_metrics_v1_5 {
779+
struct metrics_table_header common_header;
780+
781+
/* Temperature (Celsius) */
782+
uint16_t temperature_hotspot;
783+
uint16_t temperature_mem;
784+
uint16_t temperature_vrsoc;
785+
786+
/* Power (Watts) */
787+
uint16_t curr_socket_power;
788+
789+
/* Utilization (%) */
790+
uint16_t average_gfx_activity;
791+
uint16_t average_umc_activity; // memory controller
792+
uint16_t vcn_activity[NUM_VCN];
793+
uint16_t jpeg_activity[NUM_JPEG_ENG];
794+
795+
/* Energy (15.259uJ (2^-16) units) */
796+
uint64_t energy_accumulator;
797+
798+
/* Driver attached timestamp (in ns) */
799+
uint64_t system_clock_counter;
800+
801+
/* Throttle status */
802+
uint32_t throttle_status;
803+
804+
/* Clock Lock Status. Each bit corresponds to clock instance */
805+
uint32_t gfxclk_lock_status;
806+
807+
/* Link width (number of lanes) and speed (in 0.1 GT/s) */
808+
uint16_t pcie_link_width;
809+
uint16_t pcie_link_speed;
810+
811+
/* XGMI bus width and bitrate (in Gbps) */
812+
uint16_t xgmi_link_width;
813+
uint16_t xgmi_link_speed;
814+
815+
/* Utilization Accumulated (%) */
816+
uint32_t gfx_activity_acc;
817+
uint32_t mem_activity_acc;
818+
819+
/*PCIE accumulated bandwidth (GB/sec) */
820+
uint64_t pcie_bandwidth_acc;
821+
822+
/*PCIE instantaneous bandwidth (GB/sec) */
823+
uint64_t pcie_bandwidth_inst;
824+
825+
/* PCIE L0 to recovery state transition accumulated count */
826+
uint64_t pcie_l0_to_recov_count_acc;
827+
828+
/* PCIE replay accumulated count */
829+
uint64_t pcie_replay_count_acc;
830+
831+
/* PCIE replay rollover accumulated count */
832+
uint64_t pcie_replay_rover_count_acc;
833+
834+
/* PCIE NAK sent accumulated count */
835+
uint32_t pcie_nak_sent_count_acc;
836+
837+
/* PCIE NAK received accumulated count */
838+
uint32_t pcie_nak_rcvd_count_acc;
839+
840+
/* XGMI accumulated data transfer size(KiloBytes) */
841+
uint64_t xgmi_read_data_acc[NUM_XGMI_LINKS];
842+
uint64_t xgmi_write_data_acc[NUM_XGMI_LINKS];
843+
844+
/* PMFW attached timestamp (10ns resolution) */
845+
uint64_t firmware_timestamp;
846+
847+
/* Current clocks (Mhz) */
848+
uint16_t current_gfxclk[MAX_GFX_CLKS];
849+
uint16_t current_socclk[MAX_CLKS];
850+
uint16_t current_vclk0[MAX_CLKS];
851+
uint16_t current_dclk0[MAX_CLKS];
852+
uint16_t current_uclk;
853+
854+
uint16_t padding;
855+
};
856+
777857
/*
778858
* gpu_metrics_v2_0 is not recommended as it's not naturally aligned.
779859
* Use gpu_metrics_v2_1 or later instead.

drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -989,6 +989,9 @@ void smu_cmn_init_soft_gpu_metrics(void *table, uint8_t frev, uint8_t crev)
989989
case METRICS_VERSION(1, 4):
990990
structure_size = sizeof(struct gpu_metrics_v1_4);
991991
break;
992+
case METRICS_VERSION(1, 5):
993+
structure_size = sizeof(struct gpu_metrics_v1_5);
994+
break;
992995
case METRICS_VERSION(2, 0):
993996
structure_size = sizeof(struct gpu_metrics_v2_0);
994997
break;

0 commit comments

Comments
 (0)