All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 3/5] vTPM: add TPM TCPA and SSDT for HVM virtual machine when vTPM is added
@ 2014-12-31  4:45 Quan Xu
  2015-01-05 12:56 ` Wei Liu
  0 siblings, 1 reply; 4+ messages in thread
From: Quan Xu @ 2014-12-31  4:45 UTC (permalink / raw)
  To: xen-devel
  Cc: wei.liu2, ian.jackson, ian.campbell, Quan Xu, stefano.stabellini

Signed-off-by: Quan Xu <quan.xu@intel.com>
---
 tools/firmware/hvmloader/acpi/build.c | 5 +++--
 tools/libxl/libxl_create.c            | 5 ++++-
 tools/libxl/libxl_types.idl           | 1 +
 tools/libxl/xl_cmdimpl.c              | 2 ++
 4 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/tools/firmware/hvmloader/acpi/build.c b/tools/firmware/hvmloader/acpi/build.c
index 1431296..f2aa071 100644
--- a/tools/firmware/hvmloader/acpi/build.c
+++ b/tools/firmware/hvmloader/acpi/build.c
@@ -313,9 +313,10 @@ static int construct_secondary_tables(unsigned long *table_ptrs,
 
     /* TPM TCPA and SSDT. */
     tis_hdr = (uint16_t *)0xFED40F00;
-    if ( (tis_hdr[0] == tis_signature[0]) &&
+    if ( ((tis_hdr[0] == tis_signature[0]) &&
          (tis_hdr[1] == tis_signature[1]) &&
-         (tis_hdr[2] == tis_signature[2]) )
+         (tis_hdr[2] == tis_signature[2])) ||
+         !strncmp(xenstore_read("platform/acpi_stubdom_vtpm", "1"), "1", 1) )
     {
         ssdt = mem_alloc(sizeof(ssdt_tpm), 16);
         if (!ssdt) return -1;
diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c
index 0a09925..c6f68fe 100644
--- a/tools/libxl/libxl_create.c
+++ b/tools/libxl/libxl_create.c
@@ -432,7 +432,7 @@ int libxl__domain_build(libxl__gc *gc,
         vments[4] = "start_time";
         vments[5] = libxl__sprintf(gc, "%lu.%02d", start_time.tv_sec,(int)start_time.tv_usec/10000);
 
-        localents = libxl__calloc(gc, 9, sizeof(char *));
+        localents = libxl__calloc(gc, 11, sizeof(char *));
         i = 0;
         localents[i++] = "platform/acpi";
         localents[i++] = libxl_defbool_val(info->u.hvm.acpi) ? "1" : "0";
@@ -440,6 +440,9 @@ int libxl__domain_build(libxl__gc *gc,
         localents[i++] = libxl_defbool_val(info->u.hvm.acpi_s3) ? "1" : "0";
         localents[i++] = "platform/acpi_s4";
         localents[i++] = libxl_defbool_val(info->u.hvm.acpi_s4) ? "1" : "0";
+        localents[i++] = "platform/acpi_stubdom_vtpm";
+        localents[i++] = (info->num_vtpms > 0) ? "1" : "0";
+
         if (info->u.hvm.mmio_hole_memkb) {
             uint64_t max_ram_below_4g =
                 (1ULL << 32) - (info->u.hvm.mmio_hole_memkb << 10);
diff --git a/tools/libxl/libxl_types.idl b/tools/libxl/libxl_types.idl
index ca3f724..b08b974 100644
--- a/tools/libxl/libxl_types.idl
+++ b/tools/libxl/libxl_types.idl
@@ -379,6 +379,7 @@ libxl_domain_build_info = Struct("domain_build_info",[
     # if you set device_model you must set device_model_version too
     ("device_model",     string),
     ("device_model_ssidref", uint32),
+    ("num_vtpms", integer),
     ("device_model_ssid_label", string),
 
     # extra parameters pass directly to qemu, NULL terminated
diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
index 3c9f146..9c43e88 100644
--- a/tools/libxl/xl_cmdimpl.c
+++ b/tools/libxl/xl_cmdimpl.c
@@ -1414,6 +1414,7 @@ static void parse_config_data(const char *config_source,
 
     if (!xlu_cfg_get_list(config, "vtpm", &vtpms, 0, 0)) {
         d_config->num_vtpms = 0;
+        b_info->num_vtpms = 0;
         d_config->vtpms = NULL;
         while ((buf = xlu_cfg_get_listitem (vtpms, d_config->num_vtpms)) != NULL) {
             libxl_device_vtpm *vtpm;
@@ -1456,6 +1457,7 @@ static void parse_config_data(const char *config_source,
             }
             free(buf2);
             d_config->num_vtpms++;
+            b_info->num_vtpms++;
         }
     }
 
-- 
1.8.3.2

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

* Re: [PATCH v2 3/5] vTPM: add TPM TCPA and SSDT for HVM virtual machine when vTPM is added
  2014-12-31  4:45 [PATCH v2 3/5] vTPM: add TPM TCPA and SSDT for HVM virtual machine when vTPM is added Quan Xu
@ 2015-01-05 12:56 ` Wei Liu
  2015-01-06 15:55   ` Xu, Quan
  0 siblings, 1 reply; 4+ messages in thread
From: Wei Liu @ 2015-01-05 12:56 UTC (permalink / raw)
  To: Quan Xu
  Cc: wei.liu2, ian.campbell, stefano.stabellini, ian.jackson,
	xen-devel, Jan Beulich

You need to CC Jan for hvmloader changes (which I've done for you).

On Tue, Dec 30, 2014 at 11:45:14PM -0500, Quan Xu wrote:
> Signed-off-by: Quan Xu <quan.xu@intel.com>
> ---
>  tools/firmware/hvmloader/acpi/build.c | 5 +++--
>  tools/libxl/libxl_create.c            | 5 ++++-
>  tools/libxl/libxl_types.idl           | 1 +
>  tools/libxl/xl_cmdimpl.c              | 2 ++
>  4 files changed, 10 insertions(+), 3 deletions(-)
> 
> diff --git a/tools/firmware/hvmloader/acpi/build.c b/tools/firmware/hvmloader/acpi/build.c
> index 1431296..f2aa071 100644
> --- a/tools/firmware/hvmloader/acpi/build.c
> +++ b/tools/firmware/hvmloader/acpi/build.c
> @@ -313,9 +313,10 @@ static int construct_secondary_tables(unsigned long *table_ptrs,
>  
>      /* TPM TCPA and SSDT. */
>      tis_hdr = (uint16_t *)0xFED40F00;
> -    if ( (tis_hdr[0] == tis_signature[0]) &&
> +    if ( ((tis_hdr[0] == tis_signature[0]) &&
>           (tis_hdr[1] == tis_signature[1]) &&
> -         (tis_hdr[2] == tis_signature[2]) )
> +         (tis_hdr[2] == tis_signature[2])) ||
> +         !strncmp(xenstore_read("platform/acpi_stubdom_vtpm", "1"), "1", 1) )
>      {
>          ssdt = mem_alloc(sizeof(ssdt_tpm), 16);
>          if (!ssdt) return -1;
> diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c
> index 0a09925..c6f68fe 100644
> --- a/tools/libxl/libxl_create.c
> +++ b/tools/libxl/libxl_create.c
> @@ -432,7 +432,7 @@ int libxl__domain_build(libxl__gc *gc,
>          vments[4] = "start_time";
>          vments[5] = libxl__sprintf(gc, "%lu.%02d", start_time.tv_sec,(int)start_time.tv_usec/10000);
>  
> -        localents = libxl__calloc(gc, 9, sizeof(char *));
> +        localents = libxl__calloc(gc, 11, sizeof(char *));
>          i = 0;
>          localents[i++] = "platform/acpi";
>          localents[i++] = libxl_defbool_val(info->u.hvm.acpi) ? "1" : "0";
> @@ -440,6 +440,9 @@ int libxl__domain_build(libxl__gc *gc,
>          localents[i++] = libxl_defbool_val(info->u.hvm.acpi_s3) ? "1" : "0";
>          localents[i++] = "platform/acpi_s4";
>          localents[i++] = libxl_defbool_val(info->u.hvm.acpi_s4) ? "1" : "0";
> +        localents[i++] = "platform/acpi_stubdom_vtpm";
> +        localents[i++] = (info->num_vtpms > 0) ? "1" : "0";
> +
>          if (info->u.hvm.mmio_hole_memkb) {
>              uint64_t max_ram_below_4g =
>                  (1ULL << 32) - (info->u.hvm.mmio_hole_memkb << 10);
> diff --git a/tools/libxl/libxl_types.idl b/tools/libxl/libxl_types.idl
> index ca3f724..b08b974 100644
> --- a/tools/libxl/libxl_types.idl
> +++ b/tools/libxl/libxl_types.idl
> @@ -379,6 +379,7 @@ libxl_domain_build_info = Struct("domain_build_info",[
>      # if you set device_model you must set device_model_version too
>      ("device_model",     string),
>      ("device_model_ssidref", uint32),
> +    ("num_vtpms", integer),

Why is this needed? Can you not use d_config->num_vtpms? I.e. this never
differs from d_config->num_vtpms in your code below...

Wei.

>      ("device_model_ssid_label", string),
>  
>      # extra parameters pass directly to qemu, NULL terminated
> diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
> index 3c9f146..9c43e88 100644
> --- a/tools/libxl/xl_cmdimpl.c
> +++ b/tools/libxl/xl_cmdimpl.c
> @@ -1414,6 +1414,7 @@ static void parse_config_data(const char *config_source,
>  
>      if (!xlu_cfg_get_list(config, "vtpm", &vtpms, 0, 0)) {
>          d_config->num_vtpms = 0;
> +        b_info->num_vtpms = 0;
>          d_config->vtpms = NULL;
>          while ((buf = xlu_cfg_get_listitem (vtpms, d_config->num_vtpms)) != NULL) {
>              libxl_device_vtpm *vtpm;
> @@ -1456,6 +1457,7 @@ static void parse_config_data(const char *config_source,
>              }
>              free(buf2);
>              d_config->num_vtpms++;
> +            b_info->num_vtpms++;
>          }
>      }
>  
> -- 
> 1.8.3.2

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

* Re: [PATCH v2 3/5] vTPM: add TPM TCPA and SSDT for HVM virtual machine when vTPM is added
  2015-01-05 12:56 ` Wei Liu
