From nobody Sat Oct 25 08:57:50 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 1520371124583519.5524350870502; Tue, 6 Mar 2018 13:18:44 -0800 (PST) Received: from localhost ([::1]:58259 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1etJyt-00018F-Mb for importer@patchew.org; Tue, 06 Mar 2018 16:18:43 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47226) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1etJTS-0006hs-Px for qemu-devel@nongnu.org; Tue, 06 Mar 2018 15:46:15 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1etJTN-0003cd-Tp for qemu-devel@nongnu.org; Tue, 06 Mar 2018 15:46:14 -0500 Received: from mail-pl0-x243.google.com ([2607:f8b0:400e:c01::243]:42289) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1etJTN-0003cR-Nt for qemu-devel@nongnu.org; Tue, 06 Mar 2018 15:46:09 -0500 Received: by mail-pl0-x243.google.com with SMTP id 93-v6so12546707plc.9 for ; Tue, 06 Mar 2018 12:46:09 -0800 (PST) Received: from localhost.localdomain (125-237-39-90-fibre.bb.spark.co.nz. [125.237.39.90]) by smtp.gmail.com with ESMTPSA id y6sm39123791pfg.71.2018.03.06.12.46.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 06 Mar 2018 12:46:08 -0800 (PST) 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=z4u8YDUTO3j4dCbOzLLzxOroTR7hBXDCAX5JA8vX91M=; b=JtNjtDK5jRhAc/k/SG6WqaB04R5GL3OVs6lFuMyFTGK9QYwieOiu0BVUbz32ysCz2w 0VkVggkKzbs5+OIoh57g9zux+1eY4V33Mf/1QW/QV/jXbeIjVVLCjavW7G83nAUwt+ou NBvvnCYTTKpzBW+kmPMq06gEPi6AGw4klmalpa5LdyMzvhx5qKNbR7YenZDQbq90MUGI vKhr0JUvcEtIxyQkRDbt4ugLCsizQCTcLpqYppCd098/PoNQ98COYK++m+ZoNTj9PlHG IpExaoMF8Ae3uUQRg/4QnD5wRfpmcL6rZcWN+9qqKZRCkjAK9iKvRAx2psC/VmG/xYOX 75IQ== 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=z4u8YDUTO3j4dCbOzLLzxOroTR7hBXDCAX5JA8vX91M=; b=fxGECrSHr+VhKtCwY8RrE0xUirYXs0KAq+WysUNzM5H+yBe4H7Xhn86EhFZ6xq77bD M0Ak1FA9Dy5D+Vd58yj9l2lLyFvAWVe0a28Y136j635YZkGZd/OLessiOPDRF8/8v6/Y nJM+s7v/e/ldbwZHSTt6o2Upzrtjf59iVXZWta+m4bxz532oemP1pW5C8qc8o+/JDxzL hC+Lcz4DUdQaZ5i6bau5Rmw8RkVBfgVnV5z0h6Dt27s/gERxkZbHGXI1ejywJn4h/Xe+ p3SyFkT1ULLB+1qgJwWlbAWvRX963WU4aAV4cBmbvnjsx4vzhVsjSpxoidI8Cv1TkCK+ V5fA== X-Gm-Message-State: APf1xPBlSYPQyIwzs3PIVrbjGSERJVoPciu62UwhgTFY0T+iqKOOIV90 H7gLWLNl2xES30UIwifOmObEaqbuNnE= X-Google-Smtp-Source: AG47ELuTGmwGu/r1s+kQ1ZpcXl5K4z0HuylnwjCU9pJFyx/YGFUIGy2Nfbqj4ihmbIZ/mwvlwRUcXg== X-Received: by 2002:a17:902:8c92:: with SMTP id t18-v6mr17924250plo.449.1520369168749; Tue, 06 Mar 2018 12:46:08 -0800 (PST) From: Michael Clark To: qemu-devel@nongnu.org Date: Wed, 7 Mar 2018 09:43:52 +1300 Message-Id: <1520369037-37977-18-git-send-email-mjc@sifive.com> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1520369037-37977-1-git-send-email-mjc@sifive.com> References: <1520369037-37977-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::243 Subject: [Qemu-devel] [PATCH v1 17/22] RISC-V: Ingore satp writes and return 0 for reads 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: Bastian Koppelmann , Michael Clark , Palmer Dabbelt , Sagar Karandikar , RISC-V Patches when no-mmu 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 bear trap overhead, versus simply reading back the value and checking if the write took (saves hundreds of cycles and much more complex trap handling code). 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