Add the two-QEMU Battery EC-relay e2e#121
Merged
Merged
Conversation
Register the Battery relay service in the vendored SP (reusing the shared EcRelay that already backs Thermal) and add a battery e2e test binary that drives GetBst over the two-QEMU MCTP link and asserts the EC dev-qemu MockFuelGauge dynamic data (state=DISCHARGING, rate=1500, capacity=2304, voltage=11850) — values the SP cannot fabricate. Factor the shared FF-A request-build + dispatch (build_request, send_service_command) into test-support and refactor the thermal binary onto it. Wire the battery vdrive + test-sp-ec-link-battery target (sharing a canned two-QEMU recipe with thermal) and add it to the top-level e2e-test sequence. Verified: make ec uefi + test-sp-ec-link-battery -> ALL TESTS PASSED; thermal e2e still green. Assisted-by: GitHub Copilot:claude-opus-4.8
dymk
requested review from
Copilot,
kat-perez,
maxperga-msft,
philgweber and
rogurr
and removed request for
Copilot
July 9, 2026 18:12
kurtjd
approved these changes
Jul 9, 2026
There was a problem hiding this comment.
Pull request overview
Adds end-to-end coverage for a second EC-relay service (Battery) in the two-QEMU harness, and refactors common FF-A request/dispatch logic into shared test support to keep per-service tests focused on request/response specifics.
Changes:
- Register
BatteryalongsideThermalin the QEMU Secure Partition message handler. - Add a new
batteryUEFI e2e test binary that issuesGetBstand asserts EC-origin BST values. - Factor shared FF-A payload build + command dispatch into
test-support, refactor the thermal test to use it, and wire a newtest-sp-ec-link-batterytarget into the e2e Makefile flow.
Reviewed changes
Copilot reviewed 8 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
mod/secure-services/platform/src/main.rs |
Registers Battery relay service in the QEMU SP handler chain. |
Makefile |
Runs the new two-QEMU battery e2e as part of the top-level e2e-test sequence. |
e2e-tests/tests/thermal/src/main.rs |
Refactors thermal test to use shared request/dispatch helper. |
e2e-tests/tests/battery/src/main.rs |
New battery GetBst two-QEMU e2e test asserting exact EC BST values. |
e2e-tests/tests/battery/Cargo.toml |
Adds the new battery test crate manifest. |
e2e-tests/test-support/src/lib.rs |
Adds Battery UUID and shared helpers (build_request, send_service_command). |
e2e-tests/Makefile |
Adds battery vdrive, new test-sp-ec-link-battery target, and a shared two-QEMU runner macro. |
e2e-tests/Cargo.toml |
Adds tests/battery to the workspace members. |
e2e-tests/Cargo.lock |
Locks the new workspace member (battery). |
dymk
enabled auto-merge (squash)
July 9, 2026 20:30
tullom
approved these changes
Jul 10, 2026
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.
Summary
Adds a Battery service two-QEMU round-trip E2E, proving the MCTP relay carries a second service (after Thermal). Registers
ec_service_lib::services::Batteryin the QEMU SP (reusing the sharedEcRelaythat already backs Thermal — one line) and adds abatterye2e binary drivingGetBstover the two-QEMU link.The test asserts the EC dev-qemu
MockFuelGaugedynamic data exactly —state=0x1 (DISCHARGING),rate=1500,capacity=2304,voltage=11850— values that originate from the EC, not the SP.Factors the shared FF-A request-build + dispatch (
build_request,send_service_command) intotest-supportand refactors the thermal binary onto it. Adds the battery vdrive +test-sp-ec-link-batterytarget (sharing a canned two-QEMU recipe with thermal) and wires it into the top-levele2e-testsequence.No EC or
odp-secure-serviceschange — the EC dev-qemu mock already registersBatteryServiceRelayHandler, and the SPBatteryrelay service already exists.Verification
make ec uefi && make -C e2e-tests test-sp-ec-link-battery→ ALL TESTS PASSED (ffa_version,ffa_id_get,partition_discovery,battery_get_bst); observedGetBst: state=0x1 rate=1500 capacity=2304 voltage=11850.test-sp-ec-link) still green after the shared-helper refactor.Notes
Batteryhandler currently ignores the request payload (hardcodesGetBst/battery 0), so this e2e asserts theGetBst/battery-0 path until that is fixed.Closes #120