The branch main has been updated by markj:

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

commit 1c1a3646a1c86624e67a42636894fd1685386cf1
Author:     Mark Johnston <[email protected]>
AuthorDate: 2026-07-31 14:22:46 +0000
Commit:     Mark Johnston <[email protected]>
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):

Reply via email to