From nobody Sat Oct 25 21:46:13 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1521230065564479.2895996451159; Fri, 16 Mar 2018 12:54:25 -0700 (PDT) Received: from localhost ([::1]:59252 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ewvQm-0000Bt-AB for importer@patchew.org; Fri, 16 Mar 2018 15:54:24 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40395) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ewvFK-0007Xy-Sb for qemu-devel@nongnu.org; Fri, 16 Mar 2018 15:42:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ewvFJ-0003of-VP for qemu-devel@nongnu.org; Fri, 16 Mar 2018 15:42:34 -0400 Received: from mail-pl0-x242.google.com ([2607:f8b0:400e:c01::242]:44989) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ewvFJ-0003oO-Pt for qemu-devel@nongnu.org; Fri, 16 Mar 2018 15:42:33 -0400 Received: by mail-pl0-x242.google.com with SMTP id 9-v6so6503940ple.11 for ; Fri, 16 Mar 2018 12:42:33 -0700 (PDT) Received: from monty.com ([12.206.222.5]) by smtp.gmail.com with ESMTPSA id k24sm13780469pff.77.2018.03.16.12.42.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 16 Mar 2018 12:42:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=skhNLehqLx7INkCfB7WkgTioVOYa2VI4KQLj/TiEtYM=; b=OX7z2qKu7yM8MHIBFprKTJVZv6HgM5QWReXZTY9oWEv3j8yBGajjUDne0T/lC1+Zcl jUPBMG6lqa2yWVHCva1tbj51+m9TwK/UgzUjUlUn+Ax0Dq/3A0bhFdmL2Va9X93DOLDZ LsPCW+Ic6wDsVI+24XEJFGmvWeQvZFd70ku0F39o6zhMZ0RPsHgW/jIsafDGEJm1x0Uf ZlOlTzPgXJJtcwmKe05jcSObpqAjvC7DrgGwQ+5oiRfsUBevMueuwOefyOTSStv3ZWrf oUAOTrzrcZCEnbxpNccQulApMj6awvLESVbz9SoX+Xki4FCs/jtV4XjfD9/PtF5vHE9N QxOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=skhNLehqLx7INkCfB7WkgTioVOYa2VI4KQLj/TiEtYM=; b=qKk0GRN015sbS38zOPy4PWm71xK3SYOZXJuFXnOE7DK/+S4BNPorRd+0EYJROSt8Cf X+SYQyC+m+0QrBDSkcdl3FM1aEI4e078dCbGj4vEXceg5W3BqwDD0b3qE2Nj3jpb2/kC H91oz3Saz0tj5S8hzQB+p7rmJ3VxaLUA1D+B6KLmdnUhDlytrBAaGMDuYSPVSpef5ZvG 6v5pHMZTFEnTgGhsWBjEPo5klFl1bcTwblrG5pSgQjeuxspmecCvD3O3Sgnf66VsIlea OEZY/nuVQvxoUmik0kQYfHie78kdNffATcfaZgLR0Zy6La1NdF1YMBQMbx3eTNzqyiFN vqlQ== X-Gm-Message-State: AElRT7GqnNza6cCr+BydbP06JoIJrgOBmjJWtFNeyxRArJPIzHc4fKv2 JrvlW6xCbedzjIHrUN7BnnkzTljZEFM= X-Google-Smtp-Source: AG47ELvGRr5MEflDIgvEpL9ywlvSmeAenlDn4rmnaAfxB4LN6kP5kzpEb8QoL4mNshypXg41NnjrRw== X-Received: by 2002:a17:902:b10c:: with SMTP id q12-v6mr3426918plr.197.1521229352553; Fri, 16 Mar 2018 12:42:32 -0700 (PDT) From: Michael Clark To: qemu-devel@nongnu.org Date: Fri, 16 Mar 2018 12:41:14 -0700 Message-Id: <1521229281-73637-18-git-send-email-mjc@sifive.com> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1521229281-73637-1-git-send-email-mjc@sifive.com> References: <1521229281-73637-1-git-send-email-mjc@sifive.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c01::242 Subject: [Qemu-devel] [PATCH v3 17/24] RISC-V: Hardwire satp to 0 for no-mmu case X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: patches@groups.riscv.org, Michael Clark , Palmer Dabbelt , Sagar Karandikar , Bastian Koppelmann Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" satp is WARL so it should not trap on illegal writes, rather it can be hardwired to zero and silently ignore illegal writes. It seems the RISC-V WARL behaviour is preferred to having to trap overhead versus simply reading back the value and checking if the write took (saves hundreds of cycles and more complex trap handling code). Cc: Sagar Karandikar Cc: Bastian Koppelmann Signed-off-by: Michael Clark Signed-off-by: Palmer Dabbelt --- target/riscv/op_helper.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/target/riscv/op_helper.c b/target/riscv/op_helper.c index e34715d..dd3e417 100644 --- a/target/riscv/op_helper.c +++ b/target/riscv/op_helper.c @@ -242,7 +242,7 @@ void csr_write_helper(CPURISCVState *env, target_ulong = val_to_write, } case CSR_SATP: /* CSR_SPTBR */ { if (!riscv_feature(env, RISCV_FEATURE_MMU)) { - goto do_illegal; + break; } if (env->priv_ver <=3D PRIV_VERSION_1_09_1 && (val_to_write ^ env-= >sptbr)) { @@ -452,7 +452,10 @@ target_ulong csr_read_helper(CPURISCVState *env, targe= t_ulong csrno) return env->scounteren; case CSR_SCAUSE: return env->scause; - case CSR_SPTBR: + case CSR_SATP: /* CSR_SPTBR */ + if (!riscv_feature(env, RISCV_FEATURE_MMU)) { + return 0; + } if (env->priv_ver >=3D PRIV_VERSION_1_10_0) { return env->satp; } else { --=20 2.7.0