Commit 8edac960a7deabd8c569fde189c2958e656d9115
1 parent
0bf46a40
qemu: introduce qemu_cpu_kick (Marcelo Tosatti)
To notify cpu of pending interrupt. Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@7243 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
3 changed files
with
25 additions
and
0 deletions
exec.c
@@ -1542,6 +1542,17 @@ void cpu_interrupt(CPUState *env, int mask) | @@ -1542,6 +1542,17 @@ void cpu_interrupt(CPUState *env, int mask) | ||
1542 | old_mask = env->interrupt_request; | 1542 | old_mask = env->interrupt_request; |
1543 | env->interrupt_request |= mask; | 1543 | env->interrupt_request |= mask; |
1544 | 1544 | ||
1545 | +#ifndef CONFIG_USER_ONLY | ||
1546 | + /* | ||
1547 | + * If called from iothread context, wake the target cpu in | ||
1548 | + * case its halted. | ||
1549 | + */ | ||
1550 | + if (!qemu_cpu_self(env)) { | ||
1551 | + qemu_cpu_kick(env); | ||
1552 | + return; | ||
1553 | + } | ||
1554 | +#endif | ||
1555 | + | ||
1545 | if (use_icount) { | 1556 | if (use_icount) { |
1546 | env->icount_decr.u16.high = 0xffff; | 1557 | env->icount_decr.u16.high = 0xffff; |
1547 | #ifndef CONFIG_USER_ONLY | 1558 | #ifndef CONFIG_USER_ONLY |
qemu-common.h
@@ -189,6 +189,10 @@ void qemu_service_io(void); | @@ -189,6 +189,10 @@ void qemu_service_io(void); | ||
189 | /* Force QEMU to process pending events */ | 189 | /* Force QEMU to process pending events */ |
190 | void qemu_notify_event(void); | 190 | void qemu_notify_event(void); |
191 | 191 | ||
192 | +/* Unblock cpu */ | ||
193 | +void qemu_cpu_kick(void *env); | ||
194 | +int qemu_cpu_self(void *env); | ||
195 | + | ||
192 | #ifdef CONFIG_USER_ONLY | 196 | #ifdef CONFIG_USER_ONLY |
193 | #define qemu_init_vcpu(env) do { } while (0) | 197 | #define qemu_init_vcpu(env) do { } while (0) |
194 | #else | 198 | #else |
vl.c
@@ -3740,6 +3740,16 @@ void qemu_init_vcpu(void *_env) | @@ -3740,6 +3740,16 @@ void qemu_init_vcpu(void *_env) | ||
3740 | return; | 3740 | return; |
3741 | } | 3741 | } |
3742 | 3742 | ||
3743 | +int qemu_cpu_self(void *env) | ||
3744 | +{ | ||
3745 | + return 1; | ||
3746 | +} | ||
3747 | + | ||
3748 | +void qemu_cpu_kick(void *env) | ||
3749 | +{ | ||
3750 | + return; | ||
3751 | +} | ||
3752 | + | ||
3743 | #ifdef _WIN32 | 3753 | #ifdef _WIN32 |
3744 | static void host_main_loop_wait(int *timeout) | 3754 | static void host_main_loop_wait(int *timeout) |
3745 | { | 3755 | { |