tests/qtest: add Cadence SDHCI ADMA pacing/MMIO reproducer
PATCH 1/1 tests/qtest: add Cadence SDHCI ADMA pacing/MMIO reproducer
Add an image-free qtest for the microchip-icicle-kit machine that drives the generic SDHCI model (hw/sd/sdhci.c) through the Cadence wrapper (hw/sd/cadence_sdhci.c, SRS window at 0x20008200) directly over MMIO under "-accel qtest", where QEMU_CLOCK_VIRTUAL only advances when the test steps it.
It reproduces two aspects of the ADMA2 engine objectively, without any guest firmware:
1. Pacing: a 12-descriptor (> SDHC_ADMA_DESCS_PER_DELAY) non-interrupt ADMA2 CMD18 read completes after a model-dependent number of SDHC_TRANSFER_DELAY virtual-clock steps, which the test reports.
2. MMIO coupling: a chain carrying a DMA-boundary interrupt descriptor yields mid-chain and reschedules on the virtual clock. With the clock frozen, a bare interrupt-status read must not itself resume or complete the transfer. This asserts the behaviour intended by "Run ADMA independently of MMIO": it passes on the fixed model and fails on a model that resumes ADMA from an MMIO read.
The SD bring-up (CMD0/CMD8/ACMD41/CMD2/CMD3/CMD7/CMD16) and the ADMA2 descriptor-table layout mirror the pattern already used by the SDHCI device model; SDHCI register offsets and ADMA attribute bits are reproduced locally because sdhci-internal.h is not standalone-includable from a qtest.
--- MAINTAINERS | 1 + tests/qtest/cadence-sdhci-test.c | 268 +++++++++++++++++++++++++++++++ tests/qtest/meson.build | 1 + 3 files changed, 270 insertions(+) create mode 100644 tests/qtest/cadence-sdhci-test.c
MAINTAINERS +1 -0
@@ -2277,6 +2277,7 @@ F: include/hw/sd/sd* F: hw/sd/core.c F: hw/sd/sd* F: hw/sd/ssi-sd.c +F: tests/qtest/cadence-sdhci-test.c F: tests/qtest/fuzz-sdcard-test.c F: tests/qtest/sdhci-test.c
tests/qtest/cadence-sdhci-test.c new file +268 -0
268 lines not on this page · raw message
tests/qtest/meson.build +1 -0
@@ -283,6 +283,7 @@ qtests_riscv32 = \ (config_all_devices.has_key('CONFIG_SIFIVE_E_AON') ? ['sifive-e-aon-watchdog-test'] : []) qtests_riscv64 = ['riscv-csr-test'] + \ + (config_all_devices.has_key('CONFIG_MICROCHIP_PFSOC') ? ['cadence-sdhci-test'] : []) + \ (unpack_edk2_blobs ? ['bios-tables-test'] : []) qos_test_ss = ss.source_set()
Signature · 1 line
2.43.0