All of lore.kernel.org
 help / color / mirror / Atom feed
From: Quan Xu <quan.xu@intel.com>
To: xen-devel@lists.xen.org
Cc: keir@xen.org, ian.campbell@citrix.com, tim@xen.org,
	ian.jackson@eu.citrix.com, jbeulich@suse.com,
	Quan Xu <quan.xu@intel.com>
Subject: [PATCH 4/6] vTPM: add TPM TCPA and SSDT for HVM virtual machine when vTPM is added
Date: Thu, 30 Oct 2014 03:38:49 -0400	[thread overview]
Message-ID: <1414654731-32641-5-git-send-email-quan.xu@intel.com> (raw)
In-Reply-To: <1414654731-32641-1-git-send-email-quan.xu@intel.com>

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

  parent reply	other threads:[~2014-10-30  7:38 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-30  7:38 [PATCH 0/6] vTPM: Xen stubdom vTPM for HVM virtual machine Quan Xu
2014-10-30  7:38 ` [PATCH 1/6] vTPM: event channel bind interdomain with para/hvm " Quan Xu
     [not found]   ` <945CA011AD5F084CBEA3E851C0AB28890E81D119@SHSMSX101.ccr.corp.intel.com>
     [not found]     ` <54528379.5080107@tycho.nsa.gov>
2014-10-31  2:06       ` FW: FW: " Xu, Quan
2014-11-06 16:55       ` Xu, Quan
2014-11-07  7:15         ` Xu, Quan
2014-10-30  7:38 ` [PATCH 2/6] vTPM: add HVM_PARAM_STUBDOM_VTPM parameter for HVM " Quan Xu
2014-10-30 11:49   ` Andrew Cooper
2014-10-30 12:05     ` Xu, Quan
2014-10-30 12:17       ` Andrew Cooper
2014-10-30 13:34         ` Stefano Stabellini
2014-10-30 14:22           ` Xu, Quan
2014-10-31 17:50             ` Stefano Stabellini
2014-11-02 11:03               ` Xu, Quan
2014-10-30 14:13         ` Xu, Quan
2014-10-31  7:01     ` Xu, Quan
2014-10-30  7:38 ` [PATCH 3/6] vTPM: limit libxl__add_vtpms() function to para " Quan Xu
2014-10-30  7:38 ` Quan Xu [this message]
2014-10-30  7:38 ` [PATCH 5/6] vTPM: add vTPM device for HVM " Quan Xu
2014-10-30  7:38 ` [PATCH 6/6] vTPM: add QEMU_STUBDOM_VTPM compile option Quan Xu
2014-11-03 11:30 ` [PATCH 0/6] vTPM: Xen stubdom vTPM for HVM virtual machine Stefano Stabellini
2014-11-05  9:18   ` Xu, Quan
2014-11-05 11:01     ` Stefano Stabellini
2014-11-05 13:20       ` Xu, Quan

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=1414654731-32641-5-git-send-email-quan.xu@intel.com \
    --to=quan.xu@intel.com \
    --cc=ian.campbell@citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=jbeulich@suse.com \
    --cc=keir@xen.org \
    --cc=tim@xen.org \
    --cc=xen-devel@lists.xen.org \
    /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 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.