diff --git a/.gitmodules b/.gitmodules index 69ce0f77be28..85cb2cc46f0a 100644 --- a/.gitmodules +++ b/.gitmodules @@ -4,7 +4,7 @@ branch = 202205 [submodule "sonic-linux-kernel"] path = src/sonic-linux-kernel - url = https://github.com/sonic-net/sonic-linux-kernel + url = https://github.com/Junchao-Mellanox/sonic-linux-kernel branch = 202205 [submodule "sonic-sairedis"] path = src/sonic-sairedis diff --git a/platform/mellanox/hw-management.mk b/platform/mellanox/hw-management.mk index 6270e43a8ccb..c3dca6fe6cdf 100644 --- a/platform/mellanox/hw-management.mk +++ b/platform/mellanox/hw-management.mk @@ -16,7 +16,7 @@ # # Mellanox HW Management -MLNX_HW_MANAGEMENT_VERSION = 7.0020.4301 +MLNX_HW_MANAGEMENT_VERSION = 7.0020.4303 export MLNX_HW_MANAGEMENT_VERSION diff --git a/platform/mellanox/hw-management/0002-Disable-hw-mgmt-on-SimX-platforms.patch b/platform/mellanox/hw-management/0002-Disable-hw-mgmt-on-SimX-platforms.patch index 61aab18090a2..f3a2b87cc5ab 100644 --- a/platform/mellanox/hw-management/0002-Disable-hw-mgmt-on-SimX-platforms.patch +++ b/platform/mellanox/hw-management/0002-Disable-hw-mgmt-on-SimX-platforms.patch @@ -1,47 +1,85 @@ -From 422b64397f2f33b394d037820f0ceb4c09e3a725 Mon Sep 17 00:00:00 2001 -From: Alexander Allen -Date: Fri, 21 Jan 2022 16:47:19 +0000 -Subject: [PATCH 2/4] Disable hw-mgmt on SimX platforms +From 78c36dabc04236f54c6274b2faff42c2acf56c82 Mon Sep 17 00:00:00 2001 +From: Junchao-Mellanox +Date: Mon, 28 Aug 2023 11:46:52 +0800 +Subject: [PATCH] [PATCH 2/4] Disable hw-mgmt on SimX platforms --- - usr/usr/bin/hw-management-ready.sh | 11 +++++++---- - usr/usr/bin/hw-management.sh | 9 +++++++++ - 2 files changed, 16 insertions(+), 4 deletions(-) + usr/usr/bin/hw-management-ready.sh | 6 ++++++ + usr/usr/bin/hw-management.sh | 23 ++++++++++++++++------- + 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/usr/usr/bin/hw-management-ready.sh b/usr/usr/bin/hw-management-ready.sh -index 88672a8..7558c68 100755 +index 2b736d2..649c125 100755 --- a/usr/usr/bin/hw-management-ready.sh +++ b/usr/usr/bin/hw-management-ready.sh -@@ -51,17 +51,20 @@ if [ -d /var/run/hw-management ]; then - rm -fr /var/run/hw-management - fi +@@ -39,6 +39,12 @@ + # Waits in loop until hw-management service can be started. + # Report start of hw-management service to console and logger. --case $board_type in --VMOD0014) -+if [ -z "$(lspci -vvv | grep SimX)" ]; then -+ case $board_type in -+ VMOD0014) - if [ ! -d /sys/devices/pci0000:00/0000:00:1f.0/NVSN2201:00/mlxreg-hotplug/hwmon ]; then - timeout 180 bash -c 'until [ -d /sys/devices/pci0000:00/0000:00:1f.0/NVSN2201:00/mlxreg-hotplug/hwmon ]; do sleep 0.2; done' - fi - ;; --*) -+ *) - if [ ! -d /sys/devices/platform/mlxplat/mlxreg-hotplug/hwmon ]; then - timeout 180 bash -c 'until [ -d /sys/devices/platform/mlxplat/mlxreg-hotplug/hwmon ]; do sleep 0.2; done' - fi - ;; --esac -+ esac ++if [ -n "$(lspci -vvv | grep SimX)" ]; then ++ echo "Start Chassis HW management service." ++ logger -t hw-management -p daemon.notice "Start Chassis HW management service." ++ exit 0 +fi + - echo "Start Chassis HW management service." - logger -t hw-management -p daemon.notice "Start Chassis HW management service." + board_type=`cat /sys/devices/virtual/dmi/id/board_name` + + if systemctl is-active --quiet hw-management; then diff --git a/usr/usr/bin/hw-management.sh b/usr/usr/bin/hw-management.sh -index 1ee05b5..50d922b 100755 +index 1591665..aa8a2b5 100755 --- a/usr/usr/bin/hw-management.sh +++ b/usr/usr/bin/hw-management.sh -@@ -2310,6 +2310,13 @@ do_chip_down() +@@ -505,7 +505,7 @@ function restore_i2c_bus_frequency_default() + function find_regio_sysfs_path_helper() + { + # Find hwmon{n} sysfs path for regio device +- case $board_type in ++ case $board_type in + VMOD0014) + for path in /sys/devices/pci0000:00/*/NVSN2201:*/mlxreg-io/hwmon/hwmon*; do + if [ -d "$path" ]; then +@@ -668,10 +668,10 @@ set_jtag_gpio() + gpio_tdi=$((gpiobase+jtag_tdi)) + echo $gpio_tdi > /sys/class/gpio/"$export_unexport" + +- # In SN2201 system. ++ # In SN2201 system. + # GPIO0 for CPU request to reset the Main Board I2C Mux. +- # GPIO1 for CPU control the CPU Board MUX when doing the ISP programming. +- # GPIO13 for CPU request Main Board JTAG control signal. ++ # GPIO1 for CPU control the CPU Board MUX when doing the ISP programming. ++ # GPIO13 for CPU request Main Board JTAG control signal. + if [ "$board_type" == "VMOD0014" ]; then + mux_reset=27 + jtag_mux_en=33 +@@ -1209,7 +1209,7 @@ connect_msn4700_msn4600_A1() + # msn4600C with removed A2D + connect_table+=(${msn4600C_A1_base_connect_table[@]}) + else +- # msn4700/msn4600 respin ++ # msn4700/msn4600 respin + connect_table+=(${msn4700_msn4600_A1_base_connect_table[@]}) + fi + add_cpu_board_to_connection_table +@@ -1985,7 +1985,7 @@ create_symbolic_links() + fi + if [ ! -d $thermal_path ]; then + mkdir $thermal_path +- fi ++ fi + if [ ! -d $config_path ]; then + mkdir $config_path + fi +@@ -2169,7 +2169,7 @@ do_start() + check_system + set_asic_pci_id + +- asic_control=$(< $config_path/asic_control) ++ asic_control=$(< $config_path/asic_control) + if [[ $asic_control -ne 0 ]]; then + get_asic_bus + get_asic2_bus +@@ -2344,6 +2344,13 @@ do_chip_down() /usr/bin/hw-management-thermal-events.sh change hotplug_asic down %S %p } @@ -55,8 +93,8 @@ index 1ee05b5..50d922b 100755 __usage=" Usage: $(basename "$0") [Options] -@@ -2335,6 +2342,8 @@ Options: - force-reload Performs hw-management 'stop' and the 'start. +@@ -2370,6 +2377,8 @@ Options: + reset-cause Output system reset cause. " +check_simx @@ -65,5 +103,5 @@ index 1ee05b5..50d922b 100755 start) if [ -d /var/run/hw-management ]; then -- -2.20.1 +1.9.1 diff --git a/platform/mellanox/hw-management/hw-mgmt b/platform/mellanox/hw-management/hw-mgmt index c036e38b3969..d33839d0682f 160000 --- a/platform/mellanox/hw-management/hw-mgmt +++ b/platform/mellanox/hw-management/hw-mgmt @@ -1 +1 @@ -Subproject commit c036e38b3969e1b0eebbf36ef367bb14cd52bcfb +Subproject commit d33839d0682faf13783de41f0591c4cde494b374 diff --git a/platform/mellanox/mlnx-platform-api/sonic_platform/chassis.py b/platform/mellanox/mlnx-platform-api/sonic_platform/chassis.py index e13b90d6c0ca..e97b04e80ef1 100644 --- a/platform/mellanox/mlnx-platform-api/sonic_platform/chassis.py +++ b/platform/mellanox/mlnx-platform-api/sonic_platform/chassis.py @@ -26,6 +26,7 @@ from sonic_platform_base.chassis_base import ChassisBase from sonic_py_common.logger import Logger import os + import time from functools import reduce from .utils import extract_RJ45_ports_index from . import utils @@ -753,6 +754,16 @@ def _parse_warmfast_reboot_from_proc_cmdline(self): return 'fast-reboot' return None + def _wait_reboot_cause_ready(self): + max_wait_time = 45 + while max_wait_time > 0: + if utils.read_int_from_file('/run/hw-management/config/reset_attr_ready', log_func=None) == 1: + return True + time.sleep(5) + max_wait_time -= 5 + + return False + def get_reboot_cause(self): """ Retrieves the cause of the previous reboot @@ -773,6 +784,10 @@ def get_reboot_cause(self): if reboot_cause: return self.REBOOT_CAUSE_NON_HARDWARE, '' + if not self._wait_reboot_cause_ready(): + logger.log_error("Hardware reboot cause is not ready") + return self.REBOOT_CAUSE_NON_HARDWARE, '' + if not self.reboot_cause_initialized: self.initialize_reboot_cause() diff --git a/platform/mellanox/mlnx-platform-api/tests/test_chassis.py b/platform/mellanox/mlnx-platform-api/tests/test_chassis.py index e71f75f0a954..749f8fa7c45f 100644 --- a/platform/mellanox/mlnx-platform-api/tests/test_chassis.py +++ b/platform/mellanox/mlnx-platform-api/tests/test_chassis.py @@ -194,6 +194,7 @@ def mock_check_sfp_status(self, port_dict, error_dict, timeout): assert status is True assert 'sfp' in event_dict and not event_dict['sfp'] + @mock.patch('sonic_platform.chassis.Chassis._wait_reboot_cause_ready', MagicMock(return_value=True)) def test_reboot_cause(self): from sonic_platform import utils from sonic_platform.chassis import REBOOT_CAUSE_ROOT diff --git a/src/sonic-linux-kernel b/src/sonic-linux-kernel index 836aedf1528b..717009b40423 160000 --- a/src/sonic-linux-kernel +++ b/src/sonic-linux-kernel @@ -1 +1 @@ -Subproject commit 836aedf1528b427b7856b072b45b6cc7aebe9790 +Subproject commit 717009b40423dad3d40328e9d844eaaca64450ed