Skip to contentSkip to conversation

i2c: imc-x299: add driver for Intel X299/Skylake-X iMC SMBus engine

PATCH Superseded Simone Chifari 1 participant 1 message Jun 17 I2C subsystem host drivers

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH 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 and BYTE_DATA transfers are implemented; the devices on this bus need nothing more. An optional settle_us module parameter (default 0) inserts a post-write delay for devices that require one.

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 | 475 ++++++++++++++++++++++++++++++
 4 files changed, 501 insertions(+)
 create mode 100644 drivers/i2c/busses/i2c-imc-x299.c
MAINTAINERS +6 -0
index c8d4b913f..bb4b06b5b 100644
@@ -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
index 8c935f867..12732b8ff 100644
@@ -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
index 547123ab3..8c7cb83fd 100644
@@ -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 +475 -0

475 lines not on this page · raw message

Signature · 1 line
2.43.0