From patchwork Mon Mar 19 21:18:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Clark X-Patchwork-Id: 10295289 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B453E60385 for ; Mon, 19 Mar 2018 21:35:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A2F07293FB for ; Mon, 19 Mar 2018 21:35:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9799F294B1; Mon, 19 Mar 2018 21:35:31 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 3D210293FB for ; Mon, 19 Mar 2018 21:35:31 +0000 (UTC) Received: from localhost ([::1]:44073 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ey2RG-0006s7-Dn for patchwork-qemu-devel@patchwork.kernel.org; Mon, 19 Mar 2018 17:35:30 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33375) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ey2CI-0001Vh-85 for qemu-devel@nongnu.org; Mon, 19 Mar 2018 17:20:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ey2CG-0002lQ-OU for qemu-devel@nongnu.org; Mon, 19 Mar 2018 17:20:02 -0400 Received: from mail-pl0-x242.google.com ([2607:f8b0:400e:c01::242]:43974) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ey2CG-0002l8-Hn for qemu-devel@nongnu.org; Mon, 19 Mar 2018 17:20:00 -0400 Received: by mail-pl0-x242.google.com with SMTP id f23-v6so11037852plr.10 for ; Mon, 19 Mar 2018 14:20:00 -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=FmWcalUe9tVfX0LuPD/UjzTUwSu/JDaxpvjfFAnMK3k=; b=L0thekK8jKo58F06u/gDazC7UpZDybjeNJI4NqtV13IhiDuAxM9gqEIk7uUu1P69y2 y4h3IolmQ4psbW7SKn+uhIrjUg7NmrUrYHy1MiXhkBL1K/+qI7eX11rovtVOp3Vz50fb tP7Z9+DTYrsFl89VRPyKqbe2ZG5tlAe3/Kd2y3ddQS7gprDJZzNxtFDyCV9kD96MVPd1 8K+BBEy2kT2FAjeBvRCGlIgn+PbCJ63CBrpMqBxyjsB7pDBF0wGbvRdCcIuZpeervFyf Oe+pp8j7w/WwgAevVe/D5aJZGl3eLuuAXhdr6IC+nC/Kxsfpp4GbWPz9bSmpC3dX93uO W50w== 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=FmWcalUe9tVfX0LuPD/UjzTUwSu/JDaxpvjfFAnMK3k=; b=QsJxoFC75BW0W8tjLZK68HuWT4iv2mCTog3FzQ3GalxqtMZ8r3WXScuGdaPOsIwLmb ez47/jUD8XcqcrBLOKtReFjcM/57Sw6rKdNtWuOqtBLTUV945lC0oPDrDhb7C3Gy6SdB kviwkjVcpt36EiTzLFHv5rXNHAqMjPGeKZV29oMWbl8Ir9dhWoHWgidy7xylCaWTiH/w FDjJnu/8SNBmR9PfxBF4ID20G7a1ESknugakwm5zNVGW9lG/uLzMzJ99EvGXu4tH2ueP J72mOKPdgVTuZnXIPIJK2v1NLnFqiNCOwMOAr6mZD5JBbBVjjW6drDatA7FvvxUJeC+R zrZw== X-Gm-Message-State: AElRT7E3/cqBJjELwj+g9bKb92eWJcOGyJBDTd3P7z10B75bAgUUArwo NoiAznRBCwA3ib9vLXOctYm9aV74nM0= X-Google-Smtp-Source: AG47ELuR+/4WaJEEtumeUNFgcCMzH+wD2OSa7TjWSty+7iA3yti3W4Q86OzjyGvfcUrVfSMnYVTOyw== X-Received: by 2002:a17:902:8483:: with SMTP id c3-v6mr11488723plo.156.1521494399637; Mon, 19 Mar 2018 14:19:59 -0700 (PDT) Received: from monty.com ([12.206.222.5]) by smtp.gmail.com with ESMTPSA id i127sm120500pfc.136.2018.03.19.14.19.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 19 Mar 2018 14:19:59 -0700 (PDT) From: Michael Clark To: qemu-devel@nongnu.org Date: Mon, 19 Mar 2018 14:18:44 -0700 Message-Id: <1521494329-19546-22-git-send-email-mjc@sifive.com> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1521494329-19546-1-git-send-email-mjc@sifive.com> References: <1521494329-19546-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 v4 21/26] RISC-V: No traps on writes to misa, minstret, mcycle 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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP These fields are marked WARL in the specification so illegal writes are silently dropped. Cc: Sagar Karandikar Cc: Bastian Koppelmann Signed-off-by: Michael Clark Signed-off-by: Palmer Dabbelt --- target/riscv/op_helper.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/target/riscv/op_helper.c b/target/riscv/op_helper.c index 36b9e8e..ba3639d 100644 --- a/target/riscv/op_helper.c +++ b/target/riscv/op_helper.c @@ -200,17 +200,19 @@ void csr_write_helper(CPURISCVState *env, target_ulong val_to_write, break; } case CSR_MINSTRET: - qemu_log_mask(LOG_UNIMP, "CSR_MINSTRET: write not implemented"); - goto do_illegal; + /* minstret is WARL so unsupported writes are ignored */ + break; case CSR_MCYCLE: - qemu_log_mask(LOG_UNIMP, "CSR_MCYCLE: write not implemented"); - goto do_illegal; + /* mcycle is WARL so unsupported writes are ignored */ + break; +#if defined(TARGET_RISCV32) case CSR_MINSTRETH: - qemu_log_mask(LOG_UNIMP, "CSR_MINSTRETH: write not implemented"); - goto do_illegal; + /* minstreth is WARL so unsupported writes are ignored */ + break; case CSR_MCYCLEH: - qemu_log_mask(LOG_UNIMP, "CSR_MCYCLEH: write not implemented"); - goto do_illegal; + /* mcycleh is WARL so unsupported writes are ignored */ + break; +#endif case CSR_MUCOUNTEREN: env->mucounteren = val_to_write; break; @@ -300,10 +302,9 @@ void csr_write_helper(CPURISCVState *env, target_ulong val_to_write, case CSR_MBADADDR: env->mbadaddr = val_to_write; break; - case CSR_MISA: { - qemu_log_mask(LOG_UNIMP, "CSR_MISA: misa writes not supported"); - goto do_illegal; - } + case CSR_MISA: + /* misa is WARL so unsupported writes are ignored */ + break; case CSR_PMPCFG0: case CSR_PMPCFG1: case CSR_PMPCFG2: @@ -328,7 +329,6 @@ void csr_write_helper(CPURISCVState *env, target_ulong val_to_write, case CSR_PMPADDR15: pmpaddr_csr_write(env, csrno - CSR_PMPADDR0, val_to_write); break; - do_illegal: #endif default: do_raise_exception_err(env, RISCV_EXCP_ILLEGAL_INST, GETPC());