mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2025-01-21 20:15:21 +00:00
vmm: cpu: Add functionality for enabling TDX for all vCPUs
Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
parent
c8cad394b5
commit
57ce0986f7
@ -186,6 +186,9 @@ pub enum Error {
|
||||
/// Error populating CPUID with CPU identification
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
CpuidIdentification(vmm_sys_util::fam::Error),
|
||||
|
||||
#[cfg(feature = "tdx")]
|
||||
InitializeTdx(hypervisor::HypervisorCpuError),
|
||||
}
|
||||
pub type Result<T> = result::Result<T, Error>;
|
||||
|
||||
@ -1083,6 +1086,18 @@ impl CpuManager {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[cfg(feature = "tdx")]
|
||||
pub fn initialize_tdx(&self, hob_address: u64) -> Result<()> {
|
||||
for vcpu in &self.vcpus {
|
||||
vcpu.lock()
|
||||
.unwrap()
|
||||
.vcpu
|
||||
.tdx_init(hob_address)
|
||||
.map_err(Error::InitializeTdx)?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn boot_vcpus(&self) -> u8 {
|
||||
self.config.boot_vcpus
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user