mirror of
https://github.com/DragonOS-Community/DragonOS.git
synced 2025-06-08 14:16:47 +00:00
fix(boot): won't fail to boot when kvm not available (#1152)
* fix(boot): won't fail to boot when kvm not available * feat(kvm): add additional debug message on kvm init fail
This commit is contained in:
parent
5e87c41d96
commit
f3bfe77712
@ -3743,8 +3743,12 @@ pub static L1TF_VMX_MITIGATION: RwLock<VmxL1dFlushState> = RwLock::new(VmxL1dFlu
|
|||||||
|
|
||||||
pub fn vmx_init() -> Result<(), SystemError> {
|
pub fn vmx_init() -> Result<(), SystemError> {
|
||||||
let cpuid = CpuId::new();
|
let cpuid = CpuId::new();
|
||||||
let cpu_feat = cpuid.get_feature_info().ok_or(SystemError::ENOSYS)?;
|
let cpu_feat = cpuid.get_feature_info().ok_or_else(|| {
|
||||||
|
log::warn!("Failed to get CPU feature info, perhaps not AMD or Intel CPU");
|
||||||
|
SystemError::ENOSYS
|
||||||
|
})?;
|
||||||
if !cpu_feat.has_vmx() {
|
if !cpu_feat.has_vmx() {
|
||||||
|
log::warn!("VMX not supported or enabled");
|
||||||
return Err(SystemError::ENOSYS);
|
return Err(SystemError::ENOSYS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,10 +93,10 @@ fn do_start_kernel() {
|
|||||||
crate::bpf::init_bpf_system();
|
crate::bpf::init_bpf_system();
|
||||||
crate::debug::jump_label::static_keys_init();
|
crate::debug::jump_label::static_keys_init();
|
||||||
|
|
||||||
// #[cfg(all(target_arch = "x86_64", feature = "kvm"))]
|
|
||||||
// crate::virt::kvm::kvm_init();
|
|
||||||
#[cfg(all(target_arch = "x86_64", feature = "kvm"))]
|
#[cfg(all(target_arch = "x86_64", feature = "kvm"))]
|
||||||
crate::arch::vm::vmx::vmx_init().unwrap();
|
if crate::arch::vm::vmx::vmx_init().is_err() {
|
||||||
|
log::warn!("vmx init failed, will not be enabled");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 在内存管理初始化之前,执行的初始化
|
/// 在内存管理初始化之前,执行的初始化
|
||||||
|
Loading…
x
Reference in New Issue
Block a user