mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-12-22 05:35:20 +00:00
devices: tpm: failure to deliver request is considered fatal
Signed-off-by: Wei Liu <liuwe@microsoft.com>
This commit is contained in:
parent
938c16f2b2
commit
2d2f356d94
@ -13,7 +13,6 @@ use std::sync::{Arc, Barrier};
|
|||||||
use thiserror::Error;
|
use thiserror::Error;
|
||||||
use tpm::emulator::{BackendCmd, Emulator};
|
use tpm::emulator::{BackendCmd, Emulator};
|
||||||
use tpm::TPM_CRB_BUFFER_MAX;
|
use tpm::TPM_CRB_BUFFER_MAX;
|
||||||
use tpm::TPM_SUCCESS;
|
|
||||||
use vm_device::BusDevice;
|
use vm_device::BusDevice;
|
||||||
|
|
||||||
#[derive(Error, Debug)]
|
#[derive(Error, Debug)]
|
||||||
@ -247,9 +246,9 @@ impl Tpm {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn request_completed(&mut self, result: isize) {
|
fn request_completed(&mut self, success: bool) {
|
||||||
self.regs[CRB_CTRL_START as usize] = !CRB_START_INVOKE;
|
self.regs[CRB_CTRL_START as usize] = !CRB_START_INVOKE;
|
||||||
if result != 0 {
|
if !success {
|
||||||
set_reg_field(
|
set_reg_field(
|
||||||
&mut self.regs,
|
&mut self.regs,
|
||||||
CrbRegister::CtrlSts(CtrlStsFields::TpmSts),
|
CrbRegister::CtrlSts(CtrlStsFields::TpmSts),
|
||||||
@ -476,9 +475,9 @@ impl BusDevice for Tpm {
|
|||||||
input_len: cmp::min(self.data_buff_len, TPM_CRB_BUFFER_MAX),
|
input_len: cmp::min(self.data_buff_len, TPM_CRB_BUFFER_MAX),
|
||||||
};
|
};
|
||||||
|
|
||||||
let _ = self.emulator.deliver_request(&mut cmd);
|
let status = self.emulator.deliver_request(&mut cmd).is_ok();
|
||||||
|
|
||||||
self.request_completed(TPM_SUCCESS as isize);
|
self.request_completed(status);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
CRB_LOC_CTRL => {
|
CRB_LOC_CTRL => {
|
||||||
|
Loading…
Reference in New Issue
Block a user