mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-08-23 16:31:16 +00:00
vmm: Stop initialising kernel based IOAPIC/PIC
Now that we require the modern capabilities we can stop creating a kernel base irqchip. Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
parent
9b1cb9621f
commit
afea6a10a2
@ -28,10 +28,7 @@ use crate::cpu;
|
|||||||
use crate::device_manager::{get_win_size, Console, DeviceManager, DeviceManagerError};
|
use crate::device_manager::{get_win_size, Console, DeviceManager, DeviceManagerError};
|
||||||
use arch::RegionType;
|
use arch::RegionType;
|
||||||
use devices::{ioapic, HotPlugNotificationType};
|
use devices::{ioapic, HotPlugNotificationType};
|
||||||
use kvm_bindings::{
|
use kvm_bindings::{kvm_enable_cap, kvm_userspace_memory_region, KVM_CAP_SPLIT_IRQCHIP};
|
||||||
kvm_enable_cap, kvm_pit_config, kvm_userspace_memory_region, KVM_CAP_SPLIT_IRQCHIP,
|
|
||||||
KVM_PIT_SPEAKER_DUMMY,
|
|
||||||
};
|
|
||||||
use kvm_ioctls::*;
|
use kvm_ioctls::*;
|
||||||
|
|
||||||
use linux_loader::cmdline::Cmdline;
|
use linux_loader::cmdline::Cmdline;
|
||||||
@ -374,12 +371,7 @@ impl Vm {
|
|||||||
fd.set_tss_address(arch::x86_64::layout::KVM_TSS_ADDRESS.raw_value() as usize)
|
fd.set_tss_address(arch::x86_64::layout::KVM_TSS_ADDRESS.raw_value() as usize)
|
||||||
.map_err(Error::VmSetup)?;
|
.map_err(Error::VmSetup)?;
|
||||||
|
|
||||||
let msi_capable = kvm.check_extension(Cap::SignalMsi);
|
|
||||||
|
|
||||||
let mut cpuid_patches = Vec::new();
|
let mut cpuid_patches = Vec::new();
|
||||||
let mut userspace_ioapic = false;
|
|
||||||
if kvm.check_extension(Cap::TscDeadlineTimer) {
|
|
||||||
if kvm.check_extension(Cap::SplitIrqchip) && msi_capable {
|
|
||||||
// Create split irqchip
|
// Create split irqchip
|
||||||
// Only the local APIC is emulated in kernel, both PICs and IOAPIC
|
// Only the local APIC is emulated in kernel, both PICs and IOAPIC
|
||||||
// are not.
|
// are not.
|
||||||
@ -389,12 +381,7 @@ impl Vm {
|
|||||||
fd.enable_cap(&cap).map_err(Error::VmSetup)?;
|
fd.enable_cap(&cap).map_err(Error::VmSetup)?;
|
||||||
|
|
||||||
// Because of the split irqchip, we need a userspace IOAPIC.
|
// Because of the split irqchip, we need a userspace IOAPIC.
|
||||||
userspace_ioapic = true;
|
let userspace_ioapic = true;
|
||||||
} else {
|
|
||||||
// Create irqchip
|
|
||||||
// A local APIC, 2 PICs and an IOAPIC are emulated in kernel.
|
|
||||||
fd.create_irq_chip().map_err(Error::VmSetup)?;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Patch tsc deadline timer bit
|
// Patch tsc deadline timer bit
|
||||||
cpuid_patches.push(cpu::CpuidPatch {
|
cpuid_patches.push(cpu::CpuidPatch {
|
||||||
@ -406,17 +393,6 @@ impl Vm {
|
|||||||
ecx_bit: Some(TSC_DEADLINE_TIMER_ECX_BIT),
|
ecx_bit: Some(TSC_DEADLINE_TIMER_ECX_BIT),
|
||||||
edx_bit: None,
|
edx_bit: None,
|
||||||
});
|
});
|
||||||
} else {
|
|
||||||
// Create irqchip
|
|
||||||
// A local APIC, 2 PICs and an IOAPIC are emulated in kernel.
|
|
||||||
fd.create_irq_chip().map_err(Error::VmSetup)?;
|
|
||||||
// Creates an in-kernel device model for the PIT.
|
|
||||||
let mut pit_config = kvm_pit_config::default();
|
|
||||||
// We need to enable the emulation of a dummy speaker port stub so that writing to port 0x61
|
|
||||||
// (i.e. KVM_SPEAKER_BASE_ADDRESS) does not trigger an exit to user space.
|
|
||||||
pit_config.flags = KVM_PIT_SPEAKER_DUMMY;
|
|
||||||
fd.create_pit2(pit_config).map_err(Error::VmSetup)?;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Patch hypervisor bit
|
// Patch hypervisor bit
|
||||||
cpuid_patches.push(cpu::CpuidPatch {
|
cpuid_patches.push(cpu::CpuidPatch {
|
||||||
|
Loading…
Reference in New Issue
Block a user