aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Matyas <50193733+JanMatCodasip@users.noreply.github.com>2020-01-10 21:29:10 +0100
committerTim Newsome <tim@sifive.com>2020-01-10 12:29:10 -0800
commitfcea4f79ba3c119b993e54205af6722dbbdf24d8 (patch)
tree7a697dcff40f9b181448eccf7ee00884edbb9a72
parent8b8db033ee118c3a35462b8e8b287652d5ec69d3 (diff)
downloadriscv-openocd-fcea4f79ba3c119b993e54205af6722dbbdf24d8.zip
riscv-openocd-fcea4f79ba3c119b993e54205af6722dbbdf24d8.tar.gz
riscv-openocd-fcea4f79ba3c119b993e54205af6722dbbdf24d8.tar.bz2
Don't issue extra FENCE+FENCE.i for the current hart. (#439)
The original OpenOCD code issued FENCE & FENCE.i twice for the current hart (which is harmless, but takes time). Avoiding this extra FENCE is a slight performance improvement. Per my rough measurements, this improves performance of certain debugger actions (single-stepping) by approx. 20% in single-hart systems.
-rw-r--r--src/target/riscv/riscv-013.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/target/riscv/riscv-013.c b/src/target/riscv/riscv-013.c
index 548c6d5..bc7035f 100644
--- a/src/target/riscv/riscv-013.c
+++ b/src/target/riscv/riscv-013.c
@@ -2010,6 +2010,10 @@ static int execute_fence(struct target *target)
if (!riscv_hart_enabled(target, i))
continue;
+ if (i == old_hartid)
+ /* Fence already executed for this hart */
+ continue;
+
riscv_set_current_hartid(target, i);
struct riscv_program program;