The driver reached the PCU function's config space by walking the ACPI MCFG
table and mapping the ECAM page itself. That is one leaf driver deciding
config-space policy, and no other driver in mainline does it, so it was the
single most likely reason for a NAK.
Move that decision where it belongs: the upstream series is now two patches,
a PCI/x86 accessor that forces the memory-mapped path with the core's
locking, and this driver on top of it. Reviewers on each side now get
something they can act on, and get_maintainer.pl selects the PCI and x86
people by itself.
Correctness work in the same pass:
- the completion bits are latched, so a command the engine never accepted
was indistinguishable from a completed one and returned the previous
transaction's data as valid. Require a positive sign that the engine
acted on the command;
- compare the command registers after every transfer against what the
driver left in them and fail with -EAGAIN on a mismatch. The original
iMC driver had this check and it is what makes an unarbitrated system
detectable instead of silently wrong;
- use the i2c core's suspended-adapter mechanism rather than a private
flag and -EHOSTDOWN;
- use devm_mutex_init(), drop the unnecessary pci_enable_device(), and
return -ENODEV rather than -EPERM from the default-off gate, which was
printing a driver-core error on every boot;
- mask GO when restoring a saved command word.
Stop attributing the dropped CF8/CFC write to System Management Mode. The
only evidence was a boot log line naming the access method, which says
nothing about who filters the write. tools/probe-cf8-write.sh is there to
settle it with an MSR_SMI_COUNT measurement.
Add Documentation/i2c/busses/i2c-imc-skylake.rst, which every other PC SMBus
driver has and which was explicitly asked for on the 2020 iMC thread, the
tools/ scripts for the hardware measurements the submission still owes, and
compat/pci-mmcfg-compat.h so the driver still builds out-of-tree against a
kernel without the new accessor while the source stays byte-identical to the
submitted patch.
72 lines
1.7 KiB
Bash
Executable File
72 lines
1.7 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Report changes to the iMC SMBus engine registers that Linux did not cause.
|
|
# Read-only. Run with the driver unloaded so anything observed is firmware.
|
|
set -euo pipefail
|
|
|
|
# shellcheck source=tools/common.sh
|
|
source "$(dirname "$(readlink -f "$0")")/common.sh"
|
|
|
|
SECONDS_TOTAL=3600
|
|
INTERVAL=1
|
|
|
|
while (($#)); do
|
|
case $1 in
|
|
--seconds) SECONDS_TOTAL=$2; shift 2 ;;
|
|
--interval) INTERVAL=$2; shift 2 ;;
|
|
-h|--help)
|
|
echo "usage: $0 [--seconds N] [--interval N]"
|
|
exit 0
|
|
;;
|
|
*) die "unknown argument: $1" ;;
|
|
esac
|
|
done
|
|
|
|
require_root
|
|
require_cmd lspci setpci awk
|
|
|
|
BDF=$(find_pcu)
|
|
|
|
if driver_is_loaded; then
|
|
echo "warning: i2c-imc-skylake is loaded; changes may be caused by Linux." >&2
|
|
echo " unload it for a clean firmware-activity measurement." >&2
|
|
fi
|
|
|
|
echo "device: $BDF"
|
|
echo "duration: ${SECONDS_TOTAL}s, sampling every ${INTERVAL}s"
|
|
echo "started: $(date -Is)"
|
|
echo
|
|
|
|
mapfile -t previous < <(snapshot_regs "$BDF")
|
|
printf 'baseline: %s\n' "${previous[*]}"
|
|
|
|
changes=0
|
|
samples=0
|
|
deadline=$((SECONDS + SECONDS_TOTAL))
|
|
|
|
while ((SECONDS < deadline)); do
|
|
sleep "$INTERVAL"
|
|
mapfile -t current < <(snapshot_regs "$BDF")
|
|
((samples++))
|
|
|
|
for i in "${!current[@]}"; do
|
|
if [[ "${current[i]}" != "${previous[i]}" ]]; then
|
|
printf '%s CHANGE %s -> %s\n' \
|
|
"$(date -Is)" "${previous[i]}" "${current[i]}"
|
|
((changes++))
|
|
fi
|
|
done
|
|
previous=("${current[@]}")
|
|
done
|
|
|
|
echo
|
|
echo "finished: $(date -Is)"
|
|
echo "samples: $samples"
|
|
echo "changes: $changes"
|
|
echo
|
|
if ((changes == 0)); then
|
|
echo "RESULT: no foreign activity observed on this system over ${SECONDS_TOTAL}s."
|
|
else
|
|
echo "RESULT: the engine is in use by something other than Linux."
|
|
echo " Do not load i2c-imc-skylake on this system."
|
|
fi
|