All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [v3 1/5] Qemu-Xen-vTPM: Support for Xen stubdom vTPM command line options
@ 2014-12-30 23:02 Quan Xu
  2015-01-05 16:06 ` Eric Blake
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Quan Xu @ 2014-12-30 23:02 UTC (permalink / raw)
  To: qemu-devel; +Cc: lcapitulino, armbru, Quan Xu, xen-devel

Signed-off-by: Quan Xu <quan.xu@intel.com>
---
 configure        | 14 ++++++++++++++
 hmp.c            |  7 +++++++
 qapi-schema.json | 19 ++++++++++++++++---
 qemu-options.hx  | 13 +++++++++++--
 tpm.c            |  7 ++++++-
 5 files changed, 54 insertions(+), 6 deletions(-)

diff --git a/configure b/configure
index a9e4d49..d63b8a1 100755
--- a/configure
+++ b/configure
@@ -2942,6 +2942,16 @@ else
 fi
 
 ##########################################
+# TPM xenstubdoms is only on x86 Linux
+
+if test "$targetos" = Linux && test "$cpu" = i386 -o "$cpu" = x86_64 && \
+   test "$xen" = "yes"; then
+  tpm_xenstubdoms=$tpm
+else
+  tpm_xenstubdoms=no
+fi
+
+##########################################
 # attr probe
 
 if test "$attr" != "no" ; then
@@ -4333,6 +4343,7 @@ echo "gcov              $gcov_tool"
 echo "gcov enabled      $gcov"
 echo "TPM support       $tpm"
 echo "libssh2 support   $libssh2"
+echo "TPM xenstubdoms   $tpm_xenstubdoms"
 echo "TPM passthrough   $tpm_passthrough"
 echo "QOM debugging     $qom_cast_debug"
 echo "vhdx              $vhdx"
@@ -4810,6 +4821,9 @@ if test "$tpm" = "yes"; then
   if test "$tpm_passthrough" = "yes"; then
     echo "CONFIG_TPM_PASSTHROUGH=y" >> $config_host_mak
   fi
+  if test "$tpm_xenstubdoms" = "yes"; then
+    echo "CONFIG_TPM_XENSTUBDOMS=y" >> $config_host_mak
+  fi
 fi
 
 echo "TRACE_BACKENDS=$trace_backends" >> $config_host_mak
diff --git a/hmp.c b/hmp.c
index 63d7686..1df3ec7 100644
--- a/hmp.c
+++ b/hmp.c
@@ -689,6 +689,7 @@ void hmp_info_tpm(Monitor *mon, const QDict *qdict)
     Error *err = NULL;
     unsigned int c = 0;
     TPMPassthroughOptions *tpo;
+    TPMXenstubdomsOptions *txo;
 
     info_list = qmp_query_tpm(&err);
     if (err) {
@@ -718,6 +719,12 @@ void hmp_info_tpm(Monitor *mon, const QDict *qdict)
                            tpo->has_cancel_path ? ",cancel-path=" : "",
                            tpo->has_cancel_path ? tpo->cancel_path : "");
             break;
+        case TPM_TYPE_OPTIONS_KIND_XENSTUBDOMS:
+            txo = ti->options->xenstubdoms;
+            if (!txo) {
+                monitor_printf(mon, "null TPMXenstubdomsOptions error!\n");
+            }
+            break;
         case TPM_TYPE_OPTIONS_KIND_MAX:
             break;
         }
diff --git a/qapi-schema.json b/qapi-schema.json
index 24379ab..9745c2b 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -2854,9 +2854,10 @@
 #
 # @passthrough: TPM passthrough type
 #
-# Since: 1.5
+# @xenstubdoms: TPM xenstubdoms type (since 2.3)## Since 1.5
+#
 ##
-{ 'enum': 'TpmType', 'data': [ 'passthrough' ] }
+{ 'enum': 'TpmType', 'data': [ 'passthrough', 'xenstubdoms' ] }
 
 ##
 # @query-tpm-types:
@@ -2884,6 +2885,16 @@
 { 'type': 'TPMPassthroughOptions', 'data': { '*path' : 'str',
                                              '*cancel-path' : 'str'} }
 
+# @TPMXenstubdomsOptions:
+#
+# Information about the TPM xenstubdoms type
+#
+# Since: 2.3
+##
+{ 'type': 'TPMXenstubdomsOptions', 'data': {  } }
+#
+##
+
 ##
 # @TpmTypeOptions:
 #
@@ -2894,7 +2905,9 @@
 # Since: 1.5
 ##
 { 'union': 'TpmTypeOptions',
-   'data': { 'passthrough' : 'TPMPassthroughOptions' } }
+  'data': { 'passthrough' : 'TPMPassthroughOptions',
+            'xenstubdoms' : 'TPMXenstubdomsOptions' } }
+##
 
 ##
 # @TpmInfo:
diff --git a/qemu-options.hx b/qemu-options.hx
index 1e7d5b8..fd73f57 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -2485,7 +2485,8 @@ DEF("tpmdev", HAS_ARG, QEMU_OPTION_tpmdev, \
     "-tpmdev passthrough,id=id[,path=path][,cancel-path=path]\n"
     "                use path to provide path to a character device; default is /dev/tpm0\n"
     "                use cancel-path to provide path to TPM's cancel sysfs entry; if\n"
-    "                not provided it will be searched for in /sys/class/misc/tpm?/device\n",
+    "                not provided it will be searched for in /sys/class/misc/tpm?/device\n"
+    "-tpmdev xenstubdoms,id=id\n",
     QEMU_ARCH_ALL)
 STEXI
 
@@ -2495,7 +2496,8 @@ The general form of a TPM device option is:
 @item -tpmdev @var{backend} ,id=@var{id} [,@var{options}]
 @findex -tpmdev
 Backend type must be:
-@option{passthrough}.
+@option{passthrough}, or
+@option{xenstubdoms}.
 
 The specific backend type will determine the applicable options.
 The @code{-tpmdev} option creates the TPM backend and requires a
@@ -2545,6 +2547,13 @@ To create a passthrough TPM use the following two options:
 Note that the @code{-tpmdev} id is @code{tpm0} and is referenced by
 @code{tpmdev=tpm0} in the device option.
 
+To create a xenstubdoms TPM use the following two options:
+@example
+-tpmdev xenstubdoms,id=tpm0 -device tpm-tis,tpmdev=tpm0
+@end example
+Note that the @code{-tpmdev} id is @code{tpm0} and is referenced by
+@code{tpmdev=tpm0} in the device option.
+
 @end table
 
 ETEXI
diff --git a/tpm.c b/tpm.c
index c371023..ee9acb8 100644
--- a/tpm.c
+++ b/tpm.c
@@ -25,7 +25,7 @@ static QLIST_HEAD(, TPMBackend) tpm_backends =
 
 
 #define TPM_MAX_MODELS      1
-#define TPM_MAX_DRIVERS     1
+#define TPM_MAX_DRIVERS     2
 
 static TPMDriverOps const *be_drivers[TPM_MAX_DRIVERS] = {
     NULL,
@@ -256,6 +256,7 @@ static TPMInfo *qmp_query_tpm_inst(TPMBackend *drv)
 {
     TPMInfo *res = g_new0(TPMInfo, 1);
     TPMPassthroughOptions *tpo;
+    TPMXenstubdomsOptions *txo;
 
     res->id = g_strdup(drv->id);
     res->model = drv->fe_model;
@@ -275,6 +276,10 @@ static TPMInfo *qmp_query_tpm_inst(TPMBackend *drv)
             tpo->has_cancel_path = true;
         }
         break;
+    case TPM_TYPE_XENSTUBDOMS:
+        res->options->kind = TPM_TYPE_OPTIONS_KIND_XENSTUBDOMS;
+        txo = g_new0(TPMXenstubdomsOptions, 1);
+        res->options->xenstubdoms = txo;
     case TPM_TYPE_MAX:
         break;
     }
-- 
1.8.3.2

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] [v3 1/5] Qemu-Xen-vTPM: Support for Xen stubdom vTPM command line options
  2014-12-30 23:02 [Qemu-devel] [v3 1/5] Qemu-Xen-vTPM: Support for Xen stubdom vTPM command line options Quan Xu
@ 2015-01-05 16:06 ` Eric Blake
  2015-01-06 14:47     ` Xu, Quan
  2015-01-05 16:06 ` Eric Blake
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 7+ messages in thread
From: Eric Blake @ 2015-01-05 16:06 UTC (permalink / raw)
  To: Quan Xu, qemu-devel; +Cc: lcapitulino, armbru, xen-devel

