Skip to content

Commit

Permalink
oc_find_card: Add -d option (debug mode) (#64)
Browse files Browse the repository at this point in the history
* Added -t option

* Typo
* Added distinction between CAPI and OPENCAPI with -C option
* oc_find_card: working like before if no -t option
* oc_find_card: usage function
* oc_find_card: specific case (GZIP) and CAPI1 only cards
* oc_find_card: Added AD9H7 and U50 CAPI2 cards
* oc_jenkins.sh: using oc-find-card -t3 option
* oc_jenkins.sh: hdl_example => hw_test.sh
* software/tools/oc_find_card: Added -d debug option
Signed-off-by: Fabrcie MOYEN <fmoyen@lewen05.dcry.iccmop>

* software/tools/oc_find_card: debug mode modifications
Signed-off-by: Fabrice MOYEN <fabrice_moyen@fr.ibm.com>

Co-authored-by: Fabrcie MOYEN <fmoyen@lewen05.dcry.iccmop>
  • Loading branch information
fmoyen and Fabrcie MOYEN authored Apr 29, 2020
1 parent 09ffd86 commit 8ca9c33
Show file tree
Hide file tree
Showing 2 changed files with 101 additions and 6 deletions.
9 changes: 5 additions & 4 deletions actions/scripts/oc_jenkins.sh
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,11 @@ function test_all_actions() # $1 = card, $2 = accel
for action in $MY_ACTION ; do
run_test=1;
case $action in
*"10142000")
test_10142000 $card $accel
RC=$?
run_test=0
*"10142000") # HDL Example
cmd="./actions/hdl_example/tests/hw_test.sh"
#test_10142000 $card $accel
#RC=$?
#run_test=0
;;
*"10142002") # HDL NVMe example
cmd="./actions/hdl_single_engine/tests/hw_general_test.sh"
Expand Down
98 changes: 96 additions & 2 deletions software/tools/oc_find_card
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,17 @@ normal=$(tput sgr0)
# v2.0 : modified Jan 16th 2018 to have -v option providing extra information
# v2.1 : modified Feb 26th 2020 adding AD9Hx in CAPI2 and OC modes
# v2.2 : modified March 19th 2020 adding -t (accel type) option; this is to prevent reporting 2 cards (1 CAPI2, 1 OpenCAPI) as only 1 card with 2 characteristics (both have $card ID=0)
# v2.3 : modified April 17th 2020 adding -d (debug) option; Displays DEBUG additional info

version=2.2
version=2.3
accel=UNKNOWN
VERBOSE=0

# Print usage message helper function
function usage() {
echo "Usage: $PROGRAM"
echo " [-v] Prints extra information (to be put as first param)"
echo " [-d] Debug mode to display additional system info"
echo " [-A] <accelerator> use either ADKU3, N250S, S121B_BPIx16, S121B_SPIx4, AD8K5, RCXVUP, FX609, S241, N250SP, AD9V3, OC-AD9V3, AD9H3, OC-AD9H3, AD9H7, OC-AD9H7, U200 or ALL"
echo " [-C] <0..3> Print accelerator name for this Card"
echo " [-t] <1..3> Specifies the Type of CAPI: CAPI1.0, CAPI2.0 or OPENCAPI (CAPI3.0)"
Expand Down Expand Up @@ -268,12 +270,104 @@ function detect_oc_card_name()
PROGRAM=$0
CardOption=0
type=0
while getopts ":vA:C:Vht:" opt; do
while getopts ":vA:C:Vdht:" opt; do
case ${opt} in
v)
VERBOSE=1
echo oc_find_card version is $version
;;
d)
DEBUG=1
DistribLike=`{ [ -f /etc/os-release ] && grep '^ID=' /etc/os-release | cut -d= -f2 ; } || { [ -f /etc/system-release ] && cat /etc/system-release ; }`
if (echo $DistribLike | egrep -qi 'centos|fedora|rhel'); then DistribLike=fedora; PackageCmd="rpm -qva | grep -i"
elif (echo $DistribLike | egrep -qi 'ubuntu|debian'); then DistribLike=debian; PackageCmd="dpkg -l | grep -i"
else DistribLike=unknown; PackageCmd="echo 'Unknown Distribution !'"
fi

