Skip to content

services: Add the Recovery Agent sequence test for streaming boot - #37

Draft
chrysh wants to merge 1 commit into
ocp-recovery-serverfrom
ocp-agent-sequence-test
Draft

chrysh wants to merge 1 commit into
ocp-recovery-serverfrom
ocp-agent-sequence-test

Conversation

@chrysh

@chrysh chrysh commented Oct 29, 2026 •

Copy link
Copy Markdown
Collaborator

RecoveryInterface and the dispatch answer one access at a time, and their in-crate tests check one access at a time. No test plays the sequence the BMC runs for a streaming boot.

This PR adds a host test that plays that sequence, from PROT_CAP to the terminal RECOVERY_STATUS and DEVICE_STATUS values. The agent half goes through dispatch with command bytes and payloads, and the device half through the RecoveryInterface methods the policy side calls, such as take_activation. Separate tests cover what the sequence cannot show in passing, such as an activation pending from an earlier attempt. Mutating clear_activation or record_drained_write makes the test fail.

RecoveryCommand::scope() has no caller, so the dispatch serves the Scope::RecoveryMode commands whether or not the device is in recovery mode. The test asserts what the dispatch does today.

Stack, review in order:

  1. services: Add the OCP recovery register layouts #35, the register layouts
  2. services: Add the OCP recovery device dispatch #36, the device dispatch
  3. this PR, the Recovery Agent sequence test

@chrysh
chrysh marked this pull request as draft November 2, 2026 21:49
@chrysh
chrysh force-pushed the ocp-recovery-server branch from cdbdded to 488a06d Compare November 3, 2026 09:53
@chrysh
chrysh force-pushed the ocp-agent-sequence-test branch from 86e91b8 to 232e160 Compare November 3, 2026 16:32
@chrysh
chrysh force-pushed the ocp-recovery-server branch from 488a06d to 9500192 Compare November 3, 2026 19:30
@chrysh
chrysh force-pushed the ocp-agent-sequence-test branch from 232e160 to fcce4df Compare November 3, 2026 19:30
@chrysh chrysh moved this from Todo to In Progress in OpenPRoT PFR Nov 3, 2026
@chrysh
chrysh force-pushed the ocp-recovery-server branch from 9500192 to 6c5b0f7 Compare November 9, 2026 10:37
@chrysh
chrysh force-pushed the ocp-agent-sequence-test branch from fcce4df to 06f3b98 Compare November 9, 2026 10:37
@chrysh
chrysh force-pushed the ocp-recovery-server branch 2 times, most recently from da4081c to 7243d9e Compare November 9, 2026 10:46
@chrysh
chrysh force-pushed the ocp-agent-sequence-test branch from 06f3b98 to 1208b0e Compare November 9, 2026 10:46
@chrysh
chrysh force-pushed the ocp-agent-sequence-test branch from 1208b0e to 696806f Compare November 9, 2026 15:57
RecoveryInterface and the dispatch answer one access at a time, and
their in-crate tests check one access at a time. The new host test plays
the sequence the BMC runs for a streaming boot, from PROT_CAP to the
terminal RECOVERY_STATUS and DEVICE_STATUS values. The agent half goes
through dispatch with command bytes and payloads, and the device half
through the RecoveryInterface methods the policy side calls, such as
take_activation. The i2c server-runtime is meant to call dispatch, and
the policy loop to call the RecoveryInterface methods.

The test decodes register bytes rather than calling the accessors,
because the agent has only a response buffer. StagingSpy wraps
RamStaging to record the size the device announced to the region, which
RamStaging does not keep. The test reads the staged image back through
ByteSource, so it reads the bytes the way the recovery flow will.

Separate tests cover what the sequence cannot show in passing:
- a failed stage names the image index it failed on
- the device refuses an activate value of 0x1, and the field keeps
  ACTIVATE_IDLE, where a device that cleared the written bits would
  leave 0xe
- the dispatch accepts an activation while the image is still short, so
  the recovery flow has to check that the image is complete
- the forced recovery mode the agent writes to DEVICE_RESET stays set
  after take_reset_request, which clears only byte 0
- an agent that finds an activation pending from an earlier attempt
  writes the idle value first, so the next take_activation returns the
  activation for the image the agent announces now

The transport is out of scope, so MAX_TRANSFER_BYTES is both the chunk
size and the transport_max argument, and the test applies no SMBus
payload limit.

RecoveryCommand::scope() has no caller. HW_STATUS, INDIRECT_FIFO_CTRL,
INDIRECT_FIFO_STATUS and INDIRECT_FIFO_DATA are Scope::RecoveryMode, and
the dispatch serves them whether or not the device is in recovery mode.
The test asserts what the dispatch does today.

Signed-off-by: Christina Quast <christina.quast@9elements.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

1 participant