All of lore.kernel.org
 help / color / mirror / Atom feed
From: Timur Maksimov <gessingate@gmail.com>
To: Jamin Lin <jamin_lin@aspeedtech.com>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>
Cc: "Paolo Bonzini" <pbonzini@redhat.com>,
	"Cédric Le Goater" <clg@kaod.org>,
	"Peter Maydell" <peter.maydell@linaro.org>,
	"Kane Chen" <kane_chen@aspeedtech.com>,
	"qemu-arm@nongnu.org" <qemu-arm@nongnu.org>,
	"Fabiano Rosas" <farosas@suse.de>,
	"Laurent Vivier" <lvivier@redhat.com>
Subject: Re: [PATCH v2 4/6] hw/i2c/aspeed: fix buffer transfer in non-packet mode
Date: Thu, 29 Oct 2026 11:45:16 +0300	[thread overview]
Message-ID: <b2cb177dd23af09fff8ed4c961eb06240a8253ad.camel@gmail.com> (raw)
In-Reply-To: <SEZPR06MB7362E41CDA36CBE3ADB0F286FC6E2@SEZPR06MB7362.apcprd06.prod.outlook.com>

Hi, Jamin.

Understood. I don’t planning to write a driver, but I might verify them
if I have some time. Otherwise, let’s just skip them,  as I am not sure
that the current implementation is incorrect.

