linux/drivers/i2c
Jan Bottorff 89a057818d i2c: designware: Fix corrupted memory seen in the ISR
[ Upstream commit f726eaa787 ]

When running on a many core ARM64 server, errors were
happening in the ISR that looked like corrupted memory. These
corruptions would fix themselves if small delays were inserted
in the ISR. Errors reported by the driver included "i2c_designware
APMC0D0F:00: i2c_dw_xfer_msg: invalid target address" and
"i2c_designware APMC0D0F:00:controller timed out" during
in-band IPMI SSIF stress tests.

The problem was determined to be memory writes in the driver were not
becoming visible to all cores when execution rapidly shifted between
cores, like when a register write immediately triggers an ISR.
Processors with weak memory ordering, like ARM64, make no
guarantees about the order normal memory writes become globally
visible, unless barrier instructions are used to control ordering.

To solve this, regmap accessor functions configured by this driver
were changed to use non-relaxed forms of the low-level register
access functions, which include a barrier on platforms that require
it. This assures memory writes before a controller register access are
visible to all cores. The community concluded defaulting to correct
operation outweighed defaulting to the small performance gains from
using relaxed access functions. Being a low speed device added weight to
this choice of default register access behavior.

Signed-off-by: Jan Bottorff <janb@os.amperecomputing.com>
Acked-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Tested-by: Serge Semin <fancer.lancer@gmail.com>
Reviewed-by: Serge Semin <fancer.lancer@gmail.com>
Signed-off-by: Wolfram Sang <wsa@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-12-13 18:36:32 +01:00
..
algos i2c: algo: bit: use new macro to specifiy capabilities 2021-01-22 09:59:21 +01:00
busses i2c: designware: Fix corrupted memory seen in the ISR 2023-12-13 18:36:32 +01:00
muxes i2c: muxes: i2c-demux-pinctrl: Use of_get_i2c_adapter_by_node() 2023-11-08 17:26:40 +01:00
i2c-boardinfo.c i2c: Remove support for dangling device properties 2021-04-10 21:43:02 +02:00
i2c-core-acpi.c i2c: acpi: fix resource leak in reconfiguration device addition 2021-10-02 08:38:43 +02:00
i2c-core-base.c i2c: Fix a potential use after free 2022-08-17 14:23:20 +02:00
i2c-core-of.c
i2c-core-slave.c
i2c-core-smbus.c i2c: core-smbus: Expose PEC calculate function for generic use 2021-06-25 17:09:34 +02:00
i2c-core.h i2c: core: Run atomic i2c xfer when !preemptible 2023-11-28 16:56:31 +00:00
i2c-dev.c i2c: dev: copy userspace array safely 2023-11-28 16:56:20 +00:00
i2c-mux.c i2c: mux: Avoid potential false error message in i2c_mux_add_adapter 2023-10-25 11:58:59 +02:00
i2c-slave-eeprom.c
i2c-slave-testunit.c i2c: testunit: add support for block process calls 2021-02-12 11:11:04 +01:00
i2c-smbus.c
i2c-stub.c i2c: stub: remove definition of DEBUG 2021-01-17 13:00:10 +01:00
Kconfig
Makefile