Skip to content

Commit 8fe8b1c

Browse files
committed
Add special-case handling for measurement token handoff
1 parent 5cb6122 commit 8fe8b1c

File tree

5 files changed

+27
-3
lines changed

5 files changed

+27
-3
lines changed

Cargo.lock

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,10 @@ hif = { git = "https://github.com/oxidecomputer/hif" }
8787
humpty = { git = "https://github.com/oxidecomputer/humpty", version = "0.1.3" }
8888
idol = {git = "https://github.com/oxidecomputer/idolatry.git"}
8989
idt8a3xxxx = { git = "https://github.com/oxidecomputer/idt8a3xxxx" }
90+
measurement-token = { git = "https://github.com/oxidecomputer/lpc55_support", default-features = false }
9091
pmbus = { git = "https://github.com/oxidecomputer/pmbus" }
91-
spd = { git = "https://github.com/oxidecomputer/spd" }
9292
serialport = { git = "https://github.com/jgallagher/serialport-rs", branch = "illumos-support" }
93+
spd = { git = "https://github.com/oxidecomputer/spd" }
9394
tlvc = { git = "https://github.com/oxidecomputer/tlvc" }
9495
tlvc-text = {git = "https://github.com/oxidecomputer/tlvc"}
9596
vsc7448-info = { git = "https://github.com/oxidecomputer/vsc7448.git" }

cmd/flash/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ humility-probes-core = { workspace = true }
1313
cmd-auxflash = { workspace = true }
1414
clap = { workspace = true }
1515
anyhow = { workspace = true }
16+
measurement-token = { workspace = true }
1617
parse_int = { workspace = true }
1718
num-traits = { workspace = true }
1819
tempfile = { workspace = true }

cmd/flash/src/lib.rs

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,23 @@ fn flashcmd(context: &mut ExecutionContext) -> Result<()> {
403403
std::thread::sleep(std::time::Duration::from_millis(delay));
404404
}
405405

406-
core.reset()?;
406+
// If this image uses handoff to send a measurement token between the RoT
407+
// and SP, this won't work with a debugger physically attached. To prevent
408+
// the SP from resetting itself, we write a different token which skips this
409+
// reboot loop. The memory address and token values are pulled from the
410+
// `measurement-token` crate in `lpc55_support`, which is also used in the
411+
// SP firmware.
412+
if hubris.manifest.features.iter().any(|s| s == "measurement-handoff") {
413+
core.reset_and_halt(std::time::Duration::from_millis(25))?;
414+
humility::msg!("skipping measurement token handoff");
415+
core.write_word_32(
416+
measurement_token::SP_ADDR as u32,
417+
measurement_token::SKIP,
418+
)?;
419+
core.run()?;
420+
} else {
421+
core.reset()?;
422+
}
407423

408424
// At this point, we can attempt to program the auxiliary flash. This has
409425
// to happen *after* the image is flashed and the core is reset, because it

humility-core/src/hubris.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ const OXIDE_NT_HUBRIS_ARCHIVE: u32 = OXIDE_NT_BASE + 1;
4040
const OXIDE_NT_HUBRIS_REGISTERS: u32 = OXIDE_NT_BASE + 2;
4141
const OXIDE_NT_HUBRIS_TASK: u32 = OXIDE_NT_BASE + 3;
4242

43-
const MAX_HUBRIS_VERSION: u32 = 9;
43+
const MAX_HUBRIS_VERSION: u32 = 10;
4444

4545
#[derive(Default, Debug, Serialize)]
4646
pub struct HubrisManifest {

0 commit comments

Comments
 (0)