i2c-imc-skylake: split the submission into a PCI patch and the driver
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.
This commit is contained in:
+124
-6
@@ -9,14 +9,31 @@ on:
|
||||
- main
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
concurrency:
|
||||
group: ci-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
env:
|
||||
I2C_TREE: https://git.kernel.org/pub/scm/linux/kernel/git/andi.shyti/linux.git
|
||||
SPARSE_REPOSITORY: https://git.kernel.org/pub/scm/devel/sparse/sparse.git
|
||||
SPARSE_COMMIT: 00c4b8e75cbf92003bc4a695a223045092b173f3
|
||||
|
||||
jobs:
|
||||
build:
|
||||
out-of-tree:
|
||||
name: Out-of-tree (${{ matrix.compiler }})
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 30
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- compiler: gcc
|
||||
make_args: ""
|
||||
- compiler: clang
|
||||
make_args: LLVM=1
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
@@ -24,20 +41,121 @@ jobs:
|
||||
- name: Install build dependencies
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y build-essential linux-headers-$(uname -r)
|
||||
sudo apt-get install -y build-essential clang llvm linux-headers-$(uname -r)
|
||||
|
||||
# A stock kernel has no pci_mmcfg_read_config() yet, so this exercises
|
||||
# the compat/ shim path. The in-tree job below covers the real thing.
|
||||
- name: Build module
|
||||
run: make
|
||||
run: make W=1 KCFLAGS=-W ${{ matrix.make_args }}
|
||||
|
||||
- name: Run checkpatch
|
||||
if: matrix.compiler == 'gcc'
|
||||
run: make checkpatch
|
||||
|
||||
- name: Check shell scripts
|
||||
if: matrix.compiler == 'gcc'
|
||||
run: |
|
||||
curl -sSLo checkpatch.pl https://raw.githubusercontent.com/torvalds/linux/master/scripts/checkpatch.pl
|
||||
curl -sSLo spelling.txt https://raw.githubusercontent.com/torvalds/linux/master/scripts/spelling.txt
|
||||
perl checkpatch.pl --no-tree --strict --no-summary --show-types -f i2c-imc-skylake.c
|
||||
sudo apt-get install -y shellcheck
|
||||
bash -n test-smoke.sh
|
||||
for f in tools/*.sh; do bash -n "$f"; done
|
||||
shellcheck -S warning test-smoke.sh tools/*.sh
|
||||
|
||||
- name: Upload artifact
|
||||
if: matrix.compiler == 'gcc'
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: i2c-imc-skylake-${{ github.ref_name }}
|
||||
path: i2c-imc-skylake.ko
|
||||
if-no-files-found: error
|
||||
|
||||
in-tree:
|
||||
name: Current i2c-host integration (2-patch series)
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 45
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Install kernel build dependencies
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y bc bison build-essential clang flex libelf-dev libssl-dev llvm
|
||||
|
||||
- name: Build pinned Sparse
|
||||
run: |
|
||||
git clone --filter=blob:none "$SPARSE_REPOSITORY" sparse
|
||||
git -C sparse checkout "$SPARSE_COMMIT"
|
||||
make -C sparse -j"$(nproc)"
|
||||
echo "$PWD/sparse" >> "$GITHUB_PATH"
|
||||
|
||||
- name: Prepare current maintainer tree
|
||||
run: |
|
||||
git clone --depth=1 --branch i2c/i2c-host "$I2C_TREE" linux-i2c
|
||||
# Patch 1/2: the PCI/x86 accessor the driver depends on. If this
|
||||
# stops applying, the tracked copy is stale and must be refreshed
|
||||
# from the kernel tree - that is a real failure, not CI noise.
|
||||
git -C linux-i2c apply --verbose \
|
||||
../docs/submission/0001-pci-mmcfg-accessor.patch
|
||||
# Patch 2/2: the driver itself.
|
||||
cp i2c-imc-skylake.c linux-i2c/drivers/i2c/busses/
|
||||
cat docs/submission/Kconfig.kernel >> linux-i2c/drivers/i2c/busses/Kconfig
|
||||
printf '%s\n' 'obj-$(CONFIG_I2C_IMC_SKYLAKE) += i2c-imc-skylake.o' \
|
||||
>> linux-i2c/drivers/i2c/busses/Makefile
|
||||
git -C linux-i2c rev-parse HEAD
|
||||
|
||||
- name: Configure kernel
|
||||
working-directory: linux-i2c
|
||||
run: |
|
||||
make O=../linux-out x86_64_defconfig
|
||||
scripts/config --file ../linux-out/.config --enable I2C --module I2C_IMC_SKYLAKE
|
||||
make O=../linux-out olddefconfig
|
||||
grep '^CONFIG_I2C_IMC_SKYLAKE=m' ../linux-out/.config
|
||||
grep '^CONFIG_PCI_MMCONFIG=y' ../linux-out/.config
|
||||
|
||||
- name: Build the series in-tree
|
||||
working-directory: linux-i2c
|
||||
run: |
|
||||
make O=../linux-out W=1 \
|
||||
drivers/pci/access.o \
|
||||
arch/x86/pci/mmconfig-shared.o \
|
||||
drivers/i2c/busses/i2c-imc-skylake.o
|
||||
|
||||
- name: Build arm64 COMPILE_TEST with Clang
|
||||
working-directory: linux-i2c
|
||||
run: |
|
||||
make O=../linux-out-arm64 ARCH=arm64 LLVM=1 defconfig
|
||||
scripts/config --file ../linux-out-arm64/.config \
|
||||
--enable COMPILE_TEST --enable PCI --enable I2C \
|
||||
--module I2C_IMC_SKYLAKE
|
||||
make O=../linux-out-arm64 ARCH=arm64 LLVM=1 olddefconfig
|
||||
grep '^CONFIG_I2C_IMC_SKYLAKE=m' ../linux-out-arm64/.config
|
||||
make O=../linux-out-arm64 ARCH=arm64 LLVM=1 W=1 \
|
||||
drivers/pci/access.o \
|
||||
drivers/i2c/busses/i2c-imc-skylake.o
|
||||
|
||||
- name: Run Sparse in-tree
|
||||
working-directory: linux-i2c
|
||||
run: |
|
||||
make O=../linux-out C=2 CF=-D__CHECK_ENDIAN__ \
|
||||
drivers/pci/access.o \
|
||||
arch/x86/pci/mmconfig-shared.o \
|
||||
drivers/i2c/busses/i2c-imc-skylake.o
|
||||
|
||||
- name: Run current-tree checkpatch
|
||||
working-directory: linux-i2c
|
||||
run: |
|
||||
scripts/checkpatch.pl --strict --no-tree -f \
|
||||
drivers/i2c/busses/i2c-imc-skylake.c
|
||||
scripts/checkpatch.pl --strict \
|
||||
../docs/submission/0001-pci-mmcfg-accessor.patch
|
||||
|
||||
- name: Build the documentation
|
||||
working-directory: linux-i2c
|
||||
run: |
|
||||
sudo apt-get install -y python3-sphinx python3-sphinx-rtd-theme
|
||||
cp ../docs/submission/i2c-imc-skylake.rst Documentation/i2c/busses/
|
||||
sed -i 's|^ i2c-i801$| i2c-i801\n i2c-imc-skylake|' \
|
||||
Documentation/i2c/busses/index.rst
|
||||
grep -q i2c-imc-skylake Documentation/i2c/busses/index.rst
|
||||
make O=../linux-out htmldocs SPHINXDIRS=i2c 2>&1 | tee doc.log | tail -20
|
||||
! grep -Ei 'WARNING|ERROR' doc.log
|
||||
|
||||
Reference in New Issue
Block a user