* [PATCH linux dev-5.3] i2c: aspeed: Prevent state corruption for IRQ with no status
@ 2019-10-18 15:46 Eddie James
2019-10-18 16:10 ` Jae Hyun Yoo
0 siblings, 1 reply; 2+ messages in thread
From: Eddie James @ 2019-10-18 15:46 UTC (permalink / raw)
To: openbmc; +Cc: joel, jae.hyun.yoo, Eddie James
On the AST2600, interrupts have been observed with no interrupt status
bits set. This can break the driver state machine, so these interrupts
should be detected and the handler should return IRQ_NONE.
Signed-off-by: Eddie James <eajames@linux.ibm.com>
---
drivers/i2c/busses/i2c-aspeed.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/drivers/i2c/busses/i2c-aspeed.c b/drivers/i2c/busses/i2c-aspeed.c
index c2a6e5a27314..e19f24c0acb2 100644
--- a/drivers/i2c/busses/i2c-aspeed.c
+++ b/drivers/i2c/busses/i2c-aspeed.c
@@ -603,6 +603,17 @@ static irqreturn_t aspeed_i2c_bus_irq(int irq, void *dev_id)
spin_lock(&bus->lock);
irq_received = readl(bus->base + ASPEED_I2C_INTR_STS_REG);
+
+ /*
+ * On the AST2600, interrupts have been observed with no interrupt
+ * status bits set. In this case, the handler should return IRQ_NONE
+ * immediately to prevent driver state machine corruption.
+ */
+ if (!irq_received) {
+ spin_unlock(&bus->lock);
+ return IRQ_NONE;
+ }
+
/* Ack all interrupts except for Rx done */
writel(irq_received & ~ASPEED_I2CD_INTR_RX_DONE,
bus->base + ASPEED_I2C_INTR_STS_REG);
--
2.23.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH linux dev-5.3] i2c: aspeed: Prevent state corruption for IRQ with no status
2019-10-18 15:46 [PATCH linux dev-5.3] i2c: aspeed: Prevent state corruption for IRQ with no status Eddie James
@ 2019-10-18 16:10 ` Jae Hyun Yoo
0 siblings, 0 replies; 2+ messages in thread
From: Jae Hyun Yoo @ 2019-10-18 16:10 UTC (permalink / raw)
To: Eddie James, openbmc
On 10/18/2019 8:46 AM, Eddie James wrote:
> On the AST2600, interrupts have been observed with no interrupt status
> bits set. This can break the driver state machine, so these interrupts
> should be detected and the handler should return IRQ_NONE.
>
> Signed-off-by: Eddie James <eajames@linux.ibm.com>
Reviewed-by: Jae Hyun Yoo <jae.hyun.yoo@linux.intel.com>
Thanks Eddie!
> ---
> drivers/i2c/busses/i2c-aspeed.c | 11 +++++++++++
> 1 file changed, 11 insertions(+)
>
> diff --git a/drivers/i2c/busses/i2c-aspeed.c b/drivers/i2c/busses/i2c-aspeed.c
> index c2a6e5a27314..e19f24c0acb2 100644
> --- a/drivers/i2c/busses/i2c-aspeed.c
> +++ b/drivers/i2c/busses/i2c-aspeed.c
> @@ -603,6 +603,17 @@ static irqreturn_t aspeed_i2c_bus_irq(int irq, void *dev_id)
>
> spin_lock(&bus->lock);
> irq_received = readl(bus->base + ASPEED_I2C_INTR_STS_REG);
> +
> + /*
> + * On the AST2600, interrupts have been observed with no interrupt
> + * status bits set. In this case, the handler should return IRQ_NONE
> + * immediately to prevent driver state machine corruption.
> + */
> + if (!irq_received) {
> + spin_unlock(&bus->lock);
> + return IRQ_NONE;
> + }
> +
> /* Ack all interrupts except for Rx done */
> writel(irq_received & ~ASPEED_I2CD_INTR_RX_DONE,
> bus->base + ASPEED_I2C_INTR_STS_REG);
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-10-18 16:10 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-10-18 15:46 [PATCH linux dev-5.3] i2c: aspeed: Prevent state corruption for IRQ with no status Eddie James
2019-10-18 16:10 ` Jae Hyun Yoo
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.