vmm: implement AccessPlatform for SEV-SNP proxy struct

Implement AccessPlatform for SEV-SNP guest to access
restricted page using IO. VMM calls MSHV api to get access
of the pages, MSHV requests guest to release the access.

Signed-off-by: Muminul Islam <muislam@microsoft.com>
This commit is contained in:
Muminul Islam 2024-08-06 14:44:51 -07:00 committed by Liu Wei
parent 398e9338a7
commit 959ea7115f

View File

@ -800,6 +800,20 @@ impl SevSnpPageAccessProxy {
}
}
#[cfg(all(feature = "mshv", feature = "sev_snp"))]
impl AccessPlatform for SevSnpPageAccessProxy {
fn translate_gpa(&self, base: u64, _size: u64) -> std::result::Result<u64, std::io::Error> {
Ok(base)
}
fn translate_gva(&self, base: u64, size: u64) -> std::result::Result<u64, std::io::Error> {
self.vm
.gain_page_access(base, size as u32)
.map_err(|e| io::Error::new(io::ErrorKind::Other, e))?;
Ok(base)
}
}
pub struct DeviceManager {
// Manage address space related to devices
address_manager: Arc<AddressManager>,