From patchwork Fri Aug 18 17:20:09 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: 1823080 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=N/xlX/0U; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RS7ts2p40z26jN for ; Sat, 19 Aug 2023 03:20:53 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qX39U-0004RX-BW; Fri, 18 Aug 2023 13:20:48 -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-0004Jj-MK for qemu-devel@nongnu.org; Fri, 18 Aug 2023 13:20:34 -0400 Received: from mail-ej1-x62a.google.com ([2a00:1450:4864:20::62a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qX399-0001fN-6H for qemu-devel@nongnu.org; Fri, 18 Aug 2023 13:20:29 -0400 Received: by mail-ej1-x62a.google.com with SMTP id a640c23a62f3a-99bf3f59905so146858366b.3 for ; Fri, 18 Aug 2023 10:20:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1692379225; x=1692984025; 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=tvng4YPVMkWkkh2eZJ6qlqU3fIhQVOx369AKXLs8f1o=; b=N/xlX/0U5f7k4DLrB8XbfHpLf8mI3p/OyDl0Qzv4kpd2xATdEJuxHuWiafAyxQGj0g DFC+KSipTcoOdmcey74UlgCF5opDOzEMWInJmkJsaK99Fd1jWG2rnvr3OQrDlJ9TCY61 8Yyk4v4t2Px8cDMIrk83TO0uSRuLdTfFuzJsv6BohYjA66T8dfLPMz07gTY2mxbZh3e1 rTeQ+UVH7cuzir8Fu5OrBYQ/mEwv00Jk05npXroOdZqe6kcxV8zFgQo7PQbKL5DO09I4 lwawbgd/1Y8xSX/yXJ8zjURFdiIli8Spk21pb83f6N87L3bMYtN7k5WpzGCQbHNJd6DE UXiA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692379225; x=1692984025; 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=tvng4YPVMkWkkh2eZJ6qlqU3fIhQVOx369AKXLs8f1o=; b=YKNVpH6Fbm8AouKuFSuFXVcID/u4czndlEowDhwiBZ03AJa5Er/4UBaEWAQZ0SgMK/ UZxBR2EXqxKyoR6/u3oP9g8MV4nzsnM6hz/pGoHTj80KNVCpt44BHP4+fU7Ig5/cXS/K sD5BpMxgf75cb+ZCOa6ZMMJ7DrvZIlmyRbYtq2OZ2xN/5WyIBhmVZ/hslH5Je5dQwgHs P2HwBLLN/V/vregmW4OAj9XUErGXniiXaIpuGODLEW212wowb2luuaEYZ8gG0k8iv/Q5 9vguQjFjuxsVFguFXEeKA0pHwLCyo/uYk2o/VLoNPGjgrWDNaAqAbGuhmDDgSyC/yDwT Q6QA== X-Gm-Message-State: AOJu0Ywkv+2EIiJaF0nShtJopFG99CqmeCQeRI+CtLaove/jAe6ox1ZW XlDDOBzJq+W4fBsyDvj5kpH1gXhtmi+OMxiMhJo= X-Google-Smtp-Source: AGHT+IFPW5IGlCJXSOETdK3KTmwogrhfQIwj9cWQBLDoQJjUupvETyhKHiA99WN8A4hcaMXcQT+IZQ== X-Received: by 2002:a17:907:75cc:b0:99b:4668:865f with SMTP id jl12-20020a17090775cc00b0099b4668865fmr2330966ejc.10.1692379225214; Fri, 18 Aug 2023 10:20:25 -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 ja24-20020a170907989800b00992b8d56f3asm1429260ejc.105.2023.08.18.10.20.24 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 18 Aug 2023 10:20:24 -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 1/8] target/loongarch: Log I/O write accesses to CSR registers Date: Fri, 18 Aug 2023 19:20:09 +0200 Message-ID: <20230818172016.24504-2-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::62a; envelope-from=philmd@linaro.org; helo=mail-ej1-x62a.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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Various CSR registers have Read/Write fields. We might want to see guest trying to change such registers. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Song Gao --- target/loongarch/cpu.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/target/loongarch/cpu.c b/target/loongarch/cpu.c index ad93ecac92..7107968699 100644 --- a/target/loongarch/cpu.c +++ b/target/loongarch/cpu.c @@ -544,6 +544,8 @@ static void loongarch_cpu_realizefn(DeviceState *dev, Error **errp) static void loongarch_qemu_write(void *opaque, hwaddr addr, uint64_t val, unsigned size) { + qemu_log_mask(LOG_UNIMP, "[%s]: Unimplemented reg 0x%" HWADDR_PRIx "\n", + __func__, addr); } static uint64_t loongarch_qemu_read(void *opaque, hwaddr addr, unsigned size) From patchwork Fri Aug 18 17:20:10 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: 1823083 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=tApuWAVl; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RS7v91R8fz26jP for ; Sat, 19 Aug 2023 03:21:09 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qX39V-0004Zk-6k; Fri, 18 Aug 2023 13:20:51 -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 1qX39H-0004N9-3P for qemu-devel@nongnu.org; Fri, 18 Aug 2023 13:20:36 -0400 Received: from mail-ej1-x636.google.com ([2a00:1450:4864:20::636]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qX39E-0001oh-Ul for qemu-devel@nongnu.org; Fri, 18 Aug 2023 13:20:34 -0400 Received: by mail-ej1-x636.google.com with SMTP id a640c23a62f3a-991c786369cso150621966b.1 for ; Fri, 18 Aug 2023 10:20:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1692379231; x=1692984031; 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=KDDiUObgQlqnPEjumWcjcKFBdygOD4fC1QpRcXk6j3k=; b=tApuWAVlN1MtgISqy2WC8FafcdIJ9bADz/SLym8mhNl5XlTKnOFBQiEQB//eg5uTXe khfYNw7iCnk1mFmoHZRzxNp1HRg6zIAba3debOO2YwFsYwBgL6TAFP7ZCjv0MYj5rLcc RGJp8dD8DZaqiDxzAKH5IA05zYOIkkDv8qzXSPIvcpSXHBc2zesXmFHRzPkDsWWRxcxw zCaecx6qeRwVghCleb/T8GiMR6t9cD+Oy6j+qjX96w1VTKHzeRi9k+JzVgaPOhRLaS/K Dn6Jewi/xNiSn7Z0ZNVxoHUX76GSNs1eIgD0csMA0jXvaR1GqO2WFG960HHcFBTtcNOn T6jA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692379231; x=1692984031; 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=KDDiUObgQlqnPEjumWcjcKFBdygOD4fC1QpRcXk6j3k=; b=UFKOqacEd6T+lu51sJjMwrS3F82zRPP8r/4ChDq3NttfxU96Q+tnXB+7tXzxf4UA/n vMkitbTQ2KbDBRxA1Z289CL9Y4Cfgz0oSbnPrr+ewrQ7KNBZArvux1lFFZh462LoRC8m WetW6qRY8u9xzeK9CBhAbrddFcQRhyq1yi59lejbXY0xXN+HpWfb8S8SIec3nFhZ8Dzr /xDeQKg4I2c2fmmOmLKTHWoodvtrq7OWmXDXQe1GXHAyDW8jBQcLgOhNVOkAq8gSQMD5 TZjHBLqARFTtJQI4A0oK8danxaqQ1n2deA3MAtJ+XaLStblSkkavuckGLsB6u33hdZQC +0Ow== X-Gm-Message-State: AOJu0Yw5Lb859ItVhFlLzIQA2zrUTZKuCBaZw7xBgwPXZheMU07jlO8+ g39HI8cjNP0y8z7n6VkKcXwMmEYI5j/nUbfL3YY= X-Google-Smtp-Source: AGHT+IGhchCXhW+ENJ4JMk7qZjoPNw1B4ZsdR9VqJejGsqrtB4bqzR3JjX163npFdyZhOEjhzsJTsw== X-Received: by 2002:a17:906:9bf6:b0:99c:e3b6:eafe with SMTP id de54-20020a1709069bf600b0099ce3b6eafemr2428252ejc.64.1692379231077; Fri, 18 Aug 2023 10:20:31 -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 c17-20020a1709060fd100b0098ce63e36e9sm1444269ejk.16.2023.08.18.10.20.29 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 18 Aug 2023 10:20:30 -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 , Richard Henderson Subject: [PATCH v2 2/8] target/loongarch: Remove duplicated disas_set_info assignment Date: Fri, 18 Aug 2023 19:20:10 +0200 Message-ID: <20230818172016.24504-3-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::636; envelope-from=philmd@linaro.org; helo=mail-ej1-x636.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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Commit 228021f05e ("target/loongarch: Add core definition") sets disas_set_info to loongarch_cpu_disas_set_info. Probably due to a failed git-rebase, commit ca61e75071 ("target/loongarch: Add gdb support") also sets it to the same value. Remove the duplication. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Reviewed-by: Song Gao --- target/loongarch/cpu.c | 1 - 1 file changed, 1 deletion(-) diff --git a/target/loongarch/cpu.c b/target/loongarch/cpu.c index 7107968699..dc617be36f 100644 --- a/target/loongarch/cpu.c +++ b/target/loongarch/cpu.c @@ -723,7 +723,6 @@ 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->disas_set_info = loongarch_cpu_disas_set_info; cc->gdb_num_core_regs = 35; cc->gdb_core_xml_file = "loongarch-base64.xml"; cc->gdb_stop_before_watchpoint = true; From patchwork Fri Aug 18 17:20:11 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: 1823099 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=gAelpra3; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RS7vq6M2Jz26jV for ; Sat, 19 Aug 2023 03:21:43 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qX39f-00057i-GL; Fri, 18 Aug 2023 13:20:59 -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 1qX39Q-0004RV-Jc for qemu-devel@nongnu.org; Fri, 18 Aug 2023 13:20:46 -0400 Received: from mail-lf1-x12e.google.com ([2a00:1450:4864:20::12e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qX39N-0001pO-QB for qemu-devel@nongnu.org; Fri, 18 Aug 2023 13:20:44 -0400 Received: by mail-lf1-x12e.google.com with SMTP id 2adb3069b0e04-4fe85fd3d27so1825184e87.0 for ; Fri, 18 Aug 2023 10:20:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1692379237; x=1692984037; 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=BKQfb1Masg0LUXafLP8DDVqoNx75e63Lg2kg56KHPJU=; b=gAelpra3Z3G7V0iS9SpWq98pdTYMzwEhv5/HjdE7UQoR4CVK92Uzzp9gk10wA6RdaZ ixQw6u1yq2fyCDzQcX4Vj1VcV/5j0RFOa8o1pfazrFwJtwzu+w1+AfMA+MkBh2a8b0P3 U1o4GSh+iM6ar7k70NzjVokRl91z2Gp3Mw6raQGp4gJHoXMoWKkOS6vPQTh5w4SpvhmG yS4fV3sYs/oqrdZS2vNVT5ddDiUfG0E9Gw8s97GrH+yPh9AMjEa45b6BtP8ORJQwg6jl DMINAMfUlgqokbwD5pKP5XGhPgTU7A+AmG1FQgCtrNemDsClVS9BwtQ89E11HV3RY2Wd yHQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692379237; x=1692984037; 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=BKQfb1Masg0LUXafLP8DDVqoNx75e63Lg2kg56KHPJU=; b=QU7zokJRaz+XZEGH4QJbNDW/qR+5uwnhMLm6PLBCpQNjZb65R3NA/5GqUfZ2H7T18v 2qdSywO+zXxzrMGtvHTZCxBs4vIEzBXQ09Ee2Ff/IeuW9A+MENJibKzIeMnD1CP8RQFJ sEdN8UYXhkjmlcPQ7+0dcCWBmRLYjS9EA61+cxZVI8USvOPobTkkapytimNYA9ERf/BM fsNbmGh2Uks9omKB3eIJCj6qyfhH8zlLD5B/WSGAB96IF38udPKPVsGEJu86/eCoudjg QU6Kg7ZOE+6AQvqVrkZ6MBtWQYw7cNzEW+zQRiAnZVBh/xvzWFwrElQ1ldiQVEew72SW kRlA== X-Gm-Message-State: AOJu0Yz4By7ciZ0OkGEbCGTGafBXxxOpGzYeJxRR01yVsDdjKH82+GKI Ry386J/AcxSHBJ642YcFPXpzTQwg1Yqxc5PBHoQ= X-Google-Smtp-Source: AGHT+IHm1PfyxD4yJwxbdGdMTXxS/91m6ZONd89NIjQKb0ux4rkcjW4Twe6BXbjD0F4qdnissMT9Rg== X-Received: by 2002:a05:6512:318f:b0:4fe:1d88:2c61 with SMTP id i15-20020a056512318f00b004fe1d882c61mr2617738lfe.32.1692379237350; Fri, 18 Aug 2023 10:20:37 -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 lg5-20020a170906f88500b009937dbabbd5sm1404250ejb.220.2023.08.18.10.20.35 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 18 Aug 2023 10:20:37 -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 , Richard Henderson Subject: [PATCH v2 3/8] target/loongarch: Fix loongarch_la464_initfn() misses setting LSPW Date: Fri, 18 Aug 2023 19:20:11 +0200 Message-ID: <20230818172016.24504-4-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::12e; envelope-from=philmd@linaro.org; helo=mail-lf1-x12e.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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Song Gao Reviewed-by: Richard Henderson Signed-off-by: Song Gao Reviewed-by: Philippe Mathieu-Daudé Message-ID: <20230817093121.1053890-11-gaosong@loongson.cn> Signed-off-by: Philippe Mathieu-Daudé --- target/loongarch/cpu.c | 1 + 1 file changed, 1 insertion(+) diff --git a/target/loongarch/cpu.c b/target/loongarch/cpu.c index dc617be36f..a1ebc20330 100644 --- a/target/loongarch/cpu.c +++ b/target/loongarch/cpu.c @@ -391,6 +391,7 @@ static void loongarch_la464_initfn(Object *obj) data = FIELD_DP32(data, CPUCFG2, LSX, 1), data = FIELD_DP32(data, CPUCFG2, LLFTP, 1); data = FIELD_DP32(data, CPUCFG2, LLFTP_VER, 1); + data = FIELD_DP32(data, CPUCFG2, LSPW, 1); data = FIELD_DP32(data, CPUCFG2, LAM, 1); env->cpucfg[2] = data; From patchwork Fri Aug 18 17:20:12 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: 1823089 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=YHn+iG5u; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RS7vL3pmpz1yfn for ; Sat, 19 Aug 2023 03:21:18 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qX39g-0005D7-N3; Fri, 18 Aug 2023 13:21:00 -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 1qX39V-0004my-TQ for qemu-devel@nongnu.org; Fri, 18 Aug 2023 13:20:52 -0400 Received: from mail-lj1-x231.google.com ([2a00:1450:4864:20::231]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qX39T-0001q5-KW for qemu-devel@nongnu.org; Fri, 18 Aug 2023 13:20:49 -0400 Received: by mail-lj1-x231.google.com with SMTP id 38308e7fff4ca-2b9cdba1228so18342781fa.2 for ; Fri, 18 Aug 2023 10:20:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1692379246; x=1692984046; 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=BYPEbS+9l3jGhhkth1Vm4/5ZlIy93oIVK2+Qb11CVCo=; b=YHn+iG5ut+EcpNpnvSv8EWPoknSGsd2LgnDz/v8+Lh8KtaPD0OBZ9vKNI/05S7xfjB Q7m19B9b/AiEliuYtkCQ6E8Eq1VrsBs7cjnJ35K+PBZTdikdlF762BC/j3caCSqcz4tr hk6XT2il3izVR/2GLtr4oHZOFcNyMDSA0lUOX58X4T6vc8yGYaPe8o0zSaZ5RxZA8vvd tHn+4+9GYfcZm0fFZGNIsu3ZmY80mkS9/HuzcWztdF9Nk13Y+Hzq+e35pQKRYjnUJW0G tclZtMqr5ksOWcM9jS6YchxPNJjg818lD5BSPLQOQjc1bkf5nDaaW0gxm5s1N+mL0FoB c/OQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692379246; x=1692984046; 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=BYPEbS+9l3jGhhkth1Vm4/5ZlIy93oIVK2+Qb11CVCo=; b=fW6zgIgADPl9a7tP/lYqs5SK10x07pOmGAlmiTRvIFaBhiYioeHiaNespfOA+bu1WA 79pWPe+U1t9LXnsRnoiLM0dxpJc4RLeyEu3oaiyEb058oabNhxXkS2hJZCgOcIbrs5wm oM6Z05Ww2KkuOXEH3g4GosCrsjABkfoSPSc2l1obqBgCgrc7ft9FfLrJws8+HlS+E+OV ML81qIlaOKyRh6IPwwEArdPGFyK5ERpdTLjt5IAGTN6xjmpzNAJmuRVyChDeY9TPbDDr 0WM6wFJVc7JWtGU9yU9hVbKmBoXb2ec18dHnHWWZfQqMcjb7sObF2Fhkeb4B0mccPhS2 wNBA== X-Gm-Message-State: AOJu0YztkZidY/16gdxT5sJqtlruLMLqF3LQqIpUiJcPbBGYFZ35/+aD PW6fZOA4wiLWNHYxseawkXa8Aey8F1t/BH84ubw= X-Google-Smtp-Source: AGHT+IHvHBRnKre6NCXpa67WjlX3oWC3sf+yXd/wHOe3L8qfeeK2q8ajLYjWhwnDZIaR4hqWrt3cOw== X-Received: by 2002:a2e:9015:0:b0:2b6:e618:b593 with SMTP id h21-20020a2e9015000000b002b6e618b593mr2421782ljg.31.1692379245770; Fri, 18 Aug 2023 10:20:45 -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 gq6-20020a170906e24600b0099c53c44083sm1411375ejb.79.2023.08.18.10.20.43 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 18 Aug 2023 10:20:45 -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 4/8] target/loongarch: Introduce abstract TYPE_LOONGARCH64_CPU Date: Fri, 18 Aug 2023 19:20:12 +0200 Message-ID: <20230818172016.24504-5-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::231; envelope-from=philmd@linaro.org; helo=mail-lj1-x231.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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org In preparation of introducing TYPE_LOONGARCH32_CPU, introduce an abstract TYPE_LOONGARCH64_CPU. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- target/loongarch/cpu.h | 1 + target/loongarch/cpu.c | 12 +++++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/target/loongarch/cpu.h b/target/loongarch/cpu.h index fa371ca8ba..c50b3a5ef3 100644 --- a/target/loongarch/cpu.h +++ b/target/loongarch/cpu.h @@ -377,6 +377,7 @@ struct ArchCPU { }; #define TYPE_LOONGARCH_CPU "loongarch-cpu" +#define TYPE_LOONGARCH64_CPU "loongarch64-cpu" OBJECT_DECLARE_CPU_TYPE(LoongArchCPU, LoongArchCPUClass, LOONGARCH_CPU) diff --git a/target/loongarch/cpu.c b/target/loongarch/cpu.c index a1ebc20330..34d6c5a31d 100644 --- a/target/loongarch/cpu.c +++ b/target/loongarch/cpu.c @@ -734,9 +734,9 @@ static void loongarch_cpu_class_init(ObjectClass *c, void *data) #endif } -#define DEFINE_LOONGARCH_CPU_TYPE(model, initfn) \ +#define DEFINE_LOONGARCH_CPU_TYPE(size, model, initfn) \ { \ - .parent = TYPE_LOONGARCH_CPU, \ + .parent = TYPE_LOONGARCH##size##_CPU, \ .instance_init = initfn, \ .name = LOONGARCH_CPU_TYPE_NAME(model), \ } @@ -752,7 +752,13 @@ static const TypeInfo loongarch_cpu_type_infos[] = { .class_size = sizeof(LoongArchCPUClass), .class_init = loongarch_cpu_class_init, }, - DEFINE_LOONGARCH_CPU_TYPE("la464", loongarch_la464_initfn), + { + .name = TYPE_LOONGARCH64_CPU, + .parent = TYPE_LOONGARCH_CPU, + + .abstract = true, + }, + DEFINE_LOONGARCH_CPU_TYPE(64, "la464", loongarch_la464_initfn), }; DEFINE_TYPES(loongarch_cpu_type_infos) 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: 1823088 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=fKI3FbqM; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RS7vC01wDz26jQ for ; Sat, 19 Aug 2023 03:21:11 +1000 (AEST) 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-Google-Smtp-Source: AGHT+IHRmoeiFH6s8Yip0g8bg6vCfRfYi5VdpTOlx0eqw3tCUmG9Cc0BahY2vYz37OKDr8BT9d/4Bg== 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.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) From patchwork Fri Aug 18 17:20:14 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: 1823090 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=dA5WUZ0S; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RS7vh2L5Kz1yfn for ; Sat, 19 Aug 2023 03:21:36 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qX39k-0005qZ-JE; Fri, 18 Aug 2023 13:21:04 -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 1qX39i-0005LL-Cg for qemu-devel@nongnu.org; Fri, 18 Aug 2023 13:21:02 -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 1qX39g-0001sv-3i for qemu-devel@nongnu.org; Fri, 18 Aug 2023 13:21:02 -0400 Received: by mail-ed1-x52c.google.com with SMTP id 4fb4d7f45d1cf-52164adea19so1484827a12.1 for ; Fri, 18 Aug 2023 10:20:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1692379258; x=1692984058; 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=9/is4OP2bMjv02N4bH1oF/ePbIH9KS0BSaVmzaTcaDA=; b=dA5WUZ0S2vTnGslEVMRBUVx8KNBdTrZlqN6x0N26Np0kJQgNcU4UVvnJY7vIzAuX/p qCxXh5HjvHI6MeFX+tdEpPNXZInZIt/h7CFq627e2CnrKPZH4dDQLAbrwPu8GG2IKNcO DxSac0kvsiRip9kVMNMURH5MKQgNpfw8BrnsTAlux0A6mmg8vo8bG3yBPD40YxYvfdqm LTjsuId/Z1rxRxrMDHEOFYgE45JfWvF6KoO8z/CY6ZsNmZrjyhqUqBb7gOD60rDXXNy/ KNHPLjyjtQ8gl8UUIqN/D1Lyr+ZPot7sttOUauq+jVS+L9HQwRDhpR1n4QaSz7Hjm0ue x4aQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692379258; x=1692984058; 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=9/is4OP2bMjv02N4bH1oF/ePbIH9KS0BSaVmzaTcaDA=; b=dQ+EHAWDH8Mwtz2JrsYl5ypI5rn0kQqoWk11V4OgTI97pfO4SMaDtjhx+hjGsX6PVO ZI2Jx8BefJ5PlPaqYg2gMt9gC6YpuaWB6OhXJkgqGXqDrDCbfX09RMfXVXGaIqdNbN9f uHovsik6ot5kw7H84XNrJGiOMNp0SMMXlUbu4UBYQzxqLKUbVHuxiRg1DwAVIXnl04Jj 5FDyzEV6LMPXZE2wzmN5U/AfbaB39CVJEbPMuJqbBi0ZtROE2HxhCmvgfKHaHvYFltL0 1LfvD5OMC11tFWXn21rRsH6z7SqEzW6UCQiJw8iB3X/soNYyWPv9fNb2VXgVub5nV0X9 WR+w== X-Gm-Message-State: AOJu0YyzRhIYcUL60ANlHz3gGN9BNPUfDaXfilE6qyglYdKW/ZEtBcu1 BJpCbiO42wUcdD8zeQhkBw5DY+iPkny/mDmLZoQ= X-Google-Smtp-Source: AGHT+IGMuYO09ODliCu7WuNcFjBMf4wysAZOg7iFopcb/HBQH4MvsvHzB3WfKciAptgxvStF3RL5XA== X-Received: by 2002:a05:6402:104f:b0:525:65f7:60 with SMTP id e15-20020a056402104f00b0052565f70060mr2883752edu.29.1692379258514; Fri, 18 Aug 2023 10:20:58 -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 w9-20020a056402070900b00525683f9b2fsm1289223edx.5.2023.08.18.10.20.57 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 18 Aug 2023 10:20:58 -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 , Richard Henderson Subject: [PATCH v2 6/8] target/loongarch: Add function to check current arch Date: Fri, 18 Aug 2023 19:20:14 +0200 Message-ID: <20230818172016.24504-7-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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Jiajie Chen Add is_la64 function to check if the current cpucfg[1].arch equals to 2(LA64). Signed-off-by: Jiajie Chen Co-authored-by: Richard Henderson Reviewed-by: Richard Henderson Signed-off-by: Song Gao Message-ID: <20230817093121.1053890-2-gaosong@loongson.cn> Signed-off-by: Philippe Mathieu-Daudé --- target/loongarch/cpu.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/target/loongarch/cpu.h b/target/loongarch/cpu.h index c50b3a5ef3..3235ad081f 100644 --- a/target/loongarch/cpu.h +++ b/target/loongarch/cpu.h @@ -132,6 +132,11 @@ FIELD(CPUCFG1, HP, 24, 1) FIELD(CPUCFG1, IOCSR_BRD, 25, 1) FIELD(CPUCFG1, MSG_INT, 26, 1) +/* cpucfg[1].arch */ +#define CPUCFG1_ARCH_LA32R 0 +#define CPUCFG1_ARCH_LA32 1 +#define CPUCFG1_ARCH_LA64 2 + /* cpucfg[2] bits */ FIELD(CPUCFG2, FP, 0, 1) FIELD(CPUCFG2, FP_SP, 1, 1) @@ -421,6 +426,11 @@ static inline int cpu_mmu_index(CPULoongArchState *env, bool ifetch) #endif } +static inline bool is_la64(CPULoongArchState *env) +{ + return FIELD_EX32(env->cpucfg[1], CPUCFG1, ARCH) == CPUCFG1_ARCH_LA64; +} + /* * LoongArch CPUs hardware flags. */ From patchwork Fri Aug 18 17:20:15 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: 1823091 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=MuRNZy5W; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RS7vj04sfz26jN for ; Sat, 19 Aug 2023 03:21:37 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qX39u-0007LR-EI; Fri, 18 Aug 2023 13:21:14 -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 1qX39o-0006dY-Nt for qemu-devel@nongnu.org; Fri, 18 Aug 2023 13:21:08 -0400 Received: from mail-ej1-x62f.google.com ([2a00:1450:4864:20::62f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qX39m-0001u6-DL for qemu-devel@nongnu.org; Fri, 18 Aug 2023 13:21:08 -0400 Received: by mail-ej1-x62f.google.com with SMTP id a640c23a62f3a-99d90ffed68so479432266b.0 for ; Fri, 18 Aug 2023 10:21:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1692379265; x=1692984065; 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=uEMElgMvR1O3ZuyrTpBd0rfdnbX1M9RkvLN7Ub/Z4Dw=; b=MuRNZy5Wj9JU8nMw9ACBoTqf4tCv1Sl/DlN5qy6tgakiWAxwj1ST0ZH6Rgx+oUY4r9 JlInG3SlRt53sUpL/jFfOptGIiIgdXjbZSJ/WZI485yZjfTs6jeoY4dBuq9XUt60Qyu6 P4OwEO1EmnPCxlFvBBaNoMUZMnyfmQUScb6+n9BVOzZd9T8QQmN4kD9iUqim8dOtJh9n bM6VgPfxzAGfO2ZVM3mxMEq9axPd77kyz3XOd+IBeWKISeVJPARBetDXL2Jl006MND35 y48GLYskOJNDoF+VLQjp62AJTQWN+vfTkeDng6FhEtw4hhC0u2SRtae0uD9we14UBYda 1GvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692379265; x=1692984065; 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=uEMElgMvR1O3ZuyrTpBd0rfdnbX1M9RkvLN7Ub/Z4Dw=; b=B1ByX1F3Up5FwN3V7PWD+kgWLLIr0DfZqMSw/gtdRCQnBu2M2FBSMQHdirXxy4DQDK sU0AUwWzUes5T+zfn+RH3fjEhLLv5GrSy7DEYPZIJtQROE6zW7inHoKzRfGVvFeP60Jg x+xgB2s2qHg3c3VC9DKVMRDK+zLf9N+iHPs6JPHUXB9B0sxnJg2411YpO1WshXZlbkmu bBfL6KHUVqcLJpgg0Y0Ije4VNl3MzthoTz5W2aPIqz+8xi8aR89lrLCXRa/Hc73K2Qpe XNeY3te16XRtUbK/jvO6v+mZN4EGUa+bYKI7fwo/goXmOk3y8+0Nd+Ka/jNN8PvAFeAh 5MfQ== X-Gm-Message-State: AOJu0YwsDmharJPbk4n2Dz00DIhw6P0oS3UwCDSe4QUH4No67DRg677d 9NKxwx1UojUNOx9ZGYj84VSgRA0RiV4miAmuxDs= X-Google-Smtp-Source: AGHT+IFfivwRxuLAN1HQuB3QQYL0Ca8mPGPEDObH+BVRtXkPgGa40G63gWKQCvJG8k5r3dC/pEBADw== X-Received: by 2002:a17:906:5195:b0:997:e9a3:9c4f with SMTP id y21-20020a170906519500b00997e9a39c4fmr3658167ejk.30.1692379264879; Fri, 18 Aug 2023 10:21:04 -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 yy10-20020a170906dc0a00b0099d02ca4327sm1411861ejb.54.2023.08.18.10.21.03 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 18 Aug 2023 10:21:04 -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 , Richard Henderson Subject: [PATCH v2 7/8] target/loongarch: Add new object class for loongarch32 cpus Date: Fri, 18 Aug 2023 19:20:15 +0200 Message-ID: <20230818172016.24504-8-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::62f; envelope-from=philmd@linaro.org; helo=mail-ej1-x62f.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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Jiajie Chen Add object class stub for future loongarch32 cpus. Signed-off-by: Jiajie Chen Reviewed-by: Richard Henderson Signed-off-by: Song Gao Message-ID: <20230817093121.1053890-3-gaosong@loongson.cn> [Rebased on TYPE_LOONGARCH64_CPU introduction] Signed-off-by: Philippe Mathieu-Daudé --- target/loongarch/cpu.h | 1 + target/loongarch/cpu.c | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/target/loongarch/cpu.h b/target/loongarch/cpu.h index 3235ad081f..b8af491041 100644 --- a/target/loongarch/cpu.h +++ b/target/loongarch/cpu.h @@ -382,6 +382,7 @@ struct ArchCPU { }; #define TYPE_LOONGARCH_CPU "loongarch-cpu" +#define TYPE_LOONGARCH32_CPU "loongarch32-cpu" #define TYPE_LOONGARCH64_CPU "loongarch64-cpu" OBJECT_DECLARE_CPU_TYPE(LoongArchCPU, LoongArchCPUClass, diff --git a/target/loongarch/cpu.c b/target/loongarch/cpu.c index 356d039560..5082506f10 100644 --- a/target/loongarch/cpu.c +++ b/target/loongarch/cpu.c @@ -726,6 +726,10 @@ static void loongarch_cpu_class_init(ObjectClass *c, void *data) #endif } +static void loongarch32_cpu_class_init(ObjectClass *c, void *data) +{ +} + static gchar *loongarch64_gdb_arch_name(CPUState *cs) { return g_strdup("loongarch64"); @@ -758,6 +762,13 @@ static const TypeInfo loongarch_cpu_type_infos[] = { .class_size = sizeof(LoongArchCPUClass), .class_init = loongarch_cpu_class_init, }, + { + .name = TYPE_LOONGARCH32_CPU, + .parent = TYPE_LOONGARCH_CPU, + + .abstract = true, + .class_init = loongarch32_cpu_class_init, + }, { .name = TYPE_LOONGARCH64_CPU, .parent = TYPE_LOONGARCH_CPU, From patchwork Fri Aug 18 17:20:16 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: 1823102 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=GOphneww; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RS7vy4D0wz1yfn for ; Sat, 19 Aug 2023 03:21:50 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qX3AA-0007sb-Sn; Fri, 18 Aug 2023 13:21:32 -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 1qX39w-0007VX-7g for qemu-devel@nongnu.org; Fri, 18 Aug 2023 13:21:16 -0400 Received: from mail-lf1-x135.google.com ([2a00:1450:4864:20::135]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qX39s-0001ur-QY for qemu-devel@nongnu.org; Fri, 18 Aug 2023 13:21:15 -0400 Received: by mail-lf1-x135.google.com with SMTP id 2adb3069b0e04-4fe389d6f19so1553439e87.3 for ; Fri, 18 Aug 2023 10:21:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1692379271; x=1692984071; 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=H2Fkk9ynZ3VBGOLEApNmPZej9m7TD3tkTeJS3zvlq3E=; b=GOphnewwFZStjeXzZW+e56mkMSIPCps0URPpllO+w64WvAbusLh3sSEfMDa7ND/9M5 Wbbc4L0nIFMJKeK2rmyWRR9S1Xm4bhpf0AgtApp0UnLMTnaPYvFuvtEklcm7hQn+hliG rZ/qZ+kcrFdTGcvWqGV4IV2QtS7h3nGr9WVjbeXoQFWAUN9DnPbwNeZ53nTQnOpAdqux JYjvoyiyJzyf1mL/rfEJ9zaQpngDbG1sXoetbg9yqm+KlatYHd2VmEzEil6DXeq178HO riaMjmkcCz4GqAtaANPelLhjx1os3VqCXu4WB4S2aq66vRotWYT+Y/uX/sp6abVw9LHm 0WSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692379271; x=1692984071; 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=H2Fkk9ynZ3VBGOLEApNmPZej9m7TD3tkTeJS3zvlq3E=; b=EUwvaV9GUXGfnE0F5GGrBCjrYb0Q9fGDyqnfFVduVpJOLyjiJtKeZeO7cT+RgSUa+i jg8K2uBqs1BQXm9SQAlF9HQIsPHptntJ/r+ebN0ZthXnuUqwYnnnhkzOM22CWOtoERws m3M49qitpqSYY4Zz4YEYpX+F+9CGj9Z5bxpmftgA3Zy4/NwzKwOC+EAAC09URYJuePZQ cvZGtN1QsD5+GTu296J676TXU1AFls7YyiW2kPYzClDrmmDVZAiyNi+VKIENmtDWE6Qi u76UznRZ/hTpT0UvOgxMXyTJdwg7vaUM3g7BdE3B8VljEMJOyAPzgATz1KdMPlIAHU+Q Uhtg== X-Gm-Message-State: AOJu0Yx942WmdgPRLQchBtehkxO5fPUznKaCA+yy0GxH8pid+qmSKE+8 tTMGjWMj8KP9kjS6fEyRX7CLcPogJ0ZJuxzkkvc= X-Google-Smtp-Source: AGHT+IHLeh8Nsum5fRrW/DxPhzkb0NOc62cZ3QyEYYBH84oQ2NFByIZAiDjhWNbbtf1SePekRAQxVQ== X-Received: by 2002:a05:6512:3f0a:b0:4fe:181f:2736 with SMTP id y10-20020a0565123f0a00b004fe181f2736mr3090125lfa.33.1692379270913; Fri, 18 Aug 2023 10:21:10 -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 c4-20020aa7df04000000b00523b1335618sm1269391edy.97.2023.08.18.10.21.09 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 18 Aug 2023 10:21:10 -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 , Richard Henderson Subject: [PATCH v2 8/8] target/loongarch: Add GDB support for loongarch32 mode Date: Fri, 18 Aug 2023 19:20:16 +0200 Message-ID: <20230818172016.24504-9-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::135; envelope-from=philmd@linaro.org; helo=mail-lf1-x135.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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Jiajie Chen GPRs and PC are 32-bit wide in loongarch32 mode. Signed-off-by: Jiajie Chen Reviewed-by: Richard Henderson Signed-off-by: Song Gao Message-ID: <20230817093121.1053890-4-gaosong@loongson.cn> [PMD: Rebased, set gdb_num_core_regs] Signed-off-by: Philippe Mathieu-Daudé --- configs/targets/loongarch64-softmmu.mak | 2 +- target/loongarch/cpu.c | 10 ++++++ target/loongarch/gdbstub.c | 32 ++++++++++++++---- gdb-xml/loongarch-base32.xml | 45 +++++++++++++++++++++++++ 4 files changed, 81 insertions(+), 8 deletions(-) create mode 100644 gdb-xml/loongarch-base32.xml diff --git a/configs/targets/loongarch64-softmmu.mak b/configs/targets/loongarch64-softmmu.mak index 9abc99056f..f23780fdd8 100644 --- a/configs/targets/loongarch64-softmmu.mak +++ b/configs/targets/loongarch64-softmmu.mak @@ -1,5 +1,5 @@ TARGET_ARCH=loongarch64 TARGET_BASE_ARCH=loongarch TARGET_SUPPORTS_MTTCG=y -TARGET_XML_FILES= gdb-xml/loongarch-base64.xml gdb-xml/loongarch-fpu.xml +TARGET_XML_FILES= gdb-xml/loongarch-base32.xml gdb-xml/loongarch-base64.xml gdb-xml/loongarch-fpu.xml TARGET_NEED_FDT=y diff --git a/target/loongarch/cpu.c b/target/loongarch/cpu.c index 5082506f10..f42e8497d6 100644 --- a/target/loongarch/cpu.c +++ b/target/loongarch/cpu.c @@ -726,8 +726,18 @@ static void loongarch_cpu_class_init(ObjectClass *c, void *data) #endif } +static gchar *loongarch32_gdb_arch_name(CPUState *cs) +{ + return g_strdup("loongarch32"); +} + static void loongarch32_cpu_class_init(ObjectClass *c, void *data) { + CPUClass *cc = CPU_CLASS(c); + + cc->gdb_num_core_regs = 35; + cc->gdb_core_xml_file = "loongarch-base32.xml"; + cc->gdb_arch_name = loongarch32_gdb_arch_name; } static gchar *loongarch64_gdb_arch_name(CPUState *cs) diff --git a/target/loongarch/gdbstub.c b/target/loongarch/gdbstub.c index 0752fff924..a462e25737 100644 --- a/target/loongarch/gdbstub.c +++ b/target/loongarch/gdbstub.c @@ -34,16 +34,25 @@ int loongarch_cpu_gdb_read_register(CPUState *cs, GByteArray *mem_buf, int n) { LoongArchCPU *cpu = LOONGARCH_CPU(cs); CPULoongArchState *env = &cpu->env; + uint64_t val; if (0 <= n && n < 32) { - return gdb_get_regl(mem_buf, env->gpr[n]); + val = env->gpr[n]; } else if (n == 32) { /* orig_a0 */ - return gdb_get_regl(mem_buf, 0); + val = 0; } else if (n == 33) { - return gdb_get_regl(mem_buf, env->pc); + val = env->pc; } else if (n == 34) { - return gdb_get_regl(mem_buf, env->CSR_BADV); + val = env->CSR_BADV; + } + + if (0 <= n && n <= 34) { + if (is_la64(env)) { + return gdb_get_reg64(mem_buf, val); + } else { + return gdb_get_reg32(mem_buf, val); + } } return 0; } @@ -52,15 +61,24 @@ int loongarch_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n) { LoongArchCPU *cpu = LOONGARCH_CPU(cs); CPULoongArchState *env = &cpu->env; - target_ulong tmp = ldtul_p(mem_buf); + target_ulong tmp; + int read_length; int length = 0; + if (is_la64(env)) { + tmp = ldq_p(mem_buf); + read_length = 8; + } else { + tmp = ldl_p(mem_buf); + read_length = 4; + } + if (0 <= n && n < 32) { env->gpr[n] = tmp; - length = sizeof(target_ulong); + length = read_length; } else if (n == 33) { env->pc = tmp; - length = sizeof(target_ulong); + length = read_length; } return length; } diff --git a/gdb-xml/loongarch-base32.xml b/gdb-xml/loongarch-base32.xml new file mode 100644 index 0000000000..af47bbd3da --- /dev/null +++ b/gdb-xml/loongarch-base32.xml @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +