> Subject: Re: [PATCH v2 5/6] hw/i2c/aspeed: fix DMA transfer in non-packet
> mode
> 
> On 10/27/26 20:50, Timur Maksimov wrote:
> > Avoid calling aspeed_i2c_set_tx_dma_dram_offset twice in non-packet
> > mode where this function is called first in aspeed_i2c_get_addr.
> > Also fix writing to I2CD_DMA_ADDR in old register mode.
> 
> This should be 2 changes.
> 
> > Signed-off-by: Timur Maksimov <[email protected]>
> > ---
> >   hw/i2c/aspeed_i2c.c | 6 +++++-
> >   1 file changed, 5 insertions(+), 1 deletion(-)
> >
> > diff --git a/hw/i2c/aspeed_i2c.c b/hw/i2c/aspeed_i2c.c index
> > 510758fb7a..a2b4c8b576 100644
> > --- a/hw/i2c/aspeed_i2c.c
> > +++ b/hw/i2c/aspeed_i2c.c
> > @@ -416,7 +416,9 @@ static int aspeed_i2c_bus_send(AspeedI2CBus *bus,
> bool send_addr)
> >           if (aspeed_i2c_is_new_mode(bus->controller)) {
> >               ARRAY_FIELD_DP32(bus->regs, I2CM_DMA_LEN_STS,
> TX_LEN, 0);
> >           }
> > -        aspeed_i2c_set_tx_dma_dram_offset(bus);
> > +        if (!send_addr) {
> > +            aspeed_i2c_set_tx_dma_dram_offset(bus);
> > +        }
> >           while (bus->regs[reg_dma_len]) {
> >               uint8_t data;
> >               ret = aspeed_i2c_dma_read(bus, &data);
> 
> 
> Fixes: efea7ddb4689 ("hw/i2c/aspeed_i2c: Fix DMA moving data into incorrect
> address")
> 

This please see my comments in patch 4.

> > @@ -1070,11 +1072,13 @@ static void
> aspeed_i2c_bus_old_write(AspeedI2CBus *bus, hwaddr offset,
> >           bus->pending_intr_sts |= old_intr & cmd_intr;
> >           aspeed_i2c_bus_raise_interrupt(bus);
> >           break;
> > +
> >       case A_I2CD_DMA_ADDR:
> >           if (!aic->has_dma) {
> >               qemu_log_mask(LOG_GUEST_ERROR, "%s: No DMA
> support\n",  __func__);
> >               break;
> >           }
> > +        bus->regs[R_I2CD_DMA_ADDR] = value;
> >           break;
> >
> >       case A_I2CD_DMA_LEN:
> >
> 
> and
> 
> Fixes: 2260fc6ff3ff ("aspeed: i2c: Use reg array instead of individual vars")
> 

This looks good to me.

> Thanks,
> 
> C.

Reply via email to