habanalabs: use proper max_power variable for device utilization
authorTomer Tayar <ttayar@habana.ai>
Mon, 17 Jan 2022 22:21:49 +0000 (00:21 +0200)
committerOded Gabbay <ogabbay@kernel.org>
Mon, 28 Feb 2022 12:22:05 +0000 (14:22 +0200)
The max_power variable which is used for calculating the device
utilization is the ASIC specific property which is set during init.
However, the max value can be modified via sysfs, and thus the updated
value in the device structure should be used instead.

Signed-off-by: Tomer Tayar <ttayar@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
drivers/misc/habanalabs/common/device.c

index 60bfd737404b394b839e243e58d43a755ff67527..63e2449ad136f76fbef126a9aa91026576af039f 100644 (file)
@@ -614,7 +614,7 @@ int hl_device_utilization(struct hl_device *hdev, u32 *utilization)
        u64 max_power, curr_power, dc_power, dividend;
        int rc;
 
-       max_power = hdev->asic_prop.max_power_default;
+       max_power = hdev->max_power;
        dc_power = hdev->asic_prop.dc_power_default;
        rc = hl_fw_cpucp_power_get(hdev, &curr_power);