@samitouri / QOSamiQemu / commits / ca56779a7a

hw/i3c/dw-i3c: Add register RO field masks

Adds read-only register masks for the DwC I3C controller. Signed-off-by: Joe Komlodi <komlodi@google.com> Reviewed-by: Patrick Venture <venture@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-10-jamin_lin@aspeedtech.com Signed-off-by: Cédric Le Goater <clg@redhat.com>

Jamin Lin committed Feb 25, 2026 at 02:12 UTC ca56779a7a39dc47591449724330d65aa44428a5
1 file changed +40
hw/i3c/dw-i3c.c
+40
@@ -296,6 +296,45 @@ static const uint32_t dw_i3c_resets[DW_I3C_NR_REGS] = {
296 [R_SLAVE_CONFIG] = 0x00000023,
297 };
298
299 +static const uint32_t dw_i3c_ro[DW_I3C_NR_REGS] = {
300 + [R_DEVICE_CTRL] = 0x04fffe00,
301 + [R_DEVICE_ADDR] = 0x7f807f80,
302 + [R_HW_CAPABILITY] = 0xffffffff,
303 + [R_IBI_QUEUE_STATUS] = 0xffffffff,
304 + [R_DATA_BUFFER_THLD_CTRL] = 0xf8f8f8f8,
305 + [R_IBI_QUEUE_CTRL] = 0xfffffff0,
306 + [R_RESET_CTRL] = 0xffffffc0,
307 + [R_SLV_EVENT_CTRL] = 0xffffff3f,
308 + [R_INTR_STATUS] = 0xffff809f,
309 + [R_INTR_STATUS_EN] = 0xffff8080,
310 + [R_INTR_SIGNAL_EN] = 0xffff8080,
311 + [R_INTR_FORCE] = 0xffff8000,
312 + [R_QUEUE_STATUS_LEVEL] = 0xffffffff,
313 + [R_DATA_BUFFER_STATUS_LEVEL] = 0xffffffff,
314 + [R_PRESENT_STATE] = 0xffffffff,
315 + [R_CCC_DEVICE_STATUS] = 0xffffffff,
316 + [R_I3C_VER_ID] = 0xffffffff,
317 + [R_I3C_VER_TYPE] = 0xffffffff,
318 + [R_DEVICE_ADDR_TABLE_POINTER] = 0xffffffff,
319 + [R_DEV_CHAR_TABLE_POINTER] = 0xffcbffff,
320 + [R_SLV_PID_VALUE] = 0xffff0fff,
321 + [R_SLV_CHAR_CTRL] = 0xffffffff,
322 + [A_VENDOR_SPECIFIC_REG_POINTER] = 0xffffffff,
323 + [R_SLV_MAX_LEN] = 0xffffffff,
324 + [R_MAX_READ_TURNAROUND] = 0xffffffff,
325 + [R_MAX_DATA_SPEED] = 0xffffffff,
326 + [R_SLV_INTR_REQ] = 0xfffffff0,
327 + [R_SLV_TSX_SYMBL_TIMING] = 0xffffffc0,
328 + [R_DEVICE_CTRL_EXTENDED] = 0xfffffff8,
329 + [R_SCL_I3C_OD_TIMING] = 0xff00ff00,
330 + [R_SCL_I3C_PP_TIMING] = 0xff00ff00,
331 + [R_SCL_I2C_FMP_TIMING] = 0xff000000,
332 + [R_SCL_EXT_TERMN_LCNT_TIMING] = 0x0000fff0,
333 + [R_BUS_IDLE_TIMING] = 0xfff00000,
334 + [R_EXTENDED_CAPABILITY] = 0xffffffff,
335 + [R_SLAVE_CONFIG] = 0xffffffff,
336 +};
337 +
338 static uint64_t dw_i3c_read(void *opaque, hwaddr offset, unsigned size)
339 {
340 DWI3C *s = DW_I3C(opaque);
@@ -324,6 +363,7 @@ static void dw_i3c_write(void *opaque, hwaddr offset, uint64_t value,
363
364 trace_dw_i3c_write(s->id, offset, value);
365
366 + value &= ~dw_i3c_ro[addr];
367 switch (addr) {
368 case R_HW_CAPABILITY:
369 case R_RESPONSE_QUEUE_PORT: