From patchwork Wed Mar 21 20:46:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Clark X-Patchwork-Id: 10300421 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 85FA760385 for ; Wed, 21 Mar 2018 21:10:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 718EA298E6 for ; Wed, 21 Mar 2018 21:10:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6F5BC28A11; Wed, 21 Mar 2018 21:10:25 +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 A1B0D29964 for ; Wed, 21 Mar 2018 21:10:18 +0000 (UTC) Received: from localhost ([::1]:57479 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eykzx-0005F9-A1 for patchwork-qemu-devel@patchwork.kernel.org; Wed, 21 Mar 2018 17:10:17 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53205) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eykeZ-0002BT-QO for qemu-devel@nongnu.org; Wed, 21 Mar 2018 16:48:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eykeX-0002Bc-Qr for qemu-devel@nongnu.org; Wed, 21 Mar 2018 16:48:11 -0400 Received: from mail-pf0-x242.google.com ([2607:f8b0:400e:c00::242]:40176) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eykeX-0002BJ-Ju for qemu-devel@nongnu.org; Wed, 21 Mar 2018 16:48:09 -0400 Received: by mail-pf0-x242.google.com with SMTP id x1so2459397pfh.7 for ; Wed, 21 Mar 2018 13:48:09 -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=DtjObHzMyCtwVlbVXNllzDA4qxktugHIJcxePOJaPhI1mJxriwAR1gamE3zCZOUoSV tpgGdqsSk5udKNBcrp5NJe6VjySMIoxAxBUd5a2LgspZqvfLgmBsXNB9GRvCkTI2uoma VmVLkKTo+jyUHtXxM8D+n5On9nNogO6s30ZINZRmbbeISD5Xds8DEYm8/GdjQiCuqTEm xWcUL7jUOdhA3CIPhJuHJvtvPwOhzncGlNYjjOFRYjZO6Es0xW35JqYgVPev86AZko9Y Di2Hkm/o7vhxdALWApyQQm/bAZttfnuPQkG6La5SrjDkvZHWN3KHlcYSDyBFE9r3fiw6 jB0w== 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=NLSxoFY0yP8ObWH6kMd3Z69M/QjUuaFGJ//fmJh7iXElhXyeN3oCIf3jDw2oO9tkc5 42WFRf6q6d9KqQYhAhoWBmVcbkj0yTnKKHz73u6TnOG9FqwM6KMhxaMdM3swCWm5mtko xGigHQb+JbmN4g2idGKZzVuGVHeYV4ksUmH52GZh2Non6p83vfTNdMDNge3VP27MbV6o xwyub0h8cIRpIeu1oXmoz21ST7XARLYt3dnE9eHP0XJcivY4DRUh5+f5TY0X2S/mK45t d0IlXc60tKR3d8YzP0H0YnFTZKOuxI7lSlxfzTDVR4vg3NwkcF0Ynrm2XNfQkp8xFls1 rtWQ== X-Gm-Message-State: AElRT7GNksP3WP8qEdZvfY2gfUhsTGdXFXuk8EhDsQDcl8Ww9ZuSSx0G O/ucjarm+urB4Qg8ZItLQ9+C5w9/UU0= X-Google-Smtp-Source: AG47ELsMKJqeljlupPFomkZH72ZlAAw8LmJ8OOujZfkv6LjgiZVI962M+1ZzQ9YBGBpHnyyevlM7cw== X-Received: by 10.99.96.66 with SMTP id u63mr16048420pgb.22.1521665288600; Wed, 21 Mar 2018 13:48:08 -0700 (PDT) Received: from monty.com ([12.206.222.5]) by smtp.gmail.com with ESMTPSA id w10sm8244499pgr.57.2018.03.21.13.48.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 21 Mar 2018 13:48:08 -0700 (PDT) From: Michael Clark To: qemu-devel@nongnu.org Date: Wed, 21 Mar 2018 13:46:56 -0700 Message-Id: <1521665220-3869-21-git-send-email-mjc@sifive.com> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1521665220-3869-1-git-send-email-mjc@sifive.com> References: <1521665220-3869-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:c00::242 Subject: [Qemu-devel] [PULL 20/24] 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());