[-- Attachment #1: Type: text/plain, Size: 856 bytes --]

On 12/30/2014 04:02 PM, Quan Xu wrote:
> Signed-off-by: Quan Xu <quan.xu@intel.com>

This message was missing an In-Reply-To header tying it to the 0/5 cover
letter, making it show up as an independent thread.  Please see if you
can fix that for the next submission.

> ---
>  configure        | 14 ++++++++++++++
>  hmp.c            |  7 +++++++
>  qapi-schema.json | 19 ++++++++++++++++---
>  qemu-options.hx  | 13 +++++++++++--
>  tpm.c            |  7 ++++++-
>  5 files changed, 54 insertions(+), 6 deletions(-)
> 

> +++ b/qapi-schema.json
> @@ -2854,9 +2854,10 @@
>  #
>  # @passthrough: TPM passthrough type
>  #
> -# Since: 1.5
> +# @xenstubdoms: TPM xenstubdoms type (since 2.3)## Since 1.5

Missing newlines.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [v3 1/5] Qemu-Xen-vTPM: Support for Xen stubdom vTPM command line options
  2014-12-30 23:02 [Qemu-devel] [v3 1/5] Qemu-Xen-vTPM: Support for Xen stubdom vTPM command line options Quan Xu
  2015-01-05 16:06 ` Eric Blake
@ 2015-01-05 16:06 ` Eric Blake
  2015-01-19 17:31 ` Paolo Bonzini
  2015-01-19 17:31 ` [Qemu-devel] " Paolo Bonzini
  3 siblings, 0 replies; 7+ messages in thread
From: Eric Blake @ 2015-01-05 16:06 UTC (permalink / raw)
  To: Quan Xu, qemu-devel; +Cc: lcapitulino, armbru, xen-devel


[-- Attachment #1.1: Type: text/plain, Size: 856 bytes --]

On 12/30/2014 04:02 PM, Quan Xu wrote:
> Signed-off-by: Quan Xu <quan.xu@intel.com>

This message was missing an In-Reply-To header tying it to the 0/5 cover
letter, making it show up as an independent thread.  Please see if you
can fix that for the next submission.

> ---
>  configure        | 14 ++++++++++++++
>  hmp.c            |  7 +++++++
>  qapi-schema.json | 19 ++++++++++++++++---
>  qemu-options.hx  | 13 +++++++++++--
>  tpm.c            |  7 ++++++-
>  5 files changed, 54 insertions(+), 6 deletions(-)
> 

> +++ b/qapi-schema.json
> @@ -2854,9 +2854,10 @@
>  #
>  # @passthrough: TPM passthrough type
>  #
> -# Since: 1.5
> +# @xenstubdoms: TPM xenstubdoms type (since 2.3)## Since 1.5

Missing newlines.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

[-- Attachment #2: Type: text/plain, Size: 126 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] [Xen-devel] [v3 1/5] Qemu-Xen-vTPM: Support for Xen stubdom vTPM command line options
  2015-01-05 16:06 ` Eric Blake
@ 2015-01-06 14:47     ` Xu, Quan
  0 siblings, 0 replies; 7+ messages in thread
From: Xu, Quan @ 2015-01-06 14:47 UTC (permalink / raw)
  To: Eric Blake, qemu-devel; +Cc: xen-devel, armbru, lcapitulino



> -----Original Message-----
> From: xen-devel-bounces@lists.xen.org
> [mailto:xen-devel-bounces@lists.xen.org] On Behalf Of Eric Blake
> Sent: Tuesday, January 06, 2015 12:07 AM
> To: Xu, Quan; qemu-devel@nongnu.org
> Cc: lcapitulino@redhat.com; armbru@redhat.com; xen-devel@lists.xen.org
> Subject: Re: [Xen-devel] [v3 1/5] Qemu-Xen-vTPM: Support for Xen stubdom
> vTPM command line options
> 
> On 12/30/2014 04:02 PM, Quan Xu wrote:
> > Signed-off-by: Quan Xu <quan.xu@intel.com>
> 
> This message was missing an In-Reply-To header tying it to the 0/5 cover
> letter, making it show up as an independent thread.  Please see if you can fix
> that for the next submission.

Eric,
	Very sorry for this, and I will ask some opensource veteran to help me.


> 
> > ---
> >  configure        | 14 ++++++++++++++
> >  hmp.c            |  7 +++++++
> >  qapi-schema.json | 19 ++++++++++++++++---  qemu-options.hx  | 13
> > +++++++++++--
> >  tpm.c            |  7 ++++++-
> >  5 files changed, 54 insertions(+), 6 deletions(-)
> >
> 
> > +++ b/qapi-schema.json
> > @@ -2854,9 +2854,10 @@
> >  #
> >  # @passthrough: TPM passthrough type
> >  #
> > -# Since: 1.5
> > +# @xenstubdoms: TPM xenstubdoms type (since 2.3)## Since 1.5
> 
> Missing newlines.

Will add newlines in next v4.

Thanks 
Quan 
> 
> --
> Eric Blake   eblake redhat com    +1-919-301-3266
> Libvirt virtualization library http://libvirt.org


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [v3 1/5] Qemu-Xen-vTPM: Support for Xen stubdom vTPM command line options
@ 2015-01-06 14:47     ` Xu, Quan
  0 siblings, 0 replies; 7+ messages in thread
From: Xu, Quan @ 2015-01-06 14:47 UTC (permalink / raw)
  To: Eric Blake, qemu-devel; +Cc: xen-devel, armbru, lcapitulino



> -----Original Message-----
> From: xen-devel-bounces@lists.xen.org
> [mailto:xen-devel-bounces@lists.xen.org] On Behalf Of Eric Blake
> Sent: Tuesday, January 06, 2015 12:07 AM
> To: Xu, Quan; qemu-devel@nongnu.org
> Cc: lcapitulino@redhat.com; armbru@redhat.com; xen-devel@lists.xen.org
> Subject: Re: [Xen-devel] [v3 1/5] Qemu-Xen-vTPM: Support for Xen stubdom
> vTPM command line options
> 
> On 12/30/2014 04:02 PM, Quan Xu wrote:
> > Signed-off-by: Quan Xu <quan.xu@intel.com>
> 
> This message was missing an In-Reply-To header tying it to the 0/5 cover
> letter, making it show up as an independent thread.  Please see if you can fix
> that for the next submission.

Eric,
	Very sorry for this, and I will ask some opensource veteran to help me.


> 
> > ---
> >  configure        | 14 ++++++++++++++
> >  hmp.c            |  7 +++++++
> >  qapi-schema.json | 19 ++++++++++++++++---  qemu-options.hx  | 13
> > +++++++++++--
> >  tpm.c            |  7 ++++++-
> >  5 files changed, 54 insertions(+), 6 deletions(-)
> >
> 
> > +++ b/qapi-schema.json
> > @@ -2854,9 +2854,10 @@
> >  #
> >  # @passthrough: TPM passthrough type
> >  #
> > -# Since: 1.5
> > +# @xenstubdoms: TPM xenstubdoms type (since 2.3)## Since 1.5
> 
> Missing newlines.

Will add newlines in next v4.

Thanks 
Quan 
> 
> --
> Eric Blake   eblake redhat com    +1-919-301-3266
> Libvirt virtualization library http://libvirt.org

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] [v3 1/5] Qemu-Xen-vTPM: Support for Xen stubdom vTPM command line options
  2014-12-30 23:02 [Qemu-devel] [v3 1/5] Qemu-Xen-vTPM: Support for Xen stubdom vTPM command line options Quan Xu
                   ` (2 preceding siblings ...)
  2015-01-19 17:31 ` Paolo Bonzini
@ 2015-01-19 17:31 ` Paolo Bonzini
  3 siblings, 0 replies; 7+ messages in thread
From: Paolo Bonzini @ 2015-01-19 17:31 UTC (permalink / raw)
  To: Quan Xu, qemu-devel; +Cc: xen-devel, armbru, lcapitulino



On 31/12/2014 00:02, Quan Xu wrote:
> Signed-off-by: Quan Xu <quan.xu@intel.com>
> ---
>  configure        | 14 ++++++++++++++
>  hmp.c            |  7 +++++++
>  qapi-schema.json | 19 ++++++++++++++++---
>  qemu-options.hx  | 13 +++++++++++--
>  tpm.c            |  7 ++++++-
>  5 files changed, 54 insertions(+), 6 deletions(-)
> 
> diff --git a/configure b/configure
> index a9e4d49..d63b8a1 100755
> --- a/configure
> +++ b/configure
> @@ -2942,6 +2942,16 @@ else
>  fi
>  
>  ##########################################
> +# TPM xenstubdoms is only on x86 Linux
> +
> +if test "$targetos" = Linux && test "$cpu" = i386 -o "$cpu" = x86_64 && \
> +   test "$xen" = "yes"; then
> +  tpm_xenstubdoms=$tpm
> +else
> +  tpm_xenstubdoms=no
> +fi
> +
> +##########################################
>  # attr probe
>  
>  if test "$attr" != "no" ; then
> @@ -4333,6 +4343,7 @@ echo "gcov              $gcov_tool"
>  echo "gcov enabled      $gcov"
>  echo "TPM support       $tpm"
>  echo "libssh2 support   $libssh2"
> +echo "TPM xenstubdoms   $tpm_xenstubdoms"
>  echo "TPM passthrough   $tpm_passthrough"
>  echo "QOM debugging     $qom_cast_debug"
>  echo "vhdx              $vhdx"
> @@ -4810,6 +4821,9 @@ if test "$tpm" = "yes"; then
>    if test "$tpm_passthrough" = "yes"; then
>      echo "CONFIG_TPM_PASSTHROUGH=y" >> $config_host_mak
>    fi
> +  if test "$tpm_xenstubdoms" = "yes"; then
> +    echo "CONFIG_TPM_XENSTUBDOMS=y" >> $config_host_mak
> +  fi
>  fi
>  
>  echo "TRACE_BACKENDS=$trace_backends" >> $config_host_mak
> diff --git a/hmp.c b/hmp.c
> index 63d7686..1df3ec7 100644
> --- a/hmp.c
> +++ b/hmp.c
> @@ -689,6 +689,7 @@ void hmp_info_tpm(Monitor *mon, const QDict *qdict)
>      Error *err = NULL;
>      unsigned int c = 0;
>      TPMPassthroughOptions *tpo;
> +    TPMXenstubdomsOptions *txo;
>  
>      info_list = qmp_query_tpm(&err);
>      if (err) {
> @@ -718,6 +719,12 @@ void hmp_info_tpm(Monitor *mon, const QDict *qdict)
>                             tpo->has_cancel_path ? ",cancel-path=" : "",
>                             tpo->has_cancel_path ? tpo->cancel_path : "");
>              break;
> +        case TPM_TYPE_OPTIONS_KIND_XENSTUBDOMS:
> +            txo = ti->options->xenstubdoms;
> +            if (!txo) {
> +                monitor_printf(mon, "null TPMXenstubdomsOptions error!\n");
> +            }
> +            break;

No need for the first four lines of code after the "case".

>          case TPM_TYPE_OPTIONS_KIND_MAX:
>              break;
>          }
> diff --git a/qapi-schema.json b/qapi-schema.json
> index 24379ab..9745c2b 100644
> --- a/qapi-schema.json
> +++ b/qapi-schema.json
> @@ -2854,9 +2854,10 @@
>  #
>  # @passthrough: TPM passthrough type
>  #
> -# Since: 1.5
> +# @xenstubdoms: TPM xenstubdoms type (since 2.3)## Since 1.5

Cut-and-paste mistake.

Paolo

> +#
>  ##
> -{ 'enum': 'TpmType', 'data': [ 'passthrough' ] }
> +{ 'enum': 'TpmType', 'data': [ 'passthrough', 'xenstubdoms' ] }
>  
>  ##
>  # @query-tpm-types:
> @@ -2884,6 +2885,16 @@
>  { 'type': 'TPMPassthroughOptions', 'data': { '*path' : 'str',
>                                               '*cancel-path' : 'str'} }
>  
> +# @TPMXenstubdomsOptions:
> +#
> +# Information about the TPM xenstubdoms type
> +#
> +# Since: 2.3
> +##
> +{ 'type': 'TPMXenstubdomsOptions', 'data': {  } }
> +#
> +##
> +
>  ##
>  # @TpmTypeOptions:
>  #
> @@ -2894,7 +2905,9 @@
>  # Since: 1.5
>  ##
>  { 'union': 'TpmTypeOptions',
> -   'data': { 'passthrough' : 'TPMPassthroughOptions' } }
> +  'data': { 'passthrough' : 'TPMPassthroughOptions',
> +            'xenstubdoms' : 'TPMXenstubdomsOptions' } }
> +##
>  
>  ##
>  # @TpmInfo:
> diff --git a/qemu-options.hx b/qemu-options.hx
> index 1e7d5b8..fd73f57 100644
> --- a/qemu-options.hx
> +++ b/qemu-options.hx
> @@ -2485,7 +2485,8 @@ DEF("tpmdev", HAS_ARG, QEMU_OPTION_tpmdev, \
>      "-tpmdev passthrough,id=id[,path=path][,cancel-path=path]\n"
>      "                use path to provide path to a character device; default is /dev/tpm0\n"
>      "                use cancel-path to provide path to TPM's cancel sysfs entry; if\n"
> -    "                not provided it will be searched for in /sys/class/misc/tpm?/device\n",
> +    "                not provided it will be searched for in /sys/class/misc/tpm?/device\n"
> +    "-tpmdev xenstubdoms,id=id\n",
>      QEMU_ARCH_ALL)
>  STEXI
>  
> @@ -2495,7 +2496,8 @@ The general form of a TPM device option is:
>  @item -tpmdev @var{backend} ,id=@var{id} [,@var{options}]
>  @findex -tpmdev
>  Backend type must be:
> -@option{passthrough}.
> +@option{passthrough}, or
> +@option{xenstubdoms}.
>  
>  The specific backend type will determine the applicable options.
>  The @code{-tpmdev} option creates the TPM backend and requires a
> @@ -2545,6 +2547,13 @@ To create a passthrough TPM use the following two options:
>  Note that the @code{-tpmdev} id is @code{tpm0} and is referenced by
>  @code{tpmdev=tpm0} in the device option.
>  
> +To create a xenstubdoms TPM use the following two options:
> +@example
> +-tpmdev xenstubdoms,id=tpm0 -device tpm-tis,tpmdev=tpm0
> +@end example
> +Note that the @code{-tpmdev} id is @code{tpm0} and is referenced by
> +@code{tpmdev=tpm0} in the device option.
> +
>  @end table
>  
>  ETEXI
> diff --git a/tpm.c b/tpm.c
> index c371023..ee9acb8 100644
> --- a/tpm.c
> +++ b/tpm.c
> @@ -25,7 +25,7 @@ static QLIST_HEAD(, TPMBackend) tpm_backends =
>  
>  
>  #define TPM_MAX_MODELS      1
> -#define TPM_MAX_DRIVERS     1
> +#define TPM_MAX_DRIVERS     2
>  
>  static TPMDriverOps const *be_drivers[TPM_MAX_DRIVERS] = {
>      NULL,
> @@ -256,6 +256,7 @@ static TPMInfo *qmp_query_tpm_inst(TPMBackend *drv)
>  {
>      TPMInfo *res = g_new0(TPMInfo, 1);
>      TPMPassthroughOptions *tpo;
> +    TPMXenstubdomsOptions *txo;
>  
>      res->id = g_strdup(drv->id);
>      res->model = drv->fe_model;
> @@ -275,6 +276,10 @@ static TPMInfo *qmp_query_tpm_inst(TPMBackend *drv)
>              tpo->has_cancel_path = true;
>          }
>          break;
> +    case TPM_TYPE_XENSTUBDOMS:
> +        res->options->kind = TPM_TYPE_OPTIONS_KIND_XENSTUBDOMS;
> +        txo = g_new0(TPMXenstubdomsOptions, 1);
> +        res->options->xenstubdoms = txo;
>      case TPM_TYPE_MAX:
>          break;
>      }
> 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [v3 1/5] Qemu-Xen-vTPM: Support for Xen stubdom vTPM command line options
  2014-12-30 23:02 [Qemu-devel] [v3 1/5] Qemu-Xen-vTPM: Support for Xen stubdom vTPM command line options Quan Xu
  2015-01-05 16:06 ` Eric Blake
  2015-01-05 16:06 ` Eric Blake
@ 2015-01-19 17:31 ` Paolo Bonzini
  2015-01-19 17:31 ` [Qemu-devel] " Paolo Bonzini
  3 siblings, 0 replies; 7+ messages in thread
From: Paolo Bonzini @ 2015-01-19 17:31 UTC (permalink / raw)
  To: Quan Xu, qemu-devel; +Cc: xen-devel, armbru, lcapitulino



On 31/12/2014 00:02, Quan Xu wrote:
> Signed-off-by: Quan Xu <quan.xu@intel.com>
> ---
>  configure        | 14 ++++++++++++++
>  hmp.c            |  7 +++++++
>  qapi-schema.json | 19 ++++++++++++++++---
>  qemu-options.hx  | 13 +++++++++++--
>  tpm.c            |  7 ++++++-
>  5 files changed, 54 insertions(+), 6 deletions(-)
> 
> diff --git a/configure b/configure
> index a9e4d49..d63b8a1 100755
> --- a/configure
> +++ b/configure
> @@ -2942,6 +2942,16 @@ else
>  fi
>  
>  ##########################################
> +# TPM xenstubdoms is only on x86 Linux
> +
> +if test "$targetos" = Linux && test "$cpu" = i386 -o "$cpu" = x86_64 && \
> +   test "$xen" = "yes"; then
> +  tpm_xenstubdoms=$tpm
> +else
> +  tpm_xenstubdoms=no
> +fi
> +
> +##########################################
>  # attr probe
>  
>  if test "$attr" != "no" ; then
> @@ -4333,6 +4343,7 @@ echo "gcov              $gcov_tool"
>  echo "gcov enabled      $gcov"
>  echo "TPM support       $tpm"
>  echo "libssh2 support   $libssh2"
> +echo "TPM xenstubdoms   $tpm_xenstubdoms"
>  echo "TPM passthrough   $tpm_passthrough"
>  echo "QOM debugging     $qom_cast_debug"
>  echo "vhdx              $vhdx"
> @@ -4810,6 +4821,9 @@ if test "$tpm" = "yes"; then
>    if test "$tpm_passthrough" = "yes"; then
>      echo "CONFIG_TPM_PASSTHROUGH=y" >> $config_host_mak
>    fi
> +  if test "$tpm_xenstubdoms" = "yes"; then
> +    echo "CONFIG_TPM_XENSTUBDOMS=y" >> $config_host_mak
> +  fi
>  fi
>  
>  echo "TRACE_BACKENDS=$trace_backends" >> $config_host_mak
> diff --git a/hmp.c b/hmp.c
> index 63d7686..1df3ec7 100644
> --- a/hmp.c
> +++ b/hmp.c
> @@ -689,6 +689,7 @@ void hmp_info_tpm(Monitor *mon, const QDict *qdict)
>      Error *err = NULL;
>      unsigned int c = 0;
>      TPMPassthroughOptions *tpo;
> +    TPMXenstubdomsOptions *txo;
>  
>      info_list = qmp_query_tpm(&err);
>      if (err) {
> @@ -718,6 +719,12 @@ void hmp_info_tpm(Monitor *mon, const QDict *qdict)
>                             tpo->has_cancel_path ? ",cancel-path=" : "",
>                             tpo->has_cancel_path ? tpo->cancel_path : "");
>              break;
> +        case TPM_TYPE_OPTIONS_KIND_XENSTUBDOMS:
> +            txo = ti->options->xenstubdoms;
> +            if (!txo) {
> +                monitor_printf(mon, "null TPMXenstubdomsOptions error!\n");
> +            }
> +            break;

No need for the first four lines of code after the "case".

>          case TPM_TYPE_OPTIONS_KIND_MAX:
>              break;
>          }
> diff --git a/qapi-schema.json b/qapi-schema.json
> index 24379ab..9745c2b 100644
> --- a/qapi-schema.json
> +++ b/qapi-schema.json
> @@ -2854,9 +2854,10 @@
>  #
>  # @passthrough: TPM passthrough type
>  #
> -# Since: 1.5
> +# @xenstubdoms: TPM xenstubdoms type (since 2.3)## Since 1.5

