diff --git a/devices/src/irqchip/kvm/x86_64.rs b/devices/src/irqchip/kvm/x86_64.rs index e9bd145817..0de348ef96 100644 --- a/devices/src/irqchip/kvm/x86_64.rs +++ b/devices/src/irqchip/kvm/x86_64.rs @@ -130,6 +130,12 @@ impl IrqChipX86_64 for KvmKernelIrqChip { } } + /// Get the lapic frequency in Hz + fn lapic_frequency(&self) -> u32 { + // KVM emulates the lapic to have a bus frequency of 1GHz + 1_000_000_000 + } + /// Retrieves the state of the PIT. Gets the pit state via the KVM API. fn get_pit(&self) -> Result { Ok(PitState::from(&self.vm.get_pit_state()?)) @@ -746,6 +752,12 @@ impl IrqChipX86_64 for KvmSplitIrqChip { } } + /// Get the lapic frequency in Hz + fn lapic_frequency(&self) -> u32 { + // KVM emulates the lapic to have a bus frequency of 1GHz + 1_000_000_000 + } + /// Retrieves the state of the PIT. Gets the pit state via the KVM API. fn get_pit(&self) -> Result { Ok(self.pit.lock().get_pit_state()) diff --git a/devices/src/irqchip/x86_64.rs b/devices/src/irqchip/x86_64.rs index 5f2f599db0..3015d88495 100644 --- a/devices/src/irqchip/x86_64.rs +++ b/devices/src/irqchip/x86_64.rs @@ -35,6 +35,9 @@ pub trait IrqChipX86_64: IrqChip { /// Set the current state of the specified VCPU's local APIC fn set_lapic_state(&mut self, vcpu_id: usize, state: &LapicState) -> Result<()>; + /// Get the lapic frequency in Hz + fn lapic_frequency(&self) -> u32; + /// Retrieves the state of the PIT. fn get_pit(&self) -> Result;