Enable irqchip and tsc for windows

Enable most of modules under `irqchip` as well as `tsc` to work with
windows since all their dependencies have been completed. They were
already working for unix.

The test `irqchip::userspace::tests::irq_event_tokens` fails on wine,
however, it work on windows and unix natively.

The test `tsc::calibrate::tests::test_frequency_higher_than_u32` fails
for hosts with cpu>64, since the windows implementation for setting
thread affinity does not support cpu>64.

BUG=b:237024070
TEST=Ran `tools/run_tests --target=host --arch=win64`

Change-Id: I15d8f3c3256e89f89efbe64dbe2ad809fcd90a72
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3737456
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Vaibhav Nagarnaik <vnagarnaik@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Noah Gold <nkgold@google.com>
This commit is contained in:
Vaibhav Nagarnaik 2022-06-30 17:08:28 +00:00 committed by Chromeos LUCI
parent fcc9e4cf9c
commit 45fb59a2bb
3 changed files with 36 additions and 53 deletions

View file

@ -15,54 +15,35 @@ use resources::SystemAllocator;
cfg_if::cfg_if! {
if #[cfg(unix)] {
mod kvm;
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
mod x86_64;
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
pub use x86_64::*;
#[cfg(any(target_arch = "arm", target_arch = "aarch64"))]
mod aarch64;
#[cfg(any(target_arch = "arm", target_arch = "aarch64"))]
pub use aarch64::*;
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
mod pic;
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
pub use pic::*;
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
mod ioapic;
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
pub use ioapic::*;
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
mod apic;
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
pub use apic::*;
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
mod userspace;
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
pub use userspace::*;
pub use self::kvm::KvmKernelIrqChip;
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
pub use self::kvm::KvmSplitIrqChip;
#[cfg(any(target_arch = "arm", target_arch = "aarch64"))]
pub use self::kvm::{AARCH64_GIC_NR_IRQS, AARCH64_GIC_NR_SPIS};
} else if #[cfg(windows)] {
#[cfg(feature = "whpx")]
} else if #[cfg(all(windows, feature = "whpx"))] {
mod whpx;
#[cfg(feature = "whpx")]
pub use self::whpx::WhpxSplitIrqChip;
}
}
cfg_if::cfg_if! {
if #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] {
mod x86_64;
pub use x86_64::*;
mod pic;
pub use pic::*;
mod ioapic;
pub use ioapic::*;
mod apic;
pub use apic::*;
mod userspace;
pub use userspace::*;
} else if #[cfg(any(target_arch = "arm", target_arch = "aarch64"))] {
mod aarch64;
pub use aarch64::*;
}
}
pub type IrqEventIndex = usize;
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]

View file

@ -10,14 +10,20 @@ mod bus;
mod irq_event;
pub mod irqchip;
mod pci;
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
mod pit;
pub mod serial_device;
mod sys;
pub mod virtio;
#[cfg(all(feature = "tpm", feature = "chromeos", target_arch = "x86_64"))]
mod vtpm_proxy;
cfg_if::cfg_if! {
if #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] {
mod pit;
pub use self::pit::{Pit, PitError};
pub mod tsc;
}
}
pub use self::bus::{
Bus, BusAccessInfo, BusDevice, BusDeviceObj, BusDeviceSync, BusRange, BusResumeDevice, BusType,
HostHotPlugKey, HotPlugBus,
@ -30,8 +36,6 @@ pub use self::pci::{
PciDeviceError, PciInterruptPin, PciRoot, PciVirtualConfigMmio, StubPciDevice,
StubPciParameters,
};
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
pub use self::pit::{Pit, PitError};
#[cfg(all(feature = "tpm", feature = "chromeos", target_arch = "x86_64"))]
pub use self::vtpm_proxy::VtpmProxy;
@ -56,8 +60,6 @@ cfg_if::cfg_if! {
mod serial;
#[cfg(feature = "tpm")]
mod software_tpm;
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
pub mod tsc;
#[cfg(feature = "usb")]
pub mod usb;
#[cfg(feature = "usb")]

View file

@ -16,15 +16,15 @@ use remain::sorted;
use sync::Mutex;
use thiserror::Error;
#[cfg(not(test))]
use base::Clock;
#[cfg(test)]
use base::FakeClock as Clock;
#[cfg(test)]
use base::FakeTimer as Timer;
#[cfg(not(test))]
use base::Timer;
cfg_if::cfg_if! {
if #[cfg(test)] {
use base::FakeClock as Clock;
use base::FakeTimer as Timer;
} else {
use base::Clock;
use base::Timer;
}
}
use crate::bus::BusAccessInfo;
use crate::pci::CrosvmDeviceId;