]> git.baikalelectronics.ru Git - kernel.git/commitdiff
habanalabs: do not set max power on a secured device
authorOfir Bitton <obitton@habana.ai>
Thu, 30 Jun 2022 11:37:03 +0000 (14:37 +0300)
committerOded Gabbay <ogabbay@kernel.org>
Tue, 12 Jul 2022 06:09:29 +0000 (09:09 +0300)
Max power API is not supported in secured devices. Hence, we should
skip setting it during boot.

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

index 9f3778c82e546801f80ecdc8beb76dea06fe5e46..99d84b46aeb6aa3e3ecc4adcd9e9bb21f24ae796 100644 (file)
@@ -1545,7 +1545,8 @@ kill_processes:
                        goto out_err;
                }
 
-               hl_fw_set_max_power(hdev);
+               if (!hdev->asic_prop.fw_security_enabled)
+                       hl_fw_set_max_power(hdev);
        } else {
                rc = hdev->asic_funcs->non_hard_reset_late_init(hdev);
                if (rc) {
@@ -1914,7 +1915,8 @@ int hl_device_init(struct hl_device *hdev, struct class *hclass)
        /* Need to call this again because the max power might change,
         * depending on card type for certain ASICs
         */
-       if (hdev->asic_prop.set_max_power_on_device_init)
+       if (hdev->asic_prop.set_max_power_on_device_init &&
+                       !hdev->asic_prop.fw_security_enabled)
                hl_fw_set_max_power(hdev);
 
        /*