On 12/12/24 18:05, James Bottomley wrote:
Instead of processing the tpmdev options using the old qemu options,
convert to the new visitor format which also allows the passing of
json on the command line.

Signed-off-by: James Bottomley <james.bottom...@hansenpartnership.com>
Tested-by: Stefan Berger <stef...@linux.ibm.com>
Reviewed-by: Stefan Berger <stef...@linux.ibm.com>

---
v4: add TpmConfiOptions
v5: exit(0) for help
v7: adjust line lengths, free options
v8: minor updates; add tested/reviewed-by
v9: optarg->optstr
---
  backends/tpm/tpm_emulator.c    | 25 ++++------
  backends/tpm/tpm_passthrough.c | 23 +++------
  include/sysemu/tpm.h           |  5 +-
  include/sysemu/tpm_backend.h   |  2 +-
  qapi/tpm.json                  | 21 ++++++++
  system/tpm.c                   | 91 ++++++++++++++--------------------
  system/vl.c                    | 19 +------
  7 files changed, 81 insertions(+), 105 deletions(-)


diff --git a/qapi/tpm.json b/qapi/tpm.json
index a16a72edb9..e6345d424b 100644
--- a/qapi/tpm.json
+++ b/qapi/tpm.json
@@ -142,6 +142,27 @@
              'emulator': 'TPMEmulatorOptionsWrapper' },
    'if': 'CONFIG_TPM' }
+##
+# @TpmCreateOptions:
+#
+# A union referencing different TPM backend types' configuration options
+#   without the wrapper to be usable by visitors.
+#
+# @type: - 'passthrough' The configuration options for the TPM passthrough type
+#        - 'emulator' The configuration options for TPM emulator backend type
+#
+# @id: The Id of the TPM
+#
+# Since: 9.0

(Now 10.0)

+##
+{ 'union': 'TpmCreateOptions',
+  'base': { 'type': 'TpmType',
+            'id' : 'str' },
+  'discriminator': 'type',
+  'data': { 'passthrough' : 'TPMPassthroughOptions',
+            'emulator': 'TPMEmulatorOptions' },
+  'if': 'CONFIG_TPM' }
+
  ##
  # @TPMInfo:
  #

Reply via email to