[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v4 3/8] tpm_emulator: Implement callback for whether we are suspe
From: |
Stefan Berger |
Subject: |
[PATCH v4 3/8] tpm_emulator: Implement callback for whether we are suspended |
Date: |
Thu, 12 Dec 2019 13:07:39 -0500 |
Implement the check whether the emulator backend is suspended.
Signed-off-by: Stefan Berger <address@hidden>
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;
+
trace_tpm_emulator_pre_save();
tpm_backend_finish_sync(tb);
@@ -975,6 +986,7 @@ static void tpm_emulator_class_init(ObjectClass *klass,
void *data)
tbc->get_tpm_version = tpm_emulator_get_tpm_version;
tbc->get_buffer_size = tpm_emulator_get_buffer_size;
tbc->get_tpm_options = tpm_emulator_get_tpm_options;
+ tbc->is_suspended = tpm_emulator_is_suspended;
tbc->handle_request = tpm_emulator_handle_request;
}
--
2.21.0
- [PATCH v4 0/8] Add vTPM emulator supportfor ppc64 platform, Stefan Berger, 2019/12/12
- [PATCH v4 7/8] hw/ppc/Kconfig: Enable TPM_SPAPR as part of PSERIES config, Stefan Berger, 2019/12/12
- [PATCH v4 1/8] tpm_spapr: Support TPM for ppc64 using CRQ based interface, Stefan Berger, 2019/12/12
- [PATCH v4 8/8] docs: tpm: Add example command line for ppc64 and tpm-spapr, Stefan Berger, 2019/12/12
- [PATCH v4 6/8] tpm_spapr: Support suspend and resume, Stefan Berger, 2019/12/12
- [PATCH v4 2/8] tpm_backend: Implement check whether tpm backend is suspended, Stefan Berger, 2019/12/12
- [PATCH v4 3/8] tpm_emulator: Implement callback for whether we are suspended,
Stefan Berger <=
- [PATCH v4 5/8] tpm: Return bool from tpm_backend_finish_sync, Stefan Berger, 2019/12/12
- [PATCH v4 4/8] tpm_passthrough: Implement callback for whether we are suspended, Stefan Berger, 2019/12/12