qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] tpm: fixed be_buffer_size size in in tpm_crb


From: Yuri Konotopov
Subject: [PATCH] tpm: fixed be_buffer_size size in in tpm_crb
Date: Sat, 25 Dec 2021 16:38:06 +0400

Trying to boot VM with TPM 2.0 CRB in passthrough mode without this change
I got "Requested buffer size of 3968 is smaller than host TPM's fixed
buffer size of 4096".
Looks like it can not be less than backend buffer size nor less than
CRB_CTRL_CMD_SIZE.

Signed-off-by: Yuri Konotopov <ykonotopov@gnome.org>
---
 hw/tpm/tpm_crb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/tpm/tpm_crb.c b/hw/tpm/tpm_crb.c
index 58ebd1469c..8243645453 100644
--- a/hw/tpm/tpm_crb.c
+++ b/hw/tpm/tpm_crb.c
@@ -270,7 +270,7 @@ static void tpm_crb_reset(void *dev)
     s->regs[R_CRB_CTRL_RSP_SIZE] = CRB_CTRL_CMD_SIZE;
     s->regs[R_CRB_CTRL_RSP_ADDR] = TPM_CRB_ADDR_BASE + A_CRB_DATA_BUFFER;
 
-    s->be_buffer_size = MIN(tpm_backend_get_buffer_size(s->tpmbe),
+    s->be_buffer_size = MAX(tpm_backend_get_buffer_size(s->tpmbe),
                             CRB_CTRL_CMD_SIZE);
 
     if (tpm_backend_startup_tpm(s->tpmbe, s->be_buffer_size) < 0) {
-- 
2.32.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]