Skip to content

Commit 19b597e

Browse files
committed
bfb-install: add command syntax for lfwp
This commit adds command syntax for lfwp. -l | --lfwp: enable lfwp flow -a | --activate: activate lfwp If only '--lfwp' is specified, it'll do activation by default unless '--activate=0' is specified. RM #4449636
1 parent 8f77946 commit 19b597e

File tree

2 files changed

+66
-20
lines changed

2 files changed

+66
-20
lines changed

man/bfb-install.8

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,12 @@ bfb-install \- BFB installing script for BlueField SoC over rshim driver
66
.SH SYNOPSIS
77
.B bfb-install
88
-b, --bfb <bfb_file> -r, --rshim [<ip:>[:port]:]rshim<N>
9+
[-a, --activate <0 | 1>]
910
[-c, --config <config_file>]
1011
[-f, --rootfs <rootfs_file>]
1112
[-h, --help]
1213
[-k, --keep-log]
14+
[-l, --lfwp]
1315
[-m, --remote-mode <scp|nc|ncpipe>]
1416
[-R, --reverse-nc]
1517
[-u, --runtime]
@@ -18,8 +20,8 @@ bfb-install \- BFB installing script for BlueField SoC over rshim driver
1820

1921
.SH DESCRIPTION
2022

21-
bfb-install is a utility script to install BFB images on BlueField SoC over the
22-
rshim driver.
23+
bfb-install is a utility script to install or activate BFB images on
24+
BlueField SoC over the rshim driver.
2325

2426
When the "--rshim" option doesn't provide an "ip" argument, the script will run
2527
in local mode and try to access the local rshim device and install the BFB image
@@ -41,6 +43,13 @@ particularly useful for environments with firewall restrictions on the local
4143
host side.
4244

4345
.SH OPTIONS
46+
.TP
47+
-a, --activate
48+
49+
This argument is used for upgrade activation. For now it's only
50+
used with LFWP (Live-Firmware-Patch). '--lfwp' enables LFWP and does
51+
activation by default unless '--activate=0' is specified.
52+
4453
.TP
4554
-b, --bfb
4655

@@ -69,6 +78,11 @@ Show the help message.
6978

7079
Do not clear rshim log buffer after reading during bfb install.
7180

81+
.TP
82+
-l, --lfwp
83+
84+
This argument is used to enable LFWP (Live-Firmware-Patch).
85+
7286
.TP
7387
-m , --remote-mode
7488

scripts/bfb-install

