From: Sean Anderson <seanga2@gmail.com>
To: u-boot@lists.denx.de
Subject: [PATCH 11/11] riscv: Add option to disable writes to mcounteren
Date: Tue, 31 Dec 2019 17:51:34 -0500 [thread overview]
Message-ID: <bb63dc96-61fc-92ee-550e-13f485735e6d@gmail.com> (raw)
In-Reply-To: <29dd818b-dff7-a44d-1e6c-493726d68f93@gmail.com>
On the kendryte k210, writes to mcounteren result in an illegal instruction
exception.
Signed-off-by: Sean Anderson <seanga2@gmail.com>
---
arch/riscv/cpu/cpu.c | 2 ++
board/sipeed/maix/Kconfig | 1 +
configs/sipeed_maix_bitm_config | 1 +
3 files changed, 4 insertions(+)
diff --git a/arch/riscv/cpu/cpu.c b/arch/riscv/cpu/cpu.c
index e457f6acbf..df9eae663c 100644
--- a/arch/riscv/cpu/cpu.c
+++ b/arch/riscv/cpu/cpu.c
@@ -89,7 +89,9 @@ int arch_cpu_init_dm(void)
* Enable perf counters for cycle, time,
* and instret counters only
*/
+#ifndef CONFIG_SYS_RISCV_NOCOUNTER
csr_write(CSR_MCOUNTEREN, GENMASK(2, 0));
+#endif
/* Disable paging */
if (supports_extension('s'))
diff --git a/board/sipeed/maix/Kconfig b/board/sipeed/maix/Kconfig
index 6a25086ef4..c456c47fb2 100644
--- a/board/sipeed/maix/Kconfig
+++ b/board/sipeed/maix/Kconfig
@@ -37,6 +37,7 @@ config BOARD_SPECIFIC_OPTIONS
select SIFIVE_SERIAL
select ARCH_DEFAULT_RV64I
select ENV_IS_NOWHERE
+ select SYS_RISCV_NOCOUNTER
imply SIFIVE_CLINT
imply K210_SYSCTL
imply CLK_K210
diff --git a/configs/sipeed_maix_bitm_config b/configs/sipeed_maix_bitm_config
index 0088748ae0..73075e3016 100644
--- a/configs/sipeed_maix_bitm_config
+++ b/configs/sipeed_maix_bitm_config
@@ -30,6 +30,7 @@ CONFIG_RISCV_ISA_A=y
CONFIG_SIFIVE_CLINT=y
CONFIG_K210_SYSCTL=y
CONFIG_SHOW_REGS=y
+CONFIG_SYS_RISCV_NOCOUNTER=y
CONFIG_STACK_SIZE_SHIFT=14
CONFIG_LOCALVERSION=""
CONFIG_CC_OPTIMIZE_FOR_SIZE=y
--
2.24.1
prev parent reply other threads:[~2019-12-31 22:51 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-31 22:39 [PATCH 00/11] riscv: Add Sipeed Maix support Sean Anderson
2019-12-31 22:42 ` [PATCH 01/11] clk: Always use the supplied struct clk Sean Anderson
2020-01-02 5:01 ` Jagan Teki
2019-12-31 22:43 ` [PATCH 02/11] clk: Check that ops of composite clock components exist, before calling Sean Anderson
2019-12-31 22:44 ` [PATCH 03/11] riscv: Add headers for asm/global_data.h Sean Anderson
2019-12-31 22:45 ` [PATCH 04/11] riscv: Add an option to default to RV64I Sean Anderson
2019-12-31 22:46 ` [PATCH 05/11] riscv: Enable SiFive UART support pre-relocation Sean Anderson
2019-12-31 22:47 ` [PATCH 06/11] riscv: Add initial Sipeed Maix support Sean Anderson
2019-12-31 22:48 ` [PATCH 07/11] riscv: Add device tree for K210 Sean Anderson
2019-12-31 22:49 ` [PATCH 08/11] riscv: Add K210 sysctl support Sean Anderson
2019-12-31 22:50 ` [PATCH 09/11] riscv: Add K210 pll support Sean Anderson
2019-12-31 22:50 ` [PATCH 10/11] riscv: Add K210 clock support Sean Anderson
2019-12-31 22:51 ` Sean Anderson [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=bb63dc96-61fc-92ee-550e-13f485735e6d@gmail.com \
--to=seanga2@gmail.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox