1 | From: James Bottomley <James.Bottomley@HansenPartnership.com> | ||
---|---|---|---|
2 | |||
3 | The requested feedback was to convert the tpmdev handler to being json | 1 | The requested feedback was to convert the tpmdev handler to being json |
4 | based, which requires rethreading all the backends. The good news is | 2 | based, which requires rethreading all the backends. The good news is |
5 | this reduced quite a bit of code (especially as I converted it to | 3 | this reduced quite a bit of code (especially as I converted it to |
6 | error_fatal handling as well, which removes the return status | 4 | error_fatal handling as well, which removes the return status |
7 | threading). The bad news is I can't test any of the conversions. | 5 | threading). |
8 | swtpm still isn't building on opensuse and, apparently, passthrough | ||
9 | doesn't like my native TPM because it doesn't allow cancellation. | ||
10 | 6 | ||
11 | v3 pulls out more unneeded code in the visitor conversion, makes | 7 | v3 pulls out more unneeded code in the visitor conversion, makes |
12 | migration work on external state preservation of the simulator and | 8 | migration work on external state preservation of the simulator and |
13 | adds documentation | 9 | adds documentation |
14 | 10 | ||
... | ... | ||
24 | v8 adds better error handling, more code tidies and adds command | 20 | v8 adds better error handling, more code tidies and adds command |
25 | socket disconnection/reconnection (instead of trying to keep the | 21 | socket disconnection/reconnection (instead of trying to keep the |
26 | socket open the whole time). This adds overhead, but makes | 22 | socket open the whole time). This adds overhead, but makes |
27 | debugging guest kernel TPM issues much easier. | 23 | debugging guest kernel TPM issues much easier. |
28 | 24 | ||
25 | v9 Fix merge conflict with optarg->optstr conversion | ||
26 | |||
27 | v10 Fix more merge conflicts and update API versions | ||
28 | |||
29 | v11 Fix another merge conflict and correct a warm reboot problem where | ||
30 | the TPM isn't getting reset (meaning the PCR values are wrong). | ||
31 | |||
29 | James | 32 | James |
30 | 33 | ||
31 | --- | 34 | --- |
32 | 35 | ||
33 | James Bottomley (2): | 36 | James Bottomley (2): |
34 | tpm: convert tpmdev options processing to new visitor format | 37 | tpm: convert tpmdev options processing to new visitor format |
35 | tpm: add backend for mssim | 38 | tpm: add backend for mssim |
36 | 39 | ||
37 | MAINTAINERS | 6 + | 40 | MAINTAINERS | 6 + |
38 | backends/tpm/Kconfig | 5 + | 41 | backends/tpm/Kconfig | 5 + |
39 | backends/tpm/meson.build | 1 + | 42 | backends/tpm/meson.build | 1 + |
40 | backends/tpm/tpm_emulator.c | 25 ++- | 43 | backends/tpm/tpm_emulator.c | 25 +-- |
41 | backends/tpm/tpm_mssim.c | 319 +++++++++++++++++++++++++++++++++ | 44 | backends/tpm/tpm_mssim.c | 335 +++++++++++++++++++++++++++++++++ |
42 | backends/tpm/tpm_mssim.h | 44 +++++ | 45 | backends/tpm/tpm_mssim.h | 44 +++++ |
43 | backends/tpm/tpm_passthrough.c | 23 +-- | 46 | backends/tpm/tpm_passthrough.c | 23 +-- |
44 | docs/specs/tpm.rst | 39 ++++ | 47 | docs/specs/tpm.rst | 39 ++++ |
45 | include/sysemu/tpm.h | 4 +- | 48 | include/sysemu/tpm.h | 5 +- |
46 | include/sysemu/tpm_backend.h | 2 +- | 49 | include/sysemu/tpm_backend.h | 2 +- |
47 | qapi/tpm.json | 49 ++++- | 50 | qapi/tpm.json | 50 ++++- |
48 | softmmu/tpm-hmp-cmds.c | 9 + | 51 | system/tpm-hmp-cmds.c | 9 + |
49 | softmmu/tpm.c | 91 ++++------ | 52 | system/tpm.c | 91 ++++----- |
50 | softmmu/vl.c | 19 +- | 53 | system/vl.c | 19 +- |
51 | 14 files changed, 528 insertions(+), 108 deletions(-) | 54 | 14 files changed, 546 insertions(+), 108 deletions(-) |
52 | create mode 100644 backends/tpm/tpm_mssim.c | 55 | create mode 100644 backends/tpm/tpm_mssim.c |
53 | create mode 100644 backends/tpm/tpm_mssim.h | 56 | create mode 100644 backends/tpm/tpm_mssim.h |
54 | 57 | ||
55 | -- | 58 | -- |
56 | 2.35.3 | 59 | 2.35.3 | diff view generated by jsdifflib |
1 | From: James Bottomley <James.Bottomley@HansenPartnership.com> | ||
---|---|---|---|
2 | |||
3 | Instead of processing the tpmdev options using the old qemu options, | 1 | Instead of processing the tpmdev options using the old qemu options, |
4 | convert to the new visitor format which also allows the passing of | 2 | convert to the new visitor format which also allows the passing of |
5 | json on the command line. | 3 | json on the command line. |
6 | 4 | ||
7 | Signed-off-by: James Bottomley <jejb@linux.ibm.com> | 5 | Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com> |
8 | Tested-by: Stefan Berger <stefanb@linux.ibm.com> | 6 | Tested-by: Stefan Berger <stefanb@linux.ibm.com> |
9 | Reviewed-by: Stefan Berger <stefanb@linux.ibm.com> | 7 | Reviewed-by: Stefan Berger <stefanb@linux.ibm.com> |
10 | 8 | ||
11 | --- | 9 | --- |
12 | v4: add TpmConfiOptions | 10 | v4: add TpmConfiOptions |
13 | v5: exit(0) for help | 11 | v5: exit(0) for help |
14 | v7: adjust line lengths, free options | 12 | v7: adjust line lengths, free options |
15 | v8: minor updates; add tested/reviewed-by | 13 | v8: minor updates; add tested/reviewed-by |
14 | v9: optarg->optstr | ||
16 | --- | 15 | --- |
17 | backends/tpm/tpm_emulator.c | 25 ++++------ | 16 | backends/tpm/tpm_emulator.c | 25 ++++------ |
18 | backends/tpm/tpm_passthrough.c | 23 +++------ | 17 | backends/tpm/tpm_passthrough.c | 23 +++------ |
19 | include/sysemu/tpm.h | 4 +- | 18 | include/sysemu/tpm.h | 5 +- |
20 | include/sysemu/tpm_backend.h | 2 +- | 19 | include/sysemu/tpm_backend.h | 2 +- |
21 | qapi/tpm.json | 19 +++++++ | 20 | qapi/tpm.json | 21 ++++++++ |
22 | softmmu/tpm.c | 91 ++++++++++++++-------------------- | 21 | system/tpm.c | 91 ++++++++++++++-------------------- |
23 | softmmu/vl.c | 19 +------ | 22 | system/vl.c | 19 +------ |
24 | 7 files changed, 78 insertions(+), 105 deletions(-) | 23 | 7 files changed, 81 insertions(+), 105 deletions(-) |
25 | 24 | ||
26 | diff --git a/backends/tpm/tpm_emulator.c b/backends/tpm/tpm_emulator.c | 25 | diff --git a/backends/tpm/tpm_emulator.c b/backends/tpm/tpm_emulator.c |
27 | index XXXXXXX..XXXXXXX 100644 | 26 | index XXXXXXX..XXXXXXX 100644 |
28 | --- a/backends/tpm/tpm_emulator.c | 27 | --- a/backends/tpm/tpm_emulator.c |
29 | +++ b/backends/tpm/tpm_emulator.c | 28 | +++ b/backends/tpm/tpm_emulator.c |
... | ... | ||
154 | +++ b/include/sysemu/tpm.h | 153 | +++ b/include/sysemu/tpm.h |
155 | @@ -XXX,XX +XXX,XX @@ | 154 | @@ -XXX,XX +XXX,XX @@ |
156 | 155 | ||
157 | #ifdef CONFIG_TPM | 156 | #ifdef CONFIG_TPM |
158 | 157 | ||
159 | -int tpm_config_parse(QemuOptsList *opts_list, const char *optarg); | 158 | -int tpm_config_parse(QemuOptsList *opts_list, const char *optstr); |
160 | -int tpm_init(void); | 159 | -int tpm_init(void); |
161 | +void tpm_config_parse(const char *optarg); | 160 | +void tpm_config_parse(const char *optstr); |
162 | +void tpm_init(void); | 161 | +void tpm_init(void); |
162 | + | ||
163 | void tpm_cleanup(void); | 163 | void tpm_cleanup(void); |
164 | 164 | ||
165 | typedef enum TPMVersion { | 165 | typedef enum TPMVersion { |
166 | diff --git a/include/sysemu/tpm_backend.h b/include/sysemu/tpm_backend.h | 166 | diff --git a/include/sysemu/tpm_backend.h b/include/sysemu/tpm_backend.h |
167 | index XXXXXXX..XXXXXXX 100644 | 167 | index XXXXXXX..XXXXXXX 100644 |
... | ... | ||
191 | +# without the wrapper to be usable by visitors. | 191 | +# without the wrapper to be usable by visitors. |
192 | +# | 192 | +# |
193 | +# @type: - 'passthrough' The configuration options for the TPM passthrough type | 193 | +# @type: - 'passthrough' The configuration options for the TPM passthrough type |
194 | +# - 'emulator' The configuration options for TPM emulator backend type | 194 | +# - 'emulator' The configuration options for TPM emulator backend type |
195 | +# | 195 | +# |
196 | +# Since: 8.2 | 196 | +# @id: The Id of the TPM |
197 | +# | ||
198 | +# Since: 9.0 | ||
197 | +## | 199 | +## |
198 | +{ 'union': 'TpmCreateOptions', | 200 | +{ 'union': 'TpmCreateOptions', |
199 | + 'base': { 'type': 'TpmType', | 201 | + 'base': { 'type': 'TpmType', |
200 | + 'id' : 'str' }, | 202 | + 'id' : 'str' }, |
201 | + 'discriminator': 'type', | 203 | + 'discriminator': 'type', |
... | ... | ||
204 | + 'if': 'CONFIG_TPM' } | 206 | + 'if': 'CONFIG_TPM' } |
205 | + | 207 | + |
206 | ## | 208 | ## |
207 | # @TPMInfo: | 209 | # @TPMInfo: |
208 | # | 210 | # |
209 | diff --git a/softmmu/tpm.c b/softmmu/tpm.c | 211 | diff --git a/system/tpm.c b/system/tpm.c |
210 | index XXXXXXX..XXXXXXX 100644 | 212 | index XXXXXXX..XXXXXXX 100644 |
211 | --- a/softmmu/tpm.c | 213 | --- a/system/tpm.c |
212 | +++ b/softmmu/tpm.c | 214 | +++ b/system/tpm.c |
213 | @@ -XXX,XX +XXX,XX @@ | 215 | @@ -XXX,XX +XXX,XX @@ |
214 | #include "qapi/error.h" | 216 | #include "qapi/error.h" |
215 | #include "qapi/qapi-commands-tpm.h" | 217 | #include "qapi/qapi-commands-tpm.h" |
216 | #include "qapi/qmp/qerror.h" | 218 | #include "qapi/qmp/qerror.h" |
217 | +#include "qapi/qobject-input-visitor.h" | 219 | +#include "qapi/qobject-input-visitor.h" |
... | ... | ||
332 | 334 | ||
333 | /* | 335 | /* |
334 | * Parse the TPM configuration options. | 336 | * Parse the TPM configuration options. |
335 | * To display all available TPM backends the user may use '-tpmdev help' | 337 | * To display all available TPM backends the user may use '-tpmdev help' |
336 | */ | 338 | */ |
337 | -int tpm_config_parse(QemuOptsList *opts_list, const char *optarg) | 339 | -int tpm_config_parse(QemuOptsList *opts_list, const char *optstr) |
338 | +void tpm_config_parse(const char *optarg) | 340 | +void tpm_config_parse(const char *optstr) |
339 | { | 341 | { |
340 | - QemuOpts *opts; | 342 | - QemuOpts *opts; |
341 | + Visitor *v; | 343 | + Visitor *v; |
342 | + TpmCreateOptionsQueueEntry *tcqe; | 344 | + TpmCreateOptionsQueueEntry *tcqe; |
343 | 345 | ||
344 | - if (!strcmp(optarg, "help")) { | 346 | - if (!strcmp(optstr, "help")) { |
345 | + if (is_help_option(optarg)) { | 347 | + if (is_help_option(optstr)) { |
346 | tpm_display_backend_drivers(); | 348 | tpm_display_backend_drivers(); |
347 | - return -1; | 349 | - return -1; |
348 | - } | 350 | - } |
349 | - opts = qemu_opts_parse_noisily(opts_list, optarg, true); | 351 | - opts = qemu_opts_parse_noisily(opts_list, optstr, true); |
350 | - if (!opts) { | 352 | - if (!opts) { |
351 | - return -1; | 353 | - return -1; |
352 | + exit(0); | 354 | + exit(0); |
353 | } | 355 | } |
354 | - return 0; | 356 | - return 0; |
355 | + v = qobject_input_visitor_new_str(optarg, "type", &error_fatal); | 357 | + v = qobject_input_visitor_new_str(optstr, "type", &error_fatal); |
356 | + tcqe = g_new(TpmCreateOptionsQueueEntry, 1); | 358 | + tcqe = g_new(TpmCreateOptionsQueueEntry, 1); |
357 | + visit_type_TpmCreateOptions(v, NULL, &tcqe->tco, &error_fatal); | 359 | + visit_type_TpmCreateOptions(v, NULL, &tcqe->tco, &error_fatal); |
358 | + visit_free(v); | 360 | + visit_free(v); |
359 | + QSIMPLEQ_INSERT_TAIL(&tco_queue, tcqe, entry); | 361 | + QSIMPLEQ_INSERT_TAIL(&tco_queue, tcqe, entry); |
360 | } | 362 | } |
361 | 363 | ||
362 | /* | 364 | /* |
363 | diff --git a/softmmu/vl.c b/softmmu/vl.c | 365 | diff --git a/system/vl.c b/system/vl.c |
364 | index XXXXXXX..XXXXXXX 100644 | 366 | index XXXXXXX..XXXXXXX 100644 |
365 | --- a/softmmu/vl.c | 367 | --- a/system/vl.c |
366 | +++ b/softmmu/vl.c | 368 | +++ b/system/vl.c |
367 | @@ -XXX,XX +XXX,XX @@ static QemuOptsList qemu_object_opts = { | 369 | @@ -XXX,XX +XXX,XX @@ static QemuOptsList qemu_object_opts = { |
368 | }, | 370 | }, |
369 | }; | 371 | }; |
370 | 372 | ||
371 | -static QemuOptsList qemu_tpmdev_opts = { | 373 | -static QemuOptsList qemu_tpmdev_opts = { |
... | ... | ||
380 | - | 382 | - |
381 | static QemuOptsList qemu_overcommit_opts = { | 383 | static QemuOptsList qemu_overcommit_opts = { |
382 | .name = "overcommit", | 384 | .name = "overcommit", |
383 | .head = QTAILQ_HEAD_INITIALIZER(qemu_overcommit_opts.head), | 385 | .head = QTAILQ_HEAD_INITIALIZER(qemu_overcommit_opts.head), |
384 | @@ -XXX,XX +XXX,XX @@ static void qemu_create_late_backends(void) | 386 | @@ -XXX,XX +XXX,XX @@ static void qemu_create_late_backends(void) |
385 | 387 | exit(1); | |
386 | object_option_foreach_add(object_create_late); | 388 | } |
387 | 389 | ||
388 | - if (tpm_init() < 0) { | 390 | - if (tpm_init() < 0) { |
389 | - exit(1); | 391 | - exit(1); |
390 | - } | 392 | - } |
391 | + tpm_init(); | 393 | + tpm_init(); |
... | ... | diff view generated by jsdifflib |
1 | From: James Bottomley <James.Bottomley@HansenPartnership.com> | ||
---|---|---|---|
2 | |||
3 | The Microsoft Simulator (mssim) is the reference emulation platform | 1 | The Microsoft Simulator (mssim) is the reference emulation platform |
4 | for the TCG TPM 2.0 specification. | 2 | for the TCG TPM 2.0 specification. |
5 | 3 | ||
6 | https://github.com/Microsoft/ms-tpm-20-ref.git | 4 | https://github.com/Microsoft/ms-tpm-20-ref.git |
7 | 5 | ||
... | ... | ||
34 | 32 | ||
35 | -tpmdev "{'type':'mssim','id':'tpm0','command':{'type':inet,'host':'remote','port':'2321'}}" | 33 | -tpmdev "{'type':'mssim','id':'tpm0','command':{'type':inet,'host':'remote','port':'2321'}}" |
36 | 34 | ||
37 | tpm-tis also works as the backend. | 35 | tpm-tis also works as the backend. |
38 | 36 | ||
39 | Signed-off-by: James Bottomley <jejb@linux.ibm.com> | 37 | Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com> |
40 | Acked-by: Markus Armbruster <armbru@redhat.com> | 38 | Acked-by: Markus Armbruster <armbru@redhat.com> |
41 | 39 | ||
42 | --- | 40 | --- |
43 | 41 | ||
44 | v2: convert to SocketAddr json and use qio_channel_socket_connect_sync() | 42 | v2: convert to SocketAddr json and use qio_channel_socket_connect_sync() |
45 | v3: gate control power off by migration state keep control socket disconnected | 43 | v3: gate control power off by migration state keep control socket disconnected |
46 | to test outside influence and add docs. | 44 | to test outside influence and add docs. |
47 | v7: TPMmssim -> TPMMssim; doc and json fixes | 45 | v7: TPMmssim -> TPMMssim; doc and json fixes |
48 | Make command socket open each time (makes OS debugging easier) | 46 | Make command socket open each time (makes OS debugging easier) |
47 | v11: add startup method to make sure TPM is reset on reboot | ||
49 | --- | 48 | --- |
50 | MAINTAINERS | 6 + | 49 | MAINTAINERS | 6 + |
51 | backends/tpm/Kconfig | 5 + | 50 | backends/tpm/Kconfig | 5 + |
52 | backends/tpm/meson.build | 1 + | 51 | backends/tpm/meson.build | 1 + |
53 | backends/tpm/tpm_mssim.c | 319 +++++++++++++++++++++++++++++++++++++++ | 52 | backends/tpm/tpm_mssim.c | 335 +++++++++++++++++++++++++++++++++++++++ |
54 | backends/tpm/tpm_mssim.h | 44 ++++++ | 53 | backends/tpm/tpm_mssim.h | 44 +++++ |
55 | docs/specs/tpm.rst | 39 +++++ | 54 | docs/specs/tpm.rst | 39 +++++ |
56 | qapi/tpm.json | 32 +++- | 55 | qapi/tpm.json | 31 +++- |
57 | softmmu/tpm-hmp-cmds.c | 9 ++ | 56 | system/tpm-hmp-cmds.c | 9 ++ |
58 | 8 files changed, 451 insertions(+), 4 deletions(-) | 57 | 8 files changed, 466 insertions(+), 4 deletions(-) |
59 | create mode 100644 backends/tpm/tpm_mssim.c | 58 | create mode 100644 backends/tpm/tpm_mssim.c |
60 | create mode 100644 backends/tpm/tpm_mssim.h | 59 | create mode 100644 backends/tpm/tpm_mssim.h |
61 | 60 | ||
62 | diff --git a/MAINTAINERS b/MAINTAINERS | 61 | diff --git a/MAINTAINERS b/MAINTAINERS |
63 | index XXXXXXX..XXXXXXX 100644 | 62 | index XXXXXXX..XXXXXXX 100644 |
... | ... | ||
75 | +MSSIM TPM Backend | 74 | +MSSIM TPM Backend |
76 | +M: James Bottomley <jejb@linux.ibm.com> | 75 | +M: James Bottomley <jejb@linux.ibm.com> |
77 | +S: Maintained | 76 | +S: Maintained |
78 | +F: backends/tpm/tpm_mssim.* | 77 | +F: backends/tpm/tpm_mssim.* |
79 | + | 78 | + |
80 | Checkpatch | 79 | SPDM |
81 | S: Odd Fixes | 80 | M: Alistair Francis <alistair.francis@wdc.com> |
82 | F: scripts/checkpatch.pl | 81 | S: Maintained |
83 | diff --git a/backends/tpm/Kconfig b/backends/tpm/Kconfig | 82 | diff --git a/backends/tpm/Kconfig b/backends/tpm/Kconfig |
84 | index XXXXXXX..XXXXXXX 100644 | 83 | index XXXXXXX..XXXXXXX 100644 |
85 | --- a/backends/tpm/Kconfig | 84 | --- a/backends/tpm/Kconfig |
86 | +++ b/backends/tpm/Kconfig | 85 | +++ b/backends/tpm/Kconfig |
87 | @@ -XXX,XX +XXX,XX @@ config TPM_EMULATOR | 86 | @@ -XXX,XX +XXX,XX @@ config TPM_EMULATOR |
... | ... | ||
305 | + fail_msg: | 304 | + fail_msg: |
306 | + error_prepend(errp, ERROR_PREFIX); | 305 | + error_prepend(errp, ERROR_PREFIX); |
307 | + tpm_util_write_fatal_error_response(cmd->out, cmd->out_len); | 306 | + tpm_util_write_fatal_error_response(cmd->out, cmd->out_len); |
308 | +} | 307 | +} |
309 | + | 308 | + |
309 | +static int tpm_mssim_startup(TPMBackend *tb, size_t buffersize) | ||
310 | +{ | ||
311 | + TPMMssim *t = TPM_MSSIM(tb); | ||
312 | + Error *errp = NULL; | ||
313 | + int ret; | ||
314 | + | ||
315 | + if (runstate_check(RUN_STATE_INMIGRATE)) { | ||
316 | + return 0; | ||
317 | + } | ||
318 | + | ||
319 | + /* | ||
320 | + * reset the TPM using a power cycle sequence, in case someone has | ||
321 | + * previously powered it up | ||
322 | + */ | ||
323 | + ret = tpm_send_ctrl(t, TPM_SIGNAL_POWER_OFF, &errp); | ||
324 | + if (ret != 0) { | ||
325 | + goto fail; | ||
326 | + } | ||
327 | + | ||
328 | + ret = tpm_send_ctrl(t, TPM_SIGNAL_POWER_ON, &errp); | ||
329 | + if (ret != 0) { | ||
330 | + goto fail; | ||
331 | + } | ||
332 | + | ||
333 | + ret = tpm_send_ctrl(t, TPM_SIGNAL_NV_ON, &errp); | ||
334 | + if (ret != 0) { | ||
335 | + goto fail; | ||
336 | + } | ||
337 | + | ||
338 | + return 0; | ||
339 | + | ||
340 | + fail: | ||
341 | + error_report_err(errp); | ||
342 | + return -1; | ||
343 | +} | ||
344 | + | ||
310 | +static TPMBackend *tpm_mssim_create(TpmCreateOptions *opts) | 345 | +static TPMBackend *tpm_mssim_create(TpmCreateOptions *opts) |
311 | +{ | 346 | +{ |
312 | + TPMBackend *be = TPM_BACKEND(object_new(TYPE_TPM_MSSIM)); | 347 | + TPMBackend *be = TPM_BACKEND(object_new(TYPE_TPM_MSSIM)); |
313 | + TPMMssim *t = TPM_MSSIM(be); | 348 | + TPMMssim *t = TPM_MSSIM(be); |
314 | + int ret; | ||
315 | + Error *errp = NULL; | 349 | + Error *errp = NULL; |
316 | + TPMMssimOptions *mo = &opts->u.mssim; | 350 | + TPMMssimOptions *mo = &opts->u.mssim; |
317 | + | 351 | + |
318 | + if (!mo->command) { | 352 | + if (!mo->command) { |
319 | + mo->command = g_new0(SocketAddress, 1); | 353 | + mo->command = g_new0(SocketAddress, 1); |
... | ... | ||
347 | + goto fail; | 381 | + goto fail; |
348 | + } | 382 | + } |
349 | + qio_channel_close(QIO_CHANNEL(t->ctrl_qc), NULL); | 383 | + qio_channel_close(QIO_CHANNEL(t->ctrl_qc), NULL); |
350 | + qio_channel_close(QIO_CHANNEL(t->cmd_qc), NULL); | 384 | + qio_channel_close(QIO_CHANNEL(t->cmd_qc), NULL); |
351 | + | 385 | + |
352 | + if (!runstate_check(RUN_STATE_INMIGRATE)) { | ||
353 | + /* | ||
354 | + * reset the TPM using a power cycle sequence, in case someone | ||
355 | + * has previously powered it up | ||
356 | + */ | ||
357 | + ret = tpm_send_ctrl(t, TPM_SIGNAL_POWER_OFF, &errp); | ||
358 | + if (ret != 0) { | ||
359 | + goto fail; | ||
360 | + } | ||
361 | + | ||
362 | + ret = tpm_send_ctrl(t, TPM_SIGNAL_POWER_ON, &errp); | ||
363 | + if (ret != 0) { | ||
364 | + goto fail; | ||
365 | + } | ||
366 | + | ||
367 | + ret = tpm_send_ctrl(t, TPM_SIGNAL_NV_ON, &errp); | ||
368 | + if (ret != 0) { | ||
369 | + goto fail; | ||
370 | + } | ||
371 | + } | ||
372 | + | 386 | + |
373 | + return be; | 387 | + return be; |
374 | + | 388 | + |
375 | + fail: | 389 | + fail: |
376 | + object_unref(OBJECT(t->ctrl_qc)); | 390 | + object_unref(OBJECT(t->ctrl_qc)); |
... | ... | ||
405 | + cl->type = TPM_TYPE_MSSIM; | 419 | + cl->type = TPM_TYPE_MSSIM; |
406 | + cl->opts = tpm_mssim_cmdline_opts; | 420 | + cl->opts = tpm_mssim_cmdline_opts; |
407 | + cl->desc = "TPM mssim emulator backend driver"; | 421 | + cl->desc = "TPM mssim emulator backend driver"; |
408 | + cl->create = tpm_mssim_create; | 422 | + cl->create = tpm_mssim_create; |
409 | + cl->cancel_cmd = tpm_mssim_cancel_cmd; | 423 | + cl->cancel_cmd = tpm_mssim_cancel_cmd; |
424 | + cl->startup_tpm = tpm_mssim_startup; | ||
410 | + cl->get_tpm_version = tpm_mssim_get_version; | 425 | + cl->get_tpm_version = tpm_mssim_get_version; |
411 | + cl->get_buffer_size = tpm_mssim_get_buffer_size; | 426 | + cl->get_buffer_size = tpm_mssim_get_buffer_size; |
412 | + cl->get_tpm_options = tpm_mssim_get_opts; | 427 | + cl->get_tpm_options = tpm_mssim_get_opts; |
413 | + cl->handle_request = tpm_mssim_handle_request; | 428 | + cl->handle_request = tpm_mssim_handle_request; |
414 | +} | 429 | +} |
... | ... | ||
547 | # | 562 | # |
548 | @@ -XXX,XX +XXX,XX @@ | 563 | @@ -XXX,XX +XXX,XX @@ |
549 | # | 564 | # |
550 | # @emulator: Software Emulator TPM type (since 2.11) | 565 | # @emulator: Software Emulator TPM type (since 2.11) |
551 | # | 566 | # |
552 | +# @mssim: Microsoft TPM Emulator (since 8.2) | 567 | +# @mssim: Microsoft TPM Emulator (since 9.0) |
553 | +# | 568 | +# |
554 | # Since: 1.5 | 569 | # Since: 1.5 |
555 | ## | 570 | ## |
556 | -{ 'enum': 'TpmType', 'data': [ 'passthrough', 'emulator' ], | 571 | -{ 'enum': 'TpmType', 'data': [ 'passthrough', 'emulator' ], |
557 | +{ 'enum': 'TpmType', 'data': [ 'passthrough', 'emulator', 'mssim' ], | 572 | +{ 'enum': 'TpmType', 'data': [ 'passthrough', 'emulator', 'mssim' ], |
558 | 'if': 'CONFIG_TPM' } | 573 | 'if': 'CONFIG_TPM' } |
559 | 574 | ||
560 | ## | 575 | ## |
561 | @@ -XXX,XX +XXX,XX @@ | 576 | @@ -XXX,XX +XXX,XX @@ |
562 | # Example: | 577 | # .. qmp-example:: |
563 | # | 578 | # |
564 | # -> { "execute": "query-tpm-types" } | 579 | # -> { "execute": "query-tpm-types" } |
565 | -# <- { "return": [ "passthrough", "emulator" ] } | 580 | -# <- { "return": [ "passthrough", "emulator" ] } |
566 | +# <- { "return": [ "passthrough", "emulator", "mssim" ] } | 581 | +# <- { "return": [ "passthrough", "emulator", "mssim" ] } |
567 | +# | ||
568 | ## | 582 | ## |
569 | { 'command': 'query-tpm-types', 'returns': ['TpmType'], | 583 | { 'command': 'query-tpm-types', 'returns': ['TpmType'], |
570 | 'if': 'CONFIG_TPM' } | 584 | 'if': 'CONFIG_TPM' } |
571 | @@ -XXX,XX +XXX,XX @@ | 585 | @@ -XXX,XX +XXX,XX @@ |
572 | 'data': { 'data': 'TPMEmulatorOptions' }, | 586 | 'data': { 'data': 'TPMEmulatorOptions' }, |
... | ... | ||
579 | +# | 593 | +# |
580 | +# @command: command socket for the TPM emulator | 594 | +# @command: command socket for the TPM emulator |
581 | +# | 595 | +# |
582 | +# @control: control socket for the TPM emulator | 596 | +# @control: control socket for the TPM emulator |
583 | +# | 597 | +# |
584 | +# Since: 8.2 | 598 | +# Since: 9.0 |
585 | +## | 599 | +## |
586 | +{ 'struct': 'TPMMssimOptions', | 600 | +{ 'struct': 'TPMMssimOptions', |
587 | + 'data': { '*command': 'SocketAddress', | 601 | + 'data': { '*command': 'SocketAddress', |
588 | + '*control': 'SocketAddress' }, | 602 | + '*control': 'SocketAddress' }, |
589 | + 'if': 'CONFIG_TPM' } | 603 | + 'if': 'CONFIG_TPM' } |
... | ... | ||
617 | + 'emulator': 'TPMEmulatorOptions', | 631 | + 'emulator': 'TPMEmulatorOptions', |
618 | + 'mssim': 'TPMMssimOptions' }, | 632 | + 'mssim': 'TPMMssimOptions' }, |
619 | 'if': 'CONFIG_TPM' } | 633 | 'if': 'CONFIG_TPM' } |
620 | 634 | ||
621 | ## | 635 | ## |
622 | diff --git a/softmmu/tpm-hmp-cmds.c b/softmmu/tpm-hmp-cmds.c | 636 | diff --git a/system/tpm-hmp-cmds.c b/system/tpm-hmp-cmds.c |
623 | index XXXXXXX..XXXXXXX 100644 | 637 | index XXXXXXX..XXXXXXX 100644 |
624 | --- a/softmmu/tpm-hmp-cmds.c | 638 | --- a/system/tpm-hmp-cmds.c |
625 | +++ b/softmmu/tpm-hmp-cmds.c | 639 | +++ b/system/tpm-hmp-cmds.c |
626 | @@ -XXX,XX +XXX,XX @@ void hmp_info_tpm(Monitor *mon, const QDict *qdict) | 640 | @@ -XXX,XX +XXX,XX @@ void hmp_info_tpm(Monitor *mon, const QDict *qdict) |
627 | unsigned int c = 0; | 641 | unsigned int c = 0; |
628 | TPMPassthroughOptions *tpo; | 642 | TPMPassthroughOptions *tpo; |
629 | TPMEmulatorOptions *teo; | 643 | TPMEmulatorOptions *teo; |
630 | + TPMMssimOptions *tmo; | 644 | + TPMMssimOptions *tmo; |
... | ... | diff view generated by jsdifflib |