Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 31 Jul 2026 14:30:17 +0000
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 1c1a3646a1c8 - main - bhyve: tpm: Avoid printing a message when clearing the cancel bit
Message-ID:  <6a6cb179.203f1.35c691@gitrepo.freebsd.org>

index | next in thread | raw e-mail

The branch main has been updated by markj:

URL: https://cgit.FreeBSD.org/src/commit/?id=1c1a3646a1c86624e67a42636894fd1685386cf1

commit 1c1a3646a1c86624e67a42636894fd1685386cf1
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2026-07-31 14:22:46 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2026-07-31 14:22:51 +0000

    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
---
 usr.sbin/bhyve/tpm_intf_crb.c | 15 +++++++++++----
 1 file 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):


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6a6cb179.203f1.35c691>