From patchwork Fri Mar 9 04:12:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Clark X-Patchwork-Id: 10269669 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 C7528603B5 for ; Fri, 9 Mar 2018 04:31:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A65A329C99 for ; Fri, 9 Mar 2018 04:31:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9B33129CB5; Fri, 9 Mar 2018 04:31:51 +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 164A629C99 for ; Fri, 9 Mar 2018 04:31:51 +0000 (UTC) Received: from localhost ([::1]:43191 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eu9h8-0001or-Ew for patchwork-qemu-devel@patchwork.kernel.org; Thu, 08 Mar 2018 23:31:50 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56019) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eu9R6-0004hW-7A for qemu-devel@nongnu.org; Thu, 08 Mar 2018 23:15:17 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eu9R3-0007C9-8P for qemu-devel@nongnu.org; Thu, 08 Mar 2018 23:15:16 -0500 Received: from mail-pl0-x244.google.com ([2607:f8b0:400e:c01::244]:37655) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eu9R3-0007Bq-1u for qemu-devel@nongnu.org; Thu, 08 Mar 2018 23:15:13 -0500 Received: by mail-pl0-x244.google.com with SMTP id w12-v6so4619435plp.4 for ; Thu, 08 Mar 2018 20:15:13 -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=elXEjrujeHBejLZefg5SAzL2dxTnnLrXWqzO68PGJuU=; b=BL6Mg7OOSX8Ef0xyL5aYxhoUJbW0a5EoJH5a5zfUmQ5lV+Rtj7nYSF6NN6T+8oz12k Ed72Ts198Bb24IibjkiSked6lx5d7dbD/H6DeheyVvMAADK9za5G+p1gRU9rj0ooI+nn KUO6lribDcuxCnz/agWPp3gERaIxaUk0eMG2lTu7pyA54uf71XJoV9iINKSy+A672swK 2E3TExkohnB4rQWcRyVE54s1y0+8zeSldydWsUAx062SG8UNNEzQR0vcgrxYK4gte2i4 gwmM789kUD3ykihYE+QHZ2w1r7QdSpHhR1o7pCluilYvynBmqXnKZ9sPRRkG9gMOX/tg 27Mw== 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=elXEjrujeHBejLZefg5SAzL2dxTnnLrXWqzO68PGJuU=; b=fGYO0KfUmG8Kk3WJ+WHOlnVgSLbaxAE9y2y9qsrksUvlkef76+2zmG6wdgbFASGaxr Vtb/fl2OhQUjGzu6BaHgudlRo5sIyBS0BnghV6tCq7pJc6P7XWHg+joFJiUvyIKZWyEl HIc8t2oDVBxtlbviqAxpxPsGV7OUu5b9o/w8WjW5idgQ4w+RL4XFHWCoK68QCz7hQgl9 C9fGHhE9FLFrZZqFhNdOSfkU4uPRMmosMz9jo33m5LWOX9OU2P5yodxKPi9bmZ5LYPBh DdVe5WDSUG/cChDfLo0e/jvaq/ZVSWr7S8JFiUjvNfDa++VH6+0/IiQbIXNQ3s+OWm65 gI+w== X-Gm-Message-State: AElRT7GWgLo5rnyYPR5B//gbE7v2GauGGTPyNh5nfvMniZm2DSOqYbuh MeOguA4qX73agOK9iDjIUxtRugdrbMI= X-Google-Smtp-Source: AG47ELtD2pjxoQwJwo4URgba6LvM2mfLs0Ow4FJWWdRNbgDSlT7SIP20Tg0KMJp39kx6ZW0QsoJBiQ== X-Received: by 2002:a17:902:bf03:: with SMTP id bi3-v6mr21030074plb.343.1520568912207; Thu, 08 Mar 2018 20:15:12 -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 h15sm334141pfi.56.2018.03.08.20.15.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 08 Mar 2018 20:15:11 -0800 (PST) From: Michael Clark To: qemu-devel@nongnu.org Date: Fri, 9 Mar 2018 17:12:43 +1300 Message-Id: <1520568765-58189-22-git-send-email-mjc@sifive.com> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1520568765-58189-1-git-send-email-mjc@sifive.com> References: <1520568765-58189-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::244 Subject: [Qemu-devel] [PATCH v2 21/23] 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: Bastian Koppelmann , Michael Clark , Palmer Dabbelt , Sagar Karandikar 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 aa101cc..f8595a6 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());