mirror of
https://chromium.googlesource.com/crosvm/crosvm
synced 2025-02-06 10:32:10 +00:00
devices: add IrqChipX86_64::lapic_frequency.
This function is used to generate cpuid leaf 15H in some situations. BUG=213152505 TEST=builds Change-Id: Ia5a7c46b32f1bdba366a500caa650edb2e3ae99f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3696534 Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Daniel Verkamp <dverkamp@chromium.org> Commit-Queue: Noah Gold <nkgold@google.com>
This commit is contained in:
parent
2efb19303d
commit
4679ac4183
2 changed files with 15 additions and 0 deletions
|
@ -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<PitState> {
|
||||
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<PitState> {
|
||||
Ok(self.pit.lock().get_pit_state())
|
||||
|
|
|
@ -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<PitState>;
|
||||
|
||||
|
|
Loading…
Reference in a new issue