i2c: imc-x299: add Intel X299 iMC SMBus adapter
v2 cover i2c: imc-x299: add Intel X299 iMC SMBus adapter
This series adds a driver for the integrated memory controller (iMC) SMBus engine on Intel Skylake-X / Cascade Lake-X processors (socket LGA 2066, platform X299, PCU function 8086:2085).
The engine provides two SMBus channels — one per pair of DIMM slots — over which SPD EEPROMs, DDR4 thermal sensors and third-party LED controllers (e.g. ENE KB9012 at 0x27) are accessible. Exposing it as a pair of standard Linux I2C adapters lets existing tools (i2c-tools, lm-sensors) use it without bespoke sysfs hacks.
Why ECAM MMIO instead of pci_{read,write}_config_dword
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
On X299 the kernel selects "configuration type 1" (CF8/CFC port I/O) for PCI config space access, as reported by boot-time dmesg:
PCI: Using configuration type 1 for base access
System Management Mode traps writes to those ports for this device, so a standard pci_write_config_dword() targeting the SMBus DATA register never reaches the hardware — the transaction hangs at status bit 0x08 indefinitely. The Windows NTIOLib (used by Kingston FURY) reaches the same registers via the ECAM (MMIO) window, which is not trapped. This driver follows the same path:ioremap() of the ECAM page for the target function and driving the registers by MMIO read/write.
Note that pci_mmcfg_* helpers are arch-internal and not exported to modules, so a manual walk of the ACPI MCFG table is used to locate mmcfg_base at probe time (no module parameter, no hardcoding).
Relation to prior iMC SMBus work
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Two previous attempts to upstream an iMC SMBus driver exist:
- Lutomirski 2013–2016 (Sandy Bridge-EP 8086:3ca8): used CF8/CFC pci_read/write_config_dword — correct on that platform since SMM does not trap those ports on Sandy Bridge-EP. Not merged due to missing bus arbitration (BMC / CLTT sharing) and a required allow_unsafe_access flag.
- schaecsn 2020 (Broadwell-E 8086:6fa8): added TSOD arbitration using the Broadwell-documented tsod_polling_interval quiesce procedure. Not merged (no reviewer response); register layout differs from X299.
This driver is for a different device ID (0x2085), different register layout (DATA/STATUS/CTRL at 0x9C-0xB8 vs 0x180-0x188), and a fundamentally different access method (ECAM ioremap). Combining it with the Lutomirski/schaecsn code would require a large per-generation hw_data table with mutually incompatible access methods; a separate file is cleaner.
The X299 HEDT (High-End Desktop) platform has no BMC and no CLTT firmware polling, so the arbitration safety concern of the Lutomirski patch does not apply. No allow_unsafe_access flag is needed.
Testing
~~~~~~~
Tested on: ASUS TUF X299 Mark 1, Intel Core i9-10900X, 4× Kingston FURY HyperX DDR4-3000 16 GB, kernel 7.0.0-14-generic (Linux Mint 22.3).
$ i2cdetect -l | grep iMC i2c-7 smbus iMC SMBus X299 channel 0 SMBus adapter i2c-8 smbus iMC SMBus X299 channel 1 SMBus adapter
Since the hardware only supports register-offset transactions (SMBus BYTE_DATA), zero-length writes (QUICK) and offset-less transactions (BYTE) are not supported (returning -EOPNOTSUPP), so standard i2cdetect scans do not list devices. However, standard kernel drivers such as ee1004 (for DDR4 SPD) load and bind successfully, accessing the EEPROMs via standard BYTE_DATA reads.
udev autoloads the module on PCI add event (MODULE_DEVICE_TABLE present). 20 rmmod/modprobe cycles: no oops, no warnings, no resource leaks in dmesg.
Simone Chifari (1):
i2c: imc-x299: add driver for Intel X299/Skylake-X iMC SMBus engine
MAINTAINERS | 6 + drivers/i2c/busses/Kconfig | 19 ++ drivers/i2c/busses/Makefile | 1 + drivers/i2c/busses/i2c-imc-x299.c | 435 ++++++++++++++++++++++++++++++ 4 files changed, 461 insertions(+) create mode 100644 drivers/i2c/busses/i2c-imc-x299.c
Signature · 1 line
2.43.0
PATCH v2 1/1 i2c: imc-x299: add driver for Intel X299/Skylake-X iMC SMBus engine
The integrated memory controller (iMC) on Intel Skylake-X / Cascade Lake-X (X299, PCU function 8086:2085) exposes an SMBus engine that reaches the DDR4 DIMM SPD EEPROMs and thermal sensors. Present it as two standard I2C adapters (one per hardware SMBus channel) so that i2c-tools and lm-sensors can use it.
The engine is driven through the PCI configuration space of the PCU function. On this platform System Management Mode traps CF8/CFC port-based config writes to this function, so pci_write_config_dword() never completes. The MMCONFIG (ECAM) window is not trapped, so the driver ioremap()s the ECAM page of the function and drives the registers by MMIO, locating the MMCONFIG base via a manual walk of the ACPI MCFG table (the pci_mmcfg_* helpers are not exported to modules).
Relation to prior iMC SMBus work: two earlier attempts to upstream an iMC SMBus driver exist. Lutomirski (2013-2016, Sandy Bridge-EP 8086:3ca8) used CF8/CFC pci_{read,write}_config_dword, which is correct on that platform because SMM does not trap those ports there; it was not merged, largely over missing BMC/CLTT bus arbitration and a required allow_unsafe_access flag. schaecsn (2020, Broadwell-E 8086:6fa8) added TSOD arbitration but saw no reviewer response. This device is a different ID (0x2085), with a different register layout (DATA/STATUS/CTRL at 0x9C-0xB8 vs 0x180-0x188) and a fundamentally different access method (ECAM MMIO), so a separate file is cleaner than a per-generation hw_data table with mutually incompatible access paths. The X299 HEDT platform has no BMC and no CLTT firmware polling, so the arbitration concern does not apply and no allow_unsafe_access flag is needed.
Only SMBus BYTE_DATA transfers are implemented; the devices on this bus need nothing more.
Tested on ASUS TUF X299 Mark 1 (i9-10900X, 4x Kingston FURY DDR4): both channels enumerate, SPD EEPROMs are readable, udev autoloads the module, and 20 rmmod/modprobe cycles run clean with no oops or leaks.
--- MAINTAINERS | 6 + drivers/i2c/busses/Kconfig | 19 ++ drivers/i2c/busses/Makefile | 1 + drivers/i2c/busses/i2c-imc-x299.c | 435 ++++++++++++++++++++++++++++++ 4 files changed, 461 insertions(+) create mode 100644 drivers/i2c/busses/i2c-imc-x299.c
MAINTAINERS +6 -0
@@ -13374,6 +13374,12 @@ L: [email protected] S: Orphan F: drivers/net/wwan/iosm/ +INTEL X299 iMC SMBUS DRIVER +M: Simone Chifari <[email protected]> +L: [email protected] +S: Maintained +F: drivers/i2c/busses/i2c-imc-x299.c + INTEL(R) FLEXIBLE RETURN AND EVENT DELIVERY M: Xin Li <[email protected]> M: "H. Peter Anvin" <[email protected]>
drivers/i2c/busses/Kconfig +19 -0
@@ -180,6 +180,25 @@ config I2C_I801_MUX Optional support for multiplexed SMBUS on certain systems with more than 8 memory slots. +config I2C_IMC_X299 + tristate "Intel X299 / Skylake-X iMC SMBus adapter" + depends on PCI && ACPI && X86 + help + Say Y here if you want kernel support for the integrated memory + controller (iMC) SMBus engine found in Intel Skylake-X / Cascade + Lake-X processors (socket LGA 2066, platform X299, PCU function + 8086:2085). + + The engine is exposed through the PCI configuration space of the + PCU function and is driven via ECAM MMIO (not CF8/CFC port I/O, + which is trapped by System Management Mode on this platform). + Two I2C adapters are registered, one per hardware SMBus channel, + allowing access to DDR4 DIMM SPD EEPROMs (0x50-0x57) and thermal + sensors from userspace via standard i2c-tools and lm-sensors. + + If unsure, say N. This driver is only useful on Intel X299 desktop + / HEDT systems with the Skylake-X or Cascade Lake-X CPU. + config I2C_ISCH tristate "Intel SCH SMBus 1.0" depends on PCI && HAS_IOPORT
drivers/i2c/busses/Makefile +1 -0
@@ -17,6 +17,7 @@ obj-$(CONFIG_I2C_AMD756) += i2c-amd756.o obj-$(CONFIG_I2C_AMD8111) += i2c-amd8111.o obj-$(CONFIG_I2C_CHT_WC) += i2c-cht-wc.o obj-$(CONFIG_I2C_I801) += i2c-i801.o +obj-$(CONFIG_I2C_IMC_X299) += i2c-imc-x299.o obj-$(CONFIG_I2C_ISCH) += i2c-isch.o obj-$(CONFIG_I2C_ISMT) += i2c-ismt.o obj-$(CONFIG_I2C_NFORCE2) += i2c-nforce2.o
drivers/i2c/busses/i2c-imc-x299.c new file +435 -0
435 lines not on this page · raw message
Signature · 1 line
2.43.0