From patchwork Thu Dec 26 21:19:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiaxun Yang X-Patchwork-Id: 13921433 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 4EDC9E77188 for ; Thu, 26 Dec 2024 21:21:02 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tQvGp-0003dc-DK; Thu, 26 Dec 2024 16:19:51 -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 1tQvGn-0003ck-0B for qemu-devel@nongnu.org; Thu, 26 Dec 2024 16:19:49 -0500 Received: from fout-a1-smtp.messagingengine.com ([103.168.172.144]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tQvGl-0002vv-HU for qemu-devel@nongnu.org; Thu, 26 Dec 2024 16:19:48 -0500 Received: from phl-compute-05.internal (phl-compute-05.phl.internal [10.202.2.45]) by mailfout.phl.internal (Postfix) with ESMTP id B907213801C7; Thu, 26 Dec 2024 16:19:45 -0500 (EST) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-05.internal (MEProxy); Thu, 26 Dec 2024 16:19:45 -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=1735247985; x=1735334385; bh=J5Os7FcfxuL0lY+KefWBE+pEYPFluDZ4pINxkioG6GM=; b= dQCa1fS/mmuwJjQslVjZj3ymp10szoAZi278yjEsjYn3h2n0MJO4M+T9pDitiyc4 UXV7Mbrw30TqT5yQXn0/wO8b77HiGYbg1f2xzInm5flXe90VP8eMLLcQfWG2kEpR AKUCKrPGFUQ3cN18CbBHnTRd8FFL266QQ+N+4Vy8cczCWuq8VnLKhWjpG8zmdcT9 6QJILRAIuLYpprnuk2W+ekQs/pOmWJraF1J7Z1rw2BNITydZPJy+7pcE0Bzh1dKa 2VtjNQy1nBjVB4mfhEWIWoB4litTAuvvRyYiYECRVjnz7nqS5Wum3fM6hh3y8PL6 8szWP0D1FpFpFh1D7/lyZw== 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=1735247985; x= 1735334385; bh=J5Os7FcfxuL0lY+KefWBE+pEYPFluDZ4pINxkioG6GM=; b=a 0y6bbBZPX+peVBnlRzoYZ5d+z3yN3A4lO019lICeNdW5BZXYEA+AEF/t5u+VZpyA vu9zRsDPd6y0gsiIMQ41RXE4cDe4DOekFdckmP0kzuDelxDIUDq3NsmdIrFeqQO0 dJghXIr1f4VKZ/SbppTALj7IsybCycDi8sfIXQuZ1J2jug+j66JgLEIZfrmXA+if +rs3xGKriNwmouJcvr6nN032KA6bHW9teT84sJLWKeMJODB3bNASyjHsXVAiDm0D PaEd6XVfplydyDh/JpkdoKwJHzx34A7Z2Y7SsqRTZbjSaLynUqm1gBdyLGQ+Gi81 ZaU3ShJbC5JJeAIBNyzmw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddruddukedgudegjecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdp uffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivg hnthhsucdlqddutddtmdenucfjughrpefhfffugggtgffkfhgjvfevofesthejredtredt jeenucfhrhhomheplfhirgiguhhnucgjrghnghcuoehjihgrgihunhdrhigrnhhgsehflh ihghhorghtrdgtohhmqeenucggtffrrghtthgvrhhnpedvkeeihfefveekueevteefleff keegudeghfdtuddugefhueevgeffgedukeejleenucevlhhushhtvghrufhiiigvpedtne curfgrrhgrmhepmhgrihhlfhhrohhmpehjihgrgihunhdrhigrnhhgsehflhihghhorght rdgtohhmpdhnsggprhgtphhtthhopeduvddpmhhouggvpehsmhhtphhouhhtpdhrtghpth htohepmhgrohgsihgsoheslhhoohhnghhsohhnrdgtnhdprhgtphhtthhopehmrghrtggv lhdrrghpfhgvlhgsrghumhesghhmrghilhdrtghomhdprhgtphhtthhopehpsghonhiiih hnihesrhgvughhrghtrdgtohhmpdhrtghpthhtohepghgrohhsohhngheslhhoohhnghhs ohhnrdgtnhdprhgtphhtthhopegvsghlrghkvgesrhgvughhrghtrdgtohhmpdhrtghpth htohepjhhirgiguhhnrdihrghnghesfhhlhihgohgrthdrtghomhdprhgtphhtthhopehq vghmuhdquggvvhgvlhesnhhonhhgnhhurdhorhhgpdhrtghpthhtohepfigrnhhghigrnh grnhehheeshhhurgifvghirdgtohhmpdhrtghpthhtohepiihhrghouddrlhhiuhesihhn thgvlhdrtghomh X-ME-Proxy: Feedback-ID: ifd894703:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 26 Dec 2024 16:19:43 -0500 (EST) From: Jiaxun Yang Date: Thu, 26 Dec 2024 21:19:32 +0000 Subject: [PATCH v2 01/23] target/loongarch: Enable rotr.w/rotri.w for LoongArch32 MIME-Version: 1.0 Message-Id: <20241226-la32-fixes1-v2-1-0414594f8cb5@flygoat.com> References: <20241226-la32-fixes1-v2-0-0414594f8cb5@flygoat.com> In-Reply-To: <20241226-la32-fixes1-v2-0-0414594f8cb5@flygoat.com> To: qemu-devel@nongnu.org Cc: Song Gao , Bibo Mao , Eric Blake , Markus Armbruster , Eduardo Habkost , Marcel Apfelbaum , =?utf-8?q?Philippe_Mathieu-?= =?utf-8?q?Daud=C3=A9?= , Yanan Wang , Zhao Liu , Paolo Bonzini , Jiaxun Yang X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=2013; i=jiaxun.yang@flygoat.com; h=from:subject:message-id; bh=BoEFL5mTmPnLaZ8ShfI5yw4/wyM2it5eCmOUPeHemfM=; b=owGbwMvMwCXmXMhTe71c8zDjabUkhvTcE9lulrLmE1bNce6cUu5StcvfXzb92MdUBpM9+7Y2x km8fJvTUcrCIMbFICumyBIioNS3ofHigusPsv7AzGFlAhnCwMUpABNJ28XIsMvoxuRbM7f8rgub 1f1ZNXGySYw20yXnWU1/axWsp/F+vMvwm/0r5yFDvypFH5f3G3cZ+AVlr9p9iytSe9nMzkOCuw4 dZwAA X-Developer-Key: i=jiaxun.yang@flygoat.com; a=openpgp; fpr=980379BEFEBFBF477EA04EF9C111949073FC0F67 Received-SPF: pass client-ip=103.168.172.144; envelope-from=jiaxun.yang@flygoat.com; helo=fout-a1-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_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_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. Note that those instructions are indeed not in LA32R subset, however QEMU is not performing any check against LA32R so far. Make it available to ALL. Signed-off-by: Jiaxun Yang Reviewed-by: Richard Henderson --- 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 Thu Dec 26 21:19:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiaxun Yang X-Patchwork-Id: 13921430 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 108D2E77188 for ; Thu, 26 Dec 2024 21:20:25 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tQvGp-0003de-UV; Thu, 26 Dec 2024 16:19:51 -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 1tQvGo-0003dI-6G for qemu-devel@nongnu.org; Thu, 26 Dec 2024 16:19:50 -0500 Received: from fhigh-a4-smtp.messagingengine.com ([103.168.172.155]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tQvGm-0002w8-AQ for qemu-devel@nongnu.org; Thu, 26 Dec 2024 16:19:49 -0500 Received: from phl-compute-05.internal (phl-compute-05.phl.internal [10.202.2.45]) by mailfhigh.phl.internal (Postfix) with ESMTP id AE62B1140114; Thu, 26 Dec 2024 16:19:47 -0500 (EST) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-05.internal (MEProxy); Thu, 26 Dec 2024 16:19:47 -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=1735247987; x=1735334387; bh=HzRGBpSsuGYsqp1nebQkdwxhC9+0p8sAf3ZNP4r9fJ8=; b= HlSqOc/RYxOZROJoNPzXNZPzoGV3Rv3dMvP4Wm/Oq/qDDQoQEnMs/iEudIYq3JQW fkj0D1yn1sfwmJztwo8xPPzQGWgrv3qlb/ykP1tJa/yYCmsjUZjIS3tfcEYjwgs6 9QOznPXQC5gaFxaB3GZf80wyRAVV1qQDhYITSRv3k05IFU/lRCMDyENyAH2RC344 +nu6oy9Yb/S5UZLWt4qnr3+gCAQ4pYuW8EvFLV6+8qGvXeE3tUI/CgaTTHh2nuVR T5AbUdmeJw2SGu4PzNKSUDxZemZ4ZKPMaCErhQ62z1yv4c0sAEQKwHusP1M/K80Y 07DdpsbLgtpAW6cl+BcHGg== 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=1735247987; x= 1735334387; bh=HzRGBpSsuGYsqp1nebQkdwxhC9+0p8sAf3ZNP4r9fJ8=; b=Z 0HpOQO4e8Litvp47IYfxq5AIqMs9NC2gBAzKcEIzCN0ffNf87KWpbTnBt+JBHj45 kbdbi81fX3Rf7R4YonIJfdSiWmXxz7qig5fr8azx8znq2i8brzzIHYXf7nremc+L 7heF7N/uMXwUaGMduP0dshkAS7rHe9B3klkh1PyUTMW+1bayPWbCxlu55qaBg6cX e4ymMKYwOqyl2nuBr13JCKMFBls5lflVH4Yfiqez8O9nBYpRdotKt7S5IHwQ0IGt /4suikVVltoTgMyb1bYhnYOp7K5RIljeq96AlG81w/kk00yk49PnFObD8kQaFqrg 54InmLhwyjihX/AtjYufg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddruddukedgudegjecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdp uffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivg hnthhsucdlqddutddtmdenucfjughrpefhfffugggtgffkfhgjvfevofesthejredtredt jeenucfhrhhomheplfhirgiguhhnucgjrghnghcuoehjihgrgihunhdrhigrnhhgsehflh ihghhorghtrdgtohhmqeenucggtffrrghtthgvrhhnpedvkeeihfefveekueevteefleff keegudeghfdtuddugefhueevgeffgedukeejleenucevlhhushhtvghrufhiiigvpedune curfgrrhgrmhepmhgrihhlfhhrohhmpehjihgrgihunhdrhigrnhhgsehflhihghhorght rdgtohhmpdhnsggprhgtphhtthhopeduvddpmhhouggvpehsmhhtphhouhhtpdhrtghpth htohepmhgrohgsihgsoheslhhoohhnghhsohhnrdgtnhdprhgtphhtthhopehmrghrtggv lhdrrghpfhgvlhgsrghumhesghhmrghilhdrtghomhdprhgtphhtthhopehpsghonhiiih hnihesrhgvughhrghtrdgtohhmpdhrtghpthhtohepghgrohhsohhngheslhhoohhnghhs ohhnrdgtnhdprhgtphhtthhopegvsghlrghkvgesrhgvughhrghtrdgtohhmpdhrtghpth htohepjhhirgiguhhnrdihrghnghesfhhlhihgohgrthdrtghomhdprhgtphhtthhopehq vghmuhdquggvvhgvlhesnhhonhhgnhhurdhorhhgpdhrtghpthhtohepfigrnhhghigrnh grnhehheeshhhurgifvghirdgtohhmpdhrtghpthhtohepiihhrghouddrlhhiuhesihhn thgvlhdrtghomh X-ME-Proxy: Feedback-ID: ifd894703:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 26 Dec 2024 16:19:45 -0500 (EST) From: Jiaxun Yang Date: Thu, 26 Dec 2024 21:19:33 +0000 Subject: [PATCH v2 02/23] target/loongarch: Fix address generation for gen_sc MIME-Version: 1.0 Message-Id: <20241226-la32-fixes1-v2-2-0414594f8cb5@flygoat.com> References: <20241226-la32-fixes1-v2-0-0414594f8cb5@flygoat.com> In-Reply-To: <20241226-la32-fixes1-v2-0-0414594f8cb5@flygoat.com> To: qemu-devel@nongnu.org Cc: Song Gao , Bibo Mao , Eric Blake , Markus Armbruster , Eduardo Habkost , Marcel Apfelbaum , =?utf-8?q?Philippe_Mathieu-?= =?utf-8?q?Daud=C3=A9?= , Yanan Wang , Zhao Liu , Paolo Bonzini , Jiaxun Yang X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1715; i=jiaxun.yang@flygoat.com; h=from:subject:message-id; bh=JXml0K3ROVIscLytx9HCnpVchfiE4wBfBikTFNxlvXg=; b=owGbwMvMwCXmXMhTe71c8zDjabUkhvTcE9meQU9vBm/jmtv7TTSD14h5afh17dNHU1e23Yvjm 7GHhSe6o5SFQYyLQVZMkSVEQKlvQ+PFBdcfZP2BmcPKBDKEgYtTACYiIcDI8CU1xf/e5sk1J41n /n2WuvhhYVjpnNu7Y95wZlpnVfYnXmL4n5Facvrdtm1Rh/Vnlhs41UddsLska7le4cv7fTnfxTf 18wMA X-Developer-Key: i=jiaxun.yang@flygoat.com; a=openpgp; fpr=980379BEFEBFBF477EA04EF9C111949073FC0F67 Received-SPF: pass client-ip=103.168.172.155; envelope-from=jiaxun.yang@flygoat.com; helo=fhigh-a4-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_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_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_sc should use make_address_i to obtain source address to ensure that address is properly truncated. Another temp value is created in middle to avoid data corruption as make_address_i may return the same memory location as src1. Signed-off-by: Jiaxun Yang Reviewed-by: Richard Henderson --- target/loongarch/tcg/insn_trans/trans_atomic.c.inc | 4 ++-- 1 file changed, 2 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..c35f6f3ce47877ab6ad84fa2cbc50b46c0b23ad1 100644 --- a/target/loongarch/tcg/insn_trans/trans_atomic.c.inc +++ b/target/loongarch/tcg/insn_trans/trans_atomic.c.inc @@ -22,13 +22,12 @@ static bool gen_sc(DisasContext *ctx, arg_rr_i *a, MemOp mop) TCGv dest = gpr_dst(ctx, a->rd, EXT_NONE); TCGv src1 = gpr_src(ctx, a->rj, EXT_NONE); TCGv src2 = gpr_src(ctx, a->rd, EXT_NONE); - TCGv t0 = tcg_temp_new(); + TCGv t0 = make_address_i(ctx, src1, a->imm); TCGv val = tcg_temp_new(); TCGLabel *l1 = gen_new_label(); TCGLabel *done = gen_new_label(); - tcg_gen_addi_tl(t0, src1, a->imm); tcg_gen_brcond_tl(TCG_COND_EQ, t0, cpu_lladdr, l1); tcg_gen_movi_tl(dest, 0); tcg_gen_br(done); @@ -36,6 +35,7 @@ static bool gen_sc(DisasContext *ctx, arg_rr_i *a, MemOp mop) gen_set_label(l1); tcg_gen_mov_tl(val, src2); /* generate cmpxchg */ + t0 = tcg_temp_new(); tcg_gen_atomic_cmpxchg_tl(t0, cpu_lladdr, cpu_llval, val, ctx->mem_idx, mop); tcg_gen_setcond_tl(TCG_COND_EQ, dest, t0, cpu_llval); From patchwork Thu Dec 26 21:19:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiaxun Yang X-Patchwork-Id: 13921452 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 8682AE77188 for ; Thu, 26 Dec 2024 21:23:39 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tQvGq-0003e5-T4; Thu, 26 Dec 2024 16:19:52 -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 1tQvGq-0003dg-02 for qemu-devel@nongnu.org; Thu, 26 Dec 2024 16:19:52 -0500 Received: from fout-a1-smtp.messagingengine.com ([103.168.172.144]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tQvGo-0002wU-M6 for qemu-devel@nongnu.org; Thu, 26 Dec 2024 16:19:51 -0500 Received: from phl-compute-05.internal (phl-compute-05.phl.internal [10.202.2.45]) by mailfout.phl.internal (Postfix) with ESMTP id BA25813801CA; Thu, 26 Dec 2024 16:19:49 -0500 (EST) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-05.internal (MEProxy); Thu, 26 Dec 2024 16:19:49 -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=1735247989; x=1735334389; bh=S4LKGFTypIdV3P5Y7CtYczPKE/btLEKjM8yejT9DHdU=; b= aa9RTjecAmw1+MPgV4EcIPNERKf9Kqwux9NLIK2qtI0D5YPv2Vl6MIZgvSGEl0dr aNNZW1wmTqBRfinzdAGpSupP0+Eo5Adigef46/qQ1ONjowsfZBtdRT7DDLgPzM7O dVkzo3V01Q7phf1XRByXEdxRmIEn+5qGwlCE9zdQ0+h4fLSGOP4Ck5Nj/hakCjn5 Yqn5dTAxwdz0mX1MY8tmRjcQAKybNTg6/zIkLaYhmNt94GnzuFpRWIE5cMVnMbkX bhH/N966ACYZmdHVsO6t+GDFW8dEdtOA/lruYt5KGPJjGUm+ou5SdLdR0FMWoTFJ bUuPtdZm3fZCaFOi+vRyHw== 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=1735247989; x= 1735334389; bh=S4LKGFTypIdV3P5Y7CtYczPKE/btLEKjM8yejT9DHdU=; b=d yL0X7VTCWfgmJLuAxeDasY7Gs3zNGWRqXQxvihynvrcJI/hPYm/Q2RU8JWhVOL7S dCrmLksbUQZ1A4CZi307LUS8FEX3BqYDuA3NjVHR8+yDpNT7I6tKsNXsfa86dnw4 bSLlp+aAue+dIVQ/O/wW+J81YHBpl4HBlj9j/B9O1au0Vfqa/klJRL53c4MZ0iKw taVpjhtwtOu/ry2a4KTjIdbgm2r4yRua/1aOy5+ktgpOfEK1phMgMDWMWMRNUuw8 deQnxpUTnMqsuXFs2SsN8yeSPUsidQjU7Z8Ge5oP/rT4tqVx8CuqvVF0vc/p5+yB u5TZyynmOPCoIindAKMqQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddruddukedgudegjecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdp uffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivg hnthhsucdlqddutddtmdenucfjughrpefhfffugggtgffkfhgjvfevofesthejredtredt jeenucfhrhhomheplfhirgiguhhnucgjrghnghcuoehjihgrgihunhdrhigrnhhgsehflh ihghhorghtrdgtohhmqeenucggtffrrghtthgvrhhnpedvkeeihfefveekueevteefleff keegudeghfdtuddugefhueevgeffgedukeejleenucevlhhushhtvghrufhiiigvpedune curfgrrhgrmhepmhgrihhlfhhrohhmpehjihgrgihunhdrhigrnhhgsehflhihghhorght rdgtohhmpdhnsggprhgtphhtthhopeduvddpmhhouggvpehsmhhtphhouhhtpdhrtghpth htohepmhgrohgsihgsoheslhhoohhnghhsohhnrdgtnhdprhgtphhtthhopehmrghrtggv lhdrrghpfhgvlhgsrghumhesghhmrghilhdrtghomhdprhgtphhtthhopehpsghonhiiih hnihesrhgvughhrghtrdgtohhmpdhrtghpthhtohepghgrohhsohhngheslhhoohhnghhs ohhnrdgtnhdprhgtphhtthhopegvsghlrghkvgesrhgvughhrghtrdgtohhmpdhrtghpth htohepjhhirgiguhhnrdihrghnghesfhhlhihgohgrthdrtghomhdprhgtphhtthhopehq vghmuhdquggvvhgvlhesnhhonhhgnhhurdhorhhgpdhrtghpthhtohepfigrnhhghigrnh grnhehheeshhhurgifvghirdgtohhmpdhrtghpthhtohepiihhrghouddrlhhiuhesihhn thgvlhdrtghomh X-ME-Proxy: Feedback-ID: ifd894703:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 26 Dec 2024 16:19:47 -0500 (EST) From: Jiaxun Yang Date: Thu, 26 Dec 2024 21:19:34 +0000 Subject: [PATCH v2 03/23] target/loongarch: Fix PGD CSR for LoongArch32 MIME-Version: 1.0 Message-Id: <20241226-la32-fixes1-v2-3-0414594f8cb5@flygoat.com> References: <20241226-la32-fixes1-v2-0-0414594f8cb5@flygoat.com> In-Reply-To: <20241226-la32-fixes1-v2-0-0414594f8cb5@flygoat.com> To: qemu-devel@nongnu.org Cc: Song Gao , Bibo Mao , Eric Blake , Markus Armbruster , Eduardo Habkost , Marcel Apfelbaum , =?utf-8?q?Philippe_Mathieu-?= =?utf-8?q?Daud=C3=A9?= , Yanan Wang , Zhao Liu , Paolo Bonzini , Jiaxun Yang X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=895; i=jiaxun.yang@flygoat.com; h=from:subject:message-id; bh=6C/XW5GxVl4u28OCGxlKZ9TASN0NONQ1NU6nHVutsUw=; b=owGbwMvMwCXmXMhTe71c8zDjabUkhvTcE9lsTzY9PN+sWKFevo9Bd2HitoACKamd7Y2LMyL4O KTmGAV2lLIwiHExyIopsoQIKPVtaLy44PqDrD8wc1iZQIYwcHEKwETmJDAybLBbVvdPP6Fc+HW+ jtSsI9vnsZ/i3HqsftPSeZILr3dd8GRkOBa3Yp70/Oc9qeIbpx868b22ytpW9lHVtfvqyof2cR3 6ygwA X-Developer-Key: i=jiaxun.yang@flygoat.com; a=openpgp; fpr=980379BEFEBFBF477EA04EF9C111949073FC0F67 Received-SPF: pass client-ip=103.168.172.144; envelope-from=jiaxun.yang@flygoat.com; helo=fout-a1-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_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_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..821aa6af46ea2129d771fdc937eca72317cefc1e 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 (extract64(v, is_la64(env) ? 63 : 31, 1)) { v = env->CSR_PGDH; } else { v = env->CSR_PGDL; From patchwork Thu Dec 26 21:19:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiaxun Yang X-Patchwork-Id: 13921449 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 6E7CAE77188 for ; Thu, 26 Dec 2024 21:22:55 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tQvGu-0003ez-7I; Thu, 26 Dec 2024 16:19:56 -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 1tQvGr-0003eR-W6 for qemu-devel@nongnu.org; Thu, 26 Dec 2024 16:19:54 -0500 Received: from fout-a1-smtp.messagingengine.com ([103.168.172.144]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tQvGq-0002wu-AQ for qemu-devel@nongnu.org; Thu, 26 Dec 2024 16:19:53 -0500 Received: from phl-compute-04.internal (phl-compute-04.phl.internal [10.202.2.44]) by mailfout.phl.internal (Postfix) with ESMTP id BFC6513801DC; Thu, 26 Dec 2024 16:19:51 -0500 (EST) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-04.internal (MEProxy); Thu, 26 Dec 2024 16:19:51 -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=1735247991; x=1735334391; bh=Q1Tr4VLCU/aCVt0TUBVkqUl7v2+5x9K5iupl27zw8OA=; b= VN+5o7XhclFJsvjNxxT/vzZtonp9rOFx1Mqth6dzQg0LqFfSCEmnv0V1VvWpl+AX 6Gut7K4Ls4z61K4C47UKf40YxEzRafpudGg4fjDrfigHTEhi3BMgqlfP5WIcfZPs suYLQcBKYzd2SkSIppmOOngBBfcNsoy8ph3LOSJn+eYRInmr98LVvM6b8SR/nVLb j/ejPXH3nUj+UcqVP1IFTsO32xSOLlBnRdKpLUcfs+5CJ/bQMQcrlo77FD8O7+fK vPhXgtfqJ6btcyIuf59iL3AI+PZSLASa8z7Q0zuJRETlYsO1jRfLnt1phEK6QcIu 59Y4++A9cSSA2XlL25GeRg== 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=1735247991; x= 1735334391; bh=Q1Tr4VLCU/aCVt0TUBVkqUl7v2+5x9K5iupl27zw8OA=; b=R G5O2kob2sWTJl2jivootEgbekdqEbOvwHo+DQO3Cqz7oq3h8l/9N4fawQAreSka4 Ukqewz6ibw1M+Xm+wOJ9TnHQxUpaDSGOkkwRV1kKW8p8oHZBJZpSQFRtYX0U37O0 sqoEZDBIwQSKLry6auO3oJtaSkDb2dg5bENH2SK60qgUvVlqyZcWMqRRw73Z/gqK MmmHxVsmoa4uPNRVzY6Zm02wiwQkxApE2m2j5yhk8pbWW3k7/p9SHwZExKyjzbHI v0BsJWyXEK1pUuSInY4+JkNC4GUthG37wRVDd4bVAO0bblHl0O0Ldykzxg4v7YhL ocwCs+fFCC3RvkRxC+l+Q== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddruddukedgudegkecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdp uffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivg hnthhsucdlqddutddtmdenucfjughrpefhfffugggtgffkfhgjvfevofesthejredtredt jeenucfhrhhomheplfhirgiguhhnucgjrghnghcuoehjihgrgihunhdrhigrnhhgsehflh ihghhorghtrdgtohhmqeenucggtffrrghtthgvrhhnpedvkeeihfefveekueevteefleff keegudeghfdtuddugefhueevgeffgedukeejleenucevlhhushhtvghrufhiiigvpedtne curfgrrhgrmhepmhgrihhlfhhrohhmpehjihgrgihunhdrhigrnhhgsehflhihghhorght rdgtohhmpdhnsggprhgtphhtthhopeduvddpmhhouggvpehsmhhtphhouhhtpdhrtghpth htohepmhgrohgsihgsoheslhhoohhnghhsohhnrdgtnhdprhgtphhtthhopehmrghrtggv lhdrrghpfhgvlhgsrghumhesghhmrghilhdrtghomhdprhgtphhtthhopehpsghonhiiih hnihesrhgvughhrghtrdgtohhmpdhrtghpthhtohepghgrohhsohhngheslhhoohhnghhs ohhnrdgtnhdprhgtphhtthhopegvsghlrghkvgesrhgvughhrghtrdgtohhmpdhrtghpth htohepjhhirgiguhhnrdihrghnghesfhhlhihgohgrthdrtghomhdprhgtphhtthhopehq vghmuhdquggvvhgvlhesnhhonhhgnhhurdhorhhgpdhrtghpthhtohepfigrnhhghigrnh grnhehheeshhhurgifvghirdgtohhmpdhrtghpthhtohepiihhrghouddrlhhiuhesihhn thgvlhdrtghomh X-ME-Proxy: Feedback-ID: ifd894703:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 26 Dec 2024 16:19:49 -0500 (EST) From: Jiaxun Yang Date: Thu, 26 Dec 2024 21:19:35 +0000 Subject: [PATCH v2 04/23] target/loongarch: Perform sign extension for IOCSR reads MIME-Version: 1.0 Message-Id: <20241226-la32-fixes1-v2-4-0414594f8cb5@flygoat.com> References: <20241226-la32-fixes1-v2-0-0414594f8cb5@flygoat.com> In-Reply-To: <20241226-la32-fixes1-v2-0-0414594f8cb5@flygoat.com> To: qemu-devel@nongnu.org Cc: Song Gao , Bibo Mao , Eric Blake , Markus Armbruster , Eduardo Habkost , Marcel Apfelbaum , =?utf-8?q?Philippe_Mathieu-?= =?utf-8?q?Daud=C3=A9?= , Yanan Wang , Zhao Liu , Paolo Bonzini , Jiaxun Yang X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1853; i=jiaxun.yang@flygoat.com; h=from:subject:message-id; bh=JNBgIaVRNq8CD21Ic9ZZf6Czo7m4QZkHaZRXP0viouw=; b=owGbwMvMwCXmXMhTe71c8zDjabUkhvTcE9nlOXK/vaKu3LPkfOvAbG/yVrT01rYXQh6HjnwLa 1+nVlXfUcrCIMbFICumyBIioNS3ofHigusPsv7AzGFlAhnCwMUpABMJzmP4K8d9jz9k5tbMj+LG pV0z319lXLN40YHLM12PFmz7FH9rSyMjw8cQ8Q/vG1ZsS2eubvGxz9AyTstzfbnb+0HOT46kGx7 beAA= X-Developer-Key: i=jiaxun.yang@flygoat.com; a=openpgp; fpr=980379BEFEBFBF477EA04EF9C111949073FC0F67 Received-SPF: pass client-ip=103.168.172.144; envelope-from=jiaxun.yang@flygoat.com; helo=fout-a1-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_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_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, 4.2.2. IOCSR Access Instructions: The reading value is described as "writes it to the general register rd after symbolic expansion." which means it should be sign extended. Signed-off-by: Jiaxun Yang --- target/loongarch/tcg/iocsr_helper.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/target/loongarch/tcg/iocsr_helper.c b/target/loongarch/tcg/iocsr_helper.c index b6916f53d20ca133f0000e773685cb94240bafe2..db30de2523fff01bcc8923eb12c7fca7bedca7bf 100644 --- a/target/loongarch/tcg/iocsr_helper.c +++ b/target/loongarch/tcg/iocsr_helper.c @@ -17,20 +17,20 @@ uint64_t helper_iocsrrd_b(CPULoongArchState *env, target_ulong r_addr) { - return address_space_ldub(env->address_space_iocsr, r_addr, - GET_MEMTXATTRS(env), NULL); + return (int8_t)address_space_ldub(env->address_space_iocsr, r_addr, + GET_MEMTXATTRS(env), NULL); } uint64_t helper_iocsrrd_h(CPULoongArchState *env, target_ulong r_addr) { - return address_space_lduw(env->address_space_iocsr, r_addr, - GET_MEMTXATTRS(env), NULL); + return (int16_t)address_space_lduw(env->address_space_iocsr, r_addr, + GET_MEMTXATTRS(env), NULL); } uint64_t helper_iocsrrd_w(CPULoongArchState *env, target_ulong r_addr) { - return address_space_ldl(env->address_space_iocsr, r_addr, - GET_MEMTXATTRS(env), NULL); + return (int32_t)address_space_ldl(env->address_space_iocsr, r_addr, + GET_MEMTXATTRS(env), NULL); } uint64_t helper_iocsrrd_d(CPULoongArchState *env, target_ulong r_addr) From patchwork Thu Dec 26 21:19:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jiaxun Yang X-Patchwork-Id: 13921440 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 B7AB3E77188 for ; Thu, 26 Dec 2024 21:22:04 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tQvGv-0003fF-IA; Thu, 26 Dec 2024 16:19:57 -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 1tQvGt-0003eg-Lh for qemu-devel@nongnu.org; Thu, 26 Dec 2024 16:19:55 -0500 Received: from fout-a1-smtp.messagingengine.com ([103.168.172.144]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tQvGs-0002x5-77 for qemu-devel@nongnu.org; Thu, 26 Dec 2024 16:19:55 -0500 Received: from phl-compute-12.internal (phl-compute-12.phl.internal [10.202.2.52]) by mailfout.phl.internal (Postfix) with ESMTP id BE74213801DF; Thu, 26 Dec 2024 16:19:53 -0500 (EST) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-12.internal (MEProxy); Thu, 26 Dec 2024 16:19:53 -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=1735247993; x=1735334393; bh=KCkRYG/jH7j0XUGmJo5gVnglQvXIToUkt02zHQ4OVAo=; b= MHh62pem9YEL6q6lN2Td6Zl0Qoy72MkUG/V2A+UgPORkQJmenAMpkpNcAsqWRBVr TyKFoj96qJBjg9Pe5wNbRNNUI3rRd6DjpUiQfxDCD/YOTcwXP3MaW13nyhXmQD0m mDDMp90dJ9UVdkaQaj9ajg4rp88XsmNdK54IdmZG1FKkBGkK5Yqr8tpXsbqutmkD 1pf9tDgJp/CVjXHLQlrBITgJZY9JDmf5OTyZEE+UM0dAQsBXnkez4wmv91AL9+mO rC+DTOS33PRHCGGDbF9TKVKBra/3Md12deBPOGcgKLPymlJ8nenKq2B97wOfDM/D fmB7za1RNH0ALg7too4vNQ== 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=1735247993; x= 1735334393; bh=KCkRYG/jH7j0XUGmJo5gVnglQvXIToUkt02zHQ4OVAo=; b=W lGvWh1R7ymaRILyuJ70uUALbpQm5ewSle++6OaOrGzBLJki9PKCyl3oGJXd9Fmx8 fUkOB/13I5ehq7SAhyCKfCBGrrK14f3Hty6th8ME0OLhhBi03kAdflKH0K/4MnL2 eiy0Pu70oWWug/MgytB4ro7utFZamgET+ZEvgKIAQyJ437RxUSEqyH8KhN7dufhb zQWyR6A7i99KHwsNu2KFeKROLXorILwX6NLtez8IVuKsqL23OOmRBBI6EN0b1Lbi efq8l1d8J8MYdMDdVGY2jGvE7wcr3crUBCAp7IR+G/82/H+UYAGof3/usPNCQbh5 Fw7CItUKUYxAJXRIcpqrg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddruddukedgudegkecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdp uffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivg hnthhsucdlqddutddtmdenucfjughrpefhfffugggtgffkfhgjvfevofesthejredtredt jeenucfhrhhomheplfhirgiguhhnucgjrghnghcuoehjihgrgihunhdrhigrnhhgsehflh ihghhorghtrdgtohhmqeenucggtffrrghtthgvrhhnpedvkeeihfefveekueevteefleff keegudeghfdtuddugefhueevgeffgedukeejleenucevlhhushhtvghrufhiiigvpedtne curfgrrhgrmhepmhgrihhlfhhrohhmpehjihgrgihunhdrhigrnhhgsehflhihghhorght rdgtohhmpdhnsggprhgtphhtthhopeduvddpmhhouggvpehsmhhtphhouhhtpdhrtghpth htohepmhgrohgsihgsoheslhhoohhnghhsohhnrdgtnhdprhgtphhtthhopehmrghrtggv lhdrrghpfhgvlhgsrghumhesghhmrghilhdrtghomhdprhgtphhtthhopehpsghonhiiih hnihesrhgvughhrghtrdgtohhmpdhrtghpthhtohepghgrohhsohhngheslhhoohhnghhs ohhnrdgtnhdprhgtphhtthhopegvsghlrghkvgesrhgvughhrghtrdgtohhmpdhrtghpth htohepjhhirgiguhhnrdihrghnghesfhhlhihgohgrthdrtghomhdprhgtphhtthhopehq vghmuhdquggvvhgvlhesnhhonhhgnhhurdhorhhgpdhrtghpthhtohepfigrnhhghigrnh grnhehheeshhhurgifvghirdgtohhmpdhrtghpthhtohepiihhrghouddrlhhiuhesihhn thgvlhdrtghomh X-ME-Proxy: Feedback-ID: ifd894703:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 26 Dec 2024 16:19:51 -0500 (EST) From: Jiaxun Yang Date: Thu, 26 Dec 2024 21:19:36 +0000 Subject: [PATCH v2 05/23] target/loongarch: Use target_ulong for iocsrrd helper results MIME-Version: 1.0 Message-Id: <20241226-la32-fixes1-v2-5-0414594f8cb5@flygoat.com> References: <20241226-la32-fixes1-v2-0-0414594f8cb5@flygoat.com> In-Reply-To: <20241226-la32-fixes1-v2-0-0414594f8cb5@flygoat.com> To: qemu-devel@nongnu.org Cc: Song Gao , Bibo Mao , Eric Blake , Markus Armbruster , Eduardo Habkost , Marcel Apfelbaum , =?utf-8?q?Philippe_Mathieu-?= =?utf-8?q?Daud=C3=A9?= , Yanan Wang , Zhao Liu , Paolo Bonzini , Jiaxun Yang X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=2778; i=jiaxun.yang@flygoat.com; h=from:subject:message-id; bh=eM8z4PNF4T/f/rnPHhyrp+3IIz7lkcNTnCate8LHDPM=; b=owGbwMvMwCXmXMhTe71c8zDjabUkhvTcE9muL7rCGnMvzejZZ6+i+j+SbWqYgnFL85ED/WeeJ LP65n7oKGVhEONikBVTZAkRUOrb0HhxwfUHWX9g5rAygQxh4OIUgIl83MnwP7HmY+WGvV01tdJ1 Kw41uYWd/K/MZ9LvOG+d5YqFs7xNJzMy3HAS5LjwOleeyXrinB6DSb9LFCt/bYthWfIsUuF5otQ GdgA= X-Developer-Key: i=jiaxun.yang@flygoat.com; a=openpgp; fpr=980379BEFEBFBF477EA04EF9C111949073FC0F67 Received-SPF: pass client-ip=103.168.172.144; envelope-from=jiaxun.yang@flygoat.com; helo=fout-a1-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_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_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 Those results are all targeting TCGv values, which means they should be in target_ulong type. Signed-off-by: Jiaxun Yang Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé --- target/loongarch/helper.h | 8 ++++---- target/loongarch/tcg/iocsr_helper.c | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/target/loongarch/helper.h b/target/loongarch/helper.h index b3b64a021536255a3f9decfc10ff61fe8380e2ae..409d93a5b0808f0e32b8c0e2e17cebac9feaf8ed 100644 --- a/target/loongarch/helper.h +++ b/target/loongarch/helper.h @@ -104,10 +104,10 @@ DEF_HELPER_2(csrwr_estat, i64, env, tl) DEF_HELPER_2(csrwr_asid, i64, env, tl) DEF_HELPER_2(csrwr_tcfg, i64, env, tl) DEF_HELPER_2(csrwr_ticlr, i64, env, tl) -DEF_HELPER_2(iocsrrd_b, i64, env, tl) -DEF_HELPER_2(iocsrrd_h, i64, env, tl) -DEF_HELPER_2(iocsrrd_w, i64, env, tl) -DEF_HELPER_2(iocsrrd_d, i64, env, tl) +DEF_HELPER_2(iocsrrd_b, tl, env, tl) +DEF_HELPER_2(iocsrrd_h, tl, env, tl) +DEF_HELPER_2(iocsrrd_w, tl, env, tl) +DEF_HELPER_2(iocsrrd_d, tl, env, tl) DEF_HELPER_3(iocsrwr_b, void, env, tl, tl) DEF_HELPER_3(iocsrwr_h, void, env, tl, tl) DEF_HELPER_3(iocsrwr_w, void, env, tl, tl) diff --git a/target/loongarch/tcg/iocsr_helper.c b/target/loongarch/tcg/iocsr_helper.c index db30de2523fff01bcc8923eb12c7fca7bedca7bf..23d819de0ef9790eb82741f1e8a0e20dc139bf4b 100644 --- a/target/loongarch/tcg/iocsr_helper.c +++ b/target/loongarch/tcg/iocsr_helper.c @@ -15,25 +15,25 @@ #define GET_MEMTXATTRS(cas) \ ((MemTxAttrs){.requester_id = env_cpu(cas)->cpu_index}) -uint64_t helper_iocsrrd_b(CPULoongArchState *env, target_ulong r_addr) +target_ulong helper_iocsrrd_b(CPULoongArchState *env, target_ulong r_addr) { return (int8_t)address_space_ldub(env->address_space_iocsr, r_addr, GET_MEMTXATTRS(env), NULL); } -uint64_t helper_iocsrrd_h(CPULoongArchState *env, target_ulong r_addr) +target_ulong helper_iocsrrd_h(CPULoongArchState *env, target_ulong r_addr) { return (int16_t)address_space_lduw(env->address_space_iocsr, r_addr, GET_MEMTXATTRS(env), NULL); } -uint64_t helper_iocsrrd_w(CPULoongArchState *env, target_ulong r_addr) +target_ulong helper_iocsrrd_w(CPULoongArchState *env, target_ulong r_addr) { return (int32_t)address_space_ldl(env->address_space_iocsr, r_addr, GET_MEMTXATTRS(env), NULL); } -uint64_t helper_iocsrrd_d(CPULoongArchState *env, target_ulong r_addr) +target_ulong helper_iocsrrd_d(CPULoongArchState *env, target_ulong r_addr) { return address_space_ldq(env->address_space_iocsr, r_addr, GET_MEMTXATTRS(env), NULL); From patchwork Thu Dec 26 21:19:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiaxun Yang X-Patchwork-Id: 13921439 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 011DBE7718E for ; Thu, 26 Dec 2024 21:21:59 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tQvGy-0003fa-9s; Thu, 26 Dec 2024 16:20:00 -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 1tQvGw-0003fM-OS for qemu-devel@nongnu.org; Thu, 26 Dec 2024 16:19:58 -0500 Received: from fhigh-a4-smtp.messagingengine.com ([103.168.172.155]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tQvGu-0002xO-K4 for qemu-devel@nongnu.org; Thu, 26 Dec 2024 16:19:58 -0500 Received: from phl-compute-12.internal (phl-compute-12.phl.internal [10.202.2.52]) by mailfhigh.phl.internal (Postfix) with ESMTP id D3A641140172; Thu, 26 Dec 2024 16:19:55 -0500 (EST) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-12.internal (MEProxy); Thu, 26 Dec 2024 16:19:55 -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=1735247995; x=1735334395; bh=1dyXMSuDYiyHHVXUJfqzXihl7agJ2Ol0SZf8+RalGTY=; b= W85UVr426EG/zOEyzxJJAeDm6Pn1jKcdAgQHqQQ1WrQf7OGYoKH65Y/gcqM34HP8 wUwAE7kDeMl/UpWtLvmgk5wigCtUdLqN8nPu7ofRIRIuOTVWLHwiKqO4cauzZfOe /b3ckUDjdPDkVFSVzg/5gYjuB1kYayIFltebONwCk2P7gNc01CecbHW2fQ53c8H8 UvNGwOIPMeGvSrgA7g8EY2JHWs0fC1g6rPlA0qMQxnrS0KXmO/tG5C1A2h6mp6pM ZNMhfLGqcqyEhb9p490oAuM2pCK8zBG9SfBDlZvSSGj8UJQofNRd4k1RXVG1C+Mz PnJu54WeupdDi1zz6qxK+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=1735247995; x= 1735334395; bh=1dyXMSuDYiyHHVXUJfqzXihl7agJ2Ol0SZf8+RalGTY=; b=M afi1+G6L6fI5HQFvLNQ2j8UDAxJBKk4/a+7JE7EFphqf5mGdyY9/T3JXlol/d2Rq WUF0DKV4MRbnxXvRLDiRTayXWn0ri/vfz1N2UNFVLH710T94FFRG+uPejh3Ksp8s TIuWG5XwPr0i85RrhMCGoUDoTsYwRMuW8Mnf/UXKsXtGZWV2ZcBot0WjsaCpxyIp 5YnXlK9h7g6E/fwgdmexM6xbZYf5dmxiyF5IlZHnsvioqbLlrxGrC8TzriauDf/J agHyXTg94j1rdHX3u2FGPKALUb1Aycn2rAws2vz9E2jlKT/TWS6jtSYrc0pLPeUn CmkrbyPC8wGVXKePbahrw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddruddukedgudegkecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdp uffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivg hnthhsucdlqddutddtmdenucfjughrpefhfffugggtgffkfhgjvfevofesthejredtredt jeenucfhrhhomheplfhirgiguhhnucgjrghnghcuoehjihgrgihunhdrhigrnhhgsehflh ihghhorghtrdgtohhmqeenucggtffrrghtthgvrhhnpedvkeeihfefveekueevteefleff keegudeghfdtuddugefhueevgeffgedukeejleenucevlhhushhtvghrufhiiigvpedune curfgrrhgrmhepmhgrihhlfhhrohhmpehjihgrgihunhdrhigrnhhgsehflhihghhorght rdgtohhmpdhnsggprhgtphhtthhopeduvddpmhhouggvpehsmhhtphhouhhtpdhrtghpth htohepmhgrohgsihgsoheslhhoohhnghhsohhnrdgtnhdprhgtphhtthhopehmrghrtggv lhdrrghpfhgvlhgsrghumhesghhmrghilhdrtghomhdprhgtphhtthhopehpsghonhiiih hnihesrhgvughhrghtrdgtohhmpdhrtghpthhtohepghgrohhsohhngheslhhoohhnghhs ohhnrdgtnhdprhgtphhtthhopegvsghlrghkvgesrhgvughhrghtrdgtohhmpdhrtghpth htohepjhhirgiguhhnrdihrghnghesfhhlhihgohgrthdrtghomhdprhgtphhtthhopehq vghmuhdquggvvhgvlhesnhhonhhgnhhurdhorhhgpdhrtghpthhtohepfigrnhhghigrnh grnhehheeshhhurgifvghirdgtohhmpdhrtghpthhtohepiihhrghouddrlhhiuhesihhn thgvlhdrtghomh X-ME-Proxy: Feedback-ID: ifd894703:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 26 Dec 2024 16:19:53 -0500 (EST) From: Jiaxun Yang Date: Thu, 26 Dec 2024 21:19:37 +0000 Subject: [PATCH v2 06/23] target/loongarch: Store some uint64_t values as target_ulong MIME-Version: 1.0 Message-Id: <20241226-la32-fixes1-v2-6-0414594f8cb5@flygoat.com> References: <20241226-la32-fixes1-v2-0-0414594f8cb5@flygoat.com> In-Reply-To: <20241226-la32-fixes1-v2-0-0414594f8cb5@flygoat.com> To: qemu-devel@nongnu.org Cc: Song Gao , Bibo Mao , Eric Blake , Markus Armbruster , Eduardo Habkost , Marcel Apfelbaum , =?utf-8?q?Philippe_Mathieu-?= =?utf-8?q?Daud=C3=A9?= , Yanan Wang , Zhao Liu , Paolo Bonzini , Jiaxun Yang X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=16603; i=jiaxun.yang@flygoat.com; h=from:subject:message-id; bh=sbJnd056LAZaUCNScVsknOWxhwATEI+sdXtyYdtfH7k=; b=owGbwMvMwCXmXMhTe71c8zDjabUkhvTcE9mquiFS/rMl7ET5fwofnLDzjaLwJA/3ifMdrlZor k1Y9WJjRykLgxgXg6yYIkuIgFLfhsaLC64/yPoDM4eVCWQIAxenAEzEbiojwxTjfa3zjb82dF49 J1Vf/lNHcmP584tVjfMzzb58k+ZM7WH4Z1ww3ayn+l2OmmfaRgf1zduPqq3Wm+C+1fLi7LrHF5b s5QUA X-Developer-Key: i=jiaxun.yang@flygoat.com; a=openpgp; fpr=980379BEFEBFBF477EA04EF9C111949073FC0F67 Received-SPF: pass client-ip=103.168.172.155; envelope-from=jiaxun.yang@flygoat.com; helo=fhigh-a4-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_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_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 Store internal registers including GPRs, CSRs, and LBT scratchs as target_ulong, as per architecture specification. The only exception here is tlb_misc, as it's only used by QEMU internally and need keep to be 64bit to store all required fields. There is no migration ABI change, as target_ulong is uint64_t on existing loongarch64 builds anyway. Signed-off-by: Jiaxun Yang --- target/loongarch/cpu.c | 34 ++++++------ target/loongarch/cpu.h | 132 ++++++++++++++++++++++----------------------- target/loongarch/machine.c | 120 ++++++++++++++++++++--------------------- 3 files changed, 143 insertions(+), 143 deletions(-) diff --git a/target/loongarch/cpu.c b/target/loongarch/cpu.c index f5bc8720d1fc1b28950ee02de5ae6cce86fc6a96..82412f8867a50a6cd25cff511def0f24d2b10b49 100644 --- a/target/loongarch/cpu.c +++ b/target/loongarch/cpu.c @@ -748,7 +748,7 @@ static void loongarch_cpu_dump_state(CPUState *cs, FILE *f, int flags) CPULoongArchState *env = cpu_env(cs); int i; - qemu_fprintf(f, " PC=%016" PRIx64 " ", env->pc); + qemu_fprintf(f, " PC=" TARGET_FMT_lx " ", env->pc); qemu_fprintf(f, " FCSR0 0x%08x\n", env->fcsr0); /* gpr */ @@ -756,28 +756,28 @@ static void loongarch_cpu_dump_state(CPUState *cs, FILE *f, int flags) if ((i & 3) == 0) { qemu_fprintf(f, " GPR%02d:", i); } - qemu_fprintf(f, " %s %016" PRIx64, regnames[i], env->gpr[i]); + qemu_fprintf(f, " %s " TARGET_FMT_lx, regnames[i], env->gpr[i]); if ((i & 3) == 3) { qemu_fprintf(f, "\n"); } } - qemu_fprintf(f, "CRMD=%016" PRIx64 "\n", env->CSR_CRMD); - qemu_fprintf(f, "PRMD=%016" PRIx64 "\n", env->CSR_PRMD); - qemu_fprintf(f, "EUEN=%016" PRIx64 "\n", env->CSR_EUEN); - qemu_fprintf(f, "ESTAT=%016" PRIx64 "\n", env->CSR_ESTAT); - qemu_fprintf(f, "ERA=%016" PRIx64 "\n", env->CSR_ERA); - qemu_fprintf(f, "BADV=%016" PRIx64 "\n", env->CSR_BADV); - qemu_fprintf(f, "BADI=%016" PRIx64 "\n", env->CSR_BADI); - qemu_fprintf(f, "EENTRY=%016" PRIx64 "\n", env->CSR_EENTRY); - qemu_fprintf(f, "PRCFG1=%016" PRIx64 ", PRCFG2=%016" PRIx64 "," - " PRCFG3=%016" PRIx64 "\n", + qemu_fprintf(f, "CRMD=" TARGET_FMT_lx "\n", env->CSR_CRMD); + qemu_fprintf(f, "PRMD=" TARGET_FMT_lx "\n", env->CSR_PRMD); + qemu_fprintf(f, "EUEN=" TARGET_FMT_lx "\n", env->CSR_EUEN); + qemu_fprintf(f, "ESTAT=" TARGET_FMT_lx "\n", env->CSR_ESTAT); + qemu_fprintf(f, "ERA=" TARGET_FMT_lx "\n", env->CSR_ERA); + qemu_fprintf(f, "BADV=" TARGET_FMT_lx "\n", env->CSR_BADV); + qemu_fprintf(f, "BADI=" TARGET_FMT_lx "\n", env->CSR_BADI); + qemu_fprintf(f, "EENTRY=" TARGET_FMT_lx "\n", env->CSR_EENTRY); + qemu_fprintf(f, "PRCFG1=" TARGET_FMT_lx ", PRCFG2=" TARGET_FMT_lx "," + " PRCFG3=" TARGET_FMT_lx "\n", env->CSR_PRCFG1, env->CSR_PRCFG2, env->CSR_PRCFG3); - qemu_fprintf(f, "TLBRENTRY=%016" PRIx64 "\n", env->CSR_TLBRENTRY); - qemu_fprintf(f, "TLBRBADV=%016" PRIx64 "\n", env->CSR_TLBRBADV); - qemu_fprintf(f, "TLBRERA=%016" PRIx64 "\n", env->CSR_TLBRERA); - qemu_fprintf(f, "TCFG=%016" PRIx64 "\n", env->CSR_TCFG); - qemu_fprintf(f, "TVAL=%016" PRIx64 "\n", env->CSR_TVAL); + qemu_fprintf(f, "TLBRENTRY=" TARGET_FMT_lx "\n", env->CSR_TLBRENTRY); + qemu_fprintf(f, "TLBRBADV=" TARGET_FMT_lx "\n", env->CSR_TLBRBADV); + qemu_fprintf(f, "TLBRERA=" TARGET_FMT_lx "\n", env->CSR_TLBRERA); + qemu_fprintf(f, "TCFG=" TARGET_FMT_lx "\n", env->CSR_TCFG); + qemu_fprintf(f, "TVAL=" TARGET_FMT_lx "\n", env->CSR_TVAL); /* fpr */ if (flags & CPU_DUMP_FPU) { diff --git a/target/loongarch/cpu.h b/target/loongarch/cpu.h index 86c86c6c958db1a215a3e76a27f379bd4a095fb6..4f542a3376831141d012f177dc46a0e928afc85c 100644 --- a/target/loongarch/cpu.h +++ b/target/loongarch/cpu.h @@ -276,8 +276,8 @@ union fpr_t { struct LoongArchTLB { uint64_t tlb_misc; /* Fields corresponding to CSR_TLBELO0/1 */ - uint64_t tlb_entry0; - uint64_t tlb_entry1; + target_ulong tlb_entry0; + target_ulong tlb_entry1; }; typedef struct LoongArchTLB LoongArchTLB; #endif @@ -289,18 +289,18 @@ enum loongarch_features { typedef struct LoongArchBT { /* scratch registers */ - uint64_t scr0; - uint64_t scr1; - uint64_t scr2; - uint64_t scr3; + target_ulong scr0; + target_ulong scr1; + target_ulong scr2; + target_ulong scr3; /* loongarch eflags */ uint32_t eflags; uint32_t ftop; } lbt_t; typedef struct CPUArchState { - uint64_t gpr[32]; - uint64_t pc; + target_ulong gpr[32]; + target_ulong pc; fpr_t fpr[32]; bool cf[8]; @@ -310,69 +310,69 @@ typedef struct CPUArchState { uint32_t cpucfg[21]; /* LoongArch CSRs */ - uint64_t CSR_CRMD; - uint64_t CSR_PRMD; - uint64_t CSR_EUEN; - uint64_t CSR_MISC; - uint64_t CSR_ECFG; - uint64_t CSR_ESTAT; - uint64_t CSR_ERA; - uint64_t CSR_BADV; - uint64_t CSR_BADI; - uint64_t CSR_EENTRY; - uint64_t CSR_TLBIDX; - uint64_t CSR_TLBEHI; - uint64_t CSR_TLBELO0; - uint64_t CSR_TLBELO1; - uint64_t CSR_ASID; - uint64_t CSR_PGDL; - uint64_t CSR_PGDH; - uint64_t CSR_PGD; - uint64_t CSR_PWCL; - uint64_t CSR_PWCH; - uint64_t CSR_STLBPS; - uint64_t CSR_RVACFG; - uint64_t CSR_CPUID; - uint64_t CSR_PRCFG1; - uint64_t CSR_PRCFG2; - uint64_t CSR_PRCFG3; - uint64_t CSR_SAVE[16]; - uint64_t CSR_TID; - uint64_t CSR_TCFG; - uint64_t CSR_TVAL; - uint64_t CSR_CNTC; - uint64_t CSR_TICLR; - uint64_t CSR_LLBCTL; - uint64_t CSR_IMPCTL1; - uint64_t CSR_IMPCTL2; - uint64_t CSR_TLBRENTRY; - uint64_t CSR_TLBRBADV; - uint64_t CSR_TLBRERA; - uint64_t CSR_TLBRSAVE; - uint64_t CSR_TLBRELO0; - uint64_t CSR_TLBRELO1; - uint64_t CSR_TLBREHI; - uint64_t CSR_TLBRPRMD; - uint64_t CSR_MERRCTL; - uint64_t CSR_MERRINFO1; - uint64_t CSR_MERRINFO2; - uint64_t CSR_MERRENTRY; - uint64_t CSR_MERRERA; - uint64_t CSR_MERRSAVE; - uint64_t CSR_CTAG; - uint64_t CSR_DMW[4]; - uint64_t CSR_DBG; - uint64_t CSR_DERA; - uint64_t CSR_DSAVE; + target_ulong CSR_CRMD; + target_ulong CSR_PRMD; + target_ulong CSR_EUEN; + target_ulong CSR_MISC; + target_ulong CSR_ECFG; + target_ulong CSR_ESTAT; + target_ulong CSR_ERA; + target_ulong CSR_BADV; + target_ulong CSR_BADI; + target_ulong CSR_EENTRY; + target_ulong CSR_TLBIDX; + target_ulong CSR_TLBEHI; + target_ulong CSR_TLBELO0; + target_ulong CSR_TLBELO1; + target_ulong CSR_ASID; + target_ulong CSR_PGDL; + target_ulong CSR_PGDH; + target_ulong CSR_PGD; + target_ulong CSR_PWCL; + target_ulong CSR_PWCH; + target_ulong CSR_STLBPS; + target_ulong CSR_RVACFG; + target_ulong CSR_CPUID; + target_ulong CSR_PRCFG1; + target_ulong CSR_PRCFG2; + target_ulong CSR_PRCFG3; + target_ulong CSR_SAVE[16]; + target_ulong CSR_TID; + target_ulong CSR_TCFG; + target_ulong CSR_TVAL; + target_ulong CSR_CNTC; + target_ulong CSR_TICLR; + target_ulong CSR_LLBCTL; + target_ulong CSR_IMPCTL1; + target_ulong CSR_IMPCTL2; + target_ulong CSR_TLBRENTRY; + target_ulong CSR_TLBRBADV; + target_ulong CSR_TLBRERA; + target_ulong CSR_TLBRSAVE; + target_ulong CSR_TLBRELO0; + target_ulong CSR_TLBRELO1; + target_ulong CSR_TLBREHI; + target_ulong CSR_TLBRPRMD; + target_ulong CSR_MERRCTL; + target_ulong CSR_MERRINFO1; + target_ulong CSR_MERRINFO2; + target_ulong CSR_MERRENTRY; + target_ulong CSR_MERRERA; + target_ulong CSR_MERRSAVE; + target_ulong CSR_CTAG; + target_ulong CSR_DMW[4]; + target_ulong CSR_DBG; + target_ulong CSR_DERA; + target_ulong CSR_DSAVE; struct { - uint64_t guest_addr; + target_ulong guest_addr; } stealtime; #ifdef CONFIG_TCG float_status fp_status; uint32_t fcsr0_mask; - uint64_t lladdr; /* LL virtual address compared against SC */ - uint64_t llval; + target_ulong lladdr; /* LL virtual address compared against SC */ + target_ulong llval; #endif #ifndef CONFIG_USER_ONLY #ifdef CONFIG_TCG @@ -381,7 +381,7 @@ typedef struct CPUArchState { AddressSpace *address_space_iocsr; bool load_elf; - uint64_t elf_address; + target_ulong elf_address; uint32_t mp_state; /* Store ipistate to access from this struct */ DeviceState *ipistate; diff --git a/target/loongarch/machine.c b/target/loongarch/machine.c index 4e70f5c8798bdc826df809c98e8adb4ebf879c39..ba6e4f9df259c9a25962a4cfa180280f56ba6077 100644 --- a/target/loongarch/machine.c +++ b/target/loongarch/machine.c @@ -123,10 +123,10 @@ static const VMStateDescription vmstate_lbt = { .minimum_version_id = 0, .needed = lbt_needed, .fields = (const VMStateField[]) { - VMSTATE_UINT64(env.lbt.scr0, LoongArchCPU), - VMSTATE_UINT64(env.lbt.scr1, LoongArchCPU), - VMSTATE_UINT64(env.lbt.scr2, LoongArchCPU), - VMSTATE_UINT64(env.lbt.scr3, LoongArchCPU), + VMSTATE_UINTTL(env.lbt.scr0, LoongArchCPU), + VMSTATE_UINTTL(env.lbt.scr1, LoongArchCPU), + VMSTATE_UINTTL(env.lbt.scr2, LoongArchCPU), + VMSTATE_UINTTL(env.lbt.scr3, LoongArchCPU), VMSTATE_UINT32(env.lbt.eflags, LoongArchCPU), VMSTATE_UINT32(env.lbt.ftop, LoongArchCPU), VMSTATE_END_OF_LIST() @@ -146,8 +146,8 @@ static const VMStateDescription vmstate_tlb_entry = { .minimum_version_id = 0, .fields = (const VMStateField[]) { VMSTATE_UINT64(tlb_misc, LoongArchTLB), - VMSTATE_UINT64(tlb_entry0, LoongArchTLB), - VMSTATE_UINT64(tlb_entry1, LoongArchTLB), + VMSTATE_UINTTL(tlb_entry0, LoongArchTLB), + VMSTATE_UINTTL(tlb_entry1, LoongArchTLB), VMSTATE_END_OF_LIST() } }; @@ -175,65 +175,65 @@ const VMStateDescription vmstate_loongarch_cpu = { VMSTATE_UINTTL(env.pc, LoongArchCPU), /* Remaining CSRs */ - VMSTATE_UINT64(env.CSR_CRMD, LoongArchCPU), - VMSTATE_UINT64(env.CSR_PRMD, LoongArchCPU), - VMSTATE_UINT64(env.CSR_EUEN, LoongArchCPU), - VMSTATE_UINT64(env.CSR_MISC, LoongArchCPU), - VMSTATE_UINT64(env.CSR_ECFG, LoongArchCPU), - VMSTATE_UINT64(env.CSR_ESTAT, LoongArchCPU), - VMSTATE_UINT64(env.CSR_ERA, LoongArchCPU), - VMSTATE_UINT64(env.CSR_BADV, LoongArchCPU), - VMSTATE_UINT64(env.CSR_BADI, LoongArchCPU), - VMSTATE_UINT64(env.CSR_EENTRY, LoongArchCPU), - VMSTATE_UINT64(env.CSR_TLBIDX, LoongArchCPU), - VMSTATE_UINT64(env.CSR_TLBEHI, LoongArchCPU), - VMSTATE_UINT64(env.CSR_TLBELO0, LoongArchCPU), - VMSTATE_UINT64(env.CSR_TLBELO1, LoongArchCPU), - VMSTATE_UINT64(env.CSR_ASID, LoongArchCPU), - VMSTATE_UINT64(env.CSR_PGDL, LoongArchCPU), - VMSTATE_UINT64(env.CSR_PGDH, LoongArchCPU), - VMSTATE_UINT64(env.CSR_PGD, LoongArchCPU), - VMSTATE_UINT64(env.CSR_PWCL, LoongArchCPU), - VMSTATE_UINT64(env.CSR_PWCH, LoongArchCPU), - VMSTATE_UINT64(env.CSR_STLBPS, LoongArchCPU), - VMSTATE_UINT64(env.CSR_RVACFG, LoongArchCPU), - VMSTATE_UINT64(env.CSR_PRCFG1, LoongArchCPU), - VMSTATE_UINT64(env.CSR_PRCFG2, LoongArchCPU), - VMSTATE_UINT64(env.CSR_PRCFG3, LoongArchCPU), - VMSTATE_UINT64_ARRAY(env.CSR_SAVE, LoongArchCPU, 16), - VMSTATE_UINT64(env.CSR_TID, LoongArchCPU), - VMSTATE_UINT64(env.CSR_TCFG, LoongArchCPU), - VMSTATE_UINT64(env.CSR_TVAL, LoongArchCPU), - VMSTATE_UINT64(env.CSR_CNTC, LoongArchCPU), - VMSTATE_UINT64(env.CSR_TICLR, LoongArchCPU), - VMSTATE_UINT64(env.CSR_LLBCTL, LoongArchCPU), - VMSTATE_UINT64(env.CSR_IMPCTL1, LoongArchCPU), - VMSTATE_UINT64(env.CSR_IMPCTL2, LoongArchCPU), - VMSTATE_UINT64(env.CSR_TLBRENTRY, LoongArchCPU), - VMSTATE_UINT64(env.CSR_TLBRBADV, LoongArchCPU), - VMSTATE_UINT64(env.CSR_TLBRERA, LoongArchCPU), - VMSTATE_UINT64(env.CSR_TLBRSAVE, LoongArchCPU), - VMSTATE_UINT64(env.CSR_TLBRELO0, LoongArchCPU), - VMSTATE_UINT64(env.CSR_TLBRELO1, LoongArchCPU), - VMSTATE_UINT64(env.CSR_TLBREHI, LoongArchCPU), - VMSTATE_UINT64(env.CSR_TLBRPRMD, LoongArchCPU), - VMSTATE_UINT64(env.CSR_MERRCTL, LoongArchCPU), - VMSTATE_UINT64(env.CSR_MERRINFO1, LoongArchCPU), - VMSTATE_UINT64(env.CSR_MERRINFO2, LoongArchCPU), - VMSTATE_UINT64(env.CSR_MERRENTRY, LoongArchCPU), - VMSTATE_UINT64(env.CSR_MERRERA, LoongArchCPU), - VMSTATE_UINT64(env.CSR_MERRSAVE, LoongArchCPU), - VMSTATE_UINT64(env.CSR_CTAG, LoongArchCPU), - VMSTATE_UINT64_ARRAY(env.CSR_DMW, LoongArchCPU, 4), + VMSTATE_UINTTL(env.CSR_CRMD, LoongArchCPU), + VMSTATE_UINTTL(env.CSR_PRMD, LoongArchCPU), + VMSTATE_UINTTL(env.CSR_EUEN, LoongArchCPU), + VMSTATE_UINTTL(env.CSR_MISC, LoongArchCPU), + VMSTATE_UINTTL(env.CSR_ECFG, LoongArchCPU), + VMSTATE_UINTTL(env.CSR_ESTAT, LoongArchCPU), + VMSTATE_UINTTL(env.CSR_ERA, LoongArchCPU), + VMSTATE_UINTTL(env.CSR_BADV, LoongArchCPU), + VMSTATE_UINTTL(env.CSR_BADI, LoongArchCPU), + VMSTATE_UINTTL(env.CSR_EENTRY, LoongArchCPU), + VMSTATE_UINTTL(env.CSR_TLBIDX, LoongArchCPU), + VMSTATE_UINTTL(env.CSR_TLBEHI, LoongArchCPU), + VMSTATE_UINTTL(env.CSR_TLBELO0, LoongArchCPU), + VMSTATE_UINTTL(env.CSR_TLBELO1, LoongArchCPU), + VMSTATE_UINTTL(env.CSR_ASID, LoongArchCPU), + VMSTATE_UINTTL(env.CSR_PGDL, LoongArchCPU), + VMSTATE_UINTTL(env.CSR_PGDH, LoongArchCPU), + VMSTATE_UINTTL(env.CSR_PGD, LoongArchCPU), + VMSTATE_UINTTL(env.CSR_PWCL, LoongArchCPU), + VMSTATE_UINTTL(env.CSR_PWCH, LoongArchCPU), + VMSTATE_UINTTL(env.CSR_STLBPS, LoongArchCPU), + VMSTATE_UINTTL(env.CSR_RVACFG, LoongArchCPU), + VMSTATE_UINTTL(env.CSR_PRCFG1, LoongArchCPU), + VMSTATE_UINTTL(env.CSR_PRCFG2, LoongArchCPU), + VMSTATE_UINTTL(env.CSR_PRCFG3, LoongArchCPU), + VMSTATE_UINTTL_ARRAY(env.CSR_SAVE, LoongArchCPU, 16), + VMSTATE_UINTTL(env.CSR_TID, LoongArchCPU), + VMSTATE_UINTTL(env.CSR_TCFG, LoongArchCPU), + VMSTATE_UINTTL(env.CSR_TVAL, LoongArchCPU), + VMSTATE_UINTTL(env.CSR_CNTC, LoongArchCPU), + VMSTATE_UINTTL(env.CSR_TICLR, LoongArchCPU), + VMSTATE_UINTTL(env.CSR_LLBCTL, LoongArchCPU), + VMSTATE_UINTTL(env.CSR_IMPCTL1, LoongArchCPU), + VMSTATE_UINTTL(env.CSR_IMPCTL2, LoongArchCPU), + VMSTATE_UINTTL(env.CSR_TLBRENTRY, LoongArchCPU), + VMSTATE_UINTTL(env.CSR_TLBRBADV, LoongArchCPU), + VMSTATE_UINTTL(env.CSR_TLBRERA, LoongArchCPU), + VMSTATE_UINTTL(env.CSR_TLBRSAVE, LoongArchCPU), + VMSTATE_UINTTL(env.CSR_TLBRELO0, LoongArchCPU), + VMSTATE_UINTTL(env.CSR_TLBRELO1, LoongArchCPU), + VMSTATE_UINTTL(env.CSR_TLBREHI, LoongArchCPU), + VMSTATE_UINTTL(env.CSR_TLBRPRMD, LoongArchCPU), + VMSTATE_UINTTL(env.CSR_MERRCTL, LoongArchCPU), + VMSTATE_UINTTL(env.CSR_MERRINFO1, LoongArchCPU), + VMSTATE_UINTTL(env.CSR_MERRINFO2, LoongArchCPU), + VMSTATE_UINTTL(env.CSR_MERRENTRY, LoongArchCPU), + VMSTATE_UINTTL(env.CSR_MERRERA, LoongArchCPU), + VMSTATE_UINTTL(env.CSR_MERRSAVE, LoongArchCPU), + VMSTATE_UINTTL(env.CSR_CTAG, LoongArchCPU), + VMSTATE_UINTTL_ARRAY(env.CSR_DMW, LoongArchCPU, 4), /* Debug CSRs */ - VMSTATE_UINT64(env.CSR_DBG, LoongArchCPU), - VMSTATE_UINT64(env.CSR_DERA, LoongArchCPU), - VMSTATE_UINT64(env.CSR_DSAVE, LoongArchCPU), + VMSTATE_UINTTL(env.CSR_DBG, LoongArchCPU), + VMSTATE_UINTTL(env.CSR_DERA, LoongArchCPU), + VMSTATE_UINTTL(env.CSR_DSAVE, LoongArchCPU), VMSTATE_UINT64(kvm_state_counter, LoongArchCPU), /* PV steal time */ - VMSTATE_UINT64(env.stealtime.guest_addr, LoongArchCPU), + VMSTATE_UINTTL(env.stealtime.guest_addr, LoongArchCPU), VMSTATE_END_OF_LIST() }, From patchwork Thu Dec 26 21:19:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiaxun Yang X-Patchwork-Id: 13921434 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 BFF74E7718E for ; Thu, 26 Dec 2024 21:21:17 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tQvGz-0003fu-5z; Thu, 26 Dec 2024 16:20:01 -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 1tQvGx-0003fW-NL for qemu-devel@nongnu.org; Thu, 26 Dec 2024 16:19:59 -0500 Received: from fhigh-a4-smtp.messagingengine.com ([103.168.172.155]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tQvGw-0002xa-Cm for qemu-devel@nongnu.org; Thu, 26 Dec 2024 16:19:59 -0500 Received: from phl-compute-06.internal (phl-compute-06.phl.internal [10.202.2.46]) by mailfhigh.phl.internal (Postfix) with ESMTP id E5BB01140122; Thu, 26 Dec 2024 16:19:57 -0500 (EST) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-06.internal (MEProxy); Thu, 26 Dec 2024 16:19:57 -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=1735247997; x=1735334397; bh=zFX/R/2OBNMM/usy/SvwghUXl01SL+AnQBH94JO8ndM=; b= k4JwZQycTGhkh00mumnBFpmbw65DuoYf0v5KwNsvc4mk7kxoCOBwql0owQQ9u/T2 z6QU9vzfS4WbiOHLToRQ+1EWg32eQNGJwwCGVEBS2YfWvZTafTxa70dXPnh/Uwu8 bA3gtg/SeWYLEmvHaRcs5hLrIItUBg9eS6KcFGET+apohpNPE/jrXwtpp0t/CjFj 71oZbgT7PVrfAIRcEJrw1AbVv2SH4tISEK9jdc4FTv5Fn8l3zBvwWL/m4Jz6SfIo lEy0BMqbQTfIlxJ0pccYYAQ4gGPD8Wlq41BW2h4HVJ8Q/Kg2cVSyJiBi1+YfYwKL YYKiF9Po2qZSRsBhBh9Ihg== 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=1735247997; x= 1735334397; bh=zFX/R/2OBNMM/usy/SvwghUXl01SL+AnQBH94JO8ndM=; b=x HEY4DpIO6O+UQPHBIWm2ZNfuRsVpaLK/0QLsjP5/UP4CxtcDWmI4fRWxja7LnkWk lWFxRVfcGnZxQjj2PZuray6SHZDMhlvlzMbGdqjmQOMnwCo6bvh3pr3mBM0jNpnz BI9BM5wfO+Xn+NX3w0QYkcxf692mFm60Ag+grwnylWchQI6wDtLtbje531obLfKu XaB1yEYnKSkZf7OpGq5xKlWgjrgpnvrsrhLTxwVxuZZz2RGL+u9j9wYCFeMyxcyd /60Tmv0IdRcsEnLj8zoLV6roAeY6XgIC2SGLydSUgjOlfb9UMYYO4hMnU+2EyTCi 1NPFoVV1vqeW3QZdQ+tbA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddruddukedgudegjecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdp uffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivg hnthhsucdlqddutddtmdenucfjughrpefhfffugggtgffkfhgjvfevofesthejredtredt jeenucfhrhhomheplfhirgiguhhnucgjrghnghcuoehjihgrgihunhdrhigrnhhgsehflh ihghhorghtrdgtohhmqeenucggtffrrghtthgvrhhnpedvkeeihfefveekueevteefleff keegudeghfdtuddugefhueevgeffgedukeejleenucevlhhushhtvghrufhiiigvpedtne curfgrrhgrmhepmhgrihhlfhhrohhmpehjihgrgihunhdrhigrnhhgsehflhihghhorght rdgtohhmpdhnsggprhgtphhtthhopeduvddpmhhouggvpehsmhhtphhouhhtpdhrtghpth htohepmhgrohgsihgsoheslhhoohhnghhsohhnrdgtnhdprhgtphhtthhopehmrghrtggv lhdrrghpfhgvlhgsrghumhesghhmrghilhdrtghomhdprhgtphhtthhopehpsghonhiiih hnihesrhgvughhrghtrdgtohhmpdhrtghpthhtohepghgrohhsohhngheslhhoohhnghhs ohhnrdgtnhdprhgtphhtthhopegvsghlrghkvgesrhgvughhrghtrdgtohhmpdhrtghpth htohepjhhirgiguhhnrdihrghnghesfhhlhihgohgrthdrtghomhdprhgtphhtthhopehq vghmuhdquggvvhgvlhesnhhonhhgnhhurdhorhhgpdhrtghpthhtohepfigrnhhghigrnh grnhehheeshhhurgifvghirdgtohhmpdhrtghpthhtohepiihhrghouddrlhhiuhesihhn thgvlhdrtghomh X-ME-Proxy: Feedback-ID: ifd894703:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 26 Dec 2024 16:19:55 -0500 (EST) From: Jiaxun Yang Date: Thu, 26 Dec 2024 21:19:38 +0000 Subject: [PATCH v2 07/23] target/loongarch: Cast address to 64bit before DMW_64_VSEG shift MIME-Version: 1.0 Message-Id: <20241226-la32-fixes1-v2-7-0414594f8cb5@flygoat.com> References: <20241226-la32-fixes1-v2-0-0414594f8cb5@flygoat.com> In-Reply-To: <20241226-la32-fixes1-v2-0-0414594f8cb5@flygoat.com> To: qemu-devel@nongnu.org Cc: Song Gao , Bibo Mao , Eric Blake , Markus Armbruster , Eduardo Habkost , Marcel Apfelbaum , =?utf-8?q?Philippe_Mathieu-?= =?utf-8?q?Daud=C3=A9?= , Yanan Wang , Zhao Liu , Paolo Bonzini , Jiaxun Yang X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=862; i=jiaxun.yang@flygoat.com; h=from:subject:message-id; bh=hDOvSXO+z0VzV0fEPlaxByL62UfL44EDg9vVWEzf4c4=; b=owGbwMvMwCXmXMhTe71c8zDjabUkhvTcE9lT5L0TLD/ON7P+l9AWx3JYP3FN6CGRyNuvK07f6 PGxP9/SUcrCIMbFICumyBIioNS3ofHigusPsv7AzGFlAhnCwMUpABMxPc3wT5kt+IAoo4wdw1cB kR+zsrZ/f5CedUdb4WSq0qG1foaHOhn+8H2O1vC/HsVz913znqv3NGRKvq18t0U7Jjmjm6HIrMS VBQA= X-Developer-Key: i=jiaxun.yang@flygoat.com; a=openpgp; fpr=980379BEFEBFBF477EA04EF9C111949073FC0F67 Received-SPF: pass client-ip=103.168.172.155; envelope-from=jiaxun.yang@flygoat.com; helo=fhigh-a4-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_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_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 Avoid compiler warning on 32bit. This code path won't be taken anyway. Signed-off-by: Jiaxun Yang Reviewed-by: Richard Henderson --- target/loongarch/cpu_helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/loongarch/cpu_helper.c b/target/loongarch/cpu_helper.c index 580362ac3e9ffbe6c8523cf57902dcda018ceed5..b8da136eb0554ba661a15e3069ee0d6bae61af86 100644 --- a/target/loongarch/cpu_helper.c +++ b/target/loongarch/cpu_helper.c @@ -196,7 +196,7 @@ int get_physical_address(CPULoongArchState *env, hwaddr *physical, plv = kernel_mode | (user_mode << R_CSR_DMW_PLV3_SHIFT); if (is_la64(env)) { - base_v = address >> R_CSR_DMW_64_VSEG_SHIFT; + base_v = (uint64_t)address >> R_CSR_DMW_64_VSEG_SHIFT; } else { base_v = address >> R_CSR_DMW_32_VSEG_SHIFT; } From patchwork Thu Dec 26 21:19:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jiaxun Yang X-Patchwork-Id: 13921447 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 BE984E77188 for ; Thu, 26 Dec 2024 21:22:31 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tQvH1-0003hL-OS; Thu, 26 Dec 2024 16:20:03 -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 1tQvGz-0003gR-R7 for qemu-devel@nongnu.org; Thu, 26 Dec 2024 16:20:01 -0500 Received: from fhigh-a4-smtp.messagingengine.com ([103.168.172.155]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tQvGy-0002xr-Bm for qemu-devel@nongnu.org; Thu, 26 Dec 2024 16:20:01 -0500 Received: from phl-compute-12.internal (phl-compute-12.phl.internal [10.202.2.52]) by mailfhigh.phl.internal (Postfix) with ESMTP id E467D114018A; Thu, 26 Dec 2024 16:19:59 -0500 (EST) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-12.internal (MEProxy); Thu, 26 Dec 2024 16:19:59 -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=1735247999; x=1735334399; bh=xq7uqmFNSO+Bhhp9oqXUJHdfuDZb5OWrQSgSK4Sc8OI=; b= qzTI8IU46HlstiDRlHznpdb5PCTwl0vELPbToyx2Fx6O+2fAW3HtCQFEsNDjDZVJ rQuhO1SfR/0J6g/On1Hf+m7agC5tadkC/L840DBG107ojwTflSpc8lyT+3sxPU5J sHtxQPLiYUkOYpzX6t+B8+5LAhFHIwz2giH6osZgt10Lb++ueGUmeunxGgOAz5R7 iVLntWo7CyeVHL2fm443/iTt+HL8HqWBYTENskLmLa/FiDprz4w6vut5a1aoIUXX M6FicNvQ8oGT8YGBCYPTNnRxadZx/aBkKmzvx+45RMfJrrC1ISwKczbz6JOVVSwS EdDKUib8Dq1QUs/KIefQJA== 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=1735247999; x= 1735334399; bh=xq7uqmFNSO+Bhhp9oqXUJHdfuDZb5OWrQSgSK4Sc8OI=; b=b aaAggyoQIzTIOScUHcQUFykoTXxIdi7OVjyStDfCaKCYhHna/Iw1xGDg4i6ItJ8d HT0gsqoIuIKUrtKYegkoGcsBDQUywxWth+g/AycrdqXuBLLAaFoAYXW3SD3D3GmO QyEbhYLPjzSVLUssjt3rE8sGM2zn7uySjOsJmesw8sBMDc4EK5eRB8CHbZvSqlkb we8U24Yu8awHbbgWrLezC+xOE6HW2WGc3siQwxElwfcpGxGBw7w/pK0z2jRuxPMp fLQUXup9R5BSDYJlzomhl57p9w8RERDyYbc6EsAW3oAbXBUtlzm2/shfUKx92O7z /BY7q+ZT9ag8O+Oavp+6g== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddruddukedgudegkecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdp uffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivg hnthhsucdlqddutddtmdenucfjughrpefhfffugggtgffkfhgjvfevofesthejredtredt jeenucfhrhhomheplfhirgiguhhnucgjrghnghcuoehjihgrgihunhdrhigrnhhgsehflh ihghhorghtrdgtohhmqeenucggtffrrghtthgvrhhnpedvkeeihfefveekueevteefleff keegudeghfdtuddugefhueevgeffgedukeejleenucevlhhushhtvghrufhiiigvpedune curfgrrhgrmhepmhgrihhlfhhrohhmpehjihgrgihunhdrhigrnhhgsehflhihghhorght rdgtohhmpdhnsggprhgtphhtthhopeduvddpmhhouggvpehsmhhtphhouhhtpdhrtghpth htohepmhgrohgsihgsoheslhhoohhnghhsohhnrdgtnhdprhgtphhtthhopehmrghrtggv lhdrrghpfhgvlhgsrghumhesghhmrghilhdrtghomhdprhgtphhtthhopehpsghonhiiih hnihesrhgvughhrghtrdgtohhmpdhrtghpthhtohepghgrohhsohhngheslhhoohhnghhs ohhnrdgtnhdprhgtphhtthhopegvsghlrghkvgesrhgvughhrghtrdgtohhmpdhrtghpth htohepjhhirgiguhhnrdihrghnghesfhhlhihgohgrthdrtghomhdprhgtphhtthhopehq vghmuhdquggvvhgvlhesnhhonhhgnhhurdhorhhgpdhrtghpthhtohepfigrnhhghigrnh grnhehheeshhhurgifvghirdgtohhmpdhrtghpthhtohepiihhrghouddrlhhiuhesihhn thgvlhdrtghomh X-ME-Proxy: Feedback-ID: ifd894703:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 26 Dec 2024 16:19:58 -0500 (EST) From: Jiaxun Yang Date: Thu, 26 Dec 2024 21:19:39 +0000 Subject: [PATCH v2 08/23] target/loongarch: Fix some modifiers for log formatting MIME-Version: 1.0 Message-Id: <20241226-la32-fixes1-v2-8-0414594f8cb5@flygoat.com> References: <20241226-la32-fixes1-v2-0-0414594f8cb5@flygoat.com> In-Reply-To: <20241226-la32-fixes1-v2-0-0414594f8cb5@flygoat.com> To: qemu-devel@nongnu.org Cc: Song Gao , Bibo Mao , Eric Blake , Markus Armbruster , Eduardo Habkost , Marcel Apfelbaum , =?utf-8?q?Philippe_Mathieu-?= =?utf-8?q?Daud=C3=A9?= , Yanan Wang , Zhao Liu , Paolo Bonzini , Jiaxun Yang X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=2683; i=jiaxun.yang@flygoat.com; h=from:subject:message-id; bh=K1JbyjmDeOq+zI7mf6qjyyMmhZTtw0g8gsLmCp1McfA=; b=owGbwMvMwCXmXMhTe71c8zDjabUkhvTcE9m9Xz/Wn374ZUnCq0e8895/KLFzYlkhUcFhbcUx0 fj322mJHaUsDGJcDLJiiiwhAkp9GxovLrj+IOsPzBxWJpAhDFycAjCR4u8M/7PXMF/d8kBhwaz7 34KfJhZE9c6V8lNMdmx7qRSvuC5LV4bhD6fI2ZoPyflph7R/l+2ezd5mXTH7Vrzvxp+1Yr8cz/K lMwMA X-Developer-Key: i=jiaxun.yang@flygoat.com; a=openpgp; fpr=980379BEFEBFBF477EA04EF9C111949073FC0F67 Received-SPF: pass client-ip=103.168.172.155; envelope-from=jiaxun.yang@flygoat.com; helo=fhigh-a4-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_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_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 target_ulong -> TARGET_FMT_ld vaddr -> VADDR_PRIx uint32_t -> PRIx32 Signed-off-by: Jiaxun Yang Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé --- target/loongarch/tcg/insn_trans/trans_atomic.c.inc | 2 +- target/loongarch/tcg/tlb_helper.c | 2 +- target/loongarch/tcg/translate.c | 5 ++--- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/target/loongarch/tcg/insn_trans/trans_atomic.c.inc b/target/loongarch/tcg/insn_trans/trans_atomic.c.inc index c35f6f3ce47877ab6ad84fa2cbc50b46c0b23ad1..8584441b543712af8a56aa234c90fd6370c8df01 100644 --- a/target/loongarch/tcg/insn_trans/trans_atomic.c.inc +++ b/target/loongarch/tcg/insn_trans/trans_atomic.c.inc @@ -56,7 +56,7 @@ static bool gen_am(DisasContext *ctx, arg_rrr *a, if (a->rd != 0 && (a->rj == a->rd || a->rk == a->rd)) { qemu_log_mask(LOG_GUEST_ERROR, "Warning: source register overlaps destination register" - "in atomic insn at pc=0x" TARGET_FMT_lx "\n", + "in atomic insn at pc=0x%016"VADDR_PRIx"\n", ctx->base.pc_next - 4); return false; } diff --git a/target/loongarch/tcg/tlb_helper.c b/target/loongarch/tcg/tlb_helper.c index 97f38fc391338ba4b76115b142fa76d89e45cd62..a1426b46f36c99e300ab924cb487875ec21ab226 100644 --- a/target/loongarch/tcg/tlb_helper.c +++ b/target/loongarch/tcg/tlb_helper.c @@ -517,7 +517,7 @@ target_ulong helper_lddir(CPULoongArchState *env, target_ulong base, if (unlikely((level == 0) || (level > 4))) { qemu_log_mask(LOG_GUEST_ERROR, - "Attepted LDDIR with level %"PRId64"\n", level); + "Attepted LDDIR with level "TARGET_FMT_ld"\n", level); return base; } diff --git a/target/loongarch/tcg/translate.c b/target/loongarch/tcg/translate.c index 1fca4afc731c048816618d87610a0cc0fe7579b1..3939670e18d01bd9fc08861532166882fbd3f890 100644 --- a/target/loongarch/tcg/translate.c +++ b/target/loongarch/tcg/translate.c @@ -287,9 +287,8 @@ static void loongarch_tr_translate_insn(DisasContextBase *dcbase, CPUState *cs) ctx->opcode = translator_ldl(cpu_env(cs), &ctx->base, ctx->base.pc_next); if (!decode(ctx, ctx->opcode)) { - qemu_log_mask(LOG_UNIMP, "Error: unknown opcode. " - TARGET_FMT_lx ": 0x%x\n", - ctx->base.pc_next, ctx->opcode); + qemu_log_mask(LOG_UNIMP, "Error: unknown opcode. %016"VADDR_PRIx + ": 0x%08"PRIx32"\n", ctx->base.pc_next, ctx->opcode); generate_exception(ctx, EXCCODE_INE); } From patchwork Thu Dec 26 21:19:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiaxun Yang X-Patchwork-Id: 13921431 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 3750CE7718F for ; Thu, 26 Dec 2024 21:20:26 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tQvH4-0003jy-Ka; Thu, 26 Dec 2024 16:20:06 -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 1tQvH2-0003hT-7H for qemu-devel@nongnu.org; Thu, 26 Dec 2024 16:20:04 -0500 Received: from fout-a1-smtp.messagingengine.com ([103.168.172.144]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tQvH0-0002yf-F7 for qemu-devel@nongnu.org; Thu, 26 Dec 2024 16:20:03 -0500 Received: from phl-compute-12.internal (phl-compute-12.phl.internal [10.202.2.52]) by mailfout.phl.internal (Postfix) with ESMTP id ECC3C13801DB; Thu, 26 Dec 2024 16:20:01 -0500 (EST) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-12.internal (MEProxy); Thu, 26 Dec 2024 16:20:01 -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=1735248001; x=1735334401; bh=tFAQFqUAgdmLwYisLRxlA7J5J4yli3bv87ehvWOUb1w=; b= B8cTW58a+fjxw0gqGq9Si5stlNLwn2sWZh0IW29m9fHfjm0YkSIxQY+YotqO1/u0 wSrNsda5/ZfwEgllTzvTjI4szxFCxGZTkjE44FAnefGbEj6/20YdTMsQAWejMEHB 18AW0lPPR+UC/O4jztWXYXb7Qqvxu/ggj7Duiryl0B2LMQ/CKN9y5FnX2mUWFS8p vlCmYeDJUogupWbzHdroEmiy9RTdNwFu5E/EVDx9htJ2U2fngJBt9zeIF6hQa15l lb0c1TlgJnrP3Lzy/LMuoBFccQBHr4qKufb/GZJQ5D0e+FO/ajzl8YazpFynFF5P XF9XNiiOgAMi/KPAo8h1RA== 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=1735248001; x= 1735334401; bh=tFAQFqUAgdmLwYisLRxlA7J5J4yli3bv87ehvWOUb1w=; b=h MZ4Jhs2S2aya/GSIJ/k4juwlwMTAxDZ0USwnXY4eWZO5OnAGMM2vsggMSlMKyISK Uar3ecj21q8gn0ySqe/qIJor+QhjOkegWfEeBQbATEwJBMlPzHfa4FDBOHDvP8G6 B45v0B2ZXk8kil5/NtTq/YslQi7vd26XHlDyRxTDkyqiDI2QkC0BNkhBrClwplR+ mT3GWwlVBdv1Xt1F8DKVIeYL3fm/KRlCiAztT0Nxh7kq2uXfwy6befIClpYquHdp t29aCl9uyI4F7ZOHCqcAYLvx2QOBLSiR7kVXwfFab+s4pYECgdNk2DL2Nat3zdML 0hF0G5JD7RD4dUi+aarRg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddruddukedgudegkecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdp uffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivg hnthhsucdlqddutddtmdenucfjughrpefhfffugggtgffkfhgjvfevofesthejredtredt jeenucfhrhhomheplfhirgiguhhnucgjrghnghcuoehjihgrgihunhdrhigrnhhgsehflh ihghhorghtrdgtohhmqeenucggtffrrghtthgvrhhnpedvkeeihfefveekueevteefleff keegudeghfdtuddugefhueevgeffgedukeejleenucevlhhushhtvghrufhiiigvpeefne curfgrrhgrmhepmhgrihhlfhhrohhmpehjihgrgihunhdrhigrnhhgsehflhihghhorght rdgtohhmpdhnsggprhgtphhtthhopeduvddpmhhouggvpehsmhhtphhouhhtpdhrtghpth htohepmhgrohgsihgsoheslhhoohhnghhsohhnrdgtnhdprhgtphhtthhopehmrghrtggv lhdrrghpfhgvlhgsrghumhesghhmrghilhdrtghomhdprhgtphhtthhopehpsghonhiiih hnihesrhgvughhrghtrdgtohhmpdhrtghpthhtohepghgrohhsohhngheslhhoohhnghhs ohhnrdgtnhdprhgtphhtthhopegvsghlrghkvgesrhgvughhrghtrdgtohhmpdhrtghpth htohepjhhirgiguhhnrdihrghnghesfhhlhihgohgrthdrtghomhdprhgtphhtthhopehq vghmuhdquggvvhgvlhesnhhonhhgnhhurdhorhhgpdhrtghpthhtohepfigrnhhghigrnh grnhehheeshhhurgifvghirdgtohhmpdhrtghpthhtohepiihhrghouddrlhhiuhesihhn thgvlhdrtghomh X-ME-Proxy: Feedback-ID: ifd894703:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 26 Dec 2024 16:20:00 -0500 (EST) From: Jiaxun Yang Date: Thu, 26 Dec 2024 21:19:40 +0000 Subject: [PATCH v2 09/23] target/loongarch: Use target_ulong for CSR helpers MIME-Version: 1.0 Message-Id: <20241226-la32-fixes1-v2-9-0414594f8cb5@flygoat.com> References: <20241226-la32-fixes1-v2-0-0414594f8cb5@flygoat.com> In-Reply-To: <20241226-la32-fixes1-v2-0-0414594f8cb5@flygoat.com> To: qemu-devel@nongnu.org Cc: Song Gao , Bibo Mao , Eric Blake , Markus Armbruster , Eduardo Habkost , Marcel Apfelbaum , =?utf-8?q?Philippe_Mathieu-?= =?utf-8?q?Daud=C3=A9?= , Yanan Wang , Zhao Liu , Paolo Bonzini , Jiaxun Yang X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=2351; i=jiaxun.yang@flygoat.com; h=from:subject:message-id; bh=ju3phB5IO4pZPav9xNWdsU/6oIb8bjN5TIBoSv4Nlw4=; b=owGbwMvMwCXmXMhTe71c8zDjabUkhvTcE9lqfo31/FpavgumqHTwdnyK1prnnTX76f/oLOUN2 7oaz6Z0lLIwiHExyIopsoQIKPVtaLy44PqDrD8wc1iZQIYwcHEKwE0+xchw7+Ysq63peg+frxQu 2pP86nfRsVzBNo/KxIcs2m8TbrBsZvjNMlF/9QWG2AXt8uEhmpu7Fqr/eKZ+uTrlzvu5Wye9k+H nAAA= X-Developer-Key: i=jiaxun.yang@flygoat.com; a=openpgp; fpr=980379BEFEBFBF477EA04EF9C111949073FC0F67 Received-SPF: pass client-ip=103.168.172.144; envelope-from=jiaxun.yang@flygoat.com; helo=fout-a1-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_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_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 All CSRs are meant to be target_ulong wide in our setting. Signed-off-by: Jiaxun Yang --- target/loongarch/helper.h | 14 +++++++------- target/loongarch/tcg/op_helper.c | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/target/loongarch/helper.h b/target/loongarch/helper.h index 409d93a5b0808f0e32b8c0e2e17cebac9feaf8ed..a608754b7f52689da9e9f4da1cef68d5af72f2ed 100644 --- a/target/loongarch/helper.h +++ b/target/loongarch/helper.h @@ -97,13 +97,13 @@ DEF_HELPER_1(rdtime_d, i64, env) #ifndef CONFIG_USER_ONLY /* CSRs helper */ -DEF_HELPER_1(csrrd_pgd, i64, env) -DEF_HELPER_1(csrrd_cpuid, i64, env) -DEF_HELPER_1(csrrd_tval, i64, env) -DEF_HELPER_2(csrwr_estat, i64, env, tl) -DEF_HELPER_2(csrwr_asid, i64, env, tl) -DEF_HELPER_2(csrwr_tcfg, i64, env, tl) -DEF_HELPER_2(csrwr_ticlr, i64, env, tl) +DEF_HELPER_1(csrrd_pgd, tl, env) +DEF_HELPER_1(csrrd_cpuid, tl, env) +DEF_HELPER_1(csrrd_tval, tl, env) +DEF_HELPER_2(csrwr_estat, tl, env, tl) +DEF_HELPER_2(csrwr_asid, tl, env, tl) +DEF_HELPER_2(csrwr_tcfg, tl, env, tl) +DEF_HELPER_2(csrwr_ticlr, tl, env, tl) DEF_HELPER_2(iocsrrd_b, tl, env, tl) DEF_HELPER_2(iocsrrd_h, tl, env, tl) DEF_HELPER_2(iocsrrd_w, tl, env, tl) diff --git a/target/loongarch/tcg/op_helper.c b/target/loongarch/tcg/op_helper.c index b17208e5b962f2191b2afa60181bff311d618bba..c9d7e84e7ec9000bab655366bdf6ed8aaa4fd080 100644 --- a/target/loongarch/tcg/op_helper.c +++ b/target/loongarch/tcg/op_helper.c @@ -61,7 +61,7 @@ void helper_asrtgt_d(CPULoongArchState *env, target_ulong rj, target_ulong rk) } } -target_ulong helper_crc32(target_ulong val, target_ulong m, uint64_t sz) +target_ulong helper_crc32(target_ulong val, target_ulong m, target_ulong sz) { uint8_t buf[8]; target_ulong mask = ((sz * 8) == 64) ? -1ULL : ((1ULL << (sz * 8)) - 1); @@ -71,7 +71,7 @@ target_ulong helper_crc32(target_ulong val, target_ulong m, uint64_t sz) return (int32_t) (crc32(val ^ 0xffffffff, buf, sz) ^ 0xffffffff); } -target_ulong helper_crc32c(target_ulong val, target_ulong m, uint64_t sz) +target_ulong helper_crc32c(target_ulong val, target_ulong m, target_ulong sz) { uint8_t buf[8]; target_ulong mask = ((sz * 8) == 64) ? -1ULL : ((1ULL << (sz * 8)) - 1); From patchwork Thu Dec 26 21:19:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiaxun Yang X-Patchwork-Id: 13921450 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 6C244E7718F for ; Thu, 26 Dec 2024 21:22:56 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tQvH7-0003mT-Jo; Thu, 26 Dec 2024 16:20:09 -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 1tQvH6-0003l9-5A for qemu-devel@nongnu.org; Thu, 26 Dec 2024 16:20:08 -0500 Received: from fout-a1-smtp.messagingengine.com ([103.168.172.144]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tQvH2-0003AU-Kh for qemu-devel@nongnu.org; Thu, 26 Dec 2024 16:20:07 -0500 Received: from phl-compute-08.internal (phl-compute-08.phl.internal [10.202.2.48]) by mailfout.phl.internal (Postfix) with ESMTP id 266BE13801E2; Thu, 26 Dec 2024 16:20:04 -0500 (EST) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-08.internal (MEProxy); Thu, 26 Dec 2024 16:20:04 -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=1735248004; x=1735334404; bh=NSZZ3jxcOftJDFqJOa6TOprhs/qkAO+ohEaeLDCpGNg=; b= oOiyDL0ewXGHZsQPpXoOV9VwcqsEpXMqqb74lQFRbEHVel4Fgu/QDP3YWxmRj/75 b10oy4bfFQfF3TtbZ4naAZvLjYwKIDPiAd20dMc+s45Ypoy6gnTg6mWxUPZ5UiUI CdosOTnFaGzk8qjBebltfnwQh+D/Uf0JkqH1LMg8KS5bzoP723GvquP4BX6ENDeE fiIgGA3K+py+b5xtjYxyPAsaYd7C7eBw2+dHh8n+KhMAwrrN8F7Y8U0GbPMKWhIP 9vw3vGcpRxx9Qmx4kTYYZGy3g4rPZ/KvTb6VRGQRZ5J+Uo3+LfBLM2mdBe8vRNnS Ben/LhG4G9Kgo5+xsd++9w== 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=1735248004; x= 1735334404; bh=NSZZ3jxcOftJDFqJOa6TOprhs/qkAO+ohEaeLDCpGNg=; b=E QVgmwQodku+fwPJrUJX1rW+d9SfUIyNM4LvEVc8EFyez2Vdttpw8RSBdisRg07VI eYIk3/xTGPH+6hM8hD6Ug25mNXCdRK3zBkCRxa1ALYz3R/xYzvWydyI2fd40qwdw ZMkgaj0TkLUNSEeCdHklOiyUjmdGNAKJya4DJkOKVm0PBjS14VyOIyz6sE+AM/iU 2o/4iemaxSMp9bzpHOS+dags6Ozfiuu4pXQvCfZd0ccQyVh7efJlsISDuT7oftWX wb0/uNErAa26WbCO9HsPN769534FHxXQkuHzFuSfjkKyhKznRKXftXTdonElzawS REY4AOrSQWby7oi8cqyPQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddruddukedgudegkecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdp uffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivg hnthhsucdlqddutddtmdenucfjughrpefhfffugggtgffkfhgjvfevofesthejredtredt jeenucfhrhhomheplfhirgiguhhnucgjrghnghcuoehjihgrgihunhdrhigrnhhgsehflh ihghhorghtrdgtohhmqeenucggtffrrghtthgvrhhnpedvkeeihfefveekueevteefleff keegudeghfdtuddugefhueevgeffgedukeejleenucevlhhushhtvghrufhiiigvpedtne curfgrrhgrmhepmhgrihhlfhhrohhmpehjihgrgihunhdrhigrnhhgsehflhihghhorght rdgtohhmpdhnsggprhgtphhtthhopeduvddpmhhouggvpehsmhhtphhouhhtpdhrtghpth htohepmhgrohgsihgsoheslhhoohhnghhsohhnrdgtnhdprhgtphhtthhopehmrghrtggv lhdrrghpfhgvlhgsrghumhesghhmrghilhdrtghomhdprhgtphhtthhopehpsghonhiiih hnihesrhgvughhrghtrdgtohhmpdhrtghpthhtohepghgrohhsohhngheslhhoohhnghhs ohhnrdgtnhdprhgtphhtthhopegvsghlrghkvgesrhgvughhrghtrdgtohhmpdhrtghpth htohepjhhirgiguhhnrdihrghnghesfhhlhihgohgrthdrtghomhdprhgtphhtthhopehq vghmuhdquggvvhgvlhesnhhonhhgnhhurdhorhhgpdhrtghpthhtohepfigrnhhghigrnh grnhehheeshhhurgifvghirdgtohhmpdhrtghpthhtohepiihhrghouddrlhhiuhesihhn thgvlhdrtghomh X-ME-Proxy: Feedback-ID: ifd894703:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 26 Dec 2024 16:20:02 -0500 (EST) From: Jiaxun Yang Date: Thu, 26 Dec 2024 21:19:41 +0000 Subject: [PATCH v2 10/23] target/loongarch: Scrutinise TCG float translation for 32 bit build MIME-Version: 1.0 Message-Id: <20241226-la32-fixes1-v2-10-0414594f8cb5@flygoat.com> References: <20241226-la32-fixes1-v2-0-0414594f8cb5@flygoat.com> In-Reply-To: <20241226-la32-fixes1-v2-0-0414594f8cb5@flygoat.com> To: qemu-devel@nongnu.org Cc: Song Gao , Bibo Mao , Eric Blake , Markus Armbruster , Eduardo Habkost , Marcel Apfelbaum , =?utf-8?q?Philippe_Mathieu-?= =?utf-8?q?Daud=C3=A9?= , Yanan Wang , Zhao Liu , Paolo Bonzini , Jiaxun Yang X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=20175; i=jiaxun.yang@flygoat.com; h=from:subject:message-id; bh=uF1DCcggUmda9FIY5oD1gPEWiTNTJF+Bx0t7eB0/zko=; b=owGbwMvMwCXmXMhTe71c8zDjabUkhvTcE9k8633U5x9ln54+LU75wo3Vjh8PsLbWi20V07jms 2qaqeSJjlIWBjEuBlkxRZYQAaW+DY0XF1x/kPUHZg4rE8gQBi5OAZhIyW5Ghm3tgmtNhY6/T7z7 4lvgzGj/n+tCN56sdys8ff3el3mzXVcw/LPVTV4YELEg6JLeDONz/1r3TZateHNBpqohsT0j4De /CDsA X-Developer-Key: i=jiaxun.yang@flygoat.com; a=openpgp; fpr=980379BEFEBFBF477EA04EF9C111949073FC0F67 Received-SPF: pass client-ip=103.168.172.144; envelope-from=jiaxun.yang@flygoat.com; helo=fout-a1-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_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_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 All float computations are kept to be 64 bit, fix types for various TCGv. Performing TCGv type conversion as necessary when interaction with GPR happens. Signed-off-by: Jiaxun Yang Reviewed-by: Richard Henderson --- target/loongarch/tcg/insn_trans/trans_farith.c.inc | 53 +++++++------- target/loongarch/tcg/insn_trans/trans_fcmp.c.inc | 16 ++--- .../loongarch/tcg/insn_trans/trans_fmemory.c.inc | 34 ++++----- target/loongarch/tcg/insn_trans/trans_fmov.c.inc | 83 ++++++++++++---------- target/loongarch/tcg/translate.c | 6 +- 5 files changed, 99 insertions(+), 93 deletions(-) diff --git a/target/loongarch/tcg/insn_trans/trans_farith.c.inc b/target/loongarch/tcg/insn_trans/trans_farith.c.inc index f4a0dea72701a99954d8ff8fc9be2eb55e2f39a8..de8101334c67285dba801309bcd652f54326ad25 100644 --- a/target/loongarch/tcg/insn_trans/trans_farith.c.inc +++ b/target/loongarch/tcg/insn_trans/trans_farith.c.inc @@ -15,11 +15,11 @@ #endif static bool gen_fff(DisasContext *ctx, arg_fff *a, - void (*func)(TCGv, TCGv_env, TCGv, TCGv)) + void (*func)(TCGv_i64, TCGv_env, TCGv_i64, TCGv_i64)) { - TCGv dest = get_fpr(ctx, a->fd); - TCGv src1 = get_fpr(ctx, a->fj); - TCGv src2 = get_fpr(ctx, a->fk); + TCGv_i64 dest = get_fpr(ctx, a->fd); + TCGv_i64 src1 = get_fpr(ctx, a->fj); + TCGv_i64 src2 = get_fpr(ctx, a->fk); CHECK_FPE; @@ -30,10 +30,10 @@ static bool gen_fff(DisasContext *ctx, arg_fff *a, } static bool gen_ff(DisasContext *ctx, arg_ff *a, - void (*func)(TCGv, TCGv_env, TCGv)) + void (*func)(TCGv_i64, TCGv_env, TCGv_i64)) { - TCGv dest = get_fpr(ctx, a->fd); - TCGv src = get_fpr(ctx, a->fj); + TCGv_i64 dest = get_fpr(ctx, a->fd); + TCGv_i64 src = get_fpr(ctx, a->fj); CHECK_FPE; @@ -44,14 +44,15 @@ static bool gen_ff(DisasContext *ctx, arg_ff *a, } static bool gen_muladd(DisasContext *ctx, arg_ffff *a, - void (*func)(TCGv, TCGv_env, TCGv, TCGv, TCGv, TCGv_i32), + void (*func)(TCGv_i64, TCGv_env, TCGv_i64, + TCGv_i64, TCGv_i64, TCGv_i32), int flag) { TCGv_i32 tflag = tcg_constant_i32(flag); - TCGv dest = get_fpr(ctx, a->fd); - TCGv src1 = get_fpr(ctx, a->fj); - TCGv src2 = get_fpr(ctx, a->fk); - TCGv src3 = get_fpr(ctx, a->fa); + TCGv_i64 dest = get_fpr(ctx, a->fd); + TCGv_i64 src1 = get_fpr(ctx, a->fj); + TCGv_i64 src2 = get_fpr(ctx, a->fk); + TCGv_i64 src3 = get_fpr(ctx, a->fa); CHECK_FPE; @@ -63,9 +64,9 @@ static bool gen_muladd(DisasContext *ctx, arg_ffff *a, static bool trans_fcopysign_s(DisasContext *ctx, arg_fcopysign_s *a) { - TCGv dest = get_fpr(ctx, a->fd); - TCGv src1 = get_fpr(ctx, a->fk); - TCGv src2 = get_fpr(ctx, a->fj); + TCGv_i64 dest = get_fpr(ctx, a->fd); + TCGv_i64 src1 = get_fpr(ctx, a->fk); + TCGv_i64 src2 = get_fpr(ctx, a->fj); if (!avail_FP_SP(ctx)) { return false; @@ -81,9 +82,9 @@ static bool trans_fcopysign_s(DisasContext *ctx, arg_fcopysign_s *a) static bool trans_fcopysign_d(DisasContext *ctx, arg_fcopysign_d *a) { - TCGv dest = get_fpr(ctx, a->fd); - TCGv src1 = get_fpr(ctx, a->fk); - TCGv src2 = get_fpr(ctx, a->fj); + TCGv_i64 dest = get_fpr(ctx, a->fd); + TCGv_i64 src1 = get_fpr(ctx, a->fk); + TCGv_i64 src2 = get_fpr(ctx, a->fj); if (!avail_FP_DP(ctx)) { return false; @@ -99,8 +100,8 @@ static bool trans_fcopysign_d(DisasContext *ctx, arg_fcopysign_d *a) static bool trans_fabs_s(DisasContext *ctx, arg_fabs_s *a) { - TCGv dest = get_fpr(ctx, a->fd); - TCGv src = get_fpr(ctx, a->fj); + TCGv_i64 dest = get_fpr(ctx, a->fd); + TCGv_i64 src = get_fpr(ctx, a->fj); if (!avail_FP_SP(ctx)) { return false; @@ -117,8 +118,8 @@ static bool trans_fabs_s(DisasContext *ctx, arg_fabs_s *a) static bool trans_fabs_d(DisasContext *ctx, arg_fabs_d *a) { - TCGv dest = get_fpr(ctx, a->fd); - TCGv src = get_fpr(ctx, a->fj); + TCGv_i64 dest = get_fpr(ctx, a->fd); + TCGv_i64 src = get_fpr(ctx, a->fj); if (!avail_FP_DP(ctx)) { return false; @@ -134,8 +135,8 @@ static bool trans_fabs_d(DisasContext *ctx, arg_fabs_d *a) static bool trans_fneg_s(DisasContext *ctx, arg_fneg_s *a) { - TCGv dest = get_fpr(ctx, a->fd); - TCGv src = get_fpr(ctx, a->fj); + TCGv_i64 dest = get_fpr(ctx, a->fd); + TCGv_i64 src = get_fpr(ctx, a->fj); if (!avail_FP_SP(ctx)) { return false; @@ -152,8 +153,8 @@ static bool trans_fneg_s(DisasContext *ctx, arg_fneg_s *a) static bool trans_fneg_d(DisasContext *ctx, arg_fneg_d *a) { - TCGv dest = get_fpr(ctx, a->fd); - TCGv src = get_fpr(ctx, a->fj); + TCGv_i64 dest = get_fpr(ctx, a->fd); + TCGv_i64 src = get_fpr(ctx, a->fj); if (!avail_FP_DP(ctx)) { return false; diff --git a/target/loongarch/tcg/insn_trans/trans_fcmp.c.inc b/target/loongarch/tcg/insn_trans/trans_fcmp.c.inc index 3babf69e4ab556842be2a83a98215da607d9a044..f0cefc75070825469bac09c59d11637d35586602 100644 --- a/target/loongarch/tcg/insn_trans/trans_fcmp.c.inc +++ b/target/loongarch/tcg/insn_trans/trans_fcmp.c.inc @@ -25,9 +25,9 @@ static uint32_t get_fcmp_flags(int cond) static bool trans_fcmp_cond_s(DisasContext *ctx, arg_fcmp_cond_s *a) { - TCGv var, src1, src2; + TCGv_i64 var, src1, src2; uint32_t flags; - void (*fn)(TCGv, TCGv_env, TCGv, TCGv, TCGv_i32); + void (*fn)(TCGv_i64, TCGv_env, TCGv_i64, TCGv_i64, TCGv_i32); if (!avail_FP_SP(ctx)) { return false; @@ -35,7 +35,7 @@ static bool trans_fcmp_cond_s(DisasContext *ctx, arg_fcmp_cond_s *a) CHECK_FPE; - var = tcg_temp_new(); + var = tcg_temp_new_i64(); src1 = get_fpr(ctx, a->fj); src2 = get_fpr(ctx, a->fk); fn = (a->fcond & 1 ? gen_helper_fcmp_s_s : gen_helper_fcmp_c_s); @@ -43,15 +43,15 @@ static bool trans_fcmp_cond_s(DisasContext *ctx, arg_fcmp_cond_s *a) fn(var, tcg_env, src1, src2, tcg_constant_i32(flags)); - tcg_gen_st8_tl(var, tcg_env, offsetof(CPULoongArchState, cf[a->cd])); + tcg_gen_st8_i64(var, tcg_env, offsetof(CPULoongArchState, cf[a->cd])); return true; } static bool trans_fcmp_cond_d(DisasContext *ctx, arg_fcmp_cond_d *a) { - TCGv var, src1, src2; + TCGv_i64 var, src1, src2; uint32_t flags; - void (*fn)(TCGv, TCGv_env, TCGv, TCGv, TCGv_i32); + void (*fn)(TCGv_i64, TCGv_env, TCGv_i64, TCGv_i64, TCGv_i32); if (!avail_FP_DP(ctx)) { return false; @@ -59,7 +59,7 @@ static bool trans_fcmp_cond_d(DisasContext *ctx, arg_fcmp_cond_d *a) CHECK_FPE; - var = tcg_temp_new(); + var = tcg_temp_new_i64(); src1 = get_fpr(ctx, a->fj); src2 = get_fpr(ctx, a->fk); fn = (a->fcond & 1 ? gen_helper_fcmp_s_d : gen_helper_fcmp_c_d); @@ -67,6 +67,6 @@ static bool trans_fcmp_cond_d(DisasContext *ctx, arg_fcmp_cond_d *a) fn(var, tcg_env, src1, src2, tcg_constant_i32(flags)); - tcg_gen_st8_tl(var, tcg_env, offsetof(CPULoongArchState, cf[a->cd])); + tcg_gen_st8_i64(var, tcg_env, offsetof(CPULoongArchState, cf[a->cd])); return true; } diff --git a/target/loongarch/tcg/insn_trans/trans_fmemory.c.inc b/target/loongarch/tcg/insn_trans/trans_fmemory.c.inc index 13452bc7e56aef1ae7388d37bc45776cba536a75..79e2506157ab04e68cf8d7091038ecce75a4683a 100644 --- a/target/loongarch/tcg/insn_trans/trans_fmemory.c.inc +++ b/target/loongarch/tcg/insn_trans/trans_fmemory.c.inc @@ -3,7 +3,7 @@ * Copyright (c) 2021 Loongson Technology Corporation Limited */ -static void maybe_nanbox_load(TCGv freg, MemOp mop) +static void maybe_nanbox_load(TCGv_i64 freg, MemOp mop) { if ((mop & MO_SIZE) == MO_32) { gen_nanbox_s(freg, freg); @@ -13,13 +13,13 @@ static void maybe_nanbox_load(TCGv freg, MemOp mop) static bool gen_fload_i(DisasContext *ctx, arg_fr_i *a, MemOp mop) { TCGv addr = gpr_src(ctx, a->rj, EXT_NONE); - TCGv dest = get_fpr(ctx, a->fd); + TCGv_i64 dest = get_fpr(ctx, a->fd); CHECK_FPE; addr = make_address_i(ctx, addr, a->imm); - tcg_gen_qemu_ld_tl(dest, addr, ctx->mem_idx, mop); + tcg_gen_qemu_ld_i64(dest, addr, ctx->mem_idx, mop); maybe_nanbox_load(dest, mop); set_fpr(a->fd, dest); @@ -29,13 +29,13 @@ static bool gen_fload_i(DisasContext *ctx, arg_fr_i *a, MemOp mop) static bool gen_fstore_i(DisasContext *ctx, arg_fr_i *a, MemOp mop) { TCGv addr = gpr_src(ctx, a->rj, EXT_NONE); - TCGv src = get_fpr(ctx, a->fd); + TCGv_i64 src = get_fpr(ctx, a->fd); CHECK_FPE; addr = make_address_i(ctx, addr, a->imm); - tcg_gen_qemu_st_tl(src, addr, ctx->mem_idx, mop); + tcg_gen_qemu_st_i64(src, addr, ctx->mem_idx, mop); return true; } @@ -44,13 +44,13 @@ static bool gen_floadx(DisasContext *ctx, arg_frr *a, MemOp mop) { TCGv src1 = gpr_src(ctx, a->rj, EXT_NONE); TCGv src2 = gpr_src(ctx, a->rk, EXT_NONE); - TCGv dest = get_fpr(ctx, a->fd); + TCGv_i64 dest = get_fpr(ctx, a->fd); TCGv addr; CHECK_FPE; addr = make_address_x(ctx, src1, src2); - tcg_gen_qemu_ld_tl(dest, addr, ctx->mem_idx, mop); + tcg_gen_qemu_ld_i64(dest, addr, ctx->mem_idx, mop); maybe_nanbox_load(dest, mop); set_fpr(a->fd, dest); @@ -61,13 +61,13 @@ static bool gen_fstorex(DisasContext *ctx, arg_frr *a, MemOp mop) { TCGv src1 = gpr_src(ctx, a->rj, EXT_NONE); TCGv src2 = gpr_src(ctx, a->rk, EXT_NONE); - TCGv src3 = get_fpr(ctx, a->fd); + TCGv_i64 src3 = get_fpr(ctx, a->fd); TCGv addr; CHECK_FPE; addr = make_address_x(ctx, src1, src2); - tcg_gen_qemu_st_tl(src3, addr, ctx->mem_idx, mop); + tcg_gen_qemu_st_i64(src3, addr, ctx->mem_idx, mop); return true; } @@ -76,14 +76,14 @@ static bool gen_fload_gt(DisasContext *ctx, arg_frr *a, MemOp mop) { TCGv src1 = gpr_src(ctx, a->rj, EXT_NONE); TCGv src2 = gpr_src(ctx, a->rk, EXT_NONE); - TCGv dest = get_fpr(ctx, a->fd); + TCGv_i64 dest = get_fpr(ctx, a->fd); TCGv addr; CHECK_FPE; gen_helper_asrtgt_d(tcg_env, src1, src2); addr = make_address_x(ctx, src1, src2); - tcg_gen_qemu_ld_tl(dest, addr, ctx->mem_idx, mop); + tcg_gen_qemu_ld_i64(dest, addr, ctx->mem_idx, mop); maybe_nanbox_load(dest, mop); set_fpr(a->fd, dest); @@ -94,14 +94,14 @@ static bool gen_fstore_gt(DisasContext *ctx, arg_frr *a, MemOp mop) { TCGv src1 = gpr_src(ctx, a->rj, EXT_NONE); TCGv src2 = gpr_src(ctx, a->rk, EXT_NONE); - TCGv src3 = get_fpr(ctx, a->fd); + TCGv_i64 src3 = get_fpr(ctx, a->fd); TCGv addr; CHECK_FPE; gen_helper_asrtgt_d(tcg_env, src1, src2); addr = make_address_x(ctx, src1, src2); - tcg_gen_qemu_st_tl(src3, addr, ctx->mem_idx, mop); + tcg_gen_qemu_st_i64(src3, addr, ctx->mem_idx, mop); return true; } @@ -110,14 +110,14 @@ static bool gen_fload_le(DisasContext *ctx, arg_frr *a, MemOp mop) { TCGv src1 = gpr_src(ctx, a->rj, EXT_NONE); TCGv src2 = gpr_src(ctx, a->rk, EXT_NONE); - TCGv dest = get_fpr(ctx, a->fd); + TCGv_i64 dest = get_fpr(ctx, a->fd); TCGv addr; CHECK_FPE; gen_helper_asrtle_d(tcg_env, src1, src2); addr = make_address_x(ctx, src1, src2); - tcg_gen_qemu_ld_tl(dest, addr, ctx->mem_idx, mop); + tcg_gen_qemu_ld_i64(dest, addr, ctx->mem_idx, mop); maybe_nanbox_load(dest, mop); set_fpr(a->fd, dest); @@ -128,14 +128,14 @@ static bool gen_fstore_le(DisasContext *ctx, arg_frr *a, MemOp mop) { TCGv src1 = gpr_src(ctx, a->rj, EXT_NONE); TCGv src2 = gpr_src(ctx, a->rk, EXT_NONE); - TCGv src3 = get_fpr(ctx, a->fd); + TCGv_i64 src3 = get_fpr(ctx, a->fd); TCGv addr; CHECK_FPE; gen_helper_asrtle_d(tcg_env, src1, src2); addr = make_address_x(ctx, src1, src2); - tcg_gen_qemu_st_tl(src3, addr, ctx->mem_idx, mop); + tcg_gen_qemu_st_i64(src3, addr, ctx->mem_idx, mop); return true; } diff --git a/target/loongarch/tcg/insn_trans/trans_fmov.c.inc b/target/loongarch/tcg/insn_trans/trans_fmov.c.inc index 5cbd9d3f347128852ba1933a5961148464f1bbf5..58ce4d3c45d84a5de19358dd289b87aef2cb1078 100644 --- a/target/loongarch/tcg/insn_trans/trans_fmov.c.inc +++ b/target/loongarch/tcg/insn_trans/trans_fmov.c.inc @@ -9,11 +9,11 @@ static const uint32_t fcsr_mask[4] = { static bool trans_fsel(DisasContext *ctx, arg_fsel *a) { - TCGv zero = tcg_constant_tl(0); - TCGv dest = get_fpr(ctx, a->fd); - TCGv src1 = get_fpr(ctx, a->fj); - TCGv src2 = get_fpr(ctx, a->fk); - TCGv cond; + TCGv_i64 zero = tcg_constant_i64(0); + TCGv_i64 dest = get_fpr(ctx, a->fd); + TCGv_i64 src1 = get_fpr(ctx, a->fj); + TCGv_i64 src2 = get_fpr(ctx, a->fk); + TCGv_i64 cond; if (!avail_FP(ctx)) { return false; @@ -21,19 +21,19 @@ static bool trans_fsel(DisasContext *ctx, arg_fsel *a) CHECK_FPE; - cond = tcg_temp_new(); - tcg_gen_ld8u_tl(cond, tcg_env, offsetof(CPULoongArchState, cf[a->ca])); - tcg_gen_movcond_tl(TCG_COND_EQ, dest, cond, zero, src1, src2); + cond = tcg_temp_new_i64(); + tcg_gen_ld8u_i64(cond, tcg_env, offsetof(CPULoongArchState, cf[a->ca])); + tcg_gen_movcond_i64(TCG_COND_EQ, dest, cond, zero, src1, src2); set_fpr(a->fd, dest); return true; } static bool gen_f2f(DisasContext *ctx, arg_ff *a, - void (*func)(TCGv, TCGv), bool nanbox) + void (*func)(TCGv_i64, TCGv_i64), bool nanbox) { - TCGv dest = get_fpr(ctx, a->fd); - TCGv src = get_fpr(ctx, a->fj); + TCGv_i64 dest = get_fpr(ctx, a->fd); + TCGv_i64 src = get_fpr(ctx, a->fj); CHECK_FPE; @@ -47,17 +47,18 @@ static bool gen_f2f(DisasContext *ctx, arg_ff *a, } static bool gen_r2f(DisasContext *ctx, arg_fr *a, - void (*func)(TCGv, TCGv)) + void (*func)(TCGv_i64, TCGv_i64)) { - TCGv src = gpr_src(ctx, a->rj, EXT_NONE); - TCGv dest = get_fpr(ctx, a->fd); + TCGv rj = gpr_src(ctx, a->rj, EXT_NONE); + TCGv_i64 dest = get_fpr(ctx, a->fd); + TCGv_i64 src = tcg_temp_new_i64(); if (!avail_FP(ctx)) { return false; } CHECK_FPE; - + tcg_gen_ext_tl_i64(src, rj); func(dest, src); set_fpr(a->fd, dest); @@ -65,10 +66,11 @@ static bool gen_r2f(DisasContext *ctx, arg_fr *a, } static bool gen_f2r(DisasContext *ctx, arg_rf *a, - void (*func)(TCGv, TCGv)) + void (*func)(TCGv_i64, TCGv_i64)) { - TCGv dest = gpr_dst(ctx, a->rd, EXT_NONE); - TCGv src = get_fpr(ctx, a->fj); + TCGv rd = gpr_dst(ctx, a->rd, EXT_NONE); + TCGv_i64 src = get_fpr(ctx, a->fj); + TCGv_i64 dest = tcg_temp_new_i64(); if (!avail_FP(ctx)) { return false; @@ -77,7 +79,8 @@ static bool gen_f2r(DisasContext *ctx, arg_rf *a, CHECK_FPE; func(dest, src); - gen_set_gpr(a->rd, dest, EXT_NONE); + tcg_gen_trunc_i64_tl(rd, dest); + gen_set_gpr(a->rd, rd, EXT_NONE); return true; } @@ -94,13 +97,13 @@ static bool trans_movgr2fcsr(DisasContext *ctx, arg_movgr2fcsr *a) CHECK_FPE; if (mask == UINT32_MAX) { - tcg_gen_st32_i64(Rj, tcg_env, offsetof(CPULoongArchState, fcsr0)); + tcg_gen_st32_tl(Rj, tcg_env, offsetof(CPULoongArchState, fcsr0)); } else { TCGv_i32 fcsr0 = tcg_temp_new_i32(); TCGv_i32 temp = tcg_temp_new_i32(); tcg_gen_ld_i32(fcsr0, tcg_env, offsetof(CPULoongArchState, fcsr0)); - tcg_gen_extrl_i64_i32(temp, Rj); + tcg_gen_trunc_tl_i32(temp, Rj); tcg_gen_andi_i32(temp, temp, mask); tcg_gen_andi_i32(fcsr0, fcsr0, ~mask); tcg_gen_or_i32(fcsr0, fcsr0, temp); @@ -127,32 +130,34 @@ static bool trans_movfcsr2gr(DisasContext *ctx, arg_movfcsr2gr *a) CHECK_FPE; - tcg_gen_ld32u_i64(dest, tcg_env, offsetof(CPULoongArchState, fcsr0)); - tcg_gen_andi_i64(dest, dest, fcsr_mask[a->fcsrs]); + tcg_gen_ld32u_tl(dest, tcg_env, offsetof(CPULoongArchState, fcsr0)); + tcg_gen_andi_tl(dest, dest, fcsr_mask[a->fcsrs]); gen_set_gpr(a->rd, dest, EXT_NONE); return true; } -static void gen_movgr2fr_w(TCGv dest, TCGv src) +static void gen_movgr2fr_w(TCGv_i64 dest, TCGv_i64 src) { + tcg_gen_deposit_i64(dest, dest, src, 0, 32); } -static void gen_movgr2frh_w(TCGv dest, TCGv src) +static void gen_movgr2frh_w(TCGv_i64 dest, TCGv_i64 src) { tcg_gen_deposit_i64(dest, dest, src, 32, 32); } -static void gen_movfrh2gr_s(TCGv dest, TCGv src) +static void gen_movfrh2gr_s(TCGv_i64 dest, TCGv_i64 src) { - tcg_gen_sextract_tl(dest, src, 32, 32); + tcg_gen_sextract_i64(dest, src, 32, 32); + tcg_gen_ext32s_i64(dest, dest); } static bool trans_movfr2cf(DisasContext *ctx, arg_movfr2cf *a) { - TCGv t0; - TCGv src = get_fpr(ctx, a->fj); + TCGv_i64 t0; + TCGv_i64 src = get_fpr(ctx, a->fj); if (!avail_FP(ctx)) { return false; @@ -160,16 +165,16 @@ static bool trans_movfr2cf(DisasContext *ctx, arg_movfr2cf *a) CHECK_FPE; - t0 = tcg_temp_new(); - tcg_gen_andi_tl(t0, src, 0x1); - tcg_gen_st8_tl(t0, tcg_env, offsetof(CPULoongArchState, cf[a->cd & 0x7])); + t0 = tcg_temp_new_i64(); + tcg_gen_andi_i64(t0, src, 0x1); + tcg_gen_st8_i64(t0, tcg_env, offsetof(CPULoongArchState, cf[a->cd & 0x7])); return true; } static bool trans_movcf2fr(DisasContext *ctx, arg_movcf2fr *a) { - TCGv dest = get_fpr(ctx, a->fd); + TCGv_i64 dest = get_fpr(ctx, a->fd); if (!avail_FP(ctx)) { return false; @@ -177,7 +182,7 @@ static bool trans_movcf2fr(DisasContext *ctx, arg_movcf2fr *a) CHECK_FPE; - tcg_gen_ld8u_tl(dest, tcg_env, + tcg_gen_ld8u_i64(dest, tcg_env, offsetof(CPULoongArchState, cf[a->cj & 0x7])); set_fpr(a->fd, dest); @@ -214,11 +219,11 @@ static bool trans_movcf2gr(DisasContext *ctx, arg_movcf2gr *a) return true; } -TRANS(fmov_s, FP_SP, gen_f2f, tcg_gen_mov_tl, true) -TRANS(fmov_d, FP_DP, gen_f2f, tcg_gen_mov_tl, false) +TRANS(fmov_s, FP_SP, gen_f2f, tcg_gen_mov_i64, true) +TRANS(fmov_d, FP_DP, gen_f2f, tcg_gen_mov_i64, false) TRANS(movgr2fr_w, FP_SP, gen_r2f, gen_movgr2fr_w) -TRANS(movgr2fr_d, 64, gen_r2f, tcg_gen_mov_tl) +TRANS(movgr2fr_d, 64, gen_r2f, tcg_gen_mov_i64) TRANS(movgr2frh_w, FP_DP, gen_r2f, gen_movgr2frh_w) -TRANS(movfr2gr_s, FP_SP, gen_f2r, tcg_gen_ext32s_tl) -TRANS(movfr2gr_d, 64, gen_f2r, tcg_gen_mov_tl) +TRANS(movfr2gr_s, FP_SP, gen_f2r, tcg_gen_ext32s_i64) +TRANS(movfr2gr_d, 64, gen_f2r, tcg_gen_mov_i64) TRANS(movfrh2gr_s, FP_DP, gen_f2r, gen_movfrh2gr_s) diff --git a/target/loongarch/tcg/translate.c b/target/loongarch/tcg/translate.c index 3939670e18d01bd9fc08861532166882fbd3f890..6494fac6aac04f495c18b4326bf271902d9df323 100644 --- a/target/loongarch/tcg/translate.c +++ b/target/loongarch/tcg/translate.c @@ -218,15 +218,15 @@ static void gen_set_gpr(int reg_num, TCGv t, DisasExtend dst_ext) } } -static TCGv get_fpr(DisasContext *ctx, int reg_num) +static TCGv_i64 get_fpr(DisasContext *ctx, int reg_num) { - TCGv t = tcg_temp_new(); + TCGv_i64 t = tcg_temp_new_i64(); tcg_gen_ld_i64(t, tcg_env, offsetof(CPULoongArchState, fpr[reg_num].vreg.D(0))); return t; } -static void set_fpr(int reg_num, TCGv val) +static void set_fpr(int reg_num, TCGv_i64 val) { tcg_gen_st_i64(val, tcg_env, offsetof(CPULoongArchState, fpr[reg_num].vreg.D(0))); From patchwork Thu Dec 26 21:19:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiaxun Yang X-Patchwork-Id: 13921453 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 56735E7718F for ; Thu, 26 Dec 2024 21:23:41 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tQvH8-0003mj-Sk; Thu, 26 Dec 2024 16:20:12 -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 1tQvH6-0003lQ-9u for qemu-devel@nongnu.org; Thu, 26 Dec 2024 16:20:08 -0500 Received: from fhigh-a4-smtp.messagingengine.com ([103.168.172.155]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tQvH4-0003B8-IZ for qemu-devel@nongnu.org; Thu, 26 Dec 2024 16:20:08 -0500 Received: from phl-compute-04.internal (phl-compute-04.phl.internal [10.202.2.44]) by mailfhigh.phl.internal (Postfix) with ESMTP id 1DE1D1140190; Thu, 26 Dec 2024 16:20:06 -0500 (EST) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-04.internal (MEProxy); Thu, 26 Dec 2024 16:20:06 -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=1735248006; x=1735334406; bh=eXHJ1U0y5JFh/QMeXDd3F6H0yuNld44iqz4yHUgHQtE=; b= O5nSkTDVhhCHrlCFCyChbsi9P5A9iu3HffocL0LxZhrOfjW1wq3P3l8l5O574Ed1 gRngU6fMTq8PvNqnV4Bo1QuwLFct3YaTxn4dLuO374s2bILKVAaudUw6jffI/C+w IOixXL0DZBO6WucDhnC8m/GXCEmv459aUdPFTE9GnV3wEZl4l/nKM4q4sy3hpkoZ IbKl11YFY+1Wv0a8O7pnzhIlZhoc2Su1s/O7x2sOZXRowOZpc4kEqdG0O/ZPXpF3 bPZtF1UUirYTQNuT2k4CibZkqxKQi1d5CUmMB3Xtit0aCodz/0Q3gIO7C/3XUjhx Q1P8gTYUjtw/xNnUSuFfGg== 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=1735248006; x= 1735334406; bh=eXHJ1U0y5JFh/QMeXDd3F6H0yuNld44iqz4yHUgHQtE=; b=U G1IGJp1NY1Jzh2H3qi2pxtAaTvCS7Lcdyo1v4984B9i4DiMFEYvkqhkRrhvO7OPi O8lLrGzOUMXPj4dWDOqAsUGu92/ujrVmF7JSr/mBdpbfP/lL7y3zEJUA0MnuWZ1k hxodHQFFXCQQUk4IUsgjSg5vM1uzK0c18Tfw2uQ0562ByCPyd6sZvADC941Znbxa Kz9tRV/eRAgf1RE9+GMHPSYzFciUHyNmPb9NIWD+TKlodIoGbyU2Mf6tSiN5ki+D XqtDFTvTl7ix3GYk//sgGpFKxXEj5dMyip9mhybghufDkmQ3CtmRX/RZlJpaleXD x5VmIltcvdDm3KHe54+FQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddruddukedgudegkecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdp uffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivg hnthhsucdlqddutddtmdenucfjughrpefhfffugggtgffkfhgjvfevofesthejredtredt jeenucfhrhhomheplfhirgiguhhnucgjrghnghcuoehjihgrgihunhdrhigrnhhgsehflh ihghhorghtrdgtohhmqeenucggtffrrghtthgvrhhnpedvkeeihfefveekueevteefleff keegudeghfdtuddugefhueevgeffgedukeejleenucevlhhushhtvghrufhiiigvpedune curfgrrhgrmhepmhgrihhlfhhrohhmpehjihgrgihunhdrhigrnhhgsehflhihghhorght rdgtohhmpdhnsggprhgtphhtthhopeduvddpmhhouggvpehsmhhtphhouhhtpdhrtghpth htohepmhgrohgsihgsoheslhhoohhnghhsohhnrdgtnhdprhgtphhtthhopehmrghrtggv lhdrrghpfhgvlhgsrghumhesghhmrghilhdrtghomhdprhgtphhtthhopehpsghonhiiih hnihesrhgvughhrghtrdgtohhmpdhrtghpthhtohepghgrohhsohhngheslhhoohhnghhs ohhnrdgtnhdprhgtphhtthhopegvsghlrghkvgesrhgvughhrghtrdgtohhmpdhrtghpth htohepjhhirgiguhhnrdihrghnghesfhhlhihgohgrthdrtghomhdprhgtphhtthhopehq vghmuhdquggvvhgvlhesnhhonhhgnhhurdhorhhgpdhrtghpthhtohepfigrnhhghigrnh grnhehheeshhhurgifvghirdgtohhmpdhrtghpthhtohepiihhrghouddrlhhiuhesihhn thgvlhdrtghomh X-ME-Proxy: Feedback-ID: ifd894703:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 26 Dec 2024 16:20:04 -0500 (EST) From: Jiaxun Yang Date: Thu, 26 Dec 2024 21:19:42 +0000 Subject: [PATCH v2 11/23] target/loongarch: Scrutinise TCG vector translation for 32 bit build MIME-Version: 1.0 Message-Id: <20241226-la32-fixes1-v2-11-0414594f8cb5@flygoat.com> References: <20241226-la32-fixes1-v2-0-0414594f8cb5@flygoat.com> In-Reply-To: <20241226-la32-fixes1-v2-0-0414594f8cb5@flygoat.com> To: qemu-devel@nongnu.org Cc: Song Gao , Bibo Mao , Eric Blake , Markus Armbruster , Eduardo Habkost , Marcel Apfelbaum , =?utf-8?q?Philippe_Mathieu-?= =?utf-8?q?Daud=C3=A9?= , Yanan Wang , Zhao Liu , Paolo Bonzini , Jiaxun Yang X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=7548; i=jiaxun.yang@flygoat.com; h=from:subject:message-id; bh=B9h13SA8JedUvZZiyRlBBN5M0kMQWk0GNpXduoTwOTc=; b=owGbwMvMwCXmXMhTe71c8zDjabUkhvTcE9lhJxmyRU5sL1Jb9Wxh0T+JzjVbu5o+yT0661cWH dyvW7++o5SFQYyLQVZMkSVEQKlvQ+PFBdcfZP2BmcPKBDKEgYtTACayu4nhf5Q019n9EznL3NJC UoVFrrnvP9C4cvmdtxo+NjdT7vBdE2JkWLlyUgffmypxE+XNwjlh3qt/rz69YupzX8cpzw28s6I N2QE= X-Developer-Key: i=jiaxun.yang@flygoat.com; a=openpgp; fpr=980379BEFEBFBF477EA04EF9C111949073FC0F67 Received-SPF: pass client-ip=103.168.172.155; envelope-from=jiaxun.yang@flygoat.com; helo=fhigh-a4-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_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_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 Fix types for various TCGv. Performing TCGv type conversion as necessary when interaction with GPR happens. Signed-off-by: Jiaxun Yang --- target/loongarch/tcg/insn_trans/trans_vec.c.inc | 70 +++++++++++++------------ 1 file changed, 36 insertions(+), 34 deletions(-) diff --git a/target/loongarch/tcg/insn_trans/trans_vec.c.inc b/target/loongarch/tcg/insn_trans/trans_vec.c.inc index 92b1d22e28934b524a1f6ae6cb2bcbb189de27e3..e8015a332636d77ba72aeefde2e4135cdf2543a2 100644 --- a/target/loongarch/tcg/insn_trans/trans_vec.c.inc +++ b/target/loongarch/tcg/insn_trans/trans_vec.c.inc @@ -4761,7 +4761,8 @@ static bool trans_## NAME (DisasContext *ctx, arg_cv *a) \ \ tcg_gen_or_i64(t1, al, ah); \ tcg_gen_setcondi_i64(COND, t1, t1, 0); \ - tcg_gen_st8_tl(t1, tcg_env, offsetof(CPULoongArchState, cf[a->cd & 0x7])); \ + tcg_gen_st8_i64(t1, tcg_env, offsetof(CPULoongArchState, \ + cf[a->cd & 0x7])); \ \ return true; \ } @@ -4807,7 +4808,8 @@ static bool trans_## NAME(DisasContext *ctx, arg_cv * a) \ tcg_gen_or_i64(t2, d[2], d[3]); \ tcg_gen_or_i64(t1, t2, t1); \ tcg_gen_setcondi_i64(COND, t1, t1, 0); \ - tcg_gen_st8_tl(t1, tcg_env, offsetof(CPULoongArchState, cf[a->cd & 0x7])); \ + tcg_gen_st8_i64(t1, tcg_env, offsetof(CPULoongArchState, \ + cf[a->cd & 0x7])); \ \ return true; \ } @@ -4850,12 +4852,12 @@ static bool gen_g2x(DisasContext *ctx, arg_vr_i *a, MemOp mop, return gen_g2v_vl(ctx, a, 32, mop, func); } -TRANS(vinsgr2vr_b, LSX, gen_g2v, MO_8, tcg_gen_st8_i64) -TRANS(vinsgr2vr_h, LSX, gen_g2v, MO_16, tcg_gen_st16_i64) -TRANS(vinsgr2vr_w, LSX, gen_g2v, MO_32, tcg_gen_st32_i64) -TRANS(vinsgr2vr_d, LSX, gen_g2v, MO_64, tcg_gen_st_i64) -TRANS(xvinsgr2vr_w, LASX, gen_g2x, MO_32, tcg_gen_st32_i64) -TRANS(xvinsgr2vr_d, LASX, gen_g2x, MO_64, tcg_gen_st_i64) +TRANS(vinsgr2vr_b, LSX, gen_g2v, MO_8, tcg_gen_st8_tl) +TRANS(vinsgr2vr_h, LSX, gen_g2v, MO_16, tcg_gen_st16_tl) +TRANS(vinsgr2vr_w, LSX, gen_g2v, MO_32, tcg_gen_st32_tl) +TRANS(vinsgr2vr_d, LSX, gen_g2v, MO_64, tcg_gen_st_tl) +TRANS(xvinsgr2vr_w, LASX, gen_g2x, MO_32, tcg_gen_st32_tl) +TRANS(xvinsgr2vr_d, LASX, gen_g2x, MO_64, tcg_gen_st_tl) static bool gen_v2g_vl(DisasContext *ctx, arg_rv_i *a, uint32_t oprsz, MemOp mop, void (*func)(TCGv, TCGv_ptr, tcg_target_long)) @@ -4883,18 +4885,18 @@ static bool gen_x2g(DisasContext *ctx, arg_rv_i *a, MemOp mop, return gen_v2g_vl(ctx, a, 32, mop, func); } -TRANS(vpickve2gr_b, LSX, gen_v2g, MO_8, tcg_gen_ld8s_i64) -TRANS(vpickve2gr_h, LSX, gen_v2g, MO_16, tcg_gen_ld16s_i64) -TRANS(vpickve2gr_w, LSX, gen_v2g, MO_32, tcg_gen_ld32s_i64) -TRANS(vpickve2gr_d, LSX, gen_v2g, MO_64, tcg_gen_ld_i64) -TRANS(vpickve2gr_bu, LSX, gen_v2g, MO_8, tcg_gen_ld8u_i64) -TRANS(vpickve2gr_hu, LSX, gen_v2g, MO_16, tcg_gen_ld16u_i64) -TRANS(vpickve2gr_wu, LSX, gen_v2g, MO_32, tcg_gen_ld32u_i64) -TRANS(vpickve2gr_du, LSX, gen_v2g, MO_64, tcg_gen_ld_i64) -TRANS(xvpickve2gr_w, LASX, gen_x2g, MO_32, tcg_gen_ld32s_i64) -TRANS(xvpickve2gr_d, LASX, gen_x2g, MO_64, tcg_gen_ld_i64) -TRANS(xvpickve2gr_wu, LASX, gen_x2g, MO_32, tcg_gen_ld32u_i64) -TRANS(xvpickve2gr_du, LASX, gen_x2g, MO_64, tcg_gen_ld_i64) +TRANS(vpickve2gr_b, LSX, gen_v2g, MO_8, tcg_gen_ld8s_tl) +TRANS(vpickve2gr_h, LSX, gen_v2g, MO_16, tcg_gen_ld16s_tl) +TRANS(vpickve2gr_w, LSX, gen_v2g, MO_32, tcg_gen_ld32s_tl) +TRANS(vpickve2gr_d, LSX, gen_v2g, MO_64, tcg_gen_ld_tl) +TRANS(vpickve2gr_bu, LSX, gen_v2g, MO_8, tcg_gen_ld8u_tl) +TRANS(vpickve2gr_hu, LSX, gen_v2g, MO_16, tcg_gen_ld16u_tl) +TRANS(vpickve2gr_wu, LSX, gen_v2g, MO_32, tcg_gen_ld32u_tl) +TRANS(vpickve2gr_du, LSX, gen_v2g, MO_64, tcg_gen_ld_tl) +TRANS(xvpickve2gr_w, LASX, gen_x2g, MO_32, tcg_gen_ld32s_tl) +TRANS(xvpickve2gr_d, LASX, gen_x2g, MO_64, tcg_gen_ld_tl) +TRANS(xvpickve2gr_wu, LASX, gen_x2g, MO_32, tcg_gen_ld32u_tl) +TRANS(xvpickve2gr_du, LASX, gen_x2g, MO_64, tcg_gen_ld_tl) static bool gvec_dup_vl(DisasContext *ctx, arg_vr *a, uint32_t oprsz, MemOp mop) @@ -4905,8 +4907,8 @@ static bool gvec_dup_vl(DisasContext *ctx, arg_vr *a, return true; } - tcg_gen_gvec_dup_i64(mop, vec_full_offset(a->vd), - oprsz, ctx->vl/8, src); + tcg_gen_gvec_dup_tl(mop, vec_full_offset(a->vd), + oprsz, ctx->vl/TARGET_LONG_SIZE, src); return true; } @@ -5007,8 +5009,8 @@ static bool gen_vreplve_vl(DisasContext *ctx, arg_vvr *a, if (!check_vec(ctx, oprsz)) { return true; } - - tcg_gen_andi_i64(t0, gpr_src(ctx, a->rk, EXT_NONE), (LSX_LEN / bit) - 1); + tcg_gen_extu_tl_i64(t2, gpr_src(ctx, a->rk, EXT_NONE)); + tcg_gen_andi_i64(t0, t2, (LSX_LEN / bit) - 1); tcg_gen_shli_i64(t0, t0, vece); if (HOST_BIG_ENDIAN) { tcg_gen_xori_i64(t0, t0, vece << ((LSX_LEN / bit) - 1)); @@ -5099,10 +5101,10 @@ static bool do_vbsll_v(DisasContext *ctx, arg_vv_i *a, uint32_t oprsz) } for (i = 0; i < oprsz / 16; i++) { - TCGv desthigh = tcg_temp_new_i64(); - TCGv destlow = tcg_temp_new_i64(); - TCGv high = tcg_temp_new_i64(); - TCGv low = tcg_temp_new_i64(); + TCGv_i64 desthigh = tcg_temp_new_i64(); + TCGv_i64 destlow = tcg_temp_new_i64(); + TCGv_i64 high = tcg_temp_new_i64(); + TCGv_i64 low = tcg_temp_new_i64(); get_vreg64(low, a->vj, 2 * i); @@ -5131,10 +5133,10 @@ static bool do_vbsrl_v(DisasContext *ctx, arg_vv_i *a, uint32_t oprsz) } for (i = 0; i < oprsz / 16; i++) { - TCGv desthigh = tcg_temp_new_i64(); - TCGv destlow = tcg_temp_new_i64(); - TCGv high = tcg_temp_new_i64(); - TCGv low = tcg_temp_new_i64(); + TCGv_i64 desthigh = tcg_temp_new_i64(); + TCGv_i64 destlow = tcg_temp_new_i64(); + TCGv_i64 high = tcg_temp_new_i64(); + TCGv_i64 low = tcg_temp_new_i64(); get_vreg64(high, a->vj, 2 * i + 1); ofs = ((a->imm) & 0xf) * 8; @@ -5459,7 +5461,7 @@ static void gen_xvld(DisasContext *ctx, int vreg, TCGv addr) { int i; TCGv temp = tcg_temp_new(); - TCGv dest = tcg_temp_new(); + TCGv_i64 dest = tcg_temp_new_i64(); tcg_gen_qemu_ld_i64(dest, addr, ctx->mem_idx, MO_TEUQ); set_vreg64(dest, vreg, 0); @@ -5475,7 +5477,7 @@ static void gen_xvst(DisasContext * ctx, int vreg, TCGv addr) { int i; TCGv temp = tcg_temp_new(); - TCGv dest = tcg_temp_new(); + TCGv_i64 dest = tcg_temp_new_i64(); get_vreg64(dest, vreg, 0); tcg_gen_qemu_st_i64(dest, addr, ctx->mem_idx, MO_TEUQ); From patchwork Thu Dec 26 21:19:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiaxun Yang X-Patchwork-Id: 13921432 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 C3116E77188 for ; Thu, 26 Dec 2024 21:20:44 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tQvHC-0003oE-Oz; Thu, 26 Dec 2024 16:20:14 -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 1tQvH8-0003mp-7e for qemu-devel@nongnu.org; Thu, 26 Dec 2024 16:20:11 -0500 Received: from fout-a1-smtp.messagingengine.com ([103.168.172.144]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tQvH6-0003BU-K7 for qemu-devel@nongnu.org; Thu, 26 Dec 2024 16:20:09 -0500 Received: from phl-compute-03.internal (phl-compute-03.phl.internal [10.202.2.43]) by mailfout.phl.internal (Postfix) with ESMTP id 2D14113801EB; Thu, 26 Dec 2024 16:20:08 -0500 (EST) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-03.internal (MEProxy); Thu, 26 Dec 2024 16:20:08 -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=1735248008; x=1735334408; bh=6l3LIdh4Ax+Fdtk2OiropCXlcNte8uxjPLdCcQLxLQI=; b= Qdsf66LumW6+mbax+8swojAl+NT97JrY23ASPsohyhx5R/IYqOmKqRRxwG2oNecz tKpOT8lh0SVFiO7XXkYEWzUTmcZd9uslA0RXw61VFuz1aENKseId2YptZ2BtPm1x 30xogz3W+rbZgzzQQUQ1yzmL8XcnCqLgCTDgj/SyAt3HmOXT1iNCmgGvnVEZqMek XpS5Xkmc0wCbu9ACO6wf31u9lW1QohlfcgO22XXoPCSOfhhZj0+S3wU+aP+DTmMa gdCXeqXnS05ytGcRhdUSSwwvbJvdREZFcU/qN5mrm9i8AO+z24yYQU1V3ovrAS8i kQRyWQECMhS2vtSOzcIEOQ== 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=1735248008; x= 1735334408; bh=6l3LIdh4Ax+Fdtk2OiropCXlcNte8uxjPLdCcQLxLQI=; b=k ZcHDRIszTsOL6+cbFBmzzA6UQbE8pXN8228xmQ/ieOePA5O4HoXzPmyVojlEOKpH Kr53V9d7elP+jRJnFYR1QIh5bjjYKK4raD9gmCAE7ThK4wQgSRhgJ9238k2tVSqb ahk7qnInEkpGplcf+vs42I5t8DJRjzNzvxEqwpriQJIS1YiSQytbpAwvcW11I6vi 8Z6zly8GKIG+2/TCHX5gr9EQkroUT8G3U3CzY/c0HFCN/UGtAF23FgEkaO8N/LWn fofKdKzxlQ9i9b8Lxn/fXLxjBJUwec0Pkjp7VyoToIgQFVnYhzdSb6BTjkHEGLsa zmp4ymc/CieXXyLEWYl5Q== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddruddukedgudegjecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdp uffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivg hnthhsucdlqddutddtmdenucfjughrpefhfffugggtgffkfhgjvfevofesthejredtredt jeenucfhrhhomheplfhirgiguhhnucgjrghnghcuoehjihgrgihunhdrhigrnhhgsehflh ihghhorghtrdgtohhmqeenucggtffrrghtthgvrhhnpedvkeeihfefveekueevteefleff keegudeghfdtuddugefhueevgeffgedukeejleenucevlhhushhtvghrufhiiigvpedtne curfgrrhgrmhepmhgrihhlfhhrohhmpehjihgrgihunhdrhigrnhhgsehflhihghhorght rdgtohhmpdhnsggprhgtphhtthhopeduvddpmhhouggvpehsmhhtphhouhhtpdhrtghpth htohepmhgrohgsihgsoheslhhoohhnghhsohhnrdgtnhdprhgtphhtthhopehmrghrtggv lhdrrghpfhgvlhgsrghumhesghhmrghilhdrtghomhdprhgtphhtthhopehpsghonhiiih hnihesrhgvughhrghtrdgtohhmpdhrtghpthhtohepghgrohhsohhngheslhhoohhnghhs ohhnrdgtnhdprhgtphhtthhopegvsghlrghkvgesrhgvughhrghtrdgtohhmpdhrtghpth htohepjhhirgiguhhnrdihrghnghesfhhlhihgohgrthdrtghomhdprhgtphhtthhopehq vghmuhdquggvvhgvlhesnhhonhhgnhhurdhorhhgpdhrtghpthhtohepfigrnhhghigrnh grnhehheeshhhurgifvghirdgtohhmpdhrtghpthhtohepiihhrghouddrlhhiuhesihhn thgvlhdrtghomh X-ME-Proxy: Feedback-ID: ifd894703:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 26 Dec 2024 16:20:06 -0500 (EST) From: Jiaxun Yang Date: Thu, 26 Dec 2024 21:19:43 +0000 Subject: [PATCH v2 12/23] target/loongarch: Scrutinise TCG bitops translation for 32 bit build MIME-Version: 1.0 Message-Id: <20241226-la32-fixes1-v2-12-0414594f8cb5@flygoat.com> References: <20241226-la32-fixes1-v2-0-0414594f8cb5@flygoat.com> In-Reply-To: <20241226-la32-fixes1-v2-0-0414594f8cb5@flygoat.com> To: qemu-devel@nongnu.org Cc: Song Gao , Bibo Mao , Eric Blake , Markus Armbruster , Eduardo Habkost , Marcel Apfelbaum , =?utf-8?q?Philippe_Mathieu-?= =?utf-8?q?Daud=C3=A9?= , Yanan Wang , Zhao Liu , Paolo Bonzini , Jiaxun Yang X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=3897; i=jiaxun.yang@flygoat.com; h=from:subject:message-id; bh=LoLAL627BxLCze3ZeL8YpKlbo0GtOQXjE4HP5ezEovE=; b=owGbwMvMwCXmXMhTe71c8zDjabUkhvTcE9kTlkY0JblOmNmZ4FCS6shoK9Sx9AfjmcMmtQUWc zYvW2/VUcrCIMbFICumyBIioNS3ofHigusPsv7AzGFlAhnCwMUpABNx+crIcHS/wFn2hwV1xUvm 79zx7svqoBvmrXM7k2tFrD6IZf/TusDw3+Vb5t70qlffrinUZTqs2ZR2e9u1jR3fpZ/f83HRFdU 25QMA X-Developer-Key: i=jiaxun.yang@flygoat.com; a=openpgp; fpr=980379BEFEBFBF477EA04EF9C111949073FC0F67 Received-SPF: pass client-ip=103.168.172.144; envelope-from=jiaxun.yang@flygoat.com; helo=fout-a1-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_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_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 Use tl variant whenever possible. Silent compiler warnings by performing casting for come consts. Signed-off-by: Jiaxun Yang --- target/loongarch/tcg/insn_trans/trans_bit.c.inc | 34 ++++++++++++++----------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/target/loongarch/tcg/insn_trans/trans_bit.c.inc b/target/loongarch/tcg/insn_trans/trans_bit.c.inc index ee5fa003ce06a1910f826c3eb96d1d532c32e02c..a40346a670be31a123848e8ea5f7b94f8372976b 100644 --- a/target/loongarch/tcg/insn_trans/trans_bit.c.inc +++ b/target/loongarch/tcg/insn_trans/trans_bit.c.inc @@ -18,13 +18,17 @@ static bool gen_rr(DisasContext *ctx, arg_rr *a, static void gen_bytepick_w(TCGv dest, TCGv src1, TCGv src2, target_long sa) { +#ifdef TARGET_LOONGARCH64 tcg_gen_concat_tl_i64(dest, src1, src2); tcg_gen_sextract_i64(dest, dest, (32 - sa * 8), 32); +#else + tcg_gen_extract2_tl(dest, src1, src2, (32 - sa * 8)); +#endif } static void gen_bytepick_d(TCGv dest, TCGv src1, TCGv src2, target_long sa) { - tcg_gen_extract2_i64(dest, src1, src2, (64 - sa * 8)); + tcg_gen_extract2_tl(dest, src1, src2, (64 - sa * 8)); } static bool gen_bstrins(DisasContext *ctx, arg_rr_ms_ls *a, @@ -85,7 +89,7 @@ static void gen_cto_w(TCGv dest, TCGv src1) static void gen_clz_d(TCGv dest, TCGv src1) { - tcg_gen_clzi_i64(dest, src1, TARGET_LONG_BITS); + tcg_gen_clzi_tl(dest, src1, TARGET_LONG_BITS); } static void gen_clo_d(TCGv dest, TCGv src1) @@ -107,8 +111,8 @@ static void gen_cto_d(TCGv dest, TCGv src1) static void gen_revb_2w(TCGv dest, TCGv src1) { - tcg_gen_bswap64_i64(dest, src1); - tcg_gen_rotri_i64(dest, dest, 32); + tcg_gen_bswap_tl(dest, src1); + tcg_gen_rotri_tl(dest, dest, 32); } static void gen_revb_2h(TCGv dest, TCGv src1) @@ -126,7 +130,7 @@ static void gen_revb_2h(TCGv dest, TCGv src1) static void gen_revb_4h(TCGv dest, TCGv src1) { - TCGv mask = tcg_constant_tl(0x00FF00FF00FF00FFULL); + TCGv mask = tcg_constant_tl((target_ulong)0x00FF00FF00FF00FFULL); TCGv t0 = tcg_temp_new(); TCGv t1 = tcg_temp_new(); @@ -139,22 +143,22 @@ static void gen_revb_4h(TCGv dest, TCGv src1) static void gen_revh_2w(TCGv dest, TCGv src1) { - TCGv_i64 t0 = tcg_temp_new_i64(); - TCGv_i64 t1 = tcg_temp_new_i64(); - TCGv_i64 mask = tcg_constant_i64(0x0000ffff0000ffffull); + TCGv t0 = tcg_temp_new(); + TCGv t1 = tcg_temp_new(); + TCGv mask = tcg_constant_tl((target_ulong)0x0000ffff0000ffffull); - tcg_gen_shri_i64(t0, src1, 16); - tcg_gen_and_i64(t1, src1, mask); - tcg_gen_and_i64(t0, t0, mask); - tcg_gen_shli_i64(t1, t1, 16); - tcg_gen_or_i64(dest, t1, t0); + tcg_gen_shri_tl(t0, src1, 16); + tcg_gen_and_tl(t1, src1, mask); + tcg_gen_and_tl(t0, t0, mask); + tcg_gen_shli_tl(t1, t1, 16); + tcg_gen_or_tl(dest, t1, t0); } static void gen_revh_d(TCGv dest, TCGv src1) { TCGv t0 = tcg_temp_new(); TCGv t1 = tcg_temp_new(); - TCGv mask = tcg_constant_tl(0x0000FFFF0000FFFFULL); + TCGv mask = tcg_constant_tl((target_ulong)0x0000FFFF0000FFFFULL); tcg_gen_shri_tl(t1, src1, 16); tcg_gen_and_tl(t1, t1, mask); @@ -191,7 +195,7 @@ TRANS(ctz_d, 64, gen_rr, EXT_NONE, EXT_NONE, gen_ctz_d) TRANS(revb_2h, ALL, gen_rr, EXT_NONE, EXT_SIGN, gen_revb_2h) TRANS(revb_4h, 64, gen_rr, EXT_NONE, EXT_NONE, gen_revb_4h) TRANS(revb_2w, 64, gen_rr, EXT_NONE, EXT_NONE, gen_revb_2w) -TRANS(revb_d, 64, gen_rr, EXT_NONE, EXT_NONE, tcg_gen_bswap64_i64) +TRANS(revb_d, 64, gen_rr, EXT_NONE, EXT_NONE, tcg_gen_bswap_tl) TRANS(revh_2w, 64, gen_rr, EXT_NONE, EXT_NONE, gen_revh_2w) TRANS(revh_d, 64, gen_rr, EXT_NONE, EXT_NONE, gen_revh_d) TRANS(bitrev_4b, ALL, gen_rr, EXT_ZERO, EXT_SIGN, gen_helper_bitswap) From patchwork Thu Dec 26 21:19:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiaxun Yang X-Patchwork-Id: 13921451 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 BDE39E77188 for ; Thu, 26 Dec 2024 21:23:29 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tQvHE-0003oe-3g; Thu, 26 Dec 2024 16:20:16 -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 1tQvHB-0003o0-IJ for qemu-devel@nongnu.org; Thu, 26 Dec 2024 16:20:14 -0500 Received: from fhigh-a4-smtp.messagingengine.com ([103.168.172.155]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tQvH8-0003Bm-EP for qemu-devel@nongnu.org; Thu, 26 Dec 2024 16:20:11 -0500 Received: from phl-compute-04.internal (phl-compute-04.phl.internal [10.202.2.44]) by mailfhigh.phl.internal (Postfix) with ESMTP id 002E5114018F; Thu, 26 Dec 2024 16:20:10 -0500 (EST) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-04.internal (MEProxy); Thu, 26 Dec 2024 16:20:09 -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=1735248009; x=1735334409; bh=M3agoKfwtNZT3tIbqyd6WdpZVjvJbxjbx3xjLJb8/7U=; b= sDddRUi+GlrwEA0L4zkWs8slarPJjnPNe5/A1pzUtofWrtPeAnljOifMiH8b5+1Z rH4JY9O50U/glIkcX13VI8bwzuTAVo4fx9pIUy6E9tPz9vvUR6i4ts1JNyesqsOS cvcR4kZn7L7yhB91ttrbPVJQ7Mp8vpECn/lqh9Vq1JZ0GtO7+ifpM604iFhI0Z5k TnMNIvSoeorzzmof90PClSd68WdbGQzOhtob1njIfwHnlIcz/2/yzgaYI3crpeWc NpvjykGSoHwEtrA0W1Rg7GUvRT7ZMfhhF4Yt/4WHmGU7Lazn7R+IulHSsGfHMHoa dBctDiWUW4NEiU1aZy4zFQ== 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=1735248009; x= 1735334409; bh=M3agoKfwtNZT3tIbqyd6WdpZVjvJbxjbx3xjLJb8/7U=; b=i Av95beNJuvNlP3qQlcj0ACid2nsxTj1LmnQZ71nps851On5tdMOb6Z3liD46QW9k FMfCnKh7Wh61if7gTbIFzhlR+JcKZoITqVDobewmjCj/pxjPeRdsn3p07NqHf3yu zlQx3ZB7Dx4ZBapvjzGjfcgw9KTAfLJGnuQYUFtg/eRXeUmTNh1EQ4afNwfeJFnQ BFyeFPXSV64oZEGUvFZtu6ceyjhlBo1WzHLhqW/ZzU72yNopUMFyZkgqzE5/6pkE bkd1ND/SK4uDH7IevhAWhdxaL7mWS3MwMNploTSYeb6pRPvypUduGfBoESnNFsAN lkN4Mxf+eNmlDzy1tzMMg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddruddukedgudegkecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdp uffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivg hnthhsucdlqddutddtmdenucfjughrpefhfffugggtgffkfhgjvfevofesthejredtredt jeenucfhrhhomheplfhirgiguhhnucgjrghnghcuoehjihgrgihunhdrhigrnhhgsehflh ihghhorghtrdgtohhmqeenucggtffrrghtthgvrhhnpedvkeeihfefveekueevteefleff keegudeghfdtuddugefhueevgeffgedukeejleenucevlhhushhtvghrufhiiigvpedune curfgrrhgrmhepmhgrihhlfhhrohhmpehjihgrgihunhdrhigrnhhgsehflhihghhorght rdgtohhmpdhnsggprhgtphhtthhopeduvddpmhhouggvpehsmhhtphhouhhtpdhrtghpth htohepmhgrohgsihgsoheslhhoohhnghhsohhnrdgtnhdprhgtphhtthhopehmrghrtggv lhdrrghpfhgvlhgsrghumhesghhmrghilhdrtghomhdprhgtphhtthhopehpsghonhiiih hnihesrhgvughhrghtrdgtohhmpdhrtghpthhtohepghgrohhsohhngheslhhoohhnghhs ohhnrdgtnhdprhgtphhtthhopegvsghlrghkvgesrhgvughhrghtrdgtohhmpdhrtghpth htohepjhhirgiguhhnrdihrghnghesfhhlhihgohgrthdrtghomhdprhgtphhtthhopehq vghmuhdquggvvhgvlhesnhhonhhgnhhurdhorhhgpdhrtghpthhtohepfigrnhhghigrnh grnhehheeshhhurgifvghirdgtohhmpdhrtghpthhtohepiihhrghouddrlhhiuhesihhn thgvlhdrtghomh X-ME-Proxy: Feedback-ID: ifd894703:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 26 Dec 2024 16:20:08 -0500 (EST) From: Jiaxun Yang Date: Thu, 26 Dec 2024 21:19:44 +0000 Subject: [PATCH v2 13/23] target/loongarch: Fix rdtimer on 32bit build MIME-Version: 1.0 Message-Id: <20241226-la32-fixes1-v2-13-0414594f8cb5@flygoat.com> References: <20241226-la32-fixes1-v2-0-0414594f8cb5@flygoat.com> In-Reply-To: <20241226-la32-fixes1-v2-0-0414594f8cb5@flygoat.com> To: qemu-devel@nongnu.org Cc: Song Gao , Bibo Mao , Eric Blake , Markus Armbruster , Eduardo Habkost , Marcel Apfelbaum , =?utf-8?q?Philippe_Mathieu-?= =?utf-8?q?Daud=C3=A9?= , Yanan Wang , Zhao Liu , Paolo Bonzini , Jiaxun Yang X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1304; i=jiaxun.yang@flygoat.com; h=from:subject:message-id; bh=e8KJe3ckOME7jpdGuarkSAXJviJf0h3QG8AzFQR7IKk=; b=owGbwMvMwCXmXMhTe71c8zDjabUkhvTcE9k+/yJYt/Hnbg+bkzDDk8s37mytp+npaC/e8GmPO iT0Ojk6SlkYxLgYZMUUWUIElPo2NF5ccP1B1h+YOaxMIEMYuDgFYCIFvIwMC+zXJv09G/Ty8eSm vdlex66XP0l6r/NS/7Uxv+7Zqxuf7GVkuO7d9vO4bCVvTMiW3kkfOOfKaH74rX/8ekSLZ772FRk hPgA= X-Developer-Key: i=jiaxun.yang@flygoat.com; a=openpgp; fpr=980379BEFEBFBF477EA04EF9C111949073FC0F67 Received-SPF: pass client-ip=103.168.172.155; envelope-from=jiaxun.yang@flygoat.com; helo=fhigh-a4-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_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_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 Use TCGv_i64 for intermediate values and perform truncation as necessary. Signed-off-by: Jiaxun Yang --- target/loongarch/tcg/insn_trans/trans_extra.c.inc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/target/loongarch/tcg/insn_trans/trans_extra.c.inc b/target/loongarch/tcg/insn_trans/trans_extra.c.inc index cfa361fecfa9ba569034b2c591b910ae7a3c6427..f9fb828ce51f2ee925edde7330d3054da534ecb3 100644 --- a/target/loongarch/tcg/insn_trans/trans_extra.c.inc +++ b/target/loongarch/tcg/insn_trans/trans_extra.c.inc @@ -46,13 +46,15 @@ static bool gen_rdtime(DisasContext *ctx, arg_rr *a, { TCGv dst1 = gpr_dst(ctx, a->rd, EXT_NONE); TCGv dst2 = gpr_dst(ctx, a->rj, EXT_NONE); + TCGv_i64 val = tcg_temp_new_i64(); translator_io_start(&ctx->base); - gen_helper_rdtime_d(dst1, tcg_env); + gen_helper_rdtime_d(val, tcg_env); if (word) { - tcg_gen_sextract_tl(dst1, dst1, high ? 32 : 0, 32); + tcg_gen_sextract_i64(val, val, high ? 32 : 0, 32); + tcg_gen_trunc_i64_tl(dst1, val); } - tcg_gen_ld_i64(dst2, tcg_env, offsetof(CPULoongArchState, CSR_TID)); + tcg_gen_ld_tl(dst2, tcg_env, offsetof(CPULoongArchState, CSR_TID)); return true; } From patchwork Thu Dec 26 21:19:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiaxun Yang X-Patchwork-Id: 13921448 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 90E12E77188 for ; Thu, 26 Dec 2024 21:22:38 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tQvHE-0003og-Km; Thu, 26 Dec 2024 16:20:16 -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 1tQvHD-0003oJ-Ck for qemu-devel@nongnu.org; Thu, 26 Dec 2024 16:20:15 -0500 Received: from fhigh-a4-smtp.messagingengine.com ([103.168.172.155]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tQvHB-0003C1-Bf for qemu-devel@nongnu.org; Thu, 26 Dec 2024 16:20:14 -0500 Received: from phl-compute-04.internal (phl-compute-04.phl.internal [10.202.2.44]) by mailfhigh.phl.internal (Postfix) with ESMTP id C2F3F1140192; Thu, 26 Dec 2024 16:20:11 -0500 (EST) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-04.internal (MEProxy); Thu, 26 Dec 2024 16:20:11 -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=1735248011; x=1735334411; bh=PUVE1pSS+sOSIryhoVTJh6X+Hzy5tNSPJV1bnADnqgo=; b= TREBfV5ggXjKH8XIxJ7pbpb1KxWuD7KxaR8kmyL5En4oxAvC1BdcXU+mcmZOgpg1 UjCFZSuxkalH20BeCKnLY7t9ZdngkslFeoYgqrDObeQR3+27w48jxXyc/lkFvljC iQGmDJovZOP3uRuQSYAz4QQS0r0RhPI3DlGk0mtqKg+sM7HTLdLZYGZLTB3ezOtk c+4q4ktc1hDzVDP2v5mxQEOQ3Tx0b5yDJvV1aGeskJxOlJtnD+6A8oFc4MGYtWE1 1Hq9O8zLwK7dyiHvWXkm0PIz6jlDlySLHMuzcJwZ6vpxrLLTCzl70G/2eAkAcnz4 nAz/nKbivskH8fHzXWgtKA== 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=1735248011; x= 1735334411; bh=PUVE1pSS+sOSIryhoVTJh6X+Hzy5tNSPJV1bnADnqgo=; b=g YT1sj4CAvKlWG3v6YAfnKUM0XouN2o7NLTX4p1Ig6+eOucygUNvLsO+7lx3Dsz6p 1aV6edn7GBkbJKixMDrIaRYHwpbXYRV9So9QP8uDx6L1WCORuxLNCeIupvr+SFNa b6dC/XU8hnSiJxLp8R9Yap+MkzWJKD2Cn8fNgMaesqMTW6S33UMJGfYASOAKz1sA JlTg5GghCio5Kj4pXvDvxmFWQmpdu2FOsRGVVCxkj/EwwMif35b7IAa0FDHYYa2Z e1+xs7i5Z5s5KJpAIzecZz3sSErcwnr9lRJ0rULxPRzoWoEtBaT44iwng5J6xlPp HNTzr2HOgX1GTcqGhVVXA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddruddukedgudegkecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdp uffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivg hnthhsucdlqddutddtmdenucfjughrpefhfffugggtgffkfhgjvfevofesthejredtredt jeenucfhrhhomheplfhirgiguhhnucgjrghnghcuoehjihgrgihunhdrhigrnhhgsehflh ihghhorghtrdgtohhmqeenucggtffrrghtthgvrhhnpedvkeeihfefveekueevteefleff keegudeghfdtuddugefhueevgeffgedukeejleenucevlhhushhtvghrufhiiigvpeefne curfgrrhgrmhepmhgrihhlfhhrohhmpehjihgrgihunhdrhigrnhhgsehflhihghhorght rdgtohhmpdhnsggprhgtphhtthhopeduvddpmhhouggvpehsmhhtphhouhhtpdhrtghpth htohepmhgrohgsihgsoheslhhoohhnghhsohhnrdgtnhdprhgtphhtthhopehmrghrtggv lhdrrghpfhgvlhgsrghumhesghhmrghilhdrtghomhdprhgtphhtthhopehpsghonhiiih hnihesrhgvughhrghtrdgtohhmpdhrtghpthhtohepghgrohhsohhngheslhhoohhnghhs ohhnrdgtnhdprhgtphhtthhopegvsghlrghkvgesrhgvughhrghtrdgtohhmpdhrtghpth htohepjhhirgiguhhnrdihrghnghesfhhlhihgohgrthdrtghomhdprhgtphhtthhopehq vghmuhdquggvvhgvlhesnhhonhhgnhhurdhorhhgpdhrtghpthhtohepfigrnhhghigrnh grnhehheeshhhurgifvghirdgtohhmpdhrtghpthhtohepiihhrghouddrlhhiuhesihhn thgvlhdrtghomh X-ME-Proxy: Feedback-ID: ifd894703:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 26 Dec 2024 16:20:10 -0500 (EST) From: Jiaxun Yang Date: Thu, 26 Dec 2024 21:19:45 +0000 Subject: [PATCH v2 14/23] target/loongarch: Scrutinise TCG arithmetic translation for 32 bit build MIME-Version: 1.0 Message-Id: <20241226-la32-fixes1-v2-14-0414594f8cb5@flygoat.com> References: <20241226-la32-fixes1-v2-0-0414594f8cb5@flygoat.com> In-Reply-To: <20241226-la32-fixes1-v2-0-0414594f8cb5@flygoat.com> To: qemu-devel@nongnu.org Cc: Song Gao , Bibo Mao , Eric Blake , Markus Armbruster , Eduardo Habkost , Marcel Apfelbaum , =?utf-8?q?Philippe_Mathieu-?= =?utf-8?q?Daud=C3=A9?= , Yanan Wang , Zhao Liu , Paolo Bonzini , Jiaxun Yang X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=2974; i=jiaxun.yang@flygoat.com; h=from:subject:message-id; bh=6W6xZHMD9TUqnyCi3WqD0AQhiiXReR5lG9SU3o/mijs=; b=owGbwMvMwCXmXMhTe71c8zDjabUkhvTcE9mfp9wJ/OV9u91VaXvtmuW1kfvm3T1u/vrTkoOPV xfavn71pKOUhUGMi0FWTJElRECpb0PjxQXXH2T9gZnDygQyhIGLUwAm4rGbkWGf9oTChQr6Rl5l ZgtXqipM3RzteUL88drZL+eu6isyedvGyDBLJadYXcc2eV6hZ3PgnD0nDoj8mnwnKM+4ZNZTfZ3 ll5gA X-Developer-Key: i=jiaxun.yang@flygoat.com; a=openpgp; fpr=980379BEFEBFBF477EA04EF9C111949073FC0F67 Received-SPF: pass client-ip=103.168.172.155; envelope-from=jiaxun.yang@flygoat.com; helo=fhigh-a4-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_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_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 mulh.w and mulh.wu are handled with tcg_gen_muls2_i32 and tcg_gen_mulu2_i32 to adopt different TARGET_LONG size. min value of divisor is generated from TARGET_LONG_BITS to adopt different long size as well. Signed-off-by: Jiaxun Yang --- target/loongarch/tcg/insn_trans/trans_arith.c.inc | 25 +++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/target/loongarch/tcg/insn_trans/trans_arith.c.inc b/target/loongarch/tcg/insn_trans/trans_arith.c.inc index 2be057e9320a9b722c173b0352e1631543147d68..a2360c5fdd2003ca0e458743348e687987f421d4 100644 --- a/target/loongarch/tcg/insn_trans/trans_arith.c.inc +++ b/target/loongarch/tcg/insn_trans/trans_arith.c.inc @@ -92,8 +92,24 @@ static void gen_sltu(TCGv dest, TCGv src1, TCGv src2) static void gen_mulh_w(TCGv dest, TCGv src1, TCGv src2) { - tcg_gen_mul_i64(dest, src1, src2); - tcg_gen_sari_i64(dest, dest, 32); +#ifdef TARGET_LOONGARCH64 + tcg_gen_mul_tl(dest, src1, src2); + tcg_gen_sari_tl(dest, dest, 32); +#else + TCGv_i32 discard = tcg_temp_new_i32(); + tcg_gen_muls2_i32(discard, dest, src1, src2); +#endif +} + +static void gen_mulh_wu(TCGv dest, TCGv src1, TCGv src2) +{ +#ifdef TARGET_LOONGARCH64 + /* Signs are handled by the caller's EXT_ZERO */ + gen_mulh_w(dest, src1, src2); +#else + TCGv_i32 discard = tcg_temp_new_i32(); + tcg_gen_mulu2_i32(discard, dest, src1, src2); +#endif } static void gen_mulh_d(TCGv dest, TCGv src1, TCGv src2) @@ -113,6 +129,7 @@ static void prep_divisor_d(TCGv ret, TCGv src1, TCGv src2) TCGv t0 = tcg_temp_new(); TCGv t1 = tcg_temp_new(); TCGv zero = tcg_constant_tl(0); + target_long min = 1ull << (TARGET_LONG_BITS - 1); /* * If min / -1, set the divisor to 1. @@ -121,7 +138,7 @@ static void prep_divisor_d(TCGv ret, TCGv src1, TCGv src2) * This avoids potential host overflow trap; * the required result is undefined. */ - tcg_gen_setcondi_tl(TCG_COND_EQ, ret, src1, INT64_MIN); + tcg_gen_setcondi_tl(TCG_COND_EQ, ret, src1, min); tcg_gen_setcondi_tl(TCG_COND_EQ, t0, src2, -1); tcg_gen_setcondi_tl(TCG_COND_EQ, t1, src2, 0); tcg_gen_and_tl(ret, ret, t0); @@ -275,7 +292,7 @@ TRANS(sltu, ALL, gen_rrr, EXT_NONE, EXT_NONE, EXT_NONE, gen_sltu) TRANS(mul_w, ALL, gen_rrr, EXT_SIGN, EXT_SIGN, EXT_SIGN, tcg_gen_mul_tl) TRANS(mul_d, 64, gen_rrr, EXT_NONE, EXT_NONE, EXT_NONE, tcg_gen_mul_tl) TRANS(mulh_w, ALL, gen_rrr, EXT_SIGN, EXT_SIGN, EXT_NONE, gen_mulh_w) -TRANS(mulh_wu, ALL, gen_rrr, EXT_ZERO, EXT_ZERO, EXT_NONE, gen_mulh_w) +TRANS(mulh_wu, ALL, gen_rrr, EXT_ZERO, EXT_ZERO, EXT_NONE, gen_mulh_wu) TRANS(mulh_d, 64, gen_rrr, EXT_NONE, EXT_NONE, EXT_NONE, gen_mulh_d) TRANS(mulh_du, 64, gen_rrr, EXT_NONE, EXT_NONE, EXT_NONE, gen_mulh_du) TRANS(mulw_d_w, 64, gen_rrr, EXT_SIGN, EXT_SIGN, EXT_NONE, tcg_gen_mul_tl) From patchwork Thu Dec 26 21:19:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jiaxun Yang X-Patchwork-Id: 13921443 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 0D4ACE7718E for ; Thu, 26 Dec 2024 21:22:17 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tQvHH-0003pZ-IK; Thu, 26 Dec 2024 16:20:19 -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 1tQvHE-0003oh-IL for qemu-devel@nongnu.org; Thu, 26 Dec 2024 16:20:16 -0500 Received: from fout-a1-smtp.messagingengine.com ([103.168.172.144]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tQvHD-0003CN-5N for qemu-devel@nongnu.org; Thu, 26 Dec 2024 16:20:16 -0500 Received: from phl-compute-03.internal (phl-compute-03.phl.internal [10.202.2.43]) by mailfout.phl.internal (Postfix) with ESMTP id 3180F13801E3; Thu, 26 Dec 2024 16:20:14 -0500 (EST) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-03.internal (MEProxy); Thu, 26 Dec 2024 16:20:14 -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=1735248014; x=1735334414; bh=To9ljGdoXUmo7Z5V/SBdfQXvdYuRRAbw4vPpVlePzWo=; b= cv3WlCh7hdUeUjIPg3GgQ+1fCAMj7BuhUcQA1XkhAkwXzDOj1Fhj6kggNIMk8t0B wYd6oiYTy5VJnHEe9C/3curyldSYxVvGgZFz5DOejsu5Z8wnv792Ddsw7fIeJ99P X5s4akkPSPwCnBFFO3GtWsCZbJwA9t3zG9mpgQvQ/kxCVceGKhR7cr+yFNdTsz18 52ofF2SUjuGeqZKTekEMUjlUa90iRLJnXbI1nFeZ+wmLnDnrdf7XJ3QdsrdEYHMN JzpDi29n25C9TLHg1GRcW0GGx4QLXtumwvf/exdg824G3bG5oyq6jkvswz7Nb20A UhFf6THioQXw5NWH/RtBPQ== 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=1735248014; x= 1735334414; bh=To9ljGdoXUmo7Z5V/SBdfQXvdYuRRAbw4vPpVlePzWo=; b=n g5+B6sUTtRGPkD/OYF3cqGeX/N5p+3dCQHDiPHdhJ2KAVIJ0lwz+zNQKU0i0kyCi LrBqaad9b5Ko9VUEthy3Qs97GKLZDbshJEINj5Y+6b1Vtg+LejaEMSyUp+VY3Y3y J+TKcJd9/cSh7QDs+y35F//Da4Jh8KYHuXBeeu68Wn+8Mo8OIQjF3DweZPnuhoXk ISnTLfgxmEwkHtpaYZBAEPe4rxNOrKuqQE/CRrfpjlzeOY10a6AfqjXpTuUq+QrA VG6P2k1CIkQOhMv5uixsycn1eEKK51n6NXhmwZWsFSLESdBsuJzE1QrhnfZk8xF7 j4yjyxfCp/KaJX4Qx84BQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddruddukedgudegjecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdp uffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivg hnthhsucdlqddutddtmdenucfjughrpefhfffugggtgffkfhgjvfevofesthekredtredt jeenucfhrhhomheplfhirgiguhhnucgjrghnghcuoehjihgrgihunhdrhigrnhhgsehflh ihghhorghtrdgtohhmqeenucggtffrrghtthgvrhhnpeevveetheeggfegjeekjedttdet ueeludehveejgfejtedvhfdugeetgfelhfevkeenucevlhhushhtvghrufhiiigvpedtne curfgrrhgrmhepmhgrihhlfhhrohhmpehjihgrgihunhdrhigrnhhgsehflhihghhorght rdgtohhmpdhnsggprhgtphhtthhopeduvddpmhhouggvpehsmhhtphhouhhtpdhrtghpth htohepmhgrohgsihgsoheslhhoohhnghhsohhnrdgtnhdprhgtphhtthhopehmrghrtggv lhdrrghpfhgvlhgsrghumhesghhmrghilhdrtghomhdprhgtphhtthhopehpsghonhiiih hnihesrhgvughhrghtrdgtohhmpdhrtghpthhtohepghgrohhsohhngheslhhoohhnghhs ohhnrdgtnhdprhgtphhtthhopegvsghlrghkvgesrhgvughhrghtrdgtohhmpdhrtghpth htohepjhhirgiguhhnrdihrghnghesfhhlhihgohgrthdrtghomhdprhgtphhtthhopehq vghmuhdquggvvhgvlhesnhhonhhgnhhurdhorhhgpdhrtghpthhtohepfigrnhhghigrnh grnhehheeshhhurgifvghirdgtohhmpdhrtghpthhtohepiihhrghouddrlhhiuhesihhn thgvlhdrtghomh X-ME-Proxy: Feedback-ID: ifd894703:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 26 Dec 2024 16:20:11 -0500 (EST) From: Jiaxun Yang Date: Thu, 26 Dec 2024 21:19:46 +0000 Subject: [PATCH v2 15/23] target/loongarch: Fix load type for gen_ll MIME-Version: 1.0 Message-Id: <20241226-la32-fixes1-v2-15-0414594f8cb5@flygoat.com> References: <20241226-la32-fixes1-v2-0-0414594f8cb5@flygoat.com> In-Reply-To: <20241226-la32-fixes1-v2-0-0414594f8cb5@flygoat.com> To: qemu-devel@nongnu.org Cc: Song Gao , Bibo Mao , Eric Blake , Markus Armbruster , Eduardo Habkost , Marcel Apfelbaum , =?utf-8?q?Philippe_Mathieu-?= =?utf-8?q?Daud=C3=A9?= , Yanan Wang , Zhao Liu , Paolo Bonzini , Jiaxun Yang X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1155; i=jiaxun.yang@flygoat.com; h=from:subject:message-id; bh=T7rwYaO9vvl/k/burhzTbL2wPlJMYc+RGt0BZXxOn0s=; b=owGbwMvMwCXmXMhTe71c8zDjabUkhvTcE9lzDptFmWmozk57Y3FE5SBD0SHGTBnOggPOlh3lJ QundR7tKGVhEONikBVTZAkRUOrb0HhxwfUHWX9g5rAygQxh4OIUgIm42zH8DymyckvmyPRpnzF5 25YGi0tvbhvW/p/LlXriXybD821XwhgZnr6TsEhhXKT9fl3H2ZXv/cuZ/s/M6PxYl6wwlyFyenA UBwA= X-Developer-Key: i=jiaxun.yang@flygoat.com; a=openpgp; fpr=980379BEFEBFBF477EA04EF9C111949073FC0F67 Received-SPF: pass client-ip=103.168.172.144; envelope-from=jiaxun.yang@flygoat.com; helo=fout-a1-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_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_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. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Jiaxun Yang Reviewed-by: Richard Henderson --- target/loongarch/tcg/insn_trans/trans_atomic.c.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/loongarch/tcg/insn_trans/trans_atomic.c.inc b/target/loongarch/tcg/insn_trans/trans_atomic.c.inc index 8584441b543712af8a56aa234c90fd6370c8df01..138bcb3e9999b2c186057c658a019136311f1b82 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); From patchwork Thu Dec 26 21:19:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiaxun Yang X-Patchwork-Id: 13921446 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 3691EE7718E for ; Thu, 26 Dec 2024 21:22:31 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tQvHI-0003pn-V2; Thu, 26 Dec 2024 16:20:20 -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 1tQvHF-0003p7-RQ for qemu-devel@nongnu.org; Thu, 26 Dec 2024 16:20:17 -0500 Received: from fout-a1-smtp.messagingengine.com ([103.168.172.144]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tQvHE-0003Ca-GD for qemu-devel@nongnu.org; Thu, 26 Dec 2024 16:20:17 -0500 Received: from phl-compute-03.internal (phl-compute-03.phl.internal [10.202.2.43]) by mailfout.phl.internal (Postfix) with ESMTP id 100EB13801E9; Thu, 26 Dec 2024 16:20:16 -0500 (EST) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-03.internal (MEProxy); Thu, 26 Dec 2024 16:20:16 -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=1735248016; x=1735334416; bh=AhnS5xcIEHt3sg+hD9qiLsPw6/y/gPWY/teXoXiJ66s=; b= ScVZNN6p4pBj/uJ1h+SKXlwalQgm+Hp1YDIn1hK5WcIVO1rA7Ub585cZ80OnvVSa HgHma6JBp027p1kRImnyN8ZDfP+f6DIN1QwRupjTZU4pekJ8hTcKi9tAIaCDhm5K o3ROENfDUD8PFOscAI4KjSRsTDlGeyv9rOcqz21ZGy3bsbu9ivwxcCUfLDW4WZbZ XSlvz3Tf8fPM4lU8kOULvoofJ7a35dWggF9wkLbfNVHgVIi27U5fzDV9wE/8OBeD F/0jEOlvT3vkVUQebHCC9wWeOzVBkFjyIDpWNlR7/G2F0NrIeBYyw3RkNogwNsf+ updDpRjyxDmdqG4e24dJbw== 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=1735248016; x= 1735334416; bh=AhnS5xcIEHt3sg+hD9qiLsPw6/y/gPWY/teXoXiJ66s=; b=I 7SScYZl7UEHPL4uGg/VxgYJCDBg7rTOSEGck73xMbrc3B/YZu95GRbjtIMYJOy0c dV+sM45KcDkVCEABkNGabMvLH+mK2Z8rBpooXx7Ho5JQXr6pndFTYsIjq87jeRb1 n/Jc3wzOn95m2i9CIhLZl2GUatOTMrGqz0lctslVRGUwUjdhQz9cdz6peRKII0Wu +mnNpAnT0VGdhFSOdxOMhM2YSchlnKNSGjGKzDus1yo+gUvPA49LGJ36ehfGuGjG fumEa+LE6TUGtPOzof9llZ4XR0HCHqQlvwOFpke0uA9Cygf/qNwExE6aFONxPW8y 0t8SS25dYuefg/v33YdAw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddruddukedgudegjecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdp uffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivg hnthhsucdlqddutddtmdenucfjughrpefhfffugggtgffkfhgjvfevofesthejredtredt jeenucfhrhhomheplfhirgiguhhnucgjrghnghcuoehjihgrgihunhdrhigrnhhgsehflh ihghhorghtrdgtohhmqeenucggtffrrghtthgvrhhnpedvkeeihfefveekueevteefleff keegudeghfdtuddugefhueevgeffgedukeejleenucevlhhushhtvghrufhiiigvpedune curfgrrhgrmhepmhgrihhlfhhrohhmpehjihgrgihunhdrhigrnhhgsehflhihghhorght rdgtohhmpdhnsggprhgtphhtthhopeduvddpmhhouggvpehsmhhtphhouhhtpdhrtghpth htohepmhgrohgsihgsoheslhhoohhnghhsohhnrdgtnhdprhgtphhtthhopehmrghrtggv lhdrrghpfhgvlhgsrghumhesghhmrghilhdrtghomhdprhgtphhtthhopehpsghonhiiih hnihesrhgvughhrghtrdgtohhmpdhrtghpthhtohepghgrohhsohhngheslhhoohhnghhs ohhnrdgtnhdprhgtphhtthhopegvsghlrghkvgesrhgvughhrghtrdgtohhmpdhrtghpth htohepjhhirgiguhhnrdihrghnghesfhhlhihgohgrthdrtghomhdprhgtphhtthhopehq vghmuhdquggvvhgvlhesnhhonhhgnhhurdhorhhgpdhrtghpthhtohepfigrnhhghigrnh grnhehheeshhhurgifvghirdgtohhmpdhrtghpthhtohepiihhrghouddrlhhiuhesihhn thgvlhdrtghomh X-ME-Proxy: Feedback-ID: ifd894703:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 26 Dec 2024 16:20:14 -0500 (EST) From: Jiaxun Yang Date: Thu, 26 Dec 2024 21:19:47 +0000 Subject: [PATCH v2 16/23] target/loongarch: Define address space information for LoongArch32 MIME-Version: 1.0 Message-Id: <20241226-la32-fixes1-v2-16-0414594f8cb5@flygoat.com> References: <20241226-la32-fixes1-v2-0-0414594f8cb5@flygoat.com> In-Reply-To: <20241226-la32-fixes1-v2-0-0414594f8cb5@flygoat.com> To: qemu-devel@nongnu.org Cc: Song Gao , Bibo Mao , Eric Blake , Markus Armbruster , Eduardo Habkost , Marcel Apfelbaum , =?utf-8?q?Philippe_Mathieu-?= =?utf-8?q?Daud=C3=A9?= , Yanan Wang , Zhao Liu , Paolo Bonzini , Jiaxun Yang X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1046; i=jiaxun.yang@flygoat.com; h=from:subject:message-id; bh=Z9HPXaAj3Emaei2yrxiSNSaeHVLQ6AGl79stCMSes2I=; b=owGbwMvMwCXmXMhTe71c8zDjabUkhvTcE9m5PgVMBZIpcaoneF+Jck1cLP/bNeBHH5O0SHmH3 yEGoxkdpSwMYlwMsmKKLCECSn0bGi8uuP4g6w/MHFYmkCEMXJwCMBHlXYwMCzSL1sZwfsyYdHeL tPaL/0dNdinVJZ8+/3Wt7DSlhKwpDxn+Cm6QOVH5a6F6rXCvQGfddX8pa81pEs9m3XiwUHvmxlJ /BgA= X-Developer-Key: i=jiaxun.yang@flygoat.com; a=openpgp; fpr=980379BEFEBFBF477EA04EF9C111949073FC0F67 Received-SPF: pass client-ip=103.168.172.144; envelope-from=jiaxun.yang@flygoat.com; helo=fout-a1-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_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_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 LoongArch32 have 32 bit vaddr and 36 bit paddr as per architecture specification. Signed-off-by: Jiaxun Yang --- target/loongarch/cpu-param.h | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/target/loongarch/cpu-param.h b/target/loongarch/cpu-param.h index db5ad1c69fafaf368ad7f0c960afecb5a96ddcf2..48512883e550c80570eb2bf02c802f4979151008 100644 --- a/target/loongarch/cpu-param.h +++ b/target/loongarch/cpu-param.h @@ -8,9 +8,15 @@ #ifndef LOONGARCH_CPU_PARAM_H #define LOONGARCH_CPU_PARAM_H -#define TARGET_LONG_BITS 64 -#define TARGET_PHYS_ADDR_SPACE_BITS 48 -#define TARGET_VIRT_ADDR_SPACE_BITS 48 +#if defined(TARGET_LOONGARCH64) +# define TARGET_LONG_BITS 64 +# define TARGET_PHYS_ADDR_SPACE_BITS 48 +# define TARGET_VIRT_ADDR_SPACE_BITS 48 +#elif defined(TARGET_LOONGARCH32) +# define TARGET_LONG_BITS 32 +# define TARGET_PHYS_ADDR_SPACE_BITS 36 +# define TARGET_VIRT_ADDR_SPACE_BITS 32 +#endif #define TARGET_PAGE_BITS 12 From patchwork Thu Dec 26 21:19:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiaxun Yang X-Patchwork-Id: 13921441 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 0A7EBE7718F for ; Thu, 26 Dec 2024 21:22:05 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tQvHM-0003qg-2H; Thu, 26 Dec 2024 16:20:24 -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 1tQvHK-0003q7-69 for qemu-devel@nongnu.org; Thu, 26 Dec 2024 16:20:22 -0500 Received: from fout-a1-smtp.messagingengine.com ([103.168.172.144]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tQvHI-0003D9-95 for qemu-devel@nongnu.org; Thu, 26 Dec 2024 16:20:21 -0500 Received: from phl-compute-05.internal (phl-compute-05.phl.internal [10.202.2.45]) by mailfout.phl.internal (Postfix) with ESMTP id 984A713801E6; Thu, 26 Dec 2024 16:20:18 -0500 (EST) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-05.internal (MEProxy); Thu, 26 Dec 2024 16:20:18 -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=1735248018; x=1735334418; bh=mK00rNU3uUZqwx6EGUl+GHsiUe4Y9J4gnVo/RMfXeas=; b= e7CIFt/WFYZ8Xsv8uD0xGVUkgGOGN0PzzObEmmFgT8i8rQWoHlsWzJsAnhIWmLoG 61tk2IbkvBVHIjnlMTjqblOF9IeEnDOGk3plMjTo1hDUsbem3rG/N6gSW/twji06 e8W5SIut2TTLQMqa3IH42BA9FWiop3dI5Z0he2IcGM8if4amCjZa6KmgkRAuw7iE LbWQMoPDWsqKPYO2GbAKgB5ADRavToGmNcIBfRivMAIoK9K4cT6jDCzLD3xif8+z 6nid+9PYYWMsYSTIqiO0Kd3EFkTTdA1jzaqdPXFl36ya9zWURAb1MF4y6XX0h++0 FacIz6UjR8wU9QO8dP4Fgw== 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=1735248018; x= 1735334418; bh=mK00rNU3uUZqwx6EGUl+GHsiUe4Y9J4gnVo/RMfXeas=; b=G ffrSj1o2flVEwBoBB3GYJaXsjwKdMHBhM4vvw9v9m7vXzvLoBl9E6Q/AJLefN6a6 Bq+DaBGqZilJIX4bbcMUrV5zyVqAOm+drET+3gMerh74sP3hnWAlG9D85Ty+MzNP KCfSs2FtSMis4EvWs+ZvXD4xOYj7oos0v2pL1gzo1r4hLHgbnhPFuddIwtDcwpcm 7UZHRLIsj+OiV2VoCikXVolGdu9p3icJjWENPqJnta3XlMxQ3n7SWf5G/NmP+9VS WMw5DQHnhPMJu/bxRSKXMEy5jbjNdqQbU3VTq291rUdVjF9JLkbIX7SO7ILuKdZk npH3BEPSMorrHosSSaQ6Q== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddruddukedgudegjecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdp uffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivg hnthhsucdlqddutddtmdenucfjughrpefhfffugggtgffkfhgjvfevofesthejredtredt jeenucfhrhhomheplfhirgiguhhnucgjrghnghcuoehjihgrgihunhdrhigrnhhgsehflh ihghhorghtrdgtohhmqeenucggtffrrghtthgvrhhnpedvkeeihfefveekueevteefleff keegudeghfdtuddugefhueevgeffgedukeejleenucevlhhushhtvghrufhiiigvpeefne curfgrrhgrmhepmhgrihhlfhhrohhmpehjihgrgihunhdrhigrnhhgsehflhihghhorght rdgtohhmpdhnsggprhgtphhtthhopeduvddpmhhouggvpehsmhhtphhouhhtpdhrtghpth htohepmhgrohgsihgsoheslhhoohhnghhsohhnrdgtnhdprhgtphhtthhopehmrghrtggv lhdrrghpfhgvlhgsrghumhesghhmrghilhdrtghomhdprhgtphhtthhopehpsghonhiiih hnihesrhgvughhrghtrdgtohhmpdhrtghpthhtohepghgrohhsohhngheslhhoohhnghhs ohhnrdgtnhdprhgtphhtthhopegvsghlrghkvgesrhgvughhrghtrdgtohhmpdhrtghpth htohepjhhirgiguhhnrdihrghnghesfhhlhihgohgrthdrtghomhdprhgtphhtthhopehq vghmuhdquggvvhgvlhesnhhonhhgnhhurdhorhhgpdhrtghpthhtohepfigrnhhghigrnh grnhehheeshhhurgifvghirdgtohhmpdhrtghpthhtohepiihhrghouddrlhhiuhesihhn thgvlhdrtghomh X-ME-Proxy: Feedback-ID: ifd894703:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 26 Dec 2024 16:20:16 -0500 (EST) From: Jiaxun Yang Date: Thu, 26 Dec 2024 21:19:48 +0000 Subject: [PATCH v2 17/23] target/loongarch: Refactoring is_la64/is_va32 for LoongArch32 MIME-Version: 1.0 Message-Id: <20241226-la32-fixes1-v2-17-0414594f8cb5@flygoat.com> References: <20241226-la32-fixes1-v2-0-0414594f8cb5@flygoat.com> In-Reply-To: <20241226-la32-fixes1-v2-0-0414594f8cb5@flygoat.com> To: qemu-devel@nongnu.org Cc: Song Gao , Bibo Mao , Eric Blake , Markus Armbruster , Eduardo Habkost , Marcel Apfelbaum , =?utf-8?q?Philippe_Mathieu-?= =?utf-8?q?Daud=C3=A9?= , Yanan Wang , Zhao Liu , Paolo Bonzini , Jiaxun Yang X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1435; i=jiaxun.yang@flygoat.com; h=from:subject:message-id; bh=3fvPVcmduevZWpvYs3fGnpSI9/FSXVdg+OVVSEa4VNs=; b=owGbwMvMwCXmXMhTe71c8zDjabUkhvTcE9kiaxcssl2j3pvI5S5Xt/vlp+ALnKLt17z6TgdvT HFZeepaRykLgxgXg6yYIkuIgFLfhsaLC64/yPoDM4eVCWQIAxenAEwkV42RYfqpTSeErVf+sU6o ePg1kG35/k1FZ79Kn1FJYrEO7n1xegHDP62kK9vPOjbnHOnRWyPLvSI40Hr++61RF5xLtJXk1Na fZwMA X-Developer-Key: i=jiaxun.yang@flygoat.com; a=openpgp; fpr=980379BEFEBFBF477EA04EF9C111949073FC0F67 Received-SPF: pass client-ip=103.168.172.144; envelope-from=jiaxun.yang@flygoat.com; helo=fout-a1-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_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_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 is_la64 should be wired to false on LA32 build. VA32 CSR check shouldn't be performed in LA32 mode. Signed-off-by: Jiaxun Yang --- target/loongarch/cpu.h | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/target/loongarch/cpu.h b/target/loongarch/cpu.h index 4f542a3376831141d012f177dc46a0e928afc85c..a2d416b6634b7f6787c93eac2b777a2f6c71bebf 100644 --- a/target/loongarch/cpu.h +++ b/target/loongarch/cpu.h @@ -438,18 +438,26 @@ struct LoongArchCPUClass { static inline bool is_la64(CPULoongArchState *env) { +#ifdef TARGET_LOONGARCH64 return FIELD_EX32(env->cpucfg[1], CPUCFG1, ARCH) == CPUCFG1_ARCH_LA64; +#endif + return false; } static inline bool is_va32(CPULoongArchState *env) { /* VA32 if !LA64 or VA32L[1-3] */ - bool va32 = !is_la64(env); - uint64_t plv = FIELD_EX64(env->CSR_CRMD, CSR_CRMD, PLV); - if (plv >= 1 && (FIELD_EX64(env->CSR_MISC, CSR_MISC, VA32) & (1 << plv))) { - va32 = true; + if (is_la64(env)) { + uint64_t plv = FIELD_EX64(env->CSR_CRMD, CSR_CRMD, PLV); + + if (plv >= 1 && + extract64(FIELD_EX64(env->CSR_MISC, CSR_MISC, VA32), plv, 1)) { + return true; + } + return false; } - return va32; + + return true; } static inline void set_pc(CPULoongArchState *env, uint64_t value) From patchwork Thu Dec 26 21:19:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiaxun Yang X-Patchwork-Id: 13921435 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 28F5EE7718E for ; Thu, 26 Dec 2024 21:21:27 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tQvHP-0003uK-VH; Thu, 26 Dec 2024 16:20:28 -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 1tQvHL-0003qF-4L for qemu-devel@nongnu.org; Thu, 26 Dec 2024 16:20:23 -0500 Received: from fout-a1-smtp.messagingengine.com ([103.168.172.144]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tQvHJ-0003DI-8f for qemu-devel@nongnu.org; Thu, 26 Dec 2024 16:20:22 -0500 Received: from phl-compute-06.internal (phl-compute-06.phl.internal [10.202.2.46]) by mailfout.phl.internal (Postfix) with ESMTP id B6BBD13801EF; Thu, 26 Dec 2024 16:20:20 -0500 (EST) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-06.internal (MEProxy); Thu, 26 Dec 2024 16:20:20 -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=1735248020; x=1735334420; bh=/R+UYBT9JTRjyVyhZ6ww+fL1pd+McXtjlSxujDrHCn0=; b= mtES/GS9TPT9OYkHQxmKb72BiwaMCXCeAD0howm4+FCBeUWDpilrPn05ynOru5XD e52PacEH3EMt8wY1nPqnBI4zck+lXumBcB+WqxnONYTrqn9v4Cx3gGYCZeovuRo4 RH6LWZjn+++F4it3uDSaLoZrBisy98NiuRDNIFqIlc/2jSlrQzRYuwo5izCSd8vm zT1DIamPlcQQ2ceSa7dehq7MRRVzqHC1IB5Yi+RAVBDqonRqQ9xkLvLT+jpaHheC f4pyiEtw8OQCLv0TShO8F9JnPhtcMmsCrF0XRHG+yJ3WEY0C9L/YYPe3IjcFTtTp 0Ccj8wU5Gp+PSDQfWiU6LQ== 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=1735248020; x= 1735334420; bh=/R+UYBT9JTRjyVyhZ6ww+fL1pd+McXtjlSxujDrHCn0=; b=C KqYf0ADtSaTrepRqqGA17XAddVMh1vx4P49pHcl/OVjyNWSGPNhQVTDihCzT8to9 jW2WQES5fkxWK1pj32bEOwS3sI65Zn/mGKO3u2XrryJb9gaLaRqxjyUlR4oSXiUs tVUqE3frPTL6nVHKoTglzU/sMF4+ngCglpXV0JFERkINs5mgJupnD3H3zb7C129e QvRn/RZYeu5NqjgwJfHsOdH+OSsSCqc0SQ85ilOocF0vYIs+kcQvCCDaIj8NBs5N y071LtcDwKpAPF2khUalb7khMPX+yXSnlsK6g3NLHC7brDziIjKaAy/kqo/00GMR tB0IFdR8joKH0cCdKwOFw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddruddukedgudegjecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdp uffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivg hnthhsucdlqddutddtmdenucfjughrpefhfffugggtgffkfhgjvfevofesthejredtredt jeenucfhrhhomheplfhirgiguhhnucgjrghnghcuoehjihgrgihunhdrhigrnhhgsehflh ihghhorghtrdgtohhmqeenucggtffrrghtthgvrhhnpedvkeeihfefveekueevteefleff keegudeghfdtuddugefhueevgeffgedukeejleenucevlhhushhtvghrufhiiigvpedune curfgrrhgrmhepmhgrihhlfhhrohhmpehjihgrgihunhdrhigrnhhgsehflhihghhorght rdgtohhmpdhnsggprhgtphhtthhopeduvddpmhhouggvpehsmhhtphhouhhtpdhrtghpth htohepmhgrohgsihgsoheslhhoohhnghhsohhnrdgtnhdprhgtphhtthhopehmrghrtggv lhdrrghpfhgvlhgsrghumhesghhmrghilhdrtghomhdprhgtphhtthhopehpsghonhiiih hnihesrhgvughhrghtrdgtohhmpdhrtghpthhtohepghgrohhsohhngheslhhoohhnghhs ohhnrdgtnhdprhgtphhtthhopegvsghlrghkvgesrhgvughhrghtrdgtohhmpdhrtghpth htohepjhhirgiguhhnrdihrghnghesfhhlhihgohgrthdrtghomhdprhgtphhtthhopehq vghmuhdquggvvhgvlhesnhhonhhgnhhurdhorhhgpdhrtghpthhtohepfigrnhhghigrnh grnhehheeshhhurgifvghirdgtohhmpdhrtghpthhtohepiihhrghouddrlhhiuhesihhn thgvlhdrtghomh X-ME-Proxy: Feedback-ID: ifd894703:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 26 Dec 2024 16:20:18 -0500 (EST) From: Jiaxun Yang Date: Thu, 26 Dec 2024 21:19:49 +0000 Subject: [PATCH v2 18/23] target/loongarch: ifdef out 64 bit CPUs on 32 bit builds MIME-Version: 1.0 Message-Id: <20241226-la32-fixes1-v2-18-0414594f8cb5@flygoat.com> References: <20241226-la32-fixes1-v2-0-0414594f8cb5@flygoat.com> In-Reply-To: <20241226-la32-fixes1-v2-0-0414594f8cb5@flygoat.com> To: qemu-devel@nongnu.org Cc: Song Gao , Bibo Mao , Eric Blake , Markus Armbruster , Eduardo Habkost , Marcel Apfelbaum , =?utf-8?q?Philippe_Mathieu-?= =?utf-8?q?Daud=C3=A9?= , Yanan Wang , Zhao Liu , Paolo Bonzini , Jiaxun Yang X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=4395; i=jiaxun.yang@flygoat.com; h=from:subject:message-id; bh=r6c46xv1jpn2ABIYObG2TFnqZDRs36DnvEiW/1NNqFk=; b=kA0DAAoWQ3EMfdd3KcMByyZiAGdtyGui2w9Zo8WjPniWum+OYSzouy1DaLd69A/+fKAbLdFfH oh1BAAWCgAdFiEEVBAijrCB0aDX4Gr8Q3EMfdd3KcMFAmdtyGsACgkQQ3EMfdd3KcORzgD/Z4SP kvqFGu8V2EJvbx0uhO5o86psuGUezcy0GihF6qQA/Ag5JabV85dYbJItmmFXuCT5upFmSjNztia DpN+gjccH X-Developer-Key: i=jiaxun.yang@flygoat.com; a=openpgp; fpr=980379BEFEBFBF477EA04EF9C111949073FC0F67 Received-SPF: pass client-ip=103.168.172.144; envelope-from=jiaxun.yang@flygoat.com; helo=fout-a1-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_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_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 They are not available on 32 bit builds. Signed-off-by: Jiaxun Yang --- target/loongarch/cpu.c | 68 ++++++++++++++++++++++++++++---------------------- 1 file changed, 38 insertions(+), 30 deletions(-) diff --git a/target/loongarch/cpu.c b/target/loongarch/cpu.c index 82412f8867a50a6cd25cff511def0f24d2b10b49..720f5b97698abe454c79c2f8fb2a36d0113c5c24 100644 --- a/target/loongarch/cpu.c +++ b/target/loongarch/cpu.c @@ -375,6 +375,36 @@ static int loongarch_cpu_mmu_index(CPUState *cs, bool ifetch) return MMU_DA_IDX; } +static void loongarch_la132_initfn(Object *obj) +{ + LoongArchCPU *cpu = LOONGARCH_CPU(obj); + CPULoongArchState *env = &cpu->env; + + int i; + + for (i = 0; i < 21; i++) { + env->cpucfg[i] = 0x0; + } + + cpu->dtb_compatible = "loongarch,Loongson-1C103"; + env->cpucfg[0] = 0x148042; /* PRID */ + + uint32_t data = 0; + data = FIELD_DP32(data, CPUCFG1, ARCH, 1); /* LA32 */ + data = FIELD_DP32(data, CPUCFG1, PGMMU, 1); + data = FIELD_DP32(data, CPUCFG1, IOCSR, 1); + data = FIELD_DP32(data, CPUCFG1, PALEN, 0x1f); /* 32 bits */ + data = FIELD_DP32(data, CPUCFG1, VALEN, 0x1f); /* 32 bits */ + data = FIELD_DP32(data, CPUCFG1, UAL, 1); + data = FIELD_DP32(data, CPUCFG1, RI, 0); + data = FIELD_DP32(data, CPUCFG1, EP, 0); + data = FIELD_DP32(data, CPUCFG1, RPLV, 0); + data = FIELD_DP32(data, CPUCFG1, HP, 1); + data = FIELD_DP32(data, CPUCFG1, IOCSR_BRD, 1); + env->cpucfg[1] = data; +} + +#ifdef TARGET_LOONGARCH64 static void loongarch_la464_initfn(Object *obj) { LoongArchCPU *cpu = LOONGARCH_CPU(obj); @@ -473,40 +503,12 @@ static void loongarch_la464_initfn(Object *obj) loongarch_cpu_post_init(obj); } -static void loongarch_la132_initfn(Object *obj) -{ - LoongArchCPU *cpu = LOONGARCH_CPU(obj); - CPULoongArchState *env = &cpu->env; - - int i; - - for (i = 0; i < 21; i++) { - env->cpucfg[i] = 0x0; - } - - cpu->dtb_compatible = "loongarch,Loongson-1C103"; - env->cpucfg[0] = 0x148042; /* PRID */ - - uint32_t data = 0; - data = FIELD_DP32(data, CPUCFG1, ARCH, 1); /* LA32 */ - data = FIELD_DP32(data, CPUCFG1, PGMMU, 1); - data = FIELD_DP32(data, CPUCFG1, IOCSR, 1); - data = FIELD_DP32(data, CPUCFG1, PALEN, 0x1f); /* 32 bits */ - data = FIELD_DP32(data, CPUCFG1, VALEN, 0x1f); /* 32 bits */ - data = FIELD_DP32(data, CPUCFG1, UAL, 1); - data = FIELD_DP32(data, CPUCFG1, RI, 0); - data = FIELD_DP32(data, CPUCFG1, EP, 0); - data = FIELD_DP32(data, CPUCFG1, RPLV, 0); - data = FIELD_DP32(data, CPUCFG1, HP, 1); - data = FIELD_DP32(data, CPUCFG1, IOCSR_BRD, 1); - env->cpucfg[1] = data; -} - static void loongarch_max_initfn(Object *obj) { /* '-cpu max' for TCG: we use cpu la464. */ loongarch_la464_initfn(obj); } +#endif static void loongarch_cpu_reset_hold(Object *obj, ResetType type) { @@ -870,6 +872,7 @@ static void loongarch32_cpu_class_init(ObjectClass *c, void *data) cc->gdb_arch_name = loongarch32_gdb_arch_name; } +#ifdef TARGET_LOONGARCH64 static const gchar *loongarch64_gdb_arch_name(CPUState *cs) { return "loongarch64"; @@ -882,6 +885,7 @@ static void loongarch64_cpu_class_init(ObjectClass *c, void *data) cc->gdb_core_xml_file = "loongarch-base64.xml"; cc->gdb_arch_name = loongarch64_gdb_arch_name; } +#endif #define DEFINE_LOONGARCH_CPU_TYPE(size, model, initfn) \ { \ @@ -909,6 +913,7 @@ static const TypeInfo loongarch_cpu_type_infos[] = { .abstract = true, .class_init = loongarch32_cpu_class_init, }, +#ifdef TARGET_LOONGARCH64 { .name = TYPE_LOONGARCH64_CPU, .parent = TYPE_LOONGARCH_CPU, @@ -916,9 +921,12 @@ static const TypeInfo loongarch_cpu_type_infos[] = { .abstract = true, .class_init = loongarch64_cpu_class_init, }, - DEFINE_LOONGARCH_CPU_TYPE(64, "la464", loongarch_la464_initfn), +#endif DEFINE_LOONGARCH_CPU_TYPE(32, "la132", loongarch_la132_initfn), +#ifdef TARGET_LOONGARCH64 + DEFINE_LOONGARCH_CPU_TYPE(64, "la464", loongarch_la464_initfn), DEFINE_LOONGARCH_CPU_TYPE(64, "max", loongarch_max_initfn), +#endif }; DEFINE_TYPES(loongarch_cpu_type_infos) From patchwork Thu Dec 26 21:19:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiaxun Yang X-Patchwork-Id: 13921436 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 25526E77188 for ; Thu, 26 Dec 2024 21:21:27 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tQvHT-0003vP-2U; Thu, 26 Dec 2024 16:20:31 -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 1tQvHN-0003u8-Uz for qemu-devel@nongnu.org; Thu, 26 Dec 2024 16:20:26 -0500 Received: from fhigh-a4-smtp.messagingengine.com ([103.168.172.155]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tQvHL-0003Dx-28 for qemu-devel@nongnu.org; Thu, 26 Dec 2024 16:20:24 -0500 Received: from phl-compute-03.internal (phl-compute-03.phl.internal [10.202.2.43]) by mailfhigh.phl.internal (Postfix) with ESMTP id 9CECB114019B; Thu, 26 Dec 2024 16:20:22 -0500 (EST) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-03.internal (MEProxy); Thu, 26 Dec 2024 16:20:22 -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=1735248022; x=1735334422; bh=lXdZQEAXwbRwZFnYdC1yZgfXrxQqV2X0q133oN/IeL4=; b= rile1toW8B+rFzrQNKqzvFwPJrwZ0NcRb3wd1n1lHNA7hnrpCYejo7t8fmwmvRGX Cn5n9Wn0CyY8AomJIA6P7bzFXyJUMQQpJ4GgUc35Eo+ljktYuPwGbvUMPG6X8q7u AEWcWDpr8alyTrvt0sj8i60kO7C6KgDST171MqnKd47wbOWhuhlzu0usY9J0TzjK 8yIzIkpw7eonTcoT8CqZHpvyb0VkhTQfTffXNlMOWU/M9gSTY/LLugSjlnuJLxCf lU5koU03LIThqzCzFdZnB2lDtrAxauz0Lo66Xj1cqBZFBL6BnXdyLxlR+Y39N7Gq WGT62OoM3Nwe67e8mal5gw== 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=1735248022; x= 1735334422; bh=lXdZQEAXwbRwZFnYdC1yZgfXrxQqV2X0q133oN/IeL4=; b=v CSm+Bmc2ANy0hd3ADP1YNTc8vFDXfUq3YU2KPal2k/I7tQgX195s3e8A8WbrWYRT kXVO24I2FfVor3O9ZXFdlLc2L2m/k4cadc4uoil/urIkdbn9HkJlzJMcEYwcLNNK ul+jJbWqTvCYRhuuwCgmb0qsnNHuSe30klobegSr2CdKUG37SaotGg/Amx6gCecd zGFPZFXxYFYujug39SHBio3O6UN2qP9CXwSn4wUu5O1tYyfCotxR0oZlrGSqVfuM zV+dcFx4l+L0wIWNGznenorzYDeph5yjzVeMInoEm7wtfrOinUZQ2zEF31u8hdbp D+6rpFaVo3NFJHX4JtoUA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddruddukedgudegjecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdp uffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivg hnthhsucdlqddutddtmdenucfjughrpefhfffugggtgffkfhgjvfevofesthejredtredt jeenucfhrhhomheplfhirgiguhhnucgjrghnghcuoehjihgrgihunhdrhigrnhhgsehflh ihghhorghtrdgtohhmqeenucggtffrrghtthgvrhhnpedvkeeihfefveekueevteefleff keegudeghfdtuddugefhueevgeffgedukeejleenucevlhhushhtvghrufhiiigvpedvne curfgrrhgrmhepmhgrihhlfhhrohhmpehjihgrgihunhdrhigrnhhgsehflhihghhorght rdgtohhmpdhnsggprhgtphhtthhopeduvddpmhhouggvpehsmhhtphhouhhtpdhrtghpth htohepmhgrohgsihgsoheslhhoohhnghhsohhnrdgtnhdprhgtphhtthhopehmrghrtggv lhdrrghpfhgvlhgsrghumhesghhmrghilhdrtghomhdprhgtphhtthhopehpsghonhiiih hnihesrhgvughhrghtrdgtohhmpdhrtghpthhtohepghgrohhsohhngheslhhoohhnghhs ohhnrdgtnhdprhgtphhtthhopegvsghlrghkvgesrhgvughhrghtrdgtohhmpdhrtghpth htohepjhhirgiguhhnrdihrghnghesfhhlhihgohgrthdrtghomhdprhgtphhtthhopehq vghmuhdquggvvhgvlhesnhhonhhgnhhurdhorhhgpdhrtghpthhtohepfigrnhhghigrnh grnhehheeshhhurgifvghirdgtohhmpdhrtghpthhtohepiihhrghouddrlhhiuhesihhn thgvlhdrtghomh X-ME-Proxy: Feedback-ID: ifd894703:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 26 Dec 2024 16:20:20 -0500 (EST) From: Jiaxun Yang Date: Thu, 26 Dec 2024 21:19:50 +0000 Subject: [PATCH v2 19/23] target/loongarch: Introduce max32 CPU type MIME-Version: 1.0 Message-Id: <20241226-la32-fixes1-v2-19-0414594f8cb5@flygoat.com> References: <20241226-la32-fixes1-v2-0-0414594f8cb5@flygoat.com> In-Reply-To: <20241226-la32-fixes1-v2-0-0414594f8cb5@flygoat.com> To: qemu-devel@nongnu.org Cc: Song Gao , Bibo Mao , Eric Blake , Markus Armbruster , Eduardo Habkost , Marcel Apfelbaum , =?utf-8?q?Philippe_Mathieu-?= =?utf-8?q?Daud=C3=A9?= , Yanan Wang , Zhao Liu , Paolo Bonzini , Jiaxun Yang X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=4409; i=jiaxun.yang@flygoat.com; h=from:subject:message-id; bh=vEacUjKkUMYiOaoh7JhdLKxOhu9cYeGzxhK2xx4ZzFk=; b=owGbwMvMwCXmXMhTe71c8zDjabUkhvTcE9nfGti89juZpZXkZv2uS1j3UPzY97Qg/UVLLnSt3 92a+GxLRykLgxgXg6yYIkuIgFLfhsaLC64/yPoDM4eVCWQIAxenAExksxYjw6eMKj3P6NYPjx6w th7RuiW/jF3WveYuw8TfMX7nyy9kXmBk+J2tElosYvi0bZ6ozYO95nfsg4TKvUUma8d8/n3drvA pLwA= X-Developer-Key: i=jiaxun.yang@flygoat.com; a=openpgp; fpr=980379BEFEBFBF477EA04EF9C111949073FC0F67 Received-SPF: pass client-ip=103.168.172.155; envelope-from=jiaxun.yang@flygoat.com; helo=fhigh-a4-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_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_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 Introduce max32 CPU type as it's necessary to demonstrate all features we have in LA32. Signed-off-by: Jiaxun Yang --- target/loongarch/cpu.c | 92 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) diff --git a/target/loongarch/cpu.c b/target/loongarch/cpu.c index 720f5b97698abe454c79c2f8fb2a36d0113c5c24..afc6ff30b34af86c611c5866c9c79b3924c69ed7 100644 --- a/target/loongarch/cpu.c +++ b/target/loongarch/cpu.c @@ -404,6 +404,97 @@ static void loongarch_la132_initfn(Object *obj) env->cpucfg[1] = data; } +static void loongarch_max32_initfn(Object *obj) +{ + LoongArchCPU *cpu = LOONGARCH_CPU(obj); + CPULoongArchState *env = &cpu->env; + int i; + + for (i = 0; i < 21; i++) { + env->cpucfg[i] = 0x0; + } + + cpu->dtb_compatible = "loongarch,la32"; + env->cpucfg[0] = 0x148042; /* PRID */ + + uint32_t data = 0; + data = FIELD_DP32(data, CPUCFG1, ARCH, 1); /* LA32 */ + data = FIELD_DP32(data, CPUCFG1, PGMMU, 1); + data = FIELD_DP32(data, CPUCFG1, IOCSR, 1); + data = FIELD_DP32(data, CPUCFG1, PALEN, 0x1f); /* 32 bits */ + data = FIELD_DP32(data, CPUCFG1, VALEN, 0x1f); /* 32 bits */ + data = FIELD_DP32(data, CPUCFG1, UAL, 1); + data = FIELD_DP32(data, CPUCFG1, HP, 1); + data = FIELD_DP32(data, CPUCFG1, IOCSR_BRD, 1); + env->cpucfg[1] = data; + + data = 0; + data = FIELD_DP32(data, CPUCFG2, FP, 1); + data = FIELD_DP32(data, CPUCFG2, FP_SP, 1); + data = FIELD_DP32(data, CPUCFG2, FP_DP, 1); + data = FIELD_DP32(data, CPUCFG2, FP_VER, 1); + data = FIELD_DP32(data, CPUCFG2, LLFTP, 1); + data = FIELD_DP32(data, CPUCFG2, LLFTP_VER, 1); + env->cpucfg[2] = data; + + data = 0; + data = FIELD_DP32(data, CPUCFG3, CCDMA, 1); + data = FIELD_DP32(data, CPUCFG3, ITLBHMC, 1); + data = FIELD_DP32(data, CPUCFG3, ICHMC, 1); + env->cpucfg[3] = data; + + env->cpucfg[4] = 100 * 1000 * 1000; /* Crystal frequency */ + + data = 0; + data = FIELD_DP32(data, CPUCFG5, CC_MUL, 1); + data = FIELD_DP32(data, CPUCFG5, CC_DIV, 1); + env->cpucfg[5] = data; + + data = 0; + data = FIELD_DP32(data, CPUCFG16, L1_IUPRE, 1); + data = FIELD_DP32(data, CPUCFG16, L1_DPRE, 1); + data = FIELD_DP32(data, CPUCFG16, L2_IUPRE, 1); + data = FIELD_DP32(data, CPUCFG16, L2_IUUNIFY, 1); + data = FIELD_DP32(data, CPUCFG16, L2_IUINCL, 1); + env->cpucfg[16] = data; + + /* 16K L1I */ + data = 0; + data = FIELD_DP32(data, CPUCFG17, L1IU_WAYS, 3); + data = FIELD_DP32(data, CPUCFG17, L1IU_SETS, 7); + data = FIELD_DP32(data, CPUCFG17, L1IU_SIZE, 5); + env->cpucfg[17] = data; + + /* 16K L1D */ + data = 0; + data = FIELD_DP32(data, CPUCFG18, L1D_WAYS, 3); + data = FIELD_DP32(data, CPUCFG18, L1D_SETS, 7); + data = FIELD_DP32(data, CPUCFG18, L1D_SIZE, 5); + env->cpucfg[18] = data; + + data = 0; + /* 128K L2 */ + data = FIELD_DP32(data, CPUCFG19, L2IU_WAYS, 7); + data = FIELD_DP32(data, CPUCFG19, L2IU_SETS, 9); + data = FIELD_DP32(data, CPUCFG19, L2IU_SIZE, 5); + env->cpucfg[19] = data; + + env->CSR_ASID = FIELD_DP64(0, CSR_ASID, ASIDBITS, 0xa); + + env->CSR_PRCFG1 = FIELD_DP64(env->CSR_PRCFG1, CSR_PRCFG1, SAVE_NUM, 8); + env->CSR_PRCFG1 = FIELD_DP64(env->CSR_PRCFG1, CSR_PRCFG1, TIMER_BITS, 31); + env->CSR_PRCFG1 = FIELD_DP64(env->CSR_PRCFG1, CSR_PRCFG1, VSMAX, 0); + + env->CSR_PRCFG2 = 0x3ffff000; + + env->CSR_PRCFG3 = FIELD_DP64(env->CSR_PRCFG3, CSR_PRCFG3, TLB_TYPE, 2); + env->CSR_PRCFG3 = FIELD_DP64(env->CSR_PRCFG3, CSR_PRCFG3, MTLB_ENTRY, 63); + env->CSR_PRCFG3 = FIELD_DP64(env->CSR_PRCFG3, CSR_PRCFG3, STLB_WAYS, 7); + env->CSR_PRCFG3 = FIELD_DP64(env->CSR_PRCFG3, CSR_PRCFG3, STLB_SETS, 8); + + loongarch_cpu_post_init(obj); +} + #ifdef TARGET_LOONGARCH64 static void loongarch_la464_initfn(Object *obj) { @@ -923,6 +1014,7 @@ static const TypeInfo loongarch_cpu_type_infos[] = { }, #endif DEFINE_LOONGARCH_CPU_TYPE(32, "la132", loongarch_la132_initfn), + DEFINE_LOONGARCH_CPU_TYPE(32, "max32", loongarch_max32_initfn), #ifdef TARGET_LOONGARCH64 DEFINE_LOONGARCH_CPU_TYPE(64, "la464", loongarch_la464_initfn), DEFINE_LOONGARCH_CPU_TYPE(64, "max", loongarch_max_initfn), From patchwork Thu Dec 26 21:19:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiaxun Yang X-Patchwork-Id: 13921438 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 F185FE77188 for ; Thu, 26 Dec 2024 21:21:59 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tQvHV-0003wI-HH; Thu, 26 Dec 2024 16:20:33 -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 1tQvHP-0003uW-1l for qemu-devel@nongnu.org; Thu, 26 Dec 2024 16:20:27 -0500 Received: from fhigh-a4-smtp.messagingengine.com ([103.168.172.155]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tQvHN-0003EE-Nw for qemu-devel@nongnu.org; Thu, 26 Dec 2024 16:20:26 -0500 Received: from phl-compute-05.internal (phl-compute-05.phl.internal [10.202.2.45]) by mailfhigh.phl.internal (Postfix) with ESMTP id 5D66B1140198; Thu, 26 Dec 2024 16:20:24 -0500 (EST) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-05.internal (MEProxy); Thu, 26 Dec 2024 16:20:24 -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=1735248024; x=1735334424; bh=Wn81zmb/wOHLnmGIuhH/D0MryJOnpofku8vcL5IQi2Q=; b= b5VDN0YSe7pkrxrItX9alysjbnDdmoLdvSg4NBujDoP065dTUzyoB5avyEl/Dkn2 7sAIBIZCM/J7EoNcdoYgLjD2wClBNcuahHEQLgEd5e60A2BcKQT3CzcogKhzpgwS 5itLJ23/HWzXlThNeS/0OJ+XVs5xVhH3hTz7xjyfzvX29Srhl/ZnWPuYPvgoDipF 7FW7c5OjkEr4tZt/L+n/T1zpBwtGLj7dLxE018ArVGF9/efN5GdbBjK25NHsod+U 9y2m6jxgqagy7Q8iASzO6m9w8YaJRJnaqEgOeLxt2CAs1ztmBLL9HWfuK1Hc3xHa 553XiwtfgZSqx+FaGfu96w== 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=1735248024; x= 1735334424; bh=Wn81zmb/wOHLnmGIuhH/D0MryJOnpofku8vcL5IQi2Q=; b=b jSeP1pC9id9WQ5Pi7fxa8h0mRFQTxNtEoY8HM4Mq7GSsbZPpb9VX0Q8782HtGksf S0qhmBAXvfOgL4YfcsocMV2HbaMSWY3fPwKH0CZmHOwXZQAPOL73TiY5H81XiwBs pizgFvtxGRUDqM9TgdIfbnQ5uikOvkySxDEDkd7ib76bam576ziy4UgFOvRBp6Ia D7sED0krHh4SLtWq1IvtV5uFaBVZw2GDV2ZJRldQtNZx4zPTIFiEYa/+rashBLtK gLpBguf/hpdWKzKGIrN7ecLSDC53FdZw7gdvoLNWlQjCAGHoGLMIOaL5twU1Vasl PCXDvTJni+edAFnDuTYIw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddruddukedgudegjecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdp uffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivg hnthhsucdlqddutddtmdenucfjughrpefhfffugggtgffkfhgjvfevofesthejredtredt jeenucfhrhhomheplfhirgiguhhnucgjrghnghcuoehjihgrgihunhdrhigrnhhgsehflh ihghhorghtrdgtohhmqeenucggtffrrghtthgvrhhnpedvkeeihfefveekueevteefleff keegudeghfdtuddugefhueevgeffgedukeejleenucevlhhushhtvghrufhiiigvpeegne curfgrrhgrmhepmhgrihhlfhhrohhmpehjihgrgihunhdrhigrnhhgsehflhihghhorght rdgtohhmpdhnsggprhgtphhtthhopeduvddpmhhouggvpehsmhhtphhouhhtpdhrtghpth htohepmhgrohgsihgsoheslhhoohhnghhsohhnrdgtnhdprhgtphhtthhopehmrghrtggv lhdrrghpfhgvlhgsrghumhesghhmrghilhdrtghomhdprhgtphhtthhopehpsghonhiiih hnihesrhgvughhrghtrdgtohhmpdhrtghpthhtohepghgrohhsohhngheslhhoohhnghhs ohhnrdgtnhdprhgtphhtthhopegvsghlrghkvgesrhgvughhrghtrdgtohhmpdhrtghpth htohepjhhirgiguhhnrdihrghnghesfhhlhihgohgrthdrtghomhdprhgtphhtthhopehq vghmuhdquggvvhgvlhesnhhonhhgnhhurdhorhhgpdhrtghpthhtohepfigrnhhghigrnh grnhehheeshhhurgifvghirdgtohhmpdhrtghpthhtohepiihhrghouddrlhhiuhesihhn thgvlhdrtghomh X-ME-Proxy: Feedback-ID: ifd894703:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 26 Dec 2024 16:20:22 -0500 (EST) From: Jiaxun Yang Date: Thu, 26 Dec 2024 21:19:51 +0000 Subject: [PATCH v2 20/23] hw/loongarch/virt: Default to max32 CPU for LoongArch 32 build MIME-Version: 1.0 Message-Id: <20241226-la32-fixes1-v2-20-0414594f8cb5@flygoat.com> References: <20241226-la32-fixes1-v2-0-0414594f8cb5@flygoat.com> In-Reply-To: <20241226-la32-fixes1-v2-0-0414594f8cb5@flygoat.com> To: qemu-devel@nongnu.org Cc: Song Gao , Bibo Mao , Eric Blake , Markus Armbruster , Eduardo Habkost , Marcel Apfelbaum , =?utf-8?q?Philippe_Mathieu-?= =?utf-8?q?Daud=C3=A9?= , Yanan Wang , Zhao Liu , Paolo Bonzini , Jiaxun Yang X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=946; i=jiaxun.yang@flygoat.com; h=from:subject:message-id; bh=FBUn2ePNQYQFLuMxPG6+QOkSyR+VuhIkJlorSkF3OU8=; b=owGbwMvMwCXmXMhTe71c8zDjabUkhvTcE9lPJ62MUTnKd+xXsJ1pb9dTsVn6Dezc8RE/74ZfL rHfI2XZUcrCIMbFICumyBIioNS3ofHigusPsv7AzGFlAhnCwMUpABM5Xs/wPzdrY/1JSf1n+6Z9 X/FJvKcwlyU0ZDYjo5j/mykBuz31Qxn+VxXnnpQN+VV5uKhlWmHg05Mi511PTalIu7XvedcJq2Y XNgA= X-Developer-Key: i=jiaxun.yang@flygoat.com; a=openpgp; fpr=980379BEFEBFBF477EA04EF9C111949073FC0F67 Received-SPF: pass client-ip=103.168.172.155; envelope-from=jiaxun.yang@flygoat.com; helo=fhigh-a4-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_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_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 la464 CPU is not available on LoongArch32. Use max32 which makes more sense here. Signed-off-by: Jiaxun Yang --- hw/loongarch/virt.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hw/loongarch/virt.c b/hw/loongarch/virt.c index 3a905cf71d46e3c5a29672f7bb73faedf1d29444..343d2e745e155d59f0ff17124b3c77ec9b3c111e 100644 --- a/hw/loongarch/virt.c +++ b/hw/loongarch/virt.c @@ -1440,7 +1440,11 @@ static void virt_class_init(ObjectClass *oc, void *data) HotplugHandlerClass *hc = HOTPLUG_HANDLER_CLASS(oc); mc->init = virt_init; +#if defined(TARGET_LOONGARCH64) mc->default_cpu_type = LOONGARCH_CPU_TYPE_NAME("la464"); +#elif defined(TARGET_LOONGARCH32) + mc->default_cpu_type = LOONGARCH_CPU_TYPE_NAME("max32"); +#endif mc->default_ram_id = "loongarch.ram"; mc->desc = "QEMU LoongArch Virtual Machine"; mc->max_cpus = LOONGARCH_MAX_CPUS; From patchwork Thu Dec 26 21:19:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiaxun Yang X-Patchwork-Id: 13921445 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 13E5AE7718E for ; Thu, 26 Dec 2024 21:22:25 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tQvHX-0003xW-JN; Thu, 26 Dec 2024 16:20:36 -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 1tQvHQ-0003ue-0x for qemu-devel@nongnu.org; Thu, 26 Dec 2024 16:20:28 -0500 Received: from fhigh-a4-smtp.messagingengine.com ([103.168.172.155]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tQvHO-0003EP-Iv for qemu-devel@nongnu.org; Thu, 26 Dec 2024 16:20:27 -0500 Received: from phl-compute-05.internal (phl-compute-05.phl.internal [10.202.2.45]) by mailfhigh.phl.internal (Postfix) with ESMTP id 281291140191; Thu, 26 Dec 2024 16:20:26 -0500 (EST) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-05.internal (MEProxy); Thu, 26 Dec 2024 16:20:26 -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=1735248026; x=1735334426; bh=xe9BuqPS0CARoFfo8D7AEtwCqEeGIBNkINPPVMFXfNw=; b= ZkR2jAO+pZznP+W0jFlYSvqBoiu5Xu7RP6djZcuGeXHYS5dVTV9QT0RHgfRdC5GE 1iBU/jkCLIw3HAznkY4vgJfn3OK2lM44ICgAQ00xj1jBXqo8rlbik3RCpQ1qL1JG QeCkAetnZbWbAQBFDqV7ePrK6AScO4GDRl5yM6j102a3rHuoY+cYDhcArhNEebrB xqZp3sCgTUW3R+YJczMX1dedyL8aAvJIfzVMWOw4Fg5l/TXxPNWAMf3DN/1q3xoL bLM+XeqY/eP1r84zRx11e5Uz/SsTT+syv0I4i9CW2zQNtSVR5IMLOrclnoSk+cft RfnsgR0AXLZmIEnciJcrQQ== 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=1735248026; x= 1735334426; bh=xe9BuqPS0CARoFfo8D7AEtwCqEeGIBNkINPPVMFXfNw=; b=N 0YGZlWjgJY0SSPMsddjMa6xRkvZio9FxA82IEZTL91qWWYUNAtwW2j0ulosl10yT cjMQEmo/rTVzDOFvKuodsdO1ac2qebdNhCBwlplSKB8R5z+1jaYm3acNYoN0BuPl JdnZ9lN78YOIyspDrwdyrUig1zTrUlHFNq8n9RsUNTX/oWDaIAxSM9EnHDl5yETs d8UEYaRy4++2bg65Pz5u3rSdrbdeBGTS/OCe9+hF33V2eT+5j4iew3S7qMgj1Vbu VV8vgePAHS1p8Mx7aRpvdKHlJFcq9Eh74n9O1RrDeytkKNTQ9fMf9Wi+Mu16ttR0 U4nk+e4CR0AeN++AmyIyQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddruddukedgudegjecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdp uffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivg hnthhsucdlqddutddtmdenucfjughrpefhfffugggtgffkfhgjvfevofesthejredtredt jeenucfhrhhomheplfhirgiguhhnucgjrghnghcuoehjihgrgihunhdrhigrnhhgsehflh ihghhorghtrdgtohhmqeenucggtffrrghtthgvrhhnpedvkeeihfefveekueevteefleff keegudeghfdtuddugefhueevgeffgedukeejleenucevlhhushhtvghrufhiiigvpeegne curfgrrhgrmhepmhgrihhlfhhrohhmpehjihgrgihunhdrhigrnhhgsehflhihghhorght rdgtohhmpdhnsggprhgtphhtthhopeduvddpmhhouggvpehsmhhtphhouhhtpdhrtghpth htohepmhgrohgsihgsoheslhhoohhnghhsohhnrdgtnhdprhgtphhtthhopehmrghrtggv lhdrrghpfhgvlhgsrghumhesghhmrghilhdrtghomhdprhgtphhtthhopehpsghonhiiih hnihesrhgvughhrghtrdgtohhmpdhrtghpthhtohepghgrohhsohhngheslhhoohhnghhs ohhnrdgtnhdprhgtphhtthhopegvsghlrghkvgesrhgvughhrghtrdgtohhmpdhrtghpth htohepjhhirgiguhhnrdihrghnghesfhhlhihgohgrthdrtghomhdprhgtphhtthhopehq vghmuhdquggvvhgvlhesnhhonhhgnhhurdhorhhgpdhrtghpthhtohepfigrnhhghigrnh grnhehheeshhhurgifvghirdgtohhmpdhrtghpthhtohepiihhrghouddrlhhiuhesihhn thgvlhdrtghomh X-ME-Proxy: Feedback-ID: ifd894703:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 26 Dec 2024 16:20:24 -0500 (EST) From: Jiaxun Yang Date: Thu, 26 Dec 2024 21:19:52 +0000 Subject: [PATCH v2 21/23] qapi/machine: Replace TARGET_LOONGARCH64 with TARGET_LOONGARCH MIME-Version: 1.0 Message-Id: <20241226-la32-fixes1-v2-21-0414594f8cb5@flygoat.com> References: <20241226-la32-fixes1-v2-0-0414594f8cb5@flygoat.com> In-Reply-To: <20241226-la32-fixes1-v2-0-0414594f8cb5@flygoat.com> To: qemu-devel@nongnu.org Cc: Song Gao , Bibo Mao , Eric Blake , Markus Armbruster , Eduardo Habkost , Marcel Apfelbaum , =?utf-8?q?Philippe_Mathieu-?= =?utf-8?q?Daud=C3=A9?= , Yanan Wang , Zhao Liu , Paolo Bonzini , Jiaxun Yang X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1616; i=jiaxun.yang@flygoat.com; h=from:subject:message-id; bh=iYUi8NSJen0z2KRIyUqEbFujGU6IWLS1XfkvXr0NRPs=; b=owGbwMvMwCXmXMhTe71c8zDjabUkhvTcE9lPxb0PPj4TkZA+saslaU1V/1+jIJ5c3m8rhZZ3N QeKbZjfUcrCIMbFICumyBIioNS3ofHigusPsv7AzGFlAhnCwMUpABP56sfwV2LyqhKVZzdep8ct KJW7etA28+jsqZd8RFy9Pba72n9LuMfwV4zdUEV4k5H23A1cpfL3DIPXX3tpt+oXq0Ci+jPZxxK 3OAE= X-Developer-Key: i=jiaxun.yang@flygoat.com; a=openpgp; fpr=980379BEFEBFBF477EA04EF9C111949073FC0F67 Received-SPF: pass client-ip=103.168.172.155; envelope-from=jiaxun.yang@flygoat.com; helo=fhigh-a4-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_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_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 All TARGET_LOONGARCH64 qapis are also available for LoongArch32 as we are reusing the same CPU backend implemenation. Use TARGET_LOONGARCH to identify LoongArch. Signed-off-by: Jiaxun Yang --- qapi/machine-target.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/qapi/machine-target.json b/qapi/machine-target.json index 541f93eeb78f67c7eac83d8a2722000976e38a33..b00c3f59b6a5f6e3ad9d7197d462e928ffc4c152 100644 --- a/qapi/machine-target.json +++ b/qapi/machine-target.json @@ -260,7 +260,7 @@ 'if': { 'any': [ 'TARGET_S390X', 'TARGET_I386', 'TARGET_ARM', - 'TARGET_LOONGARCH64', + 'TARGET_LOONGARCH', 'TARGET_RISCV' ] } } ## @@ -314,7 +314,7 @@ 'if': { 'any': [ 'TARGET_S390X', 'TARGET_I386', 'TARGET_ARM', - 'TARGET_LOONGARCH64', + 'TARGET_LOONGARCH', 'TARGET_RISCV' ] } } ## @@ -383,7 +383,7 @@ 'TARGET_I386', 'TARGET_S390X', 'TARGET_MIPS', - 'TARGET_LOONGARCH64', + 'TARGET_LOONGARCH', 'TARGET_RISCV' ] } } ## @@ -401,7 +401,7 @@ 'TARGET_I386', 'TARGET_S390X', 'TARGET_MIPS', - 'TARGET_LOONGARCH64', + 'TARGET_LOONGARCH', 'TARGET_RISCV' ] } } ## From patchwork Thu Dec 26 21:19:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiaxun Yang X-Patchwork-Id: 13921444 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 ED909E7718E for ; Thu, 26 Dec 2024 21:22:20 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tQvHW-0003wo-Rk; Thu, 26 Dec 2024 16:20:34 -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 1tQvHR-0003vQ-Mj for qemu-devel@nongnu.org; Thu, 26 Dec 2024 16:20:30 -0500 Received: from fout-a1-smtp.messagingengine.com ([103.168.172.144]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tQvHQ-0003Ei-CP for qemu-devel@nongnu.org; Thu, 26 Dec 2024 16:20:29 -0500 Received: from phl-compute-12.internal (phl-compute-12.phl.internal [10.202.2.52]) by mailfout.phl.internal (Postfix) with ESMTP id E133513801F7; Thu, 26 Dec 2024 16:20:27 -0500 (EST) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-12.internal (MEProxy); Thu, 26 Dec 2024 16:20:27 -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=1735248027; x=1735334427; bh=s3b9pBtSYtBY8Oe04lWhPftHKL0MaU+BrXXUcQGyXVI=; b= XXbXHMgGkZhAw/VcqmJKHwBVmXc6q3CY5KTuEp0ahlhyQpxrtc7UmR3pxhPCeCwX PwYA6afBQZKjAUQCPwHmaBN8M7iAxcNfTR2af78wZHWFnIYIZWjfEYc9/nIPLY7T s7SleKscYw7O3+yB6SIVqe5/y5CAsuumhlLZTK/EhJnLRoGrQGBh7GW/Hp+IGidC aXtxzMPh4O4fFS0PJCS8hZApfTOGckmdMr4L50SwXriq550hW6EzA8xuYTImOIlR aD7wzTbDL8akByq2K7Jfq+BjEN/LZJJ9k4+agJEYhDG5w89pg0kecCKyI53Fh3ow FU4SLF/gMNIdP/yL2GN5uQ== 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=1735248027; x= 1735334427; bh=s3b9pBtSYtBY8Oe04lWhPftHKL0MaU+BrXXUcQGyXVI=; b=U LOPwKNg/06b5eHLKLD0FWZXtlss2faCtZoAGtauHyEuX62YFrvr9r8UuC7tvO6No b7gx3FdlRgjAIK6DqPTIEMc13FuA5NCU+4aStzHQASOK8dShWMg1X9XdTousJah5 +MTVTd3BNl17sRF95KKh6iGQUwJXrgWa7wXPVYtxheAunFMPDizEv6o0i1bH91O3 ztDflo3a+00Zi2K6RTUSpxFIoyGhd4OxvOzBwv/sKfEEEpuCoGtp4oL1DXsgfWfc e73eo0g8aclOgwyEjXLwkLLxlYLR2faCkLB1FFG/+R5WRKjFwD2NgcXjVrVsVjKJ 3mRh2G8Or2tjOyGi5E9nw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddruddukedgudegkecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdp uffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivg hnthhsucdlqddutddtmdenucfjughrpefhfffugggtgffkfhgjvfevofesthejredtredt jeenucfhrhhomheplfhirgiguhhnucgjrghnghcuoehjihgrgihunhdrhigrnhhgsehflh ihghhorghtrdgtohhmqeenucggtffrrghtthgvrhhnpedvkeeihfefveekueevteefleff keegudeghfdtuddugefhueevgeffgedukeejleenucevlhhushhtvghrufhiiigvpeegne curfgrrhgrmhepmhgrihhlfhhrohhmpehjihgrgihunhdrhigrnhhgsehflhihghhorght rdgtohhmpdhnsggprhgtphhtthhopeduvddpmhhouggvpehsmhhtphhouhhtpdhrtghpth htohepmhgrohgsihgsoheslhhoohhnghhsohhnrdgtnhdprhgtphhtthhopehmrghrtggv lhdrrghpfhgvlhgsrghumhesghhmrghilhdrtghomhdprhgtphhtthhopehpsghonhiiih hnihesrhgvughhrghtrdgtohhmpdhrtghpthhtohepghgrohhsohhngheslhhoohhnghhs ohhnrdgtnhdprhgtphhtthhopegvsghlrghkvgesrhgvughhrghtrdgtohhmpdhrtghpth htohepjhhirgiguhhnrdihrghnghesfhhlhihgohgrthdrtghomhdprhgtphhtthhopehq vghmuhdquggvvhgvlhesnhhonhhgnhhurdhorhhgpdhrtghpthhtohepfigrnhhghigrnh grnhehheeshhhurgifvghirdgtohhmpdhrtghpthhtohepiihhrghouddrlhhiuhesihhn thgvlhdrtghomh X-ME-Proxy: Feedback-ID: ifd894703:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 26 Dec 2024 16:20:26 -0500 (EST) From: Jiaxun Yang Date: Thu, 26 Dec 2024 21:19:53 +0000 Subject: [PATCH v2 22/23] target/loongarch: Wire up LoongArch32 Kconfigs MIME-Version: 1.0 Message-Id: <20241226-la32-fixes1-v2-22-0414594f8cb5@flygoat.com> References: <20241226-la32-fixes1-v2-0-0414594f8cb5@flygoat.com> In-Reply-To: <20241226-la32-fixes1-v2-0-0414594f8cb5@flygoat.com> To: qemu-devel@nongnu.org Cc: Song Gao , Bibo Mao , Eric Blake , Markus Armbruster , Eduardo Habkost , Marcel Apfelbaum , =?utf-8?q?Philippe_Mathieu-?= =?utf-8?q?Daud=C3=A9?= , Yanan Wang , Zhao Liu , Paolo Bonzini , Jiaxun Yang X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1035; i=jiaxun.yang@flygoat.com; h=from:subject:message-id; bh=7RmQ2Oh/9jjCmpkY2P4iyt9t8EL0uY8W03Wqd+oJIk4=; b=owGbwMvMwCXmXMhTe71c8zDjabUkhvTcE9l3pG5z2N7v+clpauYd9f6DV2RsWf6C76oeN+7+q 9B5Zbu3o5SFQYyLQVZMkSVEQKlvQ+PFBdcfZP2BmcPKBDKEgYtTACZSoc/IcPnxxMRzd7apnNC1 fjHp1TI3vVMaq5xXmovUfDnncah0ESfDX4GLr8TfnuJ5x71O3OLX7ichl2VfMhr8fpz4PXabSgN TPTsA X-Developer-Key: i=jiaxun.yang@flygoat.com; a=openpgp; fpr=980379BEFEBFBF477EA04EF9C111949073FC0F67 Received-SPF: pass client-ip=103.168.172.144; envelope-from=jiaxun.yang@flygoat.com; helo=fout-a1-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_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_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 Add LoongArch32 Kconfig entry and enable the virt machine for LoongArch32. Signed-off-by: Jiaxun Yang --- hw/loongarch/Kconfig | 2 +- target/loongarch/Kconfig | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/hw/loongarch/Kconfig b/hw/loongarch/Kconfig index fe1c6feac13874424c110637067e5add26978833..fae467e3af1b7c7c6637f7ff04314bc09687c5dd 100644 --- a/hw/loongarch/Kconfig +++ b/hw/loongarch/Kconfig @@ -1,7 +1,7 @@ config LOONGARCH_VIRT bool default y - depends on LOONGARCH64 && FDT + depends on (LOONGARCH32 || LOONGARCH64) && FDT select DEVICE_TREE select PCI select PCI_EXPRESS_GENERIC_BRIDGE diff --git a/target/loongarch/Kconfig b/target/loongarch/Kconfig index 46b26b1a85715e779672bea93152a3c62c170fe2..e428b066c6d09048d9a34803982e8f344237055d 100644 --- a/target/loongarch/Kconfig +++ b/target/loongarch/Kconfig @@ -1,2 +1,5 @@ +config LOONGARCH32 + bool + config LOONGARCH64 bool From patchwork Thu Dec 26 21:19:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiaxun Yang X-Patchwork-Id: 13921437 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 8C900E77188 for ; Thu, 26 Dec 2024 21:21:55 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tQvHb-0003z6-MN; Thu, 26 Dec 2024 16:20:40 -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 1tQvHT-0003w6-ME for qemu-devel@nongnu.org; Thu, 26 Dec 2024 16:20:32 -0500 Received: from fhigh-a4-smtp.messagingengine.com ([103.168.172.155]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tQvHS-0003Ey-A8 for qemu-devel@nongnu.org; Thu, 26 Dec 2024 16:20:31 -0500 Received: from phl-compute-06.internal (phl-compute-06.phl.internal [10.202.2.46]) by mailfhigh.phl.internal (Postfix) with ESMTP id C5BFF11401A0; Thu, 26 Dec 2024 16:20:29 -0500 (EST) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-06.internal (MEProxy); Thu, 26 Dec 2024 16:20: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=1735248029; x=1735334429; bh=4SuT/ejVgzQsl7vXnic05xBWiNs6QkN+U6Fe72PfgOo=; b= YmOgBQwySScZRuCeFKLikTuAW28l3FYcl9zRiITN4ZiV9J92tp4t+M/q5PTWbJwQ aa7HywGPQEFdjmOI2Rx0atQ1uaXGL5Q1Qw73Ji0Q/IA9sbmNiVjv1bdzTPm64J89 bbE5y1AX03o/USNQ1R4tzukjw0qOLjqJBRi3jH8PMnnpj4c0Mr7qHtZqcQBG5all UlNLvGXwcqlPQwgJDkXfVrPWkNU6ki80MECiMxi3nAPvou4MmrMgt2ooozneEPRx jIIpCWAff39uq5tGZ7JF5xY1YMlrEIL6ajXKOzyG5i+fQnCDarQusdwxn2V6IfWA WYFmzy5gp/7YKSvzzTghkA== 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=1735248029; x= 1735334429; bh=4SuT/ejVgzQsl7vXnic05xBWiNs6QkN+U6Fe72PfgOo=; b=A fnm7p9RCxnpTaMRKsHG5cUOj9OABQRO46d1Pq+DMgneTI2EkQvUg82H4jQzV7dgJ XvYCjoj81rYguYrJw5freMeWEAYXHoCtHQZuVkIpkEfqGSEeiYfVwkMh4NdK71t2 lW5TVon93MbarQkA0oBpvwqpR5R+ygZY57CEpC15YAR6AgsFw79T1EtF3yi2nlxW /5O9RrmYPa0zC2irk7aLVQV/koHfemBhZWHK1RdCDLyHR9X1qBJEWVgwakFF0mCD fXUkqpgBwb9BexogL1W54lAGMDjtjUOrXO1XEOOq5wb93Biweio4KScQslEH5uHR epkJ6xofHSwyLA4rGKhJg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddruddukedgudegkecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdp uffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivg hnthhsucdlqddutddtmdenucfjughrpefhfffugggtgffkfhgjvfevofesthejredtredt jeenucfhrhhomheplfhirgiguhhnucgjrghnghcuoehjihgrgihunhdrhigrnhhgsehflh ihghhorghtrdgtohhmqeenucggtffrrghtthgvrhhnpedvkeeihfefveekueevteefleff keegudeghfdtuddugefhueevgeffgedukeejleenucevlhhushhtvghrufhiiigvpedtne curfgrrhgrmhepmhgrihhlfhhrohhmpehjihgrgihunhdrhigrnhhgsehflhihghhorght rdgtohhmpdhnsggprhgtphhtthhopeduvddpmhhouggvpehsmhhtphhouhhtpdhrtghpth htohepmhgrohgsihgsoheslhhoohhnghhsohhnrdgtnhdprhgtphhtthhopehmrghrtggv lhdrrghpfhgvlhgsrghumhesghhmrghilhdrtghomhdprhgtphhtthhopehpsghonhiiih hnihesrhgvughhrghtrdgtohhmpdhrtghpthhtohepghgrohhsohhngheslhhoohhnghhs ohhnrdgtnhdprhgtphhtthhopegvsghlrghkvgesrhgvughhrghtrdgtohhmpdhrtghpth htohepjhhirgiguhhnrdihrghnghesfhhlhihgohgrthdrtghomhdprhgtphhtthhopehq vghmuhdquggvvhgvlhesnhhonhhgnhhurdhorhhgpdhrtghpthhtohepfigrnhhghigrnh grnhehheeshhhurgifvghirdgtohhmpdhrtghpthhtohepiihhrghouddrlhhiuhesihhn thgvlhdrtghomh X-ME-Proxy: Feedback-ID: ifd894703:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 26 Dec 2024 16:20:28 -0500 (EST) From: Jiaxun Yang Date: Thu, 26 Dec 2024 21:19:54 +0000 Subject: [PATCH v2 23/23] config: Add loongarch32-softmmu target MIME-Version: 1.0 Message-Id: <20241226-la32-fixes1-v2-23-0414594f8cb5@flygoat.com> References: <20241226-la32-fixes1-v2-0-0414594f8cb5@flygoat.com> In-Reply-To: <20241226-la32-fixes1-v2-0-0414594f8cb5@flygoat.com> To: qemu-devel@nongnu.org Cc: Song Gao , Bibo Mao , Eric Blake , Markus Armbruster , Eduardo Habkost , Marcel Apfelbaum , =?utf-8?q?Philippe_Mathieu-?= =?utf-8?q?Daud=C3=A9?= , Yanan Wang , Zhao Liu , Paolo Bonzini , Jiaxun Yang X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=2058; i=jiaxun.yang@flygoat.com; h=from:subject:message-id; bh=JNYj8ZyURlcFCCdBmVClS5y27OylWlkDj1ACXlLsUCM=; b=owGbwMvMwCXmXMhTe71c8zDjabUkhvTcE9kiE7qn9kq7/ArnzH/AfuSsblD/xOXPg8TPbfmvb h6qUjWvo5SFQYyLQVZMkSVEQKlvQ+PFBdcfZP2BmcPKBDKEgYtTACay6TIjwzQrzk+zW98281pf t+USvDjr3H/X8DNfljL13w25HpEbFMTwk3HZWpbi3jNV7ZUfF0xZ5eIbYdWQ2l25J68l6VBmS9B LRgA= X-Developer-Key: i=jiaxun.yang@flygoat.com; a=openpgp; fpr=980379BEFEBFBF477EA04EF9C111949073FC0F67 Received-SPF: pass client-ip=103.168.172.155; envelope-from=jiaxun.yang@flygoat.com; helo=fhigh-a4-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_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_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 Signed-off-by: Jiaxun Yang --- MAINTAINERS | 4 ++-- configs/devices/loongarch32-softmmu/default.mak | 7 +++++++ configs/targets/loongarch32-softmmu.mak | 7 +++++++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/MAINTAINERS b/MAINTAINERS index 8839f22e3ed306a598da1e4ab2f9f1899f574275..0c45d28508015d448c0b8a46cdb83e3974da2e28 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1210,8 +1210,8 @@ M: Bibo Mao R: Jiaxun Yang S: Maintained F: docs/system/loongarch/virt.rst -F: configs/targets/loongarch64-softmmu.mak -F: configs/devices/loongarch64-softmmu/default.mak +F: configs/targets/loongarch*-softmmu.mak +F: configs/devices/loongarch*-softmmu/default.mak F: hw/loongarch/ F: include/hw/loongarch/virt.h F: include/hw/intc/loongarch_*.h diff --git a/configs/devices/loongarch32-softmmu/default.mak b/configs/devices/loongarch32-softmmu/default.mak new file mode 100644 index 0000000000000000000000000000000000000000..b28b5c7c9e2195cffe065716ee33ec2bf26e2b31 --- /dev/null +++ b/configs/devices/loongarch32-softmmu/default.mak @@ -0,0 +1,7 @@ +# Default configuration for loongarch32-softmmu + +# Uncomment the following lines to disable these optional devices: +# CONFIG_PCI_DEVICES=n + +# Boards are selected by default, uncomment to keep out of the build. +# CONFIG_LOONGARCH_VIRT=n diff --git a/configs/targets/loongarch32-softmmu.mak b/configs/targets/loongarch32-softmmu.mak new file mode 100644 index 0000000000000000000000000000000000000000..50e0075a24ac6bf3717db967b03b816b52a25964 --- /dev/null +++ b/configs/targets/loongarch32-softmmu.mak @@ -0,0 +1,7 @@ +TARGET_ARCH=loongarch32 +TARGET_BASE_ARCH=loongarch +TARGET_KVM_HAVE_GUEST_DEBUG=y +TARGET_SUPPORTS_MTTCG=y +TARGET_XML_FILES= gdb-xml/loongarch-base32.xml gdb-xml/loongarch-fpu.xml gdb-xml/loongarch-lsx.xml gdb-xml/loongarch-lasx.xml +# all boards require libfdt +TARGET_NEED_FDT=y