qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 09/23] hw/sd/sdcard: Generate random RCA value


From: Philippe Mathieu-Daudé
Subject: Re: [PATCH 09/23] hw/sd/sdcard: Generate random RCA value
Date: Tue, 2 Jul 2024 16:10:22 +0200
User-agent: Mozilla Thunderbird

On 2/7/24 15:13, Philippe Mathieu-Daudé wrote:
On 21/6/24 11:44, Philippe Mathieu-Daudé wrote:
On 21/6/24 10:05, Philippe Mathieu-Daudé wrote:
Rather than using the obscure 0x4567 magic value,
use a real random one.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
  hw/sd/sd.c | 8 ++------
  1 file changed, 2 insertions(+), 6 deletions(-)


Hmm the NPCM7xx test is failing:

▶  58/450 ERROR:../tests/qtest/npcm7xx_sdhci-test.c:101:sdwrite_read: assertion failed: (!memcmp(rmsg, msg, len)) ERROR

But booting various Linux / FreeBSD guests on SD cards works,
so I suppose the test (or TYPE_NPCM7XX_SDHCI model) need some
rework.

$ git grep 0x4567
tests/qtest/npcm7xx_sdhci-test.c:47:    sdhci_cmd_regs(qts, NPCM7XX_MMC_BA, 0, 0, 0x45670000, 0,
tests/qtest/npcm7xx_sdhci-test.c-48- SDHC_SELECT_DESELECT_CARD);

In tests/qtest/libqos/sdhci-cmd.h:

/* CMD Reg */
#define SDHC_SEND_RELATIVE_ADDR (3 << 8)
#define SDHC_SELECT_DESELECT_CARD (7 << 8)

IIUC setup_sd_card():

card address is queried ...:

     sdhci_cmd_regs(qts, NPCM7XX_MMC_BA, 0, 0, 0, 0,
                    SDHC_SEND_RELATIVE_ADDR);

... but then ignored and magic 0x4567 is used instead:

     sdhci_cmd_regs(qts, NPCM7XX_MMC_BA, 0, 0, 0x45670000, 0,
                    SDHC_SELECT_DESELECT_CARD);

OK, so this test need rework. I see the sdhci_read_cmd()
method but it reads the SDHC_BDATA FIFO register, not sure
this is what should be used to read the RCA from R6 command
response.

Fix: 20240702140842.54242-4-philmd@linaro.org/">https://lore.kernel.org/qemu-devel/20240702140842.54242-4-philmd@linaro.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]