On Thu, 2026-10-29 at 07:44 +0000, Jamin Lin wrote:
> Hi Timur, 
> 
> I'm not saying they don't work.
> 
> My main concern is that we currently don't have firmware to test this
> mode on real hardware.
> Although we can test it in QEMU using QTest, this does not guarantee
> that QEMU behaves the same way as real hardware.
> Without testing on real hardware, we cannot confirm that the behavior
> implemented by this patch matches the actual hardware behavior.
> 
> That said, I think the QTest in this series is very useful, as the
> functional tests don't cover all the I2C modes.
> 
> Thanks,
> Jamin
> 
> > Subject: Re: [PATCH v2 4/6] hw/i2c/aspeed: fix buffer transfer in
> > non-packet
> > mode
> > 
> > Hi Jamin, you are right;  no driver uses those modes, and I can't
> > verify their
> > work at the moment.
> > Do you suppose, that they don't work? Are there issues with them?
> > We can exclude them from tests, but  buffer mode is important for
> > old chips
> > like AST2500.
> > 
> > On Thu, 2026-10-29 at 06:33 +0000, Jamin Lin wrote:
> > > Hi Timur,
> > > 
> > > As far as I can see, no ASPEED Linux driver uses non-packet
> > > buffer or
> > > DMA mode for master transfers:
> > > - i2c-aspeed.c (old register mode) only uses byte mode; the
> > > address
> > >   is always written to the byte buffer register before START.
> > > - i2c-ast2600.c in the ASPEED SDK kernel (new register mode) sets
> > >   PKT_EN for every master transfer, and the address comes from
> > >   PKT_ADDR.
> > > 
> > > Have you verified this behavior on real hardware? Which firmware
> > > are
> > > you running that uses non-packet buffer/DMA mode?
> > > 
> > > Thanks,
> > > Jamin
> > > 
> > > > Subject: [PATCH v2 4/6] hw/i2c/aspeed: fix buffer transfer in
> > > > non-
> > > > packet mode
> > > > 
> > > > In non-packet mode, the first byte of the tx buffer pool
> > > > contains a
> > > > device address, so avoid sending it as a data byte.
> > > > 
> > > > Fixes: 961faf3ddbd8 ("hw/i2c/aspeed: Fix TXBUF transmission
> > > > start
> > > > position
> > > > error")
> > > > Signed-off-by: Timur Maksimov <gessingate@gmail.com>
> > > > ---
> > > >  hw/i2c/aspeed_i2c.c | 11 +++++++----
> > > >  1 file changed, 7 insertions(+), 4 deletions(-)
> > > > 
> > > > diff --git a/hw/i2c/aspeed_i2c.c b/hw/i2c/aspeed_i2c.c index
> > > > ff6ef6d23a..510758fb7a 100644
> > > > --- a/hw/i2c/aspeed_i2c.c
> > > > +++ b/hw/i2c/aspeed_i2c.c
> > > > @@ -382,7 +382,7 @@ static void
> > > > aspeed_i2c_bus_recv_dma_pool(AspeedI2CBus *bus)
> > > >      SHARED_ARRAY_FIELD_DP32(bus->regs, reg_cmd, RX_DMA_EN,
> > 0);  }
> > > > 
> > > > -static int aspeed_i2c_bus_send(AspeedI2CBus *bus)
> > > > +static int aspeed_i2c_bus_send(AspeedI2CBus *bus, bool
> > > > send_addr)
> > > >  {
> > > >      AspeedI2CClass *aic = ASPEED_I2C_GET_CLASS(bus-
> > > > >controller);
> > > >      int ret = -1;
> > > > @@ -391,11 +391,12 @@ static int
> > > > aspeed_i2c_bus_send(AspeedI2CBus
> > > > *bus)
> > > >      uint32_t reg_pool_ctrl =
> > > > aspeed_i2c_bus_pool_ctrl_offset(bus);
> > > >      uint32_t reg_byte_buf =
> > > > aspeed_i2c_bus_byte_buf_offset(bus);
> > > >      uint32_t reg_dma_len = aspeed_i2c_bus_dma_len_offset(bus);
> > > > +    uint8_t pool_offset = send_addr ? 1 : 0;
> > > >      int pool_tx_count = SHARED_ARRAY_FIELD_EX32(bus->regs,
> > > > reg_pool_ctrl,
> > > 
> > >                                                  T
> > X_COUNT) + 1;
> > > > 
> > > >      if (SHARED_ARRAY_FIELD_EX32(bus->regs, reg_cmd,
> > > > TX_BUFF_EN))
> > {
> > > > -        for (i = 0; i < pool_tx_count; i++) {
> > > > +        for (i = pool_offset; i < pool_tx_count; i++) {
> > > >              uint8_t *pool_base = aic->bus_pool_base(bus);
> > > > 
> > > >              trace_aspeed_i2c_bus_send("BUF", i + 1,
> > pool_tx_count,
> > > > @@
> > > > -633,6 +634,7 @@ static void
> > > > aspeed_i2c_bus_handle_cmd(AspeedI2CBus
> > > > *bus, uint64_t value)
> > > >      uint32_t reg_intr_sts =
> > > > aspeed_i2c_bus_intr_sts_offset(bus);
> > > >      uint32_t reg_cmd = aspeed_i2c_bus_cmd_offset(bus);
> > > >      uint32_t reg_dma_len = aspeed_i2c_bus_dma_len_offset(bus);
> > > > +    bool start_cmd = SHARED_ARRAY_FIELD_EX32(bus->regs,
> > > > reg_cmd,
> > > > +M_START_CMD);
> > > > 
> > > >      if (!aspeed_i2c_check_sram(bus)) {
> > > >          return;
> > > > @@ -642,7 +644,7 @@ static void
> > > > aspeed_i2c_bus_handle_cmd(AspeedI2CBus *bus, uint64_t value)
> > > >          aspeed_i2c_bus_cmd_dump(bus);
> > > >      }
> > > > 
> > > > -    if (SHARED_ARRAY_FIELD_EX32(bus->regs, reg_cmd,
> > M_START_CMD)) {
> > > > +    if (start_cmd) {
> > > >          uint8_t state = aspeed_i2c_get_state(bus) &
> > I2CD_MACTIVE ?
> > > >              I2CD_MSTARTR : I2CD_MSTART;
> > > >          uint8_t addr;
> > > > @@ -686,7 +688,8 @@ static void
> > > > aspeed_i2c_bus_handle_cmd(AspeedI2CBus *bus, uint64_t value)
> > > > 
> > > >      if (SHARED_ARRAY_FIELD_EX32(bus->regs, reg_cmd, M_TX_CMD))
> > {
> > > >          aspeed_i2c_set_state(bus, I2CD_MTXD);
> > > > -        if (aspeed_i2c_bus_send(bus)) {
> > > > +        if (aspeed_i2c_bus_send(bus, start_cmd &&
> > > > 
> > +                                     !aspeed_i2c_bus_pkt
> > _mode_en
> > > > (bus)))
> > > > + {
> > > >              SHARED_ARRAY_FIELD_DP32(bus->regs, reg_intr_sts,
> > > > TX_NAK, 1);
> > > >              i2c_end_transfer(bus->bus);
> > > >          } else {
> > > > 
> > > > --
> > > > 2.53.0


  reply	other threads:[~2026-10-29  8:45 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-27 19:50 [PATCH v2 0/6] hw/i2c/aspeed: fix non-packet buffer and DMA transfer modes Timur Maksimov
2026-10-27 19:50 ` [PATCH v2 1/6] hw/i2c: add dummy device Timur Maksimov
2026-10-28  8:54   ` Cédric Le Goater
2026-10-28 10:17     ` Markus Armbruster
2026-10-28 11:04       ` Cédric Le Goater
2026-10-28 11:26         ` Markus Armbruster
2026-10-28 16:20       ` Timur Maksimov
2026-10-29  7:22         ` Markus Armbruster
2026-10-29  8:20           ` Timur Maksimov
2026-10-29  8:37             ` Cédric Le Goater
2026-10-29 12:45               ` Corey Minyard
2026-10-29 13:04                 ` Cédric Le Goater
2026-10-29 15:56                   ` Corey Minyard
2026-10-27 19:50 ` [PATCH v2 2/6] hw/i2c/aspeed: fix BUSY status reading in new register mode Timur Maksimov
2026-10-28  8:17   ` Cédric Le Goater
2026-10-28 21:24   ` Cédric Le Goater
2026-10-29  5:21   ` Jamin Lin
2026-10-27 19:50 ` [PATCH v2 3/6] hw/i2c/aspeed: fix I2CD_CMD register reading Timur Maksimov
2026-10-29  5:23   ` Jamin Lin
2026-10-27 19:50 ` [PATCH v2 4/6] hw/i2c/aspeed: fix buffer transfer in non-packet mode Timur Maksimov
2026-10-29  6:33   ` Jamin Lin
2026-10-29  7:23     ` Timur Maksimov
2026-10-29  7:44       ` Jamin Lin
2026-10-29  8:45         ` Timur Maksimov [this message]
2026-10-27 19:50 ` [PATCH v2 5/6] hw/i2c/aspeed: fix DMA " Timur Maksimov
2026-10-28 21:32   ` Cédric Le Goater
2026-10-29  6:23     ` Jamin Lin
2026-10-27 19:50 ` [PATCH v2 6/6] tests/qtest: Add cases for 32-bit Aspeed I2C controllers Timur Maksimov
2026-10-28  8:56   ` Cédric Le Goater
2026-10-28 14:47     ` Timur Maksimov
2026-10-29  7:25       ` Jamin Lin
2026-10-29  8:25         ` Timur Maksimov
2026-10-28 11:07 ` [PATCH v2 0/6] hw/i2c/aspeed: fix non-packet buffer and DMA transfer modes Cédric Le Goater

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b2cb177dd23af09fff8ed4c961eb06240a8253ad.camel@gmail.com \
    --to=gessingate@gmail.com \
    --cc=clg@kaod.org \
    --cc=farosas@suse.de \
    --cc=jamin_lin@aspeedtech.com \
    --cc=kane_chen@aspeedtech.com \
    --cc=lvivier@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.