qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v7 1/2] tpm: convert tpmdev options processing to new visitor


From: Stefan Berger
Subject: Re: [PATCH v7 1/2] tpm: convert tpmdev options processing to new visitor format
Date: Wed, 27 Sep 2023 13:27:45 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0


On 9/27/23 12:49, James Bottomley wrote:
From: James Bottomley <James.Bottomley@HansenPartnership.com>

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 <jejb@linux.ibm.com>

---
v4: add TpmConfiOptions
v5: exit(0) for help
v7: adjust line lengths, free options
---
  backends/tpm/tpm_emulator.c    | 25 ++++------
  backends/tpm/tpm_passthrough.c | 23 +++------
  include/sysemu/tpm.h           |  4 +-
  include/sysemu/tpm_backend.h   |  2 +-
  qapi/tpm.json                  | 19 +++++++
  softmmu/tpm.c                  | 91 ++++++++++++++--------------------
  softmmu/vl.c                   | 19 +------
  7 files changed, 78 insertions(+), 105 deletions(-)

diff --git a/backends/tpm/tpm_emulator.c b/backends/tpm/tpm_emulator.c
index 402a2d6312..833520e49a 100644
--- a/backends/tpm/tpm_emulator.c
+++ b/backends/tpm/tpm_emulator.c
@@ -583,33 +583,29 @@ err_exit:
      return -1;
  }
-static int tpm_emulator_handle_device_opts(TPMEmulator *tpm_emu, QemuOpts *opts)
+static int tpm_emulator_handle_device_opts(TPMEmulator *tpm_emu,
+                                           TpmCreateOptions *opts)
  {
-    const char *value;
      Error *err = NULL;
      Chardev *dev;
- value = qemu_opt_get(opts, "chardev");
-    if (!value) {
-        error_report("tpm-emulator: parameter 'chardev' is missing");
-        goto err;
-    }
+    tpm_emu->options = QAPI_CLONE(TPMEmulatorOptions, &opts->u.emulator);
+    tpm_emu->data_ioc = NULL;
- dev = qemu_chr_find(value);
+    dev = qemu_chr_find(opts->u.emulator.chardev);
      if (!dev) {
-        error_report("tpm-emulator: tpm chardev '%s' not found", value);
+        error_report("tpm-emulator: tpm chardev '%s' not found",
+                opts->u.emulator.chardev);

still, indentation.


--- a/qapi/tpm.json
+++ b/qapi/tpm.json
@@ -138,6 +138,25 @@
              '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
+#
+# Since: 7.2
+##'


Should probably be 8.2.


With the above fixed:

Tested-by: Stefan Berger <stefanb@linux.ibm.com>

Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>





reply via email to

[Prev in Thread] Current Thread [Next in Thread]