History

habanalabs: get card type, location from F/W

For Gaudi the driver gets two new additional properties from the F/W: 1. The card's type - PCI or PMC 2. The card's location in the Gaudi's box (relevant only for PMC). The card's location is also passed to the user in the HW IP info structure as it needs this property for establishing communication between Gaudis.

Omer Shpigelman committed 6 years ago

Commit fca72fb1 parent ca624333 files · +23 −4Browse files

Unified · Split

3 files
  1. drivers/misc/habanalabs/habanalabs_ioctl.c +2 −0
  2. drivers/misc/habanalabs/include/armcp_if.h +19 −3
  3. include/uapi/misc/habanalabs.h +2 −1
drivers/misc/habanalabs/habanalabs_ioctl.c+2−0
@@ -71,6 +71,8 @@ static int hw_ip_info(struct hl_device *hdev, struct hl_info_args *args) · 70 unmodified lines
7171 min(CARD_NAME_MAX_LEN, HL_INFO_CARD_NAME_MAX_LEN));
7272
7373 hw_ip.armcp_cpld_version = le32_to_cpu(prop->armcp_info.cpld_version);
74+ hw_ip.module_id = le32_to_cpu(prop->armcp_info.card_location);
75+
7476 hw_ip.psoc_pci_pll_nr = prop->psoc_pci_pll_nr;
7577 hw_ip.psoc_pci_pll_nf = prop->psoc_pci_pll_nf;
7678 hw_ip.psoc_pci_pll_od = prop->psoc_pci_pll_od;
drivers/misc/habanalabs/include/armcp_if.h+19−3
@@ -1,6 +1,6 @@
11 /* SPDX-License-Identifier: GPL-2.0
22 *
3− * Copyright 2016-2019 HabanaLabs, Ltd.
3+ * Copyright 2016-2020 HabanaLabs, Ltd.
44 * All Rights Reserved.
55 *
66 */
@@ -35,7 +35,8 @@ struct hl_eq_entry { · 28 unmodified lines
3535 enum pq_init_status {
3636 PQ_INIT_STATUS_NA = 0,
3737 PQ_INIT_STATUS_READY_FOR_CP,
38− PQ_INIT_STATUS_READY_FOR_HOST
38+ PQ_INIT_STATUS_READY_FOR_HOST,
39+ PQ_INIT_STATUS_READY_FOR_CP_SINGLE_MSI
3940 };
4041
4142 /*
@@ -350,11 +351,24 @@ struct armcp_sensor { · 308 unmodified lines
350351 __le32 flags;
351352 };
352353
354+/**
355+ * struct armcp_card_types - ASIC card type.
356+ * @armcp_card_type_pci: PCI card.
357+ * @armcp_card_type_pmc: PCI Mezzanine Card.
358+ */
359+enum armcp_card_types {
360+ armcp_card_type_pci,
361+ armcp_card_type_pmc
362+};
363+
353364 /**
354365 * struct armcp_info - Info from ArmCP that is necessary to the host's driver
355366 * @sensors: available sensors description.
356367 * @kernel_version: ArmCP linux kernel version.
357368 * @reserved: reserved field.
369+ * @card_type: card configuration type.
370+ * @card_location: in a server, each card has different connections topology
371+ * depending on its location (relevant for PMC card type)
358372 * @cpld_version: CPLD programmed F/W version.
359373 * @infineon_version: Infineon main DC-DC version.
360374 * @fuse_version: silicon production FUSE information.
@@ -366,7 +380,9 @@ struct armcp_sensor { · 5 unmodified lines
366380 struct armcp_info {
367381 struct armcp_sensor sensors[ARMCP_MAX_SENSORS];
368382 __u8 kernel_version[VERSION_MAX_LEN];
369− __le32 reserved[3];
383+ __le32 reserved;
384+ __le32 card_type;
385+ __le32 card_location;
370386 __le32 cpld_version;
371387 __le32 infineon_version;
372388 __u8 fuse_version[VERSION_MAX_LEN];
include/uapi/misc/habanalabs.h+2−1
@@ -125,7 +125,8 @@ struct hl_info_hw_ip_info { · 124 unmodified lines
125125 __u32 sram_size;
126126 __u32 num_of_events;
127127 __u32 device_id; /* PCI Device ID */
128− __u32 reserved[3];
128+ __u32 module_id; /* For mezzanine cards in servers (From OCP spec.) */
129+ __u32 reserved[2];
129130 __u32 armcp_cpld_version;
130131 __u32 psoc_pci_pll_nr;
131132 __u32 psoc_pci_pll_nf;