habanalabs: rename ArmCP to CPU-CP
PATCH 2/6 habanalabs: remove unused ASIC function pointer
In reply to Oded GabbayOld function pointer that was left when the call to this function pointer was removed.
--- drivers/misc/habanalabs/common/habanalabs.h | 5 ----- drivers/misc/habanalabs/gaudi/gaudi.c | 1 - drivers/misc/habanalabs/goya/goya.c | 1 - 3 files changed, 7 deletions(-)
drivers/misc/habanalabs/common/habanalabs.h +0 -5
@@ -675,8 +675,6 @@ enum div_select_defs {* ASIC * @get_hw_state: retrieve the H/W state * @pci_bars_map: Map PCI BARs. -* @set_dram_bar_base: Set DRAM BAR to map specific device address. Returns -* old address the bar pointed to or U64_MAX for failure * @init_iatu: Initialize the iATU unit inside the PCI controller. * @rreg: Read a register. Needed for simulator support. * @wreg: Write a register. Needed for simulator support.
@@ -779,7 +777,6 @@ struct hl_asic_funcs { u16 len, u32 timeout, long *result);enum hl_device_hw_state (*get_hw_state)(struct hl_device *hdev);int (*pci_bars_map)(struct hl_device *hdev); -u64 (*set_dram_bar_base)(struct hl_device *hdev,u64 addr);int (*init_iatu)(struct hl_device *hdev);u32 (*rreg)(struct hl_device *hdev,u32 reg);void (*wreg)(struct hl_device *hdev,u32 reg,u32 val);
@@ -1874,8 +1871,6 @@ int hl_fw_init_cpu(struct hl_device *hdev, u32 cpu_boot_status_reg,int hl_pci_bars_map (struct hl_device *hdev,const char *const name[3 ],bool is_wc[3 ]);int hl_pci_iatu_write (struct hl_device *hdev,u32 addr,u32 data); -int hl_pci_set_dram_bar_base (struct hl_device *hdev,u8 inbound_region,u8 bar, -u64 addr);int hl_pci_set_inbound_region (struct hl_device *hdev,u8 region,struct hl_inbound_pci_region *pci_region); int hl_pci_set_outbound_region(struct hl_device *hdev,
drivers/misc/habanalabs/gaudi/gaudi.c +0 -1
@@ -6642,7 +6642,6 @@ static const struct hl_asic_funcs gaudi_funcs = { .send_cpu_message = gaudi_send_cpu_message, .get_hw_state = gaudi_get_hw_state, .pci_bars_map = gaudi_pci_bars_map, - .set_dram_bar_base = gaudi_set_hbm_bar_base, .init_iatu = gaudi_init_iatu, .rreg = hl_rreg, .wreg = hl_wreg,
drivers/misc/habanalabs/goya/goya.c +0 -1
@@ -5377,7 +5377,6 @@ static const struct hl_asic_funcs goya_funcs = { .send_cpu_message = goya_send_cpu_message, .get_hw_state = goya_get_hw_state, .pci_bars_map = goya_pci_bars_map, - .set_dram_bar_base = goya_set_ddr_bar_base, .init_iatu = goya_init_iatu, .rreg = hl_rreg, .wreg = hl_wreg,
Signature · 1 line
2.17.1
PATCH 3/6 habanalabs: remove unused define
In reply to Oded GabbayCleanup the code.
--- drivers/misc/habanalabs/gaudi/gaudiP.h | 2 -- 1 file changed, 2 deletions(-)
drivers/misc/habanalabs/gaudi/gaudiP.h +0 -2
@@ -35,8 +35,6 @@#error "Number of MSI interrupts must be smaller or equal to GAUDI_MSI_ENTRIES"#endif -#define QMAN_FENCE_TIMEOUT_USEC 10000/* 10 ms */ -#define CORESIGHT_TIMEOUT_USEC 100000/* 100 ms */ #define GAUDI_MAX_CLK_FREQ 2200000000ull/* 2200 MHz */
Signature · 1 line
2.17.1
PATCH 5/6 habanalabs: increase PQ COMP_OFFSET by one nibble
In reply to Oded GabbayFor future ASICs, we increase this field by one nibble. This field was not used by the current ASICs so this change doesn't break anything.
--- drivers/misc/habanalabs/include/common/qman_if.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/misc/habanalabs/include/common/qman_if.h +1 -1
@@ -40,7 +40,7 @@ struct hl_bd {*/ #define BD_CTL_COMP_OFFSET_SHIFT 16 -#define BD_CTL_COMP_OFFSET_MASK 0x00FF0000 +#define BD_CTL_COMP_OFFSET_MASK 0x0FFF0000#define BD_CTL_COMP_DATA_SHIFT 0#define BD_CTL_COMP_DATA_MASK 0x0000FFFF
Signature · 1 line
2.17.1
PATCH 1/6 habanalabs: rename ArmCP to CPU-CP
There were a couple of comments where the name ArmCP was still used. Rename it to CPU-CP.
In addition, rename ArmCP or ARM in log messages to "device CPU".
--- drivers/misc/habanalabs/common/firmware_if.c | 17 ++++++++------- drivers/misc/habanalabs/common/habanalabs.h | 22 ++++++++++---------- drivers/misc/habanalabs/gaudi/gaudi.c | 4 ++-- drivers/misc/habanalabs/goya/goya.c | 2 +- 4 files changed, 23 insertions(+), 22 deletions(-)
drivers/misc/habanalabs/common/firmware_if.c +9 -8
@@ -175,7 +175,7 @@ int hl_fw_unmask_irq_arr(struct hl_device *hdev, const u32 *irq_arr, total_pkt_size =sizeof (struct cpucp_unmask_irq_arr_packet ) + irq_arr_size; -/* data should be aligned to 8 bytes in order to ArmCP to copy it */ +/* data should be aligned to 8 bytes in order to CPU-CP to copy it */ total_pkt_size = (total_pkt_size +0x7 ) & ~0x7 ;/* total_pkt_size is casted to u16 later on */
@@ -283,7 +283,7 @@ int hl_fw_cpucp_info_get(struct hl_device *hdev) &cpucp_info_dma_addr);if (!cpucp_info_cpu_addr) {dev_err (hdev->dev, -"Failed to allocate DMA memory for ArmCP info packet\n" ); +"Failed to allocate DMA memory for CPU-CP info packet\n" );return -ENOMEM ; }
@@ -298,7 +298,7 @@ int hl_fw_cpucp_info_get(struct hl_device *hdev) HL_CPUCP_INFO_TIMEOUT_USEC, &result);if (rc) {dev_err (hdev->dev, -"Failed to handle ArmCP info pkt, error %d\n" , rc); +"Failed to handle CPU-CP info pkt, error %d\n" , rc); goto out; }
@@ -333,7 +333,7 @@ int hl_fw_get_eeprom_data(struct hl_device *hdev, void *data, size_t max_size) max_size, &eeprom_info_dma_addr);if (!eeprom_info_cpu_addr) {dev_err (hdev->dev, -"Failed to allocate DMA memory for ArmCP EEPROM packet\n" ); +"Failed to allocate DMA memory for CPU-CP EEPROM packet\n" );return -ENOMEM ; }
@@ -349,7 +349,8 @@ int hl_fw_get_eeprom_data(struct hl_device *hdev, void *data, size_t max_size)if (rc) {dev_err (hdev->dev, -"Failed to handle ArmCP EEPROM packet, error %d\n" , rc); +"Failed to handle CPU-CP EEPROM packet, error %d\n" , + rc); goto out; }
@@ -379,7 +380,7 @@ int hl_fw_cpucp_pci_counters_get(struct hl_device *hdev, HL_CPUCP_INFO_TIMEOUT_USEC, &result);if (rc) {dev_err (hdev->dev, -"Failed to handle ArmCP PCI info pkt, error %d\n" , rc); +"Failed to handle CPU-CP PCI info pkt, error %d\n" , rc);return rc; } counters->rx_throughput = result;
@@ -390,7 +391,7 @@ int hl_fw_cpucp_pci_counters_get(struct hl_device *hdev, HL_CPUCP_INFO_TIMEOUT_USEC, &result);if (rc) {dev_err (hdev->dev, -"Failed to handle ArmCP PCI info pkt, error %d\n" , rc); +"Failed to handle CPU-CP PCI info pkt, error %d\n" , rc);return rc; } counters->tx_throughput = result;
@@ -403,7 +404,7 @@ int hl_fw_cpucp_pci_counters_get(struct hl_device *hdev, HL_CPUCP_INFO_TIMEOUT_USEC, &result);if (rc) {dev_err (hdev->dev, -"Failed to handle ArmCP PCI info pkt, error %d\n" , rc); +"Failed to handle CPU-CP PCI info pkt, error %d\n" , rc);return rc; } counters->replay_cnt = (u32 ) result;
drivers/misc/habanalabs/common/habanalabs.h +11 -11
@@ -466,7 +466,7 @@ struct hl_cs_job;#define HL_EQ_LENGTH 64#define HL_EQ_SIZE_IN_BYTES (HL_EQ_LENGTH * HL_EQ_ENTRY_SIZE) -/* Host <-> ArmCP shared memory size */ +/* Host <-> CPU-CP shared memory size */ #define HL_CPU_ACCESSIBLE_MEM_SIZE SZ_2M/**
@@ -648,7 +648,7 @@ enum div_select_defs {* @debugfs_read32: debug interface for reading u32 from DRAM/SRAM. * @debugfs_write32: debug interface for writing u32 to DRAM/SRAM. * @add_device_attr: add ASIC specific device attributes. -* @handle_eqe: handle event queue entry (IRQ) from ArmCP. +* @handle_eqe: handle event queue entry (IRQ) from CPU-CP. * @set_pll_profile: change PLL profile (manual/automatic). * @get_events_stat: retrieve event queue entries histogram. * @read_pte: read MMU page table entry from DRAM.
@@ -657,7 +657,7 @@ enum div_select_defs {* (L1 only) or hard (L0 & L1) flush. * @mmu_invalidate_cache_range: flush specific MMU STLB cache lines with * ASID-VA-size mask. -* @send_heartbeat: send is-alive packet to ArmCP and verify response. +* @send_heartbeat: send is-alive packet to CPU-CP and verify response. * @set_clock_gating: enable/disable clock gating per engine according to * clock gating mask in hdev * @disable_clock_gating: disable clock gating completely
@@ -1438,8 +1438,8 @@ struct hl_device_idle_busy_ts {* @dev: related kernel basic device structure. * @dev_ctrl: related kernel device structure for the control device * @work_freq: delayed work to lower device frequency if possible. -* @work_heartbeat: delayed work for ArmCP is-alive check. -* @asic_name: ASIC specific nmae. +* @work_heartbeat: delayed work for CPU-CP is-alive check. +* @asic_name: ASIC specific name. * @asic_type: ASIC specific type. * @completion_queue: array of hl_cq. * @cq_wq: work queues of completion queues for executing work in process
@@ -1450,14 +1450,14 @@ struct hl_device_idle_busy_ts {* @hw_queues_mirror_list: CS mirror list for TDR. * @hw_queues_mirror_lock: protects hw_queues_mirror_list. * @kernel_cb_mgr: command buffer manager for creating/destroying/handling CGs. -* @event_queue: event queue for IRQ from ArmCP. +* @event_queue: event queue for IRQ from CPU-CP. * @dma_pool: DMA pool for small allocations. -* @cpu_accessible_dma_mem: Host <-> ArmCP shared memory CPU address. -* @cpu_accessible_dma_address: Host <-> ArmCP shared memory DMA address. -* @cpu_accessible_dma_pool: Host <-> ArmCP shared memory pool. +* @cpu_accessible_dma_mem: Host <-> CPU-CP shared memory CPU address. +* @cpu_accessible_dma_address: Host <-> CPU-CP shared memory DMA address. +* @cpu_accessible_dma_pool: Host <-> CPU-CP shared memory pool. * @asid_bitmap: holds used/available ASIDs. * @asid_mutex: protects asid_bitmap. -* @send_cpu_message_lock: enforces only one message in Host <-> ArmCP queue. +* @send_cpu_message_lock: enforces only one message in Host <-> CPU-CP queue. * @debug_lock: protects critical section of setting debug mode for device * @asic_prop: ASIC specific immutable properties. * @asic_funcs: ASIC specific functions.
@@ -1511,7 +1511,7 @@ struct hl_device_idle_busy_ts {* @late_init_done: is late init stage was done during initialization. * @hwmon_initialized: is H/W monitor sensors was initialized. * @hard_reset_pending: is there a hard reset work pending. -* @heartbeat: is heartbeat sanity check towards ArmCP enabled. +* @heartbeat: is heartbeat sanity check towards CPU-CP enabled. * @reset_on_lockup: true if a reset should be done in case of stuck CS, false * otherwise. * @dram_supports_virtual_memory: is MMU enabled towards DRAM.
drivers/misc/habanalabs/gaudi/gaudi.c +2 -2
@@ -2854,7 +2854,7 @@ static int gaudi_init_cpu_queues(struct hl_device *hdev, u32 cpu_timeout)if (err) {dev_err (hdev->dev, -"Failed to communicate with ARM CPU (ArmCP timeout)\n" ); +"Failed to communicate with Device CPU (CPU-CP timeout)\n" );return -EIO ; }
@@ -5616,7 +5616,7 @@ static bool gaudi_tpc_read_interrupts(struct hl_device *hdev, u8 tpc_id,bool soft_reset_required = false;/* Accessing the TPC_INTR_CAUSE registers requires disabling the clock -* gating, and thus cannot be done in ArmCP and should be done instead +* gating, and thus cannot be done in CPU-CP and should be done instead * by the driver. */
drivers/misc/habanalabs/goya/goya.c +1 -1
@@ -4509,7 +4509,7 @@ static int goya_unmask_irq_arr(struct hl_device *hdev, u32 *irq_arr, total_pkt_size =sizeof (struct cpucp_unmask_irq_arr_packet ) + irq_arr_size; -/* data should be aligned to 8 bytes in order to ArmCP to copy it */ +/* data should be aligned to 8 bytes in order to CPU-CP to copy it */ total_pkt_size = (total_pkt_size +0x7 ) & ~0x7 ;/* total_pkt_size is casted to u16 later on */
Signature · 1 line
2.17.1
PATCH 6/6 habanalabs: check flag before reset because of f/w event
For consistency with GAUDI code, add check of the relevant flag in the device structure before resetting the GOYA device in case of firmware event.
--- drivers/misc/habanalabs/goya/goya.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/misc/habanalabs/goya/goya.c +2 -1
@@ -4644,7 +4644,8 @@ void goya_handle_eqe(struct hl_device *hdev, struct hl_eq_entry *eq_entry)case GOYA_ASYNC_EVENT_ID_L2_RAM_ECC :case GOYA_ASYNC_EVENT_ID_PSOC_GPIO_05_SW_RESET :goya_print_irq_info (hdev, event_type, false); -hl_device_reset (hdev, true, false); +if (hdev->hard_reset_on_fw_events) +hl_device_reset (hdev, true, false);break ;case GOYA_ASYNC_EVENT_ID_PCIE_DEC :
Signature · 1 line
2.17.1
PATCH 4/6 habanalabs: Fix alignment issue in cpucp_info structure
In reply to Oded GabbayFrom: Ofir Bitton <[email protected]>
Because the device CPU compiler aligns structures to 8 bytes, struct cpucp_info has an alignment issue as some parts in the structure are not aligned to 8 bytes.
It is preferred that we explicitly insert placeholders inside the structure to avoid confusion
in order to validate this scenario, we printed both pointers:
__u8 cpucp_version[VERSION_MAX_LEN]; (0xffff899c67ed4cbc)__le64 dram_size; (0xffff899c67ed4d40)
we see difference of 132 bytes although the first array is only 128 bytes long, Meaning compiler added a 4 byte padding.
--- drivers/misc/habanalabs/include/common/cpucp_if.h | 1 + 1 file changed, 1 insertion(+)
drivers/misc/habanalabs/include/common/cpucp_if.h +1 -0
@@ -410,6 +410,7 @@ struct cpucp_info {__u8 fuse_version[VERSION_MAX_LEN ];__u8 thermal_version[VERSION_MAX_LEN ];__u8 cpucp_version[VERSION_MAX_LEN ]; +__le32 reserved2;__le64 dram_size;char card_name[CARD_NAME_MAX_LEN ]; };
Signature · 1 line
2.17.1
RE: [PATCH 6/6] habanalabs: check flag before reset because of f/w event
In reply to Oded GabbayQuoted 5 lines · On Fri, Sep 4, 2020 at 21:46 Oded Gabbay <[email protected]> wrote:
For consistency with GAUDI code, add check of the relevant flag in the device structure before resetting the GOYA device in case of firmware event.
Signed-off-by Oded Gabbay <[email protected]>
This patch-set is: