* [PATCH 1/1] i2c: designware: Disable SMBus interrupts to prevent storms from mis-configured firmware
2025-10-11 7:30 [PATCH 0/1] i2c: designware: Fix SMBUS Master interrupts storms Jinhui Guo
@ 2025-10-11 7:30 ` Jinhui Guo
2025-10-14 7:15 ` Andy Shevchenko
2025-10-20 10:29 ` Mika Westerberg
0 siblings, 2 replies; 5+ messages in thread
From: Jinhui Guo @ 2025-10-11 7:30 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 can flood the CPU.
Signed-off-by: Jinhui Guo <guojinhui.liam@bytedance.com>
---
drivers/i2c/busses/i2c-designware-core.h | 1 +
drivers/i2c/busses/i2c-designware-master.c | 11 +++++++++++
2 files changed, 12 insertions(+)
diff --git a/drivers/i2c/busses/i2c-designware-core.h b/drivers/i2c/busses/i2c-designware-core.h
index 347843b4f5dd..d1122ff0a1b7 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 c7a72c28786c..eeb60536da32 100644
--- a/drivers/i2c/busses/i2c-designware-master.c
+++ b/drivers/i2c/busses/i2c-designware-master.c
@@ -997,6 +997,11 @@ static int i2c_dw_init_recovery_info(struct dw_i2c_dev *dev)
return 0;
}
+static inline void i2c_dw_disable_smbus_intr(struct dw_i2c_dev *dev)
+{
+ regmap_write(dev->map, DW_IC_SMBUS_INTR_MASK, 0);
+}
+
int i2c_dw_probe_master(struct dw_i2c_dev *dev)
{
struct i2c_adapter *adap = &dev->adapter;
@@ -1063,6 +1068,12 @@ int i2c_dw_probe_master(struct dw_i2c_dev *dev)
return ret;
__i2c_dw_write_intr_mask(dev, 0);
+ /*
+ * Mask SMBus interrupts to block storms from broken
+ * firmware that leaves IC_SMBUS=1; the handler never
+ * services them.
+ */
+ i2c_dw_disable_smbus_intr(dev);
i2c_dw_release_lock(dev);
if (!(dev->flags & ACCESS_POLLING)) {
--
2.20.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 1/1] i2c: designware: Disable SMBus interrupts to prevent storms from mis-configured firmware
2025-10-11 7:30 ` [PATCH 1/1] i2c: designware: Disable SMBus interrupts to prevent storms from mis-configured firmware Jinhui Guo
@ 2025-10-14 7:15 ` Andy Shevchenko
2025-10-20 10:29 ` Mika Westerberg
1 sibling, 0 replies; 5+ messages in thread
From: Andy Shevchenko @ 2025-10-14 7:15 UTC (permalink / raw)
To: Jinhui Guo; +Cc: mika.westerberg, jsd, andi.shyti, linux-i2c, linux-kernel
On Sat, Oct 11, 2025 at 03:30:57PM +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 can flood the CPU.
...
> #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
It seems one TAB too little.
> #define DW_IC_COMP_PARAM_1 0xf4
> #define DW_IC_COMP_VERSION 0xf8
> #define DW_IC_SDA_HOLD_MIN_VERS 0x3131312A /* "111*" == v1.11* */
...
The rest LGTM, but let Mika to review.
FWIW,
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/1] i2c: designware: Disable SMBus interrupts to prevent storms from mis-configured firmware
@ 2025-10-18 19:22 Andy Shevchenko
0 siblings, 0 replies; 5+ messages in thread
From: Andy Shevchenko @ 2025-10-18 19:22 UTC (permalink / raw)
To: Jinhui Guo; +Cc: mika.westerberg, jsd, andi.shyti, linux-i2c, linux-kernel
On Sat, Oct 11, 2025 at 03:30:57PM +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 can flood the CPU.
...
> #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
It seems one TAB too little.
> #define DW_IC_COMP_PARAM_1 0xf4
> #define DW_IC_COMP_VERSION 0xf8
> #define DW_IC_SDA_HOLD_MIN_VERS 0x3131312A /* "111*" == v1.11* */
...
The rest LGTM, but let Mika to review.
FWIW,
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/1] i2c: designware: Disable SMBus interrupts to prevent storms from mis-configured firmware
2025-10-11 7:30 ` [PATCH 1/1] i2c: designware: Disable SMBus interrupts to prevent storms from mis-configured firmware Jinhui Guo
2025-10-14 7:15 ` Andy Shevchenko
@ 2025-10-20 10:29 ` Mika Westerberg
2025-10-21 7:46 ` Jinhui Guo
1 sibling, 1 reply; 5+ messages in thread
From: Mika Westerberg @ 2025-10-20 10:29 UTC (permalink / raw)
To: Jinhui Guo; +Cc: andriy.shevchenko, jsd, andi.shyti, linux-i2c, linux-kernel
Hi,
On Sat, Oct 11, 2025 at 03:30:57PM +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 can flood the CPU.
>
> Signed-off-by: Jinhui Guo <guojinhui.liam@bytedance.com>
> ---
> drivers/i2c/busses/i2c-designware-core.h | 1 +
> drivers/i2c/busses/i2c-designware-master.c | 11 +++++++++++
> 2 files changed, 12 insertions(+)
>
> diff --git a/drivers/i2c/busses/i2c-designware-core.h b/drivers/i2c/busses/i2c-designware-core.h
> index 347843b4f5dd..d1122ff0a1b7 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 c7a72c28786c..eeb60536da32 100644
> --- a/drivers/i2c/busses/i2c-designware-master.c
> +++ b/drivers/i2c/busses/i2c-designware-master.c
> @@ -997,6 +997,11 @@ static int i2c_dw_init_recovery_info(struct dw_i2c_dev *dev)
> return 0;
> }
>
> +static inline void i2c_dw_disable_smbus_intr(struct dw_i2c_dev *dev)
> +{
> + regmap_write(dev->map, DW_IC_SMBUS_INTR_MASK, 0);
> +}
I wonder instead of this wrapper, can you just do this in
i2c_dw_init_master() right after the adapter has been disabled?
> +
> int i2c_dw_probe_master(struct dw_i2c_dev *dev)
> {
> struct i2c_adapter *adap = &dev->adapter;
> @@ -1063,6 +1068,12 @@ int i2c_dw_probe_master(struct dw_i2c_dev *dev)
> return ret;
>
> __i2c_dw_write_intr_mask(dev, 0);
> + /*
> + * Mask SMBus interrupts to block storms from broken
> + * firmware that leaves IC_SMBUS=1; the handler never
> + * services them.
> + */
> + i2c_dw_disable_smbus_intr(dev);
> i2c_dw_release_lock(dev);
>
> if (!(dev->flags & ACCESS_POLLING)) {
> --
> 2.20.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/1] i2c: designware: Disable SMBus interrupts to prevent storms from mis-configured firmware
2025-10-20 10:29 ` Mika Westerberg
@ 2025-10-21 7:46 ` Jinhui Guo
0 siblings, 0 replies; 5+ messages in thread
From: Jinhui Guo @ 2025-10-21 7:46 UTC (permalink / raw)
To: mika.westerberg
Cc: andi.shyti, andriy.shevchenko, guojinhui.liam, jsd, linux-i2c,
linux-kernel
Hi,
On Mon, Oct 20, 2025 12:29:58 +0200, Mika Westerberg wrote:
> > +static inline void i2c_dw_disable_smbus_intr(struct dw_i2c_dev *dev)
> > +{
> > + regmap_write(dev->map, DW_IC_SMBUS_INTR_MASK, 0);
> > +}
> I wonder instead of this wrapper, can you just do this in
> i2c_dw_init_master() right after the adapter has been disabled?
We can do that to simplify the code. Patch v2 is sent and has been tested.
https://lore.kernel.org/all/20251021072431.3427-1-guojinhui.liam@bytedance.com/
Thanks,
Jinhui
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-10-21 7:46 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-18 19:22 [PATCH 1/1] i2c: designware: Disable SMBus interrupts to prevent storms from mis-configured firmware Andy Shevchenko
-- strict thread matches above, loose matches on Subject: below --
2025-10-11 7:30 [PATCH 0/1] i2c: designware: Fix SMBUS Master interrupts storms Jinhui Guo
2025-10-11 7:30 ` [PATCH 1/1] i2c: designware: Disable SMBus interrupts to prevent storms from mis-configured firmware Jinhui Guo
2025-10-14 7:15 ` Andy Shevchenko
2025-10-20 10:29 ` Mika Westerberg
2025-10-21 7:46 ` Jinhui Guo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).