test: read IDevID CSR during boot to fix subsystem CSR-stress hang#3877
Open
swenson wants to merge 3 commits into
Open
test: read IDevID CSR during boot to fix subsystem CSR-stress hang#3877swenson wants to merge 3 commits into
swenson wants to merge 3 commits into
Conversation
test_generate_csr_envelop_stress uses unbounded step_until calls, so when a boot fails to reach the expected state the test hangs until nextest's slow timeout (~90 min in nightly), which stalls and fails the whole nightly run. Add HwModel::step_until_or_timeout (bounded like the existing step_until_boot_status, 30M cycles) and use it for the idevid_csr_ready, ready_for_mb_processing, and ready_for_runtime waits in the CSR envelope path. A hung boot now panics in seconds with the awaited condition named, instead of waiting for the harness timeout.
The CSR stress test deferred reading the IDevID CSR until after model construction, so on the FPGA subsystem the host's mailbox read raced the MCU's RI_DOWNLOAD_FIRMWARE and the test hung until the harness timeout. Drain the CSR at one point on every backend: when idevid_csr_ready asserts during boot, via the model's rom_callback (gated by a new BootParams::read_idevid_csr_in_callback). On the subsystem this runs while the MCU is still held at the download gate, so there's no race. Firmware is supplied via BootParams so the model still boots to runtime for the LDEV/FMC/RT cert checks. Boot waits are also bounded so a stall fails fast with a register dump instead of timing out.
swenson
requested review from
JohnTraverAmd,
ajisaxena,
clundin25,
fdamato,
jhand2,
jlmahowa-amd,
korran,
mhatrevi,
ternst-nv,
timothytrippel,
vsonims and
zhalvorsen
as code owners
June 12, 2026 17:29
The CSR-during-boot fix relies on rom_callback firing when idevid_csr_ready asserts, but the fpga_realtime and verilated models neither stored nor ran the callback, so test_generate_csr_envelop failed with "CSR was not captured" on FPGA realtime. Store the callback and run it from run_idevid_csr_callback, matching the emulated and subsystem models.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The CSR stress test deferred reading the IDevID CSR until after model
construction, so on the FPGA subsystem the host's mailbox read raced the
MCU's RI_DOWNLOAD_FIRMWARE and the test hung until the harness timeout.
Drain the CSR at one point on every backend: when idevid_csr_ready asserts
during boot, via the model's rom_callback (gated by a new
BootParams::read_idevid_csr_in_callback). On the subsystem this runs while
the MCU is still held at the download gate, so there's no race. Firmware is
supplied via BootParams so the model still boots to runtime for the
LDEV/FMC/RT cert checks. Boot waits are also bounded so a stall fails fast
with a register dump instead of timing out.