From e5e15a51008c64549692a480c20fb8ce0e3cecbc Mon Sep 17 00:00:00 2001 From: Shlomi Bitton Date: Wed, 24 Feb 2021 11:31:31 +0000 Subject: [PATCH 1/3] New hw-mgmt patch for SimX platform adaptation Signed-off-by: Shlomi Bitton --- .../0003-Make-hw-mgmt-SimX-compatiable.patch | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 platform/mellanox/hw-management/0003-Make-hw-mgmt-SimX-compatiable.patch diff --git a/platform/mellanox/hw-management/0003-Make-hw-mgmt-SimX-compatiable.patch b/platform/mellanox/hw-management/0003-Make-hw-mgmt-SimX-compatiable.patch new file mode 100644 index 000000000000..d74f65b3342d --- /dev/null +++ b/platform/mellanox/hw-management/0003-Make-hw-mgmt-SimX-compatiable.patch @@ -0,0 +1,48 @@ +diff --git a/usr/usr/bin/hw-management-ready.sh b/usr/usr/bin/hw-management-ready.sh +index 3c9f7b6..05d143f 100755 +--- a/usr/usr/bin/hw-management-ready.sh ++++ b/usr/usr/bin/hw-management-ready.sh +@@ -49,9 +49,12 @@ if [ -d /var/run/hw-management ]; then + rm -fr /var/run/hw-management + fi + +-while [ ! -d /sys/devices/platform/mlxplat/mlxreg-hotplug/hwmon ] +-do +- sleep 1 +-done ++if [ -z "$(lspci -vvv | grep SimX)" ]; then ++ while [ ! -d /sys/devices/platform/mlxplat/mlxreg-hotplug/hwmon ] ++ do ++ sleep 1 ++ done ++fi ++ + echo "Start Chassis HW management service." + logger -t hw-management -p daemon.notice "Start Chassis HW management service." +diff --git a/usr/usr/bin/hw-management.sh b/usr/usr/bin/hw-management.sh +index 70f1297..8de1722 100755 +--- a/usr/usr/bin/hw-management.sh ++++ b/usr/usr/bin/hw-management.sh +@@ -1110,6 +1110,13 @@ do_chip_down() + /usr/bin/hw-management-thermal-events.sh change hotplug_asic down %S %p + } + ++check_simx() ++{ ++ if [ ! -z "$(lspci -vvv | grep SimX)" ]; then ++ exit 0 ++ fi ++} ++ + __usage=" + Usage: $(basename $0) [Options] + +@@ -1135,6 +1142,8 @@ Options: + force-reload Performs hw-management 'stop' and the 'start. + " + ++check_simx ++ + case $ACTION in + start) + if [ -d /var/run/hw-management ]; then From 0e236a6015bb26ce844dcc0ccee40bd2035496ac Mon Sep 17 00:00:00 2001 From: Shlomi Bitton Date: Wed, 24 Feb 2021 12:28:58 +0000 Subject: [PATCH 2/3] use -n instead of ! -z --- .../hw-management/0003-Make-hw-mgmt-SimX-compatiable.patch | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/platform/mellanox/hw-management/0003-Make-hw-mgmt-SimX-compatiable.patch b/platform/mellanox/hw-management/0003-Make-hw-mgmt-SimX-compatiable.patch index d74f65b3342d..0eb3daa7977e 100644 --- a/platform/mellanox/hw-management/0003-Make-hw-mgmt-SimX-compatiable.patch +++ b/platform/mellanox/hw-management/0003-Make-hw-mgmt-SimX-compatiable.patch @@ -20,7 +20,7 @@ index 3c9f7b6..05d143f 100755 echo "Start Chassis HW management service." logger -t hw-management -p daemon.notice "Start Chassis HW management service." diff --git a/usr/usr/bin/hw-management.sh b/usr/usr/bin/hw-management.sh -index 70f1297..8de1722 100755 +index 70f1297..e427a3d 100755 --- a/usr/usr/bin/hw-management.sh +++ b/usr/usr/bin/hw-management.sh @@ -1110,6 +1110,13 @@ do_chip_down() @@ -29,7 +29,7 @@ index 70f1297..8de1722 100755 +check_simx() +{ -+ if [ ! -z "$(lspci -vvv | grep SimX)" ]; then ++ if [ -n "$(lspci -vvv | grep SimX)" ]; then + exit 0 + fi +} From a9f9f5dc2460d808d012b4f7c94a76c9ae024666 Mon Sep 17 00:00:00 2001 From: Shlomi Bitton Date: Wed, 24 Feb 2021 12:32:51 +0000 Subject: [PATCH 3/3] Fix SimX adaptation for mlnx-fw-upgrade.j2 --- platform/mellanox/mlnx-fw-upgrade.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/mellanox/mlnx-fw-upgrade.j2 b/platform/mellanox/mlnx-fw-upgrade.j2 index 245ce75d5f18..e17ec176503c 100755 --- a/platform/mellanox/mlnx-fw-upgrade.j2 +++ b/platform/mellanox/mlnx-fw-upgrade.j2 @@ -251,7 +251,7 @@ function UpgradeFWFromImage() { } function ExitIfQEMU() { - if [[ $(cat /sys/devices/virtual/dmi/id/chassis_vendor) = "QEMU" ]]; then + if [ -n "$(lspci -vvv | grep SimX)" ]; then ExitSuccess "No FW upgrade for SimX platform" fi }