From patchwork Fri Apr 10 06:59:14 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Xu, Quan" X-Patchwork-Id: 460051 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id DAB681402A5 for ; Fri, 10 Apr 2015 22:01:36 +1000 (AEST) Received: from localhost ([::1]:38905 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YgXcq-0004Ti-8S for incoming@patchwork.ozlabs.org; Fri, 10 Apr 2015 08:01:32 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42314) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YgXcD-0003Mc-O8 for qemu-devel@nongnu.org; Fri, 10 Apr 2015 08:00:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YgXcA-0006Ix-9a for qemu-devel@nongnu.org; Fri, 10 Apr 2015 08:00:53 -0400 Received: from mga01.intel.com ([192.55.52.88]:20391) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YgXcA-0006IK-01 for qemu-devel@nongnu.org; Fri, 10 Apr 2015 08:00:50 -0400 Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga101.fm.intel.com with ESMTP; 10 Apr 2015 05:00:47 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.11,556,1422950400"; d="scan'208";a="479314562" Received: from xen-commits.sh.intel.com ([10.239.131.210]) by FMSMGA003.fm.intel.com with ESMTP; 10 Apr 2015 05:00:45 -0700 From: Quan Xu To: stefano.stabellini@eu.citrix.com, stefanb@linux.vnet.ibm.com, eblake@redhat.com Date: Fri, 10 Apr 2015 02:59:14 -0400 Message-Id: <1428649159-30879-2-git-send-email-quan.xu@intel.com> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1428649159-30879-1-git-send-email-quan.xu@intel.com> References: <1428649159-30879-1-git-send-email-quan.xu@intel.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 192.55.52.88 Cc: wei.liu2@citrix.com, Quan Xu , qemu-devel@nongnu.org, xen-devel@lists.xen.org, aliguori@amazon.com, pbonzini@redhat.com, dgdegra@tycho.nsa.gov Subject: [Qemu-devel] [PATCH v5 1/6] Qemu-Xen-vTPM: Support for Xen stubdom vTPM command line options X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Quan Xu --Changes in v5: -qapi schema enhancement. --- configure | 14 ++++++++++++++ hmp.c | 2 ++ qapi-schema.json | 17 +++++++++++++++-- qemu-options.hx | 13 +++++++++++-- tpm.c | 7 ++++++- 5 files changed, 48 insertions(+), 5 deletions(-) diff --git a/configure b/configure index 09c9225..8c9411d 100755 --- a/configure +++ b/configure @@ -3010,6 +3010,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 @@ -4432,6 +4442,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" @@ -4919,6 +4930,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 f31ae27..c10b6f7 100644 --- a/hmp.c +++ b/hmp.c @@ -813,6 +813,8 @@ 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: + break; case TPM_TYPE_OPTIONS_KIND_MAX: break; } diff --git a/qapi-schema.json b/qapi-schema.json index ac9594d..36ca1a2 100644 --- a/qapi-schema.json +++ b/qapi-schema.json @@ -2975,9 +2975,11 @@ # # @passthrough: TPM passthrough type # +# @xenstubdoms: TPM xenstubdoms type (since 2.4) +# # Since: 1.5 ## -{ 'enum': 'TpmType', 'data': [ 'passthrough' ] } +{ 'enum': 'TpmType', 'data': [ 'passthrough', 'xenstubdoms' ] } ## # @query-tpm-types: @@ -3006,6 +3008,15 @@ '*cancel-path' : 'str'} } ## +# @TPMXenstubdomsOptions: +# +# Information about the TPM xenstubdoms type +# +# Since: 2.4 +## +{ 'type': 'TPMXenstubdomsOptions', 'data': { } } + +## # @TpmTypeOptions: # # A union referencing different TPM backend types' configuration options @@ -3015,7 +3026,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 319d971..9254902 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -2539,7 +2539,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 @@ -2549,7 +2550,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 @@ -2599,6 +2601,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 963b7ee..30643fd 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, @@ -254,6 +254,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; @@ -273,6 +274,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; }