habanalabs: load CPU device boot loader from host
PATCH 1/1 habanalabs: load CPU device boot loader from host
From: Ofir Bitton <[email protected]>
Load CPU device boot loader during driver boot time in order to avoid flash write for every boot loader update.
To preserve backward-compatibility, skip the device boot load if the device doesn't request it.
Signed-off-by Ofir Bitton <[email protected]>
Reviewed-by Oded Gabbay <[email protected]>
Signed-off-by Oded Gabbay <[email protected]>
--- drivers/misc/habanalabs/firmware_if.c | 22 +++++- drivers/misc/habanalabs/goya/goya.c | 83 ++++---------------- drivers/misc/habanalabs/habanalabs.h | 4 +- drivers/misc/habanalabs/include/hl_boot_if.h | 3 + 4 files changed, 44 insertions(+), 68 deletions(-)
drivers/misc/habanalabs/firmware_if.c +21 -1
@@ -329,7 +329,7 @@ static void fw_read_errors(struct hl_device *hdev, u32 boot_err0_reg)int hl_fw_init_cpu (struct hl_device *hdev,u32 cpu_boot_status_reg,u32 msg_to_cpu_reg,u32 boot_err0_reg,bool skip_bmc, -u32 cpu_timeout) +u32 cpu_timeout,u32 boot_fit_timeout) {u32 status;int rc;
@@ -337,6 +337,26 @@ int hl_fw_init_cpu(struct hl_device *hdev, u32 cpu_boot_status_reg,dev_info (hdev->dev,"Going to wait for device boot (up to %lds)\n" , cpu_timeout /USEC_PER_SEC ); +/* Wait for boot FIT request */ + rc =hl_poll_timeout ( + hdev, + cpu_boot_status_reg, + status, + status ==CPU_BOOT_STATUS_WAITING_FOR_BOOT_FIT , +10000 , + boot_fit_timeout); + +if (rc) { +dev_dbg (hdev->dev, +"No boot fit request received, resuming boot\n" ); + }else { + rc = hdev->asic_funcs->load_boot_fit_to_device (hdev); +if (rc) + goto out; + +WREG32 (msg_to_cpu_reg,KMD_MSG_FIT_RDY ); + } +/* Make sure CPU boot-loader is running */ rc = hl_poll_timeout( hdev,
drivers/misc/habanalabs/goya/goya.c +17 -66
152 lines not on this page · raw message
drivers/misc/habanalabs/habanalabs.h +3 -1
@@ -552,6 +552,7 @@ enum hl_pll_frequency {* @read_device_fw_version: read the device's firmware versions that are * contained in registers * @load_firmware_to_device: load the firmware to the device's memory +* @load_boot_fit_to_device: load boot fit to device's memory * @set_dma_mask_from_fw: set the DMA mask in the driver according to the * firmware configuration * @get_device_time: Get the device time.
@@ -646,6 +647,7 @@ struct hl_asic_funcs {void (*read_device_fw_version)(struct hl_device *hdev,enum hl_fw_component fwc);int (*load_firmware_to_device)(struct hl_device *hdev); +int (*load_boot_fit_to_device)(struct hl_device *hdev);void (*set_dma_mask_from_fw)(struct hl_device *hdev);u64 (*get_device_time)(struct hl_device *hdev); };
@@ -1645,7 +1647,7 @@ int hl_fw_armcp_info_get(struct hl_device *hdev);int hl_fw_get_eeprom_data (struct hl_device *hdev,void *data,size_t max_size);int hl_fw_init_cpu (struct hl_device *hdev,u32 cpu_boot_status_reg,u32 msg_to_cpu_reg,u32 boot_err0_reg,bool skip_bmc, -u32 cpu_timeout); +u32 cpu_timeout,u32 boot_fit_timeout);int hl_pci_bars_map (struct hl_device *hdev,const char *const name[3 ],bool is_wc[3 ]);
drivers/misc/habanalabs/include/hl_boot_if.h +3 -0
@@ -11,6 +11,8 @@#define LKD_HARD_RESET_MAGIC 0xED7BD694#define HL_POWER9_HOST_MAGIC 0x1DA30009 +#define BOOT_FIT_SRAM_OFFSET 0x200000 +/* * CPU error bits in BOOT_ERROR registers *
@@ -77,6 +79,7 @@ enum cpu_boot_status {CPU_BOOT_STATUS_BMC_WAITING_SKIPPED ,/* deprecated - will be removed */ /* Last boot loader progress status, ready to receive commands */ CPU_BOOT_STATUS_READY_TO_BOOT =15 , + CPU_BOOT_STATUS_WAITING_FOR_BOOT_FIT = 16, }; enum kmd_msg {
Signature · 1 line
2.17.1