accel/tcg: Make halt-to-exec transition explicit and remove cpu_exec_halt
v3 cover accel/tcg: Make halt-to-exec transition explicit and remove cpu_exec_halt
Missing review: 4, 7, 9-12, 17
Since v2:
- Make all ARM halt_reason accesses atomic, including WFI/WFE helpers and halt-exit handling, and read event_register atomically.
- Keep the RISC-V changes focused on MIP: skip empty updates, add a shared accessor, and convert existing MIP reads to use it.
Since v1:
- Collected Richard R-b tags (sometimes commit description updated).
- Documented the BQL and synchronization requirements of has_work().
- Renamed the callbacks to poll_during_halt() and leaving_halt().
- Addressed Peter's comments by removing racy halt-work assertions, documenting the BQL contract, and explaining why x86 #DB delivery through do_interrupt_all() is safe without the BQL.
- Addressed Paolo's comments by making ARM PSCI state updates atomic, kicking remote vCPUs after power-state changes, and ensuring x86 APIC polling runs before cpu_has_work() with the BQL held only around APIC access.
- Sanitized s390_cpu_get_state() for atomic accesses without BQL.
This series was inspired by a previous thread on the list [*].
Refactor the CPU halt-to-execution transition logic in TCG as something more explicit and composable.
Core problem: TCGCPUOps::cpu_exec_halt callback mixed concerns, it checked for work, processed async events, and handled state transitions all in one place.
Solution: introduces two dedicated callbacks:
* poll_during_halt(): Process target-specific async events before checking for work. Called early in cpu_exec().
* leaving_halt(): Perform target-specific state updates when transitioning from halt to execution.
This separation allows the generic cpu_exec() code to orchestrate the flow cleanly (process events, check for work, transition state).
Only 2 targets need to be migrated (x86 and ARM) then we can remove the redundant cpu_exec_halt() hook.
The changes are expected to be purely refactoring with no functional impact.
Philippe Mathieu-Daudé (21):
system: Document has_work() synchronization requirements target/s390x: Use s390_cpu_get_state() consistently target/s390x: Make s390_cpu_set_state() return void target/s390x: Use S390CpuState for CPU state APIs target/s390x: Access S390CpuState atomically target/arm: Un-inline arm_set_cpu_power_state() target/arm: Kick vCPU after updating PSCI power state target/arm: Access PSCI state atomically
target/arm: Access halt state atomically
target/riscv: Skip empty MIP updates
target/riscv: Add riscv_cpu_get_mip()
target/riscv: Access MIP atomically
accel/tcg: Refactor poll-while-halted flow in cpu_exec() accel/tcg: Introduce poll_during_halt() and leaving_halt() target/arm: Split leaving-halt handling from arm_cpu_exec_halt() target/arm: Convert cpu_exec_halt() to leaving_halt() target/i386: Use an acquire load for interrupt_request target/i386: Split APIC polling from x86_cpu_exec_halt() target/i386: Split leaving-halt handling from x86_cpu_exec_halt() target/i386: Use generic halt transition handlers accel/tcg: Remove the redundant cpu_exec_halt() hook
include/accel/tcg/cpu-ops.h | 36 ++++++++++++++++------------- include/hw/core/sysemu-cpu-ops.h | 6 +++-- target/arm/internals.h | 11 +-------- target/i386/tcg/helper-tcg.h | 3 ++- target/loongarch/internals.h | 1 - target/riscv/cpu.h | 1 + target/riscv/internals.h | 5 ---- target/s390x/cpu.h | 9 ++++---- target/s390x/kvm/kvm_s390x.h | 2 +- target/s390x/s390x-internal.h | 1 - accel/tcg/cpu-exec.c | 20 ++++++++++------ hw/intc/riscv_aclint.c | 2 +- hw/intc/s390_flic.c | 7 ++++-- target/alpha/cpu.c | 1 - target/arm/arm-powerctl.c | 13 +++++++++++ target/arm/cpu.c | 31 +++++++++++-------------- target/arm/tcg/cpu-v7m.c | 1 - target/arm/tcg/op_helper.c | 8 +++---- target/avr/cpu.c | 1 - target/hexagon/cpu.c | 1 - target/hppa/cpu.c | 1 - target/i386/cpu.c | 5 +++- target/i386/tcg/system/seg_helper.c | 17 +++++++++----- target/i386/tcg/tcg-cpu.c | 3 ++- target/loongarch/cpu.c | 2 +- target/loongarch/tcg/tcg_cpu.c | 1 - target/m68k/cpu.c | 1 - target/microblaze/cpu.c | 1 - target/mips/cpu.c | 1 - target/or1k/cpu.c | 1 - target/ppc/cpu_init.c | 1 - target/riscv/cpu.c | 5 ++-- target/riscv/tcg/cpu_helper.c | 20 ++++++++++++---- target/riscv/tcg/csr.c | 6 +++-- target/riscv/tcg/tcg-cpu.c | 1 - target/rx/cpu.c | 1 - target/s390x/cpu-system.c | 26 ++++++++++++--------- target/s390x/cpu.c | 3 +-- target/s390x/kvm/kvm.c | 4 ++-- target/s390x/kvm/stubs.c | 2 +- target/s390x/machine.c | 2 +- target/s390x/sigp.c | 9 ++++++-- target/sh4/cpu.c | 1 - target/sparc/cpu.c | 1 - target/tricore/cpu.c | 1 - target/xtensa/cpu.c | 1 - 46 files changed, 150 insertions(+), 127 deletions(-)
Signature · 1 line
2.53.0
PATCH v3 1/21 system: Document has_work() synchronization requirements
Document that has_work() may be called with or without the BQL.
Require implementations to remain idempotent and avoid consuming work, and to synchronize state shared with other threads without acquiring the BQL unconditionally.
--- include/hw/core/sysemu-cpu-ops.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
include/hw/core/sysemu-cpu-ops.h +4 -2
@@ -19,8 +19,10 @@ typedef struct SysemuCPUOps {/** * @has_work: Callback for checking if there is work to do. * -* This function should be idempotent (i.e. not change state) as -* it will likely be queried multiple times before a CPU resumes. +* This callback may be called with or without the BQL. It must be +* idempotent, must not consume work, and must not assume that the BQL +* is held or acquire it unconditionally. State shared with other +* threads must use appropriate synchronization. */ bool (*has_work)(CPUState *cpu);/* MANDATORY NON-NULL */ /**
Signature · 1 line
2.53.0
PATCH v3 2/21 target/s390x: Use s390_cpu_get_state() consistently
In reply to Philippe Mathieu-DaudéReplace direct reads of env::cpu_state with s390_cpu_get_state(). This keeps CPU state reads consistent across CPU transitions.
--- target/s390x/cpu-system.c | 2 +- target/s390x/cpu.c | 2 +- target/s390x/kvm/kvm.c | 2 +- target/s390x/machine.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-)
target/s390x/cpu-system.c +1 -1
@@ -263,7 +263,7 @@ unsigned int s390_cpu_set_state(uint8_t cpu_state, S390CPU *cpu) cpu_state);exit (1 ); } -if (kvm_enabled () && cpu->env.cpu_state != cpu_state) { +if (kvm_enabled () &&s390_cpu_get_state (cpu) != cpu_state) {kvm_s390_set_cpu_state (cpu, cpu_state); } cpu->env.cpu_state = cpu_state;
target/s390x/cpu.c +1 -1
@@ -130,7 +130,7 @@ static void s390_query_cpu_fast(CPUState *cpu, CpuInfoFast *value) {S390CPU *s390_cpu =S390_CPU (cpu); - value->u.s390x.cpu_state = s390_cpu->env.cpu_state; + value->u.s390x.cpu_state =s390_cpu_get_state (s390_cpu);#if !defined(CONFIG_USER_ONLY )if (s390_has_topology ()) { value->u.s390x.has_dedicated = true;
target/s390x/kvm/kvm.c +1 -1
@@ -407,7 +407,7 @@ int kvm_arch_init_vcpu(CPUState *cs) {unsigned int max_cpus =MACHINE (qdev_get_machine ())->smp.max_cpus;S390CPU *cpu =S390_CPU (cs); -kvm_s390_set_cpu_state (cpu, cpu->env.cpu_state); +kvm_s390_set_cpu_state (cpu,s390_cpu_get_state (cpu)); cpu->irqstate =g_malloc0 (VCPU_IRQ_BUF_SIZE (max_cpus));return 0 ; }
target/s390x/machine.c +1 -1
@@ -32,7 +32,7 @@ static int cpu_post_load(void *opaque, int version_id)* than via cpu_synchronize_state, we need update kvm here. */ if (kvm_enabled ()) { -kvm_s390_set_cpu_state (cpu, cpu->env.cpu_state); +kvm_s390_set_cpu_state (cpu,s390_cpu_get_state (cpu));return kvm_s390_vcpu_interrupt_post_load (cpu); }
Signature · 1 line
2.53.0
PATCH v3 3/21 target/s390x: Make s390_cpu_set_state() return void
In reply to Philippe Mathieu-DaudéFrom: Philippe Mathieu-Daudé <[email protected]>
The return value of s390_cpu_set_state() is only used by the STOP interrupt handler. Make the setter return void and count running CPUs directly at that call site.
--- target/s390x/cpu.h | 5 ++--- target/s390x/cpu-system.c | 4 +--- target/s390x/sigp.c | 3 ++- 3 files changed, 5 insertions(+), 7 deletions(-)
target/s390x/cpu.h +2 -3
@@ -847,11 +847,10 @@ void s390_do_cpu_set_diag318(CPUState *cs, run_on_cpu_data arg);int s390_assign_subch_ioeventfd (EventNotifier *notifier,uint32_t sch_id,int vq,bool assign);#ifndef CONFIG_USER_ONLY -unsigned int s390_cpu_set_state (uint8_t cpu_state,S390CPU *cpu); +void s390_cpu_set_state (uint8_t cpu_state,S390CPU *cpu);#else -static inline unsigned int s390_cpu_set_state (uint8_t cpu_state,S390CPU *cpu) +static inline void s390_cpu_set_state (uint8_t cpu_state,S390CPU *cpu) { -return 0 ; }#endif /* CONFIG_USER_ONLY */ static inline uint8_t s390_cpu_get_state (const S390CPU *cpu)
target/s390x/cpu-system.c +1 -3
@@ -236,7 +236,7 @@ void s390_cpu_unhalt(S390CPU *cpu) } } -unsigned int s390_cpu_set_state (uint8_t cpu_state,S390CPU *cpu) +void s390_cpu_set_state (uint8_t cpu_state,S390CPU *cpu) {trace_cpu_set_state (CPU (cpu)->cpu_index, cpu_state);
@@ -267,8 +267,6 @@ unsigned int s390_cpu_set_state(uint8_t cpu_state, S390CPU *cpu)kvm_s390_set_cpu_state (cpu, cpu_state); } cpu->env.cpu_state = cpu_state; - -return s390_count_running_cpus (); }void s390_cmma_reset (void )
target/s390x/sigp.c +2 -1
@@ -617,7 +617,8 @@ void do_stop_interrupt(CPUS390XState *env)s390_store_status (cpu,S390_STORE_STATUS_DEF_ADDR , true); } env->sigp_order =0 ; -if (s390_cpu_set_state (S390_CPU_STATE_STOPPED , cpu) ==0 ) { +s390_cpu_set_state (S390_CPU_STATE_STOPPED , cpu); +if (s390_count_running_cpus () ==0 ) {qemu_system_shutdown_request (SHUTDOWN_CAUSE_GUEST_SHUTDOWN ); } env->pending_int &= ~INTERRUPT_STOP ;
Signature · 1 line
2.53.0
PATCH v3 4/21 target/s390x: Use S390CpuState for CPU state APIs
In reply to Philippe Mathieu-DaudéUse the QAPI S390CpuState enum for CPU state accessors instead of uint8_t. Handle state checks with switch statements.
--- target/s390x/cpu.h | 6 +++--- target/s390x/kvm/kvm_s390x.h | 2 +- hw/intc/s390_flic.c | 7 +++++-- target/s390x/cpu-system.c | 18 ++++++++++++------ target/s390x/kvm/kvm.c | 2 +- target/s390x/kvm/stubs.c | 2 +- target/s390x/sigp.c | 6 +++++- 7 files changed, 28 insertions(+), 15 deletions(-)
target/s390x/cpu.h +3 -3
@@ -847,13 +847,13 @@ void s390_do_cpu_set_diag318(CPUState *cs, run_on_cpu_data arg);int s390_assign_subch_ioeventfd (EventNotifier *notifier,uint32_t sch_id,int vq,bool assign);#ifndef CONFIG_USER_ONLY -void s390_cpu_set_state (uint8_t cpu_state,S390CPU *cpu); +void s390_cpu_set_state (S390CpuState cpu_state,S390CPU *cpu);#else -static inline void s390_cpu_set_state (uint8_t cpu_state,S390CPU *cpu) +static inline void s390_cpu_set_state (S390CpuState cpu_state,S390CPU *cpu) { }#endif /* CONFIG_USER_ONLY */ -static inline uint8_t s390_cpu_get_state (const S390CPU *cpu) +static inline S390CpuState s390_cpu_get_state (const S390CPU *cpu) {return cpu->env.cpu_state; }
target/s390x/kvm/kvm_s390x.h +1 -1
@@ -22,7 +22,7 @@ int kvm_s390_mem_op(S390CPU *cpu, vaddr addr, uint8_t ar, void *hostbuf,int kvm_s390_mem_op_pv (S390CPU *cpu,vaddr addr,void *hostbuf,int len,bool is_write);void kvm_s390_program_interrupt (S390CPU *cpu,uint16_t code); -int kvm_s390_set_cpu_state (S390CPU *cpu,uint8_t cpu_state); +int kvm_s390_set_cpu_state (S390CPU *cpu,S390CpuState cpu_state);void kvm_s390_vcpu_interrupt_pre_save (S390CPU *cpu);int kvm_s390_vcpu_interrupt_post_load (S390CPU *cpu);int kvm_s390_get_hpage (void );
hw/intc/s390_flic.c +5 -2
@@ -193,8 +193,11 @@ static void qemu_s390_flic_notify(uint32_t type)cpu_set_interrupt (cs,CPU_INTERRUPT_HARD );/* ignore CPUs that are not sleeping */ -if (s390_cpu_get_state (cpu) !=S390_CPU_STATE_OPERATING && -s390_cpu_get_state (cpu) !=S390_CPU_STATE_LOAD ) { +switch (s390_cpu_get_state (cpu)) { +case S390_CPU_STATE_LOAD : +case S390_CPU_STATE_OPERATING : +break ; +default :continue ; }
target/s390x/cpu-system.c +12 -6
@@ -44,8 +44,11 @@ bool s390_cpu_has_work(CPUState *cs)S390CPU *cpu =S390_CPU (cs);/* STOPPED cpus can never wake up */ -if (s390_cpu_get_state (cpu) !=S390_CPU_STATE_LOAD && -s390_cpu_get_state (cpu) !=S390_CPU_STATE_OPERATING ) { +switch (s390_cpu_get_state (cpu)) { +case S390_CPU_STATE_LOAD : +case S390_CPU_STATE_OPERATING : +break ; +default :return false; }
@@ -202,12 +205,15 @@ unsigned s390_count_running_cpus(void)int nr_running =0 ;CPU_FOREACH (cpu) { -uint8_t state =S390_CPU (cpu)->env.cpu_state; -if (state ==S390_CPU_STATE_OPERATING || - state ==S390_CPU_STATE_LOAD ) { +switch (s390_cpu_get_state (S390_CPU (cpu))) { +case S390_CPU_STATE_LOAD : +case S390_CPU_STATE_OPERATING :if (!disabled_wait (cpu)) { nr_running++; } +break ; +default : +break ; } }
@@ -236,7 +242,7 @@ void s390_cpu_unhalt(S390CPU *cpu) } } -void s390_cpu_set_state (uint8_t cpu_state,S390CPU *cpu) +void s390_cpu_set_state (S390CpuState cpu_state,S390CPU *cpu) {trace_cpu_set_state (CPU (cpu)->cpu_index, cpu_state);
target/s390x/kvm/kvm.c +1 -1
@@ -2007,7 +2007,7 @@ int kvm_s390_get_ri(void)return cap_ri; } -int kvm_s390_set_cpu_state (S390CPU *cpu,uint8_t cpu_state) +int kvm_s390_set_cpu_state (S390CPU *cpu,S390CpuState cpu_state) {struct kvm_mp_state mp_state = {};int ret;
target/s390x/kvm/stubs.c +1 -1
@@ -128,7 +128,7 @@ int kvm_s390_mem_op_pv(S390CPU *cpu, vaddr addr, void *hostbuf, int len,g_assert_not_reached (); } -int kvm_s390_set_cpu_state (S390CPU *cpu,uint8_t cpu_state) +int kvm_s390_set_cpu_state (S390CPU *cpu,S390CpuState cpu_state) {g_assert_not_reached (); }
target/s390x/sigp.c +5 -1
@@ -39,7 +39,7 @@ static void set_sigp_status(SigpInfo *si, uint64_t status)static void sigp_sense (S390CPU *dst_cpu,SigpInfo *si) { -uint8_t state =s390_cpu_get_state (dst_cpu); +S390CpuState state =s390_cpu_get_state (dst_cpu);bool ext_call = dst_cpu->env.pending_int &INTERRUPT_EXTERNAL_CALL ;uint64_t status =0 ;
@@ -221,6 +221,8 @@ static void sigp_stop_and_store_status(CPUState *cs, run_on_cpu_data arg)cpu_synchronize_state (cs);s390_store_status (cpu,S390_STORE_STATUS_DEF_ADDR , true);break ; +default : +break ; } si->cc =SIGP_CC_ORDER_CODE_ACCEPTED ; }
@@ -362,6 +364,8 @@ static void sigp_restart(CPUState *cs, run_on_cpu_data arg)case S390_CPU_STATE_OPERATING :cpu_inject_restart (cpu);break ; +default : +break ; } si->cc =SIGP_CC_ORDER_CODE_ACCEPTED ; }
Signature · 1 line
2.53.0
Re: [PATCH v3 04/21] target/s390x: Use S390CpuState for CPU state APIs
Quoted 4 lines · Philippe Mathieu-Daudé
Use the QAPI S390CpuState enum for CPU state accessors instead of
uint8_t. Handle state checks with switch statements.Signed-off-by Philippe Mathieu-Daudé <[email protected]>
Quoted 9 lines
--- target/s390x/cpu.h | 6 +++--- target/s390x/kvm/kvm_s390x.h | 2 +- hw/intc/s390_flic.c | 7 +++++-- target/s390x/cpu-system.c | 18 ++++++++++++------ target/s390x/kvm/kvm.c | 2 +- target/s390x/kvm/stubs.c | 2 +- target/s390x/sigp.c | 6 +++++- 7 files changed, 28 insertions(+), 15 deletions(-)
PATCH v3 5/21 target/s390x: Access S390CpuState atomically
In reply to Philippe Mathieu-DaudéUse qatomic_read/set() in the S390 CPU state accessors. This avoids non-atomic reads in s390_cpu_has_work().
--- target/s390x/cpu.h | 2 +- target/s390x/cpu-system.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
target/s390x/cpu.h +1 -1
@@ -855,7 +855,7 @@ static inline void s390_cpu_set_state(S390CpuState cpu_state, S390CPU *cpu)#endif /* CONFIG_USER_ONLY */ static inline S390CpuState s390_cpu_get_state (const S390CPU *cpu) { -return cpu->env.cpu_state; +return qatomic_read (&cpu->env.cpu_state); }
target/s390x/cpu-system.c +1 -1
@@ -272,7 +272,7 @@ void s390_cpu_set_state(S390CpuState cpu_state, S390CPU *cpu)if (kvm_enabled () &&s390_cpu_get_state (cpu) != cpu_state) {kvm_s390_set_cpu_state (cpu, cpu_state); } - cpu->env.cpu_state = cpu_state; +qatomic_set (&cpu->env.cpu_state, cpu_state); }void s390_cmma_reset (void )
Signature · 1 line
2.53.0
PATCH v3 6/21 target/arm: Un-inline arm_set_cpu_power_state()
In reply to Philippe Mathieu-DaudéMove arm_set_cpu_power_state() from the header to arm-powerctl.c, keeping the power-state helper with the other power-control code. Restrict the call in arm_cpu_reset_hold() to system emulation.
--- target/arm/internals.h | 8 +------- target/arm/arm-powerctl.c | 7 +++++++ target/arm/cpu.c | 4 ++-- 3 files changed, 10 insertions(+), 9 deletions(-)
target/arm/internals.h +1 -7
@@ -2082,12 +2082,6 @@ bool arm_cpu_match_cpreg_mig_tolerance(ARMCPU *cpu, uint64_t kvmidx,/** * arm_set_cpu_power_state() - set power state synced with halt_reason */ -static inline void arm_set_cpu_power_state (ARMCPU *cpu,ARMPSCIState state) -{ -CPUARMState *env = &cpu->env; - - cpu->power_state = state; - env->halt_reason = state ==PSCI_OFF ?HALT_PSCI :NOT_HALTED ; -} +void arm_set_cpu_power_state (ARMCPU *cpu,ARMPSCIState state);#endif
target/arm/arm-powerctl.c +7 -0
@@ -45,6 +45,13 @@ struct CpuOnInfo {bool target_aa64; }; +void arm_set_cpu_power_state (ARMCPU *cpu,ARMPSCIState state) +{ +CPUARMState *env = &cpu->env; + + cpu->power_state = state; + env->halt_reason = state ==PSCI_OFF ?HALT_PSCI :NOT_HALTED ; +}static void arm_set_cpu_on_async_work (CPUState *target_cpu_state,run_on_cpu_data data)
target/arm/cpu.c +2 -2
@@ -351,8 +351,6 @@ static void arm_cpu_reset_hold(Object *obj, ResetType type) env->vfp.xregs[ARM_VFP_MVFR1 ] = cpu->isar.mvfr1; env->vfp.xregs[ARM_VFP_MVFR2 ] = cpu->isar.mvfr2; -arm_set_cpu_power_state (cpu, cs->start_powered_off ?PSCI_OFF :PSCI_ON ); -if (arm_feature (env,ARM_FEATURE_AARCH64 )) {/* 64 bit CPUs always start in 64 bit mode */ env->aarch64 = true;
@@ -671,6 +669,8 @@ static void arm_cpu_reset_hold(Object *obj, ResetType type)arm_set_ah_fp_behaviours (&env->vfp.fp_status[FPST_AH_F16 ]);#ifndef CONFIG_USER_ONLY +arm_set_cpu_power_state (cpu, cs->start_powered_off ?PSCI_OFF :PSCI_ON ); +if (kvm_enabled ()) {kvm_arm_reset_vcpu (cpu); }
Signature · 1 line
2.53.0
PATCH v3 7/21 target/arm: Kick vCPU after updating PSCI power state
In reply to Philippe Mathieu-DaudéPSCI can update the power state of a vCPU other than the caller. Kick that vCPU after changing its state so it observes the update promptly.
--- target/arm/arm-powerctl.c | 5 +++++ 1 file changed, 5 insertions(+)
target/arm/arm-powerctl.c +5 -0
@@ -48,9 +48,14 @@ struct CpuOnInfo {void arm_set_cpu_power_state (ARMCPU *cpu,ARMPSCIState state) {CPUARMState *env = &cpu->env; +CPUState *cs =CPU (cpu); cpu->power_state = state; env->halt_reason = state ==PSCI_OFF ?HALT_PSCI :NOT_HALTED ; + +if (!qemu_cpu_is_self (cs)) { +qemu_cpu_kick (cs); + } } static void arm_set_cpu_on_async_work(CPUState *target_cpu_state,
Signature · 1 line
2.53.0
PATCH v3 8/21 target/arm: Access PSCI state atomically
In reply to Philippe Mathieu-DaudéUse qatomic_set() when updating ARMCPU::power_state and CPUARMState::halt_reason. Read ARMCPU::power_state atomically in arm_cpu_has_work(), which can run without the BQL held.
--- target/arm/arm-powerctl.c | 5 +++-- target/arm/cpu.c | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-)
target/arm/arm-powerctl.c +3 -2
@@ -50,8 +50,9 @@ void arm_set_cpu_power_state(ARMCPU *cpu, ARMPSCIState state)CPUARMState *env = &cpu->env;CPUState *cs =CPU (cpu); - cpu->power_state = state; - env->halt_reason = state ==PSCI_OFF ?HALT_PSCI :NOT_HALTED ; +qatomic_set (&cpu->power_state, state); +qatomic_set (&env->halt_reason, state ==PSCI_OFF ?HALT_PSCI + :NOT_HALTED );if (!qemu_cpu_is_self (cs)) {qemu_cpu_kick (cs);
target/arm/cpu.c +1 -1
@@ -149,7 +149,7 @@ static bool arm_cpu_has_work(CPUState *cs)* Only another PSCI call can wake the CPU up in which case the * power_state would be set by arm_set_cpu_on_and_reset_async_work() */ -if (cpu->power_state ==PSCI_OFF ) { +if (qatomic_read (&cpu->power_state) ==PSCI_OFF ) {g_assert (cpu->env.halt_reason ==HALT_PSCI );return false; }
Signature · 1 line
2.53.0
PATCH v3 9/21 target/arm: Access halt state atomically
In reply to Philippe Mathieu-Daudéarm_cpu_has_work() runs without the BQL held and can inspect halt_reason and event_register while other CPU contexts update them. The WFxT timer may also consume HALT_WFE asynchronously.
Use atomic accesses for the halt state, including the WFI/WFE and halt-exit stores. This keeps the halt/wakeup protocol race-free and matches the atomic state transitions used by the asynchronous wake-up paths.
---
v3: Dropped rth's R-b because of HELPER()s call also updated
--- target/arm/cpu.c | 7 ++++--- target/arm/tcg/op_helper.c | 8 ++++---- 2 files changed, 8 insertions(+), 7 deletions(-)
target/arm/cpu.c +4 -3
@@ -144,20 +144,21 @@ int arm_cpu_mmu_index(CPUState *cs, bool ifetch)static bool arm_cpu_has_work (CPUState *cs) {ARMCPU *cpu =ARM_CPU (cs); +ARMHaltReason halt_reason =qatomic_read (&cpu->env.halt_reason);/* * Only another PSCI call can wake the CPU up in which case the * power_state would be set by arm_set_cpu_on_and_reset_async_work() */ if (qatomic_read (&cpu->power_state) ==PSCI_OFF ) { -g_assert (cpu->env.halt_reason ==HALT_PSCI ); +g_assert (halt_reason ==HALT_PSCI );return false; }/* * A wake-up event should only wake us if we are halted on a WFE */ -if (cpu->env.halt_reason ==HALT_WFE && cpu->env.event_register) { +if (halt_reason ==HALT_WFE &&qatomic_read (&cpu->env.event_register)) {return true; }
@@ -882,7 +883,7 @@ bool arm_cpu_exec_halt(CPUState *cs)timer_del (cpu->wfxt_timer); }/* clear the halt reason */ - cpu->env.halt_reason =NOT_HALTED ; +qatomic_set (&cpu->env.halt_reason,NOT_HALTED ); }return leave_halt; }
target/arm/tcg/op_helper.c +4 -4
@@ -398,7 +398,7 @@ void HELPER(wfi)(CPUARMState *env, uint32_t insn_len) target_el); } - env->halt_reason =HALT_WFI ; +qatomic_set (&env->halt_reason,HALT_WFI ); cs->exception_index =EXCP_HLT ; cs->halted =1 ;cpu_loop_exit (cs);
@@ -460,7 +460,7 @@ void HELPER(wfit)(CPUARMState *env, uint32_t rd) }else {timer_mod (cpu->wfxt_timer, nexttick); } - env->halt_reason =HALT_WFI ; +qatomic_set (&env->halt_reason,HALT_WFI ); cs->exception_index =EXCP_HLT ; cs->halted =1 ;cpu_loop_exit (cs);
@@ -629,7 +629,7 @@ void HELPER(wfe)(CPUARMState *env, uint32_t insn_len) } } - env->halt_reason =HALT_WFE ; +qatomic_set (&env->halt_reason,HALT_WFE ); cs->exception_index =EXCP_HLT ; cs->halted =1 ;cpu_loop_exit (cs);
@@ -723,7 +723,7 @@ void HELPER(wfet)(CPUARMState *env, uint32_t rd) } } - env->halt_reason =HALT_WFE ; +qatomic_set (&env->halt_reason,HALT_WFE ); cs->exception_index =EXCP_HLT ; cs->halted =1 ;cpu_loop_exit (cs);
Signature · 1 line
2.53.0
Re: [PATCH v3 09/21] target/arm: Access halt state atomically
Quoted 9 lines · Philippe Mathieu-Daudé
arm_cpu_has_work()runs without the BQL held and can inspecthalt_reasonandevent_registerwhile other CPU contexts update them. The WFxT timer may also consumeHALT_WFEasynchronously.Use atomic accesses for the halt state, including the WFI/WFE and halt-exit stores. This keeps the halt/wakeup protocol race-free and matches the atomic state transitions used by the asynchronous wake-up paths.
Quoted 7 lines
Signed-off-by Philippe Mathieu-Daudé<[email protected]>---
v3: Dropped rth's R-b because of HELPER()s call also updated--- target/arm/cpu.c | 7 ++++--- target/arm/tcg/op_helper.c | 8 ++++---- 2 files changed, 8 insertions(+), 7 deletions(-)
r~
PATCH v3 10/21 target/riscv: Skip empty MIP updates
In reply to Philippe Mathieu-DaudéReturn early when the effective mask is zero. This avoids taking the BQL and processing interrupts when riscv_cpu_update_mip() cannot change env->mip.
--- target/riscv/tcg/cpu_helper.c | 3 +++ 1 file changed, 3 insertions(+)
target/riscv/tcg/cpu_helper.c +3 -0
@@ -580,6 +580,9 @@ uint64_t riscv_cpu_update_mip(CPURISCVState *env, uint64_t mask, uint64_t value)/* No need to update mip for VSTIP */ mask = ((mask ==MIP_VSTIP ) && env->vstime_irq) ?0 : mask; +if (!mask) { +return old; + }BQL_LOCK_GUARD ();
Signature · 1 line
2.53.0
Re: [PATCH v3 10/21] target/riscv: Skip empty MIP updates
Quoted 5 lines · Philippe Mathieu-Daudé
Return early when the effective mask is zero. This avoids taking the BQL and processing interrupts when
riscv_cpu_update_mip()cannot changeenv->mip.Signed-off-by Philippe Mathieu-Daudé <[email protected]>
This breaks the usage in riscv_cpu_set_mode. One could argue that should be calling riscv_cpu_interrupt directly, but you'd want to examine locking as well.
target/riscv/tcg/cpu_helper.c uint64_t riscv_cpu_update_mip(CPURISCVState *env, uint64_t mask, uint64_t value) · line 585
Quoted 5 lines
/* No need to update mip for VSTIP */ mask = ((mask == MIP_VSTIP) && env->vstime_irq) ? 0 : mask;target/riscv/tcg/cpu_helper.c +3
-0+if (!mask) { +return old; + }
If this is kept in some way, this should be written as
if (!mask || (mask == MIP_VSTIP && env->vstime_irq)) {
return env->mip;
}Note that there is an existing bug in which the returned 'old' is fetched before the bql lock is taken. Note as well that the existing mip update statement doesn't use 'old', but could if it were fetched at the right time.
r~
PATCH v3 11/21 target/riscv: Add riscv_cpu_get_mip()
In reply to Philippe Mathieu-DaudéIntroduce riscv_cpu_get_mip() and use it for MIP reads in interrupt, CSR, and ACLINT code. Centralize reads of env->mip before changing the accessor implementation.
--- target/riscv/cpu.h | 1 + hw/intc/riscv_aclint.c | 2 +- target/riscv/cpu.c | 3 ++- target/riscv/tcg/cpu_helper.c | 17 ++++++++++++----- target/riscv/tcg/csr.c | 6 ++++-- 5 files changed, 20 insertions(+), 9 deletions(-)
target/riscv/cpu.h +1 -0
@@ -684,6 +684,7 @@ bool riscv_cpu_translate_for_debug(CPUState *cs, vaddr addr,bool riscv_cpu_exec_interrupt (CPUState *cs,int interrupt_request);void riscv_cpu_swap_hypervisor_regs (CPURISCVState *env);int riscv_cpu_claim_interrupts (RISCVCPU *cpu,uint64_t interrupts); +uint64_t riscv_cpu_get_mip (const CPURISCVState *env);uint64_t riscv_cpu_update_mip (CPURISCVState *env,uint64_t mask,uint64_t value);void riscv_cpu_set_rnmi (RISCVCPU *cpu,uint32_t irq,bool level);
hw/intc/riscv_aclint.c +1 -1
@@ -438,7 +438,7 @@ static uint64_t riscv_aclint_swi_read(void *opaque, hwaddr addr,qemu_log_mask (LOG_GUEST_ERROR ,"aclint-swi: invalid hartid: %zu" , hartid); }else if ((addr &0x3 ) ==0 ) { -return (swi->sswi) ?0 : ((env->mip &MIP_MSIP ) >0 ); +return (swi->sswi) ?0 : ((riscv_cpu_get_mip (env) &MIP_MSIP ) >0 ); } }
target/riscv/cpu.c +2 -1
@@ -916,8 +916,9 @@ uint64_t riscv_cpu_all_pending(CPURISCVState *env)uint32_t gein =get_field (env->hstatus,HSTATUS_VGEIN );uint64_t vsgein = (env->hgeip & (1ULL << gein)) ?MIP_VSEIP :0 ;uint64_t vstip = (env->vstime_irq) ?MIP_VSTIP :0 ; +uint64_t mip =riscv_cpu_get_mip (env); -return (env->mip | vsgein | vstip) & env->mie; +return (mip | vsgein | vstip) & env->mie; }int riscv_cpu_mirq_pending (CPURISCVState *env)
target/riscv/tcg/cpu_helper.c +12 -5
@@ -526,6 +526,11 @@ void riscv_cpu_swap_hypervisor_regs(CPURISCVState *env) } } +uint64_t riscv_cpu_get_mip (const CPURISCVState *env) +{ +return env->mip; +} +void riscv_cpu_set_rnmi (RISCVCPU *cpu,uint32_t irq,bool level) {CPURISCVState *env = &cpu->env;
@@ -554,6 +559,7 @@ void riscv_cpu_interrupt(CPURISCVState *env) {uint64_t gein, vsgein =0 , vstip =0 , irqf =0 ;CPUState *cs =env_cpu (env); +uint64_t mip =riscv_cpu_get_mip (env);BQL_LOCK_GUARD ();
@@ -567,7 +573,7 @@ void riscv_cpu_interrupt(CPURISCVState *env) vstip = env->vstime_irq ?MIP_VSTIP :0 ; -if (env->mip | vsgein | vstip | irqf) { +if (mip | vsgein | vstip | irqf) {cpu_interrupt (cs,CPU_INTERRUPT_HARD ); }else {cpu_reset_interrupt (cs,CPU_INTERRUPT_HARD );
@@ -576,7 +582,7 @@ void riscv_cpu_interrupt(CPURISCVState *env)uint64_t riscv_cpu_update_mip (CPURISCVState *env,uint64_t mask,uint64_t value) { -uint64_t old = env->mip; +uint64_t old =riscv_cpu_get_mip (env);/* No need to update mip for VSTIP */ mask = ((mask ==MIP_VSTIP ) && env->vstime_irq) ?0 : mask;
@@ -586,7 +592,7 @@ uint64_t riscv_cpu_update_mip(CPURISCVState *env, uint64_t mask, uint64_t value)BQL_LOCK_GUARD (); - env->mip = (env->mip & ~mask) | (value & mask); + env->mip = (old & ~mask) | (value & mask);riscv_cpu_interrupt (env);
@@ -2064,10 +2070,11 @@ void riscv_cpu_do_interrupt(CPUState *cs)bool async = !!(cs->exception_index &RISCV_EXCP_INT_FLAG );target_ulong cause = cs->exception_index &RISCV_EXCP_INT_MASK ;uint64_t deleg = async ? env->mideleg : env->medeleg; +uint64_t mip =riscv_cpu_get_mip (env);bool s_injected = env->mvip & (1ULL << cause) & env->mvien && - !(env->mip & (1ULL << cause)); + !(mip & (1ULL << cause));bool vs_injected = env->hvip & (1ULL << cause) & env->hvien && - !(env->mip & (1ULL << cause)); + !(mip & (1ULL << cause));bool smode_double_trap = false;uint64_t hdeleg = async ? env->hideleg : env->hedeleg;const bool prev_virt = env->virt_enabled;
target/riscv/tcg/csr.c +4 -2
@@ -3816,7 +3816,7 @@ static RISCVException rmw_mip64(CPURISCVState *env, int csrno,if (mask) { old_mip =riscv_cpu_update_mip (env, mask, (new_val & mask)); }else { - old_mip = env->mip; + old_mip =riscv_cpu_get_mip (env); }if (csrno !=CSR_HVIP ) {
@@ -4549,8 +4549,10 @@ static RISCVException read_vstopi(CPURISCVState *env, int csrno, hviprio =get_field (env->hvictl,HVICTL_IPRIO );if (gein) { +uint64_t mip =riscv_cpu_get_mip (env); + vsgein = (env->hgeip & (1ULL << gein)) ?MIP_VSEIP :0 ; - vseip = env->mie & (env->mip | vsgein) &MIP_VSEIP ; + vseip = env->mie & (mip | vsgein) &MIP_VSEIP ;if (gein <= env->geilen && vseip) { siid[scount] =IRQ_S_EXT ; siprio[scount] =IPRIO_MMAXIPRIO +1 ;
Signature · 1 line
2.53.0
Re: [PATCH v3 11/21] target/riscv: Add riscv_cpu_get_mip()
target/riscv/tcg/cpu_helper.c void riscv_cpu_interrupt(CPURISCVState *env) · line 565
Quoted 8 lines · Philippe Mathieu-Daudé
target/riscv/tcg/cpu_helper.c +1
-0@@ -554,6 +559,7 @@ void riscv_cpu_interrupt(CPURISCVState *env) {uint64_t gein, vsgein =0 , vstip =0 , irqf =0 ;CPUState *cs =env_cpu (env); +uint64_t mip =riscv_cpu_get_mip (env);BQL_LOCK_GUARD ();
You don't want to move any reads outside the lock.
r~
PATCH v3 12/21 target/riscv: Access MIP atomically
In reply to Philippe Mathieu-DaudéUse qatomic_read() in riscv_cpu_get_mip() and qatomic_set() when updating env->mip. This makes MIP accesses safe for riscv_cpu_has_work(), which may run without the BQL.
--- target/riscv/tcg/cpu_helper.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
target/riscv/tcg/cpu_helper.c +2 -2
@@ -528,7 +528,7 @@ void riscv_cpu_swap_hypervisor_regs(CPURISCVState *env)uint64_t riscv_cpu_get_mip (const CPURISCVState *env) { -return env->mip; +return qatomic_read (&env->mip); }void riscv_cpu_set_rnmi (RISCVCPU *cpu,uint32_t irq,bool level)
@@ -592,7 +592,7 @@ uint64_t riscv_cpu_update_mip(CPURISCVState *env, uint64_t mask, uint64_t value)BQL_LOCK_GUARD (); - env->mip = (old & ~mask) | (value & mask); +qatomic_set (&env->mip, (old & ~mask) | (value & mask));riscv_cpu_interrupt (env);
Signature · 1 line
2.53.0
Re: [PATCH v3 12/21] target/riscv: Access MIP atomically
Quoted 9 lines · Philippe Mathieu-Daudé
Use
qatomic_read()inriscv_cpu_get_mip()andqatomic_set()when updatingenv->mip. This makes MIP accesses safe forriscv_cpu_has_work(), which may run without the BQL.Reported-by Paolo Bonzini<[email protected]>Signed-off-by Philippe Mathieu-Daudé<[email protected]>--- target/riscv/tcg/cpu_helper.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
r~
PATCH v3 13/21 accel/tcg: Refactor poll-while-halted flow in cpu_exec()
In reply to Philippe Mathieu-DaudéInvert cpu_handle_halt()'s logic to read in cpu_exec() as "if halted, poll for async events and find work; if no work, return". Rename as cpu_poll_while_halted().
--- accel/tcg/cpu-exec.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
accel/tcg/cpu-exec.c +4 -4
@@ -654,18 +654,18 @@ static inline void tb_add_jump(TranslationBlock *tb, int n, }#ifndef CONFIG_USER_ONLY -static inline bool cpu_handle_halt (CPUState *cpu) +static bool cpu_poll_while_halted (CPUState *cpu) {const TCGCPUOps *tcg_ops = cpu->cc->tcg_ops;bool leave_halt = tcg_ops->cpu_exec_halt (cpu);if (!leave_halt) { -return true; +return false; } cpu->halted =0 ;/* allow execution */ -return false; +return true; }#endif /* !CONFIG_USER_ONLY */
@@ -1027,7 +1027,7 @@ int cpu_exec(CPUState *cpu)#ifndef CONFIG_USER_ONLY if (cpu->halted) { -if (cpu_handle_halt (cpu)) { +if (!cpu_poll_while_halted (cpu)) {return EXCP_HALTED ; }assert (!cpu->halted);
Signature · 1 line
2.53.0
PATCH v3 14/21 accel/tcg: Introduce poll_during_halt() and leaving_halt()
In reply to Philippe Mathieu-DaudéSplit target-specific halt handling into an optional poll_during_halt() callback before cpu_has_work() and a leaving_halt() callback after work is found.
Keep cpu_exec_halt() as a legacy alternative for targets that have not migrated. Require each target to provide either cpu_exec_halt() or leaving_halt(), but not both.
--- include/accel/tcg/cpu-ops.h | 24 +++++++++++++++++++++++- accel/tcg/cpu-exec.c | 21 +++++++++++++++++---- 2 files changed, 40 insertions(+), 5 deletions(-)
include/accel/tcg/cpu-ops.h +23 -1
@@ -169,6 +169,27 @@ struct TCGCPUOps {*/ vaddr (*untagged_addr)(CPUState *cs,vaddr addr);#else +/** +* @poll_during_halt: Poll target-specific events while the CPU is halted. +* @cpu: vCPU context +* +* Called when the CPU is halted to handle target-specific asynchronous +* event processing before instruction execution begins. +* The caller does not hold the BQL. +*/ +void (*poll_during_halt)(CPUState *cpu); +/** +* @leaving_halt: Perform target-specific cleanup before resuming +* execution. +* @cpu: vCPU context +* +* Called after a halted CPU has detected pending work and is about to +* resume execution from the halted state. This callback performs any +* necessary target-specific state transitions or synchronization before +* instruction execution resumes. The caller does not hold the BQL. +* Either this callback or @cpu_exec_halt must be provided (but not both). +*/ +void (*leaving_halt)(CPUState *cpu);/** @do_interrupt: Callback for interrupt handling. */ void (*do_interrupt)(CPUState *cpu);/** @cpu_exec_interrupt: Callback for processing interrupts in cpu_exec */
@@ -185,7 +206,8 @@ struct TCGCPUOps {* if it should remain in the halted state. (This should generally * be the same value that cpu_has_work() would return.) * -* This method must be provided. If the target does not need to +* Either @leaving_halt or this method must be provided, but not both. +* If the target does not need to * do anything special for halt, the same function used for its * SysemuCPUOps::has_work method can be used here, as they have the * same function signature.
accel/tcg/cpu-exec.c +17 -4
@@ -48,6 +48,7 @@#include "internal-common.h" #if !defined(CONFIG_USER_ONLY )#include "accel/tcg/iommu.h" +#include "hw/core/sysemu-cpu-ops.h" #endif /* -icount align implementation. */
@@ -657,10 +658,22 @@ static inline void tb_add_jump(TranslationBlock *tb, int n,static bool cpu_poll_while_halted (CPUState *cpu) {const TCGCPUOps *tcg_ops = cpu->cc->tcg_ops; -bool leave_halt = tcg_ops->cpu_exec_halt (cpu); -if (!leave_halt) { -return false; +if (tcg_ops->leaving_halt) { +assert (!tcg_ops->cpu_exec_halt); +if (tcg_ops->poll_during_halt) { + tcg_ops->poll_during_halt (cpu); + } +if (!cpu_has_work (cpu)) { +return false; + } + tcg_ops->leaving_halt (cpu); + }else { +assert (!tcg_ops->poll_during_halt); +assert (cpu->cc->sysemu_ops->has_work == tcg_ops->cpu_exec_halt); +if (!tcg_ops->cpu_exec_halt (cpu)) { +return false; + } } cpu->halted =0 ;/* allow execution */
@@ -1059,7 +1072,7 @@ bool tcg_exec_realizefn(CPUState *cpu, Error **errp)/* Check mandatory TCGCPUOps handlers */ const TCGCPUOps *tcg_ops = cpu->cc->tcg_ops;#ifndef CONFIG_USER_ONLY -assert (tcg_ops->cpu_exec_halt); +assert (tcg_ops->cpu_exec_halt || tcg_ops->leaving_halt);assert (tcg_ops->cpu_exec_interrupt);assert (tcg_ops->cpu_exec_reset);assert (tcg_ops->pointer_wrap);
Signature · 1 line
2.53.0
PATCH v3 15/21 target/arm: Split leaving-halt handling from arm_cpu_exec_halt()
In reply to Philippe Mathieu-DaudéMove WFxT timer cleanup and halt-reason reset into arm_cpu_leaving_halt(). Keep arm_cpu_exec_halt() focused on deciding whether the CPU can leave the halted state.
--- target/arm/cpu.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-)
target/arm/cpu.c +13 -7
@@ -872,18 +872,24 @@ static bool arm_cpu_internal_is_big_endian(CPUState *cs) }#ifdef CONFIG_TCG +static void arm_cpu_leaving_halt (CPUState *cs) +{ +ARMCPU *cpu =ARM_CPU (cs); + +/* We're about to come out of WFI/WFE: disable the WFxT timer */ +if (cpu->wfxt_timer) { +timer_del (cpu->wfxt_timer); + } +/* clear the halt reason */ +qatomic_set (&cpu->env.halt_reason,NOT_HALTED ); +} +bool arm_cpu_exec_halt (CPUState *cs) {bool leave_halt =cpu_has_work (cs);if (leave_halt) { -/* We're about to come out of WFI/WFE: disable the WFxT timer */ -ARMCPU *cpu =ARM_CPU (cs); -if (cpu->wfxt_timer) { -timer_del (cpu->wfxt_timer); - } -/* clear the halt reason */ -qatomic_set (&cpu->env.halt_reason,NOT_HALTED ); +arm_cpu_leaving_halt (cs); }return leave_halt; }
Signature · 1 line
2.53.0
PATCH v3 16/21 target/arm: Convert cpu_exec_halt() to leaving_halt()
In reply to Philippe Mathieu-Daudéarm_cpu_exec_halt() now merely checks cpu_has_work() and conditionally call arm_cpu_leaving_halt(), which is now the generic flow in cpu_has_work_after_processing_async_events().
Register the leaving_halt handler to use the generic target-agnostic flow and remove the arm_cpu_exec_halt() wrapper.
--- target/arm/internals.h | 3 --- target/arm/cpu.c | 12 +----------- target/arm/tcg/cpu-v7m.c | 1 - 3 files changed, 1 insertion(+), 15 deletions(-)
target/arm/internals.h +0 -3
@@ -431,9 +431,6 @@ void arm_restore_state_to_opc(CPUState *cs,#ifdef CONFIG_TCG TCGTBCPUState arm_get_tb_cpu_state (CPUState *cs);void arm_cpu_synchronize_from_tb (CPUState *cs,const TranslationBlock *tb); - -/* Our implementation of TCGCPUOps::cpu_exec_halt */ -bool arm_cpu_exec_halt (CPUState *cs);int arm_cpu_mmu_index (CPUState *cs,bool ifetch);#endif /* CONFIG_TCG */
target/arm/cpu.c +1 -11
@@ -883,16 +883,6 @@ static void arm_cpu_leaving_halt(CPUState *cs)/* clear the halt reason */ qatomic_set(&cpu->env.halt_reason, NOT_HALTED); } - -bool arm_cpu_exec_halt (CPUState *cs) -{ -bool leave_halt =cpu_has_work (cs); - -if (leave_halt) { -arm_cpu_leaving_halt (cs); - } -return leave_halt; -}#endif /*
@@ -2617,7 +2607,7 @@ static const TCGCPUOps arm_tcg_ops = { .tlb_fill_align = arm_cpu_tlb_fill_align, .pointer_wrap = aprofile_pointer_wrap, .cpu_exec_interrupt = arm_cpu_exec_interrupt, - .cpu_exec_halt = arm_cpu_exec_halt, + .leaving_halt = arm_cpu_leaving_halt, .cpu_exec_reset = cpu_reset, .do_interrupt = arm_cpu_do_interrupt, .do_transaction_failed = arm_cpu_do_transaction_failed,
target/arm/tcg/cpu-v7m.c +0 -1
@@ -302,7 +302,6 @@ static const TCGCPUOps arm_v7m_tcg_ops = { .tlb_fill_align = arm_cpu_tlb_fill_align, .pointer_wrap = cpu_pointer_wrap_uint32, .cpu_exec_interrupt = arm_v7m_cpu_exec_interrupt, - .cpu_exec_halt = arm_cpu_exec_halt, .cpu_exec_reset = cpu_reset, .do_interrupt = arm_v7m_cpu_do_interrupt, .do_transaction_failed = arm_cpu_do_transaction_failed,
Signature · 1 line
2.53.0
PATCH v3 17/21 target/i386: Use an acquire load for interrupt_request
In reply to Philippe Mathieu-Daudéx86_cpu_has_work() may run without the BQL, but currently reads CPUState::interrupt_request directly. Other threads update this field with qatomic_or() in cpu_set_interrupt(), so the direct read races with an atomic access.
Load the interrupt request with qatomic_load_acquire(), matching cpu_test_interrupt(). This provides the acquire ordering required before x86_cpu_pending_interrupt() inspects the CPU state.
--- target/i386/cpu.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
target/i386/cpu.c +4 -1
@@ -10640,7 +10640,10 @@ int x86_cpu_pending_interrupt(const CPUState *cs, int interrupt_request)static bool x86_cpu_has_work (CPUState *cs) { -return x86_cpu_pending_interrupt (cs, cs->interrupt_request) !=0 ; +uint32_t pending_interrupts; + + pending_interrupts =qatomic_load_acquire (&cs->interrupt_request); +return x86_cpu_pending_interrupt (cs, pending_interrupts) !=0 ; }#endif /* !CONFIG_USER_ONLY */
Signature · 1 line
2.53.0
Re: [PATCH v3 17/21] target/i386: Use an acquire load for interrupt_request
Quoted 21 lines · Philippe Mathieu-Daudé
x86_cpu_has_work()may run without the BQL, but currently readsCPUState::interrupt_requestdirectly. Other threads update this field withqatomic_or()incpu_set_interrupt(), so the direct read races with an atomic access.Load the interrupt request with
qatomic_load_acquire(), matchingcpu_test_interrupt(). This provides the acquire ordering required beforex86_cpu_pending_interrupt()inspects the CPU state.Suggested-by Paolo Bonzini <[email protected]>Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- target/i386/cpu.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)target/i386/cpu.c +0
-0@@ -10640,7 +10640,10 @@ int x86_cpu_pending_interrupt(const CPUState *cs, int interrupt_request)
target/i386/cpu.c int x86_cpu_pending_interrupt(const CPUState *cs, int interrupt_request) · line 10649
Quoted 10 lines
target/i386/cpu.c +4
-1static bool x86_cpu_has_work (CPUState *cs) { -return x86_cpu_pending_interrupt (cs, cs->interrupt_request) !=0 ; +uint32_t pending_interrupts; + + pending_interrupts =qatomic_load_acquire (&cs->interrupt_request); +return x86_cpu_pending_interrupt (cs, pending_interrupts) !=0 ; }#endif /* !CONFIG_USER_ONLY */
For the change overall,
Because of -ftrivial-auto-var-init=zero, I am now in general against uninitialized local variables, if at all possible, everywhere.
I know you've added the local variable due to wrapping, and split the initialization for the same reason. In this case, perhaps best to just use a shorter variable name:
uint32_t ir = qatomic_load_acquire(&cs->interrupt_request);
return x86_cpu_pending_interrupt(cs, ir) != 0;but in others, just wrap the initialization:
uint32_t pending_interrupts
= qatomic_load_acquire(&cs->interrupt_request);r~
Re: [PATCH v3 17/21] target/i386: Use an acquire load for interrupt_request
In reply to Philippe Mathieu-DaudéQuoted 15 lines · Philippe Mathieu-Daudé
Date: Wed, 23 Sep 2026 19:11:11 +0200
From: Philippe Mathieu-Daudé <[email protected]>
Subject: [PATCH v3 17/21] target/i386: Use an acquire load for
interrupt_request
X-Mailer: git-send-email 2.53.0
x86_cpu_has_work()may run without the BQL, but currently readsCPUState::interrupt_requestdirectly. Other threads update this field withqatomic_or()incpu_set_interrupt(), so the direct read races with an atomic access.Load the interrupt request with
qatomic_load_acquire(), matchingcpu_test_interrupt(). This provides the acquire ordering required beforex86_cpu_pending_interrupt()inspects the CPU state.
Quoted 5 lines
Suggested-by Paolo Bonzini <[email protected]>Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- target/i386/cpu.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
(and I agree with Richard's comment :-))
Regards,
Zhao
PATCH v3 18/21 target/i386: Split APIC polling from x86_cpu_exec_halt()
In reply to Philippe Mathieu-DaudéMove APIC polling into x86_cpu_poll_during_halt() while keeping the remaining halt handling in x86_cpu_exec_halt().
--- target/i386/tcg/helper-tcg.h | 1 + target/i386/tcg/system/seg_helper.c | 11 +++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-)
target/i386/tcg/helper-tcg.h +1 -0
@@ -37,6 +37,7 @@*/ void x86_cpu_do_interrupt (CPUState *cpu);#ifndef CONFIG_USER_ONLY +void x86_cpu_poll_during_halt (CPUState *cpu);bool x86_cpu_exec_halt (CPUState *cpu);bool x86_need_replay_interrupt (int interrupt_request);bool x86_cpu_exec_interrupt (CPUState *cpu,int int_req);
target/i386/tcg/system/seg_helper.c +9 -2
@@ -128,10 +128,9 @@ void x86_cpu_do_interrupt(CPUState *cs) } } -bool x86_cpu_exec_halt (CPUState *cpu) +void x86_cpu_poll_during_halt (CPUState *cpu) {X86CPU *x86_cpu =X86_CPU (cpu); -CPUX86State *env = &x86_cpu->env;if (cpu_test_interrupt (cpu,CPU_INTERRUPT_POLL )) {bql_lock ();
@@ -139,6 +138,14 @@ bool x86_cpu_exec_halt(CPUState *cpu)cpu_reset_interrupt (cpu,CPU_INTERRUPT_POLL );bql_unlock (); } +} + +bool x86_cpu_exec_halt (CPUState *cpu) +{ +X86CPU *x86_cpu =X86_CPU (cpu); +CPUX86State *env = &x86_cpu->env; + +x86_cpu_poll_during_halt (cpu);if (!cpu_has_work (cpu)) {return false;
Signature · 1 line
2.53.0
PATCH v3 19/21 target/i386: Split leaving-halt handling from x86_cpu_exec_halt()
In reply to Philippe Mathieu-DaudéMove debug exception handling performed when leaving HLT into x86_cpu_leaving_halt(). Keep x86_cpu_exec_halt() responsible for checking whether the CPU can resume.
Document that #DB IRQ delivery through do_interrupt_all() runs in the vCPU thread and does not require BQL protection.
--- target/i386/tcg/helper-tcg.h | 1 + target/i386/tcg/system/seg_helper.c | 25 +++++++++++++++++-------- 2 files changed, 18 insertions(+), 8 deletions(-)
target/i386/tcg/helper-tcg.h +1 -0
@@ -39,6 +39,7 @@ void x86_cpu_do_interrupt(CPUState *cpu);#ifndef CONFIG_USER_ONLY void x86_cpu_poll_during_halt (CPUState *cpu);bool x86_cpu_exec_halt (CPUState *cpu); +void x86_cpu_leaving_halt (CPUState *cpu);bool x86_need_replay_interrupt (int interrupt_request);bool x86_cpu_exec_interrupt (CPUState *cpu,int int_req);#endif
target/i386/tcg/system/seg_helper.c +17 -8
@@ -140,22 +140,31 @@ void x86_cpu_poll_during_halt(CPUState *cpu) } } -bool x86_cpu_exec_halt (CPUState *cpu) +void x86_cpu_leaving_halt (CPUState *cpu) {X86CPU *x86_cpu =X86_CPU (cpu); -CPUX86State *env = &x86_cpu->env; - -x86_cpu_poll_during_halt (cpu); - -if (!cpu_has_work (cpu)) { -return false; - } +CPUX86State *env =cpu_env (cpu);/* Complete HLT instruction. */ if (env->eflags &TF_MASK ) { env->dr[6 ] |=DR6_BS ; +/* +* do_interrupt_all() is the normal TCG exception-delivery path +* and runs in the same vCPU thread context, so #DB delivery does +* not require BQL protection here. +*/ do_interrupt_all (x86_cpu,EXCP01_DB ,0 ,0 , env->eip,0 ); } +} + +bool x86_cpu_exec_halt (CPUState *cpu) +{ +if (!cpu_has_work (cpu)) { +return false; + } + +x86_cpu_leaving_halt (cpu); +return true; }
Signature · 1 line
2.53.0
PATCH v3 20/21 target/i386: Use generic halt transition handlers
In reply to Philippe Mathieu-DaudéRegister x86_cpu_poll_during_halt() and x86_cpu_leaving_halt() with the generic TCG halt flow. Remove the target-specific x86_cpu_exec_halt() wrapper.
--- target/i386/tcg/helper-tcg.h | 1 - target/i386/tcg/system/seg_helper.c | 11 ----------- target/i386/tcg/tcg-cpu.c | 3 ++- 3 files changed, 2 insertions(+), 13 deletions(-)
target/i386/tcg/helper-tcg.h +0 -1
@@ -38,7 +38,6 @@void x86_cpu_do_interrupt (CPUState *cpu);#ifndef CONFIG_USER_ONLY void x86_cpu_poll_during_halt (CPUState *cpu); -bool x86_cpu_exec_halt (CPUState *cpu);void x86_cpu_leaving_halt (CPUState *cpu);bool x86_need_replay_interrupt (int interrupt_request);bool x86_cpu_exec_interrupt (CPUState *cpu,int int_req);
target/i386/tcg/system/seg_helper.c +0 -11
@@ -157,17 +157,6 @@ void x86_cpu_leaving_halt(CPUState *cpu) } } -bool x86_cpu_exec_halt (CPUState *cpu) -{ -if (!cpu_has_work (cpu)) { -return false; - } - -x86_cpu_leaving_halt (cpu); - -return true; -} -bool x86_need_replay_interrupt (int interrupt_request) {/*
target/i386/tcg/tcg-cpu.c +2 -1
@@ -180,7 +180,8 @@ const TCGCPUOps x86_tcg_ops = { .tlb_fill = x86_cpu_tlb_fill, .pointer_wrap = x86_pointer_wrap, .do_interrupt = x86_cpu_do_interrupt, - .cpu_exec_halt = x86_cpu_exec_halt, + .poll_during_halt = x86_cpu_poll_during_halt, + .leaving_halt = x86_cpu_leaving_halt, .cpu_exec_interrupt = x86_cpu_exec_interrupt, .cpu_exec_reset = x86_cpu_exec_reset, .do_unaligned_access = x86_cpu_do_unaligned_access,
Signature · 1 line
2.53.0
PATCH v3 21/21 accel/tcg: Remove the redundant cpu_exec_halt() hook
In reply to Philippe Mathieu-DaudéAll remaining users of cpu_exec_halt simply alias cpu_has_work(). Call cpu_has_work() directly from the generic halt flow and remove the redundant hook registrations and interface definition.
Make affected cpu_has_work() helpers private where possible.
--- include/accel/tcg/cpu-ops.h | 18 ------------------ target/loongarch/internals.h | 1 - target/riscv/internals.h | 5 ----- target/s390x/s390x-internal.h | 1 - accel/tcg/cpu-exec.c | 23 ++++++++--------------- target/alpha/cpu.c | 1 - target/avr/cpu.c | 1 - target/hexagon/cpu.c | 1 - target/hppa/cpu.c | 1 - target/loongarch/cpu.c | 2 +- target/loongarch/tcg/tcg_cpu.c | 1 - target/m68k/cpu.c | 1 - target/microblaze/cpu.c | 1 - target/mips/cpu.c | 1 - target/or1k/cpu.c | 1 - target/ppc/cpu_init.c | 1 - target/riscv/cpu.c | 2 +- target/riscv/tcg/tcg-cpu.c | 1 - target/rx/cpu.c | 1 - target/s390x/cpu-system.c | 2 +- target/s390x/cpu.c | 1 - target/sh4/cpu.c | 1 - target/sparc/cpu.c | 1 - target/tricore/cpu.c | 1 - target/xtensa/cpu.c | 1 - 25 files changed, 11 insertions(+), 60 deletions(-)
include/accel/tcg/cpu-ops.h +0 -18
@@ -187,7 +187,6 @@ struct TCGCPUOps {* resume execution from the halted state. This callback performs any * necessary target-specific state transitions or synchronization before * instruction execution resumes. The caller does not hold the BQL. -* Either this callback or @cpu_exec_halt must be provided (but not both). */ void (*leaving_halt)(CPUState *cpu);/** @do_interrupt: Callback for interrupt handling. */
@@ -196,23 +195,6 @@ struct TCGCPUOps {bool (*cpu_exec_interrupt)(CPUState *cpu,int interrupt_request);/** @cpu_exec_reset: Callback for reset in cpu_exec. */ void (*cpu_exec_reset)(CPUState *cpu); -/** -* @cpu_exec_halt: Callback for handling halt in cpu_exec. -* -* The target CPU should do any special processing here that it needs -* to do when the CPU is in the halted state. -* -* Return true to indicate that the CPU should now leave halt, false -* if it should remain in the halted state. (This should generally -* be the same value that cpu_has_work() would return.) -* -* Either @leaving_halt or this method must be provided, but not both. -* If the target does not need to -* do anything special for halt, the same function used for its -* SysemuCPUOps::has_work method can be used here, as they have the -* same function signature. -*/ -bool (*cpu_exec_halt)(CPUState *cpu);/** * @tlb_fill_align: Handle a softmmu tlb miss * @cpu: cpu context
target/loongarch/internals.h +0 -1
@@ -38,7 +38,6 @@ void cpu_loongarch_timer_cb(void *opaque);uint64_t cpu_loongarch_get_timer_counter (CPUTimerState *timer);uint64_t cpu_loongarch_get_timer_ticks (CPUTimerState *timer);void cpu_loongarch_set_timer_config (CPUTimerState *timer,uint64_t value); -bool loongarch_cpu_has_work (CPUState *cs);bool cpu_loongarch_hw_interrupts_pending (CPULoongArchState *env);#endif /* !CONFIG_USER_ONLY */
target/riscv/internals.h +0 -5
@@ -201,11 +201,6 @@ static inline target_ulong get_xepc_mask(CPURISCVState *env) } } -#ifndef CONFIG_USER_ONLY -/* Our implementation of SysemuCPUOps::has_work */ -bool riscv_cpu_has_work (CPUState *cs); -#endif -/* Zjpm addr masking routine */ static inline target_ulong adjust_addr_body(CPURISCVState *env, target_ulong addr,
target/s390x/s390x-internal.h +0 -1
@@ -248,7 +248,6 @@ bool s390_cpu_system_realize(DeviceState *dev, Error **errp);void s390_cpu_finalize (Object *obj);void s390_cpu_system_class_init (CPUClass *cc);void s390_cpu_machine_reset_cb (void *opaque); -bool s390_cpu_has_work (CPUState *cs);#endif /* CONFIG_USER_ONLY */
accel/tcg/cpu-exec.c +8 -15
@@ -48,7 +48,6 @@#include "internal-common.h" #if !defined(CONFIG_USER_ONLY )#include "accel/tcg/iommu.h" -#include "hw/core/sysemu-cpu-ops.h" #endif /* -icount align implementation. */
@@ -659,21 +658,16 @@ static bool cpu_poll_while_halted(CPUState *cpu) {const TCGCPUOps *tcg_ops = cpu->cc->tcg_ops; +if (tcg_ops->poll_during_halt) { + tcg_ops->poll_during_halt (cpu); + } + +if (!cpu_has_work (cpu)) { +return false; + } +if (tcg_ops->leaving_halt) { -assert (!tcg_ops->cpu_exec_halt); -if (tcg_ops->poll_during_halt) { - tcg_ops->poll_during_halt (cpu); - } -if (!cpu_has_work (cpu)) { -return false; - } tcg_ops->leaving_halt (cpu); - }else { -assert (!tcg_ops->poll_during_halt); -assert (cpu->cc->sysemu_ops->has_work == tcg_ops->cpu_exec_halt); -if (!tcg_ops->cpu_exec_halt (cpu)) { -return false; - } } cpu->halted =0 ;/* allow execution */
@@ -1072,7 +1066,6 @@ bool tcg_exec_realizefn(CPUState *cpu, Error **errp)/* Check mandatory TCGCPUOps handlers */ const TCGCPUOps *tcg_ops = cpu->cc->tcg_ops;#ifndef CONFIG_USER_ONLY -assert (tcg_ops->cpu_exec_halt || tcg_ops->leaving_halt);assert (tcg_ops->cpu_exec_interrupt);assert (tcg_ops->cpu_exec_reset);assert (tcg_ops->pointer_wrap);
target/alpha/cpu.c +0 -1
@@ -265,7 +265,6 @@ static const TCGCPUOps alpha_tcg_ops = { .tlb_fill = alpha_cpu_tlb_fill, .pointer_wrap = cpu_pointer_wrap_notreached, .cpu_exec_interrupt = alpha_cpu_exec_interrupt, - .cpu_exec_halt = alpha_cpu_has_work, .cpu_exec_reset = cpu_reset, .do_interrupt = alpha_cpu_do_interrupt, .do_transaction_failed = alpha_cpu_do_transaction_failed,
target/avr/cpu.c +0 -1
@@ -246,7 +246,6 @@ static const TCGCPUOps avr_tcg_ops = { .restore_state_to_opc = avr_restore_state_to_opc, .mmu_index = avr_cpu_mmu_index, .cpu_exec_interrupt = avr_cpu_exec_interrupt, - .cpu_exec_halt = avr_cpu_has_work, .cpu_exec_reset = cpu_reset, .tlb_fill = avr_cpu_tlb_fill, .do_interrupt = avr_cpu_do_interrupt,
target/hexagon/cpu.c +0 -1
@@ -783,7 +783,6 @@ static const TCGCPUOps hexagon_tcg_ops = { .cpu_exec_reset = cpu_reset, .tlb_fill = hexagon_tlb_fill, .do_unaligned_access = hexagon_cpu_do_unaligned_access, - .cpu_exec_halt = hexagon_cpu_has_work, .do_interrupt = hexagon_cpu_do_interrupt,#endif /* !CONFIG_USER_ONLY */ };
target/hppa/cpu.c +0 -1
@@ -270,7 +270,6 @@ static const TCGCPUOps hppa_tcg_ops = { .tlb_fill_align = hppa_cpu_tlb_fill_align, .pointer_wrap = cpu_pointer_wrap_notreached, .cpu_exec_interrupt = hppa_cpu_exec_interrupt, - .cpu_exec_halt = hppa_cpu_has_work, .cpu_exec_reset = cpu_reset, .do_interrupt = hppa_cpu_do_interrupt, .do_unaligned_access = hppa_cpu_do_unaligned_access,
target/loongarch/cpu.c +1 -1
@@ -123,7 +123,7 @@ bool cpu_loongarch_hw_interrupts_pending(CPULoongArchState *env)#endif #ifndef CONFIG_USER_ONLY -bool loongarch_cpu_has_work (CPUState *cs) +static bool loongarch_cpu_has_work (CPUState *cs) {bool has_work = false;
target/loongarch/tcg/tcg_cpu.c +0 -1
@@ -327,7 +327,6 @@ const TCGCPUOps loongarch_tcg_ops = { .tlb_fill = loongarch_cpu_tlb_fill, .pointer_wrap = loongarch_pointer_wrap, .cpu_exec_interrupt = loongarch_cpu_exec_interrupt, - .cpu_exec_halt = loongarch_cpu_has_work, .cpu_exec_reset = cpu_reset, .do_interrupt = loongarch_cpu_do_interrupt, .do_transaction_failed = loongarch_cpu_do_transaction_failed,
target/m68k/cpu.c +0 -1
@@ -710,7 +710,6 @@ static const TCGCPUOps m68k_tcg_ops = { .tlb_fill = m68k_cpu_tlb_fill, .pointer_wrap = cpu_pointer_wrap_uint32, .cpu_exec_interrupt = m68k_cpu_exec_interrupt, - .cpu_exec_halt = m68k_cpu_has_work, .cpu_exec_reset = cpu_reset, .do_interrupt = m68k_cpu_do_interrupt, .do_transaction_failed = m68k_cpu_transaction_failed,
target/microblaze/cpu.c +0 -1
@@ -448,7 +448,6 @@ static const TCGCPUOps mb_tcg_ops = { .tlb_fill = mb_cpu_tlb_fill, .pointer_wrap = cpu_pointer_wrap_uint32, .cpu_exec_interrupt = mb_cpu_exec_interrupt, - .cpu_exec_halt = mb_cpu_has_work, .cpu_exec_reset = cpu_reset, .do_interrupt = mb_cpu_do_interrupt, .do_transaction_failed = mb_cpu_transaction_failed,
target/mips/cpu.c +0 -1
@@ -716,7 +716,6 @@ static const TCGCPUOps mips_tcg_ops = { .tlb_fill = mips_cpu_tlb_fill, .pointer_wrap = mips_pointer_wrap, .cpu_exec_interrupt = mips_cpu_exec_interrupt, - .cpu_exec_halt = mips_cpu_has_work, .cpu_exec_reset = cpu_reset, .do_interrupt = mips_cpu_do_interrupt, .do_transaction_failed = mips_cpu_do_transaction_failed,
target/or1k/cpu.c +0 -1
@@ -266,7 +266,6 @@ static const TCGCPUOps openrisc_tcg_ops = { .tlb_fill = openrisc_cpu_tlb_fill, .pointer_wrap = cpu_pointer_wrap_uint32, .cpu_exec_interrupt = openrisc_cpu_exec_interrupt, - .cpu_exec_halt = openrisc_cpu_has_work, .cpu_exec_reset = cpu_reset, .do_interrupt = openrisc_cpu_do_interrupt,#endif /* !CONFIG_USER_ONLY */
target/ppc/cpu_init.c +0 -1
@@ -7496,7 +7496,6 @@ static const TCGCPUOps ppc_tcg_ops = { .tlb_fill = ppc_cpu_tlb_fill, .pointer_wrap = ppc_pointer_wrap, .cpu_exec_interrupt = ppc_cpu_exec_interrupt, - .cpu_exec_halt = ppc_cpu_has_work, .cpu_exec_reset = cpu_reset, .do_interrupt = ppc_cpu_do_interrupt, .cpu_exec_enter = ppc_cpu_exec_enter,
target/riscv/cpu.c +1 -1
@@ -954,7 +954,7 @@ int riscv_cpu_vsirq_pending(CPURISCVState *env) (irqs | irqs_f_vs), env->hviprio); } -bool riscv_cpu_has_work (CPUState *cs) +static bool riscv_cpu_has_work (CPUState *cs) {RISCVCPU *cpu =RISCV_CPU (cs);CPURISCVState *env = &cpu->env;
target/riscv/tcg/tcg-cpu.c +0 -1
@@ -286,7 +286,6 @@ const TCGCPUOps riscv_tcg_ops = { .tlb_fill = riscv_cpu_tlb_fill, .pointer_wrap = riscv_pointer_wrap, .cpu_exec_interrupt = riscv_cpu_exec_interrupt, - .cpu_exec_halt = riscv_cpu_has_work, .cpu_exec_reset = cpu_reset, .do_interrupt = riscv_cpu_do_interrupt, .do_transaction_failed = riscv_cpu_do_transaction_failed,
target/rx/cpu.c +0 -1
@@ -227,7 +227,6 @@ static const TCGCPUOps rx_tcg_ops = { .pointer_wrap = cpu_pointer_wrap_uint32, .cpu_exec_interrupt = rx_cpu_exec_interrupt, - .cpu_exec_halt = rx_cpu_has_work, .cpu_exec_reset = cpu_reset, .do_interrupt = rx_cpu_do_interrupt, };
target/s390x/cpu-system.c +1 -1
@@ -39,7 +39,7 @@#include "system/tcg.h" #include "hw/core/sysemu-cpu-ops.h" -bool s390_cpu_has_work (CPUState *cs) +static bool s390_cpu_has_work (CPUState *cs) {S390CPU *cpu =S390_CPU (cs);
target/s390x/cpu.c +0 -1
@@ -384,7 +384,6 @@ static const TCGCPUOps s390_tcg_ops = { .tlb_fill = s390_cpu_tlb_fill, .pointer_wrap = s390_pointer_wrap, .cpu_exec_interrupt = s390_cpu_exec_interrupt, - .cpu_exec_halt = s390_cpu_has_work, .cpu_exec_reset = cpu_reset, .do_interrupt = s390_cpu_do_interrupt, .debug_excp_handler = s390x_cpu_debug_excp_handler,
target/sh4/cpu.c +0 -1
@@ -312,7 +312,6 @@ static const TCGCPUOps superh_tcg_ops = { .tlb_fill = superh_cpu_tlb_fill, .pointer_wrap = cpu_pointer_wrap_notreached, .cpu_exec_interrupt = superh_cpu_exec_interrupt, - .cpu_exec_halt = superh_cpu_has_work, .cpu_exec_reset = cpu_reset, .do_interrupt = superh_cpu_do_interrupt, .do_unaligned_access = superh_cpu_do_unaligned_access,
target/sparc/cpu.c +0 -1
@@ -1074,7 +1074,6 @@ static const TCGCPUOps sparc_tcg_ops = { .tlb_fill = sparc_cpu_tlb_fill, .pointer_wrap = sparc_pointer_wrap, .cpu_exec_interrupt = sparc_cpu_exec_interrupt, - .cpu_exec_halt = sparc_cpu_has_work, .cpu_exec_reset = cpu_reset, .do_interrupt = sparc_cpu_do_interrupt, .do_transaction_failed = sparc_cpu_do_transaction_failed,
target/tricore/cpu.c +0 -1
@@ -223,7 +223,6 @@ static const TCGCPUOps tricore_tcg_ops = { .tlb_fill = tricore_cpu_tlb_fill, .pointer_wrap = cpu_pointer_wrap_uint32, .cpu_exec_interrupt = tricore_cpu_exec_interrupt, - .cpu_exec_halt = tricore_cpu_has_work, .cpu_exec_reset = cpu_reset, };
target/xtensa/cpu.c +0 -1
@@ -325,7 +325,6 @@ static const TCGCPUOps xtensa_tcg_ops = { .tlb_fill = xtensa_cpu_tlb_fill, .pointer_wrap = cpu_pointer_wrap_uint32, .cpu_exec_interrupt = xtensa_cpu_exec_interrupt, - .cpu_exec_halt = xtensa_cpu_has_work, .cpu_exec_reset = cpu_reset, .do_interrupt = xtensa_cpu_do_interrupt, .do_transaction_failed = xtensa_cpu_do_transaction_failed,
Signature · 1 line
2.53.0