From patchwork Fri Aug 18 17:20:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 714678 Delivered-To: patch@linaro.org Received: by 2002:a5d:484e:0:b0:317:ecd7:513f with SMTP id n14csp632342wrs; Fri, 18 Aug 2023 10:21:09 -0700 (PDT) X-Google-Smtp-Source: AGHT+IECKBJ7uP7xVj9wTq44xb2+bTH5tX6Xq2I1unx2IRpY6PybwQblIVG5HBJIqacCpvfkKxC1 X-Received: by 2002:a0c:f211:0:b0:63c:f630:8bba with SMTP id h17-20020a0cf211000000b0063cf6308bbamr3185894qvk.53.1692379269434; Fri, 18 Aug 2023 10:21:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692379269; cv=none; d=google.com; s=arc-20160816; b=Gu8q+19M1JJiAzVV4SCgLmKZ6bS/qp9R1n/9znTZnLgTFe1LTdkLokoj5tfSxRimtD 5G+k1NHjR9a10beTMEzX9CQACOEey87RRal0pcnCHXtOfztZ56pf0AVn5JEDMpoT0+wM 4soemyWnZ3b79WRwlB7nt428ndouD4mr1iMs3CeARlIUtqHmliIGE8bv6BsIire1JJ2/ g6DPOKakuvLlH9p9j/g4WxRR/brwJcTywG++NEFEmhVyvEdY4gAKpS99Vx0AKDkKshsl mz2l+lb1m6Xp/Y76brnY4b9yIy0crYYJ/tpMF9JqtVmlJroxLkcVw8LqyC4fIwrCW1KI EMTw== 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:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=IoHDoN5cg3pTvtc6lY6oBNri3TvAxKVoaXExBdNi1sc=; fh=L83jzy0hhBVNaLcKX8Elyc9wPnQzNxExr67xNuVQva4=; b=eEDndozjGWaOrUxrpa9Iw10PorLvGGqyQ4jVldkxXIJMhD5q6K6plJafyiqKxLOLm1 PG5IQpB4BkO5jN4IY1ZLdrq4d2kj0j3s/219vIPa6LIzCChg1IpIObId2+tVhQP9mveX OecUA3ij90+naTE5vdO8ZaTR21edONDd96tXhEDj0O3KOxgQSVFYZVvLzaa2r8SUatbl /XvlWbxZ5gEiJFQD6jOFI3PQBcRW09VQJ/Bf4MtNfIcoRVMg2YRyQ56JS52MLwSBKZ7u yY8TnoQFYVZw65waw6MbAAhtMGILf+hYCqP5bUYT+mqyVlp0uF/YRORBEIdi5XOLexRd MPkQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fKI3FbqM; 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=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id k23-20020a0cb257000000b0063d10f78906si1533191qve.321.2023.08.18.10.21.09 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 18 Aug 2023 10:21:09 -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=@linaro.org header.s=google header.b=fKI3FbqM; 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=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qX39i-0005Ko-2e; Fri, 18 Aug 2023 13:21:02 -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 1qX39c-00053r-59 for qemu-devel@nongnu.org; Fri, 18 Aug 2023 13:20:56 -0400 Received: from mail-ed1-x52c.google.com ([2a00:1450:4864:20::52c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qX39Z-0001qj-Ua for qemu-devel@nongnu.org; Fri, 18 Aug 2023 13:20:55 -0400 Received: by mail-ed1-x52c.google.com with SMTP id 4fb4d7f45d1cf-51e28cac164so4683080a12.1 for ; Fri, 18 Aug 2023 10:20:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1692379252; x=1692984052; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=IoHDoN5cg3pTvtc6lY6oBNri3TvAxKVoaXExBdNi1sc=; b=fKI3FbqMUYRFbg6+QV9AIreKSqMnB87mlAgXj+spNzZ1vvrCHn84+cZpSlQeg33RqK VGMGPdXUzEQOGomVDALq+qAGJWR8AC2Mx7Y+mGb+NEBGIo3bmWZC+Dy3wWwP3zUCBsNh kA+j6rKHo312OYP9iS3Edv1VE/669Urlo4gRZ9cfWJGAxiGJuOlvgHPZC4DwuqIIWFWB nNE6RNhuJ1tF9OIwMeccbiCy3G/zWdca2deMQH8L/IEIVvk76socVBE/gytr9+MHrbSE ruD+CQeGqRX8biK1yIYe+wy0bSy32VgSVKBXLiN/TAWLyhhpHYipSxRIruolfsUDwlVo QD2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692379252; x=1692984052; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=IoHDoN5cg3pTvtc6lY6oBNri3TvAxKVoaXExBdNi1sc=; b=j7jlpR9PwXD94w8DhtMpnPo3wLb2khJ+LLXIhE6He13B1liUY/ykI6ALGsIM48mFfR olSk6stzXAM/0RM+5my5GWt5EcxM6o+jkJmAvJrwvZDz/JZzczIQUI2RMIl91OSOJ955 3XbeegKtu6sZkAsoi1qFUS+kMwnBv02w+USm2g8gj5ejVmtIigNbpkplP7UwjjSwBvGl KXN7+Or1S61Z4E7UvqA36kLAvECPKg48WXr95bDFVkCRr520e1HJXlDOWF3L08m1FkuR htF0dztnRqPUwDfppWk/dOMS9h2ragHq9saFPIF13/W0bEEN3wjU0QigFzB0p4ECuFj0 BqsA== X-Gm-Message-State: AOJu0Yz7xu9F8RpTNclxeb6CooN7xgG026wDy+Xlte8MIjygtoC5g9uZ jouK+LdHOSeTyPAN4KZVufFqtUjilceT3GcAZ/E= X-Received: by 2002:a17:906:8a51:b0:989:450:e565 with SMTP id gx17-20020a1709068a5100b009890450e565mr3344948ejc.23.1692379252378; Fri, 18 Aug 2023 10:20:52 -0700 (PDT) Received: from m1x-phil.lan (cnf78-h01-176-184-27-79.dsl.sta.abo.bbox.fr. [176.184.27.79]) by smtp.gmail.com with ESMTPSA id z14-20020a1709064e0e00b0099293cdbc98sm1427558eju.145.2023.08.18.10.20.50 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 18 Aug 2023 10:20:52 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Huacai Chen , Xiaojuan Yang , =?utf-8?q?Alex_Benn=C3=A9e?= , Jiajie Chen , Song Gao Subject: [PATCH v2 5/8] target/loongarch: Extract 64-bit specifics to loongarch64_cpu_class_init Date: Fri, 18 Aug 2023 19:20:13 +0200 Message-ID: <20230818172016.24504-6-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230818172016.24504-1-philmd@linaro.org> References: <20230818172016.24504-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::52c; envelope-from=philmd@linaro.org; helo=mail-ed1-x52c.google.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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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.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 Extract loongarch64 specific code from loongarch_cpu_class_init() to a new loongarch64_cpu_class_init(). In preparation of supporting loongarch32 cores, rename these functions using the '64' suffix. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- target/loongarch/cpu.c | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/target/loongarch/cpu.c b/target/loongarch/cpu.c index 34d6c5a31d..356d039560 100644 --- a/target/loongarch/cpu.c +++ b/target/loongarch/cpu.c @@ -356,7 +356,7 @@ static bool loongarch_cpu_has_work(CPUState *cs) #endif } -static void loongarch_la464_initfn(Object *obj) +static void loongarch64_la464_initfn(Object *obj) { LoongArchCPU *cpu = LOONGARCH_CPU(obj); CPULoongArchState *env = &cpu->env; @@ -695,11 +695,6 @@ static const struct SysemuCPUOps loongarch_sysemu_ops = { }; #endif -static gchar *loongarch_gdb_arch_name(CPUState *cs) -{ - return g_strdup("loongarch64"); -} - static void loongarch_cpu_class_init(ObjectClass *c, void *data) { LoongArchCPUClass *lacc = LOONGARCH_CPU_CLASS(c); @@ -724,16 +719,27 @@ static void loongarch_cpu_class_init(ObjectClass *c, void *data) cc->disas_set_info = loongarch_cpu_disas_set_info; cc->gdb_read_register = loongarch_cpu_gdb_read_register; cc->gdb_write_register = loongarch_cpu_gdb_write_register; - cc->gdb_num_core_regs = 35; - cc->gdb_core_xml_file = "loongarch-base64.xml"; cc->gdb_stop_before_watchpoint = true; - cc->gdb_arch_name = loongarch_gdb_arch_name; #ifdef CONFIG_TCG cc->tcg_ops = &loongarch_tcg_ops; #endif } +static gchar *loongarch64_gdb_arch_name(CPUState *cs) +{ + return g_strdup("loongarch64"); +} + +static void loongarch64_cpu_class_init(ObjectClass *c, void *data) +{ + CPUClass *cc = CPU_CLASS(c); + + cc->gdb_num_core_regs = 35; + cc->gdb_core_xml_file = "loongarch-base64.xml"; + cc->gdb_arch_name = loongarch64_gdb_arch_name; +} + #define DEFINE_LOONGARCH_CPU_TYPE(size, model, initfn) \ { \ .parent = TYPE_LOONGARCH##size##_CPU, \ @@ -757,8 +763,9 @@ static const TypeInfo loongarch_cpu_type_infos[] = { .parent = TYPE_LOONGARCH_CPU, .abstract = true, + .class_init = loongarch64_cpu_class_init, }, - DEFINE_LOONGARCH_CPU_TYPE(64, "la464", loongarch_la464_initfn), + DEFINE_LOONGARCH_CPU_TYPE(64, "la464", loongarch64_la464_initfn), }; DEFINE_TYPES(loongarch_cpu_type_infos)