Commit 8141dc2945 for qemu.org
commit 8141dc29457d2e7d2350992cac7e53dc6f775c6d
Author: Jamin Lin <jamin_lin@aspeedtech.com>
Date: Wed Feb 25 02:12:19 2026 +0000
hw/i3c/dw-i3c: Use 32 bits on MMIO writes
The registers are only 32 bits wide, so we should cast the 64-bit value
passed in to only be 32 bits wide.
Signed-off-by: Joe Komlodi <komlodi@google.com>
Reviewed-by: Patrick Venture <venture@google.com>
Reviewed-by: Titus Rwantare <titusr@google.com>
Reviewed-by: Jamin Lin <jamin_lin@aspeedtech.com>
Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>
Tested-by: Jithu Joseph <jithu.joseph@oss.qualcomm.com>
Link: https://lore.kernel.org/qemu-devel/20260225021158.1586584-12-jamin_lin@aspeedtech.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
diff --git a/hw/i3c/dw-i3c.c b/hw/i3c/dw-i3c.c
index eeaf1125e4..7ca99fb87e 100644
--- a/hw/i3c/dw-i3c.c
+++ b/hw/i3c/dw-i3c.c
@@ -363,10 +363,11 @@ static void dw_i3c_write(void *opaque, hwaddr offset, uint64_t value,
{
DWI3C *s = DW_I3C(opaque);
uint32_t addr = offset >> 2;
+ uint32_t val32 = (uint32_t)value;
trace_dw_i3c_write(s->id, offset, value);
- value &= ~dw_i3c_ro[addr];
+ val32 &= ~dw_i3c_ro[addr];
switch (addr) {
case R_HW_CAPABILITY:
case R_RESPONSE_QUEUE_PORT:
@@ -392,7 +393,7 @@ static void dw_i3c_write(void *opaque, hwaddr offset, uint64_t value,
case R_RESET_CTRL:
break;
default:
- s->regs[addr] = value;
+ s->regs[addr] = val32;
break;
}
}