mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-12-22 13:45:20 +00:00
hypervisor: Add a flag to identify sev-snp VM
This will help in identify whether a VM supports sev-snp and based on that disable/enable certain features. Signed-off-by: Jinank Jain <jinankjain@microsoft.com> Signed-off-by: Muminul Islam <muislam@microsoft.com>
This commit is contained in:
parent
af4a193b43
commit
3a683b54d5
@ -251,6 +251,7 @@ impl hypervisor::Hypervisor for MshvHypervisor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Set additional partition property for SEV-SNP partition.
|
// Set additional partition property for SEV-SNP partition.
|
||||||
|
let mut _sev_snp_enabled = mshv_vm_type == VmType::Snp;
|
||||||
if mshv_vm_type == VmType::Snp {
|
if mshv_vm_type == VmType::Snp {
|
||||||
let snp_policy = snp::get_default_snp_guest_policy();
|
let snp_policy = snp::get_default_snp_guest_policy();
|
||||||
let vmgexit_offloads = snp::get_default_vmgexit_offload_features();
|
let vmgexit_offloads = snp::get_default_vmgexit_offload_features();
|
||||||
@ -306,6 +307,8 @@ impl hypervisor::Hypervisor for MshvHypervisor {
|
|||||||
fd: vm_fd,
|
fd: vm_fd,
|
||||||
msrs,
|
msrs,
|
||||||
dirty_log_slots: Arc::new(RwLock::new(HashMap::new())),
|
dirty_log_slots: Arc::new(RwLock::new(HashMap::new())),
|
||||||
|
#[cfg(feature = "sev_snp")]
|
||||||
|
sev_snp_enabled: _sev_snp_enabled,
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1467,6 +1470,8 @@ pub struct MshvVm {
|
|||||||
fd: Arc<VmFd>,
|
fd: Arc<VmFd>,
|
||||||
msrs: Vec<MsrEntry>,
|
msrs: Vec<MsrEntry>,
|
||||||
dirty_log_slots: Arc<RwLock<HashMap<u64, MshvDirtyLogSlot>>>,
|
dirty_log_slots: Arc<RwLock<HashMap<u64, MshvDirtyLogSlot>>>,
|
||||||
|
#[cfg(feature = "sev_snp")]
|
||||||
|
sev_snp_enabled: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl MshvVm {
|
impl MshvVm {
|
||||||
|
Loading…
Reference in New Issue
Block a user