Lines changed: 50 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,13 @@ usage ()
4848
{
4949
echo "Usage: $0 [options]"
5050
echo "Options:"
51+
echo " -a, --activate <0|1> Activate the upgrade."
5152
echo " -b, --bfb <bfb_file> BFB image file to use."
5253
echo " -c, --config <config_file> Optional configuration file."
5354
echo " -f, --rootfs <rootfs_file> Optional rootfs file."
5455
echo " -h, --help Show help message."
5556
echo " -k, --keep-log Do not clear the log after reading during bfb install."
57+
echo " -l, --lfwp Enable LFWP upgrade."
5658
echo " -m, --remote-mode <mode> Remote mode to use (scp, nc, ncpipe)."
5759
echo " -p, --pldm <pldm_file> PLDM image for runtime upgrade."
5860
echo " -r, --rshim <device> Rshim device, format [<ip>:<port>:]rshim<N>."
@@ -624,6 +626,8 @@ num_bfb=0
624626
num_rshim=0
625627
max_bfb=1
626628
max_rshim=1
629+
lfwp=0
630+
activate=
627631

628632
rshim_node= # rshim device identifier, e.g. rshim0
629633
ip= # IP address for remote host
@@ -637,18 +641,20 @@ pcie_bd="" # PCIE Bus-Device
637641
pf0_bound=0 # PF0 is bound prior to the script run
638642
pf1_bound=0 # PF1 is bound prior to the script run
639643

640-
options=`getopt -n bfb-install -o b:c:f:hkm:p:r:Ruv \
641-
-l bfb:,config:,rootfs:,help,keep-log,remote-mode:,reverse-nc,rshim:,pldm:,runtime,verbose \
644+
options=`getopt -n bfb-install -o a:b:c:f:hklm:p:r:Ruv \
645+
-l activate:,bfb:,config:,rootfs:,help,keep-log,lfwp,remote-mode:,reverse-nc,rshim:,pldm:,runtime,verbose \
642646
-- "$@"`
643647
if [ $? != 0 ]; then echo "Command line error" >&2; exit 1; fi
644648
eval set -- $options
645649
while [ "$1" != -- ]; do
646650
case $1 in
651+
--activate|-a) shift; activate=$1 ;;
647652
--bfb|-b) shift; bfb=$(readlink -f $1) num_bfb=$((num_bfb + 1));;
648653
--config|-c) shift; cfg=$1 ;;
649654
--rootfs|-f) shift; rootfs=$1 ;;
650655
--help|-h) usage; exit 0 ;;
651656
--keep-log|-k) clear_on_read=0 ;;
657+
--lfwp|-l) lfwp=1; runtime=1 ;;
652658
--pldm|-p) shift; pldm=$(readlink -f $1) ;;
653659
--remote-mode|-m) shift; remote_mode=$1 ;;
654660
--rshim|-r) shift; rshim=$1 num_rshim=$((num_rshim + 1));;
@@ -663,7 +669,10 @@ done
663669

664670
# Parameter checks
665671

666-
if [ -z "${bfb}" -a -z "${pldm}" ]; then
672+
# Default activate to the lfwp value.
673+
activate=${activate:-$lfwp}
674+
675+
if [ -z "${bfb}" -a -z "${pldm}" -a ${activate} -eq 0 ]; then
667676
echo "Error: Need to provide either bfb or pldm file."
668677
usage >&2
669678
exit 1
@@ -876,12 +885,7 @@ if [ -n "${pldm}" ]; then
876885

877886
pldm=""
878887
bfb="${TMP_DIR}/pldm/pldm.bfb"
879-
elif [ ${runtime} -eq 1 ]; then
880-
if [ ! -e "${bfb}" ]; then
881-
echo "Error: ${bfb} not found."
882-
exit 1
883-
fi
884-
888+
elif [ ${runtime} -eq 1 -a -e "${bfb}" ]; then
885889
# Convert bundle BFB to flat BFB if needed.
886890
# This conversion is only supported on PCIe host.
887891
is_bundle=$(mlx-mkbfb -d "${bfb}" | grep "In-memory filesystem")
@@ -913,8 +917,8 @@ elif [ ${runtime} -eq 1 ]; then
913917
fi
914918
fi
915919

916-
# Check again if bfb file exists
917-
if [ ! -e "${bfb}" ]; then
920+
# Check again if bfb file exists (if not activate-only).
921+
if [ ! -e "${bfb}" -a ${activate} -eq 0 ]; then
918922
echo "Error: ${bfb} not found."
919923
exit 1
920924
fi
@@ -1013,16 +1017,44 @@ if [ ${nic_mode} -eq 1 -a -n "${pcie_bd}" -a ${runtime} -eq 0 ]; then
10131017
done
10141018
fi
10151019

1016-
# Reactivate NIC_FW
1017-
if which flint &> /dev/null; then
1018-
if [ -n "${pcie_bd}" -a ${runtime} -eq 1 ]; then
1020+
# Reactivate NIC_FW if runtime but not LFWP.
1021+
if [ ${lfwp} -eq 0 -a -n "${pcie_bd}" -a ${runtime} -eq 1 ]; then
1022+
if which flint &> /dev/null; then
10191023
# Suppress errors if already activated.
10201024
flint -d ${pcie_bd}.0 ir >&/dev/null
1025+
else
1026+
echo "Flint not found. Skip NIC_FW reactivation."
10211027
fi
1022-
else
1023-
echo "Flint not found. Skip NIC_FW reactivation."
10241028
fi
10251029

1026-
push_boot_stream
1030+
# Push BFB and wait for result.
1031+
if [ -e "${bfb}" ]; then
1032+
push_boot_stream
1033+
wait_for_update_to_finish
1034+
fi
1035+
1036+
# LFWP activation on PCIe host.
1037+
if [ ${lfwp} -eq 1 -a ${activate} -eq 1 ]; then
1038+
if [ -z "${pcie_bd}" ]; then
1039+
echo "ERROR: Failed to activate LFWP, PCIe device not found."
1040+
exit 1
1041+
fi
1042+
1043+
if ! which mlxfwreset &> /dev/null; then
1044+
echo "ERROR: Failed to activate LFWP, mlxfwreset not found."
1045+
exit 1
1046+
fi
10271047

1028-
wait_for_update_to_finish
1048+
# Best-effort to check and apply L0 reset.
1049+
if (mlxfwreset -d ${pcie_bd}.0 q | grep live-Patch | grep -qw "\-Supported"); then
1050+
echo "Live Patch NIC Firmware reset is supported."
1051+
msg=$(mlxfwreset -d ${pcie_bd}.0 -y -l 0 r 2>&1)
1052+
if [ $? -ne 0 ]; then
1053+
echo "ERROR: Live Patch NIC Firmware reset failed. $msg"
1054+
else
1055+
echo "Live Patch NIC Firmware reset done"
1056+
fi
1057+
else
1058+
echo "Live Patch NIC Firmware reset not supported."
1059+
fi
1060+
fi

0 commit comments

Comments
 (0)