diff options
author | Alistair Francis <alistair.francis@wdc.com> | 2019-10-08 15:04:18 -0700 |
---|---|---|
committer | Palmer Dabbelt <palmer@dabbelt.com> | 2019-11-14 09:53:28 -0800 |
commit | 7ec5d3030b9293ab631dd653f64bc933b6c82e65 (patch) | |
tree | d296987c0cce26292ad67b885672f9104c2f7b4b /target/riscv/cpu.c | |
parent | f480f6e8c5ca9a27c046e3a273a4693d2475bdc2 (diff) | |
download | qemu-7ec5d3030b9293ab631dd653f64bc933b6c82e65.zip qemu-7ec5d3030b9293ab631dd653f64bc933b6c82e65.tar.gz qemu-7ec5d3030b9293ab631dd653f64bc933b6c82e65.tar.bz2 |
target/riscv: Remove atomic accesses to MIP CSR
Instead of relying on atomics to access the MIP register let's update
our helper function to instead just lock the IO mutex thread before
writing. This follows the same concept as used in PPC for handling
interrupts
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Palmer Dabbelt <palmer@dabbelt.com>
Signed-off-by: Palmer Dabbelt <palmer@sifive.com>
Signed-off-by: Palmer Dabbelt <palmer@dabbelt.com>
Diffstat (limited to 'target/riscv/cpu.c')
-rw-r--r-- | target/riscv/cpu.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index 3939963..d37861a 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -224,8 +224,7 @@ static void riscv_cpu_dump_state(CPUState *cs, FILE *f, int flags) #ifndef CONFIG_USER_ONLY qemu_fprintf(f, " %s " TARGET_FMT_lx "\n", "mhartid ", env->mhartid); qemu_fprintf(f, " %s " TARGET_FMT_lx "\n", "mstatus ", env->mstatus); - qemu_fprintf(f, " %s " TARGET_FMT_lx "\n", "mip ", - (target_ulong)atomic_read(&env->mip)); + qemu_fprintf(f, " %s 0x%x\n", "mip ", env->mip); qemu_fprintf(f, " %s " TARGET_FMT_lx "\n", "mie ", env->mie); qemu_fprintf(f, " %s " TARGET_FMT_lx "\n", "mideleg ", env->mideleg); qemu_fprintf(f, " %s " TARGET_FMT_lx "\n", "medeleg ", env->medeleg); @@ -275,7 +274,7 @@ static bool riscv_cpu_has_work(CPUState *cs) * Definition of the WFI instruction requires it to ignore the privilege * mode and delegation registers, but respect individual enables */ - return (atomic_read(&env->mip) & env->mie) != 0; + return (env->mip & env->mie) != 0; #else return true; #endif |