From patchwork Fri Aug 18 10:34:25 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: 714630 Delivered-To: patch@linaro.org Received: by 2002:a5d:484e:0:b0:317:ecd7:513f with SMTP id n14csp523240wrs; Fri, 18 Aug 2023 07:12:17 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHJOmguWo9c8degDZidm0jS9hetwSyAc80N0uA374BDejDnlv0zhRF9nUIE1WHsIs//iPGs X-Received: by 2002:ac8:5708:0:b0:406:56cb:b617 with SMTP id 8-20020ac85708000000b0040656cbb617mr4157749qtw.53.1692367937062; Fri, 18 Aug 2023 07:12:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692367937; cv=none; d=google.com; s=arc-20160816; b=wXriyklGidt9EECu04d29cnyVBtnF5b6HBwC1aSvAeOYCrCuTfdTb+UT01S/NG0IRg NZyQrQvkE5Bs+0mkLjEZdXy6apIMyTZVurvu/TUiRxRjW4m5ToIbzR1cvbLyZSuw4Ppa dj0WurifaAqM3AuUWsxC4Gf8stKI/P7ZaM7eR4mAnIGRsCDeXQcJG0ODYjH7gZ4+vSGj NP9eW5oLkca024O9GiL6BzSxRe15TQ412y7wNIU8pYQCm/Ff7FZ2WG3e7AES2NmAnI7d iRnfttTADGTYKP2mjRTe1nd35xUeHb91p6zYD8+YBwbLG8hOoL9hg5GRrM9hktymfsz9 yxfA== 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=fW46fogpRD0z/3au3liqhnlpv4cot2Ttk3TraxBL1oU=; fh=BVT+wNaEQ6DYU2fJ+3RLrSAfhPFgaPFe1wC3+pPOUB8=; b=B2/CR9Y/ltqCyeelVb+TzhRETA40jAT5Xcbyw/MQ+mo14D3KNs7lqW2Jnx9klwfdnP CMGoLWZgJSAeCRXev0EqcF1XPX9aAZ7go8fjWbdwAToMEoHbD/1amJYRRrELFpFgyCgn QpwI0paElgvyJkj1c9tMVxcA1B5tZaK0oN0BYQ1MoSQZ5kqrKks/YUfiYVZh1KubLX73 IoEjuPfMaJBqxM3Z2sekldLQDueZJo9RVj10FqCfOVTv/ktVG/zAkerEMZE/HHasQ2If D8IJzkirtRFKFzBIHgg3oc10krjd59m3CQNp7lNYjxH+qYeCKRJ3RvUcTP230gXEGHAB Y/tA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=nHCqP+Xv; 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 a20-20020a05622a02d400b004039b86b885si1243802qtx.614.2023.08.18.07.12.16 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 18 Aug 2023 07:12:17 -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=nHCqP+Xv; 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 1qX05n-0004yD-DS; Fri, 18 Aug 2023 10:04:47 -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 1qWwol-0006Nr-2W for qemu-devel@nongnu.org; Fri, 18 Aug 2023 06:35:00 -0400 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qWwoi-0002ye-6j for qemu-devel@nongnu.org; Fri, 18 Aug 2023 06:34:58 -0400 Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-3fe1fc8768aso7190605e9.1 for ; Fri, 18 Aug 2023 03:34:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1692354894; x=1692959694; 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=fW46fogpRD0z/3au3liqhnlpv4cot2Ttk3TraxBL1oU=; b=nHCqP+Xve8KUI4ERf6Zc+4QKEd6XZkDP7lTAPt7hPg/0n2oZDBL3Toa8jfRVJdJ84+ deMkyuCZrwvFeOHBD+OyUd2AJ/hC0IJbRaQEfPvrytAK/36sb89oYM8MbCi8CrqA9efR pdFH7aPhDJCjmozd0KEoco/q/qdI0FPTEtQZhSJZl7Vp3NKV4Drp5p2GOhh+jqJf1lLG bCpLoTNoMFDaoCTfk2PCAQlaY/5cZDD80wvIl/c6k0WvqusCvKbcfynsvBpmUEdgjSzU h1BhkC8nJJAN4Wz0lejbscD1W64/wDRTLBaSJSpm0rqk0SWUPnEtTwXug2RLVCPbbQF4 LXKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692354894; x=1692959694; 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=fW46fogpRD0z/3au3liqhnlpv4cot2Ttk3TraxBL1oU=; b=Wq79JMLqcHloGCABDG+YOJ5IED8q2EnwtnG6CbMmONwvCpfSTLoB7OfnX/JUbM5Oxc sETfaF/bkILxPVfW6v9p31UJPDsAlyk85v7OZMuW6ztSwE0TmPwC/EusYl9InAzZQwBI goN7FMQRsvMEwHekAfec6nxaggzKAEecUVsNhk+FRZMbCAx4/Jj6kDzyS1a26lfv7QcA NbnyRGsDw2taRrRkmfYDQjeQ46pU9a2IxC4Mmc1+Tiu1F8QS2XTXfkxX6RCOOu/+DoNr S5M/odYcDRoPbgDtYWXXWWHnJvnyVyJgLtz6xhPuDexAVKQFdnS9Gqfj/sFhir+c9r9I uejQ== X-Gm-Message-State: AOJu0YzN7er5TtqyYBHPvkywNZhfAcl8b6Q4LKKg+WuaX6Jxi4uYzC/X AzvysPJRwZF7fLR2+fs2CfeiSYYcWFAMM+JalWo= X-Received: by 2002:a1c:7c0f:0:b0:3f9:b244:c294 with SMTP id x15-20020a1c7c0f000000b003f9b244c294mr1934808wmc.35.1692354894139; Fri, 18 Aug 2023 03:34:54 -0700 (PDT) Received: from localhost.localdomain ([92.88.170.41]) by smtp.gmail.com with ESMTPSA id n24-20020a7bc5d8000000b003fe17e04269sm2371236wmk.40.2023.08.18.03.34.52 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 18 Aug 2023 03:34:53 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Huacai Chen , Song Gao , Xiaojuan Yang , Jiajie Chen , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH 4/4] target/loongarch: Extract 64-bit specifics to loongarch64_cpu_class_init Date: Fri, 18 Aug 2023 12:34:25 +0200 Message-ID: <20230818103425.16271-5-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230818103425.16271-1-philmd@linaro.org> References: <20230818103425.16271-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32a; envelope-from=philmd@linaro.org; helo=mail-wm1-x32a.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(). Adapt DEFINE_LOONGARCH64_CPU_TYPE() macro. Signed-off-by: Philippe Mathieu-Daudé --- target/loongarch/cpu.c | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/target/loongarch/cpu.c b/target/loongarch/cpu.c index 19572e37ad..6bd5ca93fd 100644 --- a/target/loongarch/cpu.c +++ b/target/loongarch/cpu.c @@ -694,11 +694,6 @@ static const struct SysemuCPUOps loongarch_sysemu_ops = { }; #endif -static gchar *loongarch64_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); @@ -714,8 +709,6 @@ static void loongarch_cpu_class_init(ObjectClass *c, void *data) cc->class_by_name = loongarch_cpu_class_by_name; cc->has_work = loongarch_cpu_has_work; cc->dump_state = loongarch_cpu_dump_state; - cc->set_pc = loongarch64_cpu_set_pc; - cc->get_pc = loongarch64_cpu_get_pc; #ifndef CONFIG_USER_ONLY dc->vmsd = &vmstate_loongarch_cpu; cc->sysemu_ops = &loongarch_sysemu_ops; @@ -723,21 +716,35 @@ 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 = loongarch64_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->set_pc = loongarch64_cpu_set_pc; + cc->get_pc = loongarch64_cpu_get_pc; + cc->gdb_num_core_regs = 35; + cc->gdb_core_xml_file = "loongarch-base64.xml"; + cc->gdb_arch_name = loongarch64_gdb_arch_name; +} + #define DEFINE_LOONGARCH64_CPU_TYPE(model, initfn) \ { \ .parent = TYPE_LOONGARCH_CPU, \ - .instance_init = initfn, \ .name = LOONGARCH_CPU_TYPE_NAME(model), \ + .instance_init = initfn, \ + .class_init = loongarch64_cpu_class_init, \ } static const TypeInfo loongarch_cpu_type_infos[] = {