Skip to content

Commit

Permalink
Add much of the basic wiring for TDX Guest VSM support. (#541)
Browse files Browse the repository at this point in the history
This is just most of the inner wiring, replacing hardcoded VTLs with the
actual ones. Should introduce no functional changes just yet.
  • Loading branch information
smalis-msft authored Jan 8, 2025
1 parent 8171cea commit 8cf8aa4
Show file tree
Hide file tree
Showing 7 changed files with 517 additions and 446 deletions.
9 changes: 3 additions & 6 deletions openhcl/virt_mshv_vtl/src/processor/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -229,11 +229,7 @@ mod private {
/// message slot.
///
/// This is used for hypervisor-managed and untrusted SINTs.
fn request_untrusted_sint_readiness(
this: &mut UhProcessor<'_, Self>,
vtl: GuestVtl,
sints: u16,
);
fn request_untrusted_sint_readiness(this: &mut UhProcessor<'_, Self>, sints: u16);

/// Returns whether this VP should be put to sleep in usermode, or
/// whether it's ready to proceed into the kernel.
Expand Down Expand Up @@ -958,7 +954,8 @@ impl<'a, T: Backing> UhProcessor<'a, T> {
};

if sints & untrusted_sints != 0 {
T::request_untrusted_sint_readiness(self, vtl, sints & untrusted_sints);
assert_eq!(vtl, GuestVtl::Vtl0);
T::request_untrusted_sint_readiness(self, sints & untrusted_sints);
}
}

Expand Down
6 changes: 1 addition & 5 deletions openhcl/virt_mshv_vtl/src/processor/mshv/arm64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,11 +190,7 @@ impl BackingPrivate for HypervisorBackedArm64 {
.set_interrupt_notification(true);
}

fn request_untrusted_sint_readiness(
this: &mut UhProcessor<'_, Self>,
_vtl: GuestVtl,
sints: u16,
) {
fn request_untrusted_sint_readiness(this: &mut UhProcessor<'_, Self>, sints: u16) {
this.backing
.next_deliverability_notifications
.set_sints(this.backing.next_deliverability_notifications.sints() | sints);
Expand Down
6 changes: 1 addition & 5 deletions openhcl/virt_mshv_vtl/src/processor/mshv/x64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -389,11 +389,7 @@ impl BackingPrivate for HypervisorBackedX86 {
.set_interrupt_notification(true);
}

fn request_untrusted_sint_readiness(
this: &mut UhProcessor<'_, Self>,
_vtl: GuestVtl,
sints: u16,
) {
fn request_untrusted_sint_readiness(this: &mut UhProcessor<'_, Self>, sints: u16) {
this.backing
.next_deliverability_notifications
.set_sints(this.backing.next_deliverability_notifications.sints() | sints);
Expand Down
11 changes: 2 additions & 9 deletions openhcl/virt_mshv_vtl/src/processor/snp/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -453,14 +453,7 @@ impl BackingPrivate for SnpBacked {
unreachable!("extint managed through software apic")
}

fn request_untrusted_sint_readiness(
this: &mut UhProcessor<'_, Self>,
vtl: GuestVtl,
sints: u16,
) {
if vtl == GuestVtl::Vtl1 {
todo!("TODO: handle untrusted sints for VTL1");
}
fn request_untrusted_sint_readiness(this: &mut UhProcessor<'_, Self>, sints: u16) {
if this.backing.hv_sint_notifications & !sints == 0 {
return;
}
Expand All @@ -470,7 +463,7 @@ impl BackingPrivate for SnpBacked {
tracing::trace!(?notifications, "setting notifications");
this.runner
.set_vp_register(
vtl,
GuestVtl::Vtl0,
HvX64RegisterName::DeliverabilityNotifications,
u64::from(notifications).into(),
)
Expand Down
Loading

0 comments on commit 8cf8aa4

Please sign in to comment.