qemu-cr16/hw/i2c
Jamin Lin 0b1ddf19d0 hw/i2c/aspeed_i2c: Fix DMA moving data into incorrect address
In the previous design, the I2C model updated dma_dram_offset only when
firmware programmed the RX/TX DMA buffer address registers. The firmware
used to rewrite these registers before issuing each DMA command.

The firmware driver behavior has changed to program the DMA address
registers only once during I2C initialization. As a result, the I2C model
no longer refreshes dma_dram_offset, causing DMA to move data into an
incorrect DRAM address.

Fix this by introducing helper functions to update dma_dram_offset from
the DMA address registers, and invoke them right before handling TX/RX
DMA operations. This guarantees DMA always uses the correct buffer
address even if the registers are programmed only once.

Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>
Fixes: c400c38854 ("hw/i2c/aspeed: Introduce a new dma_dram_offset attribute in AspeedI2Cbus")
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Link: https://lore.kernel.org/qemu-devel/20260203020855.1642884-5-jamin_lin@aspeedtech.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
(cherry picked from commit efea7ddb4689a1ac4bce63a9ddb32887c7f3ac50)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2026-02-06 00:13:25 +03:00
..
allwinner-i2c.c qom: Have class_init() take a const data argument 2025-04-25 17:00:41 +02:00
arm_sbcon_i2c.c hw/i2c/versatile_i2c: Rename versatile_i2c -> arm_sbcon_i2c 2023-01-23 13:32:38 +00:00
aspeed_i2c.c hw/i2c/aspeed_i2c: Fix DMA moving data into incorrect address 2026-02-06 00:13:25 +03:00
bcm2835_i2c.c qom: Have class_init() take a const data argument 2025-04-25 17:00:41 +02:00
bitbang_i2c.c qom: Have class_init() take a const data argument 2025-04-25 17:00:41 +02:00
core.c qom: Have class_init() take a const data argument 2025-04-25 17:00:41 +02:00
exynos4210_i2c.c qom: Have class_init() take a const data argument 2025-04-25 17:00:41 +02:00
i2c_mux_pca954x.c qom: Have class_init() take a const data argument 2025-04-25 17:00:41 +02:00
imx_i2c.c hw/i2c/imx: Fix trace func name error 2025-12-31 18:02:43 +03:00
Kconfig hw/i2c: Implement Broadcom Serial Controller (BSC) 2024-03-05 13:22:55 +00:00
meson.build hw/i2c: Implement Broadcom Serial Controller (BSC) 2024-03-05 13:22:55 +00:00
microbit_i2c.c qom: Have class_init() take a const data argument 2025-04-25 17:00:41 +02:00
mpc_i2c.c qom: Have class_init() take a const data argument 2025-04-25 17:00:41 +02:00
npcm7xx_smbus.c qom: Have class_init() take a const data argument 2025-04-25 17:00:41 +02:00
omap_i2c.c hw/arm: Replace TABs for spaces in OMAP board and device code 2025-05-14 14:29:47 +01:00
pm_smbus.c cleanup: Drop pointless return at end of function 2025-04-24 09:33:42 +02:00
pmbus_device.c qom: Have class_init() take a const data argument 2025-04-25 17:00:41 +02:00
ppc4xx_i2c.c qom: Have class_init() take a const data argument 2025-04-25 17:00:41 +02:00
smbus_eeprom.c hw/i2c/smbus_eeprom: Add minimum write recovery time for DDR2 2025-10-21 20:09:57 +02:00
smbus_ich9.c qom: Make InterfaceInfo[] uses const 2025-04-25 17:00:41 +02:00
smbus_master.c hw/i2c: Introduce i2c_start_recv() and i2c_start_send() 2021-07-08 14:15:01 -05:00
smbus_slave.c qom: Have class_init() take a const data argument 2025-04-25 17:00:41 +02:00
trace-events hw/i2c/imx_i2c: Convert DPRINTF() to trace events 2025-01-13 17:16:04 +01:00
trace.h trace: switch position of headers to what Meson requires 2020-08-21 06:18:24 -04:00