qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Daniel P. Berrangé" <berrange@redhat.com>
To: James Bottomley <jejb@linux.ibm.com>
Cc: qemu-devel@nongnu.org, Stefan Berger <stefanb@linux.ibm.com>,
	Markus Armbruster <armbru@redhat.com>
Subject: Re: [PATCH v3 1/2] tpm: convert tpmdev options processing to new visitor format
Date: Wed, 21 Dec 2022 16:32:22 +0000	[thread overview]
Message-ID: <Y6M1FkKxnRv1Ev3I@redhat.com> (raw)
In-Reply-To: <20221219131344.18909-2-jejb@linux.ibm.com>

On Mon, Dec 19, 2022 at 08:13:43AM -0500, 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>
> ---
>  backends/tpm/tpm_emulator.c    | 35 ++++++-------
>  backends/tpm/tpm_passthrough.c | 37 +++++---------
>  include/sysemu/tpm.h           |  4 +-
>  include/sysemu/tpm_backend.h   |  2 +-
>  monitor/hmp-cmds.c             |  4 +-
>  qapi/tpm.json                  | 26 ++--------
>  softmmu/tpm.c                  | 90 ++++++++++++++--------------------
>  softmmu/vl.c                   | 19 +------
>  8 files changed, 73 insertions(+), 144 deletions(-)
> 

> diff --git a/qapi/tpm.json b/qapi/tpm.json
> index 4e2ea9756a..d8cbd5ea0e 100644
> --- a/qapi/tpm.json
> +++ b/qapi/tpm.json
> @@ -99,39 +99,23 @@
>  { 'struct': 'TPMEmulatorOptions', 'data': { 'chardev' : 'str' },
>    'if': 'CONFIG_TPM' }
>  
> -##
> -# @TPMPassthroughOptionsWrapper:
> -#
> -# Since: 1.5
> -##
> -{ 'struct': 'TPMPassthroughOptionsWrapper',
> -  'data': { 'data': 'TPMPassthroughOptions' },
> -  'if': 'CONFIG_TPM' }
> -
> -##
> -# @TPMEmulatorOptionsWrapper:
> -#
> -# Since: 2.11
> -##
> -{ 'struct': 'TPMEmulatorOptionsWrapper',
> -  'data': { 'data': 'TPMEmulatorOptions' },
> -  'if': 'CONFIG_TPM' }
> -
>  ##
>  # @TpmTypeOptions:
>  #
>  # A union referencing different TPM backend types' configuration options
>  #
> +# @id: identifier of the backend
>  # @type: - 'passthrough' The configuration options for the TPM passthrough type
>  #        - 'emulator' The configuration options for TPM emulator backend type
>  #
>  # Since: 1.5
>  ##
>  { 'union': 'TpmTypeOptions',
> -  'base': { 'type': 'TpmType' },
> +  'base': { 'type': 'TpmType',
> +            'id': 'str' },
>    'discriminator': 'type',
> -  'data': { 'passthrough' : 'TPMPassthroughOptionsWrapper',
> -            'emulator': 'TPMEmulatorOptionsWrapper' },
> +  'data': { 'passthrough' : 'TPMPassthroughOptions',
> +            'emulator': 'TPMEmulatorOptions' },
>    'if': 'CONFIG_TPM' }

This isn't a valid change todo, as it affects the public facing
data structure for the  query-tpm command.

I understand why you're doing it though, to get rid fo the
extra nesting, which is a hangover from earlier QAPI days
where we couldn't cope with flat unions.

Instead of changing TpmTypeOptions, you'll need to introduce
a new TpmTypeCreateOptions that eliminates the wrapping, and
use that in the CLI creation path, leaving the query-tpm
command unchanged.


With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|



  reply	other threads:[~2022-12-21 16:33 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-19 13:13 [PATCH v3 0/2] tpm: add mssim backend James Bottomley
2022-12-19 13:13 ` [PATCH v3 1/2] tpm: convert tpmdev options processing to new visitor format James Bottomley
2022-12-21 16:32   ` Daniel P. Berrangé [this message]
2022-12-21 20:31     ` James Bottomley
2022-12-19 13:13 ` [PATCH v3 2/2] tpm: add backend for mssim James Bottomley
2022-12-19 13:51 ` [PATCH v3 0/2] tpm: add mssim backend Stefan Berger
2022-12-19 13:55   ` James Bottomley
2022-12-19 14:15     ` Stefan Berger
2022-12-19 14:17       ` James Bottomley
2022-12-19 15:16 ` Stefan Berger
2022-12-19 15:21   ` 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=Y6M1FkKxnRv1Ev3I@redhat.com \
    --to=berrange@redhat.com \
    --cc=armbru@redhat.com \
    --cc=jejb@linux.ibm.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanb@linux.ibm.com \
    /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).