[AMD Official Use Only - AMD Internal Distribution Only]

+ @Wang, Yang(Kevin) for the code review.

Regards,
Hawing

-----Original Message-----
From: Lazar, Lijo <lijo.la...@amd.com>
Sent: Monday, September 8, 2025 07:01
To: amd-gfx@lists.freedesktop.org
Cc: Zhang, Hawking <hawking.zh...@amd.com>; Deucher, Alexander 
<alexander.deuc...@amd.com>; Kamal, Asad <asad.ka...@amd.com>
Subject: [PATCH v2 0/7] Add field encoding to gpu metrics fields

Currently, gpu_metrics is exported a binary blob with the defintion provided by 
means of a structure and version. Though providing the version works well for 
backward compatiblity, it doesn't work the other way for tools like amd-smi. 
Installing a driver with a newer definition of gpu_metrics sometimes could 
break compatibility with the older version of amd-smi. Even if newer fields are 
added towards the end, a change in datatype of existing field or an increase of 
size in an array element will break the compatiblity.

To address this, add field encoding before each metrics field. Each field is 
designated an attribute id, and along with that the type (only integral ones 
are used currently) and number of instances are encoded. Thus an older amd-smi 
tool may skip any unknown attribute field, and move to the next attribute. This 
encoding scheme doesn't take care of elements that are not valid always -  say 
member_field[3] is not valid under certain conditions in an array member 
member_field[10]. Hence this still keeps the design of having all invalid 
elements initialized to 0xFFs.

Lijo Lazar (7):
  drm/amdgpu/pm: Add definition for gpu_metrics v1.9
  drm/amd/pm: Add helper functions for gpu metrics
  drm/amd/pm: Use gpu metrics 1.9 for SMUv13.0.6
  drm/amd/pm: Use gpu metrics 1.9 for SMUv13.0.12
  drm/amd/pm: Add schema v1.1 for parition metrics
  drm/amd/pm: Update SMUv13.0.6 partition metrics
  drm/amd/pm: Update SMUv13.0.12 partition metrics

 .../gpu/drm/amd/include/kgd_pp_interface.h    | 123 ++++++++++++++
 .../drm/amd/pm/swsmu/smu13/smu_v13_0_12_ppt.c |  94 +++++------  
.../drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c  | 140 ++++++++--------  
.../drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.h  | 156 +++++++++++++++++-
 drivers/gpu/drm/amd/pm/swsmu/smu_cmn.h        |  62 +++++++
 5 files changed, 450 insertions(+), 125 deletions(-)

--
2.49.0

Reply via email to