@samitouri / QOSamiQemu / commits / 9c32999643

hw/i2c/aspeed_i2c: reset and migrate pending_intr_sts

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> Link: https://lore.kernel.org/qemu-devel/20260325085450.126595-1-zhaoguohan@kylinos.cn Reviewed-by: Cédric Le Goater <clg@redhat.com> Reviewed-by: Jithu Joseph <jithu.joseph@oss.qualcomm.com> Signed-off-by: Cédric Le Goater <clg@redhat.com>

GuoHan Zhao committed Mar 25, 2026 at 16:54 UTC 9c3299964367edbf31f9e695bb7e090e8f18c35f
1 file changed +3 -1
hw/i2c/aspeed_i2c.c
+3 -1
@@ -1134,10 +1134,11 @@ static const MemoryRegionOps aspeed_i2c_bus_pool_ops = {
1134
1135 static const VMStateDescription aspeed_i2c_bus_vmstate = {
1136 .name = TYPE_ASPEED_I2C,
1137 - .version_id = 6,
1137 + .version_id = 7,
1138 .minimum_version_id = 6,
1139 .fields = (const VMStateField[]) {
1140 VMSTATE_UINT32_ARRAY(regs, AspeedI2CBus, ASPEED_I2C_NEW_NUM_REG),
1141 + VMSTATE_UINT32_V(pending_intr_sts, AspeedI2CBus, 7),
1142 VMSTATE_UINT8_ARRAY(pool, AspeedI2CBus, ASPEED_I2C_BUS_POOL_SIZE),
1143 VMSTATE_UINT64(dma_dram_offset, AspeedI2CBus),
1144 VMSTATE_END_OF_LIST()
@@ -1510,6 +1511,7 @@ static void aspeed_i2c_bus_reset(DeviceState *dev)
1511 AspeedI2CBus *s = ASPEED_I2C_BUS(dev);
1512
1513 memset(s->regs, 0, sizeof(s->regs));
1514 + s->pending_intr_sts = 0;
1515 i2c_end_transfer(s->bus);
1516 }
1517