From patchwork Mon Aug 21 12:59:56 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: 715376 Delivered-To: patch@linaro.org Received: by 2002:a5d:484e:0:b0:317:ecd7:513f with SMTP id n14csp1821359wrs; Mon, 21 Aug 2023 06:02:41 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGugnk8Ri3qKPax2ThNSXArHWioZWU/4xkBUgex94tPbstYWSJOandIg+UliR1t3RM14IsJ X-Received: by 2002:a05:622a:5c8:b0:40f:da66:4e1 with SMTP id d8-20020a05622a05c800b0040fda6604e1mr8754976qtb.59.1692622961471; Mon, 21 Aug 2023 06:02:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692622961; cv=none; d=google.com; s=arc-20160816; b=mqACAGWfRq+i2su8NdDqWblKYmi4B7ufRJ9jZc5ebKeZDz1bMxPmr0g9KHkbKgGTiQ FZSosIfLdjBbheK8GZW9Qj1PXCldI+p5oubg3+dLgLjT6xvFDdOVg0xIDlxChzB9m+KE JZ2X95SNh4T2piSjpNdaU0wI9NXNgGYNN/mA17oqiYhr4n9e3Y0GCKgu0fa5xR4mBhep 2lXw8VfZSk1bmqq7n2SJyeAhVbSNjLGnWdmUqkaW2hnRnBiBs/Vkjb+b8f8Gr4cVvcWg Cf3q6mB9ZZiwUA3ZsRA/C0M49uWqIcvrzOyO18vLHLamkqmclimRBonq+mkOm+MGqKft 0CPA== 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=2emvSppPUAN2BQaD+odMmobapg0yAtZtyVccXkFX9fU=; fh=6ZlfjzpG5M4zTB3QdUsu1um4KG/wqA9A9dxpvstpjlg=; b=GzmdZ8L4iTQ2igvqaSuvsX/+gqhBdrkdqWYtDZDjc46uiEiNTDl3uAxTq9+ZApq5IE FU48HpcacWICRyOsZNP1unQShzo3x5s8CTJj/QfmkY/FNdZfh7QyvRbGAGftKfsnwc1q HX17uCekRZL1jUaSt3vrJ18/VZWofb8b4PVJoCmZ2npCHdcpmA0f6LACIU6yrR2skaMu /dqKJe33QBpQxDaKb2dJvbvV0av8IOOafk7tHXyEXz0+V/18RpbAW069Z1cyoxkUEz8Q 5+Ivl0objU7cgrrFGhvIBkwKNFg/tOx9jGA6W9Mxl1w0OybIvq8uSIhiXMOde5Obf0Zf /Ngw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MWvMd7e4; 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 b15-20020ac85bcf000000b00403f0dfa0d8si4861283qtb.179.2023.08.21.06.02.41 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 21 Aug 2023 06:02:41 -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=MWvMd7e4; 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 1qY4XP-0001hq-8s; Mon, 21 Aug 2023 09:01:43 -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 1qY4Wd-0000Zb-5p for qemu-devel@nongnu.org; Mon, 21 Aug 2023 09:01:00 -0400 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qY4WQ-0001G6-CG for qemu-devel@nongnu.org; Mon, 21 Aug 2023 09:00:53 -0400 Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-3fef56f7223so2089475e9.3 for ; Mon, 21 Aug 2023 06:00:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1692622833; x=1693227633; 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=2emvSppPUAN2BQaD+odMmobapg0yAtZtyVccXkFX9fU=; b=MWvMd7e48PL32UgoBAiA1HJuQshk3FE/pVt1lWK5r8O+oEFQS46ifjy7V7UsvMKpdK AAaclzj3qdUJkMIX9mr+B2iTYll8O/BJwnD2h15pzl/hKzKesCjrHJir4ZN++wBY66+V Q9IHNEO+5s6rAMcNqVwje1PDc8Oxt+iAzwzowoASjwFSX4M6yHEjdpZtE3YukTkg0DmJ 4z4gl9+By5TXSHsEpVXmr/3+W+uVEQCjzcibVBbmUYw8BQgeQwuU2LOP7w3ueUO+Eckb 57DUhSijIH0107FQcCmERvUy7JuWbgn5ZBhPVwxD3bSS/4fO+R9dm89241X/782fAPkp ckKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692622833; x=1693227633; 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=2emvSppPUAN2BQaD+odMmobapg0yAtZtyVccXkFX9fU=; b=Aqkhi7rSo3b2vhvxH76uAlPm0G4ANvJLgZJgFe4VnD0+VZVJ7DmA5VEQz8o/6a1P1B taWLDd7JZSA8YvjgtvEODVqChUA8GN/FhsNqtiXU9Zd/99NbV2cOs+C7f9Jnbl0ltcD0 G9VApqG7XcT2ChBvdTWm8i7rW47qvEGwppUaa+rudtX9t0UV1DC+pgqNF8Ctk+hab545 8KZ8jV+iqXw4TVamVLiazIsoUfyXzcBhR8dS9ZadXKDQCGMrYDB425ScFq3KFzUL5hPC ekkmsJOchhKtfujcTePETm613rHR92sbv9/W5RGbKuEAum8jeNt0NfKmA8LXkjmhrmWN z5dg== X-Gm-Message-State: AOJu0YzBUxHUX7TyUHklBsG59Nkm3XUNtAW182eu00GOjcjhyYwTG5pW rAuRTO2YjiUJliBRexwA5syYb/6MSGbobn45oPk= X-Received: by 2002:a05:600c:364a:b0:3fe:d70f:b0a2 with SMTP id y10-20020a05600c364a00b003fed70fb0a2mr5580469wmq.6.1692622833766; Mon, 21 Aug 2023 06:00:33 -0700 (PDT) Received: from m1x-phil.lan (static-176-182-122-208.ncc.abo.bbox.fr. [176.182.122.208]) by smtp.gmail.com with ESMTPSA id 21-20020a05600c22d500b003fee777fd84sm7809383wmg.41.2023.08.21.06.00.32 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 21 Aug 2023 06:00:33 -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?= , =?utf-8?q?A?= =?utf-8?q?lex_Benn=C3=A9e?= , Song Gao , Jiajie Chen , Xiaojuan Yang , Huacai Chen , Richard Henderson Subject: [PATCH v3 5/8] target/loongarch: Extract 64-bit specifics to loongarch64_cpu_class_init Date: Mon, 21 Aug 2023 14:59:56 +0200 Message-ID: <20230821125959.28666-6-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230821125959.28666-1-philmd@linaro.org> References: <20230821125959.28666-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::330; envelope-from=philmd@linaro.org; helo=mail-wm1-x330.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. Reviewed-by: Richard Henderson Signed-off-by: Philippe Mathieu-Daudé --- target/loongarch/cpu.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/target/loongarch/cpu.c b/target/loongarch/cpu.c index 34d6c5a31d..6384bda1bd 100644 --- a/target/loongarch/cpu.c +++ b/target/loongarch/cpu.c @@ -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,6 +763,7 @@ 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), };