OSDN Git Service

target/riscv: Only flush TLB if SATP.ASID changes
authorJonathan Behrens <jonathan@fintelia.io>
Wed, 8 May 2019 17:38:35 +0000 (13:38 -0400)
committerPalmer Dabbelt <palmer@sifive.com>
Fri, 24 May 2019 19:09:25 +0000 (12:09 -0700)
There is an analogous change for ARM here:
https://patchwork.kernel.org/patch/10649857

Signed-off-by: Jonathan Behrens <jonathan@fintelia.io>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Signed-off-by: Palmer Dabbelt <palmer@sifive.com>
target/riscv/csr.c

index 0f51c7e..f9e2910 100644 (file)
@@ -723,7 +723,9 @@ static int write_satp(CPURISCVState *env, int csrno, target_ulong val)
         if (env->priv == PRV_S && get_field(env->mstatus, MSTATUS_TVM)) {
             return -1;
         } else {
-            tlb_flush(CPU(riscv_env_get_cpu(env)));
+            if((val ^ env->satp) & SATP_ASID) {
+                tlb_flush(CPU(riscv_env_get_cpu(env)));
+            }
             env->satp = val;
         }
     }