vTPM: add TPM TCPA and SSDT for HVM virtual machine when vTPM is added
PATCH v2 3/5 vTPM: add TPM TCPA and SSDT for HVM virtual machine when vTPM is added
--- 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(-)
tools/firmware/hvmloader/acpi/build.c +3 -2
@@ -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 ;
tools/libxl/libxl_create.c +4 -1
@@ -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 );
tools/libxl/libxl_types.idl +1 -0
@@ -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
tools/libxl/xl_cmdimpl.c +2 -0
@@ -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++; } }
Signature · 1 line
1.8.3.2
You need to CC Jan for hvmloader changes (which I've done for you).
Quoted 53 lines · Quan Xu
Signed-off-by Quan Xu <[email protected]>--- 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(-)tools/firmware/hvmloader/acpi/build.c +3
-2@@ -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 ;tools/libxl/libxl_create.c +4
-1@@ -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 );tools/libxl/libxl_types.idl +0
-0
tools/libxl/libxl_types.idl libxl_domain_build_info = Struct("domain_build_info",[ · line 382
Quoted 4 lines
tools/libxl/libxl_types.idl +1
-0@@ -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.
Quoted 25 lines
tools/libxl/libxl_types.idl +0
-0("device_model_ssid_label", string), # extra parameters pass directly to qemu, NULL terminatedtools/libxl/xl_cmdimpl.c +2
-0@@ -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++; } }Signature · 1 line
1.8.3.2
Quoted 13 lines
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Wei Liu
Sent: Monday, January 05, 2015 8:57 PM
To: Xu, Quan
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Jan Beulich
Subject: Re: [Xen-devel] [PATCH v2 3/5] vTPM: add TPM TCPA and SSDT for HVM virtual machine when vTPM is added
Quoted 1 line
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.
Quoted 62 lines · Quan Xu
Quoted 41 lines
Signed-off-by Quan Xu <[email protected]>--- 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(-)tools/firmware/hvmloader/acpi/build.c +4
-2@@ -313,9 +313,10 @@ static int construct_secondary_tables(unsignedlong *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 ;tools/libxl/libxl_create.c +1
-1@@ -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" ;Quoted 3 lines
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";
tools/libxl/libxl_create.c int libxl__domain_build(libxl__gc *gc,
Quoted 9 lines
localents[i++] = "platform/acpi_s4"; localents[i++] = libxl_defbool_val(info->u.hvm.acpi_s4) ? "1": "0";
tools/libxl/libxl_create.c +3
-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);
tools/libxl/libxl_types.idl libxl_domain_build_info =
Quoted 5 lines
tools/libxl/libxl_types.idl +0
-0@@ -379,6 +379,7 @@ libxl_domain_build_info =Struct("domain_build_info",[
Quoted 8 lines
tools/libxl/libxl_types.idl libxl_domain_build_info = Struct("domain_build_info",[ · line 382
Quoted 4 lines
tools/libxl/libxl_types.idl +1
-0# 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 fromd_config->num_vtpmsin 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
Quoted 35 lines
Wei.
Quoted 8 lines
tools/libxl/libxl_types.idl +0
-1("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 index3c9f146..9c43e88 100644
tools/libxl/xl_cmdimpl.c static void parse_config_data(const char · line 1420
Quoted 7 lines
tools/libxl/xl_cmdimpl.c +1
-0@@ -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) {tools/libxl/xl_cmdimpl.c static void parse_config_data(const char
Quoted 2 lines
libxl_device_vtpm *vtpm;tools/libxl/xl_cmdimpl.c +0
-0@@ -1456,6 +1457,7 @@ static void parse_config_data(const char
*config_source,Quoted 9 lines
tools/libxl/xl_cmdimpl.c +1
-1}free (buf2); d_config->num_vtpms++; + b_info->num_vtpms++; } } --1.8.3.2
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Ian Campbell
Acked-byQuoted 12 lines · Quan
Quoted 12 lines
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Wei Liu
Sent: Monday, January 05, 2015 8:57 PM
To: Xu, Quan
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Jan Beulich
Subject: Re: [Xen-devel] [PATCH v2 3/5] vTPM: add TPM TCPA and SSDT for HVM virtual machine when vTPM is added
Quoted 4 lines
Quoted 1 line
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' withscripts/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 <[email protected]> Jan Beulich <[email protected]> Ian Jackson <[email protected]> Stefano Stabellini <[email protected]> Ian Campbell <[email protected]> Wei Liu <[email protected]> [email protected]
Due to:
commit 5c8dd034f083dbc0cca2ba375a754978f8e25332
Author: Jan Beulich <[email protected]> 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.
missing first line (accidetally missed from actual commit) was:
"MAINTAINERS: move hvmloader to x86"
Ian.