target/riscv: Use QEMU_IOTHREAD_LOCK_GUARD in riscv_cpu_update_mip
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
parent
03ac0a0cfd
commit
b3eb5b861a
|
@ -610,7 +610,6 @@ uint64_t riscv_cpu_update_mip(RISCVCPU *cpu, uint64_t mask, uint64_t value)
|
||||||
CPURISCVState *env = &cpu->env;
|
CPURISCVState *env = &cpu->env;
|
||||||
CPUState *cs = CPU(cpu);
|
CPUState *cs = CPU(cpu);
|
||||||
uint64_t gein, vsgein = 0, vstip = 0, old = env->mip;
|
uint64_t gein, vsgein = 0, vstip = 0, old = env->mip;
|
||||||
bool locked = false;
|
|
||||||
|
|
||||||
if (riscv_cpu_virt_enabled(env)) {
|
if (riscv_cpu_virt_enabled(env)) {
|
||||||
gein = get_field(env->hstatus, HSTATUS_VGEIN);
|
gein = get_field(env->hstatus, HSTATUS_VGEIN);
|
||||||
|
@ -621,10 +620,7 @@ uint64_t riscv_cpu_update_mip(RISCVCPU *cpu, uint64_t mask, uint64_t value)
|
||||||
mask = ((mask == MIP_VSTIP) && env->vstime_irq) ? 0 : mask;
|
mask = ((mask == MIP_VSTIP) && env->vstime_irq) ? 0 : mask;
|
||||||
vstip = env->vstime_irq ? MIP_VSTIP : 0;
|
vstip = env->vstime_irq ? MIP_VSTIP : 0;
|
||||||
|
|
||||||
if (!qemu_mutex_iothread_locked()) {
|
QEMU_IOTHREAD_LOCK_GUARD();
|
||||||
locked = true;
|
|
||||||
qemu_mutex_lock_iothread();
|
|
||||||
}
|
|
||||||
|
|
||||||
env->mip = (env->mip & ~mask) | (value & mask);
|
env->mip = (env->mip & ~mask) | (value & mask);
|
||||||
|
|
||||||
|
@ -634,10 +630,6 @@ uint64_t riscv_cpu_update_mip(RISCVCPU *cpu, uint64_t mask, uint64_t value)
|
||||||
cpu_reset_interrupt(cs, CPU_INTERRUPT_HARD);
|
cpu_reset_interrupt(cs, CPU_INTERRUPT_HARD);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (locked) {
|
|
||||||
qemu_mutex_unlock_iothread();
|
|
||||||
}
|
|
||||||
|
|
||||||
return old;
|
return old;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue