linux/tools/testing/selftests/powerpc/eeh/eeh-vf-unaware.sh
Oliver O'Halloran 38132cc0e5 selftests/powerpc: Add VF recovery tests
The basic EEH test ignores VFs since we the way the eeh_dev_break debugfs
interface works means that if multiple VFs are enabled we may cause errors
on all them them. However, we can work around that by only enabling a
single VF at a time.

This patch adds some infrastructure for finding SR-IOV capable devices and
enabling / disabling VFs so we can exercise the VF specific EEH recovery
paths. Two new tests are added, one for testing EEH aware devices and one
for EEH un-aware VFs.

Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20201103044503.917128-3-oohall@gmail.com
2021-01-31 22:35:47 +11:00

36 lines
633 B
Bash
Executable File

#!/bin/sh
# SPDX-License-Identifier: GPL-2.0-only
. ./eeh-functions.sh
eeh_test_prep # NB: may exit
vf_list="$(eeh_enable_vfs)";
if $? != 0 ; then
log "No usable VFs found. Skipping EEH unaware VF test"
exit $KSELFTESTS_SKIP;
fi
log "Enabled VFs: $vf_list"
failed=0
for vf in $vf_list ; do
log "Testing $vf"
if eeh_can_recover $vf ; then
log "Driver for $vf supports error recovery. Unbinding..."
echo "$vf" > /sys/bus/pci/devices/$vf/driver/unbind
fi
log "Breaking $vf..."
if ! eeh_one_dev $vf ; then
log "$vf failed to recover"
failed="$((failed + 1))"
fi
done
eeh_disable_vfs
test "$failed" != 0
exit $?;