echo;echo "###########################################################################################################"
echo;echo "( ͡° ͜ʖ ͡°) DEBUG INFO (more info if run as root)"
echo
echo "==========================================================================================================="
echo "FIRMWARE INFO:"
echo "--------------"
echo
echo "Active SKIBOOT firmware release: `cat /proc/device-tree/ibm,opal/firmware/version | tr -d '\0'` (/proc/device-tree/ibm,opal/firmware/version)" # tr strips NUL bytes (ubuntu warns if not doing)
echo "(Active and LSMCode SKIBOOT may be different if a custom SKIBOOT has been applyied. The 'Active' one is the really running one)"
echo
echo "LSMCODE output:"
lsmcode
echo
echo "Testing /proc/device-tree/ibm,secureboot/secure-enabled existence:"
if [ -f /proc/device-tree/ibm,secureboot/secure-enabled ]; then
echo " file exists ==> Secure-Boot ENABLED"
else
echo " file doesn't exist ==> Secure-Boot DISABLED"
fi

echo
echo "==========================================================================================================="
echo "OS INFO:"
echo "--------"
echo
echo "LINUX distribution: `{ [ -f /etc/os-release ] && grep PRETTY_NAME /etc/os-release | cut -d= -f2 ; } || { [ -f /etc/system-release ] && cat /etc/system-release ; }`"
echo "LINUX version: `{ [ -f /etc/os-release ] && grep '^VERSION=' /etc/os-release | cut -d= -f2 ; } || { [ -f /etc/system-release ] && cat /etc/system-release ; }`"
echo "OS KERNEL release: `uname -r`"; echo

echo
echo "CXL / OCXL installed packages:"
eval $PackageCmd cxl

echo
echo "==========================================================================================================="
echo "PCI ACCELERATOR CARDS:"
echo "----------------------"
echo
echo "PCI cards detected (lspci):"
lspci -nn | grep -i accelerator
echo "(0632: CAPI card, 062b: OPENCAPI card)"
echo
echo "Card installed on non-CAPI PCI slot (dmesg):"
dmesg | grep incompatible
echo
echo "CAPI /dev/cxl directory:"
ls -la /dev/cxl
echo
echo "CAPI /sys/class/cxl directory:"
ls -la /sys/class/cxl
echo
echo "OPENCAPI /dev/ocxl directory:"
ls -la /dev/ocxl
echo
echo "OPENCAPI /sys/class/ocxl directory:"
ls -la /sys/class/ocxl
echo
echo "EEH_MAX_FREEZES: default number of resets allowed per PCI device per hour (/sys/kernel/debug/powerpc/eeh_max_freezes)"
PCIMaxReset=`[ -f /sys/kernel/debug/powerpc/eeh_max_freezes ] && cat /sys/kernel/debug/powerpc/eeh_max_freezes`
printf "%d ($PCIMaxReset)\n" $PCIMaxReset
echo

echo
echo "==========================================================================================================="
echo "OPAL MSGLOG:"
echo "------------"
echo
echo "Looking for 'degraded':"
grep -i degraded /sys/firmware/opal/msglog
echo
echo "Looking for 'OCAPI':"
grep OCAPI /sys/firmware/opal/msglog
echo
echo "OCAPI link information:"
grep OCAPI /sys/firmware/opal/msglog | grep link

echo
echo "==========================================================================================================="
echo "More info could be found in /sys/firmware/opal/msglog rolling file (firmware journal)"
echo "or with dmesg (kernel journal) or journalctl (systemd journal) commands"
echo
echo "( ͡° ͜ʖ ͡°) END OF DEBUG INFO"
echo;echo "###########################################################################################################"
;;
A)
accel=${OPTARG};
;;
Expand Down

0 comments on commit 8ca9c33

Please sign in to comment.