@ 2015-01-06 15:55   ` Xu, Quan
  2015-01-06 16:08     ` Ian Campbell
  0 siblings, 1 reply; 4+ messages in thread
From: Xu, Quan @ 2015-01-06 15:55 UTC (permalink / raw)
  To: Wei Liu
  Cc: xen-devel@lists.xen.org, ian.jackson@eu.citrix.com,
	ian.campbell@citrix.com, Jan Beulich,
	stefano.stabellini@eu.citrix.com



> -----Original Message-----
> From: xen-devel-bounces@lists.xen.org
> [mailto:xen-devel-bounces@lists.xen.org] On Behalf Of Wei Liu
> Sent: Monday, January 05, 2015 8:57 PM
> To: Xu, Quan
> Cc: wei.liu2@citrix.com; ian.campbell@citrix.com;
> stefano.stabellini@eu.citrix.com; ian.jackson@eu.citrix.com;
> xen-devel@lists.xen.org; Jan Beulich
> Subject: Re: [Xen-devel] [PATCH v2 3/5] vTPM: add TPM TCPA and SSDT for
> HVM virtual machine when vTPM is added
> 
> You need to CC Jan for hvmloader changes (which I've done for you).

Thanks. Will CC Jan in v3, also I will CC Jan for SeaBios Patch..
I did not get 'Jan Beulich' with scripts/get_maintainer.pl, maybe Community should also update it.


> On Tue, Dec 30, 2014 at 11:45:14PM -0500, Quan Xu wrote:
> > Signed-off-by: Quan Xu <quan.xu@intel.com>
> > ---
> >  tools/firmware/hvmloader/acpi/build.c | 5 +++--
> >  tools/libxl/libxl_create.c            | 5 ++++-
> >  tools/libxl/libxl_types.idl           | 1 +
> >  tools/libxl/xl_cmdimpl.c              | 2 ++
> >  4 files changed, 10 insertions(+), 3 deletions(-)
> >
> > diff --git a/tools/firmware/hvmloader/acpi/build.c
> > b/tools/firmware/hvmloader/acpi/build.c
> > index 1431296..f2aa071 100644
> > --- a/tools/firmware/hvmloader/acpi/build.c
> > +++ b/tools/firmware/hvmloader/acpi/build.c
> > @@ -313,9 +313,10 @@ static int construct_secondary_tables(unsigned
> > long *table_ptrs,
> >
> >      /* TPM TCPA and SSDT. */
> >      tis_hdr = (uint16_t *)0xFED40F00;
> > -    if ( (tis_hdr[0] == tis_signature[0]) &&
> > +    if ( ((tis_hdr[0] == tis_signature[0]) &&
> >           (tis_hdr[1] == tis_signature[1]) &&
> > -         (tis_hdr[2] == tis_signature[2]) )
> > +         (tis_hdr[2] == tis_signature[2])) ||
> > +         !strncmp(xenstore_read("platform/acpi_stubdom_vtpm", "1"),
> > + "1", 1) )
> >      {
> >          ssdt = mem_alloc(sizeof(ssdt_tpm), 16);
> >          if (!ssdt) return -1;
> > diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c
> > index 0a09925..c6f68fe 100644
> > --- a/tools/libxl/libxl_create.c
> > +++ b/tools/libxl/libxl_create.c
> > @@ -432,7 +432,7 @@ int libxl__domain_build(libxl__gc *gc,
> >          vments[4] = "start_time";
> >          vments[5] = libxl__sprintf(gc, "%lu.%02d",
> > start_time.tv_sec,(int)start_time.tv_usec/10000);
> >
> > -        localents = libxl__calloc(gc, 9, sizeof(char *));
> > +        localents = libxl__calloc(gc, 11, sizeof(char *));
> >          i = 0;
> >          localents[i++] = "platform/acpi";
> >          localents[i++] = libxl_defbool_val(info->u.hvm.acpi) ? "1" :
> > "0"; @@ -440,6 +440,9 @@ int libxl__domain_build(libxl__gc *gc,
> >          localents[i++] = libxl_defbool_val(info->u.hvm.acpi_s3) ? "1" :
> "0";
> >          localents[i++] = "platform/acpi_s4";
> >          localents[i++] = libxl_defbool_val(info->u.hvm.acpi_s4) ? "1"
> > : "0";
> > +        localents[i++] = "platform/acpi_stubdom_vtpm";
> > +        localents[i++] = (info->num_vtpms > 0) ? "1" : "0";
> > +
> >          if (info->u.hvm.mmio_hole_memkb) {
> >              uint64_t max_ram_below_4g =
> >                  (1ULL << 32) - (info->u.hvm.mmio_hole_memkb <<
> 10);
> > diff --git a/tools/libxl/libxl_types.idl b/tools/libxl/libxl_types.idl
> > index ca3f724..b08b974 100644
> > --- a/tools/libxl/libxl_types.idl
> > +++ b/tools/libxl/libxl_types.idl
> > @@ -379,6 +379,7 @@ libxl_domain_build_info =
> Struct("domain_build_info",[
> >      # if you set device_model you must set device_model_version too
> >      ("device_model",     string),
> >      ("device_model_ssidref", uint32),
> > +    ("num_vtpms", integer),
> 
> Why is this needed? Can you not use d_config->num_vtpms? I.e. this never
> differs from d_config->num_vtpms in your code below...
> 

This parameter is for HVM_PARAM_STUBDOM_VTPM hypercall, which is deleted in v2. I should also delete it.
I will do it in v3. Thanks..


Thanks 
Quan 


> Wei.
> 
> >      ("device_model_ssid_label", string),
> >
> >      # extra parameters pass directly to qemu, NULL terminated diff
> > --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c index
> > 3c9f146..9c43e88 100644
> > --- a/tools/libxl/xl_cmdimpl.c
> > +++ b/tools/libxl/xl_cmdimpl.c
> > @@ -1414,6 +1414,7 @@ static void parse_config_data(const char
> > *config_source,
> >
> >      if (!xlu_cfg_get_list(config, "vtpm", &vtpms, 0, 0)) {
> >          d_config->num_vtpms = 0;
> > +        b_info->num_vtpms = 0;
> >          d_config->vtpms = NULL;
> >          while ((buf = xlu_cfg_get_listitem (vtpms,
> d_config->num_vtpms)) != NULL) {
> >              libxl_device_vtpm *vtpm;
> > @@ -1456,6 +1457,7 @@ static void parse_config_data(const char
> *config_source,
> >              }
> >              free(buf2);
> >              d_config->num_vtpms++;
> > +            b_info->num_vtpms++;
> >          }
> >      }
> >
> > --
> > 1.8.3.2
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel

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

* Re: [PATCH v2 3/5] vTPM: add TPM TCPA and SSDT for HVM virtual machine when vTPM is added
  2015-01-06 15:55   ` Xu, Quan
@ 2015-01-06 16:08     ` Ian Campbell
  0 siblings, 0 replies; 4+ messages in thread
From: Ian Campbell @ 2015-01-06 16:08 UTC (permalink / raw)
  To: Xu, Quan
  Cc: ian.jackson@eu.citrix.com, xen-devel@lists.xen.org, Wei Liu,
	Jan Beulich, stefano.stabellini@eu.citrix.com

On Tue, 2015-01-06 at 15:55 +0000, Xu, Quan wrote:
> 
> > -----Original Message-----
> > From: xen-devel-bounces@lists.xen.org
> > [mailto:xen-devel-bounces@lists.xen.org] On Behalf Of Wei Liu
> > Sent: Monday, January 05, 2015 8:57 PM
> > To: Xu, Quan
> > Cc: wei.liu2@citrix.com; ian.campbell@citrix.com;
> > stefano.stabellini@eu.citrix.com; ian.jackson@eu.citrix.com;
> > xen-devel@lists.xen.org; Jan Beulich
> > Subject: Re: [Xen-devel] [PATCH v2 3/5] vTPM: add TPM TCPA and SSDT for
> > HVM virtual machine when vTPM is added
> > 
> > You need to CC Jan for hvmloader changes (which I've done for you).
> 
> Thanks. Will CC Jan in v3, also I will CC Jan for SeaBios Patch..
> I did not get 'Jan Beulich' with scripts/get_maintainer.pl, maybe Community should also update it.

With latest xen.git:

$ ./scripts/get_maintainer.pl -f tools/firmware/hvmloader/acpi/build.c
Keir Fraser <keir@xen.org>
Jan Beulich <jbeulich@suse.com>
Ian Jackson <ian.jackson@eu.citrix.com>
Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Ian Campbell <ian.campbell@citrix.com>
Wei Liu <wei.liu2@citrix.com>
xen-devel@lists.xen.org

Due to:

commit 5c8dd034f083dbc0cca2ba375a754978f8e25332
Author: Jan Beulich <jbeulich@suse.com>
Date:   Tue Nov 4 13:15:58 2014 +0100

    ... as being more like a hypervisor extension into the guest than a
    part of the tool stack.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Ian Campbell <ian.campbell@citrix.com>

missing first line (accidetally missed from actual commit) was:
"MAINTAINERS: move hvmloader to x86"

Ian.

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

end of thread, other threads:[~2015-01-06 16:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-31  4:45 [PATCH v2 3/5] vTPM: add TPM TCPA and SSDT for HVM virtual machine when vTPM is added Quan Xu
2015-01-05 12:56 ` Wei Liu
2015-01-06 15:55   ` Xu, Quan
2015-01-06 16:08     ` Ian Campbell

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.