Commit 5dc9ffaf authored by Oded Gabbay's avatar Oded Gabbay

habanalabs: expose server type in INFO IOCTL

Add the server type property to the hl_info_hw_ip_info structure
that is exposed to the user via the INFO IOCTL.

This is needed by the userspace s/w stack to know the connections map
of the internal links that connect the ASIC among themselves inside the
server.

The F/W will tell us, as part of the NIC information, the server type
that the GAUDI is located in.
Signed-off-by: default avatarOded Gabbay <ogabbay@kernel.org>
parent e62ada5e
// SPDX-License-Identifier: GPL-2.0 // SPDX-License-Identifier: GPL-2.0
/* /*
* Copyright 2016-2019 HabanaLabs, Ltd. * Copyright 2016-2021 HabanaLabs, Ltd.
* All Rights Reserved. * All Rights Reserved.
*/ */
......
...@@ -489,6 +489,8 @@ struct hl_hints_range { ...@@ -489,6 +489,8 @@ struct hl_hints_range {
* reserved for the user * reserved for the user
* @first_available_cq: first available CQ for the user. * @first_available_cq: first available CQ for the user.
* @user_interrupt_count: number of user interrupts. * @user_interrupt_count: number of user interrupts.
* @server_type: Server type that the ASIC is currently installed in.
* The value is according to enum hl_server_type in uapi file.
* @tpc_enabled_mask: which TPCs are enabled. * @tpc_enabled_mask: which TPCs are enabled.
* @completion_queues_count: number of completion queues. * @completion_queues_count: number of completion queues.
* @fw_security_enabled: true if security measures are enabled in firmware, * @fw_security_enabled: true if security measures are enabled in firmware,
...@@ -570,6 +572,7 @@ struct asic_fixed_properties { ...@@ -570,6 +572,7 @@ struct asic_fixed_properties {
u16 first_available_user_msix_interrupt; u16 first_available_user_msix_interrupt;
u16 first_available_cq[HL_MAX_DCORES]; u16 first_available_cq[HL_MAX_DCORES];
u16 user_interrupt_count; u16 user_interrupt_count;
u16 server_type;
u8 tpc_enabled_mask; u8 tpc_enabled_mask;
u8 completion_queues_count; u8 completion_queues_count;
u8 fw_security_enabled; u8 fw_security_enabled;
......
...@@ -94,6 +94,8 @@ static int hw_ip_info(struct hl_device *hdev, struct hl_info_args *args) ...@@ -94,6 +94,8 @@ static int hw_ip_info(struct hl_device *hdev, struct hl_info_args *args)
hw_ip.first_available_interrupt_id = hw_ip.first_available_interrupt_id =
prop->first_available_user_msix_interrupt; prop->first_available_user_msix_interrupt;
hw_ip.server_type = prop->server_type;
return copy_to_user(out, &hw_ip, return copy_to_user(out, &hw_ip,
min((size_t) size, sizeof(hw_ip))) ? -EFAULT : 0; min((size_t) size, sizeof(hw_ip))) ? -EFAULT : 0;
} }
......
...@@ -642,6 +642,8 @@ static int gaudi_set_fixed_properties(struct hl_device *hdev) ...@@ -642,6 +642,8 @@ static int gaudi_set_fixed_properties(struct hl_device *hdev)
prop->hard_reset_done_by_fw = false; prop->hard_reset_done_by_fw = false;
prop->gic_interrupts_enable = true; prop->gic_interrupts_enable = true;
prop->server_type = HL_SERVER_TYPE_UNKNOWN;
return 0; return 0;
} }
......
...@@ -469,6 +469,8 @@ int goya_set_fixed_properties(struct hl_device *hdev) ...@@ -469,6 +469,8 @@ int goya_set_fixed_properties(struct hl_device *hdev)
prop->hard_reset_done_by_fw = false; prop->hard_reset_done_by_fw = false;
prop->gic_interrupts_enable = true; prop->gic_interrupts_enable = true;
prop->server_type = HL_SERVER_TYPE_UNKNOWN;
return 0; return 0;
} }
......
...@@ -700,6 +700,15 @@ struct cpucp_mac_addr { ...@@ -700,6 +700,15 @@ struct cpucp_mac_addr {
__u8 mac_addr[ETH_ALEN]; __u8 mac_addr[ETH_ALEN];
}; };
enum cpucp_serdes_type {
TYPE_1_SERDES_TYPE,
TYPE_2_SERDES_TYPE,
HLS1_SERDES_TYPE,
HLS1H_SERDES_TYPE,
UNKNOWN_SERDES_TYPE,
MAX_NUM_SERDES_TYPE = UNKNOWN_SERDES_TYPE
};
struct cpucp_nic_info { struct cpucp_nic_info {
struct cpucp_mac_addr mac_addrs[CPUCP_MAX_NICS]; struct cpucp_mac_addr mac_addrs[CPUCP_MAX_NICS];
__le64 link_mask[CPUCP_NIC_MASK_ARR_LEN]; __le64 link_mask[CPUCP_NIC_MASK_ARR_LEN];
...@@ -708,6 +717,8 @@ struct cpucp_nic_info { ...@@ -708,6 +717,8 @@ struct cpucp_nic_info {
__le64 link_ext_mask[CPUCP_NIC_MASK_ARR_LEN]; __le64 link_ext_mask[CPUCP_NIC_MASK_ARR_LEN];
__u8 qsfp_eeprom[CPUCP_NIC_QSFP_EEPROM_MAX_LEN]; __u8 qsfp_eeprom[CPUCP_NIC_QSFP_EEPROM_MAX_LEN];
__le64 auto_neg_mask[CPUCP_NIC_MASK_ARR_LEN]; __le64 auto_neg_mask[CPUCP_NIC_MASK_ARR_LEN];
__le16 serdes_type; /* enum cpucp_serdes_type */
__u8 reserved[6];
}; };
#endif /* CPUCP_IF_H */ #endif /* CPUCP_IF_H */
...@@ -279,6 +279,14 @@ enum hl_device_status { ...@@ -279,6 +279,14 @@ enum hl_device_status {
HL_DEVICE_STATUS_NEEDS_RESET HL_DEVICE_STATUS_NEEDS_RESET
}; };
enum hl_server_type {
HL_SERVER_TYPE_UNKNOWN = 0,
HL_SERVER_GAUDI_HLS1 = 1,
HL_SERVER_GAUDI_HLS1H = 2,
HL_SERVER_GAUDI_TYPE1 = 3,
HL_SERVER_GAUDI_TYPE2 = 4
};
/* Opcode for management ioctl /* Opcode for management ioctl
* *
* HW_IP_INFO - Receive information about different IP blocks in the * HW_IP_INFO - Receive information about different IP blocks in the
...@@ -337,17 +345,49 @@ enum hl_device_status { ...@@ -337,17 +345,49 @@ enum hl_device_status {
#define HL_INFO_VERSION_MAX_LEN 128 #define HL_INFO_VERSION_MAX_LEN 128
#define HL_INFO_CARD_NAME_MAX_LEN 16 #define HL_INFO_CARD_NAME_MAX_LEN 16
/**
* struct hl_info_hw_ip_info - hardware information on various IPs in the ASIC
* @sram_base_address: The first SRAM physical base address that is free to be
* used by the user.
* @dram_base_address: The first DRAM virtual or physical base address that is
* free to be used by the user.
* @dram_size: The DRAM size that is available to the user.
* @sram_size: The SRAM size that is available to the user.
* @num_of_events: The number of events that can be received from the f/w. This
* is needed so the user can what is the size of the h/w events
* array he needs to pass to the kernel when he wants to fetch
* the event counters.
* @device_id: PCI device ID of the ASIC.
* @module_id: Module ID of the ASIC for mezzanine cards in servers
* (From OCP spec).
* @first_available_interrupt_id: The first available interrupt ID for the user
* to be used when it works with user interrupts.
* @server_type: Server type that the Gaudi ASIC is currently installed in.
* The value is according to enum hl_server_type
* @cpld_version: CPLD version on the board.
* @psoc_pci_pll_nr: PCI PLL NR value. Needed by the profiler in some ASICs.
* @psoc_pci_pll_nf: PCI PLL NF value. Needed by the profiler in some ASICs.
* @psoc_pci_pll_od: PCI PLL OD value. Needed by the profiler in some ASICs.
* @psoc_pci_pll_div_factor: PCI PLL DIV factor value. Needed by the profiler
* in some ASICs.
* @tpc_enabled_mask: Bit-mask that represents which TPCs are enabled. Relevant
* for Goya/Gaudi only.
* @dram_enabled: Whether the DRAM is enabled.
* @cpucp_version: The CPUCP f/w version.
* @card_name: The card name as passed by the f/w.
* @dram_page_size: The DRAM physical page size.
*/
struct hl_info_hw_ip_info { struct hl_info_hw_ip_info {
__u64 sram_base_address; __u64 sram_base_address;
__u64 dram_base_address; __u64 dram_base_address;
__u64 dram_size; __u64 dram_size;
__u32 sram_size; __u32 sram_size;
__u32 num_of_events; __u32 num_of_events;
__u32 device_id; /* PCI Device ID */ __u32 device_id;
__u32 module_id; /* For mezzanine cards in servers (From OCP spec.) */ __u32 module_id;
__u32 reserved; __u32 reserved;
__u16 first_available_interrupt_id; __u16 first_available_interrupt_id;
__u16 reserved2; __u16 server_type;
__u32 cpld_version; __u32 cpld_version;
__u32 psoc_pci_pll_nr; __u32 psoc_pci_pll_nr;
__u32 psoc_pci_pll_nf; __u32 psoc_pci_pll_nf;
...@@ -358,7 +398,7 @@ struct hl_info_hw_ip_info { ...@@ -358,7 +398,7 @@ struct hl_info_hw_ip_info {
__u8 pad[2]; __u8 pad[2];
__u8 cpucp_version[HL_INFO_VERSION_MAX_LEN]; __u8 cpucp_version[HL_INFO_VERSION_MAX_LEN];
__u8 card_name[HL_INFO_CARD_NAME_MAX_LEN]; __u8 card_name[HL_INFO_CARD_NAME_MAX_LEN];
__u64 reserved3; __u64 reserved2;
__u64 dram_page_size; __u64 dram_page_size;
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment