From: "Cédric Le Goater" <clg@kaod.org>
To: GuoHan Zhao <zhaoguohan@kylinos.cn>,
Peter Maydell <peter.maydell@linaro.org>
Cc: Steven Lee <steven_lee@aspeedtech.com>,
Troy Lee <leetroy@gmail.com>,
Jamin Lin <jamin_lin@aspeedtech.com>,
Andrew Jeffery <andrew@codeconstruct.com.au>,
Joel Stanley <joel@jms.id.au>,
qemu-arm@nongnu.org, qemu-devel@nongnu.org,
Jithu Joseph <jithu.joseph@oss.qualcomm.com>
Subject: Re: [PATCH] hw/i2c/aspeed_i2c: reset and migrate pending_intr_sts
Date: Wed, 25 Mar 2026 11:54:57 +0100 [thread overview]
Message-ID: <cbc2f8e2-82d6-426e-b269-4921fa95b219@kaod.org> (raw)
In-Reply-To: <20260325085450.126595-1-zhaoguohan@kylinos.cn>
+Jithu
On 3/25/26 09:54, GuoHan Zhao wrote:
> Commit 7e82393ed058 ("hw/i2c/aspeed: fix lost interrupts on
> back-to-back commands") introduced pending_intr_sts to preserve
> interrupt bits that collide with already pending status bits.
>
> That deferred interrupt state is consumed later when the guest clears
> INTR_STS, but it is not reset in aspeed_i2c_bus_reset() and it is not
> part of the bus migration state. A reset can therefore leave stale
> deferred bits behind, and migration can silently drop them.
>
> Clear pending_intr_sts on reset and include it in VMState while keeping
> compatibility with older migration streams.
>
> Fixes: 7e82393ed058 ("hw/i2c/aspeed: fix lost interrupts on back-to-back commands")
> Signed-off-by: GuoHan Zhao <zhaoguohan@kylinos.cn>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Thanks,
C.
> ---
> hw/i2c/aspeed_i2c.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/hw/i2c/aspeed_i2c.c b/hw/i2c/aspeed_i2c.c
> index 5d18f8d49ea4..90f83a03fd4f 100644
> --- a/hw/i2c/aspeed_i2c.c
> +++ b/hw/i2c/aspeed_i2c.c
> @@ -1134,10 +1134,11 @@ static const MemoryRegionOps aspeed_i2c_bus_pool_ops = {
>
> static const VMStateDescription aspeed_i2c_bus_vmstate = {
> .name = TYPE_ASPEED_I2C,
> - .version_id = 6,
> + .version_id = 7,
> .minimum_version_id = 6,
> .fields = (const VMStateField[]) {
> VMSTATE_UINT32_ARRAY(regs, AspeedI2CBus, ASPEED_I2C_NEW_NUM_REG),
> + VMSTATE_UINT32_V(pending_intr_sts, AspeedI2CBus, 7),
> VMSTATE_UINT8_ARRAY(pool, AspeedI2CBus, ASPEED_I2C_BUS_POOL_SIZE),
> VMSTATE_UINT64(dma_dram_offset, AspeedI2CBus),
> VMSTATE_END_OF_LIST()
> @@ -1510,6 +1511,7 @@ static void aspeed_i2c_bus_reset(DeviceState *dev)
> AspeedI2CBus *s = ASPEED_I2C_BUS(dev);
>
> memset(s->regs, 0, sizeof(s->regs));
> + s->pending_intr_sts = 0;
> i2c_end_transfer(s->bus);
> }
>
prev parent reply other threads:[~2026-03-25 10:55 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-25 8:54 [PATCH] hw/i2c/aspeed_i2c: reset and migrate pending_intr_sts GuoHan Zhao
2026-03-25 10:54 ` Cédric Le Goater [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=cbc2f8e2-82d6-426e-b269-4921fa95b219@kaod.org \
--to=clg@kaod.org \
--cc=andrew@codeconstruct.com.au \
--cc=jamin_lin@aspeedtech.com \
--cc=jithu.joseph@oss.qualcomm.com \
--cc=joel@jms.id.au \
--cc=leetroy@gmail.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=steven_lee@aspeedtech.com \
--cc=zhaoguohan@kylinos.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox