Hi,
I found this bug by accident when doing avocado tests with the RISC-V
machines. Trying to migrate the sifive_u machine, which always has a SD
card, fails every time:
qemu-system-riscv64: ../hw/sd/sd.c:297: sd_ocr_powerup: Assertion
`!FIELD_EX32(sd->ocr, OCR, CARD_POWER_UP)' failed.
I'm sending it as RFC because I am not sure if this fix is a bandaid for
something else that should be worked on. The code in question was
introduced a while ago to circumvent a power on bug with EDK2, where a
timer was introduced to power on the card after receiving a ACMD41
event/command. There is a possibility that the assumptions made back
then no longer hold true.
Cc: Philippe Mathieu-Daudé <philmd@linaro.org>
Cc: Bin Meng <bin.meng@windriver.com>
Daniel Henrique Barboza (2):
hw/sd/sd.c: add sd_card_powered_up()
hw/sd: skip double power-up in sd_vmstate_pre_load()
hw/sd/sd.c | 23 ++++++++++++++++++-----
1 file changed, 18 insertions(+), 5 deletions(-)
--
2.39.0