qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Berger <stefanb@linux.ibm.com>
To: Stefan Berger <stefanb@linux.vnet.ibm.com>, qemu-ppc@nongnu.org
Cc: marcandre.lureau@redhat.com, qemu-devel@nongnu.org,
	david@gibson.dropbear.id.au
Subject: Re: [PATCH v4 3/8] tpm_emulator: Implement callback for whether we are suspended
Date: Thu, 12 Dec 2019 15:10:49 -0500	[thread overview]
Message-ID: <e0c93bcf-e8a6-55c0-a32c-e63b3c5ccb21@linux.ibm.com> (raw)
In-Reply-To: <76e147e3-c5d1-e7e0-1297-f1f2f0e07aa5@linux.ibm.com>

On 12/12/19 1:33 PM, Stefan Berger wrote:
> On 12/12/19 1:07 PM, Stefan Berger wrote:
>> Implement the check whether the emulator backend is suspended.
>>
>> Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
>>
>> diff --git a/hw/tpm/tpm_emulator.c b/hw/tpm/tpm_emulator.c
>> index 22f9113432..7be7d3a91b 100644
>> --- a/hw/tpm/tpm_emulator.c
>> +++ b/hw/tpm/tpm_emulator.c
>> @@ -80,6 +80,8 @@ typedef struct TPMEmulator {
>>       unsigned int established_flag_cached:1;
>>         TPMBlobBuffers state_blobs;
>> +
>> +    bool is_suspended;
>>   } TPMEmulator;
>>     struct tpm_error {
>> @@ -486,6 +488,13 @@ static size_t 
>> tpm_emulator_get_buffer_size(TPMBackend *tb)
>>       return actual_size;
>>   }
>>   +static bool tpm_emulator_is_suspended(TPMBackend *tb)
>> +{
>> +    TPMEmulator *tpm_emu = TPM_EMULATOR(tb);
>> +
>> +    return tpm_emu->is_suspended;
>> +}
>> +
>>   static int tpm_emulator_block_migration(TPMEmulator *tpm_emu)
>>   {
>>       Error *err = NULL;
>> @@ -846,6 +855,8 @@ static int tpm_emulator_pre_save(void *opaque)
>>       TPMBackend *tb = opaque;
>>       TPMEmulator *tpm_emu = TPM_EMULATOR(tb);
>>   +    tpm_emu->is_suspended = true;
>
> This is the most critical part here. It must be true when we receive a 
> response in the tpm_spapr_request_completed(). The problem is that 
> what tpm_backend_finish_sync() does is not specific to this backend 
> but more a global operation that another device could run as well -- 
> none seem to do this today. So the point is that there could be a race 
> here. This flag should really be set in '.pre_pre_save,' so before any 
> other device could poll. Better would be calling a global function 
> that indicates whether device suspension has started. In this case we 
> could do away with this and just call that function from the spapr 
> device.


runstate_check(RUN_STATE_FINISH_MIGRATE) seems to be what we need here...



>
>
>



  reply	other threads:[~2019-12-12 20:12 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-12 18:07 [PATCH v4 0/8] Add vTPM emulator supportfor ppc64 platform Stefan Berger
2019-12-12 18:07 ` [PATCH v4 1/8] tpm_spapr: Support TPM for ppc64 using CRQ based interface Stefan Berger
2019-12-12 18:07 ` [PATCH v4 2/8] tpm_backend: Implement check whether tpm backend is suspended Stefan Berger
2019-12-12 18:07 ` [PATCH v4 3/8] tpm_emulator: Implement callback for whether we are suspended Stefan Berger
2019-12-12 18:33   ` Stefan Berger
2019-12-12 20:10     ` Stefan Berger [this message]
2019-12-12 18:07 ` [PATCH v4 4/8] tpm_passthrough: " Stefan Berger
2019-12-12 18:07 ` [PATCH v4 5/8] tpm: Return bool from tpm_backend_finish_sync Stefan Berger
2019-12-12 18:07 ` [PATCH v4 6/8] tpm_spapr: Support suspend and resume Stefan Berger
2019-12-12 18:07 ` [PATCH v4 7/8] hw/ppc/Kconfig: Enable TPM_SPAPR as part of PSERIES config Stefan Berger
2019-12-12 18:07 ` [PATCH v4 8/8] docs: tpm: Add example command line for ppc64 and tpm-spapr 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=e0c93bcf-e8a6-55c0-a32c-e63b3c5ccb21@linux.ibm.com \
    --to=stefanb@linux.ibm.com \
    --cc=david@gibson.dropbear.id.au \
    --cc=marcandre.lureau@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=stefanb@linux.vnet.ibm.com \
    /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).