iMC SMBUS, TSOD hwmon devices, and eeprom modalias
v3 cover iMC SMBUS, TSOD hwmon devices, and eeprom modalias
Intel LGA2011 machines have dedicated SMBUS controllers for DIMM sockets. Because they're dedicated, they can be safely and accurately probed, since all devices on them are known to be attached to DIMMs. The devices found are:
- SPD EEPROMs
- TSODs (Temperature Sensor on DIMMs), a JEDEC standard device
- Other interesting things, with drivers hopefully to follow...
This patch series adds a simple generic layer for probing for DIMMs over SMBUS, an i2c bus driver for the iMC controller found on Intel LGA2011 chips, and a modalias for the eeprom driver so it can be automatically loaded.
I've tested this on a Core i7 Extreme and on a Xeon E5 server. With this series applied, sensors shows (on the Xeon E5):
TSOD-i2c-1-18
Adapter: iMC socket 0 channel 0
DIMM Temperature: +35.2°C
TSOD-i2c-1-1c
Adapter: iMC socket 0 channel 0
DIMM Temperature: +33.0°C
TSOD-i2c-3-18
Adapter: iMC socket 1 channel 0
DIMM Temperature: +34.0°C
TSOD-i2c-3-1c
Adapter: iMC socket 1 channel 0
DIMM Temperature: +27.2°C
with no need for any userspace probing or manual module loading. decode-dimms works on both machines, again without any manual module loading.
The whole series is available on git here (against v3.9.7):
https://git.kernel.org/cgit/linux/kernel/git/luto/linux.git/log/?h=i2c_imc/patch_v3
Changes from earlier versions:
- Dropped changes to core I2C_CLASS_SPD probing
- Cleanup up i2c_imc driver
- Added dimm-bus, tsod driver, and eeprom modalias
Andy Lutomirski (4):
i2c: Add DIMM bus code
i2c_imc: New driver for Intel's iMC, found on LGA2011 chips
tsod: New hwmon driver for Temperature Sensors on DIMM
eeprom: Add a MODULE_DEVICE_TABLE
drivers/hwmon/Kconfig | 10 + drivers/hwmon/Makefile | 1 + drivers/hwmon/tsod.c | 195 +++++++++++++++ drivers/i2c/busses/Kconfig | 19 ++ drivers/i2c/busses/Makefile | 5 + drivers/i2c/busses/dimm-bus.c | 84 +++++++ drivers/i2c/busses/i2c-imc.c | 548 ++++++++++++++++++++++++++++++++++++++++++ drivers/misc/eeprom/eeprom.c | 1 + include/linux/i2c/dimm-bus.h | 24 ++ 9 files changed, 887 insertions(+) create mode 100644 drivers/hwmon/tsod.c create mode 100644 drivers/i2c/busses/dimm-bus.c create mode 100644 drivers/i2c/busses/i2c-imc.c create mode 100644 include/linux/i2c/dimm-bus.h
Signature · 1 line
1.8.1.4
A message that is not in the archive (sent off-list or not yet received): cover.1374093761.git.luto-kltTT9wpgjJwATOyAt5JVQ@public.gmane.org
PATCH v3 1/4 i2c: Add DIMM bus code
Add i2c_scan_dimm_bus to declare that a particular i2c_adapter contains DIMMs. This will probe (and autoload modules!) for useful SMBUS devices that live on DIMMs.
As more SMBUS-addressable DIMM components become supported, this code can be extended to probe for them.
--- drivers/i2c/busses/Kconfig | 4 +++ drivers/i2c/busses/Makefile | 4 +++ drivers/i2c/busses/dimm-bus.c | 84 +++++++++++++++++++++++++++++++++++++++++++ include/linux/i2c/dimm-bus.h | 24 +++++++++++++ 4 files changed, 116 insertions(+) create mode 100644 drivers/i2c/busses/dimm-bus.c create mode 100644 include/linux/i2c/dimm-bus.h
drivers/i2c/busses/Kconfig +4 -0
@@ -133,6 +133,10 @@ config I2C_ISMT This driver can also be built as a module. If so, the module will be called i2c-ismt. +config I2C_DIMM_BUS + tristate + default n + config I2C_PIIX4 tristate "Intel PIIX4 and compatible (ATI/AMD/Serverworks/Broadcom/SMSC)" depends on PCI
drivers/i2c/busses/Makefile +4 -0
@@ -24,6 +24,10 @@ obj-$(CONFIG_I2C_SIS96X) += i2c-sis96x.o obj-$(CONFIG_I2C_VIA) += i2c-via.o obj-$(CONFIG_I2C_VIAPRO) += i2c-viapro.o +# DIMM busses +obj-$(CONFIG_I2C_DIMM_BUS) += dimm-bus.o +obj-$(CONFIG_I2C_IMC) += i2c-imc.o + # Mac SMBus host controller drivers obj-$(CONFIG_I2C_HYDRA) += i2c-hydra.o obj-$(CONFIG_I2C_POWERMAC) += i2c-powermac.o
drivers/i2c/busses/dimm-bus.c new file +84 -0
84 lines not on this page · raw message
include/linux/i2c/dimm-bus.h new file +24 -0
@@ -0,0 +1,24 @@ +/* +* Copyright (c) 2013 Andrew Lutomirski <[email protected]> +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 +* as published by the Free Software Foundation. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifndef _I2C_DIMM_BUS +#define _I2C_DIMM_BUS + +struct i2c_adapter ; +void i2c_scan_dimm_bus (struct i2c_adapter *adapter); + +#endif /* _I2C_DIMM_BUS */
Signature · 1 line
1.8.1.4
A message that is not in the archive (sent off-list or not yet received): b8e50b55358b4f0cd1db96174a9e6a2e69780359.1374093761.git.luto-kltTT9wpgjJwATOyAt5JVQ@public.gmane.org
Re: [PATCH v3 1/4] i2c: Add DIMM bus code
Quoted 7 lines · Andy Lutomirski
Add
i2c_scan_dimm_busto declare that a particulari2c_adaptercontains DIMMs. This will probe (and autoload modules!) for useful SMBUS devices that live on DIMMs.As more SMBUS-addressable DIMM components become supported, this code can be extended to probe for them.
I don't think this code is necessary. The temperature sensor would be auto-detected if you mark the bus driver as I2C_CLASS_HWMON, and DIM eeprom auto-detection should not be needed.
Guenter
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [PATCH v3 1/4] i2c: Add DIMM bus code
Quoted 11 lines · Guenter Roeck
Quoted 7 lines · Andy Lutomirski
Add
i2c_scan_dimm_busto declare that a particulari2c_adaptercontains DIMMs. This will probe (and autoload modules!) for useful SMBUS devices that live on DIMMs.As more SMBUS-addressable DIMM components become supported, this code can be extended to probe for them.
I don't think this code is necessary. The temperature sensor would be auto-detected if you mark the bus driver as
I2C_CLASS_HWMON, and DIM eeprom auto-detection should not be needed.
I'm not at all sure I want to mark this thing I2C_CLASS_HWMON. I don't want random hwmon drivers probing the bus. (Although I wouldn't need to -- jc42 is looking for I2C_CLASS_SPD.)
Also, my code is IMO better than the i2c core probing code for several reasons:
- i2c_imc is incompatible with the i2c core class-based detection
code because it can't do a read byte operation. I believe that, because of exactly this limitation, devices soldered onto DIMMs are unlikely to ever require this operation. (LGA2011 is the premier platform for interesting DIMM-like devices right now.) So I'd have to modify the i2c core with more nasty hard-coded lists of what can be safely probed how, and ISTM that kind of thing is better handled in code that runs on busses that are really known to contain DIMMs (and not, say, i2c-gpio).
- The eventual goal is to write a driver for NVDIMMs, which will also
appear on this bus, and I want them to pull in the right drivers via modalias and udev, which the i2c core code can't do. To do this well, I'll want the SMBUS driver to pass in (via platform-data) information on which DIMM channel is which, and I don't know any way to do anything like that without using i2c_new_device.
- Busses like i2c_i801 may or may not contain DIMMs. They do on some
machines I have. But on my Core i7 Extreme box, there are no DIMMs on that bus, and there are no SPDs on that bus (i.e. addresses 0x50 through 0x57 don't answer), but there is an unknown device at address 0x19. I don't really want to think about whether it's safe to probe by, say, read_word_data(0). When NVDIMMs show up, even more bizarre addresses may be populated. My code can probe *carefully* by looking for SPDs first, whereas the i2c-core code is not nearly as careful.
One option would be to move code like this into the core and replace I2C_CLASS_SPD with something like it. That way everything could get the benefit of DIMM-specific probing.
--Andy
A message that is not in the archive (sent off-list or not yet received): CALCETrVCotmG2PCQUF1BaAcbvnysMbS-kE4SJHoSokgzaML0jg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org
Re: [PATCH v3 1/4] i2c: Add DIMM bus code
Some thoughts on an alternative solution below:
Quoted 29 lines · Andy Lutomirski
Quoted 11 lines · Guenter Roeck
Quoted 7 lines · Andy Lutomirski
Add
i2c_scan_dimm_busto declare that a particulari2c_adaptercontains DIMMs. This will probe (and autoload modules!) for useful SMBUS devices that live on DIMMs.As more SMBUS-addressable DIMM components become supported, this code can be extended to probe for them.
I don't think this code is necessary. The temperature sensor would be auto-detected if you mark the bus driver as
I2C_CLASS_HWMON, and DIM eeprom auto-detection should not be needed.I'm not at all sure I want to mark this thing
I2C_CLASS_HWMON. I don't want random hwmon drivers probing the bus. (Although I wouldn't need to -- jc42 is looking forI2C_CLASS_SPD.)Also, my code is IMO better than the i2c core probing code for several reasons:
-
i2c_imcis incompatible with the i2c core class-based detection
code because it can't do a read byte operation. I believe that, because of exactly this limitation, devices soldered onto DIMMs are unlikely to ever require this operation. (LGA2011 is the premier platform for interesting DIMM-like devices right now.) So I'd have to modify the i2c core with more nasty hard-coded lists of what can be safely probed how, and ISTM that kind of thing is better handled in code that runs on busses that are really known to contain DIMMs (and not, say, i2c-gpio).
Quoted 6 lines
- The eventual goal is to write a driver for NVDIMMs, which will also
appear on this bus, and I want them to pull in the right drivers via modalias and udev, which the i2c core code can't do. To do this well, I'll want the SMBUS driver to pass in (via platform-data) information on which DIMM channel is which, and I don't know any way to do anything like that without usingi2c_new_device.
Perhaps i2c_adapter could have a new field for this purpose. For DIMM busses it could store topology information. Then any clients instantiated on the bus could read it to figure out where they are.
Quoted 10 lines
- Busses like
i2c_i801may or may not contain DIMMs. They do on some
machines I have. But on my Core i7 Extreme box, there are no DIMMs on that bus, and there are no SPDs on that bus (i.e. addresses0x50through0x57don't answer), but there is an unknown device at address0x19. I don't really want to think about whether it's safe to probe by, say,read_word_data(0). When NVDIMMs show up, even more bizarre addresses may be populated. My code can probe *carefully* by looking for SPDs first, whereas the i2c-core code is not nearly as careful.
Quoted 3 lines
One option would be to move code like this into the core and replace
I2C_CLASS_SPDwith something like it. That way everything could get the benefit of DIMM-specific probing.
What if the core code got a little smarter than just matching arbitrary bits in the class? For example, if the adapter is I2C_CLASS_SPD, then the core could look for eeproms (and optionally instantiate them itself instead of relying on the eeprom driver being loaded). Or, more generally, adapters could have a list of named classes, and there could be a module or something for each class that knows how to probe and instantiate devices of that class. So the class "nvdimm" could instantiate whatever it needs to instantiate, the class "tsod" could instantiate jc42 instances, etc. (I'm pretty sure I'll eventually want nvdimm to be autoloaded, it may want to depend on the eeprom driver somehow in case I need to read the SPD data -- I'm not sure yet.)
I guess the logic of "probe 0x50, then, if there's an eeprom there, probe 0x18 for jc42" isn't perfect. For example, lm90 can live at 0x18 or 0x19, and if there are DIMMs on the same segment as an lm90, then it's possible for a jc42 and an lm90 to collide. So if my bus were I2C_CLASS_SPD | I2C_CLASS_DIMM, then perhaps the jc42 (and core) code could probe more aggressively.
--Andy
PATCH v3 2/4 i2c_imc: New driver for Intel's iMC, found on LGA2011 chips
In reply to a message not in the archiveSandy Bridge Xeon and Extreme chips have integrated memory controllers with (rather limited) onboard SMBUS masters. This driver gives access to the bus.
--- drivers/i2c/busses/Kconfig | 15 ++ drivers/i2c/busses/Makefile | 1 + drivers/i2c/busses/i2c-imc.c | 548 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 564 insertions(+) create mode 100644 drivers/i2c/busses/i2c-imc.c
drivers/i2c/busses/Kconfig +15 -0
@@ -137,6 +137,21 @@ config I2C_DIMM_BUS tristate default n +config I2C_IMC + tristate "Intel iMC (LGA 2011) SMBus Controller" + depends on PCI && X86 + select I2C_DIMM_BUS + help + If you say yes to this option, support will be included for the Intel + Integrated Memory Controller SMBus host controller interface. This + controller is found on LGA 2011 Xeons and Core i7 Extremes. + + It is possibly, although unlikely, that the use of this driver will + interfere with your platform's RAM thermal management. + + This driver can also be built as a module. If so, the module will be + called i2c-imc. + config I2C_PIIX4 tristate "Intel PIIX4 and compatible (ATI/AMD/Serverworks/Broadcom/SMSC)" depends on PCI
drivers/i2c/busses/Makefile +1 -0
@@ -15,6 +15,7 @@ obj-$(CONFIG_I2C_AMD8111) += i2c-amd8111.o obj-$(CONFIG_I2C_I801) += i2c-i801.o obj-$(CONFIG_I2C_ISCH) += i2c-isch.o obj-$(CONFIG_I2C_ISMT) += i2c-ismt.o +obj-$(CONFIG_I2C_IMC) += i2c-imc.o obj-$(CONFIG_I2C_NFORCE2) += i2c-nforce2.o obj-$(CONFIG_I2C_NFORCE2_S4985) += i2c-nforce2-s4985.o obj-$(CONFIG_I2C_PIIX4) += i2c-piix4.o
drivers/i2c/busses/i2c-imc.c new file +548 -0
548 lines not on this page · raw message
Signature · 1 line
1.8.1.4
PATCH v3 3/4 tsod: New hwmon driver for Temperature Sensors on DIMM
In reply to a message not in the archive--- drivers/hwmon/Kconfig | 10 +++ drivers/hwmon/Makefile | 1 + drivers/hwmon/tsod.c | 195 +++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 206 insertions(+) create mode 100644 drivers/hwmon/tsod.c
drivers/hwmon/Kconfig +10 -0
@@ -1462,6 +1462,16 @@ config SENSORS_MC13783_ADC help Support for the A/D converter on MC13783 and MC13892 PMIC. +config SENSORS_TSOD + tristate "Temperature Sensor On DIMM (TSOD)" + depends on I2C + help + If you say yes here you get support for the integrated temperature + sensors on newer DIMMs that comply with JESD21-C. + + This driver can also be built as a module. If so, the module + will be called tsod. + if ACPI comment "ACPI drivers"
drivers/hwmon/Makefile +1 -0
@@ -134,6 +134,7 @@ obj-$(CONFIG_SENSORS_W83L785TS) += w83l785ts.o obj-$(CONFIG_SENSORS_W83L786NG) += w83l786ng.o obj-$(CONFIG_SENSORS_WM831X) += wm831x-hwmon.o obj-$(CONFIG_SENSORS_WM8350) += wm8350-hwmon.o +obj-$(CONFIG_SENSORS_TSOD) += tsod.o obj-$(CONFIG_PMBUS) += pmbus/
drivers/hwmon/tsod.c new file +195 -0
195 lines not on this page · raw message
Signature · 1 line
1.8.1.4
A message that is not in the archive (sent off-list or not yet received): f358329ff1dd3c3c272cadb4a358a5587cb28e18.1374093761.git.luto-kltTT9wpgjJwATOyAt5JVQ@public.gmane.org
Re: [PATCH v3 3/4] tsod: New hwmon driver for Temperature Sensors on DIMM
Quoted 2 lines · Andy Lutomirski
Signed-off-by Andy Lutomirski <[email protected]>---
Why don't you just use the existing jc42 driver ?
Guenter
Quoted 244 lines
drivers/hwmon/Kconfig | 10 +++ drivers/hwmon/Makefile | 1 + drivers/hwmon/tsod.c | 195 +++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 206 insertions(+) create mode 100644 drivers/hwmon/tsod.cdrivers/hwmon/Kconfig +10
-0@@ -1462,6 +1462,16 @@ config SENSORS_MC13783_ADC help Support for the A/D converter on MC13783 and MC13892 PMIC. +config SENSORS_TSOD + tristate "Temperature Sensor On DIMM (TSOD)" + depends on I2C + help + If you say yes here you get support for the integrated temperature + sensors on newer DIMMs that comply with JESD21-C. + + This driver can also be built as a module. If so, the module + will be called tsod. + if ACPI comment "ACPI drivers"drivers/hwmon/Makefile +1
-0@@ -134,6 +134,7 @@ obj-$(CONFIG_SENSORS_W83L785TS) += w83l785ts.o obj-$(CONFIG_SENSORS_W83L786NG) += w83l786ng.o obj-$(CONFIG_SENSORS_WM831X) += wm831x-hwmon.o obj-$(CONFIG_SENSORS_WM8350) += wm8350-hwmon.o +obj-$(CONFIG_SENSORS_TSOD) += tsod.o obj-$(CONFIG_PMBUS) += pmbus/drivers/hwmon/tsod.c new file +195
-0@@ -0,0 +1,195 @@ +/* +* drivers/hwmon/tsod.c - Temperaure Sensor On DIMM +* +* Copyright (C) 2013 Andrew Lutomirski <[email protected]> +* +* This program is free software; you can redistribute it and/or modify it +* under the terms of the GNU General Public License v2 as published by the +* Free Software Foundation. +* +* This program is distributed in the hope that it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +* more details. +* +* You should have received a copy of the GNU General Public License along with +* this program; if not, write to the Free Software Foundation, Inc., +* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA +* +* The official reference for these devices is JEDEC Standard No. 21-C, +* which is available for free from www.jedec.org. +*/ + +#include <linux/kernel.h> +#include <linux/module.h> +#include <linux/err.h> +#include <linux/i2c.h> +#include <linux/hwmon.h> +#include <linux/hwmon-sysfs.h> +#include <linux/slab.h> + +/* Registers */ +#define TSOD_CURRENT_TEMP 5 +#define TSOD_VENDOR 6 +#define TSOD_DEVICE 7 + +/* +* This driver does not program the trip points, etc. -- this is done by +* firmware, and the memory controller probably wants the defaults preserved. +*/ + +struct tsod_priv { +struct i2c_client *client; +struct device *hwmondev; +}; + +static ssize_t show_name (struct device *dev, +struct device_attribute *attr,char *buf) +{ +return sprintf (buf,"TSOD\n" ); +} + +static ssize_t show_label (struct device *dev, +struct device_attribute *attr,char *buf) +{ +return sprintf (buf,"DIMM Temperature\n" ); +} + +static ssize_t show_temperature (struct device *dev, +struct device_attribute *attr,char *buf) +{ +struct tsod_priv *priv =dev_get_drvdata (dev->parent); +int temp, raw; + + raw =i2c_smbus_read_word_swapped (priv->client,TSOD_CURRENT_TEMP ); +if (raw <0 ) +return raw; + +/* +* The three high bits are undefined and the rest is twos-complement. +* Use a sign-extending right shift to propagate the sign bit. +*/ + temp = ((s16)((s16 )raw <<3 ) >>3 ); + +/* +* The value is in units of 0.0625 degrees, but we want it in +* units of 0.001 degrees. +*/ +return sprintf (buf,"%d\n" ,DIV_ROUND_CLOSEST (temp *625 ,10 )); +} + +static DEVICE_ATTR(name, S_IRUGO, show_name, NULL); +static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, show_temperature, NULL, 0); +static SENSOR_DEVICE_ATTR(temp1_label, S_IRUGO, show_label, NULL, 0); + +static struct attribute *tsod_hwmon_attributes[] = { + &dev_attr_name.attr, + &sensor_dev_attr_temp1_input.dev_attr.attr, + &sensor_dev_attr_temp1_label.dev_attr.attr, + +NULL , +}; + +static const struct attribute_group tsod_hwmon_attr_group = { + .attrs = tsod_hwmon_attributes, +}; + +static int tsod_detect (struct i2c_client *client,struct i2c_board_info *info) +{ +struct i2c_adapter *adapter = client->adapter; + +if (!i2c_check_functionality (adapter,I2C_FUNC_SMBUS_READ_WORD_DATA )) +return -ENODEV ; + +strlcpy (info->type,"tsod" ,I2C_NAME_SIZE ); +return 0 ; +} + +static int tsod_probe (struct i2c_client *client, +const struct i2c_device_id *id) +{ +int ret; +struct tsod_priv *priv; + +/* Sanity check the address */ +if ((client->addr &0x78 ) !=0x18 ) +return -ENODEV ; + +/* Sanity check: make sure we can read the temperature. */ + ret =i2c_smbus_read_word_swapped (client,TSOD_CURRENT_TEMP ); +if (ret <0 ) +return -ENODEV ; + + priv =kzalloc (sizeof (struct tsod_priv ),GFP_KERNEL ); +if (!priv) +return -ENOMEM ; + + priv->client = client; + + priv->hwmondev =hwmon_device_register (&client->dev); +if (IS_ERR (priv->hwmondev)) { + ret =PTR_ERR (priv->hwmondev); + goto err_free; + } + +i2c_set_clientdata (client, priv); + + ret =sysfs_create_group (&priv->hwmondev->kobj, &tsod_hwmon_attr_group); +if (ret) + goto err_unreg; + +return 0 ; + +err_unreg: +hwmon_device_unregister (&client->dev); + +err_free: +kfree (priv); +i2c_set_clientdata (client,0 ); +return ret; +} + +static int tsod_remove (struct i2c_client *client) +{ +struct tsod_priv *priv =i2c_get_clientdata (client); + +sysfs_remove_group (&priv->hwmondev->kobj, &tsod_hwmon_attr_group); +hwmon_device_unregister (priv->hwmondev); +kfree (priv); +return 0 ; +} + +static const unsigned short tsod_addresses[] = { +0x18 ,0x19 ,0x20 ,0x21 ,0x22 ,0x23 ,0x24 ,0x25 ,I2C_CLIENT_END +}; + +static const struct i2c_device_id tsod_id[] = { + {"tsod" ,0 }, + { } +}; +MODULE_DEVICE_TABLE (i2c, tsod_id); + +static struct i2c_driver tsod_driver = { + .driver = { + .name ="tsod" , + .owner =THIS_MODULE , + }, + .probe = tsod_probe, + .remove = tsod_remove, + .id_table = tsod_id, + +/* +* We do not claim I2C_CLASS_SPD -- there are other devices +* on, e.g., the i2c_i801 bus that have these addresses. +* Instead we let the dimm-bus code instantiate us. +*/ + + .detect = tsod_detect, + .address_list = tsod_addresses, +}; + +module_i2c_driver (tsod_driver); + +MODULE_AUTHOR ("Andrew Lutomirski <[email protected]>" ); +MODULE_DESCRIPTION ("Temperaure Sensor On DIMM" ); +MODULE_LICENSE ("GPL" );Signature · 1 line
1.8.1.4
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [PATCH v3 3/4] tsod: New hwmon driver for Temperature Sensors on DIMM
Quoted 5 lines · Guenter Roeck
Quoted 2 lines · Andy Lutomirski
Signed-off-by Andy Lutomirski <[email protected]>---
Why don't you just use the existing jc42 driver ?
Failure to notice it. *sigh*. I assumed that any driver for this device would have "tsod" or "TSOD" somewhere greppable. I'll at least send a patch to improve the description.
That being said, the jc42 driver *writes*. The iMC controller (AFAICS) uses the data from the TSOD for things like dynamically adjusting the DRAM refresh interval and IMO the kernel has no business at all writing to any registers on the TSOD on this platform. (FWIW, I tried fiddling with the critical threshold and my box didn't blow up or report thermal trip events. But still, this scares me a bit.)
If I modify the i2c_imc driver to add .class = I2C_CLASS_SPD and get rid of the TSOD probing and load the jc42 module, then it can't actually find my TSODs (because the i2c core isn't capable of probing on the iMC bus). If I manually add the device, it works.
But I'd like to keep the enumeration code I wrote around, since the main point of this exercise is to enumerate things that aren't actually hwmon devices. But I don't want random sensors scripts reprogramming the hardware. Is the some magic I can work (or should add) with i2c_board_info to force the jc42 driver into a read-only mode?
In any case, am I doing the right thing by not setting I2C_CLASS_SPD on my bus?
--Andy
A message that is not in the archive (sent off-list or not yet received): CALCETrWQF6p+DveuOxfMhp0r_CrvF=+FOmvfkF-TQ2NVgJ_2aA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org
Re: [PATCH v3 3/4] tsod: New hwmon driver for Temperature Sensors on DIMM
Quoted 11 lines · Andy Lutomirski
Quoted 5 lines · Guenter Roeck
Quoted 2 lines · Andy Lutomirski
Signed-off-by Andy Lutomirski <[email protected]>---
Why don't you just use the existing jc42 driver ?
Failure to notice it. *sigh*. I assumed that any driver for this device would have "tsod" or "TSOD" somewhere greppable. I'll at least send a patch to improve the description.
Quoted 7 lines
That being said, the jc42 driver *writes*. The iMC controller (AFAICS) uses the data from the TSOD for things like dynamically adjusting the DRAM refresh interval and IMO the kernel has no business at all writing to any registers on the TSOD on this platform. (FWIW, I tried fiddling with the critical threshold and my box didn't blow up or report thermal trip events. But still, this scares me a bit.)
I don't see a problem with that. If the i2c controller supports writes, one can perform the write from user space with i2cset, so what is the problem ? Besides, jc42 compliant temperature sensors expect to be written to in order to set the temperature limits. If you don't like that, you don't have to do it.
Quoted 5 lines
If I modify the
i2c_imcdriver to add .class =I2C_CLASS_SPDand get rid of the TSOD probing and load the jc42 module, then it can't actually find my TSODs (because the i2c core isn't capable of probing on the iMC bus). If I manually add the device, it works.
You mean it doesn't support the SMBus quick command ? Did you set I2C_CLASS_HWMON as well, or just I2C_CLASS_SPD ?
If you have the ability to use i2c_board_info, the failure to auto-detect the devices should not really matter. In that case you can just use one of the other methods to instantiate the i2c devices.
Quoted 7 lines
But I'd like to keep the enumeration code I wrote around, since the main point of this exercise is to enumerate things that aren't actually hwmon devices. But I don't want random sensors scripts reprogramming the hardware. Is the some magic I can work (or should add) with
i2c_board_infoto force the jc42 driver into a read-only mode?
Again, that is user space code doing the write, which you can control without reverting to a "private" driver. That the driver permits the write doesn't mean you have to use it. The only write it always performs is to enable the sensor if it is disabled .. which presumably should be ok even for you, since otherwise loading the driver doesn't make any sense in the first place.
Thanks,
Guenter
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [PATCH v3 3/4] tsod: New hwmon driver for Temperature Sensors on DIMM
Quoted 19 lines · Guenter Roeck
Quoted 11 lines · Andy Lutomirski
Quoted 5 lines · Guenter Roeck
Quoted 2 lines · Andy Lutomirski
Signed-off-by Andy Lutomirski <[email protected]>---
Why don't you just use the existing jc42 driver ?
Failure to notice it. *sigh*. I assumed that any driver for this device would have "tsod" or "TSOD" somewhere greppable. I'll at least send a patch to improve the description.
Quoted 7 lines
That being said, the jc42 driver *writes*. The iMC controller (AFAICS) uses the data from the TSOD for things like dynamically adjusting the DRAM refresh interval and IMO the kernel has no business at all writing to any registers on the TSOD on this platform. (FWIW, I tried fiddling with the critical threshold and my box didn't blow up or report thermal trip events. But still, this scares me a bit.)
Quoted 4 lines
I don't see a problem with that. If the i2c controller supports writes, one can perform the write from user space with i2cset, so what is the problem ? Besides, jc42 compliant temperature sensors expect to be written to in order to set the temperature limits. If you don't like that, you don't have to do it.
Fair enough.
Quoted 8 lines
Quoted 6 lines
If I modify the
i2c_imcdriver to add .class =I2C_CLASS_SPDand get rid of the TSOD probing and load the jc42 module, then it can't actually find my TSODs (because the i2c core isn't capable of probing on the iMC bus). If I manually add the device, it works.You mean it doesn't support the SMBus quick command ? Did you set
I2C_CLASS_HWMONas well, or justI2C_CLASS_SPD?
I didn't set I2C_CLASS_HWMON (and I won't -- jc42 is the only hwmon driver that should ever probe this bus). The adapter only supports read byte/word data, write byte/word data, and write byte. (I'm pretty sure that the hardware is capable of initiating a read byte transaction, but not under software control. I have no idea why write byte is there without read byte being available, so I didn't implement it. I think it's so that you can reset the pointer register after reading something else, but this is pointless because you don't know what to reset it to. This hardware is not exactly a thing of beauty, but I'm stuck with it.)
Quoted 4 lines
If you have the ability to use
i2c_board_info, the failure to auto-detect the devices should not really matter. In that case you can just use one of the other methods to instantiate the i2c devices.
See my other post about dimm_bus.
Quoted 8 lines
Quoted 8 lines
But I'd like to keep the enumeration code I wrote around, since the main point of this exercise is to enumerate things that aren't actually hwmon devices. But I don't want random sensors scripts reprogramming the hardware. Is the some magic I can work (or should add) with
i2c_board_infoto force the jc42 driver into a read-only mode?
Quoted 6 lines
Again, that is user space code doing the write, which you can control without reverting to a "private" driver. That the driver permits the write doesn't mean you have to use it. The only write it always performs is to enable the sensor if it is disabled .. which presumably should be ok even for you, since otherwise loading the driver doesn't make any sense in the first place.
OK, I'm convinced. I'll scrap my tsod driver.
--Andy
PATCH v3 4/4 eeprom: Add a MODULE_DEVICE_TABLE
In reply to a message not in the archiveThe new DIMM-bus code can detect eeproms, so give the eeprom driver an appropriate modalias.
--- drivers/misc/eeprom/eeprom.c | 1 + 1 file changed, 1 insertion(+)
drivers/misc/eeprom/eeprom.c +1 -0
@@ -215,6 +215,7 @@ static const struct i2c_device_id eeprom_id[] = { { "eeprom", 0 }, { } }; +MODULE_DEVICE_TABLE(i2c, eeprom_id); static struct i2c_driver eeprom_driver = { .driver = {
Signature · 1 line
1.8.1.4
A message that is not in the archive (sent off-list or not yet received): 5661ebb4676a4d20678f369df3a2da5d587e9100.1374093761.git.luto-kltTT9wpgjJwATOyAt5JVQ@public.gmane.org
Re: [PATCH v3 4/4] eeprom: Add a MODULE_DEVICE_TABLE
Hi Andy,
Quoted 13 lines · Andy Lutomirski
The new DIMM-bus code can detect eeproms, so give the eeprom driver an appropriate modalias.
Signed-off-by Andy Lutomirski <[email protected]>--- drivers/misc/eeprom/eeprom.c | 1 + 1 file changed, 1 insertion(+)drivers/misc/eeprom/eeprom.c +0
-0
drivers/misc/eeprom/eeprom.c static const struct i2c_device_id eeprom_id[] = { · line 221
Quoted 7 lines
drivers/misc/eeprom/eeprom.c +1
-0@@ -215,6 +215,7 @@ static const struct i2c_device_id eeprom_id[] = { { "eeprom", 0 }, { } }; +MODULE_DEVICE_TABLE(i2c, eeprom_id); static struct i2c_driver eeprom_driver = { .driver = {
Nack. The eeprom driver will eventually die, I don't want to see anything like that added to it. Please use the at24 driver for anything new.
Thanks,
Signature · 1 line
Jean Delvare
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [PATCH v3 4/4] eeprom: Add a MODULE_DEVICE_TABLE
Quoted 21 lines · Jean Delvare
Hi Andy,
Quoted 18 lines · Andy Lutomirski
The new DIMM-bus code can detect eeproms, so give the eeprom driver an appropriate modalias.
Signed-off-by Andy Lutomirski <[email protected]>--- drivers/misc/eeprom/eeprom.c | 1 + 1 file changed, 1 insertion(+)drivers/misc/eeprom/eeprom.c +1
-0@@ -215,6 +215,7 @@ static const struct i2c_device_id eeprom_id[] = { { "eeprom", 0 }, { } }; +MODULE_DEVICE_TABLE (i2c, eeprom_id);
Quoted 6 lines
drivers/misc/eeprom/eeprom.c static const struct i2c_device_id eeprom_id[] = { · line 221
Quoted 2 lines
drivers/misc/eeprom/eeprom.c +0
-0static struct i2c_driver eeprom_driver = { .driver = {Nack. The eeprom driver will eventually die, I don't want to see anything like that added to it. Please use the at24 driver for anything new.
at24 doesn't have .class=I2C_CLASS_SPD (and I still am not really a fan of the i2c class mechanism). Shall I play with ways to get known DIMM-only busses to probe these things directly and instantiate with i2c_new_device(..., .type="spd")? Do you have other plans for how probing should work?
(For background in case you haven't been following the rest of the
thread: the Intel iMC (integrated memory controller) bus appears to have only DIMMs attached, so everything on the bus is either the host or is something attached to a DIMM. The latter devices have well-defined addresses: four bits of type and three bits of slot number. This makes it easy to probe accurately. I'm not sure that the i2c core class mechanism is well-suited to this, it's easy to do manually.)
--Andy
Quoted 4 lines
Thanks,
--
Jean Delvare
Signature · 2 lines
Andy Lutomirski AMA Capital Management, LLC
A message that is not in the archive (sent off-list or not yet received): CALCETrX9Et-D+C9qJ9Ou46UyuWdqD6SN+PSu6RKDwnVogE=jZQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org
Re: [PATCH v3 4/4] eeprom: Add a MODULE_DEVICE_TABLE
Hi Andy,
Quoted 2 lines · Andy Lutomirski
at24 doesn't have .class=I2C_CLASS_SPD (and I still am not really a fan of the i2c class mechanism).
The class-based auto-detection has its merits but it's not the solution to all problems.
.class=I2C_CLASS_SPD could be added to the at24 driver. If we ever want to kill the legacy eeprom driver, we will have to do exactly that.
That being said this won't help in your case, as your bus driver does not support the SMBus transaction (Receive Byte) used to probe for EEPROM chips in address range 0x50-0x57.
Quoted 4 lines
Shall I play with ways to get known
DIMM-only busses to probe these things directly and instantiate withi2c_new_device(..., .type="spd")? Do you have other plans for how probing should work?
You could indeed call i2c_new_probed_device() on addresses 0x50-0x57 at the end of your new i2c bus driver's probe function, in order to instantiate spd devices. This function takes a probe function as a parameter so you could use a transaction type supported (Read Byte.)
Quoted 8 lines
(For background in case you haven't been following the rest of the
thread: the Intel iMC (integrated memory controller) bus appears to have only DIMMs attached, so everything on the bus is either the host or is something attached to a DIMM. The latter devices have well-defined addresses: four bits of type and three bits of slot number. This makes it easy to probe accurately. I'm not sure that the i2c core class mechanism is well-suited to this, it's easy to do manually.)
Ideally the BIOS/firmware/whatever would tell the OS which memory slots are used so that the kernel can instantiate all I2C/SMBus slave devices without even probing for them. I really wonder how many decades it will take to Intel and co to come up with a complete device typology description on the PC/x86_64 platfor, so that probing is finally history.
Signature · 1 line
Jean Delvare
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [PATCH v3 4/4] eeprom: Add a MODULE_DEVICE_TABLE
Quoted 19 lines · Jean Delvare
Quoted 2 lines · Andy Lutomirski
at24 doesn't have .class=I2C_CLASS_SPD (and I still am not really a fan of the i2c class mechanism).
The class-based auto-detection has its merits but it's not the solution to all problems.
.class=I2C_CLASS_SPD could be added to the at24 driver. If we ever want to kill the legacy eeprom driver, we will have to do exactly that.
That being said this won't help in your case, as your bus driver does not support the SMBus transaction (Receive Byte) used to probe for EEPROM chips in address range 0x50-0x57.
Quoted 4 lines
Shall I play with ways to get known
DIMM-only busses to probe these things directly and instantiate withi2c_new_device(..., .type="spd")? Do you have other plans for how probing should work?
Quoted 5 lines
You could indeed call
i2c_new_probed_device()on addresses 0x50-0x57 at the end of your new i2c bus driver's probe function, in order to instantiate spd devices. This function takes a probe function as a parameter so you could use a transaction type supported (Read Byte.)
Can you take a look at patch v4 1/2 and let me know if you think it's any good? It does more or less that, albeit using i2c_new_device and a bit fancier logic. It's also factored out to make it (in theory) reusable by any other bus with similar properties, but I can easily move it somewhere else.
(And apologies for my newbishness in poking around the i2c code.)
Quoted 9 lines
Quoted 8 lines
(For background in case you haven't been following the rest of the
thread: the Intel iMC (integrated memory controller) bus appears to have only DIMMs attached, so everything on the bus is either the host or is something attached to a DIMM. The latter devices have well-defined addresses: four bits of type and three bits of slot number. This makes it easy to probe accurately. I'm not sure that the i2c core class mechanism is well-suited to this, it's easy to do manually.)
Quoted 6 lines
Ideally the BIOS/firmware/whatever would tell the OS which memory slots are used so that the kernel can instantiate all I2C/SMBus slave devices without even probing for them. I really wonder how many decades it will take to Intel and co to come up with a complete device typology description on the PC/x86_64 platfor, so that probing is finally history.
Intel almost did it. They give status bits indicating whether they (where "they" means either BIOS or the chipset -- I'm not sure) think that a given slot contains a TSOD. I think that those bits actually control the periodic hardware TSOD polling. On my i7 Extreme, they're all zero.
I suppose that one could query the EDAC infrastructure to see which slots are mapped to which RAM addresses, but that would be a giant mess.
--Andy
Signature · 2 lines
Andy Lutomirski AMA Capital Management, LLC