Commit 21d3af36b0 for qemu.org
commit 21d3af36b0adab8e56f19fcbbb206b8273611cba
Author: Bernhard Beschow <shentey@gmail.com>
Date: Mon Jul 27 10:28:46 2026 +0100
hw/net/flexcan: Drop oversized 'mb[]' mailbox view
As indicated in the comments, the `mb[]` a.k.a. `mbs []` views should
cover 0x400 (1024) bytes. However, the `mb[]` array covers four times
the size since `sizeof(FlexcanRegsMessageBuffer)` returns the size in
bytes instead of counting the number of uint32_t fields. This shifts the
subsequent register offsets by 0xc00 which is not intended. Fix the size
and thus the offsets by dropping the now unused `mb[]` view.
Note that the different size changes the migration layout. Since the device
model is new, no change in the version fields is needed.
Signed-off-by: Bernhard Beschow <shentey@gmail.com>
Tested-by: Pavel Pisa <pisa@fel.cvut.cz>
Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Message-id: 20260723070059.6332-8-shentey@gmail.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
diff --git a/include/hw/net/flexcan.h b/include/hw/net/flexcan.h
index d8159475e0..9affdff837 100644
--- a/include/hw/net/flexcan.h
+++ b/include/hw/net/flexcan.h
@@ -65,10 +65,8 @@ typedef struct FlexcanRegs {
uint32_t dbg1; /* 0x58, unused */
uint32_t dbg2; /* 0x5C, unused */
uint32_t _reserved3[8]; /* 0x60 */
- union { /* 0x80 - not affected by soft reset */
- uint32_t mb[sizeof(FlexcanRegsMessageBuffer) * FLEXCAN_MAILBOX_COUNT];
- FlexcanRegsMessageBuffer mbs[FLEXCAN_MAILBOX_COUNT];
- };
+ /* 0x80 - not affected by soft reset */
+ FlexcanRegsMessageBuffer mbs[FLEXCAN_MAILBOX_COUNT];
uint32_t _reserved4[256]; /* 0x480 */
uint32_t rximr[64]; /* 0x880 - not affected by soft reset */
uint32_t _reserved5[24]; /* 0x980 */