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
71 min(CARD_NAME_MAX_LEN, HL_INFO_CARD_NAME_MAX_LEN));71 min(CARD_NAME_MAX_LEN, HL_INFO_CARD_NAME_MAX_LEN));
72 72
73 hw_ip.armcp_cpld_version = le32_to_cpu(prop->armcp_info.cpld_version);73 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
74 hw_ip.psoc_pci_pll_nr = prop->psoc_pci_pll_nr;76 hw_ip.psoc_pci_pll_nr = prop->psoc_pci_pll_nr;
75 hw_ip.psoc_pci_pll_nf = prop->psoc_pci_pll_nf;77 hw_ip.psoc_pci_pll_nf = prop->psoc_pci_pll_nf;
76 hw_ip.psoc_pci_pll_od = prop->psoc_pci_pll_od;78 hw_ip.psoc_pci_pll_od = prop->psoc_pci_pll_od;
drivers/misc/habanalabs/include/armcp_if.h+19−3
@@ -1,6 +1,6 @@
1/* SPDX-License-Identifier: GPL-2.01/* SPDX-License-Identifier: GPL-2.0
2 *2 *
3 * Copyright 2016-2019 HabanaLabs, Ltd.3 * Copyright 2016-2020 HabanaLabs, Ltd.
4 * All Rights Reserved.4 * All Rights Reserved.
5 *5 *
6 */6 */
@@ -35,7 +35,8 @@ struct hl_eq_entry { · 28 unmodified lines
35enum pq_init_status {35enum pq_init_status {
36 PQ_INIT_STATUS_NA = 0,36 PQ_INIT_STATUS_NA = 0,
37 PQ_INIT_STATUS_READY_FOR_CP,37 PQ_INIT_STATUS_READY_FOR_CP,
38 PQ_INIT_STATUS_READY_FOR_HOST38 PQ_INIT_STATUS_READY_FOR_HOST,
39 PQ_INIT_STATUS_READY_FOR_CP_SINGLE_MSI
39};40};
40 41
41/*42/*
@@ -350,11 +351,24 @@ struct armcp_sensor { · 308 unmodified lines
350 __le32 flags;351 __le32 flags;
351};352};
352 353
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 */
359enum armcp_card_types {
360 armcp_card_type_pci,
361 armcp_card_type_pmc
362};
363
353/**364/**
354 * struct armcp_info - Info from ArmCP that is necessary to the host's driver365 * struct armcp_info - Info from ArmCP that is necessary to the host's driver
355 * @sensors: available sensors description.366 * @sensors: available sensors description.
356 * @kernel_version: ArmCP linux kernel version.367 * @kernel_version: ArmCP linux kernel version.
357 * @reserved: reserved field.368 * @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)
358 * @cpld_version: CPLD programmed F/W version.372 * @cpld_version: CPLD programmed F/W version.
359 * @infineon_version: Infineon main DC-DC version.373 * @infineon_version: Infineon main DC-DC version.
360 * @fuse_version: silicon production FUSE information.374 * @fuse_version: silicon production FUSE information.
@@ -366,7 +380,9 @@ struct armcp_sensor { · 5 unmodified lines
366struct armcp_info {380struct armcp_info {
367 struct armcp_sensor sensors[ARMCP_MAX_SENSORS];381 struct armcp_sensor sensors[ARMCP_MAX_SENSORS];
368 __u8 kernel_version[VERSION_MAX_LEN];382 __u8 kernel_version[VERSION_MAX_LEN];
369 __le32 reserved[3];383 __le32 reserved;
384 __le32 card_type;
385 __le32 card_location;
370 __le32 cpld_version;386 __le32 cpld_version;
371 __le32 infineon_version;387 __le32 infineon_version;
372 __u8 fuse_version[VERSION_MAX_LEN];388 __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
125 __u32 sram_size;125 __u32 sram_size;
126 __u32 num_of_events;126 __u32 num_of_events;
127 __u32 device_id; /* PCI Device ID */127 __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];
129 __u32 armcp_cpld_version;130 __u32 armcp_cpld_version;
130 __u32 psoc_pci_pll_nr;131 __u32 psoc_pci_pll_nr;
131 __u32 psoc_pci_pll_nf;132 __u32 psoc_pci_pll_nf;