From: Stefan Berger <stefanb@linux.ibm.com>
To: James Bottomley <jejb@linux.ibm.com>, qemu-devel@nongnu.org
Cc: "Daniel P . Berrangé" <berrange@redhat.com>,
"Markus Armbruster" <armbru@redhat.com>
Subject: Re: [PATCH v7 1/2] tpm: convert tpmdev options processing to new visitor format
Date: Wed, 27 Sep 2023 13:27:45 -0400 [thread overview]
Message-ID: <f05031c2-82b9-4b86-17ab-5e39489715c0@linux.ibm.com> (raw)
In-Reply-To: <20230927164908.12891-2-jejb@linux.ibm.com>
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>
next prev parent reply other threads:[~2023-09-27 17:28 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-27 16:49 [PATCH v7 0/2] tpm: add mssim backend James Bottomley
2023-09-27 16:49 ` [PATCH v7 1/2] tpm: convert tpmdev options processing to new visitor format James Bottomley
2023-09-27 17:27 ` Stefan Berger [this message]
2023-09-27 16:49 ` [PATCH v7 2/2] tpm: add backend for mssim James Bottomley
2023-09-27 17:03 ` Daniel P. Berrangé
2023-09-28 5:29 ` Markus Armbruster
2023-09-28 16:59 ` James Bottomley
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=f05031c2-82b9-4b86-17ab-5e39489715c0@linux.ibm.com \
--to=stefanb@linux.ibm.com \
--cc=armbru@redhat.com \
--cc=berrange@redhat.com \
--cc=jejb@linux.ibm.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).