From patchwork Mon Aug 21 12:59:52 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: 715369 Delivered-To: patch@linaro.org Received: by 2002:a5d:484e:0:b0:317:ecd7:513f with SMTP id n14csp1820341wrs; Mon, 21 Aug 2023 06:01:18 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHcf9BjJVA2HaeoOCVqngs9R7Y20WYhNCvGepcm+TbreoiX/CimE4qWzLOeD2aCV61PfIry X-Received: by 2002:a0c:f554:0:b0:64b:e16:a3cb with SMTP id p20-20020a0cf554000000b0064b0e16a3cbmr6691624qvm.61.1692622878045; Mon, 21 Aug 2023 06:01:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692622878; cv=none; d=google.com; s=arc-20160816; b=VXUG67T7qOtSIZ0GJABiOMIK1AwIe88iZzXsQEqDs5/CiKgBFexOaX8M2fPe/8RgkF rFS65QYuhMZZ3cdZyFRyeI2xs90t4AnbQQCwnVSffIyxjcf2U3Un8m4r+uYliuX5lKnX go9oirpMxgQavSXAmoOT4I5nBw4v4ghgk5Faxi3nTwvT7COVncrQjU8wO/ou2OPST91L Bu+6n46pT/b6PdjaZbiL9Mii0oYG10YiTEOuLPZ05+BbOWH9Ggd6yUajRohpaSDVa/YU 1yiV1iCjZqqP5bdacTCksk+0aBrwpAdpY+CowVZZ6vmynQ35KuKH53agKt3yJKVJrjW3 2Q3g== 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=ajIy6AXOv6OC/kq7WdoBWCKBE4f90n/4gU5LLrh9Jio=; fh=5DJtmzMNW8Fio4h4XCWPw7Xe5go+KHWZ7ZW95yGvlMM=; b=GVK6Cdwofh0fmlGLPKMb/eFfqH4jjvOL8SkheuUfuTVMBw7HKlj9RaSV2tWwhhCqOn kEnMNH3md4YcrDiqYmUQ+WM5OAOK9ulx8nXDCryWyKArsEN0IOjDKQMor+QywseY5uXW 2dA7WjecUzoh0KY3kiwOsq8Tg9xtpIxdzwKGTgWVBuI22bnOoAc3YUk/QJSmmZQXjdLR 8hs45CZkN2df+VjWrbVgJ2K+TVDhUJX7Ou22/3eYrFOEzuFCP6s5mxjTDQA9dT3NNmIR JjMgXI+05I2TEEjxdn88h8eGPpXnfNB+O2kF77bX4F3YyGlWk3ie3mUt6iXGzBDhRTJh sHoA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=YNk3qs6n; 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 b11-20020a0cf04b000000b00630229d25e0si4781032qvl.395.2023.08.21.06.01.17 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 21 Aug 2023 06:01:18 -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=YNk3qs6n; 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 1qY4Wa-0000Mq-US; Mon, 21 Aug 2023 09:00:57 -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 1qY4Vx-0000BR-Ub for qemu-devel@nongnu.org; Mon, 21 Aug 2023 09:00:14 -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 1qY4Vv-00017A-OS for qemu-devel@nongnu.org; Mon, 21 Aug 2023 09:00:13 -0400 Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-3fef56f7248so2025695e9.3 for ; Mon, 21 Aug 2023 06:00:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1692622809; x=1693227609; 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=ajIy6AXOv6OC/kq7WdoBWCKBE4f90n/4gU5LLrh9Jio=; b=YNk3qs6nAFujYDmWCG9otiPJQYyQJYYIk0ky4VbhK63ao7MgP8S0cXOlJDsbT8GcB4 vLOLoa7VoY8jrOeYl+LvIAxXNTMkrW1oiDBsdUNfYwDo5kYHr6Zj4QpS3YpdUEMxNPxv xfTC+CDuD2ryEEJg+Um++bwZz8PxTPG8Pch0LGPGI7GsOJL91rZmX5BLvTc+uxCcOzUq WyQsAmvPgx3ArX+XwfcLFviq02cfGmntnAZVuBUWf+tflRtO4U/xv9+cRvtYwsQzabWE iTO189anKlvxjj/3/+/XyKxABsx0Ur6tE5mnXKM4QTe5RDl97FaMPgVYuk+ln5MVN07b rZ/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692622809; x=1693227609; 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=ajIy6AXOv6OC/kq7WdoBWCKBE4f90n/4gU5LLrh9Jio=; b=jiaJne9z2Agc4oOAySttB3RUWcdf8qrMI+rTGchm0nKzx/67BrUvDkpgZsnkbLyrzK o5YyT0tA/FPCGj0YAVuNlvDqdmScf1wY8w1AJZWP5rROsBCB8zGr+CJnEI8cVZf/UXNy C8YvpR2uwdmKB0Efu2rPIyUSKEqj8rABIlJp879jeJqZaEjXyOJ9zk2kwiIyQPxhdJZi E000OhE8yvQttGyzCrvipLkICigmCiAivJDx/m5QiwLbZFibiuhlF0Fn0/xDk1KEVxoU NPbe6N6b9OrZX6dlZmFwkSu+2qy+g4DzxphbOvI0Odhd4v6SMI81l3MBylaASaBahQyn Qj8A== X-Gm-Message-State: AOJu0YzIBPaOJjCEKLxYzcYTP/s9P4eCwu+gphZzwhtboee+XpgfmYNd rLsosGsttwwnnphZh/u+WA0Nb9PFPKJ7VMTn4v0= X-Received: by 2002:a05:600c:2901:b0:3fe:ef11:d79f with SMTP id i1-20020a05600c290100b003feef11d79fmr2830988wmd.36.1692622809174; Mon, 21 Aug 2023 06:00:09 -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 f8-20020adfdb48000000b0031934b035d2sm12570855wrj.52.2023.08.21.06.00.07 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 21 Aug 2023 06:00:08 -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 Subject: [PATCH v3 1/8] target/loongarch: Log I/O write accesses to CSR registers Date: Mon, 21 Aug 2023 14:59:52 +0200 Message-ID: <20230821125959.28666-2-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::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 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 Mon Aug 21 12:59:53 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: 715370 Delivered-To: patch@linaro.org Received: by 2002:a5d:484e:0:b0:317:ecd7:513f with SMTP id n14csp1820425wrs; Mon, 21 Aug 2023 06:01:25 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGtAyOHkjddd62Qp23EMs8PXRKY6WelIUjKp024PrBmJz37AjtSH58qj2hKz8yHPbTZNW8F X-Received: by 2002:a05:620a:254b:b0:75e:bf51:29a6 with SMTP id s11-20020a05620a254b00b0075ebf5129a6mr9047655qko.65.1692622885231; Mon, 21 Aug 2023 06:01:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692622885; cv=none; d=google.com; s=arc-20160816; b=aAZNJ/glHqJfSUyAuGl4WXH/rR+13JMuY/5mW5sB4qBNAU0VlTNFSPGHg9r6fmJYRU Q7RXKNxEuogKMJRqC+pY7hbs16/4pmZpG/lBZoZR+DOogCaF8IQcOY71+YPwIbkmxwrb Pz1thyjXyDWxrLZiikPwUC+BEC00R/AV+lmMVlEF2HKBh2MsNxDFhuQuPBYDc8EjVtlE n0u01TIdH+4FMgFg4FCWDiISwds3z+I5gM8lvqC0FOyN8Umlj0KNniprBwxkTVa0pjpB gxksW3mQnxPS8dKUHbnWWQI9E88nXug3gfUgIjJ55ZspjCjLgSKfW19XJN1VLO8SyJlZ pLSw== 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=9qcp2zjh0Kae/JSBm9k7FRLIsQxWf7QHOQrpHAvtUzg=; fh=6ZlfjzpG5M4zTB3QdUsu1um4KG/wqA9A9dxpvstpjlg=; b=A4PLBd1pF2r+D7ZiaT0WtUcIiuUztQLWbQf8TuNrSTSU5jrjbw5vfmiO2SGD7z/mGN 6zkvlz6UzDs/ztZhT2anaQQm54lCUzusWrX9rCDIr8Kn4SRJk9HfWWRu7ksUWKNFulgo 2P0WawhdOyS9BTXa6ue/feOuYVG8nH4uYLNb+znCuQDav1PXhrKhkjlG0Kkp5CMzdlpH jR51Lr6FeUQD8fauszIDPeR9Mno6xsWRj/zKH+5m6ScABEvsv0W1RTQvbWpgTM2XH7CC tF2RCMwrLA3s2WfpH/tYuUeDoDAVrtr6DeOkeCbJQ6lahbhAW09/gcsxoBgDzu5hH8Qs l0aA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=R+psxyLR; 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 i12-20020a05620a27cc00b007624b598b2fsi4721009qkp.61.2023.08.21.06.01.25 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 21 Aug 2023 06:01:25 -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=R+psxyLR; 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 1qY4Wy-0000la-Qi; Mon, 21 Aug 2023 09:01:16 -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 1qY4W6-0000GN-PN for qemu-devel@nongnu.org; Mon, 21 Aug 2023 09:00:29 -0400 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qY4W2-00017z-5S for qemu-devel@nongnu.org; Mon, 21 Aug 2023 09:00:22 -0400 Received: by mail-wr1-x42b.google.com with SMTP id ffacd0b85a97d-31aeef88a55so1500728f8f.2 for ; Mon, 21 Aug 2023 06:00:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1692622816; x=1693227616; 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=9qcp2zjh0Kae/JSBm9k7FRLIsQxWf7QHOQrpHAvtUzg=; b=R+psxyLRTAvK6U4Ca3UnBWDC5fKvwr8WsPF2NzCTreZ3aIIsyPclM46TXe9dzqgHbW dUKpFtPOYX70VW51uzbgDKHVoQsR+GFwRoo4iLI+hLd1ncVRr2L4v7DWFXWGrKk7mkye 8J5FB1Ss6QbnCoWxNtiIT0nvvu93NxtKr4GccB04e5zwzC6RfL5RPLtFePWCtWdghzTQ RjIfZRR4nfkfQ98LcBV9FhfgVm5teha8Gbph+J0e5kbHXUXmg00nYUEeaulsYEbyrNgb MOWkR+O8d+Dmj2xW81hKt13jqJcY/DrizSsictFzANDqMQJSUnWQGWCx76ghM1KkcDbd KZ0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692622816; x=1693227616; 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=9qcp2zjh0Kae/JSBm9k7FRLIsQxWf7QHOQrpHAvtUzg=; b=TodSqvRA+6lphJeduPVG+0rb08tuykgTBekplfq2Y6wbznpVt7T8N+IlGIAmJ1nh4m 5la6TXsN3/MhP7L0BNfohir5395eRB9oNBFlZEhf1TMKsNJ6DOmlQ7C++q39x+02UMnI EQZlxwv1zb6d9ECEtMKC8UmCeIn2TZLf1rMMiDsc2S2R+8WGQCOFV5NG9ffK+MJN80tS iuRkH9kAoLAiqTHxwQFti51+lvoyjU/Y3xeehBbibpqEucRPVCOy1rDjhb1oUM7VhEa/ ZpvCr842zFKQusawt6+goE/ayqdyDjWQQAIfA1Z5rNyLQ9P2urRfc+8AUwSnROZ3w8Pq SgnA== X-Gm-Message-State: AOJu0YyHSu4xROiNj5W7NVrBnC0uZN/pXnTpWI8MMBhQ3RlkTIhIMg8n Mts+c7DZ15kWPKK5MOFiYdLbogN/WdusmDuMQvM= X-Received: by 2002:a5d:51c1:0:b0:317:e18e:27bc with SMTP id n1-20020a5d51c1000000b00317e18e27bcmr4406693wrv.71.1692622815707; Mon, 21 Aug 2023 06:00:15 -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 j7-20020adfea47000000b00317731a6e07sm12502404wrn.62.2023.08.21.06.00.13 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 21 Aug 2023 06:00:14 -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 2/8] target/loongarch: Remove duplicated disas_set_info assignment Date: Mon, 21 Aug 2023 14:59:53 +0200 Message-ID: <20230821125959.28666-3-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::42b; envelope-from=philmd@linaro.org; helo=mail-wr1-x42b.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 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 Mon Aug 21 12:59:54 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: 715373 Delivered-To: patch@linaro.org Received: by 2002:a5d:484e:0:b0:317:ecd7:513f with SMTP id n14csp1820895wrs; Mon, 21 Aug 2023 06:02:05 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGVLFEnDXM+2BNFR3PG1SNpJCayogaeFKt3Ko6ahD6oAuOAWOYSU+R+DCu75Pz1jkagtOFd X-Received: by 2002:a05:620a:bce:b0:767:954:a743 with SMTP id s14-20020a05620a0bce00b007670954a743mr9164313qki.51.1692622924821; Mon, 21 Aug 2023 06:02:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692622924; cv=none; d=google.com; s=arc-20160816; b=K0ENeH0aSZ8wtgdS1k55qpNaW/fGTgJ/C/re0fPGK8OioCVz0kDq7lZWAhnUE+DizV Y9+YPtCKOzmLN6PHXT/n0yT+WHWTlf5kAfy9gEzhfOXqc6M8AFcNtnu/tB4/908rFknU WevYPMFmKBmYfil1ShIiEZN5k3qMHK3gD5ih6+24TpRKP8cfpjXGZYp37fFAgy/homOu NDVSfwksMSrridRitDey6dtaoOmTNW4WpFdqUxFo+JfwyIZnULyKq251vNSVQ1WCUd8X Mk1yImS28SLA2TbbGNc9yz8CXVRofnoN04sQAY+mUSCNRIcsalKoMuGIi/YrByKhmj/v VUAg== 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=BKQfb1Masg0LUXafLP8DDVqoNx75e63Lg2kg56KHPJU=; fh=6ZlfjzpG5M4zTB3QdUsu1um4KG/wqA9A9dxpvstpjlg=; b=K3MJqf0Nir5vQPhmUp1AGAN49Ji/pBKsAVYuI8WJPfVJLRkQYTXgZrqqTMo2sxODA2 H/VguIHRpLhXE77gMz+IUjgj9n8zW25TcyA0IEuknXHeFPCQtxMexAlpOJCC21W8U3qo 23vDqCy7u6YoU+hEdgIMnWNJd0RGugw84ihxFFzN4JJ80gac429L/SInpvsEKoIiE1kt NXZVDyOUeYpeRs1inZDYwk0QqahSHhQcKTdrzkfGRjBURiVMp5b4w3mT43i4P8RhJkdM rwljeSXBEGBP/c4/byBs8kV49drZ0mgujPf8r/inshOIPHByJp2XgK7z7NlMIPLnZ1PI cQtQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=EPfeNXFd; 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 10-20020ac8574a000000b0040e9fcf5f03si4811043qtx.758.2023.08.21.06.02.04 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 21 Aug 2023 06:02:04 -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=EPfeNXFd; 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 1qY4Wz-0000pm-0E; Mon, 21 Aug 2023 09:01:17 -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 1qY4WC-0000JL-V4 for qemu-devel@nongnu.org; Mon, 21 Aug 2023 09:00:31 -0400 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qY4W7-00018W-LI for qemu-devel@nongnu.org; Mon, 21 Aug 2023 09:00:26 -0400 Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-3fe12820bffso32873885e9.3 for ; Mon, 21 Aug 2023 06:00:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1692622822; x=1693227622; 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=EPfeNXFdRxPD+IEi1EH5vbxv/Rxb3+w6X1qydqFslcvxaypRHVXWPW8nurWtgYScs4 gIxGKMnqWajKkMcEg1W/zqOfSTfx7urUCVNiz+kGRDVQ3JC4wbjcPZs4S6HbwXDJ/XGX ceERdWsI1Z69sf2g4ynrlydfSwH2AjV8f4oW/gt2VMXIHOmHPokVXGwrZogk+HwsqPMw m4zQqV5uorRwNQm/qhIlYv1HN8FRKVuCruqiPHbJsPO4eL/31dcbbg4wg8/p0zO8ZmWX pdJeMVGFu8TQD8LWbFfDZbur7g3+PEHrKO78j7XKolcZed/8/LwUolI+Cff3sSVZiJEJ 8Ypg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692622822; x=1693227622; 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=aRghPR4DYm73ng1D3BkgqQQD3dcIh6QUGvbYzwMtnV/3l3UD/TM9oFQrql5GJjk/2I oDTgQi8ggSqtCTs1ZdpDZOfpeARxvuRaQLndCqPy4MjrVrIheb1h2UrebtdbLTUaxtWn IkZbL2RiJNwTFSek8wySKfQZ2RoMxFFj0RvRGj1/+9xPqyOkKJ5453sfzGOZmQtyMrOi 5NhkkYnXehVU7S4fLsYF7bBb2M+E5gPbwXu1zmHAWA9AO1D7A9H/3OetyLTxHXORWhxP bZnlShv6pbJy6DO3twbj+SCekBOnPFwmxVIh7caipXk7JXlVZjTkmYCmszmj3ovMfpE2 Namw== X-Gm-Message-State: AOJu0YywNIqk8ub9IaN2eXF0kjh8PM1mhrW0vNeXdyUl8w1DlOPmKBWo thgQJORoy8zYmQaEJd15+INJ2Mcu0XuxDs1FLiU= X-Received: by 2002:a7b:cbcb:0:b0:3fe:34c2:654b with SMTP id n11-20020a7bcbcb000000b003fe34c2654bmr4988052wmi.14.1692622822071; Mon, 21 Aug 2023 06:00:22 -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 f15-20020a7bcd0f000000b003fe1c332810sm16202208wmj.33.2023.08.21.06.00.20 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 21 Aug 2023 06:00:21 -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 3/8] target/loongarch: Fix loongarch_la464_initfn() misses setting LSPW Date: Mon, 21 Aug 2023 14:59:54 +0200 Message-ID: <20230821125959.28666-4-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::32b; envelope-from=philmd@linaro.org; helo=mail-wm1-x32b.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 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 Mon Aug 21 12:59:55 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: 715371 Delivered-To: patch@linaro.org Received: by 2002:a5d:484e:0:b0:317:ecd7:513f with SMTP id n14csp1820670wrs; Mon, 21 Aug 2023 06:01:47 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGy1m0vOk6EuT19KffFijVdmKqGn2D7eyqE45VINaUAX5CC+Z0t8ALLe/gM70cvp1yoioY5 X-Received: by 2002:ac8:5903:0:b0:403:a8fa:b4f5 with SMTP id 3-20020ac85903000000b00403a8fab4f5mr8897530qty.4.1692622906917; Mon, 21 Aug 2023 06:01:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692622906; cv=none; d=google.com; s=arc-20160816; b=lWNfM0z7TL5oUZzPD3lVQNVlY5zshCiLIcHRbLB82hL083PxrDlTnPm24J/ugrD8JC MoNAZNH3RCEPLVgAwU9yEPRGaD1/Odp8WF8Wty/O0v212+d4cMmvPsadh2fLbO7QgJRP 1+j+jzsaWfkUZ1EvGOJhQZVvMO17sxWzMib8nRx04kRITJbAW/6aPcZ3XD4LUrf3mNid a6fQvMWOKUqSJBteh6oAkz/3wD45si+keH7SsZpjKLOrn86OQh9oJ5WUuaetMOn1TdrS Hzh4gm9n6OOZxpmXMAL/P3eaNNFm72yKPFL1ilPf5PmMMasdGQ6kcFlP354N3mg6dMtv QcIQ== 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=XkFQ/Hg2hO7EU81YeAwAVpwO++/fptKuH4LuzhRKmho=; fh=6ZlfjzpG5M4zTB3QdUsu1um4KG/wqA9A9dxpvstpjlg=; b=JkFTcYiqcSqNoJ76WIyDPfSYt2b45Youm2XCjKG5MZ2PY+UGthbb+70JuF2fKat1yc rBAj+lh5aRfNy96YHSMjfmFSd9oUg52Wi8XR/m0444ezeXpDRoz6iWW8O87wN0OTHMTP 8KSN+rC5cVF/gCihigE0ZW0MG82aN8Cadm5xrwTwkT3XJ+Y/uuvBzOvvRb/IiA/nQ7wJ h4sRdFixQbbavNVNo+LPpcMbUkhsmspWqCbdlwg/saZ2CnrHCkj+v+HW44RNZHA7HjYN 8jIGz7rbaqnMPmlOxharCxKCYndGt/ikI8unEqK8NwtfaNShPHq91x7DyGB+OdT3N2Re dnFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=tgh568op; 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 i14-20020ac85e4e000000b00403f0e0625esi4833225qtx.788.2023.08.21.06.01.46 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 21 Aug 2023 06:01:46 -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=tgh568op; 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 1qY4XK-00011r-8W; Mon, 21 Aug 2023 09:01:39 -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 1qY4WH-0000Mr-8n for qemu-devel@nongnu.org; Mon, 21 Aug 2023 09:00:50 -0400 Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qY4WE-0001Cf-HB for qemu-devel@nongnu.org; Mon, 21 Aug 2023 09:00:32 -0400 Received: by mail-wr1-x430.google.com with SMTP id ffacd0b85a97d-31c3726cc45so1192465f8f.0 for ; Mon, 21 Aug 2023 06:00:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1692622828; x=1693227628; 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=XkFQ/Hg2hO7EU81YeAwAVpwO++/fptKuH4LuzhRKmho=; b=tgh568op/VZROyOFlStSZYvij2cw8LzXK5O9jwdOJSOS7g7sXEHVAcEOKBc+Pd8n3w 7vz/NdQEPHMWUBRV+tUnSEjaROy1F1KEbc7M1MOQvL7u234PViJiEQixOwHroMwrhlJ8 IHf6Nox3sW2AdPmj7kALFD8+3YGtmRLZFKlxQH6+71Bhofg45QIiSLoS/CuqWOFGbG2Q qtEb+6wLhFycPTBL01Hkr4tLo0cuV5t9Sj15oXU29czVrWbjrLfCAg0YrOLcjI127PE1 AW8CHpsfNFDfvr/iSoQ8EdHvmSqtyxlAuc82LY3iX6kqDs3FjX4WZlipbTaltshzxQum RH0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692622828; x=1693227628; 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=XkFQ/Hg2hO7EU81YeAwAVpwO++/fptKuH4LuzhRKmho=; b=QUs3b1PjD/bDbWDICbkVdmizO9Xhx9fe7wo5UqKe+MUvpUcz23zyLPK27WwF2YgGw8 LvGnfeMvul8Ss7JaBEnl0mpJjAPsEgMlTWbuXFpHKR2vnNshTv2bgR6dzXqDzKah3c+3 9jUUGLmI87BrPRxoOeruIKZeYRdHB+b4Sr11pgqC3yyuhnDOkON9GDKwUGDQAfycnIgR bbs25vPmhktdIyVeVqwdq+eRYpvbXFDqc+z8ZOWbT2Z6xA9rleWAuFz8LWdWpSKa+dJt Dcg1xJqytUKjg8skYdWP+nD7XAX1/nCBzZwSnJ5FNcrPauNqfNXWIixMml3DwocMxjFF vMLw== X-Gm-Message-State: AOJu0YxHCa4GjfFzUSkhF1fQ7e+F1modKSkS7xDFbz9QCcm86tXobQIU zqsKKrQcP2NnZJInA9swDXdQge2gKzJ5mo10Fsw= X-Received: by 2002:adf:ce8f:0:b0:31a:ddb3:32da with SMTP id r15-20020adfce8f000000b0031addb332damr5520091wrn.22.1692622828027; Mon, 21 Aug 2023 06:00:28 -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 n16-20020a5d4850000000b003179b3fd837sm12464009wrs.33.2023.08.21.06.00.26 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 21 Aug 2023 06:00:27 -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 4/8] target/loongarch: Introduce abstract TYPE_LOONGARCH64_CPU Date: Mon, 21 Aug 2023 14:59:55 +0200 Message-ID: <20230821125959.28666-5-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::430; envelope-from=philmd@linaro.org; helo=mail-wr1-x430.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 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 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), }; From patchwork Mon Aug 21 12:59:57 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: 715375 Delivered-To: patch@linaro.org Received: by 2002:a5d:484e:0:b0:317:ecd7:513f with SMTP id n14csp1821335wrs; Mon, 21 Aug 2023 06:02:39 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGxFpAzTIGCDksAlGjhplDfdtFHVW817Oq9slUvEQcI7q37XFGhwKKFO2P3tcbo6Du0hd/f X-Received: by 2002:ac8:5808:0:b0:410:7f44:7801 with SMTP id g8-20020ac85808000000b004107f447801mr6706006qtg.19.1692622959528; Mon, 21 Aug 2023 06:02:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692622959; cv=none; d=google.com; s=arc-20160816; b=znKXzj6cR1dZqtx89nLWMfJNA+CWGwBd1tC5xfeYGato4eKJeEN6DR1nyd5v9FmsCH 5P3XgVVhbd2kZMwlsv4l8vHaMOK01CVBtGpw0DcWYMF2LLrGBZd3plemjEp2HXhAg4Xj 0Jl2B1Mh0yTgV0+QZxMS971K4icRHpbTdChUlpJYAFGcAYEF42kmzEN760nNE2rCf8gg X/wocrVS56cn6UWiw/LeT7DC/J/FT6byVaLZ9kpDqsK2RrfDmWdjNrfTkHX9MK9doLvM wW8LmVIMdCsoNv8kbEzNfl8SX6emFHCTcVrocGy8pBkwhHmvP/gyTGrevLqSqyG7jn/o w/YQ== 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=9/is4OP2bMjv02N4bH1oF/ePbIH9KS0BSaVmzaTcaDA=; fh=6ZlfjzpG5M4zTB3QdUsu1um4KG/wqA9A9dxpvstpjlg=; b=b1jwa/2WqSjbhgKbkvIqcend/VPKkYAsljUAsGTUTfCEfVEyD4scdZUyGE5uHmkklL gyhCtjyDwbC0NR9Gb4+u1kA4fU8zh2KPHc8cE/HWxNGQD6l7CTQOf31sdt7oTjR7R9Wg omNSP7f56WWapfvJG1AX+Lqv/4hSgN2XWtMVb3bJNPZl7Hh+Lrvk4tr2mSRCsYCTJ7R4 ueAxcYbw9tlchs/ueEW4P/ReIAy1DQqpayT44fcKX2C/nj38jwqkR4w/mB6ivjXFxRkU DdK/W28InfmurXIeGHga1FGuXTiLEHh0NdufaJJg+HTlJqkGWyqjG0Rhqq40I7s4DJxu +A8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="Fi/aUUe0"; 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 h6-20020ac85846000000b0040fd98ecce5si4841497qth.716.2023.08.21.06.02.39 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 21 Aug 2023 06:02:39 -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="Fi/aUUe0"; 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 1qY4XN-0001LN-61; Mon, 21 Aug 2023 09:01:41 -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-0000Za-4r for qemu-devel@nongnu.org; Mon, 21 Aug 2023 09:01:00 -0400 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qY4WY-0001GG-PM for qemu-devel@nongnu.org; Mon, 21 Aug 2023 09:00:53 -0400 Received: by mail-wr1-x42b.google.com with SMTP id ffacd0b85a97d-3179ed1dfbbso3097326f8f.1 for ; Mon, 21 Aug 2023 06:00:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1692622840; x=1693227640; 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=Fi/aUUe0yJ+8Kz820NI0EVTc2lHG513QGv3fvmaBi/I+W/MpQwucdllJk4egrdS6AL j5C8mH+2391ZOcIqlgD+JiMimZA2RJW7F3A0AEpJAaQYE0xToRqv0HXZsXc3MX59ER2H Yr7Ns/iXCXnAQRDd7uPlTcmBbx2RH+9te435VbFzVCjliSfdGSJQ8J/+PCzsalR7ZN64 IWU872qwdkTBpXSdmDKH9lpsrrCoybcTP3RTsdikp6SG1F3HOoJHd0p7NCa5lHGbor9q lvG0M4DlUEs6mPh8E9qAzuY8eM8MmQaog1X+Do4ceY97tMFWj+gMVWXFqW/oc2zfAcbZ 1qcg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692622840; x=1693227640; 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=Vwlqt53iMkw+KzqqMpQrU3Y0XJqxgov0Qinsn/WkavCUbtorR0hQzO8nIEbLRYGpEF 9eXqECVgJoAqlhSlwTO3uW3g48JkiqjOAw5kPKqBsD5GZ6eqMaLD+lR7SHoGXJxp1pb1 kJhRVOM9o6HkViV00BVOzsOroi8BZf/95ZU/RbMiELP4csJraampIdUUaQKF0W4dk4Wu V9Eg3rhiL8NXANmD2DRKPtcKhjj5Hxu7NUbuOBtT/V8fTMI4wMHZsSG4kXAJR/Xf0S3I EFGGBaht4PRpP9rm23Btn11mY6RNvDIVHp0Q4kiuPHcNH8u9HgU9CgQq/R7WLYi1vv24 FwqQ== X-Gm-Message-State: AOJu0YwhqulBE9gBVWHv7gMert7yHraBBmYvytzLIxcOyYER4KKXB/Ai CSw2gw3pXtBohEv/Ps/5xoeLETKMr9AiZCKO2pk= X-Received: by 2002:adf:ea10:0:b0:31a:ed75:75e9 with SMTP id q16-20020adfea10000000b0031aed7575e9mr4620224wrm.13.1692622839591; Mon, 21 Aug 2023 06:00:39 -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 z7-20020a5d4d07000000b00317afc7949csm12403170wrt.50.2023.08.21.06.00.38 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 21 Aug 2023 06:00:39 -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 6/8] target/loongarch: Add function to check current arch Date: Mon, 21 Aug 2023 14:59:57 +0200 Message-ID: <20230821125959.28666-7-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::42b; envelope-from=philmd@linaro.org; helo=mail-wr1-x42b.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 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 Mon Aug 21 12:59:58 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: 715374 Delivered-To: patch@linaro.org Received: by 2002:a5d:484e:0:b0:317:ecd7:513f with SMTP id n14csp1821321wrs; Mon, 21 Aug 2023 06:02:38 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEFP5ndLMv6MmraJtQA2jOxa6Q2Vj1kUEL2MUlXwGJdZCG05r4PhyNSmYuBdwF7jE7qgxTn X-Received: by 2002:a05:622a:1a24:b0:400:aaaf:cf0b with SMTP id f36-20020a05622a1a2400b00400aaafcf0bmr7618589qtb.4.1692622958054; Mon, 21 Aug 2023 06:02:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692622958; cv=none; d=google.com; s=arc-20160816; b=pWV22HC/Sf6bBcywE6pprQJ1mL8EPVlVtdmHATHwxuKeEtO6Q8waQxeLxUwyfo0L8H 43VeV8s1jIz1jiMW1UrJRRizlkvcxTLPe7uPckC3nolIQqzJiSe0OIrkSV6II2hVNPJT UfAvaFDg3IJJ+AUMsxlxNq/a44ef5s1sWuvsuqm9g3bxMYHTr1sZB8t71i4h9e+BuTdN 8gi5WcxTwfonp3Dd/aJU3KAoSAzCrcMh09EL9GV4HofDRjPHOaqC0zJKRg6ux6cT5eQC p8eitjeUIrQwteAVDwMauXQDl5qxhuzD2WCBykg0o6fLzcm9ojTjXqsvFSJtgOtkEEDh 90Zg== 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=6tzLHYJyVkaJuRC3rPNGOZvBxbKGeACB/E2Y8xkmh8s=; fh=6ZlfjzpG5M4zTB3QdUsu1um4KG/wqA9A9dxpvstpjlg=; b=TLbN0Y8zzlgey8ahy+uwy1+PTMSPG0wDf+cMT3g9HIP+KfYfiN9b03E96pBdJSVFbB diEGhzZHySxZPXbMAOuaFhwvF9/0g8eUv0jAGewrV94a1fwLEC1ur2ZVDQg/nITHa/6n Jiy6i4dnIVV9CHPqDHve6EXf1JRYRu1s+Fy+/zHxt49Xmk36T/UmaTt0lMn0n3qIePDW zyvQUq/eTg2kNc8pmd6OBWxa0oiX73avFD6YO5sm8rF5ouLymM6Sk4HrMhUYSZ3N0VFH yN7/HJrHWf0J8QUpwhN8zE8djcOJJ2OS46qe6JyDdkKs2zgJgm0rZsKWuR7dMx3hhIf5 cTcw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=YSn2swva; 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 j16-20020a05622a039000b00403f7c63f44si4864498qtx.145.2023.08.21.06.02.37 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 21 Aug 2023 06:02:38 -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=YSn2swva; 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 1qY4XN-0001L1-0i; Mon, 21 Aug 2023 09:01:41 -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-0000ZZ-4r for qemu-devel@nongnu.org; Mon, 21 Aug 2023 09:01:00 -0400 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qY4WY-0001GQ-Pm for qemu-devel@nongnu.org; Mon, 21 Aug 2023 09:00:53 -0400 Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-3fe5c0e587eso31614445e9.0 for ; Mon, 21 Aug 2023 06:00:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1692622845; x=1693227645; 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=6tzLHYJyVkaJuRC3rPNGOZvBxbKGeACB/E2Y8xkmh8s=; b=YSn2swvaty+fsZRWMiXbShhj/FNdV3PgKfpu5mDmZTB28kC7ZxJn3cx2nQMnGTdHIF 9IQ1IzbAd7X78GzbMaKTx4nfTi1p9YepB9qO/43ryPi+5UpnfNaLzgGe9XSt1GDP2kYA IQGRwl0brFgs+OaIIQK9Swqn05kKYqfxvBMe+i9ZlR9HMti0fXxBZINxNjhZ4VmtL2KO N3kDJSNIjv5AUrq6jV0VclNPnFokr5oo71qOM1eNm1nWjvDe5fbNtp4N0JJTnHuYobVY +B+FDiDDeeXQm3lvUHPrO9jfkHW69CtrS/tQXuy1k7l55v8n2lpi9EGwg18vjJ1WlZ0z 3ZLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692622845; x=1693227645; 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=6tzLHYJyVkaJuRC3rPNGOZvBxbKGeACB/E2Y8xkmh8s=; b=En1APpvdA/1R01xbfgqoorrsP/mgab7k9UB6BRmTLjf2BvN/0cOkxVeidY0OYmsVk2 pUvEnIttV88mO4w8ELaZICyOIHA5jKQ1Bu8Sh659MQZlOpQuLZ4KO4GppzCqsdC/V+nd PZV6qsKMrfRgGG77m6J9Ul2Qknqfz8ZqoRvWm1G7f0Ji/YjZ2+1MFCuwZqZNh1TAhK4t QZMuLrOlojaFnYd1qBCjh4uwYh0Gjhnp9rP+4yEYyVZlrBO3ySJOJfOU59r89Jy1r8cN nTq1FhuWaJrsBj9eog0m+vXlPCE8neiZxDjSsgJkRovKZnVbttc8tYv/3koyL5PsXdgk EqMg== X-Gm-Message-State: AOJu0YzFe/jQFowcbsd7g05/cXw524+C68GDPRxk7yYN7oOKcJybExCm WhuEpJBRxS6l3/RhBPk8LJ+XjUW6wmpR8ZGSBCo= X-Received: by 2002:adf:e242:0:b0:317:60fc:d3c8 with SMTP id bl2-20020adfe242000000b0031760fcd3c8mr4734678wrb.71.1692622845597; Mon, 21 Aug 2023 06:00:45 -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 i14-20020a5d630e000000b0031980783d78sm12415396wru.54.2023.08.21.06.00.44 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 21 Aug 2023 06:00: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?= , =?utf-8?q?A?= =?utf-8?q?lex_Benn=C3=A9e?= , Song Gao , Jiajie Chen , Xiaojuan Yang , Huacai Chen , Richard Henderson Subject: [PATCH v3 7/8] target/loongarch: Add new object class for loongarch32 cpus Date: Mon, 21 Aug 2023 14:59:58 +0200 Message-ID: <20230821125959.28666-8-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::32f; envelope-from=philmd@linaro.org; helo=mail-wm1-x32f.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 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 6384bda1bd..556419f159 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 Mon Aug 21 12:59:59 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: 715372 Delivered-To: patch@linaro.org Received: by 2002:a5d:484e:0:b0:317:ecd7:513f with SMTP id n14csp1820748wrs; Mon, 21 Aug 2023 06:01:54 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHSpl9qf3vDmhlQhBx0Q78S1ZPvKivwz+3ObwnkZASk8bwbO2wE3R6iiUCGptnikLhnEUvP X-Received: by 2002:a05:620a:3903:b0:762:3567:a64c with SMTP id qr3-20020a05620a390300b007623567a64cmr8565282qkn.11.1692622914202; Mon, 21 Aug 2023 06:01:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692622914; cv=none; d=google.com; s=arc-20160816; b=Uie2xvsa8AE68d6GgYnOoLGh4pVlZHoJSqCVirIVgea8PqRoRkZIORvlgt/AN+wTtb QkDVU3x3jNymo8kLr4lz12rggjwlhn638x3zcc1caYrV1Ao+6cZa7E3r37ybeOxwFBNf J+LpW8qcrmFxTmdTNt271YgbXzGffrSvJr5EC2aJjgTefaVJeYikM1RjusRUIoC/L63n Z7Z0hm+wcg3Xr88K1ztuI+yUc//zN3KffTGR1DBJBB5GEK/Oresi9ZaIeOxFKBUDPgAZ 11e/9GaLfnvSMrCxeEUGihG3+ZbvR8zzEKvywSXHoi9Bwc5b904KmSCnsR225EiSoceU SuGw== 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=bDgVnseA0w8JiDAxdtmtFg9qt15KV6UaIIai4w2k7Xg=; fh=6ZlfjzpG5M4zTB3QdUsu1um4KG/wqA9A9dxpvstpjlg=; b=UrSlS8bi6t5HsB7L7Myo5Znf4rtWPeV1NDELwryw0Dsf9k7ssdpQSiJAUcn7Cwjiv5 9heKoA+5aXgyyQc42uWS5P5WRaD79Ct7r/FYKsdrheoEK1ozUgTkck6uYbizQooq3F2o AjnN/F90p6XqQe5D/UJeZfDEWVhKgkgngx16MhquIVPC29jTaA+o9n3HeVWmpF/Trv+r 4x1yiPMeiHryeDwAfTXGDYYFm8PTQ99Lj4ARG1KQZT/w8kqHkNnWbdVqHRacdTxlD3Ew 9heU40sqWT6xkLANbmPs4xjTKRBFPuDLaYEnewnUePjy0mPmM7utujmYc5uLZawP1Um3 EjaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FDVEh4zH; 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-20020ac85bcf000000b003fdeb6b4fd5si4769559qtb.766.2023.08.21.06.01.53 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 21 Aug 2023 06:01:54 -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=FDVEh4zH; 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 1qY4XE-0000xO-AQ; Mon, 21 Aug 2023 09:01:34 -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 1qY4Wg-0000bn-0V for qemu-devel@nongnu.org; Mon, 21 Aug 2023 09:01:06 -0400 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qY4Wc-0001Hh-Tm for qemu-devel@nongnu.org; Mon, 21 Aug 2023 09:00:57 -0400 Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-3fe1fc8768aso31570735e9.1 for ; Mon, 21 Aug 2023 06:00:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1692622852; x=1693227652; 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=bDgVnseA0w8JiDAxdtmtFg9qt15KV6UaIIai4w2k7Xg=; b=FDVEh4zH8GeP0/8eBgf5CykUO0Yp1ptm6znb1gPdw4ixd0DOaoNkX342NhyPRavrLT W3scMVfLLEo3Lkny4xjrp2rbRVz8oh37/3azi9cag4KwsYy91LDKHw/HCq+PDoFynwnS cfJVk7cELsey1WGe1/MfJBjB9/xMknlxIF+cnWT0d9AcmZ9CsjosRvlPXx2A0N64D/km FTM9Sec0yg2tW1ZpjWU/iGZha5yfSBjzsW1sLfbqTLzg1ihQdJR62pa6wso+QTGP1qsB 2g9cN/rfjBgC4kTEWCBz/jFuKiQSuoSHDpb8h3O+VHOfmvnXsrP38l5uNBeNRQn3VSJm 20+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692622852; x=1693227652; 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=bDgVnseA0w8JiDAxdtmtFg9qt15KV6UaIIai4w2k7Xg=; b=f1VI4ClqaYTJj881sgdSDfxQoiGEaufkTk/s5UVT1yx42vlDdZVGeycw7vpeLb3NuJ e5l0potJW8emzwnGATU3sAMWh/MeFYvo0I72f+VagpjBAjzGwVVsp9TodN2yco4v6jr3 V0O2w+hqmQcBOlEw6C9spL4a5rTqfxb8pKZwR/jVFRz1AndI1XsEqtzBKBh0yiPyzpCu PewT5cbqEWN5UxqwMyBVKbc9P93YcQPJ2WsYIrEPcNWo69PUvzW6fVrIEfwt1bCQiTD8 yKqiyV2i2ytKCE7GumK4LeftjsJaHcLjeK6k3h30zMBQ3QoyyJg6MD9qW5nsfld67aZK o/mg== X-Gm-Message-State: AOJu0Yz8f2tnDH+aaOWvl5kqhl2IYFSNJUy5bTJOerK3VHdd8BnUbVKH imNqHyxX4Evn6qskGK2yBdHZ+MGx+y2Hdbd2yig= X-Received: by 2002:a5d:6a02:0:b0:31a:e612:ae04 with SMTP id m2-20020a5d6a02000000b0031ae612ae04mr4847076wru.31.1692622851813; Mon, 21 Aug 2023 06:00:51 -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 x9-20020adfffc9000000b00319756d5b80sm12575680wrs.29.2023.08.21.06.00.50 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 21 Aug 2023 06:00:51 -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 8/8] target/loongarch: Add GDB support for loongarch32 mode Date: Mon, 21 Aug 2023 14:59:59 +0200 Message-ID: <20230821125959.28666-9-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::334; envelope-from=philmd@linaro.org; helo=mail-wm1-x334.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 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 556419f159..822f2a72e5 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 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +