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...@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

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

Reply via email to