hypervisor: simplify LapicState

Both KVM and MSHV share the same layout. We can drop one level of
indirection.

Signed-off-by: Wei Liu <liuwe@microsoft.com>
This commit is contained in:
Wei Liu
2022-07-27 22:58:47 +00:00
committed by Rob Bradford
parent ddc9004471
commit bec47ebcc9
3 changed files with 45 additions and 47 deletions

View File

@@ -298,18 +298,13 @@ impl From<FpuState> for kvm_fpu {
impl From<LapicState> for kvm_lapic_state {
fn from(s: LapicState) -> Self {
match s {
LapicState::Kvm(s) => s,
/* Needed in case other hypervisors are enabled */
#[allow(unreachable_patterns)]
_ => panic!("LapicState is not valid"),
}
Self { regs: s.regs }
}
}
impl From<kvm_lapic_state> for LapicState {
fn from(s: kvm_lapic_state) -> Self {
LapicState::Kvm(s)
Self { regs: s.regs }
}
}