Skip to contentSkip to conversation

tests/qtest: add Cadence SDHCI ADMA pacing/MMIO reproducer

PATCH New Wadim Mueller 1 participant 1 message Aug 13 Arm/Amlogic Meson SoC support

lore
Share & tools
lore
#0 lore raw

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
index 63e9ba521b..12c657d000 100644
@@ -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
index 54e2cb0461..78e47ee024 100644
@@ -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