Skip to content

Commit c2aa713

Browse files
committed
habanalabs: update to latest firmware headers
Add 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. Signed-off-by: Oded Gabbay <[email protected]>
1 parent 1fd984f commit c2aa713

File tree

2 files changed

+121
-6
lines changed

2 files changed

+121
-6
lines changed

drivers/misc/habanalabs/include/common/cpucp_if.h

Lines changed: 98 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,18 @@ struct hl_eq_fw_alive {
9898
__u8 pad[7];
9999
};
100100

101+
enum hl_pcie_addr_dec_cause {
102+
PCIE_ADDR_DEC_HBW_ERR_RESP,
103+
PCIE_ADDR_DEC_LBW_ERR_RESP,
104+
PCIE_ADDR_DEC_TLP_BLOCKED_BY_RR
105+
};
106+
107+
struct hl_eq_pcie_addr_dec_data {
108+
/* enum hl_pcie_addr_dec_cause */
109+
__u8 addr_dec_cause;
110+
__u8 pad[7];
111+
};
112+
101113
struct hl_eq_entry {
102114
struct hl_eq_header hdr;
103115
union {
@@ -106,6 +118,7 @@ struct hl_eq_entry {
106118
struct hl_eq_sm_sei_data sm_sei_data;
107119
struct cpucp_pkt_sync_err pkt_sync_err;
108120
struct hl_eq_fw_alive fw_alive;
121+
struct hl_eq_pcie_addr_dec_data pcie_addr_dec_data;
109122
__le64 data[7];
110123
};
111124
};
@@ -116,7 +129,7 @@ struct hl_eq_entry {
116129
#define EQ_CTL_READY_MASK 0x80000000
117130

118131
#define EQ_CTL_EVENT_TYPE_SHIFT 16
119-
#define EQ_CTL_EVENT_TYPE_MASK 0x03FF0000
132+
#define EQ_CTL_EVENT_TYPE_MASK 0x0FFF0000
120133

121134
#define EQ_CTL_INDEX_SHIFT 0
122135
#define EQ_CTL_INDEX_MASK 0x0000FFFF
@@ -300,7 +313,7 @@ enum pq_init_status {
300313
* The packet's arguments specify the desired sensor and the field to
301314
* set.
302315
*
303-
* CPUCP_PACKET_PCIE_THROUGHPUT_GET
316+
* CPUCP_PACKET_PCIE_THROUGHPUT_GET -
304317
* Get throughput of PCIe.
305318
* The packet's arguments specify the transaction direction (TX/RX).
306319
* The window measurement is 10[msec], and the return value is in KB/sec.
@@ -309,19 +322,19 @@ enum pq_init_status {
309322
* Replay count measures number of "replay" events, which is basicly
310323
* number of retries done by PCIe.
311324
*
312-
* CPUCP_PACKET_TOTAL_ENERGY_GET
325+
* CPUCP_PACKET_TOTAL_ENERGY_GET -
313326
* Total Energy is measurement of energy from the time FW Linux
314327
* is loaded. It is calculated by multiplying the average power
315328
* by time (passed from armcp start). The units are in MilliJouls.
316329
*
317-
* CPUCP_PACKET_PLL_INFO_GET
330+
* CPUCP_PACKET_PLL_INFO_GET -
318331
* Fetch frequencies of PLL from the required PLL IP.
319332
* The packet's arguments specify the device PLL type
320333
* Pll type is the PLL from device pll_index enum.
321334
* The result is composed of 4 outputs, each is 16-bit
322335
* frequency in MHz.
323336
*
324-
* CPUCP_PACKET_POWER_GET
337+
* CPUCP_PACKET_POWER_GET -
325338
* Fetch the present power consumption of the device (Current * Voltage).
326339
*
327340
* CPUCP_PACKET_NIC_PFC_SET -
@@ -345,6 +358,24 @@ enum pq_init_status {
345358
* CPUCP_PACKET_MSI_INFO_SET -
346359
* set the index number for each supported msi type going from
347360
* host to device
361+
*
362+
* CPUCP_PACKET_NIC_XPCS91_REGS_GET -
363+
* Fetch the un/correctable counters values from the NIC MAC.
364+
*
365+
* CPUCP_PACKET_NIC_STAT_REGS_GET -
366+
* Fetch various NIC MAC counters from the NIC STAT.
367+
*
368+
* CPUCP_PACKET_NIC_STAT_REGS_CLR -
369+
* Clear the various NIC MAC counters in the NIC STAT.
370+
*
371+
* CPUCP_PACKET_NIC_STAT_REGS_ALL_GET -
372+
* Fetch all NIC MAC counters from the NIC STAT.
373+
*
374+
* CPUCP_PACKET_IS_IDLE_CHECK -
375+
* Check if the device is IDLE in regard to the DMA/compute engines
376+
* and QMANs. The f/w will return a bitmask where each bit represents
377+
* a different engine or QMAN according to enum cpucp_idle_mask.
378+
* The bit will be 1 if the engine is NOT idle.
348379
*/
349380

350381
enum cpucp_packet_id {
@@ -385,6 +416,11 @@ enum cpucp_packet_id {
385416
CPUCP_PACKET_NIC_LPBK_SET, /* internal */
386417
CPUCP_PACKET_NIC_MAC_CFG, /* internal */
387418
CPUCP_PACKET_MSI_INFO_SET, /* internal */
419+
CPUCP_PACKET_NIC_XPCS91_REGS_GET, /* internal */
420+
CPUCP_PACKET_NIC_STAT_REGS_GET, /* internal */
421+
CPUCP_PACKET_NIC_STAT_REGS_CLR, /* internal */
422+
CPUCP_PACKET_NIC_STAT_REGS_ALL_GET, /* internal */
423+
CPUCP_PACKET_IS_IDLE_CHECK, /* internal */
388424
};
389425

390426
#define CPUCP_PACKET_FENCE_VAL 0xFE8CE7A5
@@ -414,6 +450,11 @@ enum cpucp_packet_id {
414450
#define CPUCP_PKT_VAL_LPBK_IN2_SHIFT 1
415451
#define CPUCP_PKT_VAL_LPBK_IN2_MASK 0x000000000000001Eull
416452

453+
#define CPUCP_PKT_VAL_MAC_CNT_IN1_SHIFT 0
454+
#define CPUCP_PKT_VAL_MAC_CNT_IN1_MASK 0x0000000000000001ull
455+
#define CPUCP_PKT_VAL_MAC_CNT_IN2_SHIFT 1
456+
#define CPUCP_PKT_VAL_MAC_CNT_IN2_MASK 0x00000000FFFFFFFEull
457+
417458
/* heartbeat status bits */
418459
#define CPUCP_PKT_HB_STATUS_EQ_FAULT_SHIFT 0
419460
#define CPUCP_PKT_HB_STATUS_EQ_FAULT_MASK 0x00000001
@@ -467,7 +508,8 @@ struct cpucp_packet {
467508
__le32 status_mask;
468509
};
469510

470-
__le32 reserved;
511+
/* For NIC requests */
512+
__le32 port_index;
471513
};
472514

473515
struct cpucp_unmask_irq_arr_packet {
@@ -476,6 +518,12 @@ struct cpucp_unmask_irq_arr_packet {
476518
__le32 irqs[0];
477519
};
478520

521+
struct cpucp_nic_status_packet {
522+
struct cpucp_packet cpucp_pkt;
523+
__le32 length;
524+
__le32 data[0];
525+
};
526+
479527
struct cpucp_array_data_packet {
480528
struct cpucp_packet cpucp_pkt;
481529
__le32 length;
@@ -595,6 +643,18 @@ enum pll_index {
595643
PLL_MAX
596644
};
597645

646+
enum rl_index {
647+
TPC_RL = 0,
648+
MME_RL,
649+
};
650+
651+
enum pvt_index {
652+
PVT_SW,
653+
PVT_SE,
654+
PVT_NW,
655+
PVT_NE
656+
};
657+
598658
/* Event Queue Packets */
599659

600660
struct eq_generic_event {
@@ -721,4 +781,36 @@ struct cpucp_nic_info {
721781
__u8 reserved[6];
722782
};
723783

784+
/*
785+
* struct cpucp_nic_status - describes the status of a NIC port.
786+
* @port: NIC port index.
787+
* @bad_format_cnt: e.g. CRC.
788+
* @responder_out_of_sequence_psn_cnt: e.g NAK.
789+
* @high_ber_reinit_cnt: link reinit due to high BER.
790+
* @correctable_err_cnt: e.g. bit-flip.
791+
* @uncorrectable_err_cnt: e.g. MAC errors.
792+
* @retraining_cnt: re-training counter.
793+
* @up: is port up.
794+
* @pcs_link: has PCS link.
795+
* @phy_ready: is PHY ready.
796+
* @auto_neg: is Autoneg enabled.
797+
* @timeout_retransmission_cnt: timeout retransmission events
798+
* @high_ber_cnt: high ber events
799+
*/
800+
struct cpucp_nic_status {
801+
__le32 port;
802+
__le32 bad_format_cnt;
803+
__le32 responder_out_of_sequence_psn_cnt;
804+
__le32 high_ber_reinit;
805+
__le32 correctable_err_cnt;
806+
__le32 uncorrectable_err_cnt;
807+
__le32 retraining_cnt;
808+
__u8 up;
809+
__u8 pcs_link;
810+
__u8 phy_ready;
811+
__u8 auto_neg;
812+
__le32 timeout_retransmission_cnt;
813+
__le32 high_ber_cnt;
814+
};
815+
724816
#endif /* CPUCP_IF_H */

drivers/misc/habanalabs/include/common/hl_boot_if.h

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,10 @@
210210
* configured and is ready for use.
211211
* Initialized in: ppboot
212212
*
213+
* CPU_BOOT_DEV_STS0_FW_NIC_MAC_EN NIC MAC channels init is done by FW and
214+
* any access to them is done via the FW.
215+
* Initialized in: linux
216+
*
213217
* CPU_BOOT_DEV_STS0_DYN_PLL_EN Dynamic PLL configuration is enabled.
214218
* FW sends to host a bitmap of supported
215219
* PLLs.
@@ -233,6 +237,21 @@
233237
* prevent IRQs overriding each other.
234238
* Initialized in: linux
235239
*
240+
* CPU_BOOT_DEV_STS0_FW_NIC_STAT_XPCS91_EN
241+
* NIC STAT and XPCS91 access is restricted
242+
* and is done via FW only.
243+
* Initialized in: linux
244+
*
245+
* CPU_BOOT_DEV_STS0_FW_NIC_STAT_EXT_EN
246+
* NIC STAT get all is supported.
247+
* Initialized in: linux
248+
*
249+
* CPU_BOOT_DEV_STS0_IS_IDLE_CHECK_EN
250+
* F/W checks if the device is idle by reading defined set
251+
* of registers. It returns a bitmask of all the engines,
252+
* where a bit is set if the engine is not idle.
253+
* Initialized in: linux
254+
*
236255
* CPU_BOOT_DEV_STS0_ENABLED Device status register enabled.
237256
* This is a main indication that the
238257
* running FW populates the device status
@@ -260,10 +279,14 @@
260279
#define CPU_BOOT_DEV_STS0_PKT_PI_ACK_EN (1 << 15)
261280
#define CPU_BOOT_DEV_STS0_FW_LD_COM_EN (1 << 16)
262281
#define CPU_BOOT_DEV_STS0_FW_IATU_CONF_EN (1 << 17)
282+
#define CPU_BOOT_DEV_STS0_FW_NIC_MAC_EN (1 << 18)
263283
#define CPU_BOOT_DEV_STS0_DYN_PLL_EN (1 << 19)
264284
#define CPU_BOOT_DEV_STS0_GIC_PRIVILEGED_EN (1 << 20)
265285
#define CPU_BOOT_DEV_STS0_EQ_INDEX_EN (1 << 21)
266286
#define CPU_BOOT_DEV_STS0_MULTI_IRQ_POLL_EN (1 << 22)
287+
#define CPU_BOOT_DEV_STS0_FW_NIC_STAT_XPCS91_EN (1 << 23)
288+
#define CPU_BOOT_DEV_STS0_FW_NIC_STAT_EXT_EN (1 << 24)
289+
#define CPU_BOOT_DEV_STS0_IS_IDLE_CHECK_EN (1 << 25)
267290
#define CPU_BOOT_DEV_STS0_ENABLED (1 << 31)
268291
#define CPU_BOOT_DEV_STS1_ENABLED (1 << 31)
269292

0 commit comments

Comments
 (0)