From nobody Mon Sep 28 00:10:50 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=univ-grenoble-alpes.fr ARC-Seal: i=1; a=rsa-sha256; t=1787137052; cv=none; d=zohomail.com; s=zohoarc; b=I1mllW8jONfjBZ853sQmgW2xknd56TrUzBB1Hz7DZvfUfkBxAT/P0tIyP0nLlaE4fuoFZ5rl7s6GoVPV7A8G1UlEf+JM8YcvHgKdl3hHd89X1SKwTxRz5YpSZW00vLPksjeACKVS3a0m5xk1i7SVARwBqdtnMLvQ/I34oT0GlHY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1787137052; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=oEu6/i6sqN8+mvcRX0NkvpSZnKr79i3ETUndsYbPye4=; b=EdxTeNJVZx+xnhSxp/U0Yx5Kb6r1+k9I75HN6uZE+McvUI4gIuzg9woWCME6VPymIYbM1ojrTYqI5sldd8glgJW7VnZAY0zgl3lLpC0Vo6SCk0aU0PR49CWrPnGgis2Meg7dd+o9uRLEpx6OsLjd6P1wG1TXrXmMhnY8h/DX3+I= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1787137052122959.7573804564939; Wed, 19 Aug 2026 03:57:32 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wwdyb-0004Fi-7n; Wed, 19 Aug 2026 06:56:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wwdyY-0004Dx-UA; Wed, 19 Aug 2026 06:56:54 -0400 Received: from zm-mta-out-3.u-ga.fr ([152.77.200.56]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wwdyX-0006Ac-2l; Wed, 19 Aug 2026 06:56:54 -0400 Received: from mailhub-2.u-ga.fr (mailhub-2.u-ga.fr [129.88.178.102]) by zm-mta-out-3.u-ga.fr (Postfix) with ESMTP id EAE4140241; Wed, 19 Aug 2026 12:56:49 +0200 (CEST) Received: from smtps.univ-grenoble-alpes.fr (smtps3.u-ga.fr [195.83.24.62]) by mailhub-2.u-ga.fr (Postfix) with ESMTP id E6D7DFF85F; Wed, 19 Aug 2026 12:56:49 +0200 (CEST) Received: from naga.. (unknown [78.241.162.199]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: petrotf@univ-grenoble-alpes.fr) by smtps.univ-grenoble-alpes.fr (Postfix) with ESMTPSA id 3A80340120; Wed, 19 Aug 2026 12:56:49 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=univ-grenoble-alpes.fr; s=2020; t=1787137009; bh=ayQmIvU7cHcv/trY1+acLz25t+8+pkLS16tDWnuaY1k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Lh1X6JE3FOSgfLrJ8EagJalzKkgxO2llXLIgb3cnsIIrQh1Q/6GfRfSKgORd2HsPK SVlQMahSr6M1zlcdUaWRu5ayeIqtqxQITh+3uj38lKacqc+TUVX/quNEjHuDp8m6BR 43k5cL+YTdElTD91Fw4w2VgcY2kYrsVRVaufXK4kS1UaBfj7IrQ8qlhfttiz82ABxC Cj8tfIS5UpkxHg6PhToTB575GhFk8uMGnow3HQuPQ9+1ZbYZwRtQ4z5+7w+OIMRL+k l8t8IRXjs7s0eoqWnvOehjfi9f3oh14TK6M/xdd2p8mi/mSyltUCe4gbr+0wphihie V+1oji0CiS1nQ== From: frederic.petrot@univ-grenoble-alpes.fr To: alistair.francis@wdc.com, daniel.barboza@oss.qualcomm.com, palmer@dabbelt.com, liwei1518@gmail.com, zhiwei_liu@linux.alibaba.com, chao.liu@processmission.com, qemu-riscv@nongnu.org, qemu-devel@nongnu.org Cc: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9trot?= Subject: [PATCH v2 1/2] target/riscv: Fix sstatus update in rv128 Date: Wed, 19 Aug 2026 12:56:54 +0200 Message-ID: <20260819105655.33391-2-frederic.petrot@univ-grenoble-alpes.fr> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260819105655.33391-1-frederic.petrot@univ-grenoble-alpes.fr> References: <20260819105655.33391-1-frederic.petrot@univ-grenoble-alpes.fr> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Greylist: Whitelist-UGA SMTP Authentifie (petrotf@univ-grenoble-alpes.fr) via submission-587 ACL (41) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=152.77.200.56; envelope-from=frederic.petrot@univ-grenoble-alpes.fr; helo=zm-mta-out-3.u-ga.fr X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @univ-grenoble-alpes.fr) X-ZM-MESSAGEID: 1787137055864158500 From: Fr=C3=A9d=C3=A9ric P=C3=A9trot The sstatus register assignment was performed before the write mask was fully constructed, leading to an incomplete update of sstatus fields on the experimental rv128 target. Move the sstatus write after the mask completion so the full write mask is applied correctly. Signed-off-by: Fr=C3=A9d=C3=A9ric P=C3=A9trot Reviewed-by: Daniel Henrique Barboza Reviewed-by: Alistair Francis Reviewed-by: Chao Liu --- target/riscv/tcg/csr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/riscv/tcg/csr.c b/target/riscv/tcg/csr.c index ffd751caa5..9cc6297328 100644 --- a/target/riscv/tcg/csr.c +++ b/target/riscv/tcg/csr.c @@ -3998,7 +3998,7 @@ static RISCVException read_sstatus_i128(CPURISCVState= *env, int csrno, Int128 *val) { uint64_t mask =3D sstatus_v1_10_mask; - uint64_t sstatus =3D env->mstatus & mask; + uint64_t sstatus; if (env->xl !=3D MXL_RV32 || env->debugger) { mask |=3D SSTATUS64_UXL; } @@ -4009,7 +4009,7 @@ static RISCVException read_sstatus_i128(CPURISCVState= *env, int csrno, if (env_archcpu(env)->cfg.ext_zicfilp) { mask |=3D SSTATUS_SPELP; } - + sstatus =3D env->mstatus & mask; *val =3D int128_make128(sstatus, add_status_sd(MXL_RV128, sstatus)); return RISCV_EXCP_NONE; } --=20 2.43.0 From nobody Mon Sep 28 00:10:50 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=univ-grenoble-alpes.fr ARC-Seal: i=1; a=rsa-sha256; t=1787137051; cv=none; d=zohomail.com; s=zohoarc; b=CaUsmRGT9IDdjYeZ1684gKEWcDuV3imOUqEHm6dhPoFJ5Ga2eJH9JGMBFwUazJaVSxy0QG6ysF2fgwyrpeCTqY8H95ckTxhETXjF5UWV4TEDOdZ9ESw1f9vnzQemmBMjju3acjce41SvggYfnxmQhMM5DxxUDOrEHUsrebJRuoM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1787137051; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=ErUwVDH9PicSpWPsiYzuGoo9kefNjciYQ9v07La9/SE=; b=KEYthEVP2Kc9LOMUzssxPOJksSshm00MOhqpK7wMfEBTJO/h+oG61r59AnK5iZmxstKjM5p0QtuBr9R2N99iA1mbRh9FkkfWmvQcEEFGBrBGmbLZqwcf8J+E0aSPyTNOcOZqnMyMlsZ7Sg6JgITHAYozMoCC1F1GJr875Y+QvJg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1787137050777892.827106451809; Wed, 19 Aug 2026 03:57:30 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wwdyb-0004Fv-L2; Wed, 19 Aug 2026 06:56:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wwdyZ-0004E6-3w; Wed, 19 Aug 2026 06:56:55 -0400 Received: from zm-mta-out-3.u-ga.fr ([152.77.200.56]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wwdyX-0006At-7c; Wed, 19 Aug 2026 06:56:54 -0400 Received: from mailhub-2.u-ga.fr (mailhub-2.u-ga.fr [129.88.178.102]) by zm-mta-out-3.u-ga.fr (Postfix) with ESMTP id B0D5840242; Wed, 19 Aug 2026 12:56:50 +0200 (CEST) Received: from smtps.univ-grenoble-alpes.fr (smtps3.u-ga.fr [195.83.24.62]) by mailhub-2.u-ga.fr (Postfix) with ESMTP id ACB26FF85F; Wed, 19 Aug 2026 12:56:50 +0200 (CEST) Received: from naga.. (unknown [78.241.162.199]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: petrotf@univ-grenoble-alpes.fr) by smtps.univ-grenoble-alpes.fr (Postfix) with ESMTPSA id 0D4C240120; Wed, 19 Aug 2026 12:56:49 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=univ-grenoble-alpes.fr; s=2020; t=1787137010; bh=4BjLY7BDlefHvhOKTtEg8Dg2WIfdTVac0sQmGr/EkmU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=29gCzqB7zIJk+8MeTeJzKbg7my6PU1dFOZX5SsGLiMuloHpuz1nelTGvqxDbK8gx9 9JrBdSTF/SukizR/PisgcPztmRtgCDdILFv+Yrn9UT0MO1v6la53zW72x+iKV9gU9l BKJkv8o0yqCgxqO/yBu8i0+SPHIz2sKB8IRoJ7iTdzX4SxZdGsaBazSn931u0capkp GfP+9ZIVhdENlbnRsHDfYeLlZELd5vTMgVUPbXDs8f9TJerJfTW6PESw5yaLf6sxbB Ocpmilh1axKqdFIKH454V/ob1emwN4qegBU2l310SWn/Tv5BDUcGrNHhx3kzwiZ8TF e+51fhmfTIA9Q== From: frederic.petrot@univ-grenoble-alpes.fr To: alistair.francis@wdc.com, daniel.barboza@oss.qualcomm.com, palmer@dabbelt.com, liwei1518@gmail.com, zhiwei_liu@linux.alibaba.com, chao.liu@processmission.com, qemu-riscv@nongnu.org, qemu-devel@nongnu.org Cc: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9trot?= Subject: [PATCH v2 2/2] target/riscv: Allow UXL to be 3 in mstatus on rv128 Date: Wed, 19 Aug 2026 12:56:55 +0200 Message-ID: <20260819105655.33391-3-frederic.petrot@univ-grenoble-alpes.fr> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260819105655.33391-1-frederic.petrot@univ-grenoble-alpes.fr> References: <20260819105655.33391-1-frederic.petrot@univ-grenoble-alpes.fr> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Greylist: Whitelist-UGA SMTP Authentifie (petrotf@univ-grenoble-alpes.fr) via submission-587 ACL (41) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=152.77.200.56; envelope-from=frederic.petrot@univ-grenoble-alpes.fr; helo=zm-mta-out-3.u-ga.fr X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @univ-grenoble-alpes.fr) X-ZM-MESSAGEID: 1787137055841158500 From: Fr=C3=A9d=C3=A9ric P=C3=A9trot Valid UXL field values for mstatus were restricted to fix a reported issue, but this inadvertently broke the experimental rv128 support where a value of 3 validly represents 128-bit execution. Update the mstatus write logic to permit UXL=3D3 when running on an rv128 CPU. Fixes: dcd028517749 ("target/riscv: Apply UXL WARL handling to vsstatus") Signed-off-by: Fr=C3=A9d=C3=A9ric P=C3=A9trot Reviewed-by: Daniel Henrique Barboza Reviewed-by: Chao Liu --- target/riscv/tcg/csr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/riscv/tcg/csr.c b/target/riscv/tcg/csr.c index 9cc6297328..4c8959a33d 100644 --- a/target/riscv/tcg/csr.c +++ b/target/riscv/tcg/csr.c @@ -2014,8 +2014,8 @@ static uint64_t riscv_write_uxl(CPURISCVState *env, u= int64_t val, RISCVMXL xl =3D riscv_cpu_mxl(env); uint64_t uxl =3D get_field(val, field); =20 - if (uxl =3D=3D MXL_RV128) { - uxl =3D xl =3D=3D MXL_RV128 ? MXL_RV64 : xl; + if (xl !=3D MXL_RV128 && uxl =3D=3D MXL_RV128) { + uxl =3D xl; val =3D set_field(val, field, uxl); } =20 --=20 2.43.0