Cut-and-paste mistake.

Paolo

> +#
>  ##
> -{ 'enum': 'TpmType', 'data': [ 'passthrough' ] }
> +{ 'enum': 'TpmType', 'data': [ 'passthrough', 'xenstubdoms' ] }
>  
>  ##
>  # @query-tpm-types:
> @@ -2884,6 +2885,16 @@
>  { 'type': 'TPMPassthroughOptions', 'data': { '*path' : 'str',
>                                               '*cancel-path' : 'str'} }
>  
> +# @TPMXenstubdomsOptions:
> +#
> +# Information about the TPM xenstubdoms type
> +#
> +# Since: 2.3
> +##
> +{ 'type': 'TPMXenstubdomsOptions', 'data': {  } }
> +#
> +##
> +
>  ##
>  # @TpmTypeOptions:
>  #
> @@ -2894,7 +2905,9 @@
>  # Since: 1.5
>  ##
>  { 'union': 'TpmTypeOptions',
> -   'data': { 'passthrough' : 'TPMPassthroughOptions' } }
> +  'data': { 'passthrough' : 'TPMPassthroughOptions',
> +            'xenstubdoms' : 'TPMXenstubdomsOptions' } }
> +##
>  
>  ##
>  # @TpmInfo:
> diff --git a/qemu-options.hx b/qemu-options.hx
> index 1e7d5b8..fd73f57 100644
> --- a/qemu-options.hx
> +++ b/qemu-options.hx
> @@ -2485,7 +2485,8 @@ DEF("tpmdev", HAS_ARG, QEMU_OPTION_tpmdev, \
>      "-tpmdev passthrough,id=id[,path=path][,cancel-path=path]\n"
>      "                use path to provide path to a character device; default is /dev/tpm0\n"
>      "                use cancel-path to provide path to TPM's cancel sysfs entry; if\n"
> -    "                not provided it will be searched for in /sys/class/misc/tpm?/device\n",
> +    "                not provided it will be searched for in /sys/class/misc/tpm?/device\n"
> +    "-tpmdev xenstubdoms,id=id\n",
>      QEMU_ARCH_ALL)
>  STEXI
>  
> @@ -2495,7 +2496,8 @@ The general form of a TPM device option is:
>  @item -tpmdev @var{backend} ,id=@var{id} [,@var{options}]
>  @findex -tpmdev
>  Backend type must be:
> -@option{passthrough}.
> +@option{passthrough}, or
> +@option{xenstubdoms}.
>  
>  The specific backend type will determine the applicable options.
>  The @code{-tpmdev} option creates the TPM backend and requires a
> @@ -2545,6 +2547,13 @@ To create a passthrough TPM use the following two options:
>  Note that the @code{-tpmdev} id is @code{tpm0} and is referenced by
>  @code{tpmdev=tpm0} in the device option.
>  
> +To create a xenstubdoms TPM use the following two options:
> +@example
> +-tpmdev xenstubdoms,id=tpm0 -device tpm-tis,tpmdev=tpm0
> +@end example
> +Note that the @code{-tpmdev} id is @code{tpm0} and is referenced by
> +@code{tpmdev=tpm0} in the device option.
> +
>  @end table
>  
>  ETEXI
> diff --git a/tpm.c b/tpm.c
> index c371023..ee9acb8 100644
> --- a/tpm.c
> +++ b/tpm.c
> @@ -25,7 +25,7 @@ static QLIST_HEAD(, TPMBackend) tpm_backends =
>  
>  
>  #define TPM_MAX_MODELS      1
> -#define TPM_MAX_DRIVERS     1
> +#define TPM_MAX_DRIVERS     2
>  
>  static TPMDriverOps const *be_drivers[TPM_MAX_DRIVERS] = {
>      NULL,
> @@ -256,6 +256,7 @@ static TPMInfo *qmp_query_tpm_inst(TPMBackend *drv)
>  {
>      TPMInfo *res = g_new0(TPMInfo, 1);
>      TPMPassthroughOptions *tpo;
> +    TPMXenstubdomsOptions *txo;
>  
>      res->id = g_strdup(drv->id);
>      res->model = drv->fe_model;
> @@ -275,6 +276,10 @@ static TPMInfo *qmp_query_tpm_inst(TPMBackend *drv)
>              tpo->has_cancel_path = true;
>          }
>          break;
> +    case TPM_TYPE_XENSTUBDOMS:
> +        res->options->kind = TPM_TYPE_OPTIONS_KIND_XENSTUBDOMS;
> +        txo = g_new0(TPMXenstubdomsOptions, 1);
> +        res->options->xenstubdoms = txo;
>      case TPM_TYPE_MAX:
>          break;
>      }
> 

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2015-01-19 17:31 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-30 23:02 [Qemu-devel] [v3 1/5] Qemu-Xen-vTPM: Support for Xen stubdom vTPM command line options Quan Xu
2015-01-05 16:06 ` Eric Blake
2015-01-06 14:47   ` [Qemu-devel] [Xen-devel] " Xu, Quan
2015-01-06 14:47     ` Xu, Quan
2015-01-05 16:06 ` Eric Blake
2015-01-19 17:31 ` Paolo Bonzini
2015-01-19 17:31 ` [Qemu-devel] " Paolo Bonzini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.