Skip to content

Commit a699176

Browse files
authored
virt_underhill: rename to virt_mshv_vtl (#63)
Currently and somewhat fundamentally, `virt_underhill` depends on the mshv_vtl driver, even for SNP and TDX. When we want to support SNP/TDX without the Microsoft hypervisor in the future, we will need to decide whether the mshv_vtl driver will be extended to support that, or whether we'll want to take a different approach. But either way, in the meantime, this is a more accurate name for the crate.
1 parent 1ffba34 commit a699176

File tree

37 files changed

+74
-82
lines changed

37 files changed

+74
-82
lines changed

Cargo.lock

Lines changed: 47 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -6676,7 +6676,7 @@ dependencies = [
66766676
"vga_proxy",
66776677
"video_core",
66786678
"virt",
6679-
"virt_underhill",
6679+
"virt_mshv_vtl",
66806680
"vm_loader",
66816681
"vm_manifest_builder",
66826682
"vm_resource",
@@ -6782,7 +6782,7 @@ dependencies = [
67826782
"thiserror",
67836783
"tracing",
67846784
"underhill_threadpool",
6785-
"virt_underhill",
6785+
"virt_mshv_vtl",
67866786
"vm_topology",
67876787
"x86defs",
67886788
]
@@ -7112,6 +7112,51 @@ dependencies = [
71127112
"zerocopy",
71137113
]
71147114

7115+
[[package]]
7116+
name = "virt_mshv_vtl"
7117+
version = "0.0.0"
7118+
dependencies = [
7119+
"aarch64defs",
7120+
"aarch64emu",
7121+
"anyhow",
7122+
"bitfield-struct",
7123+
"bitvec",
7124+
"build_rs_guest_arch",
7125+
"cfg-if",
7126+
"fs-err",
7127+
"guestmem",
7128+
"hcl",
7129+
"hv1_emulator",
7130+
"hv1_hypercall",
7131+
"hvdef",
7132+
"inspect",
7133+
"inspect_counters",
7134+
"libc",
7135+
"memory_range",
7136+
"mesh",
7137+
"pal",
7138+
"pal_async",
7139+
"pal_uring",
7140+
"parking_lot",
7141+
"pci_core",
7142+
"safe_x86_intrinsics",
7143+
"shared_pool_alloc",
7144+
"sidecar_client",
7145+
"thiserror",
7146+
"tracelimit",
7147+
"tracing",
7148+
"virt",
7149+
"virt_support_aarch64emu",
7150+
"virt_support_apic",
7151+
"virt_support_x86emu",
7152+
"vm_topology",
7153+
"vmcore",
7154+
"vtl_array",
7155+
"x86defs",
7156+
"x86emu",
7157+
"zerocopy",
7158+
]
7159+
71157160
[[package]]
71167161
name = "virt_support_aarch64emu"
71177162
version = "0.0.0"
@@ -7174,51 +7219,6 @@ dependencies = [
71747219
"zerocopy",
71757220
]
71767221

7177-
[[package]]
7178-
name = "virt_underhill"
7179-
version = "0.0.0"
7180-
dependencies = [
7181-
"aarch64defs",
7182-
"aarch64emu",
7183-
"anyhow",
7184-
"bitfield-struct",
7185-
"bitvec",
7186-
"build_rs_guest_arch",
7187-
"cfg-if",
7188-
"fs-err",
7189-
"guestmem",
7190-
"hcl",
7191-
"hv1_emulator",
7192-
"hv1_hypercall",
7193-
"hvdef",
7194-
"inspect",
7195-
"inspect_counters",
7196-
"libc",
7197-
"memory_range",
7198-
"mesh",
7199-
"pal",
7200-
"pal_async",
7201-
"pal_uring",
7202-
"parking_lot",
7203-
"pci_core",
7204-
"safe_x86_intrinsics",
7205-
"shared_pool_alloc",
7206-
"sidecar_client",
7207-
"thiserror",
7208-
"tracelimit",
7209-
"tracing",
7210-
"virt",
7211-
"virt_support_aarch64emu",
7212-
"virt_support_apic",
7213-
"virt_support_x86emu",
7214-
"vm_topology",
7215-
"vmcore",
7216-
"vtl_array",
7217-
"x86defs",
7218-
"x86emu",
7219-
"zerocopy",
7220-
]
7221-
72227222
[[package]]
72237223
name = "virt_whp"
72247224
version = "0.0.0"

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ underhill_init = { path = "openhcl/underhill_init" }
158158
underhill_mem = { path = "openhcl/underhill_mem" }
159159
openvmm_hcl_resources = { path = "openhcl/openvmm_hcl_resources" }
160160
underhill_threadpool = { path = "openhcl/underhill_threadpool" }
161-
virt_underhill = { path = "openhcl/virt_underhill" }
161+
virt_mshv_vtl = { path = "openhcl/virt_mshv_vtl" }
162162

163163
aarch64defs = { path = "vm/aarch64/aarch64defs" }
164164
aarch64emu = { path = "vm/aarch64/aarch64emu" }

openhcl/underhill_core/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ edition = "2021"
99
profiler = ["dep:profiler_worker", "diag_server/profiler"]
1010

1111
# Enable gdbstub support
12-
gdb = ["debug_worker_defs", "vmm_core/gdb", "virt_underhill/gdb"]
12+
gdb = ["debug_worker_defs", "vmm_core/gdb", "virt_mshv_vtl/gdb"]
1313

1414
# Enable locally compiling and statically linking a copy of OpenSSL.
1515
# The build process requires a C compiler, perl, and make.
@@ -92,7 +92,7 @@ underhill_threadpool.workspace = true
9292
bootloader_fdt_parser.workspace = true
9393
vga_proxy.workspace = true
9494
video_core.workspace = true
95-
virt_underhill.workspace = true
95+
virt_mshv_vtl.workspace = true
9696
vm_manifest_builder.workspace = true
9797
vmbus_async.workspace = true
9898
vmbus_user_channel.workspace = true

openhcl/underhill_core/src/dispatch/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ use tracing::instrument;
5454
use tracing::Instrument;
5555
use uevent::UeventListener;
5656
use underhill_threadpool::AffinitizedThreadpool;
57-
use virt_underhill::UhPartition;
58-
use virt_underhill::VtlCrash;
57+
use virt_mshv_vtl::UhPartition;
58+
use virt_mshv_vtl::VtlCrash;
5959
use vm_resource::ResourceResolver;
6060
use vm_topology::memory::MemoryRangeWithNode;
6161
use vmbus_channel::channel::VmbusDevice;

openhcl/underhill_core/src/emuplat/firmware.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use firmware_uefi::platform::logger::UefiLogger;
99
use guest_emulation_transport::api::EventLogId;
1010
use guest_emulation_transport::GuestEmulationTransportClient;
1111
use std::sync::Weak;
12-
use virt_underhill::UhPartition;
12+
use virt_mshv_vtl::UhPartition;
1313

1414
/// An Underhill specific logger used to log UEFI and PCAT events.
1515
#[derive(Debug)]

openhcl/underhill_core/src/emuplat/vga_proxy.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
use std::ops::RangeInclusive;
44
use std::sync::Arc;
5-
use virt_underhill::UhPartition;
5+
use virt_mshv_vtl::UhPartition;
66

77
pub struct UhRegisterHostIoFastPath(pub Arc<UhPartition>);
88

openhcl/underhill_core/src/vp.rs

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use underhill_threadpool::AffinitizedThreadpool;
1111

1212
pub(crate) async fn spawn_vps(
1313
tp: &AffinitizedThreadpool,
14-
vps: Vec<virt_underhill::UhProcessorBox>,
14+
vps: Vec<virt_mshv_vtl::UhProcessorBox>,
1515
runners: Vec<vmm_core::partition_unit::VpRunner>,
1616
chipset: &vmm_core::vmotherboard_adapter::ChipsetPlusSynic,
1717
isolation: Option<hcl::ioctl::IsolationType>,
@@ -27,7 +27,7 @@ pub(crate) async fn spawn_vps(
2727

2828
/// An object to spawn and run a VP.
2929
struct VpSpawner {
30-
vp: virt_underhill::UhProcessorBox,
30+
vp: virt_mshv_vtl::UhProcessorBox,
3131
cpu: u32,
3232
chipset: vmm_core::vmotherboard_adapter::ChipsetPlusSynic,
3333
runner: vmm_core::partition_unit::VpRunner,
@@ -37,7 +37,7 @@ struct VpSpawner {
3737
impl VpSpawner {
3838
/// Creates a new spawner.
3939
pub fn new(
40-
vp: virt_underhill::UhProcessorBox,
40+
vp: virt_mshv_vtl::UhProcessorBox,
4141
chipset: vmm_core::vmotherboard_adapter::ChipsetPlusSynic,
4242
runner: vmm_core::partition_unit::VpRunner,
4343
isolation: Option<hcl::ioctl::IsolationType>,
@@ -71,14 +71,14 @@ impl VpSpawner {
7171
}
7272
}
7373

74-
async fn run_backed_vp<T: virt_underhill::Backing>(
74+
async fn run_backed_vp<T: virt_mshv_vtl::Backing>(
7575
&mut self,
7676
saved_state: Option<vmcore::save_restore::SavedStateBlob>,
7777
control: Option<&mut IdleControl>,
7878
save_on_cancel: bool,
7979
) -> anyhow::Result<Option<vmcore::save_restore::SavedStateBlob>>
8080
where
81-
for<'a> virt_underhill::UhProcessor<'a, T>: vmcore::save_restore::ProtobufSaveRestore,
81+
for<'a> virt_mshv_vtl::UhProcessor<'a, T>: vmcore::save_restore::ProtobufSaveRestore,
8282
{
8383
let thread = underhill_threadpool::Thread::current().unwrap();
8484
// TODO propagate this error back earlier. This is easiest if
@@ -116,7 +116,7 @@ impl VpSpawner {
116116
) -> Option<vmcore::save_restore::SavedStateBlob> {
117117
let r = match self.isolation {
118118
None | Some(hcl::ioctl::IsolationType::Vbs) => {
119-
self.run_backed_vp::<virt_underhill::HypervisorBacked>(
119+
self.run_backed_vp::<virt_mshv_vtl::HypervisorBacked>(
120120
saved_state,
121121
control,
122122
save_on_cancel,
@@ -125,21 +125,13 @@ impl VpSpawner {
125125
}
126126
#[cfg(guest_arch = "x86_64")]
127127
Some(hcl::ioctl::IsolationType::Snp) => {
128-
self.run_backed_vp::<virt_underhill::SnpBacked>(
129-
saved_state,
130-
control,
131-
save_on_cancel,
132-
)
133-
.await
128+
self.run_backed_vp::<virt_mshv_vtl::SnpBacked>(saved_state, control, save_on_cancel)
129+
.await
134130
}
135131
#[cfg(guest_arch = "x86_64")]
136132
Some(hcl::ioctl::IsolationType::Tdx) => {
137-
self.run_backed_vp::<virt_underhill::TdxBacked>(
138-
saved_state,
139-
control,
140-
save_on_cancel,
141-
)
142-
.await
133+
self.run_backed_vp::<virt_mshv_vtl::TdxBacked>(saved_state, control, save_on_cancel)
134+
.await
143135
}
144136
#[cfg(guest_arch = "aarch64")]
145137
_ => unimplemented!(),

openhcl/underhill_core/src/worker.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,8 @@ use virt::state::HvRegisterState;
120120
use virt::Partition;
121121
use virt::VpIndex;
122122
use virt::X86Partition;
123-
use virt_underhill::UhPartition;
124-
use virt_underhill::UhPartitionNewParams;
123+
use virt_mshv_vtl::UhPartition;
124+
use virt_mshv_vtl::UhPartitionNewParams;
125125
use vm_loader::initial_regs::initial_regs;
126126
use vm_resource::kind::DiskHandleKind;
127127
use vm_resource::kind::KeyboardInputHandleKind;
@@ -1255,15 +1255,15 @@ async fn new_underhill_vm(
12551255
#[cfg(guest_arch = "x86_64")]
12561256
Some(hcl::ioctl::IsolationType::Snp) => {
12571257
let cpu_bytes = boot_info.cpus.len() as u64
1258-
* virt_underhill::snp_shared_pages_required_per_cpu()
1258+
* virt_mshv_vtl::snp_shared_pages_required_per_cpu()
12591259
* hvdef::HV_PAGE_SIZE;
12601260

12611261
round_up_to_2mb(cpu_bytes + device_dma + attestation)
12621262
}
12631263
#[cfg(guest_arch = "x86_64")]
12641264
Some(hcl::ioctl::IsolationType::Tdx) => {
12651265
let cpu_bytes = boot_info.cpus.len() as u64
1266-
* virt_underhill::tdx_shared_pages_required_per_cpu()
1266+
* virt_mshv_vtl::tdx_shared_pages_required_per_cpu()
12671267
* hvdef::HV_PAGE_SIZE;
12681268

12691269
round_up_to_2mb(cpu_bytes + device_dma + attestation)

openhcl/underhill_core/src/wrapped_partition.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use inspect::InspectMut;
66
use memory_range::MemoryRange;
77
use std::sync::Arc;
88
use virt::PageVisibility;
9-
use virt_underhill::UhPartition;
9+
use virt_mshv_vtl::UhPartition;
1010
use vmcore::save_restore::NoSavedState;
1111
use vmcore::save_restore::RestoreError;
1212
use vmcore::save_restore::SaveError;

openhcl/underhill_mem/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ hcl.workspace = true
1010
hvdef.workspace = true
1111
memory_range.workspace = true
1212
underhill_threadpool.workspace = true
13-
virt_underhill.workspace = true
13+
virt_mshv_vtl.workspace = true
1414
vm_topology.workspace = true
1515
x86defs.workspace = true
1616

0 commit comments

Comments
 (0)