mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-12-22 05:35:20 +00:00
vmm: tdx: Error out early for TD migration
Signed-off-by: Bo Chen <chen.bo@intel.com>
(cherry picked from commit e64b66054e
)
This commit is contained in:
parent
920564b281
commit
948e7ca61a
@ -1664,7 +1664,12 @@ impl Vmm {
|
||||
#[cfg(all(feature = "kvm", target_arch = "x86_64"))]
|
||||
let common_cpuid = {
|
||||
#[cfg(feature = "tdx")]
|
||||
let tdx = vm_config.lock().unwrap().is_tdx_enabled();
|
||||
if vm_config.lock().unwrap().is_tdx_enabled() {
|
||||
return Err(MigratableError::MigrateSend(anyhow!(
|
||||
"Live Migration is not supported when TDX is enabled"
|
||||
)));
|
||||
};
|
||||
|
||||
let amx = vm_config.lock().unwrap().cpus.features.amx;
|
||||
let phys_bits =
|
||||
vm::physical_bits(&hypervisor, vm_config.lock().unwrap().cpus.max_phys_bits);
|
||||
@ -1675,7 +1680,7 @@ impl Vmm {
|
||||
phys_bits,
|
||||
kvm_hyperv: vm_config.lock().unwrap().cpus.kvm_hyperv,
|
||||
#[cfg(feature = "tdx")]
|
||||
tdx,
|
||||
tdx: false,
|
||||
amx,
|
||||
},
|
||||
)
|
||||
@ -1854,6 +1859,13 @@ impl Vmm {
|
||||
src_vm_config: &Arc<Mutex<VmConfig>>,
|
||||
src_vm_cpuid: &[hypervisor::arch::x86::CpuIdEntry],
|
||||
) -> result::Result<(), MigratableError> {
|
||||
#[cfg(feature = "tdx")]
|
||||
if src_vm_config.lock().unwrap().is_tdx_enabled() {
|
||||
return Err(MigratableError::MigrateReceive(anyhow!(
|
||||
"Live Migration is not supported when TDX is enabled"
|
||||
)));
|
||||
};
|
||||
|
||||
// We check the `CPUID` compatibility of between the source vm and destination, which is
|
||||
// mostly about feature compatibility and "topology/sgx" leaves are not relevant.
|
||||
let dest_cpuid = &{
|
||||
@ -1867,7 +1879,7 @@ impl Vmm {
|
||||
phys_bits,
|
||||
kvm_hyperv: vm_config.cpus.kvm_hyperv,
|
||||
#[cfg(feature = "tdx")]
|
||||
tdx: vm_config.is_tdx_enabled(),
|
||||
tdx: false,
|
||||
amx: vm_config.cpus.features.amx,
|
||||
},
|
||||
)
|
||||
|
@ -2390,12 +2390,9 @@ impl Snapshottable for Vm {
|
||||
fn snapshot(&mut self) -> std::result::Result<Snapshot, MigratableError> {
|
||||
event!("vm", "snapshotting");
|
||||
|
||||
#[cfg(feature = "tdx")]
|
||||
let tdx_enabled = self.config.lock().unwrap().is_tdx_enabled();
|
||||
|
||||
#[cfg(feature = "tdx")]
|
||||
{
|
||||
if tdx_enabled {
|
||||
if self.config.lock().unwrap().is_tdx_enabled() {
|
||||
return Err(MigratableError::Snapshot(anyhow!(
|
||||
"Snapshot not possible with TDX VM"
|
||||
)));
|
||||
@ -2423,7 +2420,7 @@ impl Snapshottable for Vm {
|
||||
phys_bits,
|
||||
kvm_hyperv: self.config.lock().unwrap().cpus.kvm_hyperv,
|
||||
#[cfg(feature = "tdx")]
|
||||
tdx: tdx_enabled,
|
||||
tdx: false,
|
||||
amx,
|
||||
},
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user