Skip to content

Commit 77c0fc4

Browse files
philmdrth7680
authored andcommitted
accel/tcg: Restrict TCGCPUOps::cpu_exec_interrupt() to sysemu
All targets call TCGCPUOps::cpu_exec_interrupt() from sysemu code. Move its declaration to restrict it to system emulation. Extend the code guarded. Restrict the static inlined need_replay_interrupt() method to avoid a "defined but not used" warning. Signed-off-by: Philippe Mathieu-Daudé <[email protected]> Reviewed-by: Richard Henderson <[email protected]> Message-Id: <[email protected]> Signed-off-by: Richard Henderson <[email protected]>
1 parent f364a7f commit 77c0fc4

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

accel/tcg/cpu-exec.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -685,6 +685,7 @@ static inline bool cpu_handle_exception(CPUState *cpu, int *ret)
685685
return false;
686686
}
687687

688+
#ifndef CONFIG_USER_ONLY
688689
/*
689690
* CPU_INTERRUPT_POLL is a virtual event which gets converted into a
690691
* "real" interrupt event later. It does not need to be recorded for
@@ -698,12 +699,11 @@ static inline bool need_replay_interrupt(int interrupt_request)
698699
return true;
699700
#endif
700701
}
702+
#endif /* !CONFIG_USER_ONLY */
701703

702704
static inline bool cpu_handle_interrupt(CPUState *cpu,
703705
TranslationBlock **last_tb)
704706
{
705-
CPUClass *cc = CPU_GET_CLASS(cpu);
706-
707707
/* Clear the interrupt flag now since we're processing
708708
* cpu->interrupt_request and cpu->exit_request.
709709
* Ensure zeroing happens before reading cpu->exit_request or
@@ -725,6 +725,7 @@ static inline bool cpu_handle_interrupt(CPUState *cpu,
725725
qemu_mutex_unlock_iothread();
726726
return true;
727727
}
728+
#if !defined(CONFIG_USER_ONLY)
728729
if (replay_mode == REPLAY_MODE_PLAY && !replay_has_interrupt()) {
729730
/* Do nothing */
730731
} else if (interrupt_request & CPU_INTERRUPT_HALT) {
@@ -753,12 +754,14 @@ static inline bool cpu_handle_interrupt(CPUState *cpu,
753754
qemu_mutex_unlock_iothread();
754755
return true;
755756
}
756-
#endif
757+
#endif /* !TARGET_I386 */
757758
/* The target hook has 3 exit conditions:
758759
False when the interrupt isn't processed,
759760
True when it is, and we should restart on a new TB,
760761
and via longjmp via cpu_loop_exit. */
761762
else {
763+
CPUClass *cc = CPU_GET_CLASS(cpu);
764+
762765
if (cc->tcg_ops->cpu_exec_interrupt &&
763766
cc->tcg_ops->cpu_exec_interrupt(cpu, interrupt_request)) {
764767
if (need_replay_interrupt(interrupt_request)) {
@@ -777,6 +780,7 @@ static inline bool cpu_handle_interrupt(CPUState *cpu,
777780
* reload the 'interrupt_request' value */
778781
interrupt_request = cpu->interrupt_request;
779782
}
783+
#endif /* !CONFIG_USER_ONLY */
780784
if (interrupt_request & CPU_INTERRUPT_EXITTB) {
781785
cpu->interrupt_request &= ~CPU_INTERRUPT_EXITTB;
782786
/* ensure that no TB jump will be modified as

include/hw/core/tcg-cpu-ops.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@ struct TCGCPUOps {
3535
void (*cpu_exec_enter)(CPUState *cpu);
3636
/** @cpu_exec_exit: Callback for cpu_exec cleanup */
3737
void (*cpu_exec_exit)(CPUState *cpu);
38-
/** @cpu_exec_interrupt: Callback for processing interrupts in cpu_exec */
39-
bool (*cpu_exec_interrupt)(CPUState *cpu, int interrupt_request);
4038
/**
4139
* @tlb_fill: Handle a softmmu tlb miss or user-only address fault
4240
*
@@ -68,6 +66,8 @@ struct TCGCPUOps {
6866
void (*do_interrupt)(CPUState *cpu);
6967
#endif /* !CONFIG_USER_ONLY || !TARGET_I386 */
7068
#ifdef CONFIG_SOFTMMU
69+
/** @cpu_exec_interrupt: Callback for processing interrupts in cpu_exec */
70+
bool (*cpu_exec_interrupt)(CPUState *cpu, int interrupt_request);
7171
/**
7272
* @do_transaction_failed: Callback for handling failed memory transactions
7373
* (ie bus faults or external aborts; not MMU faults)

0 commit comments

Comments
 (0)