Skip to content

Commit 8ca9c33

Browse files
fmoyenFabrcie MOYEN
andauthored
oc_find_card: Add -d option (debug mode) (#64)
* 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>
1 parent 09ffd86 commit 8ca9c33

File tree

2 files changed

+101
-6
lines changed

2 files changed

+101
-6
lines changed

actions/scripts/oc_jenkins.sh

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,11 @@ function test_all_actions() # $1 = card, $2 = accel
6666
for action in $MY_ACTION ; do
6767
run_test=1;
6868
case $action in
69-
*"10142000")
70-
test_10142000 $card $accel
71-
RC=$?
72-
run_test=0
69+
*"10142000") # HDL Example
70+
cmd="./actions/hdl_example/tests/hw_test.sh"
71+
#test_10142000 $card $accel
72+
#RC=$?
73+
#run_test=0
7374
;;
7475
*"10142002") # HDL NVMe example
7576
cmd="./actions/hdl_single_engine/tests/hw_general_test.sh"

software/tools/oc_find_card

Lines changed: 96 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,17 @@ normal=$(tput sgr0)
3030
# v2.0 : modified Jan 16th 2018 to have -v option providing extra information
3131
# v2.1 : modified Feb 26th 2020 adding AD9Hx in CAPI2 and OC modes
3232
# 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)
33+
# v2.3 : modified April 17th 2020 adding -d (debug) option; Displays DEBUG additional info
3334

34-
version=2.2
35+
version=2.3
3536
accel=UNKNOWN
3637
VERBOSE=0
3738

3839
# Print usage message helper function
3940
function usage() {
4041
echo "Usage: $PROGRAM"
4142
echo " [-v] Prints extra information (to be put as first param)"
43+
echo " [-d] Debug mode to display additional system info"
4244
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"
4345
echo " [-C] <0..3> Print accelerator name for this Card"
4446
echo " [-t] <1..3> Specifies the Type of CAPI: CAPI1.0, CAPI2.0 or OPENCAPI (CAPI3.0)"
@@ -268,12 +270,104 @@ function detect_oc_card_name()
268270
PROGRAM=$0
269271
CardOption=0
270272
type=0
271-
while getopts ":vA:C:Vht:" opt; do
273+
while getopts ":vA:C:Vdht:" opt; do
272274
case ${opt} in
273275
v)
274276
VERBOSE=1
275277
echo oc_find_card version is $version
276278
;;
279+
d)
280+
DEBUG=1
281+
DistribLike=`{ [ -f /etc/os-release ] && grep '^ID=' /etc/os-release | cut -d= -f2 ; } || { [ -f /etc/system-release ] && cat /etc/system-release ; }`
282+
if (echo $DistribLike | egrep -qi 'centos|fedora|rhel'); then DistribLike=fedora; PackageCmd="rpm -qva | grep -i"
283+
elif (echo $DistribLike | egrep -qi 'ubuntu|debian'); then DistribLike=debian; PackageCmd="dpkg -l | grep -i"
284+
else DistribLike=unknown; PackageCmd="echo 'Unknown Distribution !'"
285+
fi
286+
287+
echo;echo "###########################################################################################################"
288+
echo;echo "( ͡° ͜ʖ ͡°) DEBUG INFO (more info if run as root)"
289+
echo
290+
echo "==========================================================================================================="
291+
echo "FIRMWARE INFO:"
292+
echo "--------------"
293+
echo
294+
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)
295+
echo "(Active and LSMCode SKIBOOT may be different if a custom SKIBOOT has been applyied. The 'Active' one is the really running one)"
296+
echo
297+
echo "LSMCODE output:"
298+
lsmcode
299+
echo
300+
echo "Testing /proc/device-tree/ibm,secureboot/secure-enabled existence:"
301+
if [ -f /proc/device-tree/ibm,secureboot/secure-enabled ]; then
302+
echo " file exists ==> Secure-Boot ENABLED"
303+
else
304+
echo " file doesn't exist ==> Secure-Boot DISABLED"
305+
fi
306+
307+
echo
308+
echo "==========================================================================================================="
309+
echo "OS INFO:"
310+
echo "--------"
311+
echo
312+
echo "LINUX distribution: `{ [ -f /etc/os-release ] && grep PRETTY_NAME /etc/os-release | cut -d= -f2 ; } || { [ -f /etc/system-release ] && cat /etc/system-release ; }`"
313+
echo "LINUX version: `{ [ -f /etc/os-release ] && grep '^VERSION=' /etc/os-release | cut -d= -f2 ; } || { [ -f /etc/system-release ] && cat /etc/system-release ; }`"
314+
echo "OS KERNEL release: `uname -r`"; echo
315+
316+
echo
317+
echo "CXL / OCXL installed packages:"
318+
eval $PackageCmd cxl
319+
320+
echo
321+
echo "==========================================================================================================="
322+
echo "PCI ACCELERATOR CARDS:"
323+
echo "----------------------"
324+
echo
325+
echo "PCI cards detected (lspci):"
326+
lspci -nn | grep -i accelerator
327+
echo "(0632: CAPI card, 062b: OPENCAPI card)"
328+
echo
329+
echo "Card installed on non-CAPI PCI slot (dmesg):"
330+
dmesg | grep incompatible
331+
echo
332+
echo "CAPI /dev/cxl directory:"
333+
ls -la /dev/cxl
334+
echo
335+
echo "CAPI /sys/class/cxl directory:"
336+
ls -la /sys/class/cxl
337+
echo
338+
echo "OPENCAPI /dev/ocxl directory:"
339+
ls -la /dev/ocxl
340+
echo
341+
echo "OPENCAPI /sys/class/ocxl directory:"
342+
ls -la /sys/class/ocxl
343+
echo
344+
echo "EEH_MAX_FREEZES: default number of resets allowed per PCI device per hour (/sys/kernel/debug/powerpc/eeh_max_freezes)"
345+
PCIMaxReset=`[ -f /sys/kernel/debug/powerpc/eeh_max_freezes ] && cat /sys/kernel/debug/powerpc/eeh_max_freezes`
346+
printf "%d ($PCIMaxReset)\n" $PCIMaxReset
347+
echo
348+
349+
echo
350+
echo "==========================================================================================================="
351+
echo "OPAL MSGLOG:"
352+
echo "------------"
353+
echo
354+
echo "Looking for 'degraded':"
355+
grep -i degraded /sys/firmware/opal/msglog
356+
echo
357+
echo "Looking for 'OCAPI':"
358+
grep OCAPI /sys/firmware/opal/msglog
359+
echo
360+
echo "OCAPI link information:"
361+
grep OCAPI /sys/firmware/opal/msglog | grep link
362+
363+
echo
364+
echo "==========================================================================================================="
365+
echo "More info could be found in /sys/firmware/opal/msglog rolling file (firmware journal)"
366+
echo "or with dmesg (kernel journal) or journalctl (systemd journal) commands"
367+
echo
368+
echo "( ͡° ͜ʖ ͡°) END OF DEBUG INFO"
369+
echo;echo "###########################################################################################################"
370+
;;
277371
A)
278372
accel=${OPTARG};
279373
;;

0 commit comments

Comments
 (0)