RISC-V: Change local interrupts from edge to level

This effectively changes riscv_cpu_update_mip
from edge to level. i.e. cpu_interrupt or
cpu_reset_interrupt are called regardless of
the current interrupt level.

Fixes WFI doesn't return when a IPI is issued:

- https://github.com/riscv/riscv-qemu/issues/132

To test:

1) Apply RISC-V Linux CPU hotplug patch:

- http://lists.infradead.org/pipermail/linux-riscv/2018-May/000603.html

2) Enable CONFIG_CPU_HOTPLUG in linux .config

3) Try to offline and online cpus:

echo 1 > /sys/devices/system/cpu/cpu2/online
echo 0 > /sys/devices/system/cpu/cpu2/online
echo 1 > /sys/devices/system/cpu/cpu2/online

Backports commit d26f5a423438e579d3ff0ca35e44edb966a36233 from qemu
This commit is contained in:
Michael Clark 2019-03-19 23:49:02 -04:00 committed by Lioncash
parent bd3e9ebaea
commit 8ffa68e757
No known key found for this signature in database
GPG key ID: 4E3C3CC1031BA9C7

View file

@ -95,9 +95,9 @@ uint32_t riscv_cpu_update_mip(RISCVCPU *cpu, uint32_t mask, uint32_t value)
cmp = atomic_cmpxchg(&env->mip, old, new); cmp = atomic_cmpxchg(&env->mip, old, new);
} while (old != cmp); } while (old != cmp);
if (new && !old) { if (new) {
cpu_interrupt(CPU(cpu), CPU_INTERRUPT_HARD); cpu_interrupt(CPU(cpu), CPU_INTERRUPT_HARD);
} else if (!new && old) { } else {
cpu_reset_interrupt(CPU(cpu), CPU_INTERRUPT_HARD); cpu_reset_interrupt(CPU(cpu), CPU_INTERRUPT_HARD);
} }