From patchwork Mon May 23 19:24:21 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 9132313 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 33BBF6075F for ; Mon, 23 May 2016 19:29:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2AE9128219 for ; Mon, 23 May 2016 19:29:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1FC2F2824E; Mon, 23 May 2016 19:29:57 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B701128219 for ; Mon, 23 May 2016 19:29:56 +0000 (UTC) Received: from localhost ([::1]:50007 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b4vY3-0006rY-S4 for patchwork-qemu-devel@patchwork.kernel.org; Mon, 23 May 2016 15:29:55 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49370) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b4vTg-0003FT-Q1 for qemu-devel@nongnu.org; Mon, 23 May 2016 15:25:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b4vTZ-0004za-G3 for qemu-devel@nongnu.org; Mon, 23 May 2016 15:25:23 -0400 Received: from mx1.redhat.com ([209.132.183.28]:47298) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b4vTZ-0004zU-A5 for qemu-devel@nongnu.org; Mon, 23 May 2016 15:25:17 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E2F23C05005F; Mon, 23 May 2016 19:25:16 +0000 (UTC) Received: from localhost (vpn1-7-9.gru2.redhat.com [10.97.7.9]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u4NJPF3d001699; Mon, 23 May 2016 15:25:16 -0400 From: Eduardo Habkost To: Peter Maydell Date: Mon, 23 May 2016 16:24:21 -0300 Message-Id: <1464031467-20736-10-git-send-email-ehabkost@redhat.com> In-Reply-To: <1464031467-20736-1-git-send-email-ehabkost@redhat.com> References: <1464031467-20736-1-git-send-email-ehabkost@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Mon, 23 May 2016 19:25:16 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 09/15] target-i386: Move TCG initialization to realize time X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Richard Henderson , =?UTF-8?q?Andreas=20F=C3=A4rber?= , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP QOM instance_init functions are not supposed to have any side-effects, as new objects may be created at any moment for querying property information (see qmp_device_list_properties()). Move TCG initialization to realize time so it won't be called when just doing object_new() on a X86CPU subclass. Reviewed-by: Igor Mammedov Signed-off-by: Eduardo Habkost --- target-i386/cpu.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/target-i386/cpu.c b/target-i386/cpu.c index 2dc3d3c..9ac2e59 100644 --- a/target-i386/cpu.c +++ b/target-i386/cpu.c @@ -2902,6 +2902,10 @@ static void x86_cpu_realizefn(DeviceState *dev, Error **errp) } + if (tcg_enabled()) { + tcg_x86_init(); + } + #ifndef CONFIG_USER_ONLY qemu_register_reset(x86_cpu_machine_reset_cb, cpu); @@ -3136,11 +3140,6 @@ static void x86_cpu_initfn(Object *obj) } x86_cpu_load_def(cpu, xcc->cpu_def, &error_abort); - - /* init various static tables used in TCG mode */ - if (tcg_enabled()) { - tcg_x86_init(); - } } static int64_t x86_cpu_get_arch_id(CPUState *cs)