|
| 1 | +From 97a18fe05a59a76513ea4e11560760d0450e6f6c Mon Sep 17 00:00:00 2001 |
| 2 | +From: Vadim Pasternak < [email protected]> |
| 3 | +Date: Sun, 10 Jan 2021 19:27:52 +0200 |
| 4 | +Subject: [PATCH net-next 1/1] mlxsw: core: Remove critical trip point from |
| 5 | + thermal zones |
| 6 | + |
| 7 | +Disable software thermal protection by removing critical trip points |
| 8 | +for the all thermal zones. |
| 9 | + |
| 10 | +According to the system requirements software should never perform |
| 11 | +system thermal protection, since all the systems implement two levels |
| 12 | +of thermal protection: the first one is performed by firmware, the |
| 13 | +second, in case firmware was not able to perform protection, by |
| 14 | +hardware, while the temperature threshold for hardware protection is |
| 15 | +higher than for firmware. |
| 16 | + |
| 17 | +In both cases, when critical temperature is reached, system will be |
| 18 | +shutdown. |
| 19 | + |
| 20 | +Signed-off-by: Vadim Pasternak < [email protected]> |
| 21 | +--- |
| 22 | + drivers/net/ethernet/mellanox/mlxsw/core_thermal.c | 19 ++----------------- |
| 23 | + 1 file changed, 2 insertions(+), 17 deletions(-) |
| 24 | + |
| 25 | +diff --git a/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c b/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c |
| 26 | +index 477c3ed53..9afac8a04 100644 |
| 27 | +--- a/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c |
| 28 | ++++ b/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c |
| 29 | +@@ -19,11 +19,9 @@ |
| 30 | + #define MLXSW_THERMAL_ASIC_TEMP_NORM 75000 /* 75C */ |
| 31 | + #define MLXSW_THERMAL_ASIC_TEMP_HIGH 85000 /* 85C */ |
| 32 | + #define MLXSW_THERMAL_ASIC_TEMP_HOT 105000 /* 105C */ |
| 33 | +-#define MLXSW_THERMAL_ASIC_TEMP_CRIT 140000 /* 140C */ |
| 34 | + #define MLXSW_THERMAL_MODULE_TEMP_NORM 60000 /* 60C */ |
| 35 | + #define MLXSW_THERMAL_MODULE_TEMP_HIGH 70000 /* 70C */ |
| 36 | + #define MLXSW_THERMAL_MODULE_TEMP_HOT 80000 /* 80C */ |
| 37 | +-#define MLXSW_THERMAL_MODULE_TEMP_CRIT 90000 /* 90C */ |
| 38 | + #define MLXSW_THERMAL_HYSTERESIS_TEMP 5000 /* 5C */ |
| 39 | + #define MLXSW_THERMAL_MODULE_TEMP_SHIFT (MLXSW_THERMAL_HYSTERESIS_TEMP * 2) |
| 40 | + #define MLXSW_THERMAL_ZONE_MAX_NAME 16 |
| 41 | +@@ -49,7 +47,6 @@ enum mlxsw_thermal_trips { |
| 42 | + MLXSW_THERMAL_TEMP_TRIP_NORM, |
| 43 | + MLXSW_THERMAL_TEMP_TRIP_HIGH, |
| 44 | + MLXSW_THERMAL_TEMP_TRIP_HOT, |
| 45 | +- MLXSW_THERMAL_TEMP_TRIP_CRIT, |
| 46 | + }; |
| 47 | + |
| 48 | + struct mlxsw_thermal_trip { |
| 49 | +@@ -79,16 +76,9 @@ static const struct mlxsw_thermal_trip default_thermal_trips[] = { |
| 50 | + { /* Warning */ |
| 51 | + .type = THERMAL_TRIP_HOT, |
| 52 | + .temp = MLXSW_THERMAL_ASIC_TEMP_HOT, |
| 53 | +- .hyst = MLXSW_THERMAL_HYSTERESIS_TEMP, |
| 54 | + .min_state = MLXSW_THERMAL_MAX_STATE, |
| 55 | + .max_state = MLXSW_THERMAL_MAX_STATE, |
| 56 | + }, |
| 57 | +- { /* Critical - soft poweroff */ |
| 58 | +- .type = THERMAL_TRIP_CRITICAL, |
| 59 | +- .temp = MLXSW_THERMAL_ASIC_TEMP_CRIT, |
| 60 | +- .min_state = MLXSW_THERMAL_MAX_STATE, |
| 61 | +- .max_state = MLXSW_THERMAL_MAX_STATE, |
| 62 | +- } |
| 63 | + }; |
| 64 | + |
| 65 | + #define MLXSW_THERMAL_NUM_TRIPS ARRAY_SIZE(default_thermal_trips) |
| 66 | +@@ -161,7 +151,6 @@ mlxsw_thermal_module_trips_reset(struct mlxsw_thermal_module *tz) |
| 67 | + tz->trips[MLXSW_THERMAL_TEMP_TRIP_NORM].temp = MLXSW_THERMAL_MODULE_TEMP_NORM; |
| 68 | + tz->trips[MLXSW_THERMAL_TEMP_TRIP_HIGH].temp = MLXSW_THERMAL_MODULE_TEMP_HIGH; |
| 69 | + tz->trips[MLXSW_THERMAL_TEMP_TRIP_HOT].temp = MLXSW_THERMAL_MODULE_TEMP_HOT; |
| 70 | +- tz->trips[MLXSW_THERMAL_TEMP_TRIP_CRIT].temp = MLXSW_THERMAL_MODULE_TEMP_CRIT; |
| 71 | + } |
| 72 | + |
| 73 | + static int |
| 74 | +@@ -203,8 +192,6 @@ mlxsw_thermal_module_trips_update(struct device *dev, struct mlxsw_core *core, |
| 75 | + tz->trips[MLXSW_THERMAL_TEMP_TRIP_NORM].temp = crit_temp; |
| 76 | + tz->trips[MLXSW_THERMAL_TEMP_TRIP_HIGH].temp = crit_temp; |
| 77 | + tz->trips[MLXSW_THERMAL_TEMP_TRIP_HOT].temp = emerg_temp; |
| 78 | +- tz->trips[MLXSW_THERMAL_TEMP_TRIP_CRIT].temp = emerg_temp + |
| 79 | +- MLXSW_THERMAL_MODULE_TEMP_SHIFT; |
| 80 | + |
| 81 | + return 0; |
| 82 | + } |
| 83 | +@@ -376,8 +363,7 @@ static int mlxsw_thermal_set_trip_temp(struct thermal_zone_device *tzdev, |
| 84 | + { |
| 85 | + struct mlxsw_thermal *thermal = tzdev->devdata; |
| 86 | + |
| 87 | +- if (trip < 0 || trip >= MLXSW_THERMAL_NUM_TRIPS || |
| 88 | +- temp > MLXSW_THERMAL_ASIC_TEMP_CRIT) |
| 89 | ++ if (trip < 0 || trip >= MLXSW_THERMAL_NUM_TRIPS) |
| 90 | + return -EINVAL; |
| 91 | + |
| 92 | + thermal->trips[trip].temp = temp; |
| 93 | +@@ -588,8 +574,7 @@ mlxsw_thermal_module_trip_temp_set(struct thermal_zone_device *tzdev, |
| 94 | + { |
| 95 | + struct mlxsw_thermal_module *tz = tzdev->devdata; |
| 96 | + |
| 97 | +- if (trip < 0 || trip >= MLXSW_THERMAL_NUM_TRIPS || |
| 98 | +- temp > tz->trips[MLXSW_THERMAL_TEMP_TRIP_CRIT].temp) |
| 99 | ++ if (trip < 0 || trip >= MLXSW_THERMAL_NUM_TRIPS) |
| 100 | + return -EINVAL; |
| 101 | + |
| 102 | + tz->trips[trip].temp = temp; |
| 103 | +-- |
| 104 | +2.11.0 |
| 105 | + |
0 commit comments