From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.4 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,UNWANTED_LANGUAGE_BODY, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 50330C4361B for ; Wed, 9 Dec 2020 11:20:44 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B93ED233A1 for ; Wed, 9 Dec 2020 11:20:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B93ED233A1 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:55626 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kmxWU-0005vI-KK for qemu-devel@archiver.kernel.org; Wed, 09 Dec 2020 06:20:42 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:54142) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kmxVW-0005Uc-OO for qemu-devel@nongnu.org; Wed, 09 Dec 2020 06:19:42 -0500 Received: from mx2.suse.de ([195.135.220.15]:48128) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kmxVU-00051Q-Ub for qemu-devel@nongnu.org; Wed, 09 Dec 2020 06:19:42 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 4B7FEAD09; Wed, 9 Dec 2020 11:19:39 +0000 (UTC) Subject: Re: [RFC v9 10/32] i386: move TCG cpu class initialization out of helper.c To: =?UTF-8?Q?Alex_Benn=c3=a9e?= References: <20201208194839.31305-1-cfontana@suse.de> <20201208194839.31305-11-cfontana@suse.de> <87360ffewo.fsf@linaro.org> From: Claudio Fontana Message-ID: <03de7a9a-632d-185b-6ade-25a8cab97d02@suse.de> Date: Wed, 9 Dec 2020 12:19:37 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.12.0 MIME-Version: 1.0 In-Reply-To: <87360ffewo.fsf@linaro.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=195.135.220.15; envelope-from=cfontana@suse.de; helo=mx2.suse.de X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, NICE_REPLY_A=-0.001, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paul Durrant , Jason Wang , qemu-devel@nongnu.org, Peter Xu , haxm-team@intel.com, Colin Xu , Olaf Hering , Stefano Stabellini , Bruce Rogers , "Emilio G . Cota" , Anthony Perard , =?UTF-8?Q?Philippe_Mathieu-Daud=c3=a9?= , Laurent Vivier , Thomas Huth , Eduardo Habkost , Richard Henderson , Cameron Esfahani , Dario Faggioli , Roman Bolshakov , Sunil Muthuswamy , Marcelo Tosatti , Wenchao Wang , Paolo Bonzini Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" On 12/9/20 11:23 AM, Alex Bennée wrote: > > Claudio Fontana writes: > >> Signed-off-by: Claudio Fontana >> --- >> target/i386/cpu.c | 33 ++++------ >> target/i386/cpu.h | 97 ++--------------------------- >> target/i386/helper-tcg.h | 112 ++++++++++++++++++++++++++++++++++ >> target/i386/helper.c | 23 ------- >> target/i386/meson.build | 1 + >> target/i386/tcg-cpu.c | 71 +++++++++++++++++++++ >> target/i386/tcg-cpu.h | 15 +++++ >> target/i386/tcg/bpt_helper.c | 1 + >> target/i386/tcg/cc_helper.c | 1 + >> target/i386/tcg/excp_helper.c | 1 + >> target/i386/tcg/fpu_helper.c | 33 +++++----- >> target/i386/tcg/int_helper.c | 1 + >> target/i386/tcg/mem_helper.c | 1 + >> target/i386/tcg/misc_helper.c | 1 + >> target/i386/tcg/mpx_helper.c | 1 + >> target/i386/tcg/seg_helper.c | 1 + >> target/i386/tcg/smm_helper.c | 2 + >> target/i386/tcg/svm_helper.c | 1 + >> target/i386/tcg/translate.c | 1 + >> 19 files changed, 244 insertions(+), 153 deletions(-) >> create mode 100644 target/i386/helper-tcg.h >> create mode 100644 target/i386/tcg-cpu.c >> create mode 100644 target/i386/tcg-cpu.h >> >> diff --git a/target/i386/cpu.c b/target/i386/cpu.c >> index b9bd249c8f..3462d0143f 100644 >> --- a/target/i386/cpu.c >> +++ b/target/i386/cpu.c >> @@ -24,6 +24,8 @@ >> #include "qemu/qemu-print.h" >> >> #include "cpu.h" >> +#include "tcg-cpu.h" >> +#include "helper-tcg.h" >> #include "exec/exec-all.h" >> #include "sysemu/kvm.h" >> #include "sysemu/reset.h" >> @@ -1495,7 +1497,8 @@ static inline uint64_t x86_cpu_xsave_components(X86CPU *cpu) >> cpu->env.features[FEAT_XSAVE_COMP_LO]; >> } >> >> -const char *get_register_name_32(unsigned int reg) >> +/* Return name of 32-bit register, from a R_* constant */ >> +static const char *get_register_name_32(unsigned int reg) >> { >> if (reg >= CPU_NB_REGS32) { >> return NULL; >> @@ -7012,13 +7015,6 @@ static void x86_cpu_set_pc(CPUState *cs, vaddr value) >> cpu->env.eip = value; >> } >> >> -static void x86_cpu_synchronize_from_tb(CPUState *cs, TranslationBlock *tb) >> -{ >> - X86CPU *cpu = X86_CPU(cs); >> - >> - cpu->env.eip = tb->pc - tb->cs_base; >> -} >> - >> int x86_cpu_pending_interrupt(CPUState *cs, int interrupt_request) >> { >> X86CPU *cpu = X86_CPU(cs); >> @@ -7252,17 +7248,18 @@ static void x86_cpu_common_class_init(ObjectClass *oc, void *data) >> cc->class_by_name = x86_cpu_class_by_name; >> cc->parse_features = x86_cpu_parse_featurestr; >> cc->has_work = x86_cpu_has_work; >> + >> #ifdef CONFIG_TCG >> - cc->do_interrupt = x86_cpu_do_interrupt; >> - cc->cpu_exec_interrupt = x86_cpu_exec_interrupt; >> -#endif >> + tcg_cpu_common_class_init(cc); > > Are we likely to have clashing names here as other arches get converted? > tcg_x86_cpu_common_class_init or x86_cpu_common_class_init? well, not in the same binary I presume? But I can add an x86 in front. > > >> diff --git a/target/i386/tcg-cpu.c b/target/i386/tcg-cpu.c >> new file mode 100644 >> index 0000000000..628dd29fe7 >> --- /dev/null >> +++ b/target/i386/tcg-cpu.c >> @@ -0,0 +1,71 @@ > >> + >> +void tcg_cpu_common_class_init(CPUClass *cc) >> +{ >> + cc->do_interrupt = x86_cpu_do_interrupt; >> + cc->cpu_exec_interrupt = x86_cpu_exec_interrupt; >> + cc->synchronize_from_tb = x86_cpu_synchronize_from_tb; >> + cc->cpu_exec_enter = x86_cpu_exec_enter; >> + cc->cpu_exec_exit = x86_cpu_exec_exit; >> + cc->tcg_initialize = tcg_x86_init; >> + cc->tlb_fill = x86_cpu_tlb_fill; >> +#ifndef CONFIG_USER_ONLY >> + cc->debug_excp_handler = breakpoint_handler; >> +#endif >> +} > > Oh I see this moves down to target/i386/tcg/ eventually. Maybe we should > just create the new file in place so it's easier to follow the changes > as we convert to a proper abstracted class? > Yes, will do. Thanks, C