@samitouri / QOSamiQemu / commits / 21d3af36b0

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>

Bernhard Beschow committed Jul 27, 2026 at 10:28 UTC 21d3af36b0adab8e56f19fcbbb206b8273611cba
1 file changed +2 -4
include/hw/net/flexcan.h
+2 -4
@@ -65,10 +65,8 @@ typedef struct FlexcanRegs {
65 uint32_t dbg1; /* 0x58, unused */
66 uint32_t dbg2; /* 0x5C, unused */
67 uint32_t _reserved3[8]; /* 0x60 */
68 - union { /* 0x80 - not affected by soft reset */
69 - uint32_t mb[sizeof(FlexcanRegsMessageBuffer) * FLEXCAN_MAILBOX_COUNT];
70 - FlexcanRegsMessageBuffer mbs[FLEXCAN_MAILBOX_COUNT];
71 - };
68 + /* 0x80 - not affected by soft reset */
69 + FlexcanRegsMessageBuffer mbs[FLEXCAN_MAILBOX_COUNT];
70 uint32_t _reserved4[256]; /* 0x480 */
71 uint32_t rximr[64]; /* 0x880 - not affected by soft reset */
72 uint32_t _reserved5[24]; /* 0x980 */