mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2025-02-22 19:32:20 +00:00
vmm: Ensure PIO/MMIO exits complete before pausing only for KVM
MSHV does not require to ensure MMIO/PIO exits complete before pausing. This patch makes sure the above requirement by checking the hypervisor type run-time. Fixes #5037 Signed-off-by: Muminul Islam <muislam@microsoft.com>
This commit is contained in:
parent
e661139e1e
commit
4e3bc20f2c
@ -59,7 +59,7 @@ pub use vm::{
|
||||
Vm, VmOps,
|
||||
};
|
||||
|
||||
#[derive(Debug, Copy, Clone)]
|
||||
#[derive(Debug, Copy, Clone, Eq, PartialEq)]
|
||||
pub enum HypervisorType {
|
||||
#[cfg(feature = "kvm")]
|
||||
Kvm,
|
||||
|
@ -811,6 +811,8 @@ impl CpuManager {
|
||||
) -> Result<()> {
|
||||
let reset_evt = self.reset_evt.try_clone().unwrap();
|
||||
let exit_evt = self.exit_evt.try_clone().unwrap();
|
||||
#[cfg(feature = "kvm")]
|
||||
let hypervisor_type = self.hypervisor_type;
|
||||
#[cfg(feature = "guest_debug")]
|
||||
let vm_debug_evt = self.vm_debug_evt.try_clone().unwrap();
|
||||
let panic_exit_evt = self.exit_evt.try_clone().unwrap();
|
||||
@ -919,12 +921,14 @@ impl CpuManager {
|
||||
|
||||
#[cfg(feature = "kvm")]
|
||||
{
|
||||
vcpu.lock().as_ref().unwrap().vcpu.set_immediate_exit(true);
|
||||
if !matches!(vcpu.lock().unwrap().run(), Ok(VmExit::Ignore)) {
|
||||
error!("Unexpected VM exit on \"immediate_exit\" run");
|
||||
break;
|
||||
if matches!(hypervisor_type, HypervisorType::Kvm) {
|
||||
vcpu.lock().as_ref().unwrap().vcpu.set_immediate_exit(true);
|
||||
if !matches!(vcpu.lock().unwrap().run(), Ok(VmExit::Ignore)) {
|
||||
error!("Unexpected VM exit on \"immediate_exit\" run");
|
||||
break;
|
||||
}
|
||||
vcpu.lock().as_ref().unwrap().vcpu.set_immediate_exit(false);
|
||||
}
|
||||
vcpu.lock().as_ref().unwrap().vcpu.set_immediate_exit(false);
|
||||
}
|
||||
|
||||
vcpu_run_interrupted.store(true, Ordering::SeqCst);
|
||||
|
Loading…
x
Reference in New Issue
Block a user