From: "Philippe Mathieu-Daudé" <f4bug@amsat.org>
To: Alistair Francis <alistair.francis@xilinx.com>,
"Edgar E . Iglesias" <edgar.iglesias@xilinx.com>,
Peter Maydell <peter.maydell@linaro.org>,
Andrew Baumann <Andrew.Baumann@microsoft.com>,
Prasad J Pandit <pjp@fedoraproject.org>,
Clement Deschamps <clement.deschamps@antfield.fr>
Cc: "Philippe Mathieu-Daudé" <f4bug@amsat.org>,
qemu-devel@nongnu.org, qemu-arm@nongnu.org,
"Peter Crosthwaite" <crosthwaite.peter@gmail.com>,
"Sai Pavan Boddu" <saipava@xilinx.com>,
"Isaac Lozano" <109lozanoi@gmail.com>,
"Andrzej Zaborowski" <balrogg@gmail.com>,
"Andrey Smirnov" <andrew.smirnov@gmail.com>,
"Andrey Yurovsky" <yurovsky@gmail.com>,
"Marc-André Lureau" <marcandre.lureau@redhat.com>,
"Eduardo Habkost" <ehabkost@redhat.com>,
"Markus Armbruster" <armbru@redhat.com>,
"Michael Roth" <mdroth@linux.vnet.ibm.com>,
"Daniel P . Berrange" <berrange@redhat.com>,
"Eric Blake" <eblake@redhat.com>, "Fam Zheng" <famz@redhat.com>,
"Thomas Huth" <thuth@redhat.com>,
"Paolo Bonzini" <pbonzini@redhat.com>
Subject: [Qemu-devel] [PATCH 00/26] SDCard housekeeping
Date: Wed, 13 Dec 2017 20:19:59 -0300 [thread overview]
Message-ID: <20171213232025.24503-1-f4bug@amsat.org> (raw)
Now that we have a way to write qtest in Python, lets start with a simple test
to perform basic card identification, covering many functions of the sd/sd.c
file.
[patch 1]
When a device is not MMIO-connected but rather plugged into a Bus, it is easier
to write tests using QMP.
So we add a 'sdbus-command' entry to directly operate on a SD Bus.
(Note this method should also work with all other QBus).
[patch 2]
We write a simple pyqtest, which
- resolve the SDBus QOM path in the test setup()
- verify default values for SD Spec v2.
Since have a test, lets run after each patch, so we are sure we don't break things.
[patch 4-14,20-23]
Add a bunch of trace events
[patch 3,11,15-18]
Aesthetic changes mostly
[other patches]
Trivial changes
Once this series applied, booting some Linux on a vexpress-a9 with few
sd*command traces enabled result in this outputs (which result useful to
understand/fix the different SD implementations):
48.687227:sdcard_normal_command IO_RW_DIRECT/ CMD52 arg 0x00000c00 (state idle)
48.687233:sdcard_command_response (no response) (state idle)
48.689237:sdcard_normal_command IO_RW_DIRECT/ CMD52 arg 0x80000c08 (state idle)
48.689244:sdcard_command_response (no response) (state idle)
48.690877:sdcard_normal_command GO_IDLE_STATE/ CMD00 arg 0x00000000 (state idle)
48.690890:sdcard_command_response (no response) (state idle)
48.723486:sdcard_normal_command SEND_IF_COND/ CMD08 arg 0x000001aa (state idle)
48.723507:sdcard_command_response 00 00 01 aa (state idle)
48.723886:sdcard_normal_command IO_SEND_OP_COND/ CMD05 arg 0x00000000 (state idle)
48.723892:sdcard_command_response (no response) (state idle)
48.724019:sdcard_normal_command IO_SEND_OP_COND/ CMD05 arg 0x00000000 (state idle)
48.724023:sdcard_command_response (no response) (state idle)
48.724110:sdcard_normal_command IO_SEND_OP_COND/ CMD05 arg 0x00000000 (state idle)
48.724115:sdcard_command_response (no response) (state idle)
48.724178:sdcard_normal_command IO_SEND_OP_COND/ CMD05 arg 0x00000000 (state idle)
48.724181:sdcard_command_response (no response) (state idle)
48.724999:sdcard_command_response 00 40 01 20 (state idle)
48.725214:sdcard_app_command SD_SEND_OP_COND/ACMD41 arg 0x00000000 (state idle)
48.725225:sdcard_command_response 40 ff ff 00 (state idle)
48.727113:sdcard_normal_command GO_IDLE_STATE/ CMD00 arg 0x00000000 (state idle)
48.727125:sdcard_command_response (no response) (state idle)
48.729206:sdcard_normal_command SEND_IF_COND/ CMD08 arg 0x000001aa (state idle)
48.729213:sdcard_command_response 00 00 01 aa (state idle)
48.729339:sdcard_command_response 00 00 01 20 (state idle)
48.729412:sdcard_app_command SD_SEND_OP_COND/ACMD41 arg 0x40300000 (state idle)
48.729419:sdcard_command_response c0 ff ff 00 (state ready)
48.729786:sdcard_normal_command ALL_SEND_CID/ CMD02 arg 0x00000000 (state ready)
48.729797:sdcard_command_response aa 58 59 51 45 4d 55 21 01 de ad be ef 00 62 19 (state identification)
48.730825:sdcard_normal_command SEND_RELATIVE_ADDR/ CMD03 arg 0x00000000 (state identification)
48.730835:sdcard_command_response 45 67 05 00 (state standby)
48.731221:sdcard_normal_command SEND_CSD/ CMD09 arg 0x45670000 (state standby)
48.731228:sdcard_command_response 40 0e 00 32 5b 59 00 00 0d 47 7f 80 0a 40 00 00 (state standby)
48.732012:sdcard_normal_command SELECT/DESELECT_CARD/ CMD07 arg 0x45670000 (state standby)
48.732021:sdcard_command_response 00 00 07 00 (state transfer)
48.732419:sdcard_command_response 00 00 09 20 (state transfer)
48.764983:sdcard_app_command SEND_SCR/ACMD51 arg 0x00000000 (state transfer)
48.765000:sdcard_command_response 00 00 09 20 (state sendingdata)
48.766951:sdcard_command_response 00 00 09 20 (state transfer)
48.767159:sdcard_app_command SD_STATUS/ACMD13 arg 0x00000000 (state transfer)
48.767168:sdcard_command_response 00 00 09 20 (state sendingdata)
48.966731:sdcard_normal_command READ_MULTIPLE_BLOCK/ CMD18 arg 0x00000000 (state transfer)
48.966763:sdcard_command_response 00 00 09 00 (state sendingdata)
48.974869:sdcard_normal_command STOP_TRANSMISSION/ CMD12 arg 0x00000000 (state sendingdata)
48.974877:sdcard_command_response 00 00 0b 00 (state transfer)
50.044308:sdcard_normal_command SEND_STATUS/ CMD13 arg 0x45670000 (state transfer)
50.044330:sdcard_command_response 00 00 09 00 (state transfer)
[...]
Regards,
Phil.
Based-on: 20171213213557.26561-7-f4bug@amsat.org
(QTests: use Python to run complex tests)
Philippe Mathieu-Daudé (26):
sdbus: add a QMP command to access a SDBus
sdcard: add Python qtests
sdcard: use ldst API
sdcard: replace fprintf() -> qemu_log_mask()
sdcard: rename sd_set_mode() -> sd_update_mode()
sdcard: add sd_set_mode()
sdcard: add sdcard_set_mode() trace event
sdcard: add sd_set_state()
sdcard: add a sdcard_set_state() trace event
sdcard: use more detailled state/mode trace events
sdcard: use warn_report() instead of fprintf()
sdcard: replace DPRINTF() by trace events
sdcard: add more trace events
sdcard: use qemu_hexbuf_strdup() to trace command response
sdcard: use PW_LEN define instead of '16' magic
sdcard: let cmd_valid_while_locked() returns a bool
sdcard: rename sd_set_REG() functions called by sd_reset() as sd_reset_REG()
sdcard: move Memory Card registers together
sdcard: add DSR register
sdcard: add/use SD_CMD_MAX to check valid SD commands
sdcard: add sd_cmd_abbreviation() to resolve the SD command id
sdcard: reduce sd_cmd traces
sdcard: add ACMD trace events
sdcard: use a 16-bit type for the 16-bit RCA register
sdcard: add/use a SDCardCommandClass enum instead of magic numbers
sdcard: add/use a ccc_spi enum for the commands supported in SPI mode
qapi-schema.json | 41 ++++
hw/sd/core.c | 43 ++++
hw/sd/sd.c | 519 +++++++++++++++++++++++++++++++------------------
stubs/qmp_sdbus.c | 11 ++
hw/sd/trace-events | 17 ++
stubs/Makefile.objs | 1 +
tests/Makefile.include | 2 +
tests/sdcard_tests.py | 172 ++++++++++++++++
8 files changed, 617 insertions(+), 189 deletions(-)
create mode 100644 stubs/qmp_sdbus.c
create mode 100755 tests/sdcard_tests.py
--
2.15.1
next reply other threads:[~2017-12-13 23:20 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-13 23:19 Philippe Mathieu-Daudé [this message]
2017-12-13 23:20 ` [Qemu-devel] [PATCH 01/26] sdbus: add a QMP command to access a SDBus Philippe Mathieu-Daudé
2017-12-14 9:06 ` Kevin Wolf
2017-12-14 9:34 ` Paolo Bonzini
2017-12-14 13:25 ` Philippe Mathieu-Daudé
2017-12-15 8:13 ` Paolo Bonzini
2017-12-14 13:18 ` Philippe Mathieu-Daudé
2017-12-15 19:53 ` Eric Blake
2017-12-13 23:20 ` [Qemu-devel] [RFC PATCH 02/26] sdcard: add a Python qtest Philippe Mathieu-Daudé
2017-12-14 9:34 ` Paolo Bonzini
2017-12-13 23:20 ` [Qemu-devel] [PATCH 03/26] sdcard: use ldst API Philippe Mathieu-Daudé
2017-12-13 23:20 ` [Qemu-devel] [PATCH 04/26] sdcard: replace fprintf() -> qemu_log_mask() Philippe Mathieu-Daudé
2017-12-13 23:20 ` [Qemu-devel] [PATCH 05/26] sdcard: rename sd_set_mode() -> sd_update_mode() Philippe Mathieu-Daudé
2017-12-13 23:20 ` [Qemu-devel] [PATCH 06/26] sdcard: add sd_set_mode() Philippe Mathieu-Daudé
2017-12-13 23:20 ` [Qemu-devel] [PATCH 07/26] sdcard: add sdcard_set_mode() trace event Philippe Mathieu-Daudé
2017-12-13 23:20 ` [Qemu-devel] [PATCH 08/26] sdcard: add sd_set_state() Philippe Mathieu-Daudé
2017-12-13 23:20 ` [Qemu-devel] [PATCH 09/26] sdcard: add a sdcard_set_state() trace event Philippe Mathieu-Daudé
2017-12-13 23:20 ` [Qemu-devel] [PATCH 10/26] sdcard: use more detailled state/mode trace events Philippe Mathieu-Daudé
2017-12-13 23:20 ` [Qemu-devel] [PATCH 11/26] sdcard: use warn_report() instead of fprintf() Philippe Mathieu-Daudé
2017-12-13 23:20 ` [Qemu-devel] [PATCH 12/26] sdcard: replace DPRINTF() by trace events Philippe Mathieu-Daudé
2017-12-13 23:20 ` [Qemu-devel] [PATCH 13/26] sdcard: add more " Philippe Mathieu-Daudé
2017-12-13 23:20 ` [Qemu-devel] [RFC PATCH 14/26] sdcard: use qemu_hexbuf_strdup() to trace command response Philippe Mathieu-Daudé
2017-12-13 23:20 ` [Qemu-devel] [PATCH 15/26] sdcard: use PW_LEN define instead of '16' magic Philippe Mathieu-Daudé
2017-12-13 23:20 ` [Qemu-devel] [PATCH 16/26] sdcard: let cmd_valid_while_locked() returns a bool Philippe Mathieu-Daudé
2017-12-13 23:20 ` [Qemu-devel] [PATCH 17/26] sdcard: rename sd_set_REG() functions called by sd_reset() as sd_reset_REG() Philippe Mathieu-Daudé
2017-12-13 23:20 ` [Qemu-devel] [PATCH 18/26] sdcard: move Memory Card registers together Philippe Mathieu-Daudé
2017-12-13 23:20 ` [Qemu-devel] [PATCH 19/26] sdcard: add DSR register Philippe Mathieu-Daudé
2017-12-13 23:20 ` [Qemu-devel] [PATCH 20/26] sdcard: add/use SD_CMD_MAX to check valid SD commands Philippe Mathieu-Daudé
2017-12-13 23:20 ` [Qemu-devel] [PATCH 21/26] sdcard: add sd_cmd_abbreviation() to resolve the SD command id Philippe Mathieu-Daudé
2017-12-13 23:20 ` [Qemu-devel] [PATCH 22/26] sdcard: reduce sd_cmd traces Philippe Mathieu-Daudé
2017-12-13 23:20 ` [Qemu-devel] [PATCH 23/26] sdcard: add ACMD trace events Philippe Mathieu-Daudé
2017-12-13 23:20 ` [Qemu-devel] [PATCH 24/26] sdcard: use a 16-bit type for the 16-bit RCA register Philippe Mathieu-Daudé
2017-12-13 23:20 ` [Qemu-devel] [PATCH 25/26] sdcard: add/use a SDCardCommandClass enum instead of magic numbers Philippe Mathieu-Daudé
2017-12-13 23:20 ` [Qemu-devel] [PATCH 26/26] sdcard: add/use a ccc_spi enum for the commands supported in SPI mode Philippe Mathieu-Daudé
2017-12-14 1:29 ` [Qemu-devel] [PATCH 00/26] SDCard housekeeping Philippe Mathieu-Daudé
2017-12-16 0:13 ` Alistair Francis
2018-01-02 16:40 ` Philippe Mathieu-Daudé
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=20171213232025.24503-1-f4bug@amsat.org \
--to=f4bug@amsat.org \
--cc=109lozanoi@gmail.com \
--cc=Andrew.Baumann@microsoft.com \
--cc=alistair.francis@xilinx.com \
--cc=andrew.smirnov@gmail.com \
--cc=armbru@redhat.com \
--cc=balrogg@gmail.com \
--cc=berrange@redhat.com \
--cc=clement.deschamps@antfield.fr \
--cc=crosthwaite.peter@gmail.com \
--cc=eblake@redhat.com \
--cc=edgar.iglesias@xilinx.com \
--cc=ehabkost@redhat.com \
--cc=famz@redhat.com \
--cc=marcandre.lureau@redhat.com \
--cc=mdroth@linux.vnet.ibm.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=pjp@fedoraproject.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=saipava@xilinx.com \
--cc=thuth@redhat.com \
--cc=yurovsky@gmail.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).