From: Peter Delevoryas <peter@pjd.dev>
Cc: peter@pjd.dev, patrick@stwcx.xyz, clg@kaod.org,
peter.maydell@linaro.org, andrew@aj.id.au, joel@jms.id.au,
qemu-arm@nongnu.org, qemu-devel@nongnu.org, dz4list@gmail.com
Subject: [PATCH 0/1] hw/i2c/aspeed: Fix old reg slave receive
Date: Sat, 20 Aug 2022 15:57:11 -0700 [thread overview]
Message-ID: <20220820225712.713209-1-peter@pjd.dev> (raw)
Hey everyone,
I haven't gotten a chance to work on the Aspeed I2C controller in a little
while, but I finally started looking at it again and noticed the
old-register mode slave receive function (master-send-to-slave) does the
wrong thing for the first byte. See the commit message for details.
I noticed this because I have a qtest for slave mode rx in old-register mode
downstream [1] (I'm also working on a version of the test that can be
upstreamed) that broke when I updated our QEMU branch to the 7.1 release.
Previously I was using Klaus's original slave I2C patches from [2].
An example of the test running successfully with this change is pasted below,
for whatever that's worth.
Thanks,
Peter
[1]: https://github.com/facebook/openbmc/blob/helium/common/recipes-devtools/qemu/qemu/0008-hw-misc-Add-byte-by-byte-i2c-network-device.patch
[2]: https://lore.kernel.org/qemu-devel/20220331165737.1073520-4-its@irrelevant.dk/
# random seed: R02S5d2728d1347dc8b50533a0d85ebb1b02
# starting QEMU: exec build/qemu-system-arm -qtest unix:/tmp/qtest-711521.sock -qtest-log /dev/null -chardev socket,path=/tmp/qtest-711521.qmp,id=char0 -mon chardev=char0,mode=control -display none -machine fby35-bmc -netdev socket,id=socket0,udp=127.0.0.1:5000,localaddr=127.0.0.1:6000 -device i2c-netdev2,bus=aspeed.i2c.bus.0,address=0x32,netdev=socket0 -accel qtest
i2c_netdev2_class_init
i2c_netdev2_realize
i2c_netdev2_can_receive
1..2
# Start of arm tests
# Start of ast2600 tests
# Start of i2c tests
i2c_netdev2_handle_event: 1
../hw/misc/i2c-netdev2.c: tx [64, 00, 00]
../hw/misc/i2c-netdev2.c: tx [de]
../hw/misc/i2c-netdev2.c: tx [ad]
../hw/misc/i2c-netdev2.c: tx [be]
../hw/misc/i2c-netdev2.c: tx [ef]
i2c_netdev2_handle_event: 3
../hw/misc/i2c-netdev2.c: tx [00, 00, 00, 00]
i2c_netdev2_can_receive
../hw/misc/i2c-netdev2.c: rx [01, 00]
i2c_netdev2_can_receive
../hw/misc/i2c-netdev2.c: rx [01, 00]
i2c_netdev2_can_receive
../hw/misc/i2c-netdev2.c: rx [01, 00]
i2c_netdev2_can_receive
../hw/misc/i2c-netdev2.c: rx [01, 00]
i2c_netdev2_can_receive
../hw/misc/i2c-netdev2.c: rx [01, 00]
ok 1 /arm/ast2600/i2c/write_in_old_byte_mode
i2c_netdev2_can_receive
../hw/misc/i2c-netdev2.c: rx [20, 00, 00]
prev rx_buf: [00, 00, 00, 00, 00, 00, 00, 00, 00, 00]
next rx_buf: [20, 00, 00, 00, 00, 00, 00, 00, 00, 00]
i2c_netdev2_slave_mode_rx: rx_len=3
i2c_netdev2_slave_mode_rx: rx_len=3
i2c_netdev2_slave_mode_rx: guest OS ack rx, clearing rx_len
i2c_netdev2_can_receive
../hw/misc/i2c-netdev2.c: rx [de]
prev rx_buf: [20, 00, 00, 00, 00, 00, 00, 00, 00, 00]
next rx_buf: [de, 00, 00, 00, 00, 00, 00, 00, 00, 00]
i2c_netdev2_slave_mode_rx: rx_len=1
i2c_netdev2_slave_mode_rx: rx_len=1
i2c_netdev2_slave_mode_rx: guest OS ack rx, clearing rx_len
i2c_netdev2_can_receive
../hw/misc/i2c-netdev2.c: rx [ad]
prev rx_buf: [de, 00, 00, 00, 00, 00, 00, 00, 00, 00]
next rx_buf: [ad, 00, 00, 00, 00, 00, 00, 00, 00, 00]
i2c_netdev2_slave_mode_rx: rx_len=1
i2c_netdev2_slave_mode_rx: rx_len=1
i2c_netdev2_slave_mode_rx: guest OS ack rx, clearing rx_len
i2c_netdev2_can_receive
../hw/misc/i2c-netdev2.c: rx [be]
prev rx_buf: [ad, 00, 00, 00, 00, 00, 00, 00, 00, 00]
next rx_buf: [be, 00, 00, 00, 00, 00, 00, 00, 00, 00]
i2c_netdev2_slave_mode_rx: rx_len=1
i2c_netdev2_slave_mode_rx: rx_len=1
i2c_netdev2_slave_mode_rx: guest OS ack rx, clearing rx_len
i2c_netdev2_can_receive
../hw/misc/i2c-netdev2.c: rx [ef]
prev rx_buf: [be, 00, 00, 00, 00, 00, 00, 00, 00, 00]
next rx_buf: [ef, 00, 00, 00, 00, 00, 00, 00, 00, 00]
i2c_netdev2_slave_mode_rx: rx_len=1
i2c_netdev2_slave_mode_rx: rx_len=1
i2c_netdev2_slave_mode_rx: guest OS ack rx, clearing rx_len
i2c_netdev2_can_receive
../hw/misc/i2c-netdev2.c: rx [ef, 00, 00, 00]
prev rx_buf: [ef, 00, 00, 00, 00, 00, 00, 00, 00, 00]
next rx_buf: [ef, 00, 00, 00, 00, 00, 00, 00, 00, 00]
i2c_netdev2_slave_mode_rx: rx_len=4
ok 2 /arm/ast2600/i2c/slave_mode_rx_byte_buf
# End of i2c tests
# End of ast2600 tests
# End of arm tests
i2c_netdev2_nic_cleanup
Peter Delevoryas (1):
hw/i2c/aspeed: Fix old reg slave receive
hw/i2c/aspeed_i2c.c | 8 +++++---
include/hw/i2c/aspeed_i2c.h | 1 +
2 files changed, 6 insertions(+), 3 deletions(-)
--
2.37.1
next reply other threads:[~2022-08-20 22:58 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-20 22:57 Peter Delevoryas [this message]
2022-08-20 22:57 ` [PATCH 1/1] hw/i2c/aspeed: Fix old reg slave receive Peter Delevoryas
2022-08-23 9:23 ` Klaus Jensen
2022-08-23 17:27 ` Peter Delevoryas
2022-08-24 14:31 ` Cédric Le Goater
2022-08-25 8:04 ` Peter Delevoryas
2022-08-25 9:02 ` 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=20220820225712.713209-1-peter@pjd.dev \
--to=peter@pjd.dev \
--cc=andrew@aj.id.au \
--cc=clg@kaod.org \
--cc=dz4list@gmail.com \
--cc=joel@jms.id.au \
--cc=patrick@stwcx.xyz \
--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.