diff --git a/hypervisor/src/lib.rs b/hypervisor/src/lib.rs index 447e8abd4..0c0e940e4 100644 --- a/hypervisor/src/lib.rs +++ b/hypervisor/src/lib.rs @@ -134,6 +134,7 @@ pub const USER_MEMORY_REGION_READ: u32 = 1; pub const USER_MEMORY_REGION_WRITE: u32 = 1 << 1; pub const USER_MEMORY_REGION_EXECUTE: u32 = 1 << 2; pub const USER_MEMORY_REGION_LOG_DIRTY: u32 = 1 << 3; +pub const USER_MEMORY_REGION_ADJUSTABLE: u32 = 1 << 4; #[derive(Debug)] pub enum MpState { diff --git a/hypervisor/src/mshv/mod.rs b/hypervisor/src/mshv/mod.rs index 16e59ffee..516b81bbf 100644 --- a/hypervisor/src/mshv/mod.rs +++ b/hypervisor/src/mshv/mod.rs @@ -31,7 +31,8 @@ use snp_constants::*; use crate::{ ClockData, CpuState, IoEventAddress, IrqRoutingEntry, MpState, UserMemoryRegion, - USER_MEMORY_REGION_EXECUTE, USER_MEMORY_REGION_READ, USER_MEMORY_REGION_WRITE, + USER_MEMORY_REGION_ADJUSTABLE, USER_MEMORY_REGION_EXECUTE, USER_MEMORY_REGION_READ, + USER_MEMORY_REGION_WRITE, }; #[cfg(feature = "sev_snp")] use igvm_defs::IGVM_VHS_SNP_ID_BLOCK; @@ -73,6 +74,9 @@ impl From for UserMemoryRegion { if region.flags & HV_MAP_GPA_EXECUTABLE != 0 { flags |= USER_MEMORY_REGION_EXECUTE; } + if region.flags & HV_MAP_GPA_ADJUSTABLE != 0 { + flags |= USER_MEMORY_REGION_ADJUSTABLE; + } UserMemoryRegion { guest_phys_addr: (region.guest_pfn << PAGE_SHIFT as u64) @@ -97,6 +101,9 @@ impl From for mshv_user_mem_region { if region.flags & USER_MEMORY_REGION_EXECUTE != 0 { flags |= HV_MAP_GPA_EXECUTABLE; } + if region.flags & USER_MEMORY_REGION_ADJUSTABLE != 0 { + flags |= HV_MAP_GPA_ADJUSTABLE; + } mshv_user_mem_region { guest_pfn: region.guest_phys_addr >> PAGE_SHIFT, @@ -1658,7 +1665,7 @@ impl vm::Vm for MshvVm { readonly: bool, _log_dirty_pages: bool, ) -> UserMemoryRegion { - let mut flags = HV_MAP_GPA_READABLE | HV_MAP_GPA_EXECUTABLE; + let mut flags = HV_MAP_GPA_READABLE | HV_MAP_GPA_EXECUTABLE | HV_MAP_GPA_ADJUSTABLE; if !readonly { flags |= HV_MAP_GPA_WRITABLE; }