Commit 6a2f5d70 authored by Ofir Bitton's avatar Ofir Bitton Committed by Oded Gabbay

habanalabs: use a single FW loading bringup flag

For simplicity, use a single bringup flag indicating which FW
binaries should loaded to device.
Signed-off-by: default avatarOfir Bitton <obitton@habana.ai>
Reviewed-by: default avatarOded Gabbay <ogabbay@kernel.org>
Signed-off-by: default avatarOded Gabbay <ogabbay@kernel.org>
parent 366addb0
...@@ -623,7 +623,11 @@ int hl_fw_read_preboot_status(struct hl_device *hdev, u32 cpu_boot_status_reg, ...@@ -623,7 +623,11 @@ int hl_fw_read_preboot_status(struct hl_device *hdev, u32 cpu_boot_status_reg,
u32 status, security_status; u32 status, security_status;
int rc; int rc;
if (!hdev->cpu_enable) /* pldm was added for cases in which we use preboot on pldm and want
* to load boot fit, but we can't wait for preboot because it runs
* very slowly
*/
if (!(hdev->fw_components & FW_TYPE_PREBOOT_CPU) || hdev->pldm)
return 0; return 0;
/* Need to check two possible scenarios: /* Need to check two possible scenarios:
...@@ -710,7 +714,7 @@ int hl_fw_init_cpu(struct hl_device *hdev, u32 cpu_boot_status_reg, ...@@ -710,7 +714,7 @@ int hl_fw_init_cpu(struct hl_device *hdev, u32 cpu_boot_status_reg,
u32 status; u32 status;
int rc; int rc;
if (!(hdev->fw_loading & FW_TYPE_BOOT_CPU)) if (!(hdev->fw_components & FW_TYPE_BOOT_CPU))
return 0; return 0;
dev_info(hdev->dev, "Going to wait for device boot (up to %lds)\n", dev_info(hdev->dev, "Going to wait for device boot (up to %lds)\n",
...@@ -801,7 +805,7 @@ int hl_fw_init_cpu(struct hl_device *hdev, u32 cpu_boot_status_reg, ...@@ -801,7 +805,7 @@ int hl_fw_init_cpu(struct hl_device *hdev, u32 cpu_boot_status_reg,
goto out; goto out;
} }
if (!(hdev->fw_loading & FW_TYPE_LINUX)) { if (!(hdev->fw_components & FW_TYPE_LINUX)) {
dev_info(hdev->dev, "Skip loading Linux F/W\n"); dev_info(hdev->dev, "Skip loading Linux F/W\n");
goto out; goto out;
} }
......
...@@ -171,15 +171,19 @@ enum hl_fw_component { ...@@ -171,15 +171,19 @@ enum hl_fw_component {
}; };
/** /**
* enum hl_fw_types - F/W types to load * enum hl_fw_types - F/W types present in the system
* @FW_TYPE_LINUX: Linux image for device CPU * @FW_TYPE_LINUX: Linux image for device CPU
* @FW_TYPE_BOOT_CPU: Boot image for device CPU * @FW_TYPE_BOOT_CPU: Boot image for device CPU
* @FW_TYPE_PREBOOT_CPU: Indicates pre-loaded CPUs are present in the system
* (preboot, ppboot etc...)
* @FW_TYPE_ALL_TYPES: Mask for all types * @FW_TYPE_ALL_TYPES: Mask for all types
*/ */
enum hl_fw_types { enum hl_fw_types {
FW_TYPE_LINUX = 0x1, FW_TYPE_LINUX = 0x1,
FW_TYPE_BOOT_CPU = 0x2, FW_TYPE_BOOT_CPU = 0x2,
FW_TYPE_ALL_TYPES = (FW_TYPE_LINUX | FW_TYPE_BOOT_CPU) FW_TYPE_PREBOOT_CPU = 0x4,
FW_TYPE_ALL_TYPES =
(FW_TYPE_LINUX | FW_TYPE_BOOT_CPU | FW_TYPE_PREBOOT_CPU)
}; };
/** /**
...@@ -2066,10 +2070,9 @@ struct hl_device { ...@@ -2066,10 +2070,9 @@ struct hl_device {
/* Parameters for bring-up */ /* Parameters for bring-up */
u64 nic_ports_mask; u64 nic_ports_mask;
u64 fw_loading; u64 fw_components;
u8 mmu_enable; u8 mmu_enable;
u8 mmu_huge_page_opt; u8 mmu_huge_page_opt;
u8 cpu_enable;
u8 reset_pcilink; u8 reset_pcilink;
u8 cpu_queues_enable; u8 cpu_queues_enable;
u8 pldm; u8 pldm;
......
...@@ -234,8 +234,7 @@ int hl_device_open_ctrl(struct inode *inode, struct file *filp) ...@@ -234,8 +234,7 @@ int hl_device_open_ctrl(struct inode *inode, struct file *filp)
static void set_driver_behavior_per_device(struct hl_device *hdev) static void set_driver_behavior_per_device(struct hl_device *hdev)
{ {
hdev->cpu_enable = 1; hdev->fw_components = FW_TYPE_ALL_TYPES;
hdev->fw_loading = FW_TYPE_ALL_TYPES;
hdev->cpu_queues_enable = 1; hdev->cpu_queues_enable = 1;
hdev->heartbeat = 1; hdev->heartbeat = 1;
hdev->mmu_enable = 1; hdev->mmu_enable = 1;
......
...@@ -3701,7 +3701,7 @@ static int gaudi_init_cpu(struct hl_device *hdev) ...@@ -3701,7 +3701,7 @@ static int gaudi_init_cpu(struct hl_device *hdev)
struct gaudi_device *gaudi = hdev->asic_specific; struct gaudi_device *gaudi = hdev->asic_specific;
int rc; int rc;
if (!hdev->cpu_enable) if (!(hdev->fw_components & FW_TYPE_PREBOOT_CPU))
return 0; return 0;
if (gaudi->hw_cap_initialized & HW_CAP_CPU) if (gaudi->hw_cap_initialized & HW_CAP_CPU)
......
...@@ -2429,7 +2429,7 @@ static int goya_init_cpu(struct hl_device *hdev) ...@@ -2429,7 +2429,7 @@ static int goya_init_cpu(struct hl_device *hdev)
struct goya_device *goya = hdev->asic_specific; struct goya_device *goya = hdev->asic_specific;
int rc; int rc;
if (!hdev->cpu_enable) if (!(hdev->fw_components & FW_TYPE_PREBOOT_CPU))
return 0; return 0;
if (goya->hw_cap_initialized & HW_CAP_CPU) if (goya->hw_cap_initialized & HW_CAP_CPU)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment