qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Berger <stefanb@linux.vnet.ibm.com>
To: "Marc-André Lureau" <marcandre.lureau@redhat.com>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v2 5/5] tpm: extend TPM CRB with state migration support
Date: Fri, 19 Jan 2018 09:46:58 -0500	[thread overview]
Message-ID: <b6e8f769-9e6d-1b40-93d0-36ab094e3ed5@linux.vnet.ibm.com> (raw)
In-Reply-To: <20180119141105.29095-6-marcandre.lureau@redhat.com>

On 01/19/2018 09:11 AM, Marc-André Lureau wrote:
> From: Stefan Berger <stefanb@linux.vnet.ibm.com>
>
> We need to synchronize with the backend thread to make sure that a command
> being processed by the external TPM emulator has completed and its
> response been received. In case the bottom half did not run, we run the
> function it is supposed to run.
>
> Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
> [ Marc-André - drop memory_region_get_ram_ptr(cmdmem) copy as it
>    should be migrated already ]
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>

I think we need to delay this until the PPI device has been added since 
this will extend the state of the CRB.


> ---
>   hw/tpm/tpm_crb.c | 32 +++++++++++++++++++++++++++++++-
>   1 file changed, 31 insertions(+), 1 deletion(-)
>
> diff --git a/hw/tpm/tpm_crb.c b/hw/tpm/tpm_crb.c
> index 908ca18d92..63d53384c5 100644
> --- a/hw/tpm/tpm_crb.c
> +++ b/hw/tpm/tpm_crb.c
> @@ -257,9 +257,39 @@ static enum TPMVersion tpm_crb_get_version(TPMIf *ti)
>       return tpm_backend_get_tpm_version(s->tpmbe);
>   }
>
> +/* persistent state handling */
> +
> +static int tpm_crb_pre_save(void *opaque)
> +{
> +    CRBState *s = opaque;
> +
> +    tpm_backend_finish_sync(s->tpmbe);
> +
> +    return 0;
> +}
> +
>   static const VMStateDescription vmstate_tpm_crb = {
>       .name = "tpm-crb",
> -    .unmigratable = 1,
> +    .pre_save  = tpm_crb_pre_save,
> +    .fields      = (VMStateField[]) {
> +        VMSTATE_UINT32(regs.loc_state.reg, CRBState),
> +        VMSTATE_UINT32(regs.loc_ctrl, CRBState),
> +        VMSTATE_UINT32(regs.loc_sts.reg, CRBState),
> +        VMSTATE_UINT64(regs.intf_id.reg, CRBState),
> +        VMSTATE_UINT64(regs.ctrl_ext, CRBState),
> +        VMSTATE_UINT32(regs.ctrl_req, CRBState),
> +        VMSTATE_UINT32(regs.ctrl_sts.reg, CRBState),
> +        VMSTATE_UINT32(regs.ctrl_cancel, CRBState),
> +        VMSTATE_UINT32(regs.ctrl_start, CRBState),
> +        VMSTATE_UINT32(regs.ctrl_int_enable, CRBState),
> +        VMSTATE_UINT32(regs.ctrl_int_sts, CRBState),
> +        VMSTATE_UINT32(regs.ctrl_cmd_size, CRBState),
> +        VMSTATE_UINT32(regs.ctrl_cmd_pa_low, CRBState),
> +        VMSTATE_UINT32(regs.ctrl_rsp_size, CRBState),
> +        VMSTATE_UINT64(regs.ctrl_rsp_pa, CRBState),
> +
> +        VMSTATE_END_OF_LIST(),
> +    }
>   };
>
>   static Property tpm_crb_properties[] = {

  reply	other threads:[~2018-01-19 14:47 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-19 14:10 [Qemu-devel] [PATCH v2 0/5] tpm: CRB device and cleanups Marc-André Lureau
2018-01-19 14:11 ` [Qemu-devel] [PATCH v2 1/5] tpm: lookup cancel path under tpm device class Marc-André Lureau
2018-01-19 14:32   ` Stefan Berger
2018-01-19 14:11 ` [Qemu-devel] [PATCH v2 2/5] tpm: replace GThreadPool with AIO threadpool Marc-André Lureau
2018-01-23 18:39   ` Stefan Berger
2018-01-19 14:11 ` [Qemu-devel] [PATCH v2 3/5] tpm: report backend request error Marc-André Lureau
2018-01-19 14:57   ` Stefan Berger
2018-01-19 14:11 ` [Qemu-devel] [PATCH v2 4/5] tpm: add CRB device Marc-André Lureau
2018-01-19 17:10   ` Stefan Berger
2018-01-19 18:42     ` Eduardo Habkost
2018-01-19 21:56       ` Stefan Berger
2018-01-20 11:08         ` Eduardo Habkost
2018-01-20 12:54   ` Philippe Mathieu-Daudé
2018-01-21  5:46     ` Stefan Berger
2018-01-21 19:24       ` Marc-Andre Lureau
2018-01-21 22:01         ` Stefan Berger
2018-01-22 15:08           ` Marc-Andre Lureau
2018-01-22 15:47             ` Stefan Berger
2018-01-22 16:57               ` Marc-André Lureau
2018-01-22 17:25             ` Eduardo Habkost
2018-01-22 17:32               ` Marc-André Lureau
2018-01-22 17:47                 ` Eduardo Habkost
2018-01-22 18:15                   ` Marc-André Lureau
2018-01-22 19:22                     ` Eduardo Habkost
2018-01-21 22:50       ` Philippe Mathieu-Daudé
2018-01-19 14:11 ` [Qemu-devel] [PATCH v2 5/5] tpm: extend TPM CRB with state migration support Marc-André Lureau
2018-01-19 14:46   ` Stefan Berger [this message]
2018-01-19 14:49     ` Marc-André Lureau
2018-01-19 14:36 ` [Qemu-devel] [PATCH v2 0/5] tpm: CRB device and cleanups no-reply
2018-01-19 14:56   ` Marc-Andre Lureau
2018-01-19 15:06     ` Stefan Berger

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=b6e8f769-9e6d-1b40-93d0-36ab094e3ed5@linux.vnet.ibm.com \
    --to=stefanb@linux.vnet.ibm.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=qemu-devel@nongnu.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).