From patchwork Sat Mar 24 18:13:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Clark X-Patchwork-Id: 10306421 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 7B72E60325 for ; Sat, 24 Mar 2018 21:17:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 593BF29090 for ; Sat, 24 Mar 2018 21:17:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4C088292E1; Sat, 24 Mar 2018 21:17:23 +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 ADDE129090 for ; Sat, 24 Mar 2018 21:17:22 +0000 (UTC) Received: from localhost ([::1]:48507 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ezqXR-0004lc-7a for patchwork-qemu-devel@patchwork.kernel.org; Sat, 24 Mar 2018 17:17:21 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44183) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ezqQX-0006xI-Tt for qemu-devel@nongnu.org; Sat, 24 Mar 2018 17:11:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ezqPR-0002aW-7k for qemu-devel@nongnu.org; Sat, 24 Mar 2018 17:10:11 -0400 Received: from mail-pf0-x242.google.com ([2607:f8b0:400e:c00::242]:39342) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ezngY-0003lc-78 for qemu-devel@nongnu.org; Sat, 24 Mar 2018 14:14:34 -0400 Received: by mail-pf0-x242.google.com with SMTP id u5so5951892pfh.6 for ; Sat, 24 Mar 2018 11:14:34 -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=FB1Lo7nSGsPTqAsq3qaHr1vz/VQhGVgh3rHa8LB9CCoxIgXp4Kbz8jIBaE31euX4ip EVOx8/Y5RxBXbdOqBZnyiMIGxJFxfgrP/6Zgdb2ZJ9RPIP+/dEwpMPoSld9r0hxcBjXx Jzuv/3EXGC+SYaQSl4TeTfBKhQOg6fyXxYALeU2kAd5zcX6HYTNZl+w/7H+jK3+FtBGF m9jtgi7nDcVlmQB+F2GAHT/UFTkWeNtRno6jhciBJPMJm/eagZYlWUlXm1svrSuQLFto u+18I9HMcKsW66hp+fXvd8WiSws9aDSWITnv0RL0/OZjp0X5IZbucj9kX2eEd511fJXQ edxQ== 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=np5Fcjcwh9qYnQuxEUIqTttpDHIr+kUUTcMP/4sEs5ybAQXalXpUVQtx8bvwi/U4j0 tHONdlU9nGzrK4UvnUbVNMcy/i/cTGnpF50w4tfEMKdcD9NnNZ7BVTwTIj5a800CMF1A upbg0qVlhhvsAgGxNRywuJoAnIDx1D4WQjJDU8/EW9OCzpqkePW5vjbazRK18zvA0N7x zCiUe810+sxlrdB3jxtyqsTOVnfyI4qRp5VGy2nv+k5AueKCv3w9w0aRvc0+s0SscL5s QhRa6HzQuRGfu3N76hUaMR/Ceg3T9JvuO9Nnx9axtdZMFZKuJTWuf4FVXi51/M/WQ615 vQ+A== X-Gm-Message-State: AElRT7Hvx1TGD/cgnGcTplkiQVaSxubK3+PRHtXC+pUbYCsKAsS5nlCr lXXLESeDSN29D0v3sCbQ+VWdLkjIWAk= X-Google-Smtp-Source: AG47ELvHOnH7j1T5cxklkT89RYPVIflt6xjs/BH/LFtuYpIGFDScQHyhd7/ancDZx50Mf/7rlBwGYg== X-Received: by 10.99.126.26 with SMTP id z26mr24325945pgc.132.1521915273261; Sat, 24 Mar 2018 11:14:33 -0700 (PDT) Received: from monty.com (h98.112.139.40.ip.windstream.net. [40.139.112.98]) by smtp.gmail.com with ESMTPSA id k24sm22314646pff.77.2018.03.24.11.14.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 24 Mar 2018 11:14:32 -0700 (PDT) From: Michael Clark To: qemu-devel@nongnu.org Date: Sat, 24 Mar 2018 11:13:35 -0700 Message-Id: <1521915220-65389-10-git-send-email-mjc@sifive.com> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1521915220-65389-1-git-send-email-mjc@sifive.com> References: <1521915220-65389-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] [PATCH v6 20/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());