Commit Graph

7 Commits

Author SHA1 Message Date
Wei Liu
2b76e1d7ba devices: simplify TPM handling
The error is never propagated anywhere. Drop it.

Avoid unwrapping unconditionally.

Signed-off-by: Wei Liu <liuwe@microsoft.com>
2023-01-26 07:57:48 +00:00
Wei Liu
15ace525be devices: drop cmd field from TPM struct
There is no need to hold on to it. It is only used locally in a
function.

Signed-off-by: Wei Liu <liuwe@microsoft.com>
2023-01-26 07:57:48 +00:00
Wei Liu
8db630763a devices: clean up two comments in TPM code
Signed-off-by: Wei Liu <liuwe@microsoft.com>
2023-01-25 18:40:57 +00:00
Wei Liu
cd1470e289 devices: rework TPM register and field look-up
Match against enums instead.

This then drops the need to import phf.

Signed-off-by: Wei Liu <liuwe@microsoft.com>
2023-01-25 18:40:57 +00:00
Wei Liu
99d8c34861 devices: change TPM_CRB_R_MAX from u32 to usize
This simplifies the code a bit.

Signed-off-by: Wei Liu <liuwe@microsoft.com>
2023-01-25 18:40:57 +00:00
Rob Bradford
5e52729453 misc: Automatically fix cargo clippy issues added in 1.65 (stable)
Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2022-12-14 14:27:19 +00:00
Praveen K Paladugu
d0b253d15f devices: Add tpm device
This device emulates a tpm device in cloud-hypervisor. Read and write support
to miminal set of control registers is supported.

Non-control commands will be processed as reads and write to
CRB_DATA_BUFFER. Reads and Writes to this data buffer are forwarded to
swtpm via the configured data_fd.

Signed-off-by: Praveen K Paladugu <prapal@linux.microsoft.com>
Co-authored-by: Sean Yoo <t-seanyoo@microsoft.com>
2022-11-15 16:42:21 +00:00