tools/testing/selftests/powerpc/scripts/hmi.sh
Source file repositories/reference/linux-study-clean/tools/testing/selftests/powerpc/scripts/hmi.sh
File Facts
- System
- Linux kernel
- Corpus path
tools/testing/selftests/powerpc/scripts/hmi.sh- Extension
.sh- Size
- 2403 bytes
- Lines
- 83
- Domain
- Support Tooling And Documentation
- Bucket
- tools
- Inferred role
- Support Tooling And Documentation: tools
- Status
- atlas-only
Why This File Exists
Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
Dependency Surface
- No C-style include directives detected by the generator.
Detected Declarations
- No top-level syscall, struct, function, initcall, or export declaration detected by the generator.
Annotated Snippet
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0-only
#
# Copyright 2015, Daniel Axtens, IBM Corporation
#
# do we have ./getscom, ./putscom?
if [ -x ./getscom ] && [ -x ./putscom ]; then
GETSCOM=./getscom
PUTSCOM=./putscom
elif which getscom > /dev/null; then
GETSCOM=$(which getscom)
PUTSCOM=$(which putscom)
else
cat <<EOF
Can't find getscom/putscom in . or \$PATH.
See https://github.com/open-power/skiboot.
The tool is in external/xscom-utils
EOF
exit 1
fi
# We will get 8 HMI events per injection
# todo: deal with things being offline
expected_hmis=8
COUNT_HMIS() {
dmesg | grep -c 'Harmless Hypervisor Maintenance interrupt'
}
# massively expand snooze delay, allowing injection on all cores
ppc64_cpu --smt-snooze-delay=1000000000
# when we exit, restore it
trap "ppc64_cpu --smt-snooze-delay=100" 0 1
# for each chip+core combination
# todo - less fragile parsing
grep -E -o 'OCC: Chip [0-9a-f]+ Core [0-9a-f]' < /sys/firmware/opal/msglog |
while read chipcore; do
chip=$(echo "$chipcore"|awk '{print $3}')
core=$(echo "$chipcore"|awk '{print $5}')
fir="0x1${core}013100"
# verify that Core FIR is zero as expected
if [ "$($GETSCOM -c 0x${chip} $fir)" != 0 ]; then
echo "FIR was not zero before injection for chip $chip, core $core. Aborting!"
echo "Result of $GETSCOM -c 0x${chip} $fir:"
$GETSCOM -c 0x${chip} $fir
echo "If you get a -5 error, the core may be in idle state. Try stress-ng."
echo "Otherwise, try $PUTSCOM -c 0x${chip} $fir 0"
exit 1
fi
# keep track of the number of HMIs handled
old_hmis=$(COUNT_HMIS)
# do injection, adding a marker to dmesg for clarity
echo "Injecting HMI on core $core, chip $chip" | tee /dev/kmsg
# inject a RegFile recoverable error
if ! $PUTSCOM -c 0x${chip} $fir 2000000000000000 > /dev/null; then
echo "Error injecting. Aborting!"
exit 1
fi
# now we want to wait for all the HMIs to be processed
# we expect one per thread on the core
i=0;
new_hmis=$(COUNT_HMIS)
while [ $new_hmis -lt $((old_hmis + expected_hmis)) ] && [ $i -lt 12 ]; do
Annotation
- Atlas domain: Support Tooling And Documentation / tools.
- Implementation status: atlas-only.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.