tpm: tpm_emulator: get and set buffer size of device

Convert the tpm_emulator backend to get the current buffer size
of the external device and set it to the buffer size that the
frontend (TIS) requests.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
This commit is contained in:
Stefan Berger 2017-11-04 19:57:15 -04:00
parent abc5cda097
commit 9375c44fdf
5 changed files with 111 additions and 12 deletions

View file

@ -974,9 +974,9 @@ static const MemoryRegionOps tpm_tis_memory_ops = {
},
};
static int tpm_tis_do_startup_tpm(TPMState *s)
static int tpm_tis_do_startup_tpm(TPMState *s, uint32_t buffersize)
{
return tpm_backend_startup_tpm(s->be_driver);
return tpm_backend_startup_tpm(s->be_driver, buffersize);
}
static void tpm_tis_realloc_buffer(TPMSizedBuffer *sb,
@ -1044,7 +1044,7 @@ static void tpm_tis_reset(DeviceState *dev)
tpm_tis_realloc_buffer(&s->loc[c].r_buffer, s->be_buffer_size);
}
tpm_tis_do_startup_tpm(s);
tpm_tis_do_startup_tpm(s, 0);
}
static const VMStateDescription vmstate_tpm_tis = {