Apu prerequisites (#1946)

* Don't require powercap support

APUs don't necessarily support setting a power cap from sysfs.
Ignore failures of the file missing.

Signed-off-by: Mario Limonciello (AMD) <superm1@kernel.org>

* Show edge temperature in default output if hotspot is missing

APUs don't have a hotspot temperature, they have an edge though.
Use that.

Signed-off-by: Mario Limonciello (AMD) <superm1@kernel.org>

* Format all "power" keys as watts

There will be more power keys when APU support is added, so format
them properly.

Signed-off-by: Mario Limonciello (AMD) <superm1@kernel.org>

* Don't show power limit in output if it's invalid

APUs can't set power limit using power_cap1 interface.  The limit
will be 0 and thus the UX looks weird in default output.
Only add the `/power_limit` if it's valid.

Signed-off-by: Mario Limonciello (AMD) <superm1@kernel.org>

* Unify sizes of `amdsmi_power_info_t`

Sizes are used inconsistently.  This causes tools to not show
N/A when they should.  Make them unified.

Signed-off-by: Mario Limonciello (AMD) <superm1@kernel.org>

---------

Signed-off-by: Mario Limonciello (AMD) <superm1@kernel.org>
Este commit está contenido en:
Mario Limonciello
2025-12-08 21:36:45 -06:00
cometido por GitHub
padre 24ff76a880
commit a08170bc75
Se han modificado 6 ficheros con 41 adiciones y 23 borrados
+8 -2
Ver fichero
@@ -1947,7 +1947,7 @@ class AMDSMICommands():
power_info[key] = self.helpers.unit_format(self.logger,
value,
voltage_unit)
elif key == "socket_power":
elif 'power' in key:
power_info[key] = self.helpers.unit_format(self.logger,
value,
power_unit)
@@ -7492,7 +7492,13 @@ class AMDSMICommands():
current_power = gpu_metrics['current_socket_power']
else:
current_power = gpu_metrics['average_socket_power']
temperature = gpu_metrics['temperature_hotspot']
# If the hotspot temperature is not available use the edge temp (applicable to APUs)
if gpu_metrics['temperature_hotspot'] != "N/A":
temperature = gpu_metrics['temperature_hotspot']
elif gpu_metrics['temperature_edge'] != "N/A":
temperature = gpu_metrics['temperature_edge']
else:
temperature = "N/A"
else:
mem_util = "N/A"
gfx_util = "N/A"
+6 -1
Ver fichero
@@ -1080,7 +1080,12 @@ class AMDSMILogger():
power_usage = gpu_info['power_usage']
if power_usage != "N/A":
power_usage = f"{gpu_info['power_usage']['current_power']}/{gpu_info['power_usage']['power_limit']} W"
power_limit = gpu_info['power_usage']['power_limit']
if power_limit != 0:
power_limit = f"/{power_limit}"
else:
power_limit = ""
power_usage = f"{gpu_info['power_usage']['current_power']}{power_limit} W"
power_usage = str(power_usage).rjust(13)
gpu_id = str(gpu_info['gpu_id']).rjust(3)