diff --git a/hypervisor/src/mshv/mod.rs b/hypervisor/src/mshv/mod.rs index 1984911b1..ac5792979 100644 --- a/hypervisor/src/mshv/mod.rs +++ b/hypervisor/src/mshv/mod.rs @@ -359,7 +359,9 @@ impl hypervisor::Hypervisor for MshvHypervisor { pub struct MshvVcpu { fd: VcpuFd, vp_index: u8, + #[cfg(target_arch = "x86_64")] cpuid: Vec, + #[cfg(target_arch = "x86_64")] msrs: Vec, vm_ops: Option>, vm_fd: Arc, @@ -1228,8 +1230,9 @@ impl cpu::Vcpu for MshvVcpu { Ok(()) } + #[cfg(target_arch = "x86_64")] /// - /// Set CPU state + /// Set CPU state for x86_64 guest. /// fn set_state(&self, state: &CpuState) -> cpu::Result<()> { let state: VcpuMshvState = state.clone().into(); @@ -1254,8 +1257,17 @@ impl cpu::Vcpu for MshvVcpu { Ok(()) } + #[cfg(target_arch = "aarch64")] /// - /// Get CPU State + /// Set CPU state for aarch64 guest. + /// + fn set_state(&self, state: &CpuState) -> cpu::Result<()> { + unimplemented!() + } + + #[cfg(target_arch = "x86_64")] + /// + /// Get CPU State for x86_64 guest /// fn state(&self) -> cpu::Result { let regs = self.get_regs()?; @@ -1291,6 +1303,14 @@ impl cpu::Vcpu for MshvVcpu { .into()) } + #[cfg(target_arch = "aarch64")] + /// + /// Get CPU state for aarch64 guest. + /// + fn state(&self) -> cpu::Result { + unimplemented!() + } + #[cfg(target_arch = "x86_64")] /// /// Translate guest virtual address to guest physical address @@ -1649,7 +1669,9 @@ impl vm::Vm for MshvVm { let vcpu = MshvVcpu { fd: vcpu_fd, vp_index: id, + #[cfg(target_arch = "x86_64")] cpuid: Vec::new(), + #[cfg(target_arch = "x86_64")] msrs: self.msrs.clone(), vm_ops, vm_fd: self.fd.clone(),