Skip to content

[sp-sim] Simulate host flash hashing #8584

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jgallagher
Copy link
Contributor

There are a couple spots here that I want to double-check are faithful to real SP behavior; will leave comments below.

@jgallagher jgallagher requested a review from labbott July 11, 2025 17:48
Comment on lines +493 to +497
HostFlashHashState::HashStarted(started) => {
let started = *started;
self.finalize_host_flash_hash_if_sufficient_time_elapsed(
slot, started,
)?;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we get a start_host_flash_hash() request while we're still hashing from a previous start request, this will return HfError::HashInProgress. I think the SP returns a generic HashError in this case, but maybe it should also return HashInProgress?

// hash of this slot.
if *component == SpComponent::HOST_CPU_BOOT_FLASH {
self.phase1_hash_state
.insert(*slot, HostFlashHashState::HashInvalidated);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is consistent with the real SP, but wanted to check. If we start up and have this sequence of requests:

  • get_host_flash_hash -> will return HfError::HashUncalculated
  • we do not get a request to start_host_flash_hash
  • we perform an update, writing the target slot
  • after the update, we get another get_host_flash_hash request -> this will now return HfError::RecalculateHash, because the act of writing sets our state to HashInvalidated

I think this is completely reasonable but wanted to double check it matches; any write will cause future gets to return HfError::RecalculateHash, even if we'd never calculated it a first time, right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant