Skip to content

Commit d2aa638

Browse files
RoyLinRoyLin
authored andcommitted
fix(snapshot): arch-gate VcpuEvent::SaveState to x86_64
VcpuState (KVM x86 vcpu state) and Vcpu::save_state/restore_state are already #[cfg(target_arch = "x86_64")], but the VcpuEvent::SaveState variant that carries Box<VcpuState> and the running()-state match arm that referenced it were not — so the vmm failed to compile on aarch64 (E0425: cannot find type VcpuState). Gate both to x86_64. Snapshot-fork is x86_64-only; aarch64 builds cold-boot only. Verified: cargo check --target aarch64-unknown-linux-gnu -p vmm now passes.
1 parent 8bb409b commit d2aa638

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

src/vmm/src/linux/vstate.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1635,6 +1635,7 @@ impl Vcpu {
16351635
state = self.exit(FC_EXIT_CODE_GENERIC_ERROR);
16361636
}
16371637
// SaveState only applies while paused; ignore in running state.
1638+
#[cfg(target_arch = "x86_64")]
16381639
Ok(VcpuEvent::SaveState(_)) => (),
16391640
// All other events or lack thereof have no effect on current 'running' state.
16401641
Err(TryRecvError::Empty) => (),
@@ -1787,6 +1788,8 @@ pub enum VcpuEvent {
17871788
/// Event that should resume the Vcpu.
17881789
Resume,
17891790
/// Save the Vcpu KVM state through the given channel (only valid while paused).
1791+
/// vCPU KVM-state save/restore is x86_64-only (see [`VcpuState`]).
1792+
#[cfg(target_arch = "x86_64")]
17901793
SaveState(crossbeam_channel::Sender<Box<VcpuState>>),
17911794
// Serialize and Deserialize to follow after we get the support from kvm-ioctls.
17921795
}

0 commit comments

Comments
 (0)