From patchwork Sun Dec 22 23:40:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiaxun Yang X-Patchwork-Id: 13918317 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 33B6DE77188 for ; Sun, 22 Dec 2024 23:41:27 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tPVYy-0000L3-Ez; Sun, 22 Dec 2024 18:40:45 -0500 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 1tPVYn-0000JO-C3 for qemu-devel@nongnu.org; Sun, 22 Dec 2024 18:40:33 -0500 Received: from fout-a7-smtp.messagingengine.com ([103.168.172.150]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tPVYl-0006BH-8T for qemu-devel@nongnu.org; Sun, 22 Dec 2024 18:40:33 -0500 Received: from phl-compute-11.internal (phl-compute-11.phl.internal [10.202.2.51]) by mailfout.phl.internal (Postfix) with ESMTP id 5D074138015F; Sun, 22 Dec 2024 18:40:29 -0500 (EST) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-11.internal (MEProxy); Sun, 22 Dec 2024 18:40:29 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=flygoat.com; h= cc:cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm3; t=1734910829; x=1734997229; bh=Fqcq7mm54RnYVYakDA1tBHL/YZxGrFp1d66a1ou16Kc=; b= bv48mN1GgRf9QFVwezUlVb0bOGCMRXAYC6tZSK5y2oWG6yBLpRe0bR8WJ3JlcKYQ KftzHfUauJxeMgGlYuVOceTEpPh61Nji8iVyUwmy42f/R9v6rbTceoO6saw5ei8u DqkTtovkyOaHbg0kkIVAU5blShmzNqoI2/XfEkvsLpYIo4FBK2dZM8uuGJNkIev+ +qUnl4MnmIw6L2Wd42a1JTxc8Jil2TDMnI5qrGuaXfol8Ojd00+kll9KzR5jss3W FCP/2a54Ci9M8J8/BUBa8eEJftQHxlF2yF8Md4PFCnjNTKQpKL3VKvSPyFotIdgd gN66ZpikPiSRQ+sEQrDU+A== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1734910829; x= 1734997229; bh=Fqcq7mm54RnYVYakDA1tBHL/YZxGrFp1d66a1ou16Kc=; b=V vQg/5K64ISezYS1ezd83PtKHjxs8HxrwcjycvWirZpPygtHaq/zWqUdbywXB/SZR 0sE7LB5pdKBOf/kvHBzkD8YTRfToyo4GzYe+sDb8fyEiX0I4GeoZS94FQRBiMtlF nWVjOYoV1bly2J10mmtV4ZdJmO6AjsUuBCKhdICf+TJqrWHbVYBdaCaSF0iR30Fd UeUteWZSJMyr8VaOvbQSa2TmBvBNbl6mW5wQZ/4SX6zBbNgwx32oNbr9CuIqhTQs 8fCeYuQG0Xkij9hN08yqeevE3Ubx/qwa5LVPviJ60R/IA1FkXswmylTdYueOWbmP esSbNv6BSknAELkRdOztg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddruddtledguddvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnh htshculddquddttddmnecujfgurhephfffufggtgfgkfhfjgfvvefosehtjeertdertdej necuhfhrohhmpeflihgrgihunhcujggrnhhguceojhhirgiguhhnrdihrghnghesfhhlhi hgohgrthdrtghomheqnecuggftrfgrthhtvghrnhepvdekiefhfeevkeeuveetfeelffek gedugefhtdduudeghfeuveegffegudekjeelnecuvehluhhsthgvrhfuihiivgeptdenuc frrghrrghmpehmrghilhhfrhhomhepjhhirgiguhhnrdihrghnghesfhhlhihgohgrthdr tghomhdpnhgspghrtghpthhtohepfedpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtoh epqhgvmhhuqdguvghvvghlsehnohhnghhnuhdrohhrghdprhgtphhtthhopehjihgrgihu nhdrhigrnhhgsehflhihghhorghtrdgtohhmpdhrtghpthhtohepghgrohhsohhngheslh hoohhnghhsohhnrdgtnh X-ME-Proxy: Feedback-ID: ifd894703:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 22 Dec 2024 18:40:28 -0500 (EST) From: Jiaxun Yang Date: Sun, 22 Dec 2024 23:40:25 +0000 Subject: [PATCH 1/3] target/loongarch: Enable rotr.w/rotri.w for LoongArch32 MIME-Version: 1.0 Message-Id: <20241222-la32-fixes1-v1-1-8c62b7e594db@flygoat.com> References: <20241222-la32-fixes1-v1-0-8c62b7e594db@flygoat.com> In-Reply-To: <20241222-la32-fixes1-v1-0-8c62b7e594db@flygoat.com> To: qemu-devel@nongnu.org Cc: Song Gao , Jiaxun Yang X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1885; i=jiaxun.yang@flygoat.com; h=from:subject:message-id; bh=2VUWVkFWQi0x23wCvKOUTz7tKvfz5U3tOhLI7LG7rEw=; b=owGbwMvMwCXmXMhTe71c8zDjabUkhvSMxVlvKl2WXBGOrtn0riFm0tkNhWIuFrPNLjSVLZ6yX LjoxJqejlIWBjEuBlkxRZYQAaW+DY0XF1x/kPUHZg4rE8gQBi5OAZhIXTrD/xCTudLrTfef35ep yxjxdOPU5fvvlJy+/17ri1KPSh7Hs70M/z0MW9VbOgUXugrz2Zzul/jW9Orxu1XGWZ9uLGA39jR s4gYA X-Developer-Key: i=jiaxun.yang@flygoat.com; a=openpgp; fpr=980379BEFEBFBF477EA04EF9C111949073FC0F67 Received-SPF: pass client-ip=103.168.172.150; envelope-from=jiaxun.yang@flygoat.com; helo=fout-a7-smtp.messagingengine.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org As per "LoongArch Reference Manual Volume 1: Basic Architecture" v1.1.0, "2.2 Table 2. Application-level basic integer instructions in LA32", rotr.w and rotri.w is a part of LA32 basic integer instructions. Make it available to ALL. Signed-off-by: Jiaxun Yang --- target/loongarch/tcg/insn_trans/trans_shift.c.inc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/loongarch/tcg/insn_trans/trans_shift.c.inc b/target/loongarch/tcg/insn_trans/trans_shift.c.inc index 377307785aab4837bc181f1691632e7970a9889d..136c4c845527f0e63902a8306dcaf136dd4dd3fc 100644 --- a/target/loongarch/tcg/insn_trans/trans_shift.c.inc +++ b/target/loongarch/tcg/insn_trans/trans_shift.c.inc @@ -78,7 +78,7 @@ TRANS(sra_w, ALL, gen_rrr, EXT_SIGN, EXT_NONE, EXT_SIGN, gen_sra_w) TRANS(sll_d, 64, gen_rrr, EXT_NONE, EXT_NONE, EXT_NONE, gen_sll_d) TRANS(srl_d, 64, gen_rrr, EXT_NONE, EXT_NONE, EXT_NONE, gen_srl_d) TRANS(sra_d, 64, gen_rrr, EXT_NONE, EXT_NONE, EXT_NONE, gen_sra_d) -TRANS(rotr_w, 64, gen_rrr, EXT_ZERO, EXT_NONE, EXT_SIGN, gen_rotr_w) +TRANS(rotr_w, ALL, gen_rrr, EXT_ZERO, EXT_NONE, EXT_SIGN, gen_rotr_w) TRANS(rotr_d, 64, gen_rrr, EXT_NONE, EXT_NONE, EXT_NONE, gen_rotr_d) TRANS(slli_w, ALL, gen_rri_c, EXT_NONE, EXT_SIGN, tcg_gen_shli_tl) TRANS(slli_d, 64, gen_rri_c, EXT_NONE, EXT_NONE, tcg_gen_shli_tl) @@ -86,5 +86,5 @@ TRANS(srli_w, ALL, gen_rri_c, EXT_ZERO, EXT_SIGN, tcg_gen_shri_tl) TRANS(srli_d, 64, gen_rri_c, EXT_NONE, EXT_NONE, tcg_gen_shri_tl) TRANS(srai_w, ALL, gen_rri_c, EXT_NONE, EXT_NONE, gen_sari_w) TRANS(srai_d, 64, gen_rri_c, EXT_NONE, EXT_NONE, tcg_gen_sari_tl) -TRANS(rotri_w, 64, gen_rri_v, EXT_NONE, EXT_NONE, gen_rotr_w) +TRANS(rotri_w, ALL, gen_rri_v, EXT_NONE, EXT_NONE, gen_rotr_w) TRANS(rotri_d, 64, gen_rri_c, EXT_NONE, EXT_NONE, tcg_gen_rotri_tl) From patchwork Sun Dec 22 23:40:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiaxun Yang X-Patchwork-Id: 13918320 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 359D7E7718D for ; Sun, 22 Dec 2024 23:41:27 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tPVYr-0000Ju-PV; Sun, 22 Dec 2024 18:40:38 -0500 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 1tPVYn-0000JP-CE for qemu-devel@nongnu.org; Sun, 22 Dec 2024 18:40:33 -0500 Received: from fhigh-a2-smtp.messagingengine.com ([103.168.172.153]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tPVYl-0006BO-8a for qemu-devel@nongnu.org; Sun, 22 Dec 2024 18:40:33 -0500 Received: from phl-compute-06.internal (phl-compute-06.phl.internal [10.202.2.46]) by mailfhigh.phl.internal (Postfix) with ESMTP id 696A31140170; Sun, 22 Dec 2024 18:40:30 -0500 (EST) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-06.internal (MEProxy); Sun, 22 Dec 2024 18:40:30 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=flygoat.com; h= cc:cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm3; t=1734910830; x=1734997230; bh=wnJHyNacr/JaVXjVhPEC6VlvfjB69COxs2lNV3a+Y3k=; b= cmyyQBoPaBOaAE7F8Mrnc7bN3sG6knj2xlako8RXF1epu+QJ3/RRQzGfkrXTE0CX 973U+gAR6bBCKCNgp8T9g/wp0Gzj8HLl6B6Jfa0W295/jOWEAgoCZgeyQhlj4Udx DrtmLSphMRSkCZjiH/ITxF2iFZ/DUz4GcYOPGwiIlHlstuPrswx0C6wSPXcpRO1S EWMft7w29+t+oWfeefJ9MKLfQqzTeO2W5NFkzGLRGUuiPcvxDSx36jgCm2XLIaSh EM8ocbclp3yfk0KT5YAZuW06kFVii0kfawWL4+9Fj64s80sXRkGTuaEcLqE9nPMD na+eTPXJAwe7CpwMR0udxA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1734910830; x= 1734997230; bh=wnJHyNacr/JaVXjVhPEC6VlvfjB69COxs2lNV3a+Y3k=; b=D yXwi2wSuY/sZqJB4pNpabfmPluZMstuIyNe9GSmgPri0/G8zM7PJcfs8wInUsQOc 7uNTgesye+lwbDWw3KQekf6JlMqeGCV1wP4KoYUKG7aigq8m/YNuWoFfwueK1A88 6AtXlABW/lE1dmNhjqrK9r/pS4vZ4MAYYYjMGru+1x750nWghh49Uqmeud695/Pr cGtpC11Rq114HNkr4u0UG3jetEJUi2Kk67KJwsot48TizTj7ulooo7JZk8aXAi1n C+AngW10lUVp2rhK3YpZk9TGCI2z07h4OfosH81FJC3AjaxJ5BKHaa9Aw0mXSnAj AoJEnyLdExnPrh/2vS10w== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddruddtledgudefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnh htshculddquddttddmnecujfgurhephfffufggtgfgkfhfjgfvvefosehtjeertdertdej necuhfhrohhmpeflihgrgihunhcujggrnhhguceojhhirgiguhhnrdihrghnghesfhhlhi hgohgrthdrtghomheqnecuggftrfgrthhtvghrnhepvdekiefhfeevkeeuveetfeelffek gedugefhtdduudeghfeuveegffegudekjeelnecuvehluhhsthgvrhfuihiivgeptdenuc frrghrrghmpehmrghilhhfrhhomhepjhhirgiguhhnrdihrghnghesfhhlhihgohgrthdr tghomhdpnhgspghrtghpthhtohepfedpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtoh epqhgvmhhuqdguvghvvghlsehnohhnghhnuhdrohhrghdprhgtphhtthhopehjihgrgihu nhdrhigrnhhgsehflhihghhorghtrdgtohhmpdhrtghpthhtohepghgrohhsohhngheslh hoohhnghhsohhnrdgtnh X-ME-Proxy: Feedback-ID: ifd894703:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 22 Dec 2024 18:40:29 -0500 (EST) From: Jiaxun Yang Date: Sun, 22 Dec 2024 23:40:26 +0000 Subject: [PATCH 2/3] target/loongarch: Fix LLSC for LoongArch32 MIME-Version: 1.0 Message-Id: <20241222-la32-fixes1-v1-2-8c62b7e594db@flygoat.com> References: <20241222-la32-fixes1-v1-0-8c62b7e594db@flygoat.com> In-Reply-To: <20241222-la32-fixes1-v1-0-8c62b7e594db@flygoat.com> To: qemu-devel@nongnu.org Cc: Song Gao , Jiaxun Yang X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1603; i=jiaxun.yang@flygoat.com; h=from:subject:message-id; bh=OtFGtow9PzLmAd3ZSoPdl+J0IhcJdBLYWcZAIb5YQIg=; b=owGbwMvMwCXmXMhTe71c8zDjabUkhvSMxVmtnO0uK/p9vliz3Wk9tHdTZlKK6Z9t2xayyyYUb eHquMzcUcrCIMbFICumyBIioNS3ofHigusPsv7AzGFlAhnCwMUpABPZJMLwT+HYwvCutzNq9nk/ 8/5etGu9tsNbze89T+dNzDB3yKx8sJfhn6pIcIW/RfA9Xg3LzDzGwIyLxqI/I09s+LtXjuPS2tO 9vAA= X-Developer-Key: i=jiaxun.yang@flygoat.com; a=openpgp; fpr=980379BEFEBFBF477EA04EF9C111949073FC0F67 Received-SPF: pass client-ip=103.168.172.153; envelope-from=jiaxun.yang@flygoat.com; helo=fhigh-a2-smtp.messagingengine.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org gen_ll should use tcg_gen_qemu_ld_tl to load t1, as t1 is in TCGv which means it should be a tl type value. gen_sc should use make_address_i to obtain source address to ensure that address is properly truncated. Signed-off-by: Jiaxun Yang --- target/loongarch/tcg/insn_trans/trans_atomic.c.inc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/target/loongarch/tcg/insn_trans/trans_atomic.c.inc b/target/loongarch/tcg/insn_trans/trans_atomic.c.inc index 974bc2a70feddbf021a07b19a0859781eb3a11c4..4607f19b003ae70e5ca1e5b56b174bd7696d54cd 100644 --- a/target/loongarch/tcg/insn_trans/trans_atomic.c.inc +++ b/target/loongarch/tcg/insn_trans/trans_atomic.c.inc @@ -9,7 +9,7 @@ static bool gen_ll(DisasContext *ctx, arg_rr_i *a, MemOp mop) TCGv src1 = gpr_src(ctx, a->rj, EXT_NONE); TCGv t0 = make_address_i(ctx, src1, a->imm); - tcg_gen_qemu_ld_i64(t1, t0, ctx->mem_idx, mop); + tcg_gen_qemu_ld_tl(t1, t0, ctx->mem_idx, mop); tcg_gen_st_tl(t0, tcg_env, offsetof(CPULoongArchState, lladdr)); tcg_gen_st_tl(t1, tcg_env, offsetof(CPULoongArchState, llval)); gen_set_gpr(a->rd, t1, EXT_NONE); @@ -28,7 +28,8 @@ static bool gen_sc(DisasContext *ctx, arg_rr_i *a, MemOp mop) TCGLabel *l1 = gen_new_label(); TCGLabel *done = gen_new_label(); - tcg_gen_addi_tl(t0, src1, a->imm); + tcg_gen_mov_tl(t0, src1); + t0 = make_address_i(ctx, t0, a->imm); tcg_gen_brcond_tl(TCG_COND_EQ, t0, cpu_lladdr, l1); tcg_gen_movi_tl(dest, 0); tcg_gen_br(done); From patchwork Sun Dec 22 23:40:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiaxun Yang X-Patchwork-Id: 13918319 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 30FAFE7718E for ; Sun, 22 Dec 2024 23:41:28 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tPVYy-0000L7-Eo; Sun, 22 Dec 2024 18:40:45 -0500 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 1tPVYr-0000Jw-7B for qemu-devel@nongnu.org; Sun, 22 Dec 2024 18:40:37 -0500 Received: from fout-a7-smtp.messagingengine.com ([103.168.172.150]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tPVYm-0006BS-7J for qemu-devel@nongnu.org; Sun, 22 Dec 2024 18:40:36 -0500 Received: from phl-compute-02.internal (phl-compute-02.phl.internal [10.202.2.42]) by mailfout.phl.internal (Postfix) with ESMTP id ACA7F13801AD; Sun, 22 Dec 2024 18:40:31 -0500 (EST) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-02.internal (MEProxy); Sun, 22 Dec 2024 18:40:31 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=flygoat.com; h= cc:cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm3; t=1734910831; x=1734997231; bh=7cTwzH7RtaLWxerE/3oHVhOon4cSx5BIeYCAgA/5kJk=; b= lCjypm0UvXvpS7HYklL1J/MtXxkvvclFBwFNrSZ8hsR2YA+RPJZVOBHAEMJaXmwy ou3i/I6bzZQ9RcrmaYJBjTBVXSawZ+KkxztZVSPu3iQRVcuLTtK6RpQ3nDWCOhtk 856VRSpgR+KCIzHPcqIUwkU4sUFP7jO6yP4rdD4QlE4lA6tBgz8trBlc67SzvL9o /7cYM77q7Bv6e1lZYmLxxC7mcDVc/XVMVNJUUOD3/8Uddbpr3FGmRYXRVYEfPso0 z2NAAoqYVBL38qzxZtw6vaAPpNhtHvEoc9FJShRN5Fvr5RgP6/w2ZyM5nKFAz6lT YPP510AFcZ3BMdfRPWc3WQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1734910831; x= 1734997231; bh=7cTwzH7RtaLWxerE/3oHVhOon4cSx5BIeYCAgA/5kJk=; b=v R8ed9WDV8BJqD74DR+7F4hqkgoDmZFHsj+bIK/vZ9wFbssloRD+xLh9LpL7Yqpgj gmUjI9ZhTMH8vBWK6OdwPWa8h39fAfLtxQlTL890BMuhFrbNB9TPRkABUgba0seS eKRsf1Xcq7XLkNVLUeSpbCmfcPr1rg/XhJc/1cWMFkqBt/Qk0oYjnkJg7+HLk9o/ SYO22b7240lzj+LCgoTBqRQ7/BICOtQ0bITq5LHWBaLYtDGmBbiMmm1xeD97emyU FKVwBLi9Y9JxiBqG9uja3E1fqhLS0Grf6jzi8Ri/WXiUZUnNjKNoCKcIeDE7PRBg 3REIJRsG/7meDDp+cjz0w== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddruddtledguddvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnh htshculddquddttddmnecujfgurhephfffufggtgfgkfhfjgfvvefosehtjeertdertdej necuhfhrohhmpeflihgrgihunhcujggrnhhguceojhhirgiguhhnrdihrghnghesfhhlhi hgohgrthdrtghomheqnecuggftrfgrthhtvghrnhepvdekiefhfeevkeeuveetfeelffek gedugefhtdduudeghfeuveegffegudekjeelnecuvehluhhsthgvrhfuihiivgeptdenuc frrghrrghmpehmrghilhhfrhhomhepjhhirgiguhhnrdihrghnghesfhhlhihgohgrthdr tghomhdpnhgspghrtghpthhtohepfedpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtoh epqhgvmhhuqdguvghvvghlsehnohhnghhnuhdrohhrghdprhgtphhtthhopehjihgrgihu nhdrhigrnhhgsehflhihghhorghtrdgtohhmpdhrtghpthhtohepghgrohhsohhngheslh hoohhnghhsohhnrdgtnh X-ME-Proxy: Feedback-ID: ifd894703:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 22 Dec 2024 18:40:30 -0500 (EST) From: Jiaxun Yang Date: Sun, 22 Dec 2024 23:40:27 +0000 Subject: [PATCH 3/3] target/loongarch: Fix PGD CSR for LoongArch32 MIME-Version: 1.0 Message-Id: <20241222-la32-fixes1-v1-3-8c62b7e594db@flygoat.com> References: <20241222-la32-fixes1-v1-0-8c62b7e594db@flygoat.com> In-Reply-To: <20241222-la32-fixes1-v1-0-8c62b7e594db@flygoat.com> To: qemu-devel@nongnu.org Cc: Song Gao , Jiaxun Yang X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=891; i=jiaxun.yang@flygoat.com; h=from:subject:message-id; bh=HMr2rCyjGnWHqISfDv+dvbEaVA1bYvHdaH0R/IQObZI=; b=owGbwMvMwCXmXMhTe71c8zDjabUkhvSMxVnTV7WuX3a2ev0C24dKP7W6HU+um8Z7amoPz4OYA 00M2/6t6yhlYRDjYpAVU2QJEVDq29B4ccH1B1l/YOawMoEMYeDiFICJ7GdlZHh+5X6W+rutJq+2 ZTzy/xVbl2m2UXbC9z0/vsjKzQ5lMbJj+J/eKCf0y/6tyJtzEarcPKadG1eFRMxzMUvb4LxRe/X 6dC4A X-Developer-Key: i=jiaxun.yang@flygoat.com; a=openpgp; fpr=980379BEFEBFBF477EA04EF9C111949073FC0F67 Received-SPF: pass client-ip=103.168.172.150; envelope-from=jiaxun.yang@flygoat.com; helo=fout-a7-smtp.messagingengine.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org As per manual, the source of PGD CSR is relevant to highest bit of BADV. In LoongArch32, all CSRs are 32 bits only, thus we should check bit 31 of BADV to determine PGDH/PGDL for LoongArch32. Signed-off-by: Jiaxun Yang --- target/loongarch/tcg/csr_helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/loongarch/tcg/csr_helper.c b/target/loongarch/tcg/csr_helper.c index 15f94caefabc7722263fa46e948e21de37b4203c..ca8100eedfb37fd3b45b3de0c0fc0fad599c4685 100644 --- a/target/loongarch/tcg/csr_helper.c +++ b/target/loongarch/tcg/csr_helper.c @@ -26,7 +26,7 @@ target_ulong helper_csrrd_pgd(CPULoongArchState *env) v = env->CSR_BADV; } - if ((v >> 63) & 0x1) { + if (v >> (is_la64(env) ? 63 : 31) & 0x1) { v = env->CSR_PGDH; } else { v = env->CSR_PGDL;