From nobody Wed Nov 27 09:54:15 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1700006799; cv=none; d=zohomail.com; s=zohoarc; b=EBR7naVgxh7LHXcbGRKWSYHq3mHE8R/M7/DDBM1rDQ8dAvqB152mpa+CWib2c5mZ61hJDqMrhJyGV8S/pxj1stAq5MDfFc2gm8YEeA8JxU1aHM/4rykdrXbZvEN7qMCcCJFThXvyBa3R4UCKmOUe20KPtUDbGI9oolVsuFqNDTI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1700006799; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=iFAFhxRfroIsfxn23HJWeW06LXJGCEmhPBiImG7e8Nk=; b=jCVO9h3CftYQwKUL5X5QjvRRcwWevEHaBbKGqNMt5SD8pYtEfNcvsWi6UesAH9V1OJYe1xf6eChQe4Q5QUbnOb55YR2yPuxOJGxh/Ti3VfTuEQD/N9OUlPlLAn+AEB/mtYZdiCY2NnexxjzFt2wf4K+1Lc8BHxxyDGbhACjEEPA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1700006799291545.8958332176072; Tue, 14 Nov 2023 16:06:39 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r33M4-0007OR-6z; Tue, 14 Nov 2023 19:02:04 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1r33Lu-0007IQ-4X for qemu-devel@nongnu.org; Tue, 14 Nov 2023 19:01:54 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1r33Ls-0008FQ-4Z for qemu-devel@nongnu.org; Tue, 14 Nov 2023 19:01:53 -0500 Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-352-MIfYUSP1P6yl4iPFHj5sGw-1; Tue, 14 Nov 2023 19:01:46 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 294191C03141; Wed, 15 Nov 2023 00:01:43 +0000 (UTC) Received: from gshan.redhat.com (unknown [10.64.136.44]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0E865C15885; Wed, 15 Nov 2023 00:01:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1700006510; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=iFAFhxRfroIsfxn23HJWeW06LXJGCEmhPBiImG7e8Nk=; b=G58gz3cV/pq4mSYnxDh0Vbo1mC649PBLYi8nPRHYrO+mMuliV5bRlMQgN4S1C6IqlsQAdt rG6EwkNBRgPgak3/KMVFPfMMQgRFYKh9ePqy5fOE1vW41NzrKqzIe89Q10Ih6DWzST+rWu r5WWR++/uliHaHBfr24Kka2CAES6IQs= X-MC-Unique: MIfYUSP1P6yl4iPFHj5sGw-1 From: Gavin Shan To: qemu-arm@nongnu.org Cc: qemu-devel@nongnu.org, qemu-riscv@nongnu.org, qemu-ppc@nongnu.org, imp@bsdimp.com, kevans@freebsd.org, richard.henderson@linaro.org, pbonzini@redhat.com, peter.maydell@linaro.org, imammedo@redhat.com, philmd@linaro.org, b.galvani@gmail.com, strahinja.p.jankovic@gmail.com, sundeep.lkml@gmail.com, kfting@nuvoton.com, wuhaotsh@google.com, nieklinnenbank@gmail.com, rad@semihalf.com, quic_llindhol@quicinc.com, marcin.juszkiewicz@linaro.org, eduardo@habkost.net, marcel.apfelbaum@gmail.com, wangyanan55@huawei.com, laurent@vivier.eu, vijai@behindbytes.com, palmer@dabbelt.com, alistair.francis@wdc.com, bin.meng@windriver.com, liwei1518@gmail.com, dbarboza@ventanamicro.com, zhiwei_liu@linux.alibaba.com, mrolnik@gmail.com, edgar.iglesias@gmail.com, bcain@quicinc.com, gaosong@loongson.cn, aurelien@aurel32.net, jiaxun.yang@flygoat.com, aleksandar.rikalo@syrmia.com, chenhuacai@kernel.org, shorne@gmail.com, npiggin@gmail.com, clg@kaod.org, ysato@users.sourceforge.jp, kbastian@mail.uni-paderborn.de, jcmvbkbc@gmail.com, shan.gavin@gmail.com Subject: [PATCH v5 21/31] target/xtensa: Use generic cpu_list() Date: Wed, 15 Nov 2023 09:56:18 +1000 Message-ID: <20231114235628.534334-22-gshan@redhat.com> In-Reply-To: <20231114235628.534334-1-gshan@redhat.com> References: <20231114235628.534334-1-gshan@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=gshan@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1700006799906100001 Content-Type: text/plain; charset="utf-8" Before it's applied: [gshan@gshan q]$ ./build/qemu-system-xtensa -cpu ? Available CPUs: test_mmuhifi_c3 sample_controller lx106 dsp3400 de233_fpu de212 dc233c dc232b After it's applied: [gshan@gshan q]$ ./build/qemu-system-xtensa -cpu ? Available CPUs: dc232b dc233c de212 de233_fpu dsp3400 lx106 sample_controller test_mmuhifi_c3 Signed-off-by: Gavin Shan --- target/xtensa/cpu.h | 10 +--------- target/xtensa/helper.c | 19 +++---------------- target/xtensa/overlay_tool.h | 7 ++----- 3 files changed, 6 insertions(+), 30 deletions(-) diff --git a/target/xtensa/cpu.h b/target/xtensa/cpu.h index dd81729306..ffeb1ca43f 100644 --- a/target/xtensa/cpu.h +++ b/target/xtensa/cpu.h @@ -491,11 +491,6 @@ typedef struct XtensaConfig { bool use_first_nan; } XtensaConfig; =20 -typedef struct XtensaConfigList { - const XtensaConfig *config; - struct XtensaConfigList *next; -} XtensaConfigList; - #if HOST_BIG_ENDIAN enum { FP_F32_HIGH, @@ -600,8 +595,6 @@ G_NORETURN void xtensa_cpu_do_unaligned_access(CPUState= *cpu, vaddr addr, MMUAccessType access_type, = int mmu_idx, uintptr_t retaddr); =20 -#define cpu_list xtensa_cpu_list - #define CPU_RESOLVING_TYPE TYPE_XTENSA_CPU =20 #if TARGET_BIG_ENDIAN @@ -620,13 +613,12 @@ void xtensa_collect_sr_names(const XtensaConfig *conf= ig); void xtensa_translate_init(void); void **xtensa_get_regfile_by_name(const char *name, int entries, int bits); void xtensa_breakpoint_handler(CPUState *cs); -void xtensa_register_core(XtensaConfigList *node); +void xtensa_register_core(XtensaConfig *config); void xtensa_sim_open_console(Chardev *chr); void check_interrupts(CPUXtensaState *s); void xtensa_irq_init(CPUXtensaState *env); qemu_irq *xtensa_get_extints(CPUXtensaState *env); qemu_irq xtensa_get_runstall(CPUXtensaState *env); -void xtensa_cpu_list(void); void xtensa_sync_window_from_phys(CPUXtensaState *env); void xtensa_sync_phys_from_window(CPUXtensaState *env); void xtensa_rotate_window(CPUXtensaState *env, uint32_t delta); diff --git a/target/xtensa/helper.c b/target/xtensa/helper.c index dbeb97a953..3654739b09 100644 --- a/target/xtensa/helper.c +++ b/target/xtensa/helper.c @@ -35,8 +35,6 @@ #include "qemu/qemu-print.h" #include "qemu/host-utils.h" =20 -static struct XtensaConfigList *xtensa_cores; - static void add_translator_to_hash(GHashTable *translator, const char *name, const XtensaOpcodeOps *opcode) @@ -187,17 +185,15 @@ static void xtensa_core_class_init(ObjectClass *oc, v= oid *data) cc->gdb_num_core_regs =3D config->gdb_regmap.num_regs; } =20 -void xtensa_register_core(XtensaConfigList *node) +void xtensa_register_core(XtensaConfig *config) { TypeInfo type =3D { .parent =3D TYPE_XTENSA_CPU, .class_init =3D xtensa_core_class_init, - .class_data =3D (void *)node->config, + .class_data =3D (void *)config, }; =20 - node->next =3D xtensa_cores; - xtensa_cores =3D node; - type.name =3D g_strdup_printf(XTENSA_CPU_TYPE_NAME("%s"), node->config= ->name); + type.name =3D g_strdup_printf(XTENSA_CPU_TYPE_NAME("%s"), config->name= ); type_register(&type); g_free((gpointer)type.name); } @@ -234,15 +230,6 @@ void xtensa_breakpoint_handler(CPUState *cs) } } =20 -void xtensa_cpu_list(void) -{ - XtensaConfigList *core =3D xtensa_cores; - qemu_printf("Available CPUs:\n"); - for (; core; core =3D core->next) { - qemu_printf(" %s\n", core->config->name); - } -} - #ifndef CONFIG_USER_ONLY void xtensa_cpu_do_unaligned_access(CPUState *cs, vaddr addr, MMUAccessType access_type, diff --git a/target/xtensa/overlay_tool.h b/target/xtensa/overlay_tool.h index 701c00eed2..7373ba7592 100644 --- a/target/xtensa/overlay_tool.h +++ b/target/xtensa/overlay_tool.h @@ -450,13 +450,10 @@ #endif =20 #if TARGET_BIG_ENDIAN =3D=3D (XCHAL_HAVE_BE !=3D 0) -#define REGISTER_CORE(core) \ +#define REGISTER_CORE(config) \ static void __attribute__((constructor)) register_core(void) \ { \ - static XtensaConfigList node =3D { \ - .config =3D &core, \ - }; \ - xtensa_register_core(&node); \ + xtensa_register_core(&config); \ } #else #define REGISTER_CORE(core) --=20 2.41.0