habanalabs: adding indication of boot fit loaded
Up until now the driver stored indication if Linux was loaded on the device CPU. This was needed in order to coordinate some tasks that are performed by the Linux. In future ASICs, many of those tasks will be performed by the boot fit, so now we need the same indication of boot fit load status. Signed-off-by: Ohad Sharabi <osharabi@habana.ai> Reviewed-by: Oded Gabbay <ogabbay@kernel.org> Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
This commit is contained in:
parent
6ccba9a3bc
commit
8f82ff75df
|
@ -1138,7 +1138,7 @@ kill_processes:
|
|||
hdev->asic_funcs->hw_fini(hdev, hard_reset, fw_reset);
|
||||
|
||||
if (hard_reset) {
|
||||
hdev->fw_loader.linux_loaded = false;
|
||||
hdev->fw_loader.fw_comp_loaded = FW_TYPE_NONE;
|
||||
|
||||
/* Release kernel context */
|
||||
if (hdev->kernel_ctx && hl_ctx_put(hdev->kernel_ctx) == 1)
|
||||
|
@ -1692,7 +1692,7 @@ void hl_device_fini(struct hl_device *hdev)
|
|||
/* Reset the H/W. It will be in idle state after this returns */
|
||||
hdev->asic_funcs->hw_fini(hdev, true, false);
|
||||
|
||||
hdev->fw_loader.linux_loaded = false;
|
||||
hdev->fw_loader.fw_comp_loaded = FW_TYPE_NONE;
|
||||
|
||||
/* Release kernel context */
|
||||
if ((hdev->kernel_ctx) && (hl_ctx_put(hdev->kernel_ctx) != 1))
|
||||
|
|
|
@ -1919,6 +1919,8 @@ static void hl_fw_boot_fit_update_state(struct hl_device *hdev,
|
|||
{
|
||||
struct asic_fixed_properties *prop = &hdev->asic_prop;
|
||||
|
||||
hdev->fw_loader.fw_comp_loaded |= FW_TYPE_BOOT_CPU;
|
||||
|
||||
/* Clear reset status since we need to read it again from boot CPU */
|
||||
prop->hard_reset_done_by_fw = false;
|
||||
|
||||
|
@ -2127,7 +2129,7 @@ static void hl_fw_linux_update_state(struct hl_device *hdev,
|
|||
{
|
||||
struct asic_fixed_properties *prop = &hdev->asic_prop;
|
||||
|
||||
hdev->fw_loader.linux_loaded = true;
|
||||
hdev->fw_loader.fw_comp_loaded |= FW_TYPE_LINUX;
|
||||
|
||||
/* Clear reset status since we need to read again from app */
|
||||
prop->hard_reset_done_by_fw = false;
|
||||
|
|
|
@ -219,6 +219,7 @@ enum hl_fw_component {
|
|||
|
||||
/**
|
||||
* enum hl_fw_types - F/W types present in the system
|
||||
* @FW_TYPE_NONE: no FW component indication
|
||||
* @FW_TYPE_LINUX: Linux 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
|
||||
|
@ -226,6 +227,7 @@ enum hl_fw_component {
|
|||
* @FW_TYPE_ALL_TYPES: Mask for all types
|
||||
*/
|
||||
enum hl_fw_types {
|
||||
FW_TYPE_NONE = 0x0,
|
||||
FW_TYPE_LINUX = 0x1,
|
||||
FW_TYPE_BOOT_CPU = 0x2,
|
||||
FW_TYPE_PREBOOT_CPU = 0x4,
|
||||
|
@ -1059,7 +1061,8 @@ struct fw_image_props {
|
|||
* @skip_bmc: should BMC be skipped
|
||||
* @sram_bar_id: SRAM bar ID
|
||||
* @dram_bar_id: DRAM bar ID
|
||||
* @linux_loaded: true if linux was loaded so far
|
||||
* @fw_comp_loaded: bitmask of loaded FW components. set bit meaning loaded
|
||||
* component. values are set according to enum hl_fw_types.
|
||||
*/
|
||||
struct fw_load_mgr {
|
||||
union {
|
||||
|
@ -1073,7 +1076,7 @@ struct fw_load_mgr {
|
|||
u8 skip_bmc;
|
||||
u8 sram_bar_id;
|
||||
u8 dram_bar_id;
|
||||
u8 linux_loaded;
|
||||
u8 fw_comp_loaded;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -4007,7 +4007,7 @@ static void gaudi_init_firmware_loader(struct hl_device *hdev)
|
|||
struct fw_load_mgr *fw_loader = &hdev->fw_loader;
|
||||
|
||||
/* fill common fields */
|
||||
fw_loader->linux_loaded = false;
|
||||
fw_loader->fw_comp_loaded = FW_TYPE_NONE;
|
||||
fw_loader->boot_fit_img.image_name = GAUDI_BOOT_FIT_FILE;
|
||||
fw_loader->linux_img.image_name = GAUDI_LINUX_FW_FILE;
|
||||
fw_loader->cpu_timeout = GAUDI_CPU_TIMEOUT_USEC;
|
||||
|
@ -4290,7 +4290,7 @@ static void gaudi_hw_fini(struct hl_device *hdev, bool hard_reset, bool fw_reset
|
|||
* via the GIC. Otherwise, we need to use COMMS or the MSG_TO_CPU
|
||||
* registers in case of old F/Ws
|
||||
*/
|
||||
if (hdev->fw_loader.linux_loaded) {
|
||||
if (hdev->fw_loader.fw_comp_loaded & FW_TYPE_LINUX) {
|
||||
irq_handler_offset = hdev->asic_prop.gic_interrupts_enable ?
|
||||
mmGIC_DISTRIBUTOR__5_GICD_SETSPI_NSR :
|
||||
le32_to_cpu(dyn_regs->gic_host_halt_irq);
|
||||
|
|
|
@ -2504,7 +2504,7 @@ static void goya_init_firmware_loader(struct hl_device *hdev)
|
|||
struct fw_load_mgr *fw_loader = &hdev->fw_loader;
|
||||
|
||||
/* fill common fields */
|
||||
fw_loader->linux_loaded = false;
|
||||
fw_loader->fw_comp_loaded = FW_TYPE_NONE;
|
||||
fw_loader->boot_fit_img.image_name = GOYA_BOOT_FIT_FILE;
|
||||
fw_loader->linux_img.image_name = GOYA_LINUX_FW_FILE;
|
||||
fw_loader->cpu_timeout = GOYA_CPU_TIMEOUT_USEC;
|
||||
|
|
Loading…
Reference in New Issue