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
1 changed files with 15 additions and 0 deletions
|
|
@ -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…
Add table
Add a link
Reference in a new issue