All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefan Berger <stefanb@linux.ibm.com>
To: Yuri Konotopov <ykonotopov@gnome.org>, qemu-devel@nongnu.org
Subject: Re: [PATCH] tpm: fixed be_buffer_size size in in tpm_crb
Date: Sun, 26 Dec 2021 21:24:45 -0500	[thread overview]
Message-ID: <c212e049-0f1a-dc81-e785-2ae02097187d@linux.ibm.com> (raw)
In-Reply-To: <20211225123806.113368-1-ykonotopov@gnome.org>


On 12/25/21 07:38, Yuri Konotopov wrote:
> 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".

I suppose the host has a TIS interface.

The reason it gives this message is that the response this TPM may send 
back could be 4096 bytes in size but the CRB of the VM can only catch 
3968 bytes, so there's a mismatch. You may not be able to use the CRB in 
passthrough mode. I would try to have the VM use the TIS.

    Stefan


> 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) {


  parent reply	other threads:[~2021-12-27  2:25 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-25 12:38 [PATCH] tpm: fixed be_buffer_size size in in tpm_crb Yuri Konotopov
2021-12-25 20:48 ` Philippe Mathieu-Daudé
2021-12-27  2:24 ` Stefan Berger [this message]
2021-12-27  2:58   ` Stefan Berger
2021-12-27  7:29   ` Yuri Konotopov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c212e049-0f1a-dc81-e785-2ae02097187d@linux.ibm.com \
    --to=stefanb@linux.ibm.com \
    --cc=qemu-devel@nongnu.org \
    --cc=ykonotopov@gnome.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.