From patchwork Tue Dec 30 23:03:12 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Xu, Quan" X-Patchwork-Id: 424717 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 74B181400B7 for ; Wed, 31 Dec 2014 14:07:49 +1100 (AEDT) Received: from localhost ([::1]:38989 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y69dT-0001YX-Id for incoming@patchwork.ozlabs.org; Tue, 30 Dec 2014 22:07:47 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39503) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y69co-0000Qz-9K for qemu-devel@nongnu.org; Tue, 30 Dec 2014 22:07:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Y69cl-0007za-2o for qemu-devel@nongnu.org; Tue, 30 Dec 2014 22:07:06 -0500 Received: from mga09.intel.com ([134.134.136.24]:30537) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y69ck-0007zF-Tk for qemu-devel@nongnu.org; Tue, 30 Dec 2014 22:07:03 -0500 Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga102.jf.intel.com with ESMTP; 30 Dec 2014 19:04:52 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.97,862,1389772800"; d="scan'208";a="435174719" Received: from xen-commits.sh.intel.com ([10.239.131.208]) by FMSMGA003.fm.intel.com with ESMTP; 30 Dec 2014 18:55:01 -0800 From: Quan Xu To: qemu-devel@nongnu.org Date: Tue, 30 Dec 2014 18:03:12 -0500 Message-Id: <1419980592-18778-1-git-send-email-quan.xu@intel.com> X-Mailer: git-send-email 1.8.3.2 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 134.134.136.24 Cc: pbonzini@redhat.com, Quan Xu , aliguori@amazon.com, xen-devel@lists.xen.org Subject: [Qemu-devel] [v3 5/5] Qemu-Xen-vTPM: QEMU machine class is initialized before tpm_init() 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 make sure QEMU machine class is initialized and QEMU has registered Xen stubdom vTPM driver when call tpm_init() Signed-off-by: Quan Xu --- vl.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/vl.c b/vl.c index f6b3546..dd437e1 100644 --- a/vl.c +++ b/vl.c @@ -4114,12 +4114,6 @@ int main(int argc, char **argv, char **envp) exit(1); } -#ifdef CONFIG_TPM - if (tpm_init() < 0) { - exit(1); - } -#endif - /* init the bluetooth world */ if (foreach_device_config(DEV_BT, bt_parse)) exit(1); @@ -4225,6 +4219,16 @@ int main(int argc, char **argv, char **envp) exit(1); } + /* For compatible with Xen stubdom vTPM driver, make + * sure QEMU machine class is initialized and QEMU has + * registered Xen stubdom vTPM driver .. + */ +#ifdef CONFIG_TPM + if (tpm_init() < 0) { + exit(1); + } +#endif + /* init generic devices */ if (qemu_opts_foreach(qemu_find_opts("device"), device_init_func, NULL, 1) != 0) exit(1);