- Why I did it 1. Update Mellanox HW-MGMT package to newer version V.7.0030.1011 2. Replace the SONiC PMON Thermal control algorithm with the one inside the HW-MGMT package on all Nvidia platforms 3. Support Spectrum-4 systems - How I did it 1. Update the HW-MGMT package version number and submodule pointer 2. Remove the thermal control algorithm implementation from Mellanox platform API 3. Revise the patch to HW-MGMT package which will disable HW-MGMT from running on SIMX 4. Update the downstream kernel patch list Signed-off-by: Kebo Liu <kebol@nvidia.com>
200 lines
7.2 KiB
Diff
200 lines
7.2 KiB
Diff
From 441a7861ef61f4d0d55dee542d4704487694f68c Mon Sep 17 00:00:00 2001
|
|
From: Vadim Pasternak <vadimp@nvidia.com>
|
|
Date: Wed, 22 Dec 2021 06:11:50 +0000
|
|
Subject: [PATCH backport 5.10 109/182] mlxsw: reg: Extend MGPIR register with
|
|
new slot fields
|
|
|
|
Extend MGPIR (Management General Peripheral Information Register) with
|
|
new fields specifying the slot number and number of the slots available
|
|
on system. The purpose of these fields is:
|
|
- to support access to MPGIR register on modular system for getting the
|
|
number of cages, equipped on the line card, inserted at specified
|
|
slot. In case slot number is set zero, MGPIR will provide the
|
|
information for the main board. For Top of the Rack (non-modular)
|
|
system it will provide the same as before.
|
|
- to provide the number of slots supported by system. This data is
|
|
relevant only in case slot number is set zero.
|
|
|
|
Signed-off-by: Vadim Pasternak <vadimp@nvidia.com>
|
|
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
|
|
---
|
|
.../net/ethernet/mellanox/mlxsw/core_env.c | 4 ++--
|
|
.../net/ethernet/mellanox/mlxsw/core_hwmon.c | 9 +++++----
|
|
.../ethernet/mellanox/mlxsw/core_thermal.c | 8 ++++----
|
|
drivers/net/ethernet/mellanox/mlxsw/minimal.c | 4 ++--
|
|
drivers/net/ethernet/mellanox/mlxsw/reg.h | 20 +++++++++++++++++--
|
|
5 files changed, 31 insertions(+), 14 deletions(-)
|
|
|
|
diff --git a/drivers/net/ethernet/mellanox/mlxsw/core_env.c b/drivers/net/ethernet/mellanox/mlxsw/core_env.c
|
|
index ad27a1c90f92..8ab15d5bd7f5 100644
|
|
--- a/drivers/net/ethernet/mellanox/mlxsw/core_env.c
|
|
+++ b/drivers/net/ethernet/mellanox/mlxsw/core_env.c
|
|
@@ -983,12 +983,12 @@ int mlxsw_env_init(struct mlxsw_core *mlxsw_core, struct mlxsw_env **p_env)
|
|
u8 module_count;
|
|
int i, err;
|
|
|
|
- mlxsw_reg_mgpir_pack(mgpir_pl);
|
|
+ mlxsw_reg_mgpir_pack(mgpir_pl, 0);
|
|
err = mlxsw_reg_query(mlxsw_core, MLXSW_REG(mgpir), mgpir_pl);
|
|
if (err)
|
|
return err;
|
|
|
|
- mlxsw_reg_mgpir_unpack(mgpir_pl, NULL, NULL, NULL, &module_count);
|
|
+ mlxsw_reg_mgpir_unpack(mgpir_pl, NULL, NULL, NULL, &module_count, NULL);
|
|
|
|
env = kzalloc(struct_size(env, module_info, module_count), GFP_KERNEL);
|
|
if (!env)
|
|
diff --git a/drivers/net/ethernet/mellanox/mlxsw/core_hwmon.c b/drivers/net/ethernet/mellanox/mlxsw/core_hwmon.c
|
|
index f4bc711a16cf..2bc4c4556895 100644
|
|
--- a/drivers/net/ethernet/mellanox/mlxsw/core_hwmon.c
|
|
+++ b/drivers/net/ethernet/mellanox/mlxsw/core_hwmon.c
|
|
@@ -656,13 +656,13 @@ static int mlxsw_hwmon_module_init(struct mlxsw_hwmon *mlxsw_hwmon)
|
|
u8 module_sensor_max;
|
|
int i, err;
|
|
|
|
- mlxsw_reg_mgpir_pack(mgpir_pl);
|
|
+ mlxsw_reg_mgpir_pack(mgpir_pl, 0);
|
|
err = mlxsw_reg_query(mlxsw_hwmon->core, MLXSW_REG(mgpir), mgpir_pl);
|
|
if (err)
|
|
return err;
|
|
|
|
mlxsw_reg_mgpir_unpack(mgpir_pl, NULL, NULL, NULL,
|
|
- &module_sensor_max);
|
|
+ &module_sensor_max, NULL);
|
|
|
|
/* Add extra attributes for module temperature. Sensor index is
|
|
* assigned to sensor_count value, while all indexed before
|
|
@@ -707,12 +707,13 @@ static int mlxsw_hwmon_gearbox_init(struct mlxsw_hwmon *mlxsw_hwmon)
|
|
u8 gbox_num;
|
|
int err;
|
|
|
|
- mlxsw_reg_mgpir_pack(mgpir_pl);
|
|
+ mlxsw_reg_mgpir_pack(mgpir_pl, 0);
|
|
err = mlxsw_reg_query(mlxsw_hwmon->core, MLXSW_REG(mgpir), mgpir_pl);
|
|
if (err)
|
|
return err;
|
|
|
|
- mlxsw_reg_mgpir_unpack(mgpir_pl, &gbox_num, &device_type, NULL, NULL);
|
|
+ mlxsw_reg_mgpir_unpack(mgpir_pl, &gbox_num, &device_type, NULL, NULL,
|
|
+ NULL);
|
|
if (device_type != MLXSW_REG_MGPIR_DEVICE_TYPE_GEARBOX_DIE ||
|
|
!gbox_num)
|
|
return 0;
|
|
diff --git a/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c b/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c
|
|
index f4f0f8ce8597..21a7415c8ef5 100644
|
|
--- a/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c
|
|
+++ b/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c
|
|
@@ -746,13 +746,13 @@ mlxsw_thermal_modules_init(struct device *dev, struct mlxsw_core *core,
|
|
char mgpir_pl[MLXSW_REG_MGPIR_LEN];
|
|
int i, err;
|
|
|
|
- mlxsw_reg_mgpir_pack(mgpir_pl);
|
|
+ mlxsw_reg_mgpir_pack(mgpir_pl, 0);
|
|
err = mlxsw_reg_query(core, MLXSW_REG(mgpir), mgpir_pl);
|
|
if (err)
|
|
return err;
|
|
|
|
mlxsw_reg_mgpir_unpack(mgpir_pl, NULL, NULL, NULL,
|
|
- &thermal->tz_module_num);
|
|
+ &thermal->tz_module_num, NULL);
|
|
|
|
thermal->tz_module_arr = kcalloc(thermal->tz_module_num,
|
|
sizeof(*thermal->tz_module_arr),
|
|
@@ -837,13 +837,13 @@ mlxsw_thermal_gearboxes_init(struct device *dev, struct mlxsw_core *core,
|
|
int i;
|
|
int err;
|
|
|
|
- mlxsw_reg_mgpir_pack(mgpir_pl);
|
|
+ mlxsw_reg_mgpir_pack(mgpir_pl, 0);
|
|
err = mlxsw_reg_query(core, MLXSW_REG(mgpir), mgpir_pl);
|
|
if (err)
|
|
return err;
|
|
|
|
mlxsw_reg_mgpir_unpack(mgpir_pl, &gbox_num, &device_type, NULL,
|
|
- NULL);
|
|
+ NULL, NULL);
|
|
if (device_type != MLXSW_REG_MGPIR_DEVICE_TYPE_GEARBOX_DIE ||
|
|
!gbox_num)
|
|
return 0;
|
|
diff --git a/drivers/net/ethernet/mellanox/mlxsw/minimal.c b/drivers/net/ethernet/mellanox/mlxsw/minimal.c
|
|
index 3d07c2dcf08d..b2ffcfda8374 100644
|
|
--- a/drivers/net/ethernet/mellanox/mlxsw/minimal.c
|
|
+++ b/drivers/net/ethernet/mellanox/mlxsw/minimal.c
|
|
@@ -280,13 +280,13 @@ static int mlxsw_m_ports_create(struct mlxsw_m *mlxsw_m)
|
|
char mgpir_pl[MLXSW_REG_MGPIR_LEN];
|
|
int i, err;
|
|
|
|
- mlxsw_reg_mgpir_pack(mgpir_pl);
|
|
+ mlxsw_reg_mgpir_pack(mgpir_pl, 0);
|
|
err = mlxsw_reg_query(mlxsw_m->core, MLXSW_REG(mgpir), mgpir_pl);
|
|
if (err)
|
|
return err;
|
|
|
|
mlxsw_reg_mgpir_unpack(mgpir_pl, NULL, NULL, NULL,
|
|
- &mlxsw_m->max_ports);
|
|
+ &mlxsw_m->max_ports, NULL);
|
|
if (!mlxsw_m->max_ports)
|
|
return 0;
|
|
|
|
diff --git a/drivers/net/ethernet/mellanox/mlxsw/reg.h b/drivers/net/ethernet/mellanox/mlxsw/reg.h
|
|
index aad0cb1497aa..a5fa25d4bd8f 100644
|
|
--- a/drivers/net/ethernet/mellanox/mlxsw/reg.h
|
|
+++ b/drivers/net/ethernet/mellanox/mlxsw/reg.h
|
|
@@ -10166,6 +10166,12 @@ enum mlxsw_reg_mgpir_device_type {
|
|
MLXSW_REG_MGPIR_DEVICE_TYPE_GEARBOX_DIE,
|
|
};
|
|
|
|
+/* mgpir_slot_index
|
|
+ * Slot index (0: Main board).
|
|
+ * Access: Index
|
|
+ */
|
|
+MLXSW_ITEM32(reg, mgpir, slot_index, 0x00, 28, 4);
|
|
+
|
|
/* mgpir_device_type
|
|
* Access: RO
|
|
*/
|
|
@@ -10183,21 +10189,29 @@ MLXSW_ITEM32(reg, mgpir, devices_per_flash, 0x00, 16, 8);
|
|
*/
|
|
MLXSW_ITEM32(reg, mgpir, num_of_devices, 0x00, 0, 8);
|
|
|
|
+/* mgpir_num_of_slots
|
|
+ * Number of slots in the system.
|
|
+ * Access: RO
|
|
+ */
|
|
+MLXSW_ITEM32(reg, mgpir, num_of_slots, 0x04, 8, 8);
|
|
+
|
|
/* mgpir_num_of_modules
|
|
* Number of modules.
|
|
* Access: RO
|
|
*/
|
|
MLXSW_ITEM32(reg, mgpir, num_of_modules, 0x04, 0, 8);
|
|
|
|
-static inline void mlxsw_reg_mgpir_pack(char *payload)
|
|
+static inline void mlxsw_reg_mgpir_pack(char *payload, u8 slot_index)
|
|
{
|
|
MLXSW_REG_ZERO(mgpir, payload);
|
|
+ mlxsw_reg_mgpir_slot_index_set(payload, slot_index);
|
|
}
|
|
|
|
static inline void
|
|
mlxsw_reg_mgpir_unpack(char *payload, u8 *num_of_devices,
|
|
enum mlxsw_reg_mgpir_device_type *device_type,
|
|
- u8 *devices_per_flash, u8 *num_of_modules)
|
|
+ u8 *devices_per_flash, u8 *num_of_modules,
|
|
+ u8 *num_of_slots)
|
|
{
|
|
if (num_of_devices)
|
|
*num_of_devices = mlxsw_reg_mgpir_num_of_devices_get(payload);
|
|
@@ -10208,6 +10222,8 @@ mlxsw_reg_mgpir_unpack(char *payload, u8 *num_of_devices,
|
|
mlxsw_reg_mgpir_devices_per_flash_get(payload);
|
|
if (num_of_modules)
|
|
*num_of_modules = mlxsw_reg_mgpir_num_of_modules_get(payload);
|
|
+ if (num_of_slots)
|
|
+ *num_of_slots = mlxsw_reg_mgpir_num_of_slots_get(payload);
|
|
}
|
|
|
|
/* MFDE - Monitoring FW Debug Register
|
|
--
|
|
2.20.1
|
|
|