mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2 0/1] i2c: designware: Fix SMBUS Master interrupts storms
@ 2025-10-21  7:24 Jinhui Guo
  2025-10-21  7:24 ` [PATCH v2 1/1] i2c: designware: Disable SMBus interrupts to prevent storms from mis-configured firmware Jinhui Guo
  0 siblings, 1 reply; 3+ messages in thread
From: Jinhui Guo @ 2025-10-21  7:24 UTC (permalink / raw)
  To: mika.westerberg, andriy.shevchenko, jsd, andi.shyti
  Cc: guojinhui.liam, linux-i2c, linux-kernel

Hi all,

We hit interrupt storms on the SMBus master extend-clock timeout IRQ
and SMBUS Slave Clock Extend Timeout IRQ because broken firmware left
IC_SMBUS=1 while the driver IRQ handler never services SMBus events.

Since we cannot disable IC_SMBUS directly, mask its interrupts to
prevent floods and make the driver more robust.

Thanks,
Jinhui

---
v1: https://lore.kernel.org/all/20251011073057.2959-1-guojinhui.liam@bytedance.com/

Changelog in v1 -> v2 (suggested by Mika and Andy Shevchenko)
 - Drop the stand-alone i2c_dw_disable_smbus_intr() wrapper and mask
   the SMBus interrupt directly in i2c_dw_init_master() after the
   adapter is disabled. [Tested]
 - Align the DW_IC_SMBUS_INTR_MASK macro definition to three TABs so
   that it matches the surrounding macro indentation style.

Jinhui Guo (1):
  i2c: designware: Disable SMBus interrupts to prevent storms from
    mis-configured firmware

 drivers/i2c/busses/i2c-designware-core.h   | 1 +
 drivers/i2c/busses/i2c-designware-master.c | 7 +++++++
 2 files changed, 8 insertions(+)

-- 
2.20.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH v2 1/1] i2c: designware: Disable SMBus interrupts to prevent storms from mis-configured firmware
  2025-10-21  7:24 [PATCH v2 0/1] i2c: designware: Fix SMBUS Master interrupts storms Jinhui Guo
@ 2025-10-21  7:24 ` Jinhui Guo
  2025-10-21  7:36   ` Mika Westerberg
  0 siblings, 1 reply; 3+ messages in thread
From: Jinhui Guo @ 2025-10-21  7:24 UTC (permalink / raw)
  To: mika.westerberg, andriy.shevchenko, jsd, andi.shyti
  Cc: guojinhui.liam, linux-i2c, linux-kernel

When probing the I2C master, disable SMBus interrupts to prevent
storms caused by broken firmware mis-configuring IC_SMBUS=1; the
handler never services them and a mis-configured SMBUS Master
extend-clock timeout or SMBUS Slave extend-clock timeout can
flood the CPU.

Signed-off-by: Jinhui Guo <guojinhui.liam@bytedance.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/i2c/busses/i2c-designware-core.h   | 1 +
 drivers/i2c/busses/i2c-designware-master.c | 7 +++++++
 2 files changed, 8 insertions(+)

diff --git a/drivers/i2c/busses/i2c-designware-core.h b/drivers/i2c/busses/i2c-designware-core.h
index 347843b4f5dd..436555543c79 100644
--- a/drivers/i2c/busses/i2c-designware-core.h
+++ b/drivers/i2c/busses/i2c-designware-core.h
@@ -78,6 +78,7 @@
 #define DW_IC_TX_ABRT_SOURCE			0x80
 #define DW_IC_ENABLE_STATUS			0x9c
 #define DW_IC_CLR_RESTART_DET			0xa8
+#define DW_IC_SMBUS_INTR_MASK			0xcc
 #define DW_IC_COMP_PARAM_1			0xf4
 #define DW_IC_COMP_VERSION			0xf8
 #define DW_IC_SDA_HOLD_MIN_VERS			0x3131312A /* "111*" == v1.11* */
diff --git a/drivers/i2c/busses/i2c-designware-master.c b/drivers/i2c/busses/i2c-designware-master.c
index 41e9b5ecad20..45bfca05bb30 100644
--- a/drivers/i2c/busses/i2c-designware-master.c
+++ b/drivers/i2c/busses/i2c-designware-master.c
@@ -220,6 +220,13 @@ static int i2c_dw_init_master(struct dw_i2c_dev *dev)
 	/* Disable the adapter */
 	__i2c_dw_disable(dev);
 
+	/*
+	 * Mask SMBus interrupts to block storms from broken
+	 * firmware that leaves IC_SMBUS=1; the handler never
+	 * services them.
+	 */
+	regmap_write(dev->map, DW_IC_SMBUS_INTR_MASK, 0);
+
 	/* Write standard speed timing parameters */
 	regmap_write(dev->map, DW_IC_SS_SCL_HCNT, dev->ss_hcnt);
 	regmap_write(dev->map, DW_IC_SS_SCL_LCNT, dev->ss_lcnt);
-- 
2.20.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2 1/1] i2c: designware: Disable SMBus interrupts to prevent storms from mis-configured firmware
  2025-10-21  7:24 ` [PATCH v2 1/1] i2c: designware: Disable SMBus interrupts to prevent storms from mis-configured firmware Jinhui Guo
@ 2025-10-21  7:36   ` Mika Westerberg
  0 siblings, 0 replies; 3+ messages in thread
From: Mika Westerberg @ 2025-10-21  7:36 UTC (permalink / raw)
  To: Jinhui Guo; +Cc: andriy.shevchenko, jsd, andi.shyti, linux-i2c, linux-kernel

On Tue, Oct 21, 2025 at 03:24:31PM +0800, Jinhui Guo wrote:
> When probing the I2C master, disable SMBus interrupts to prevent
> storms caused by broken firmware mis-configuring IC_SMBUS=1; the
> handler never services them and a mis-configured SMBUS Master
> extend-clock timeout or SMBUS Slave extend-clock timeout can
> flood the CPU.
> 
> Signed-off-by: Jinhui Guo <guojinhui.liam@bytedance.com>
> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-10-21  7:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-10-21  7:24 [PATCH v2 0/1] i2c: designware: Fix SMBUS Master interrupts storms Jinhui Guo
2025-10-21  7:24 ` [PATCH v2 1/1] i2c: designware: Disable SMBus interrupts to prevent storms from mis-configured firmware Jinhui Guo
2025-10-21  7:36   ` Mika Westerberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®