MCPcopy Create free account
hub / github.com/cloud-hypervisor/cloud-hypervisor / add_tpm_device

Method add_tpm_device

vmm/src/device_manager.rs:2569–2590  ·  view source on GitHub ↗
(
        &mut self,
        tpm_path: &Path,
    )

Source from the content-addressed store, hash-verified

2567
2568 #[cfg(not(target_arch = "riscv64"))]
2569 fn add_tpm_device(
2570 &mut self,
2571 tpm_path: &Path,
2572 ) -> DeviceManagerResult<Arc<Mutex<devices::tpm::Tpm>>> {
2573 // Create TPM Device
2574 let tpm = devices::tpm::Tpm::new(tpm_path).map_err(|e| {
2575 DeviceManagerError::CreateTpmDevice(anyhow!("Failed to create TPM Device : {e:?}"))
2576 })?;
2577 let tpm = Arc::new(Mutex::new(tpm));
2578
2579 // Add TPM Device to mmio
2580 self.address_manager
2581 .mmio_bus
2582 .insert(
2583 tpm.clone(),
2584 arch::layout::TPM_START.0,
2585 arch::layout::TPM_SIZE,
2586 )
2587 .map_err(DeviceManagerError::BusError)?;
2588
2589 Ok(tpm)
2590 }
2591
2592 /// Tries to acquire advisory locks for all disk images.
2593 ///

Callers 1

create_devicesMethod · 0.80

Calls 3

newFunction · 0.85
insertMethod · 0.45
cloneMethod · 0.45

Tested by

no test coverage detected