From 398e9338a703bfe6f959b0b25e572bdc236dad26 Mon Sep 17 00:00:00 2001 From: Muminul Islam Date: Tue, 6 Aug 2024 14:27:38 -0700 Subject: [PATCH] vmm: add a proxy struct for SEV-SNP guest Add a structure to hold the reference of the Vm trait from Hypervisor crate to access of restricted page from SEV-SNP guest. Signed-off-by: Muminul Islam --- vmm/src/device_manager.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/vmm/src/device_manager.rs b/vmm/src/device_manager.rs index 63061bbce..e03296406 100644 --- a/vmm/src/device_manager.rs +++ b/vmm/src/device_manager.rs @@ -781,6 +781,25 @@ pub struct AcpiPlatformAddresses { pub sleep_status_reg_address: Option, } +#[cfg(all(feature = "mshv", feature = "sev_snp"))] +struct SevSnpPageAccessProxy { + vm: Arc, +} + +#[cfg(all(feature = "mshv", feature = "sev_snp"))] +impl std::fmt::Debug for SevSnpPageAccessProxy { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "SNP Page access proxy") + } +} + +#[cfg(all(feature = "mshv", feature = "sev_snp"))] +impl SevSnpPageAccessProxy { + fn new(vm: Arc) -> SevSnpPageAccessProxy { + SevSnpPageAccessProxy { vm } + } +} + pub struct DeviceManager { // Manage address space related to devices address_manager: Arc,