[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC v3 22/56] cpu-exec: convert to cpu_halted
From: |
Emilio G. Cota |
Subject: |
[Qemu-devel] [RFC v3 22/56] cpu-exec: convert to cpu_halted |
Date: |
Thu, 18 Oct 2018 21:05:51 -0400 |
Cc: Peter Crosthwaite <address@hidden>
Cc: Richard Henderson <address@hidden>
Signed-off-by: Emilio G. Cota <address@hidden>
---
accel/tcg/cpu-exec.c | 24 ++++++++++++++++++++----
1 file changed, 20 insertions(+), 4 deletions(-)
diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c
index 870027d435..f37c9b1e94 100644
--- a/accel/tcg/cpu-exec.c
+++ b/accel/tcg/cpu-exec.c
@@ -422,14 +422,20 @@ static inline TranslationBlock *tb_find(CPUState *cpu,
return tb;
}
-static inline bool cpu_handle_halt(CPUState *cpu)
+static inline bool cpu_handle_halt_locked(CPUState *cpu)
{
- if (cpu->halted) {
+ g_assert(cpu_mutex_locked(cpu));
+
+ if (cpu_halted(cpu)) {
#if defined(TARGET_I386) && !defined(CONFIG_USER_ONLY)
if ((cpu->interrupt_request & CPU_INTERRUPT_POLL)
&& replay_interrupt()) {
X86CPU *x86_cpu = X86_CPU(cpu);
+
+ cpu_mutex_unlock(cpu);
qemu_mutex_lock_iothread();
+ cpu_mutex_lock(cpu);
+
apic_poll_irq(x86_cpu->apic_state);
cpu_reset_interrupt(cpu, CPU_INTERRUPT_POLL);
qemu_mutex_unlock_iothread();
@@ -439,12 +445,22 @@ static inline bool cpu_handle_halt(CPUState *cpu)
return true;
}
- cpu->halted = 0;
+ cpu_halted_set(cpu, 0);
}
return false;
}
+static inline bool cpu_handle_halt(CPUState *cpu)
+{
+ bool ret;
+
+ cpu_mutex_lock(cpu);
+ ret = cpu_handle_halt_locked(cpu);
+ cpu_mutex_unlock(cpu);
+ return ret;
+}
+
static inline void cpu_handle_debug_exception(CPUState *cpu)
{
CPUClass *cc = CPU_GET_CLASS(cpu);
@@ -543,7 +559,7 @@ static inline bool cpu_handle_interrupt(CPUState *cpu,
} else if (interrupt_request & CPU_INTERRUPT_HALT) {
replay_interrupt();
cpu->interrupt_request &= ~CPU_INTERRUPT_HALT;
- cpu->halted = 1;
+ cpu_halted_set(cpu, 1);
cpu->exception_index = EXCP_HLT;
qemu_mutex_unlock_iothread();
return true;
--
2.17.1
- Re: [Qemu-devel] [RFC v3 07/56] target/m68k: rename cpu_halted to cpu_halt, (continued)
[Qemu-devel] [RFC v3 20/56] gdbstub: convert to cpu_halted, Emilio G. Cota, 2018/10/18
[Qemu-devel] [RFC v3 23/56] cpu: define cpu_interrupt_request helpers, Emilio G. Cota, 2018/10/18
[Qemu-devel] [RFC v3 19/56] xtensa: convert to cpu_halted, Emilio G. Cota, 2018/10/18
[Qemu-devel] [RFC v3 26/56] i386: use cpu_reset_interrupt, Emilio G. Cota, 2018/10/18
[Qemu-devel] [RFC v3 22/56] cpu-exec: convert to cpu_halted,
Emilio G. Cota <=
[Qemu-devel] [RFC v3 15/56] mips: convert to cpu_halted, Emilio G. Cota, 2018/10/18
[Qemu-devel] [RFC v3 21/56] openrisc: convert to cpu_halted, Emilio G. Cota, 2018/10/18
[Qemu-devel] [RFC v3 14/56] m68k: convert to cpu_halted, Emilio G. Cota, 2018/10/18
[Qemu-devel] [RFC v3 25/56] exec: use cpu_reset_interrupt, Emilio G. Cota, 2018/10/18
[Qemu-devel] [RFC v3 18/56] sparc: convert to cpu_halted, Emilio G. Cota, 2018/10/18