Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update submodule #191

Closed
wants to merge 10 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion platform/mellanox/hw-management.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
@@ -1,47 +1,85 @@
From 422b64397f2f33b394d037820f0ceb4c09e3a725 Mon Sep 17 00:00:00 2001
From: Alexander Allen <arallen@nvidia.com>
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 <junchao@nvidia.com>
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
}

Expand All @@ -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
Expand All @@ -65,5 +103,5 @@ index 1ee05b5..50d922b 100755
start)
if [ -d /var/run/hw-management ]; then
--
2.20.1
1.9.1

15 changes: 15 additions & 0 deletions platform/mellanox/mlnx-platform-api/sonic_platform/chassis.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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()

Expand Down
1 change: 1 addition & 0 deletions platform/mellanox/mlnx-platform-api/tests/test_chassis.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading