From patchwork Thu Nov 2 00:24:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Gavin Shan X-Patchwork-Id: 740334 Delivered-To: patch@linaro.org Received: by 2002:a5d:538f:0:b0:32d:baff:b0ca with SMTP id d15csp575535wrv; Wed, 1 Nov 2023 17:27:25 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFKfj6JX89AxFTyL8WUneFmUmaQjg7brB+1fdUS6oCxS8v8aGR1rsnZpypoADxnsDM1kck7 X-Received: by 2002:a05:6830:448b:b0:6d3:2018:cea8 with SMTP id r11-20020a056830448b00b006d32018cea8mr2279261otv.10.1698884844784; Wed, 01 Nov 2023 17:27:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698884844; cv=none; d=google.com; s=arc-20160816; b=eRdGEdRI7Vw2Ck4w1updDG7imy/SKxuYqw6D2X4YTjSh11hmw3aPt6C91btfbd0O0a fUJzQXtQxgfZjdmZnWOsy7Lbg6PFKT5mwD/hiHV+seknJMXpYObSo12Whc5Z+aQL8RwT xuaPpyN4hwAhcNfkRmJxSNDSbBiG4CBIffjoqZSGmElMpyoK8PyF25pxs42JWIVsQBqv RDmQN218mPtO/QhWx6yuWqcWyAXIOjhypER03BBe5NZ/1UOJ1Fn+4Bn6jRAWM7lCyQPZ z9rZnwozOobmRIyFo9aoLUULd6DsxTTcCO0LHTRZyKmfMuJFWY4w8jYjs0/ZzzWXkeVX 7UnA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:mime-version:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=NMeEfKVcgbyI1G4rAH+CJjbX1SxoTX2qtk/NXIun/eE=; fh=rgQPcVbcOjZgL6aK5WmEt+m6+w+zLiqfGJUo4Bg6NIA=; b=RnTEpuf16kUE9LShdNhylHovIoeoKBveGGIK3pgoKl3Y3zMZoa7iSvjwVXbM7fxeak NJM6rXG9AT2Z+wDDInY5EYg5zvsiLGZQn/wev92deAzfdaihQpyfn3lvtR6dB1WKT6/G 7wOOnqI14UYaEGFNWxQH+d5QkxBL5KlNPLoOfsGk3agaq7e5kwf/PUBu856u7teaxR+t kM2x2jO6edA323/Pqa5Vs/vViZsCAkQcp3wY3dZfjdRcWcboLT7OaeMp4yIduLDluU0q DGoivl/BKG/S7ICSnZMn2GbcdhPia4g/Ob3yLXFmbj9kv+KEyOF8EmFC9W/t36bsPJuo la7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=dGXFk005; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id q7-20020a05622a030700b00417cc2f9946si3529772qtw.153.2023.11.01.17.27.24 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 01 Nov 2023 17:27:24 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=dGXFk005; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qyLXU-0000f7-4J; Wed, 01 Nov 2023 20:26:24 -0400 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 1qyLXF-0000Z9-T2 for qemu-devel@nongnu.org; Wed, 01 Nov 2023 20:26:10 -0400 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 1qyLXE-0008Lv-D1 for qemu-devel@nongnu.org; Wed, 01 Nov 2023 20:26:09 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1698884767; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NMeEfKVcgbyI1G4rAH+CJjbX1SxoTX2qtk/NXIun/eE=; b=dGXFk005fxutX2PBzPLvJOQIHZ9ckTLPvo/kzTO4CpjQJYplGlOp0SYmF9xZy9QjlejcF+ YvWLy7/0gNOpCMk541egYMExLXnhaVNexGvTNHAB5y08ZjcNmQk/DNdOw1ixB6kNLT8iZz NqNiOuXaggIyCaEwXeotTS65xiuu6pc= 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-672-_8_6y1BdMh6TW4UQx5hhBg-1; Wed, 01 Nov 2023 20:26:03 -0400 X-MC-Unique: _8_6y1BdMh6TW4UQx5hhBg-1 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 87A9F28B72EF; Thu, 2 Nov 2023 00:26:01 +0000 (UTC) Received: from gshan.redhat.com (unknown [10.64.136.70]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E68F7C1290F; Thu, 2 Nov 2023 00:25:44 +0000 (UTC) From: Gavin Shan To: qemu-arm@nongnu.org Cc: qemu-devel@nongnu.org, qemu-riscv@nongnu.org, qemu-ppc@nongnu.org, qemu-s390x@nongnu.org, philmd@linaro.org, clg@kaod.org, imammedo@redhat.com, imp@bsdimp.com, kevans@freebsd.org, richard.henderson@linaro.org, pbonzini@redhat.com, peter.maydell@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, liweiwei@iscas.ac.cn, 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, crwulff@gmail.com, marex@denx.de, shorne@gmail.com, npiggin@gmail.com, ysato@users.sourceforge.jp, david@redhat.com, thuth@redhat.com, iii@linux.ibm.com, kbastian@mail.uni-paderborn.de, jcmvbkbc@gmail.com, shan.gavin@gmail.com Subject: [PATCH v4 01/33] target/alpha: Tidy up alpha_cpu_class_by_name() Date: Thu, 2 Nov 2023 10:24:28 +1000 Message-ID: <20231102002500.1750692-2-gshan@redhat.com> In-Reply-To: <20231102002500.1750692-1-gshan@redhat.com> References: <20231102002500.1750692-1-gshan@redhat.com> MIME-Version: 1.0 MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 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: -24 X-Spam_score: -2.5 X-Spam_bar: -- X-Spam_report: (-2.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.393, 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Philippe Mathieu-Daudé For target/alpha, the default CPU model name is "ev67". The default CPU model is used when no matching CPU model is found. The conditions to fall back to the default CPU model can be combined so that the code looks a bit simplified. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Gavin Shan --- target/alpha/cpu.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/target/alpha/cpu.c b/target/alpha/cpu.c index 51b7d8d1bf..c7ae4d6a41 100644 --- a/target/alpha/cpu.c +++ b/target/alpha/cpu.c @@ -142,13 +142,10 @@ static ObjectClass *alpha_cpu_class_by_name(const char *cpu_model) typename = g_strdup_printf(ALPHA_CPU_TYPE_NAME("%s"), cpu_model); oc = object_class_by_name(typename); g_free(typename); - if (oc != NULL && object_class_is_abstract(oc)) { - oc = NULL; - } /* TODO: remove match everything nonsense */ - /* Default to ev67; no reason not to emulate insns by default. */ - if (!oc) { + if (!oc || object_class_is_abstract(oc)) { + /* Default to ev67, no reason not to emulate insns by default */ oc = object_class_by_name(ALPHA_CPU_TYPE_NAME("ev67")); }