flowey: package ipmi_kcs_ffi staticlib + header via checkin pipeline#3838
Draft
marma-dev wants to merge 4 commits into
Draft
flowey: package ipmi_kcs_ffi staticlib + header via checkin pipeline#3838marma-dev wants to merge 4 commits into
marma-dev wants to merge 4 commits into
Conversation
|
This PR modifies files containing For more on why we check whole files, instead of just diffs, check out the Rustonomicon |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds Flowey-based packaging for the ipmi_kcs_ffi C-ABI static library plus its ipmi_kcs.h header, publishing the bundle as a Windows x64 artifact from the checkin_gates pipeline so out-of-tree consumers (Legacy HCL C++) can link against the shared IPMI KCS implementation.
Changes:
- Introduces new IPMI KCS crates (
ipmi_kcs_core,ipmi_kcs,ipmi_kcs_resources,ipmi_kcs_ffi) and wires the device resolver intoopenvmm_resources(x86_64 guest only). - Adds a new Flowey node (
build_ipmi_kcs_ffi) and publishes anx64-windows-ipmi_kcs_ffiartifact from the Windows “not for VMM tests” job. - Regenerates Flowey-produced CI workflow YAMLs to include the new artifact publishing steps.
Reviewed changes
Copilot reviewed 23 out of 24 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| vm/devices/ipmi_kcs/src/resolver.rs | Adds a static resource resolver for the IPMI KCS chipset device. |
| vm/devices/ipmi_kcs/src/lib.rs | Implements the OpenVMM ChipsetDevice/PIO wrapper around the shared core plus unit tests. |
| vm/devices/ipmi_kcs/Cargo.toml | Defines the new ipmi_kcs integration crate and dependencies. |
| vm/devices/ipmi_kcs_resources/src/lib.rs | Adds the IpmiKcsHandle MeshPayload resource handle. |
| vm/devices/ipmi_kcs_resources/Cargo.toml | Defines the new ipmi_kcs_resources crate dependencies. |
| vm/devices/ipmi_kcs_ffi/src/lib.rs | Implements the C ABI wrapper over ipmi_kcs_core plus ABI-driving unit tests. |
| vm/devices/ipmi_kcs_ffi/ipmi_kcs.h | Provides the C header for the published staticlib ABI. |
| vm/devices/ipmi_kcs_ffi/Cargo.toml | Configures staticlib + rlib crate types for FFI + unit tests. |
| vm/devices/ipmi_kcs_core/src/sink.rs | Adds injected SEL sink + clock traits for the no_std core. |
| vm/devices/ipmi_kcs_core/src/sel.rs | Implements SEL storage/commands with injected dependencies. |
| vm/devices/ipmi_kcs_core/src/protocol.rs | Defines protocol constants/enums and helpers. |
| vm/devices/ipmi_kcs_core/src/lib.rs | Implements the KCS state machine and IPMI message handling core. |
| vm/devices/ipmi_kcs_core/Cargo.toml | Adds features for inspect/trace and core dependencies. |
| openvmm/openvmm_resources/src/lib.rs | Registers IpmiKcsResolver behind cfg(guest_arch = "x86_64"). |
| openvmm/openvmm_resources/Cargo.toml | Adds ipmi_kcs dependency (currently under cfg(target_arch = "x86_64")). |
| flowey/flowey_lib_hvlite/src/lib.rs | Registers the new Flowey module. |
| flowey/flowey_lib_hvlite/src/build_ipmi_kcs_ffi.rs | Adds Flowey node to build staticlib and bundle header into a typed artifact. |
| flowey/flowey_hvlite/src/pipelines/checkin_gates.rs | Publishes x64-windows-ipmi_kcs_ffi artifact from the Windows job (x64 only). |
| ci-flowey/openvmm-pr.yaml | Regenerated pipeline YAML to publish the new artifact. |
| .github/workflows/openvmm-pr.yaml | Regenerated GitHub workflow YAML to include updated steps/artifact publish. |
| .github/workflows/openvmm-pr-release.yaml | Regenerated GitHub workflow YAML to include updated steps/artifact publish. |
| .github/workflows/openvmm-ci.yaml | Regenerated GitHub workflow YAML to include updated steps/artifact publish. |
| Cargo.toml | Adds workspace members/paths for the new IPMI KCS crates. |
| Cargo.lock | Updates lockfile entries for the new workspace crates and dependencies. |
Comment on lines
108
to
111
| [target.'cfg(target_arch = "x86_64")'.dependencies] | ||
| ipmi_kcs.workspace = true | ||
| serial_16550.workspace = true | ||
| serial_debugcon.workspace = true |
Comment on lines
+115
to
+118
| fn bmc_time(&self) -> u32 { | ||
| let now = self.deps.clock.now_unix_secs(); | ||
| let adjusted = now.saturating_add(self.time_offset); | ||
| adjusted.max(0) as u32 |
Comment on lines
+198
to
+211
| match self.kcs_state() { | ||
| KcsState::WRITE_STATE => { | ||
| self.write_buffer.push(byte); | ||
|
|
||
| if self.write_end_pending { | ||
| // This was the last byte. Process the complete message. | ||
| self.write_end_pending = false; | ||
| self.process_ipmi_message(); | ||
| } else { | ||
| // More bytes expected. Set OBF for dummy read. | ||
| self.data_out = 0x00; | ||
| self.status |= STATUS_OBF; | ||
| } | ||
| } |
Comment on lines
+241
to
+245
| assert_eq!(wr(0xCA3, 0x61), IPMI_KCS_OK); // WRITE_START | ||
| rd(0xCA2, &mut byte); | ||
| assert_eq!(wr(0xCA2, 0x18), IPMI_KCS_OK); // NetFn/LUN | ||
| assert_eq!(wr(0xCA3, 0x62), IPMI_KCS_OK); // WRITE_END | ||
| rd(0xCA2, &mut byte); |
added 4 commits
June 30, 2026 09:54
Import the IPMI KCS device crate and add production-readiness changes over the PoC: - SelSink trait for forwarding SEL entries to a host (no-op by default); enables OpenHCL to publish guest SEL to host ETW. - BmcClock trait to remove std::time dependency from the SEL store; SystemClock default, injectable for paravisor. - with_deps constructors on IpmiKcsDevice/SelStore; register resolver in openvmm_resources (x86_64). - Tests for sink egress and injected clock.
- protocol.rs: use open_enum's inner #![expect(missing_docs)] idiom instead of an outer #[allow], so it reaches the generated associated constants (protocol module is pub). - sel.rs: SelStore::new() is only used by tests now that the lib paths construct via with_deps; move it into a #[cfg(test)] impl. - Cargo.lock: add ipmi_kcs / ipmi_kcs_resources entries.
Split the IPMI KCS BMC into a reusable core so OpenHCL (Rust) and the Legacy HCL C++ (OS Repo) share one implementation instead of duplicating it: - ipmi_kcs_core (new): no_std + alloc KCS state machine + SEL. protocol/sel moved here; SystemClock/std::time removed in favor of injected BmcClock; inspect and trace are optional features (off by default) so minimal consumers link neither. - ipmi_kcs: now a thin OpenVMM integration layer wrapping ipmi_kcs_core::KcsDevice (ChipsetDevice/PortIoIntercept/InspectMut/save-restore + std SystemClock). - ipmi_kcs_ffi (new): C ABI staticlib (+ ipmi_kcs.h) exposing new/free/io_read/io_write/reset with SEL + clock callbacks; std shim per the vmgs_lib precedent. Tests: core 22, integration 3, ffi 2 (incl. C-ABI Get Device ID + SEL callback). 0 warnings.
Add a build_ipmi_kcs_ffi flowey node (modeled on build_and_test_vmgs_lib) that builds the ipmi_kcs_ffi C-ABI staticlib and bundles it with ipmi_kcs.h, published as an x64-windows artifact from the checkin gates pipeline. ipmi_kcs is x86-only, so the artifact is gated to the x64 job. Regenerated CI YAML. This is the upstream-shaped replacement for the fork-local ipmi-kcs-ffi.yaml workflow.
978d4e2 to
ee8a62c
Compare
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
build_ipmi_kcs_ffiflowey node that builds theipmi_kcs_ffiC-ABI static library and bundles it with its C header (ipmi_kcs.h), publishing the pair as an x64-windows artifact from the check-in gates pipeline. This lets the out-of-tree C++ Legacy HCL build (OS repo) consume the shared IPMI KCS BMC emulator, instead of reimplementing the KCS state machine + SEL handling in C++.This is PR 4 of 4 in the IPMI KCS stack (stacked on
ipmi_kcs-ffi):ipmi_kcsdevice + resource handle.no_stdcore + C-ABI staticlib.Approach
Packaging is implemented the OpenVMM-native way — a flowey node wired into
checkin_gates, not a hand-written workflow YAML — modeled directly on the existingbuild_and_test_vmgs_libnode (which packages the analogousvmgs_libC-ABI library).What's included
flowey/flowey_lib_hvlite/src/build_ipmi_kcs_ffi.rs— newSimpleFlowNode:ipmi_kcs_ffiwithCargoCrateType::StaticLib,IpmiKcsFfiOutputartifact (WindowsStaticLib { lib, header }/LinuxStaticLib { a, header }) that bundlesipmi_kcs.halongside the.lib/.a,git_checkout_openvmm_repo.vmgs_lib, whose example C test lives in-repo) — the only consumer is the out-of-tree C++ HCL, which validates the ABI in its own build.flowey/flowey_lib_hvlite/src/lib.rs— register the module.flowey/flowey_hvlite/src/pipelines/checkin_gates.rs— declare thex64-windows-ipmi_kcs_ffiartifact and publish it from the windows "not for VMM tests" job. Gated to x64 only (theipmi_kcsdevice is x86-only), following the existinglet mut job+ conditional-publish pattern used for arch-specific artifacts..github/workflows/openvmm-{ci,pr,pr-release}.yaml,ci-flowey/openvmm-pr.yaml) viacargo xflowey regen.Validation
cargo check -p flowey_lib_hvlite -p flowey_hvlite— clean.cargo xflowey regen— succeeds; CI YAML regenerated and checked in (no pipeline drift).x64-windows-ipmi_kcs_ffibuild + publish steps and zeroaarch64references.hcl/fw) razzle build with no unresolved symbols (validated separately via the consumed artifact).Risk
Low — additive CI/packaging plus one new flowey node. No product crate behavior changes. The artifact is gated to the x64 windows job; other jobs/arches are unaffected.