diff options
| author | Mark Johnston <markj@FreeBSD.org> | 2026-07-31 14:22:46 +0000 |
|---|---|---|
| committer | Mark Johnston <markj@FreeBSD.org> | 2026-07-31 14:22:51 +0000 |
| commit | 1c1a3646a1c86624e67a42636894fd1685386cf1 (patch) | |
| tree | edd03cc40b867913b232904257bca4a931ff36e2 | |
| parent | 1719b754a9ec88fcf0f5f4b001b1b5d5d6db5819 (diff) | |
bhyve: tpm: Avoid printing a message when clearing the cancel bit
Some drivers do this routinely, e.g., FreeBSD's tpm20 does this every
time it sends a command in tpmcrb_transmit(). This causes the console
to fill up with messages. Instead, only print a warning if the cancel
bit is set to one.
Reviewed by: corvink
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D52425
| -rw-r--r-- | usr.sbin/bhyve/tpm_intf_crb.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/usr.sbin/bhyve/tpm_intf_crb.c b/usr.sbin/bhyve/tpm_intf_crb.c index d571e89bb5ae..7058b47733f3 100644 --- a/usr.sbin/bhyve/tpm_intf_crb.c +++ b/usr.sbin/bhyve/tpm_intf_crb.c @@ -371,11 +371,18 @@ tpm_crb_mem_handler(struct vcpu *vcpu __unused, const int dir, break; } case offsetof(struct tpm_crb_regs, ctrl_cancel): { - /* TODO: cancel the tpm command */ - warnx( - "%s: cancelling a TPM command is not implemented yet", - __func__); + union tpm_crb_reg_ctrl_cancel cancel; + + if ((size_t)size > sizeof(cancel)) + goto err_out; + tpm_crb_mmiocpy(&cancel, val, size); + if (cancel.cancel != 0) { + /* TODO: cancel the tpm command */ + warnx( + "%s: cancelling a TPM command is not implemented yet", + __func__); + } break; } case offsetof(struct tpm_crb_regs, int_enable): |
