habanalabs/gaudi: scrub HBM to a specific value
Subsystems (2)
PATCH 1/16 habanalabs/gaudi: scrub HBM to a specific value
From: Ofir Bitton <[email protected]>
In order to enhance debuggability, we will scrub the whole HBM to a specific value, in case HBM scrubbing is enabled. Scrubbing will be performed after reset and after user closes the FD.
--- drivers/misc/habanalabs/gaudi/gaudi.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/misc/habanalabs/gaudi/gaudi.c +7 -2
@@ -4194,6 +4194,11 @@ static int gaudi_hw_init(struct hl_device *hdev) goto disable_msi; } +/* Scrub both SRAM and DRAM */ + rc = hdev->asic_funcs->scrub_device_mem (hdev,0 ,0 ); +if (rc) +return rc; +/* Perform read from the device to flush all configuration */ RREG32 (mmHW_STATE);
@@ -4758,8 +4763,8 @@ static int gaudi_hbm_scrubbing(struct hl_device *hdev)"Doing HBM scrubbing for 0x%09llx - 0x%09llx\n" , cur_addr, cur_addr + chunk_size); -WREG32 (mmDMA0_CORE_SRC_BASE_LO + dma_offset,0 ); -WREG32 (mmDMA0_CORE_SRC_BASE_HI + dma_offset,0 ); +WREG32 (mmDMA0_CORE_SRC_BASE_LO + dma_offset,0xdeadbeaf ); +WREG32 (mmDMA0_CORE_SRC_BASE_HI + dma_offset,0xdeadbeaf );WREG32 (mmDMA0_CORE_DST_BASE_LO + dma_offset,lower_32_bits (cur_addr)); WREG32(mmDMA0_CORE_DST_BASE_HI + dma_offset,
Signature · 1 line
2.17.1
PATCH 2/16 habanalabs/gaudi: move scrubbing to late init
HW init is mostly about configuring registers. Therefore, it is better to activate DMAs only in late init and afterwards.
--- drivers/misc/habanalabs/gaudi/gaudi.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/misc/habanalabs/gaudi/gaudi.c +5 -5
@@ -1567,6 +1567,11 @@ static int gaudi_late_init(struct hl_device *hdev)return rc; } +/* Scrub both SRAM and DRAM */ + rc = hdev->asic_funcs->scrub_device_mem (hdev,0 ,0 ); +if (rc) + goto disable_pci_access; + rc =gaudi_fetch_psoc_frequency (hdev);if (rc) {dev_err (hdev->dev,"Failed to fetch psoc frequency\n" );
@@ -4194,11 +4199,6 @@ static int gaudi_hw_init(struct hl_device *hdev) goto disable_msi; } -/* Scrub both SRAM and DRAM */ - rc = hdev->asic_funcs->scrub_device_mem (hdev,0 ,0 ); -if (rc) -return rc; -/* Perform read from the device to flush all configuration */ RREG32 (mmHW_STATE);
Signature · 1 line
2.17.1
PATCH 3/16 habanalabs: save pid per userptr
In reply to Oded GabbayFrom: Yuri Nudelman <[email protected]>
Currently userptr endpoint in debugfs prints out virtual addresses in the user process memory space, without specifying their owner process ID. User space virtual address is meaningless without knowing the owner process.
--- drivers/misc/habanalabs/common/debugfs.c | 8 ++++---- drivers/misc/habanalabs/common/habanalabs.h | 2 ++ drivers/misc/habanalabs/common/memory.c | 1 + 3 files changed, 7 insertions(+), 4 deletions(-)
drivers/misc/habanalabs/common/debugfs.c +4 -4
@@ -209,12 +209,12 @@ static int userptr_show(struct seq_file *s, void *data)if (first) { first = false;seq_puts (s,"\n" ); -seq_puts (s," user virtual address size dma dir\n" ); +seq_puts (s," pid user virtual address size dma dir\n" );seq_puts (s,"----------------------------------------------------------\n" ); } -seq_printf (s, -" 0x%-14llx %-10llu %-30s\n" , - userptr->addr, userptr->size, dma_dir[userptr->dir]); +seq_printf (s," %-7d 0x%-14llx %-10llu %-30s\n" , + userptr->pid, userptr->addr, userptr->size, + dma_dir[userptr->dir]); }spin_unlock (&dev_entry->userptr_spinlock);
drivers/misc/habanalabs/common/habanalabs.h +2 -0
@@ -1452,6 +1452,7 @@ struct hl_ctx_mgr {* @sgt: pointer to the scatter-gather table that holds the pages. * @dir: for DMA unmapping, the direction must be supplied, so save it. * @debugfs_list: node in debugfs list of command submissions. +* @pid: the pid of the user process owning the memory * @addr: user-space virtual address of the start of the memory area. * @size: size of the memory area to pin & map. * @dma_mapped: true if the SG was mapped to DMA addresses, false otherwise.
@@ -1464,6 +1465,7 @@ struct hl_userptr {struct sg_table *sgt;enum dma_data_direction dir;struct list_head debugfs_list; +pid_t pid;u64 addr;u64 size;u8 dma_mapped;
drivers/misc/habanalabs/common/memory.c +1 -0
@@ -2276,6 +2276,7 @@ int hl_pin_host_memory(struct hl_device *hdev, u64 addr, u64 size,return -EINVAL ; } + userptr->pid = current->pid; userptr->sgt =kzalloc (sizeof (*userptr->sgt),GFP_KERNEL );if (!userptr->sgt)return -ENOMEM ;
Signature · 1 line
2.17.1
PATCH 4/16 habanalabs: fix mmu node address resolution in debugfs
In reply to Oded GabbayFrom: Yuri Nudelman <[email protected]>
The address resolution via debugfs was not taking into consideration the page offset, resulting in a wrong address.
--- drivers/misc/habanalabs/common/debugfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/misc/habanalabs/common/debugfs.c +1 -1
@@ -349,7 +349,7 @@ static int mmu_show(struct seq_file *s, void *data)return 0 ; } - phys_addr = hops_info.hop_info[hops_info.used_hops -1 ].hop_pte_val; +hl_mmu_va_to_pa (ctx, virt_addr, &phys_addr);if (hops_info.scrambled_vaddr && (dev_entry->mmu_addr != hops_info.scrambled_vaddr))
Signature · 1 line
2.17.1
PATCH 5/16 habanalabs/gaudi: minimize number of register reads
In reply to Oded GabbayBecause the register reads might be trapped by the hypervisor in certain deployments, minimize the number of reads during runtime by moving static initializations to functions that occur during device initialization instead of context open.
--- drivers/misc/habanalabs/gaudi/gaudi.c | 15 +++++++++++---- drivers/misc/habanalabs/gaudi/gaudi_coresight.c | 5 ----- 2 files changed, 11 insertions(+), 9 deletions(-)
drivers/misc/habanalabs/gaudi/gaudi.c +11 -4
@@ -1596,6 +1596,11 @@ static int gaudi_late_init(struct hl_device *hdev) goto disable_pci_access; } +/* We only support a single ASID for the user, so for the sake of optimization, just +* initialize the ASID one time during device initialization with the fixed value of 1 +*/ +gaudi_mmu_prepare (hdev,1 ); +return 0 ; disable_pci_access:
@@ -6793,6 +6798,9 @@ static void gaudi_mmu_prepare(struct hl_device *hdev, u32 asid) asid); } +gaudi_mmu_prepare_reg (hdev, mmPSOC_GLOBAL_CONF_TRACE_ARUSER, asid); +gaudi_mmu_prepare_reg (hdev, mmPSOC_GLOBAL_CONF_TRACE_AWUSER, asid); + hdev->asic_funcs->set_clock_gating (hdev);mutex_unlock (&gaudi->clk_gate_mutex);
@@ -6842,7 +6850,8 @@ static int gaudi_send_job_on_qman0(struct hl_device *hdev, dma_offset = gaudi_dma_assignment[GAUDI_PCI_DMA_1 ] *DMA_CORE_OFFSET ; -WREG32_OR (mmDMA0_CORE_PROT + dma_offset,BIT (DMA0_CORE_PROT_VAL_SHIFT )); +WREG32 (mmDMA0_CORE_PROT + dma_offset, +BIT (DMA0_CORE_PROT_ERR_VAL_SHIFT ) |BIT (DMA0_CORE_PROT_VAL_SHIFT )); rc =hl_hw_queue_send_cb_no_cmpl (hdev,GAUDI_QUEUE_ID_DMA_0_0 , job->job_cb_size, cb->bus_address);
@@ -6863,8 +6872,7 @@ static int gaudi_send_job_on_qman0(struct hl_device *hdev, } free_fence_ptr: -WREG32_AND (mmDMA0_CORE_PROT + dma_offset, - ~BIT (DMA0_CORE_PROT_VAL_SHIFT )); +WREG32 (mmDMA0_CORE_PROT + dma_offset,BIT (DMA0_CORE_PROT_ERR_VAL_SHIFT )); hdev->asic_funcs->asic_dma_pool_free (hdev, (void *) fence_ptr, fence_dma_addr);
@@ -8653,7 +8661,6 @@ static int gaudi_ctx_init(struct hl_ctx *ctx)if (ctx->asid ==HL_KERNEL_ASID_ID )return 0 ; -gaudi_mmu_prepare (ctx->hdev, ctx->asid);return gaudi_internal_cb_pool_init (ctx->hdev, ctx); }
drivers/misc/habanalabs/gaudi/gaudi_coresight.c +0 -5
@@ -622,11 +622,6 @@ static int gaudi_config_etr(struct hl_device *hdev,return -EINVAL ; } -gaudi_mmu_prepare_reg (hdev, mmPSOC_GLOBAL_CONF_TRACE_ARUSER, - hdev->compute_ctx->asid); -gaudi_mmu_prepare_reg (hdev, mmPSOC_GLOBAL_CONF_TRACE_AWUSER, - hdev->compute_ctx->asid); - msb =upper_32_bits (input->buffer_address) >>8 ; msb &=PSOC_GLOBAL_CONF_TRACE_ADDR_MSB_MASK ;WREG32 (mmPSOC_GLOBAL_CONF_TRACE_ADDR, msb);
Signature · 1 line
2.17.1
PATCH 6/16 habanalabs: update to latest firmware headers
In reply to Oded GabbayAdd several new packets between driver and firmware. Add matching compatibility bits for backward compatibility. Add support for 4K event types.
Add information about pcie errors.
--- .../misc/habanalabs/include/common/cpucp_if.h | 92 +++++++++++++++++-- .../habanalabs/include/common/hl_boot_if.h | 23 +++++ 2 files changed, 109 insertions(+), 6 deletions(-)
drivers/misc/habanalabs/include/common/cpucp_if.h +86 -6
@@ -98,6 +98,18 @@ struct hl_eq_fw_alive {__u8 pad[7 ]; }; +enum hl_pcie_addr_dec_cause { +PCIE_ADDR_DEC_HBW_ERR_RESP , +PCIE_ADDR_DEC_LBW_ERR_RESP , +PCIE_ADDR_DEC_TLP_BLOCKED_BY_RR +}; + +struct hl_eq_pcie_addr_dec_data { +/* enum hl_pcie_addr_dec_cause */ +__u8 addr_dec_cause; +__u8 pad[7 ]; +}; +struct hl_eq_entry {struct hl_eq_header hdr;union {
@@ -106,6 +118,7 @@ struct hl_eq_entry {struct hl_eq_sm_sei_data sm_sei_data;struct cpucp_pkt_sync_err pkt_sync_err;struct hl_eq_fw_alive fw_alive; +struct hl_eq_pcie_addr_dec_data pcie_addr_dec_data;__le64 data[7 ]; }; };
@@ -116,7 +129,7 @@ struct hl_eq_entry {#define EQ_CTL_READY_MASK 0x80000000#define EQ_CTL_EVENT_TYPE_SHIFT 16 -#define EQ_CTL_EVENT_TYPE_MASK 0x03FF0000 +#define EQ_CTL_EVENT_TYPE_MASK 0x0FFF0000#define EQ_CTL_INDEX_SHIFT 0#define EQ_CTL_INDEX_MASK 0x0000FFFF
@@ -300,7 +313,7 @@ enum pq_init_status {* The packet's arguments specify the desired sensor and the field to * set. * -* CPUCP_PACKET_PCIE_THROUGHPUT_GET +* CPUCP_PACKET_PCIE_THROUGHPUT_GET - * Get throughput of PCIe. * The packet's arguments specify the transaction direction (TX/RX). * The window measurement is 10[msec], and the return value is in KB/sec.
@@ -309,19 +322,19 @@ enum pq_init_status {* Replay count measures number of "replay" events, which is basicly * number of retries done by PCIe. * -* CPUCP_PACKET_TOTAL_ENERGY_GET +* CPUCP_PACKET_TOTAL_ENERGY_GET - * Total Energy is measurement of energy from the time FW Linux * is loaded. It is calculated by multiplying the average power * by time (passed from armcp start). The units are in MilliJouls. * -* CPUCP_PACKET_PLL_INFO_GET +* CPUCP_PACKET_PLL_INFO_GET - * Fetch frequencies of PLL from the required PLL IP. * The packet's arguments specify the device PLL type * Pll type is the PLL from device pll_index enum. * The result is composed of 4 outputs, each is 16-bit * frequency in MHz. * -* CPUCP_PACKET_POWER_GET +* CPUCP_PACKET_POWER_GET - * Fetch the present power consumption of the device (Current * Voltage). * * CPUCP_PACKET_NIC_PFC_SET -
@@ -345,6 +358,24 @@ enum pq_init_status {* CPUCP_PACKET_MSI_INFO_SET - * set the index number for each supported msi type going from * host to device +* +* CPUCP_PACKET_NIC_XPCS91_REGS_GET - +* Fetch the un/correctable counters values from the NIC MAC. +* +* CPUCP_PACKET_NIC_STAT_REGS_GET - +* Fetch various NIC MAC counters from the NIC STAT. +* +* CPUCP_PACKET_NIC_STAT_REGS_CLR - +* Clear the various NIC MAC counters in the NIC STAT. +* +* CPUCP_PACKET_NIC_STAT_REGS_ALL_GET - +* Fetch all NIC MAC counters from the NIC STAT. +* +* CPUCP_PACKET_IS_IDLE_CHECK - +* Check if the device is IDLE in regard to the DMA/compute engines +* and QMANs. The f/w will return a bitmask where each bit represents +* a different engine or QMAN according to enum cpucp_idle_mask. +* The bit will be 1 if the engine is NOT idle. */ enum cpucp_packet_id {
@@ -385,6 +416,11 @@ enum cpucp_packet_id {CPUCP_PACKET_NIC_LPBK_SET ,/* internal */ CPUCP_PACKET_NIC_MAC_CFG ,/* internal */ CPUCP_PACKET_MSI_INFO_SET ,/* internal */ +CPUCP_PACKET_NIC_XPCS91_REGS_GET ,/* internal */ +CPUCP_PACKET_NIC_STAT_REGS_GET ,/* internal */ +CPUCP_PACKET_NIC_STAT_REGS_CLR ,/* internal */ +CPUCP_PACKET_NIC_STAT_REGS_ALL_GET ,/* internal */ + CPUCP_PACKET_IS_IDLE_CHECK, /* internal */ };#define CPUCP_PACKET_FENCE_VAL 0xFE8CE7A5
@@ -414,6 +450,11 @@ enum cpucp_packet_id {#define CPUCP_PKT_VAL_LPBK_IN2_SHIFT 1#define CPUCP_PKT_VAL_LPBK_IN2_MASK 0x000000000000001Eull +#define CPUCP_PKT_VAL_MAC_CNT_IN1_SHIFT 0 +#define CPUCP_PKT_VAL_MAC_CNT_IN1_MASK 0x0000000000000001ull +#define CPUCP_PKT_VAL_MAC_CNT_IN2_SHIFT 1 +#define CPUCP_PKT_VAL_MAC_CNT_IN2_MASK 0x00000000FFFFFFFEull +/* heartbeat status bits */ #define CPUCP_PKT_HB_STATUS_EQ_FAULT_SHIFT 0#define CPUCP_PKT_HB_STATUS_EQ_FAULT_MASK 0x00000001
@@ -467,7 +508,8 @@ struct cpucp_packet {__le32 status_mask; }; -__le32 reserved; +/* For NIC requests */ +__le32 port_index; };struct cpucp_unmask_irq_arr_packet {
@@ -476,6 +518,12 @@ struct cpucp_unmask_irq_arr_packet {__le32 irqs[0 ]; }; +struct cpucp_nic_status_packet { +struct cpucp_packet cpucp_pkt; +__le32 length; +__le32 data[0 ]; +}; +struct cpucp_array_data_packet {struct cpucp_packet cpucp_pkt;__le32 length;
@@ -721,4 +769,36 @@ struct cpucp_nic_info { __u8 reserved[6]; }; +/* +* struct cpucp_nic_status - describes the status of a NIC port. +* @port: NIC port index. +* @bad_format_cnt: e.g. CRC. +* @responder_out_of_sequence_psn_cnt: e.g NAK. +* @high_ber_reinit_cnt: link reinit due to high BER. +* @correctable_err_cnt: e.g. bit-flip. +* @uncorrectable_err_cnt: e.g. MAC errors. +* @retraining_cnt: re-training counter. +* @up: is port up. +* @pcs_link: has PCS link. +* @phy_ready: is PHY ready. +* @auto_neg: is Autoneg enabled. +* @timeout_retransmission_cnt: timeout retransmission events +* @high_ber_cnt: high ber events +*/ +struct cpucp_nic_status { +__le32 port; +__le32 bad_format_cnt; +__le32 responder_out_of_sequence_psn_cnt; +__le32 high_ber_reinit; +__le32 correctable_err_cnt; +__le32 uncorrectable_err_cnt; +__le32 retraining_cnt; +__u8 up; +__u8 pcs_link; +__u8 phy_ready; +__u8 auto_neg; +__le32 timeout_retransmission_cnt; +__le32 high_ber_cnt; +}; +#endif /* CPUCP_IF_H */
drivers/misc/habanalabs/include/common/hl_boot_if.h +23 -0
@@ -210,6 +210,10 @@* configured and is ready for use. * Initialized in: ppboot * +* CPU_BOOT_DEV_STS0_FW_NIC_MAC_EN NIC MAC channels init is done by FW and +* any access to them is done via the FW. +* Initialized in: linux +* * CPU_BOOT_DEV_STS0_DYN_PLL_EN Dynamic PLL configuration is enabled. * FW sends to host a bitmap of supported * PLLs.
@@ -233,6 +237,21 @@* prevent IRQs overriding each other. * Initialized in: linux * +* CPU_BOOT_DEV_STS0_FW_NIC_STAT_XPCS91_EN +* NIC STAT and XPCS91 access is restricted +* and is done via FW only. +* Initialized in: linux +* +* CPU_BOOT_DEV_STS0_FW_NIC_STAT_EXT_EN +* NIC STAT get all is supported. +* Initialized in: linux +* +* CPU_BOOT_DEV_STS0_IS_IDLE_CHECK_EN +* F/W checks if the device is idle by reading defined set +* of registers. It returns a bitmask of all the engines, +* where a bit is set if the engine is not idle. +* Initialized in: linux +* * CPU_BOOT_DEV_STS0_ENABLED Device status register enabled. * This is a main indication that the * running FW populates the device status
@@ -260,10 +279,14 @@#define CPU_BOOT_DEV_STS0_PKT_PI_ACK_EN (1 << 15)#define CPU_BOOT_DEV_STS0_FW_LD_COM_EN (1 << 16)#define CPU_BOOT_DEV_STS0_FW_IATU_CONF_EN (1 << 17) +#define CPU_BOOT_DEV_STS0_FW_NIC_MAC_EN (1 << 18)#define CPU_BOOT_DEV_STS0_DYN_PLL_EN (1 << 19)#define CPU_BOOT_DEV_STS0_GIC_PRIVILEGED_EN (1 << 20)#define CPU_BOOT_DEV_STS0_EQ_INDEX_EN (1 << 21)#define CPU_BOOT_DEV_STS0_MULTI_IRQ_POLL_EN (1 << 22) +#define CPU_BOOT_DEV_STS0_FW_NIC_STAT_XPCS91_EN (1 << 23) +#define CPU_BOOT_DEV_STS0_FW_NIC_STAT_EXT_EN (1 << 24) +#define CPU_BOOT_DEV_STS0_IS_IDLE_CHECK_EN (1 << 25)#define CPU_BOOT_DEV_STS0_ENABLED (1 << 31)#define CPU_BOOT_DEV_STS1_ENABLED (1 << 31)
Signature · 1 line
2.17.1
PATCH 7/16 habanalabs/gaudi: increase boot fit timeout
In reply to Oded GabbayVarious f/w versions have different timeouts, so increase the default timeout to accommodate all the options.
--- drivers/misc/habanalabs/common/firmware_if.c | 4 ++++ drivers/misc/habanalabs/gaudi/gaudi.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-)
drivers/misc/habanalabs/common/firmware_if.c +4 -0
@@ -1062,6 +1062,10 @@ static void detect_cpu_boot_status(struct hl_device *hdev, u32 status)dev_err (hdev->dev,"Device boot progress - Thermal Sensor initialization failed\n" );break ; +case CPU_BOOT_STATUS_SECURITY_READY : +dev_err (hdev->dev, +"Device boot progress - Stuck in preboot after security initialization\n" ); +break ;default : dev_err(hdev->dev, "Device boot progress - Invalid status code %d\n",
drivers/misc/habanalabs/gaudi/gaudi.c +1 -1
@@ -76,7 +76,7 @@#define GAUDI_PLDM_MMU_TIMEOUT_USEC (MMU_CONFIG_TIMEOUT_USEC * 100)#define GAUDI_PLDM_QMAN0_TIMEOUT_USEC (HL_DEVICE_TIMEOUT_USEC * 30)#define GAUDI_PLDM_TPC_KERNEL_WAIT_USEC (HL_DEVICE_TIMEOUT_USEC * 30) -#define GAUDI_BOOT_FIT_REQ_TIMEOUT_USEC 1000000/* 1s */ +#define GAUDI_BOOT_FIT_REQ_TIMEOUT_USEC 4000000/* 4s */ #define GAUDI_MSG_TO_CPU_TIMEOUT_USEC 4000000/* 4s */ #define GAUDI_WAIT_FOR_BL_TIMEOUT_USEC 15000000/* 15s */
Signature · 1 line
2.17.1
PATCH 8/16 habanalabs/gaudi: restore user registers when context opens
In reply to Oded GabbayBecause we don't have multiple contexts in GAUDI, and to minimize calls to is_idle function (which uses many register reads), move the call to clear the user registers to the opening of the single user context.
--- drivers/misc/habanalabs/gaudi/gaudi.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
drivers/misc/habanalabs/gaudi/gaudi.c +12 -2
@@ -6088,7 +6088,7 @@ static int gaudi_restore_user_registers(struct hl_device *hdev)static int gaudi_context_switch (struct hl_device *hdev,u32 asid) { -return gaudi_restore_user_registers (hdev); +return 0 ; }static int gaudi_mmu_clear_pgt_range (struct hl_device *hdev)
@@ -8658,10 +8658,20 @@ static void gaudi_internal_cb_pool_fini(struct hl_device *hdev,static int gaudi_ctx_init (struct hl_ctx *ctx) { +int rc; +if (ctx->asid ==HL_KERNEL_ASID_ID )return 0 ; -return gaudi_internal_cb_pool_init (ctx->hdev, ctx); + rc =gaudi_internal_cb_pool_init (ctx->hdev, ctx); +if (rc) +return rc; + + rc =gaudi_restore_user_registers (ctx->hdev); +if (rc) +gaudi_internal_cb_pool_fini (ctx->hdev, ctx); + +return rc; }static void gaudi_ctx_fini (struct hl_ctx *ctx)
Signature · 1 line
2.17.1
PATCH 9/16 habanalabs/gaudi: add monitored SOBs to state dump
In reply to Oded GabbayFrom: Alon Mizrahi <[email protected]>
Current "state dump" is lacking of monitored SOB IDs. Add for convenience.
--- drivers/misc/habanalabs/gaudi/gaudi.c | 38 ++++++++++++++++++++++++-- drivers/misc/habanalabs/gaudi/gaudiP.h | 1 + 2 files changed, 37 insertions(+), 2 deletions(-)
drivers/misc/habanalabs/gaudi/gaudi.c +36 -2
@@ -108,6 +108,8 @@#define BIN_REG_STRING_SIZE sizeof("0b10101010101010101010101010101010") +#define MONITOR_SOB_STRING_SIZE 256 +static const char gaudi_irq_name[GAUDI_MSI_ENTRIES ][GAUDI_MAX_STRING_LEN ] = {"gaudi cq 0_0" ,"gaudi cq 0_1" ,"gaudi cq 0_2" ,"gaudi cq 0_3" ,"gaudi cq 1_0" ,"gaudi cq 1_1" ,"gaudi cq 1_2" ,"gaudi cq 1_3" ,
@@ -9185,6 +9187,34 @@ static int gaudi_monitor_valid(struct hl_mon_state_dump *mon) mon->status); } +static void gaudi_fill_sobs_from_mon (char *sobs,struct hl_mon_state_dump *mon) +{ +const size_t max_write =10 ; +u32 gid, mask, sob; +int i, offset; + +/* Sync object ID is calculated as follows: +* (8 * group_id + cleared bits in mask) +*/ + gid =FIELD_GET (SYNC_MNGR_W_S_SYNC_MNGR_OBJS_MON_ARM_0_SID_MASK , + mon->arm_data); + mask =FIELD_GET (SYNC_MNGR_W_S_SYNC_MNGR_OBJS_MON_ARM_0_MASK_MASK , + mon->arm_data); + +for (i =0 , offset =0 ; mask && offset <MONITOR_SOB_STRING_SIZE - + max_write; mask >>=1 , i++) { +if (!(mask &1 )) { + sob = gid *MONITOR_MAX_SOBS + i; + +if (offset >0 ) + offset +=snprintf (sobs + offset, max_write, +", " ); + + offset +=snprintf (sobs + offset, max_write,"%u" , sob); + } + } +} +static int gaudi_print_single_monitor (char **buf,size_t *size,size_t *offset,struct hl_device *hdev,struct hl_mon_state_dump *mon)
@@ -9192,14 +9222,17 @@ static int gaudi_print_single_monitor(char **buf, size_t *size, size_t *offset,const char *name;char scratch_buf1[BIN_REG_STRING_SIZE ], scratch_buf2[BIN_REG_STRING_SIZE ]; +char monitored_sobs[MONITOR_SOB_STRING_SIZE ] = {0 }; name =hl_state_dump_get_monitor_name (hdev, mon);if (!name) name ="" ; +gaudi_fill_sobs_from_mon (monitored_sobs, mon); + return hl_snprintf_resize( buf, size, offset, - "Mon id: %u%s, wait for group id: %u mask %s to reach val: %u and write %u to address 0x%llx. Pending: %s", + "Mon id: %u%s, wait for group id: %u mask %s to reach val: %u and write %u to address 0x%llx. Pending: %s. Means sync objects [%s] are being monitored.", mon->id, name, FIELD_GET(SYNC_MNGR_W_S_SYNC_MNGR_OBJS_MON_ARM_0_SID_MASK, mon->arm_data),
@@ -9216,7 +9249,8 @@ static int gaudi_print_single_monitor(char **buf, size_t *size, size_t *offset, scratch_buf2,sizeof (scratch_buf2),FIELD_GET (SYNC_MNGR_W_S_SYNC_MNGR_OBJS_MON_STATUS_0_PENDING_MASK , - mon->status))); + mon->status)), + monitored_sobs); }
drivers/misc/habanalabs/gaudi/gaudiP.h +1 -0
@@ -117,6 +117,7 @@ (((mmSYNC_MNGR_E_N_SYNC_MNGR_OBJS_MON_STATUS_511 - \ mmSYNC_MNGR_E_N_SYNC_MNGR_OBJS_MON_STATUS_0) + 4) >> 2) +#define MONITOR_MAX_SOBS 8/* DRAM Memory Map */
Signature · 1 line
2.17.1
PATCH 10/16 habanalabs: modify multi-CS to wait on stream masters
In reply to Oded GabbayFrom: Ohad Sharabi <[email protected]>
During the integration, the multi-CS requirements were refined:
- The multi CS call shall wait on "per-ASIC" predefined stream masters instead of set of streams.
- Stream masters are set of QIDs used by the upper SW layers (synapse) for completion (must be an external/HW queue).
--- .../habanalabs/common/command_submission.c | 50 ++++++++++++------- drivers/misc/habanalabs/common/habanalabs.h | 22 ++++---- drivers/misc/habanalabs/common/hw_queue.c | 3 +- drivers/misc/habanalabs/gaudi/gaudi.c | 22 +++++++- drivers/misc/habanalabs/gaudi/gaudiP.h | 2 + drivers/misc/habanalabs/goya/goya.c | 6 +++ 6 files changed, 77 insertions(+), 28 deletions(-)
drivers/misc/habanalabs/common/command_submission.c +33 -17
@@ -487,14 +487,15 @@ static void force_complete_multi_cs(struct hl_device *hdev)* * @hdev: pointer to habanalabs device structure * @cs: CS structure -* -* The function signals waiting entity that its waiting stream has common -* stream with the completed CS. +* The function signals a waiting entity that has an overlapping stream masters +* with the completed CS. * For example: -* - a completed CS worked on streams 0 and 1, multi CS completion -* is actively waiting on stream 3. don't send signal as no common stream -* - a completed CS worked on streams 0 and 1, multi CS completion -* is actively waiting on streams 1 and 3. send signal as stream 1 is common +* - a completed CS worked on stream master QID 4, multi CS completion +* is actively waiting on stream master QIDs 3, 5. don't send signal as no +* common stream master QID +* - a completed CS worked on stream master QID 4, multi CS completion +* is actively waiting on stream master QIDs 3, 4. send signal as stream +* master QID 4 is common */ static void complete_multi_cs (struct hl_device *hdev,struct hl_cs *cs) {
@@ -518,10 +519,11 @@ static void complete_multi_cs(struct hl_device *hdev, struct hl_cs *cs)* complete if: * 1. still waiting for completion * 2. the completed CS has at least one overlapping stream -* with the streams in the completion +* master with the stream masters in the completion */ if (mcs_compl->used && - (fence->stream_map & mcs_compl->stream_map)) { + (fence->stream_master_qid_map & + mcs_compl->stream_master_qid_map)) {/* extract the timestamp only of first completed CS */ if (!mcs_compl->timestamp) mcs_compl->timestamp =
@@ -1228,6 +1230,17 @@ static int cs_staged_submission(struct hl_device *hdev, struct hl_cs *cs,return 0 ; } +static u32 get_stream_master_qid_mask (struct hl_device *hdev,u32 qid) +{ +int i; + +for (i =0 ; i < hdev->stream_master_qid_arr_size; i++) +if (qid == hdev->stream_master_qid_arr[i]) +return BIT (i); + +return 0 ; +} +static int cs_ioctl_default (struct hl_fpriv *hpriv,void __user *chunks,u32 num_chunks,u64 *cs_seq,u32 flags,u32 encaps_signals_handle,u32 timeout)
@@ -1241,7 +1254,7 @@ static int cs_ioctl_default(struct hl_fpriv *hpriv, void __user *chunks,struct hl_cs *cs;struct hl_cb *cb;u64 user_sequence; -u8 stream_map =0 ; +u8 stream_master_qid_map =0 ;int rc, i; cntr = &hdev->aggregated_cs_counters;
@@ -1310,7 +1323,9 @@ static int cs_ioctl_default(struct hl_fpriv *hpriv, void __user *chunks,* queues of this CS */ if (hdev->supports_wait_for_multi_cs) - stream_map |=BIT ((chunk->queue_index %4 )); + stream_master_qid_map |= +get_stream_master_qid_mask (hdev, + chunk->queue_index); } job = hl_cs_allocate_job(hdev, queue_type,
@@ -1378,7 +1393,7 @@ static int cs_ioctl_default(struct hl_fpriv *hpriv, void __user *chunks,* fence object for multi-CS completion */ if (hdev->supports_wait_for_multi_cs) - cs->fence->stream_map = stream_map; + cs->fence->stream_master_qid_map = stream_master_qid_map; rc =hl_hw_queue_schedule_cs (cs);if (rc) {
@@ -2332,7 +2347,7 @@ static int hl_cs_poll_fences(struct multi_cs_data *mcs_data)break ; } - mcs_data->stream_map |= fence->stream_map; + mcs_data->stream_master_qid_map |= fence->stream_master_qid_map;if (status ==CS_WAIT_STATUS_BUSY )continue ;
@@ -2394,7 +2409,8 @@ static int _hl_cs_wait_ioctl(struct hl_device *hdev, struct hl_ctx *ctx,* hl_wait_multi_cs_completion_init - init completion structure * * @hdev: pointer to habanalabs device structure -* @stream_map: stream map, set bit indicates stream to wait on +* @stream_master_bitmap: stream master QIDs map, set bit indicates stream +* master QID to wait on * * @return valid completion struct pointer on success, otherwise error pointer *
@@ -2404,7 +2420,7 @@ static int _hl_cs_wait_ioctl(struct hl_device *hdev, struct hl_ctx *ctx,*/ static struct multi_cs_completion *hl_wait_multi_cs_completion_init (struct hl_device *hdev, -u8 stream_map) +u8 stream_master_bitmap) {struct multi_cs_completion *mcs_compl;int i;
@@ -2416,7 +2432,7 @@ static struct multi_cs_completion *hl_wait_multi_cs_completion_init(if (!mcs_compl->used) { mcs_compl->used =1 ; mcs_compl->timestamp =0 ; - mcs_compl->stream_map = stream_map; + mcs_compl->stream_master_qid_map = stream_master_bitmap;reinit_completion (&mcs_compl->completion);spin_unlock (&mcs_compl->lock);break ;
@@ -2464,7 +2480,7 @@ static int hl_wait_multi_cs_completion(struct multi_cs_data *mcs_data)long completion_rc; mcs_compl =hl_wait_multi_cs_completion_init (hdev, - mcs_data->stream_map); + mcs_data->stream_master_qid_map);if (IS_ERR (mcs_compl))return PTR_ERR (mcs_compl);
drivers/misc/habanalabs/common/habanalabs.h +13 -9
@@ -593,18 +593,18 @@ struct asic_fixed_properties {* @completion: fence is implemented using completion * @refcount: refcount for this fence * @cs_sequence: sequence of the corresponding command submission +* @stream_master_qid_map: streams masters QID bitmap to represent all streams +* masters QIDs that multi cs is waiting on * @error: mark this fence with error * @timestamp: timestamp upon completion -* @stream_map: streams bitmap to represent all streams that multi cs is -* waiting on */ struct hl_fence {struct completion completion;struct kref refcount;u64 cs_sequence; +u32 stream_master_qid_map;int error;ktime_t timestamp; -u8 stream_map; };/**
@@ -1161,6 +1161,7 @@ struct fw_load_mgr {* @state_dump_init: initialize constants required for state dump * @get_sob_addr: get SOB base address offset. * @set_pci_memory_regions: setting properties of PCI memory regions +* @get_stream_master_qid_arr: get pointer to stream masters QID array */ struct hl_asic_funcs {int (*early_init)(struct hl_device *hdev);
@@ -1290,6 +1291,7 @@ struct hl_asic_funcs {void (*state_dump_init)(struct hl_device *hdev);u32 (*get_sob_addr)(struct hl_device *hdev,u32 sob_id);void (*set_pci_memory_regions)(struct hl_device *hdev); + u32* (*get_stream_master_qid_arr)(void); };
@@ -2283,16 +2285,16 @@ struct hl_mmu_funcs {* @completion: completion of any of the CS in the list * @lock: spinlock for the completion structure * @timestamp: timestamp for the multi-CS completion +* @stream_master_qid_map: bitmap of all stream masters on which the multi-CS +* is waiting * @used: 1 if in use, otherwise 0 -* @stream_map: bitmap of all HW/external queues streams on which the multi-CS -* is waiting */ struct multi_cs_completion {struct completion completion;spinlock_t lock;s64 timestamp; +u32 stream_master_qid_map;u8 used; -u8 stream_map; };/**
@@ -2304,9 +2306,9 @@ struct multi_cs_completion {* @timestamp: timestamp of first completed CS * @wait_status: wait for CS status * @completion_bitmap: bitmap of completed CSs (1- completed, otherwise 0) +* @stream_master_qid_map: bitmap of all stream master QIDs on which the +* multi-CS is waiting * @arr_len: fence_arr and seq_arr array length -* @stream_map: bitmap of all HW/external queues streams on which the multi-CS -* is waiting * @gone_cs: indication of gone CS (1- there was gone CS, otherwise 0) * @update_ts: update timestamp. 1- update the timestamp, otherwise 0. */
@@ -2318,8 +2320,8 @@ struct multi_cs_data {s64 timestamp;long wait_status;u32 completion_bitmap; +u32 stream_master_qid_map;u8 arr_len; -u8 stream_map;u8 gone_cs;u8 update_ts; };
@@ -2541,6 +2543,7 @@ struct hl_device {struct multi_cs_completion multi_cs_completion[MULTI_CS_MAX_USER_CTX ]; +u32 *stream_master_qid_arr;atomic64_t dram_used_mem;u64 timeout_jiffies;u64 max_power;
@@ -2592,6 +2595,7 @@ struct hl_device {u8 skip_reset_on_timeout;u8 device_cpu_is_halted;u8 supports_wait_for_multi_cs; +u8 stream_master_qid_arr_size;/* Parameters for bring-up */ u64 nic_ports_mask;
drivers/misc/habanalabs/common/hw_queue.c +2 -1
@@ -721,7 +721,8 @@ int hl_hw_queue_schedule_cs(struct hl_cs *cs)/* update stream map of the first CS */ if (hdev->supports_wait_for_multi_cs) - staged_cs->fence->stream_map |= cs->fence->stream_map; + staged_cs->fence->stream_master_qid_map |= + cs->fence->stream_master_qid_map; }list_add_tail (&cs->mirror_node, &hdev->cs_mirror_list);
drivers/misc/habanalabs/gaudi/gaudi.c +21 -1
@@ -110,6 +110,17 @@#define MONITOR_SOB_STRING_SIZE 256 +static u32 gaudi_stream_master[GAUDI_STREAM_MASTER_ARR_SIZE ] = { +GAUDI_QUEUE_ID_DMA_0_0 , +GAUDI_QUEUE_ID_DMA_0_1 , +GAUDI_QUEUE_ID_DMA_0_2 , +GAUDI_QUEUE_ID_DMA_0_3 , +GAUDI_QUEUE_ID_DMA_1_0 , +GAUDI_QUEUE_ID_DMA_1_1 , +GAUDI_QUEUE_ID_DMA_1_2 , +GAUDI_QUEUE_ID_DMA_1_3 +}; +static const char gaudi_irq_name[GAUDI_MSI_ENTRIES ][GAUDI_MAX_STRING_LEN ] = {"gaudi cq 0_0" ,"gaudi cq 0_1" ,"gaudi cq 0_2" ,"gaudi cq 0_3" ,"gaudi cq 1_0" ,"gaudi cq 1_1" ,"gaudi cq 1_2" ,"gaudi cq 1_3" ,
@@ -1871,6 +1882,9 @@ static int gaudi_sw_init(struct hl_device *hdev) hdev->supports_wait_for_multi_cs = true; hdev->asic_funcs->set_pci_memory_regions (hdev); + hdev->stream_master_qid_arr = + hdev->asic_funcs->get_stream_master_qid_arr (); + hdev->stream_master_qid_arr_size =GAUDI_STREAM_MASTER_ARR_SIZE ;return 0 ;
@@ -9353,6 +9367,11 @@ static void gaudi_state_dump_init(struct hl_device *hdev) sds->funcs = gaudi_state_dump_funcs; } +static u32 *gaudi_get_stream_master_qid_arr (void ) +{ +return gaudi_stream_master; +} +static const struct hl_asic_funcs gaudi_funcs = { .early_init = gaudi_early_init, .early_fini = gaudi_early_fini,
@@ -9441,7 +9460,8 @@ static const struct hl_asic_funcs gaudi_funcs = { .init_cpu_scrambler_dram = gaudi_init_scrambler_hbm, .state_dump_init = gaudi_state_dump_init, .get_sob_addr = gaudi_get_sob_addr, - .set_pci_memory_regions = gaudi_set_pci_memory_regions + .set_pci_memory_regions = gaudi_set_pci_memory_regions, + .get_stream_master_qid_arr = gaudi_get_stream_master_qid_arr };/**
drivers/misc/habanalabs/gaudi/gaudiP.h +2 -0
@@ -36,6 +36,8 @@#define NUMBER_OF_INTERRUPTS (NUMBER_OF_CMPLT_QUEUES + \ NUMBER_OF_CPU_HW_QUEUES) +#define GAUDI_STREAM_MASTER_ARR_SIZE 8 +#if (NUMBER_OF_INTERRUPTS >GAUDI_MSI_ENTRIES )#error "Number of MSI interrupts must be smaller or equal to GAUDI_MSI_ENTRIES"#endif
drivers/misc/habanalabs/goya/goya.c +6 -0
@@ -5589,6 +5589,11 @@ static u32 goya_get_sob_addr(struct hl_device *hdev, u32 sob_id)return 0 ; } +static u32 *goya_get_stream_master_qid_arr (void ) +{ +return NULL ; +} +static const struct hl_asic_funcs goya_funcs = { .early_init = goya_early_init, .early_fini = goya_early_fini,
@@ -5678,6 +5683,7 @@ static const struct hl_asic_funcs goya_funcs = { .state_dump_init = goya_state_dump_init, .get_sob_addr = &goya_get_sob_addr, .set_pci_memory_regions = goya_set_pci_memory_regions, + .get_stream_master_qid_arr = goya_get_stream_master_qid_arr, };/*
Signature · 1 line
2.17.1
PATCH 11/16 habanalabs/gaudi: fetch TPC/MME ECC errors from F/W
In reply to Oded GabbayFrom: Ofir Bitton <[email protected]>
In case F/W security is enabled driver cannot access ECC registers, hence driver must fetch the ECC info from F/W.
--- drivers/misc/habanalabs/gaudi/gaudi.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/misc/habanalabs/gaudi/gaudi.c +6 -0
@@ -7458,6 +7458,11 @@ static void gaudi_handle_ecc_event(struct hl_device *hdev, u16 event_type,bool extract_info_from_fw;int rc; +if (hdev->asic_prop.fw_security_enabled) { + extract_info_from_fw = true; + goto extract_ecc_info; + } +switch (event_type) { case GAUDI_EVENT_PCIE_CORE_SERR ... GAUDI_EVENT_PCIE_PHY_DERR: case GAUDI_EVENT_DMA0_SERR_ECC ... GAUDI_EVENT_MMU_DERR:
@@ -7530,6 +7535,7 @@ static void gaudi_handle_ecc_event(struct hl_device *hdev, u16 event_type,return ; } +extract_ecc_info:if (extract_info_from_fw) { ecc_address =le64_to_cpu (ecc_data->ecc_address); ecc_syndrom =le64_to_cpu (ecc_data->ecc_syndrom);
Signature · 1 line
2.17.1
PATCH 12/16 habanalabs: add userptr_lookup node in debugfs
In reply to Oded GabbayFrom: Yuri Nudelman <[email protected]>
It is useful to have the ability to see which user address was pinned to which physical address during the initial mapping. We already have all that info stored, but no means to search this data (which may be quite large).
--- .../ABI/testing/debugfs-driver-habanalabs | 8 +++ drivers/misc/habanalabs/common/debugfs.c | 72 +++++++++++++++++++ drivers/misc/habanalabs/common/habanalabs.h | 19 +++++ drivers/misc/habanalabs/common/memory.c | 21 +----- 4 files changed, 101 insertions(+), 19 deletions(-)
Documentation/ABI/testing/debugfs-driver-habanalabs +8 -0
@@ -241,6 +241,14 @@ Description: Displays a list with information about the currently user pointers (user virtual addresses) that are pinned and mapped to DMA addresses +What: /sys/kernel/debug/habanalabs/hl<n>/userptr_lookup +Date: Aug 2021 +KernelVersion: 5.15 +Contact: [email protected] +Description: Allows to search for specific user pointers (user virtual + addresses) that are pinned and mapped to DMA addresses, and see + their resolution to the specific dma address. + What: /sys/kernel/debug/habanalabs/hl<n>/vm Date: Jan 2019 KernelVersion: 5.1
drivers/misc/habanalabs/common/debugfs.c +72 -0
84 lines not on this page · raw message
drivers/misc/habanalabs/common/habanalabs.h +19 -0
@@ -1836,6 +1836,7 @@ struct hl_debugfs_entry {* @state_dump_sem: protects state_dump. * @addr: next address to read/write from/to in read/write32. * @mmu_addr: next virtual address to translate to physical address in mmu_show. +* @userptr_lookup: the target user ptr to look up for on demand. * @mmu_asid: ASID to use while translating in mmu_show. * @state_dump_head: index of the latest state dump * @i2c_bus: generic u8 debugfs file for bus value to use in i2c_data_read.
@@ -1863,6 +1864,7 @@ struct hl_dbg_device_entry {struct rw_semaphore state_dump_sem;u64 addr;u64 mmu_addr; +u64 userptr_lookup;u32 mmu_asid;u32 state_dump_head;u8 i2c_bus;
@@ -2669,6 +2671,23 @@ struct hl_ioctl_desc {* Kernel module functions that can be accessed by entire module */ +/** +* hl_get_sg_info() - get number of pages and the DMA address from SG list. +* @sg: the SG list. +* @dma_addr: pointer to DMA address to return. +* +* Calculate the number of consecutive pages described by the SG list. Take the +* offset of the address in the first page, add to it the length and round it up +* to the number of needed pages. +*/ +static inline u32 hl_get_sg_info (struct scatterlist *sg,dma_addr_t *dma_addr) +{ + *dma_addr =sg_dma_address (sg); + +return ((((*dma_addr) & (PAGE_SIZE -1 )) +sg_dma_len (sg)) + + (PAGE_SIZE -1 )) >>PAGE_SHIFT ; +} +/** * hl_mem_area_inside_range() - Checks whether address+size are inside a range. * @address: The start address of the area we want to validate.
drivers/misc/habanalabs/common/memory.c +2 -19
@@ -805,23 +805,6 @@ int hl_unreserve_va_block(struct hl_device *hdev, struct hl_ctx *ctx,return rc; } -/** -* get_sg_info() - get number of pages and the DMA address from SG list. -* @sg: the SG list. -* @dma_addr: pointer to DMA address to return. -* -* Calculate the number of consecutive pages described by the SG list. Take the -* offset of the address in the first page, add to it the length and round it up -* to the number of needed pages. -*/ -static u32 get_sg_info (struct scatterlist *sg,dma_addr_t *dma_addr) -{ - *dma_addr =sg_dma_address (sg); - -return ((((*dma_addr) & (PAGE_SIZE -1 )) +sg_dma_len (sg)) + - (PAGE_SIZE -1 )) >>PAGE_SHIFT ; -} -/** * init_phys_pg_pack_from_userptr() - initialize physical page pack from host * memory
@@ -872,7 +855,7 @@ static int init_phys_pg_pack_from_userptr(struct hl_ctx *ctx,*/ total_npages =0 ;for_each_sg (userptr->sgt->sgl, sg, userptr->sgt->nents, i) { - npages =get_sg_info (sg, &dma_addr); + npages =hl_get_sg_info (sg, &dma_addr); total_npages += npages;
@@ -901,7 +884,7 @@ static int init_phys_pg_pack_from_userptr(struct hl_ctx *ctx, j =0 ;for_each_sg (userptr->sgt->sgl, sg, userptr->sgt->nents, i) { - npages =get_sg_info (sg, &dma_addr); + npages =hl_get_sg_info (sg, &dma_addr);/* align down to physical page size and save the offset */ if (first) {
Signature · 1 line
2.17.1
PATCH 13/16 habanalabs/gaudi: unmask out of bounds SLM access interrupt
In reply to Oded GabbayFrom: Tomer Tayar <[email protected]>
The out of bounds SLM access TPC interrupt indicates a severe compiler bug and needs to be informed to user.
This interrupt is currently masked so unmask it.
--- drivers/misc/habanalabs/gaudi/gaudi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/misc/habanalabs/gaudi/gaudi.c +1 -1
@@ -2686,7 +2686,7 @@ static void gaudi_init_golden_registers(struct hl_device *hdev) tpc_id <TPC_NUMBER_OF_ENGINES ; tpc_id++, tpc_offset += TPC_CFG_OFFSET) {/* Mask all arithmetic interrupts from TPC */ -WREG32 (mmTPC0_CFG_TPC_INTR_MASK + tpc_offset,0x8FFF ); +WREG32 (mmTPC0_CFG_TPC_INTR_MASK + tpc_offset,0x8FFE );/* Set 16 cache lines */ WREG32_FIELD (TPC0_CFG_MSS_CONFIG , tpc_offset,ICACHE_FETCH_LINE_NUM ,2 );
Signature · 1 line
2.17.1
PATCH 14/16 habanalabs/gaudi: define DC POWER for secured PMC
In reply to Oded GabbayIn secured mode, the CGM is disabled. Therefore, the DC power is higher. Without taking it into consideration, the utilization is 12-15% at idle.
--- drivers/misc/habanalabs/gaudi/gaudi.c | 6 +++++- drivers/misc/habanalabs/gaudi/gaudiP.h | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-)
drivers/misc/habanalabs/gaudi/gaudi.c +5 -1
@@ -506,7 +506,11 @@ static inline void set_default_power_values(struct hl_device *hdev)if (hdev->card_type == cpucp_card_type_pmc) { prop->max_power_default =MAX_POWER_DEFAULT_PMC ; - prop->dc_power_default =DC_POWER_DEFAULT_PMC ; + +if (prop->fw_security_enabled) + prop->dc_power_default =DC_POWER_DEFAULT_PMC_SEC ; +else + prop->dc_power_default =DC_POWER_DEFAULT_PMC ; }else { prop->max_power_default =MAX_POWER_DEFAULT_PCI ; prop->dc_power_default =DC_POWER_DEFAULT_PCI ;
drivers/misc/habanalabs/gaudi/gaudiP.h +2 -0
@@ -52,6 +52,8 @@#define DC_POWER_DEFAULT_PCI 60000/* 60W */ #define DC_POWER_DEFAULT_PMC 60000/* 60W */ +#define DC_POWER_DEFAULT_PMC_SEC 97000/* 97W */ +#define GAUDI_CPU_TIMEOUT_USEC 30000000/* 30s */ #define TPC_ENABLED_MASK 0xFF
Signature · 1 line
2.17.1
PATCH 15/16 habanalabs/gaudi: size should be printed in decimal
In reply to Oded GabbayIt's more readable for the size to be in decimal.
--- drivers/misc/habanalabs/gaudi/gaudi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/misc/habanalabs/gaudi/gaudi.c +2 -2
@@ -7266,7 +7266,7 @@ static void gaudi_print_sw_config_stream_data(struct hl_device *hdev, u32 stream cq_ptr = (((u64 )RREG32 (cq_ptr_hi)) <<32 ) |RREG32 (cq_ptr_lo); size =RREG32 (cq_tsize); -dev_info (hdev->dev,"stop on err: stream: %u, addr: %#llx, size: %x\n" , +dev_info (hdev->dev,"stop on err: stream: %u, addr: %#llx, size: %u\n" , stream, cq_ptr, size); }
@@ -7322,7 +7322,7 @@ static void gaudi_print_last_pqes_on_err(struct hl_device *hdev, u32 qid_base, addr =le64_to_cpu (bd->ptr); -dev_info (hdev->dev,"stop on err PQE(stream %u): ci: %u, addr: %#llx, size: %x\n" , +dev_info (hdev->dev,"stop on err PQE(stream %u): ci: %u, addr: %#llx, size: %u\n" , stream, ci, addr, len);/* get previous ci, wrap if needed */
Signature · 1 line
2.17.1
PATCH 16/16 habanalabs/gaudi: invalidate PMMU mem cache on init
In reply to Oded GabbayThis must be done to clear the internal mem cache so we won't get ecc errors on the first invalidation.
--- drivers/misc/habanalabs/gaudi/gaudi.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/misc/habanalabs/gaudi/gaudi.c +3 -0
@@ -3906,6 +3906,9 @@ static int gaudi_mmu_init(struct hl_device *hdev)WREG32 (mmSTLB_CACHE_INV_BASE_39_8,MMU_CACHE_MNG_ADDR >>8 );WREG32 (mmSTLB_CACHE_INV_BASE_49_40,MMU_CACHE_MNG_ADDR >>40 ); +/* mem cache invalidation */ +WREG32 (mmSTLB_MEM_CACHE_INVALIDATION,1 ); + hdev->asic_funcs->mmu_invalidate_cache (hdev, true,0 );WREG32 (mmMMU_UP_MMU_ENABLE,1 );
Signature · 1 line
2.17.1