From patchwork Tue Oct 18 19:22:51 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 683839 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 3sz4qZ0GkRz9ryr for ; Wed, 19 Oct 2016 06:28:26 +1100 (AEDT) Received: from localhost ([::1]:43478 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bwa3j-0003FV-2c for incoming@patchwork.ozlabs.org; Tue, 18 Oct 2016 15:28:23 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44882) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bwZzN-0007kG-D6 for qemu-devel@nongnu.org; Tue, 18 Oct 2016 15:23:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bwZzM-0006F5-Ca for qemu-devel@nongnu.org; Tue, 18 Oct 2016 15:23:53 -0400 Received: from mx1.redhat.com ([209.132.183.28]:49830) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1bwZzE-00069b-0H; Tue, 18 Oct 2016 15:23:44 -0400 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (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 6FB69C04B311; Tue, 18 Oct 2016 19:23:42 +0000 (UTC) Received: from thinkpad.redhat.com (ovpn-112-25.ams2.redhat.com [10.36.112.25]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u9IJMt9k024602; Tue, 18 Oct 2016 15:23:31 -0400 From: Laurent Vivier To: Eduardo Habkost , Igor Mammedov , Bharata B Rao , David Gibson , Peter Maydell Date: Tue, 18 Oct 2016 21:22:51 +0200 Message-Id: <1476818573-5228-2-git-send-email-lvivier@redhat.com> In-Reply-To: <1476818573-5228-1-git-send-email-lvivier@redhat.com> References: <1476818573-5228-1-git-send-email-lvivier@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Tue, 18 Oct 2016 19:23:43 +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] [PATCH v4 1/3] exec: split cpu_exec_init() 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: Anthony Green , qemu-devel@nongnu.org, Alexander Graf , Max Filippov , Greg Ungerer , "Edgar E . Iglesias" , Guan Xuetao , Jia Liu , Markus Armbruster , Artyom Tarasenko , Laurent Vivier , Andrew Jones , Chen Gang , Greg Kurz , qemu-arm@nongnu.org, Richard Henderson , Matthew Rosato , Bastian Koppelmann , Michael Walle , qemu-ppc@nongnu.org, Paolo Bonzini , Aurelien Jarno Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Put in cpu_exec_initfn() what initializes the CPU, and leave in cpu_exec_init() what adds it to the environment. As cpu_exec_initfn() is called by all XX_cpu_initfn(), call it directly in cpu_common_initfn(). cpu_exec_init() is now a realize function, it will be renamed to cpu_exec_realizefn() and moved to the XX_cpu_realizefn() function in a following patch. Signed-off-by: Laurent Vivier Reviewed-by: David Gibson Reviewed-by: Igor Mammedov Reviewed-by: Eduardo Habkost --- exec.c | 10 ++++++---- include/qom/cpu.h | 1 + qom/cpu.c | 2 ++ 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/exec.c b/exec.c index 374c364..d1e57c4 100644 --- a/exec.c +++ b/exec.c @@ -610,11 +610,8 @@ void cpu_exec_exit(CPUState *cpu) } } -void cpu_exec_init(CPUState *cpu, Error **errp) +void cpu_exec_initfn(CPUState *cpu) { - CPUClass *cc ATTRIBUTE_UNUSED = CPU_GET_CLASS(cpu); - Error *local_err ATTRIBUTE_UNUSED = NULL; - cpu->as = NULL; cpu->num_ases = 0; @@ -635,6 +632,11 @@ void cpu_exec_init(CPUState *cpu, Error **errp) cpu->memory = system_memory; object_ref(OBJECT(cpu->memory)); #endif +} + +void cpu_exec_init(CPUState *cpu, Error **errp) +{ + CPUClass *cc ATTRIBUTE_UNUSED = CPU_GET_CLASS(cpu); cpu_list_add(cpu); diff --git a/include/qom/cpu.h b/include/qom/cpu.h index 6d481a1..d7648a9 100644 --- a/include/qom/cpu.h +++ b/include/qom/cpu.h @@ -946,6 +946,7 @@ AddressSpace *cpu_get_address_space(CPUState *cpu, int asidx); void QEMU_NORETURN cpu_abort(CPUState *cpu, const char *fmt, ...) GCC_FMT_ATTR(2, 3); +void cpu_exec_initfn(CPUState *cpu); void cpu_exec_exit(CPUState *cpu); #ifdef CONFIG_SOFTMMU diff --git a/qom/cpu.c b/qom/cpu.c index c40f774..85f1132 100644 --- a/qom/cpu.c +++ b/qom/cpu.c @@ -362,6 +362,8 @@ static void cpu_common_initfn(Object *obj) QTAILQ_INIT(&cpu->watchpoints); cpu->trace_dstate = bitmap_new(trace_get_vcpu_event_count()); + + cpu_exec_initfn(cpu); } static void cpu_common_finalize(Object *obj)