cpus: Restrict CPU has_work() handlers to system emulation
v2 cover cpus: Restrict CPU has_work() handlers to system emulation
Missing review: 16
(I plan to merge this myself once reviewed)
v1 cover:
On user emulation, threads always have work to do, and CPUClass::has_work() is never called. Restrict it to system emulation, allowing to simplify a bit and reduce code built on user emulation.
Based-on: <[email protected]>
"cpus: Prefer cached CpuClass over CPU_GET_CLASS() macro"
Philippe Mathieu-Daudé (24):
cpus: Restrict cpu_has_work() to system emulation
cpus: Un-inline cpu_has_work()
cpus: Introduce SysemuCPUOps::has_work() handler target/alpha: Move has_work() from CPUClass to SysemuCPUOps target/arm: Move has_work() from CPUClass to SysemuCPUOps target/avr: Move has_work() from CPUClass to SysemuCPUOps target/hexagon: Remove CPUClass:has_work() handler target/hppa: Move has_work() from CPUClass to SysemuCPUOps target/i386: Move has_work() from CPUClass to SysemuCPUOps target/loongarch: Move has_work() from CPUClass to SysemuCPUOps target/m68k: Move has_work() from CPUClass to SysemuCPUOps target/microblaze: Move has_work() from CPUClass to SysemuCPUOps target/mips: Move has_work() from CPUClass to SysemuCPUOps target/openrisc: Move has_work() from CPUClass to SysemuCPUOps target/ppc: Move has_work() from CPUClass to SysemuCPUOps target/riscv: Move has_work() from CPUClass to SysemuCPUOps target/rx: Move has_work() from CPUClass to SysemuCPUOps target/s390x: Restrict I/O handler installers to system emulation target/s390x: Move has_work() from CPUClass to SysemuCPUOps target/sh4: Move has_work() from CPUClass to SysemuCPUOps target/sparc: Move has_work() from CPUClass to SysemuCPUOps target/tricore: Move has_work() from CPUClass to SysemuCPUOps target/xtensa: Move has_work() from CPUClass to SysemuCPUOps
cpus: Remove CPUClass::has_work() handler
include/hw/core/cpu.h | 26 ++++++++++---------------- include/hw/core/sysemu-cpu-ops.h | 4 ++++ include/hw/core/tcg-cpu-ops.h | 2 +- target/i386/cpu.h | 4 ++-- target/mips/internal.h | 4 ++-- target/riscv/internals.h | 4 +++- target/s390x/s390x-internal.h | 5 +++++ cpu-target.c | 4 ++++ hw/core/cpu-common.c | 6 ------ hw/core/cpu-system.c | 5 +++++ target/alpha/cpu.c | 4 +++- target/arm/cpu.c | 4 +++- target/avr/cpu.c | 2 +- target/hexagon/cpu.c | 6 ------ target/hppa/cpu.c | 4 +++- target/i386/cpu.c | 8 +++----- target/loongarch/cpu.c | 8 +++----- target/m68k/cpu.c | 4 +++- target/microblaze/cpu.c | 4 +++- target/mips/cpu.c | 4 +++- target/openrisc/cpu.c | 4 +++- target/ppc/cpu_init.c | 4 +++- target/riscv/cpu.c | 8 +++----- target/rx/cpu.c | 2 +- target/s390x/cpu-system.c | 18 ++++++++++++++++++ target/s390x/cpu.c | 18 ------------------ target/s390x/interrupt.c | 8 ++------ target/sh4/cpu.c | 4 ++-- target/sparc/cpu.c | 4 +++- target/tricore/cpu.c | 2 +- target/xtensa/cpu.c | 12 +++++------- 31 files changed, 102 insertions(+), 94 deletions(-)
Signature · 1 line
2.47.1
PATCH v2 1/24 cpus: Restrict cpu_has_work() to system emulation
This method is not used on user emulation, because there is always work to do there.
--- include/hw/core/cpu.h | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-)
include/hw/core/cpu.h +14 -14
@@ -748,6 +748,20 @@ int cpu_asidx_from_attrs(CPUState *cpu, MemTxAttrs attrs);*/ bool cpu_virtio_is_big_endian (CPUState *cpu); +/** +* cpu_has_work: +* @cpu: The vCPU to check. +* +* Checks whether the CPU has work to do. +* +* Returns: %true if the CPU has work, %false otherwise. +*/ +static inline bool cpu_has_work (CPUState *cpu) +{ +g_assert (cpu->cc->has_work); +return cpu->cc->has_work (cpu); +} +#endif /* CONFIG_USER_ONLY */ /**
@@ -814,20 +828,6 @@ CPUState *cpu_create(const char *typename);*/ const char *parse_cpu_option (const char *cpu_option); -/** -* cpu_has_work: -* @cpu: The vCPU to check. -* -* Checks whether the CPU has work to do. -* -* Returns: %true if the CPU has work, %false otherwise. -*/ -static inline bool cpu_has_work (CPUState *cpu) -{ -g_assert (cpu->cc->has_work); -return cpu->cc->has_work (cpu); -} -/** * qemu_cpu_is_self: * @cpu: The vCPU to check against.
Signature · 1 line
2.47.1
PATCH v2 2/24 cpus: Un-inline cpu_has_work()
In reply to Philippe Mathieu-DaudéIn order to expand cpu_has_work(), un-inline it.
--- include/hw/core/cpu.h | 6 +----- hw/core/cpu-system.c | 6 ++++++ 2 files changed, 7 insertions(+), 5 deletions(-)
include/hw/core/cpu.h +1 -5
@@ -756,11 +756,7 @@ bool cpu_virtio_is_big_endian(CPUState *cpu);* * Returns: %true if the CPU has work, %false otherwise. */ -static inline bool cpu_has_work (CPUState *cpu) -{ -g_assert (cpu->cc->has_work); -return cpu->cc->has_work (cpu); -} +bool cpu_has_work (CPUState *cpu);#endif /* CONFIG_USER_ONLY */
hw/core/cpu-system.c +6 -0
@@ -23,6 +23,12 @@#include "exec/tswap.h" #include "hw/core/sysemu-cpu-ops.h" +bool cpu_has_work (CPUState *cpu) +{ +g_assert (cpu->cc->has_work); +return cpu->cc->has_work (cpu); +} +bool cpu_paging_enabled (const CPUState *cpu) {if (cpu->cc->sysemu_ops->get_paging_enabled) {
Signature · 1 line
2.47.1
PATCH v2 3/24 cpus: Introduce SysemuCPUOps::has_work() handler
In reply to Philippe Mathieu-DaudéSysemuCPUOps::has_work() is similar to CPUClass::has_work(), but only exposed on system emulation.
--- include/hw/core/sysemu-cpu-ops.h | 4 ++++ include/hw/core/tcg-cpu-ops.h | 2 +- hw/core/cpu-system.c | 4 ++++ 3 files changed, 9 insertions(+), 1 deletion(-)
include/hw/core/sysemu-cpu-ops.h +4 -0
@@ -16,6 +16,10 @@* struct SysemuCPUOps: System operations specific to a CPU class */ typedef struct SysemuCPUOps { + /** + * @has_work: Callback for checking if there is work to do. + */ + bool (*has_work)(CPUState *cpu); /** * @get_memory_mapping: Callback for obtaining the memory mappings. */
include/hw/core/tcg-cpu-ops.h +1 -1
@@ -141,7 +141,7 @@ struct TCGCPUOps {* * This method must be provided. If the target does not need to * do anything special for halt, the same function used for its -* CPUClass::has_work method can be used here, as they have the +* SysemuCPUOps::has_work method can be used here, as they have the * same function signature. */ bool (*cpu_exec_halt)(CPUState *cpu);
hw/core/cpu-system.c +4 -0
@@ -25,6 +25,10 @@bool cpu_has_work (CPUState *cpu) { +if (cpu->cc->sysemu_ops->has_work) { +return cpu->cc->sysemu_ops->has_work (cpu); + } +g_assert (cpu->cc->has_work);return cpu->cc->has_work (cpu); }
Signature · 1 line
2.47.1
PATCH v2 4/24 target/alpha: Move has_work() from CPUClass to SysemuCPUOps
In reply to Philippe Mathieu-Daudé--- target/alpha/cpu.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
target/alpha/cpu.c +3 -1
@@ -63,6 +63,7 @@ static void alpha_restore_state_to_opc(CPUState *cs, } } +#ifndef CONFIG_USER_ONLY static bool alpha_cpu_has_work (CPUState *cs) {/* Here we are checking to see if the CPU should wake up from HALT.
@@ -77,6 +78,7 @@ static bool alpha_cpu_has_work(CPUState *cs) | CPU_INTERRUPT_SMP | CPU_INTERRUPT_MCHK); } +#endif /* !CONFIG_USER_ONLY */ static int alpha_cpu_mmu_index (CPUState *cs,bool ifetch) {
@@ -216,6 +218,7 @@ static void alpha_cpu_initfn(Object *obj)#include "hw/core/sysemu-cpu-ops.h" static const struct SysemuCPUOps alpha_sysemu_ops = { + .has_work = alpha_cpu_has_work, .get_phys_page_debug = alpha_cpu_get_phys_page_debug, };#endif
@@ -251,7 +254,6 @@ static void alpha_cpu_class_init(ObjectClass *oc, void *data) &acc->parent_realize); cc->class_by_name = alpha_cpu_class_by_name; - cc->has_work = alpha_cpu_has_work; cc->mmu_index = alpha_cpu_mmu_index; cc->dump_state = alpha_cpu_dump_state; cc->set_pc = alpha_cpu_set_pc;
Signature · 1 line
2.47.1
PATCH v2 5/24 target/arm: Move has_work() from CPUClass to SysemuCPUOps
In reply to Philippe Mathieu-Daudé--- target/arm/cpu.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
target/arm/cpu.c +3 -1
@@ -123,6 +123,7 @@ void arm_restore_state_to_opc(CPUState *cs, }#endif /* CONFIG_TCG */ +#ifndef CONFIG_USER_ONLY /* * With SCTLR_ELx.NMI == 0, IRQ with Superpriority is masked identically with * IRQ without Superpriority. Moreover, if the GIC is configured so that
@@ -141,6 +142,7 @@ static bool arm_cpu_has_work(CPUState *cs) | CPU_INTERRUPT_VFIQ | CPU_INTERRUPT_VIRQ | CPU_INTERRUPT_VSERR | CPU_INTERRUPT_EXITTB); } +#endif /* !CONFIG_USER_ONLY */ static int arm_cpu_mmu_index (CPUState *cs,bool ifetch) {
@@ -2671,6 +2673,7 @@ static const gchar *arm_gdb_arch_name(CPUState *cs)#include "hw/core/sysemu-cpu-ops.h" static const struct SysemuCPUOps arm_sysemu_ops = { + .has_work = arm_cpu_has_work, .get_phys_page_attrs_debug = arm_cpu_get_phys_page_attrs_debug, .asidx_from_attrs = arm_asidx_from_attrs, .write_elf32_note = arm_cpu_write_elf32_note,
@@ -2721,7 +2724,6 @@ static void arm_cpu_class_init(ObjectClass *oc, void *data) &acc->parent_phases); cc->class_by_name = arm_cpu_class_by_name; - cc->has_work = arm_cpu_has_work; cc->mmu_index = arm_cpu_mmu_index; cc->dump_state = arm_cpu_dump_state; cc->set_pc = arm_cpu_set_pc;
Signature · 1 line
2.47.1
PATCH v2 6/24 target/avr: Move has_work() from CPUClass to SysemuCPUOps
In reply to Philippe Mathieu-Daudé--- target/avr/cpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
target/avr/cpu.c +1 -1
@@ -200,6 +200,7 @@ static void avr_cpu_dump_state(CPUState *cs, FILE *f, int flags)#include "hw/core/sysemu-cpu-ops.h" static const struct SysemuCPUOps avr_sysemu_ops = { + .has_work = avr_cpu_has_work, .get_phys_page_debug = avr_cpu_get_phys_page_debug, };
@@ -232,7 +233,6 @@ static void avr_cpu_class_init(ObjectClass *oc, void *data) cc->class_by_name = avr_cpu_class_by_name; - cc->has_work = avr_cpu_has_work; cc->mmu_index = avr_cpu_mmu_index; cc->dump_state = avr_cpu_dump_state; cc->set_pc = avr_cpu_set_pc;
Signature · 1 line
2.47.1
PATCH v2 7/24 target/hexagon: Remove CPUClass:has_work() handler
In reply to Philippe Mathieu-DaudéRemove as unreachable code.
--- target/hexagon/cpu.c | 6 ------ 1 file changed, 6 deletions(-)
target/hexagon/cpu.c +0 -6
@@ -262,11 +262,6 @@ static void hexagon_cpu_synchronize_from_tb(CPUState *cs,cpu_env (cs)->gpr[HEX_REG_PC ] = tb->pc; } -static bool hexagon_cpu_has_work (CPUState *cs) -{ -return true; -} -static void hexagon_restore_state_to_opc (CPUState *cs,const TranslationBlock *tb,const uint64_t *data)
@@ -345,7 +340,6 @@ static void hexagon_cpu_class_init(ObjectClass *c, void *data) &mcc->parent_phases); cc->class_by_name = hexagon_cpu_class_by_name; - cc->has_work = hexagon_cpu_has_work; cc->dump_state = hexagon_dump_state; cc->set_pc = hexagon_cpu_set_pc; cc->get_pc = hexagon_cpu_get_pc;
Signature · 1 line
2.47.1
PATCH v2 8/24 target/hppa: Move has_work() from CPUClass to SysemuCPUOps
In reply to Philippe Mathieu-Daudé--- target/hppa/cpu.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
target/hppa/cpu.c +3 -1
@@ -125,10 +125,12 @@ static void hppa_restore_state_to_opc(CPUState *cs, env->psw_n =0 ; } +#ifndef CONFIG_USER_ONLY static bool hppa_cpu_has_work (CPUState *cs) {return cs->interrupt_request & (CPU_INTERRUPT_HARD |CPU_INTERRUPT_NMI ); } +#endif /* !CONFIG_USER_ONLY */ static int hppa_cpu_mmu_index (CPUState *cs,bool ifetch) {
@@ -231,6 +233,7 @@ static ObjectClass *hppa_cpu_class_by_name(const char *cpu_model)#include "hw/core/sysemu-cpu-ops.h" static const struct SysemuCPUOps hppa_sysemu_ops = { + .has_work = hppa_cpu_has_work, .get_phys_page_debug = hppa_cpu_get_phys_page_debug, };#endif
@@ -267,7 +270,6 @@ static void hppa_cpu_class_init(ObjectClass *oc, void *data) &acc->parent_phases); cc->class_by_name = hppa_cpu_class_by_name; - cc->has_work = hppa_cpu_has_work; cc->mmu_index = hppa_cpu_mmu_index; cc->dump_state = hppa_cpu_dump_state; cc->set_pc = hppa_cpu_set_pc;
Signature · 1 line
2.47.1
PATCH v2 9/24 target/i386: Move has_work() from CPUClass to SysemuCPUOps
In reply to Philippe Mathieu-DaudéMove has_work() from CPUClass to SysemuCPUOps,
restrict x86_cpu_pending_interrupt() to system.
--- target/i386/cpu.h | 4 ++-- target/i386/cpu.c | 8 +++----- 2 files changed, 5 insertions(+), 7 deletions(-)
target/i386/cpu.h +2 -2
@@ -2289,8 +2289,6 @@ struct X86CPUClass {extern const VMStateDescription vmstate_x86_cpu;#endif -int x86_cpu_pending_interrupt (CPUState *cs,int interrupt_request); -int x86_cpu_write_elf64_note (WriteCoreDumpFunction f,CPUState *cpu,int cpuid,DumpState *s); int x86_cpu_write_elf32_note(WriteCoreDumpFunction f, CPUState *cpu,
@@ -2313,6 +2311,8 @@ void x86_cpu_list(void);int cpu_x86_support_mca_broadcast (CPUX86State *env);#ifndef CONFIG_USER_ONLY +int x86_cpu_pending_interrupt (CPUState *cs,int interrupt_request); +hwaddr x86_cpu_get_phys_page_attrs_debug (CPUState *cpu,vaddr addr,MemTxAttrs *attrs);int cpu_get_pic_interrupt (CPUX86State *s);
target/i386/cpu.c +3 -5
@@ -8256,16 +8256,15 @@ static vaddr x86_cpu_get_pc(CPUState *cs)return cpu->env.eip + cpu->env.segs[R_CS ].base; } +#if !defined(CONFIG_USER_ONLY )int x86_cpu_pending_interrupt (CPUState *cs,int interrupt_request) {X86CPU *cpu =X86_CPU (cs);CPUX86State *env = &cpu->env; -#if !defined(CONFIG_USER_ONLY )if (interrupt_request &CPU_INTERRUPT_POLL ) {return CPU_INTERRUPT_POLL ; } -#endif if (interrupt_request &CPU_INTERRUPT_SIPI ) {return CPU_INTERRUPT_SIPI ; }
@@ -8286,14 +8285,12 @@ int x86_cpu_pending_interrupt(CPUState *cs, int interrupt_request) (env->eflags & IF_MASK && !(env->hflags & HF_INHIBIT_IRQ_MASK))))) {return CPU_INTERRUPT_HARD ; -#if !defined(CONFIG_USER_ONLY ) } else if (env->hflags2 & HF2_VGIF_MASK) {if ((interrupt_request &CPU_INTERRUPT_VIRQ ) && (env->eflags &IF_MASK ) && !(env->hflags &HF_INHIBIT_IRQ_MASK )) {return CPU_INTERRUPT_VIRQ ; } -#endif } }
@@ -8304,6 +8301,7 @@ static bool x86_cpu_has_work(CPUState *cs) {return x86_cpu_pending_interrupt (cs, cs->interrupt_request) !=0 ; } +#endif /* !CONFIG_USER_ONLY */ int x86_mmu_index_pl (CPUX86State *env,unsigned pl) {
@@ -8544,6 +8542,7 @@ static const Property x86_cpu_properties[] = {#include "hw/core/sysemu-cpu-ops.h" static const struct SysemuCPUOps i386_sysemu_ops = { + .has_work = x86_cpu_has_work, .get_memory_mapping = x86_cpu_get_memory_mapping, .get_paging_enabled = x86_cpu_get_paging_enabled, .get_phys_page_attrs_debug = x86_cpu_get_phys_page_attrs_debug,
@@ -8577,7 +8576,6 @@ static void x86_cpu_common_class_init(ObjectClass *oc, void *data) cc->class_by_name = x86_cpu_class_by_name; cc->parse_features = x86_cpu_parse_featurestr; - cc->has_work = x86_cpu_has_work; cc->mmu_index = x86_cpu_mmu_index; cc->dump_state = x86_cpu_dump_state; cc->set_pc = x86_cpu_set_pc;
Signature · 1 line
2.47.1
PATCH v2 10/24 target/loongarch: Move has_work() from CPUClass to SysemuCPUOps
In reply to Philippe Mathieu-Daudé--- target/loongarch/cpu.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
target/loongarch/cpu.c +3 -5
@@ -349,11 +349,9 @@ static void loongarch_restore_state_to_opc(CPUState *cs, }#endif /* CONFIG_TCG */ +#ifndef CONFIG_USER_ONLY static bool loongarch_cpu_has_work (CPUState *cs) { -#ifdef CONFIG_USER_ONLY -return true; -#else bool has_work = false; if ((cs->interrupt_request & CPU_INTERRUPT_HARD) &&
@@ -362,8 +360,8 @@ static bool loongarch_cpu_has_work(CPUState *cs) }return has_work; -#endif } +#endif /* !CONFIG_USER_ONLY */ static int loongarch_cpu_mmu_index (CPUState *cs,bool ifetch) {
@@ -835,6 +833,7 @@ static const TCGCPUOps loongarch_tcg_ops = {#include "hw/core/sysemu-cpu-ops.h" static const struct SysemuCPUOps loongarch_sysemu_ops = { + .has_work = loongarch_cpu_has_work, .write_elf64_note = loongarch_cpu_write_elf64_note, .get_phys_page_debug = loongarch_cpu_get_phys_page_debug, };
@@ -860,7 +859,6 @@ static void loongarch_cpu_class_init(ObjectClass *c, void *data) &lacc->parent_phases); cc->class_by_name = loongarch_cpu_class_by_name; - cc->has_work = loongarch_cpu_has_work; cc->mmu_index = loongarch_cpu_mmu_index; cc->dump_state = loongarch_cpu_dump_state; cc->set_pc = loongarch_cpu_set_pc;
Signature · 1 line
2.47.1
PATCH v2 11/24 target/m68k: Move has_work() from CPUClass to SysemuCPUOps
In reply to Philippe Mathieu-Daudé--- target/m68k/cpu.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
target/m68k/cpu.c +3 -1
@@ -51,10 +51,12 @@ static void m68k_restore_state_to_opc(CPUState *cs, } } +#ifndef CONFIG_USER_ONLY static bool m68k_cpu_has_work (CPUState *cs) {return cs->interrupt_request &CPU_INTERRUPT_HARD ; } +#endif /* !CONFIG_USER_ONLY */ static int m68k_cpu_mmu_index (CPUState *cs,bool ifetch) {
@@ -543,6 +545,7 @@ static const VMStateDescription vmstate_m68k_cpu = {#include "hw/core/sysemu-cpu-ops.h" static const struct SysemuCPUOps m68k_sysemu_ops = { + .has_work = m68k_cpu_has_work, .get_phys_page_debug = m68k_cpu_get_phys_page_debug, };#endif /* !CONFIG_USER_ONLY */
@@ -576,7 +579,6 @@ static void m68k_cpu_class_init(ObjectClass *c, void *data) &mcc->parent_phases); cc->class_by_name = m68k_cpu_class_by_name; - cc->has_work = m68k_cpu_has_work; cc->mmu_index = m68k_cpu_mmu_index; cc->dump_state = m68k_cpu_dump_state; cc->set_pc = m68k_cpu_set_pc;
Signature · 1 line
2.47.1
PATCH v2 12/24 target/microblaze: Move has_work() from CPUClass to SysemuCPUOps
In reply to Philippe Mathieu-Daudé--- target/microblaze/cpu.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
target/microblaze/cpu.c +3 -1
@@ -115,10 +115,12 @@ static void mb_restore_state_to_opc(CPUState *cs, cpu->env.iflags = data[1 ]; } +#ifndef CONFIG_USER_ONLY static bool mb_cpu_has_work (CPUState *cs) {return cs->interrupt_request & (CPU_INTERRUPT_HARD |CPU_INTERRUPT_NMI ); } +#endif /* !CONFIG_USER_ONLY */ static int mb_cpu_mmu_index (CPUState *cs,bool ifetch) {
@@ -415,6 +417,7 @@ static ObjectClass *mb_cpu_class_by_name(const char *cpu_model)#include "hw/core/sysemu-cpu-ops.h" static const struct SysemuCPUOps mb_sysemu_ops = { + .has_work = mb_cpu_has_work, .get_phys_page_attrs_debug = mb_cpu_get_phys_page_attrs_debug, };#endif
@@ -450,7 +453,6 @@ static void mb_cpu_class_init(ObjectClass *oc, void *data) &mcc->parent_phases); cc->class_by_name = mb_cpu_class_by_name; - cc->has_work = mb_cpu_has_work; cc->mmu_index = mb_cpu_mmu_index; cc->dump_state = mb_cpu_dump_state; cc->set_pc = mb_cpu_set_pc;
Signature · 1 line
2.47.1
PATCH v2 13/24 target/mips: Move has_work() from CPUClass to SysemuCPUOps
In reply to Philippe Mathieu-DaudéMove has_work() from CPUClass to SysemuCPUOps andcpu_mips_hw_interrupts_enabled() to system.
--- target/mips/internal.h | 4 ++-- target/mips/cpu.c | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-)
target/mips/internal.h +2 -2
@@ -162,8 +162,6 @@ void cpu_mips_store_cause(CPUMIPSState *env, target_ulong val);extern const VMStateDescription vmstate_mips_cpu; -#endif /* !CONFIG_USER_ONLY */ -static inline bool cpu_mips_hw_interrupts_enabled (CPUMIPSState *env) { return (env->CP0_Status & (1 << CP0St_IE)) &&
@@ -206,6 +204,8 @@ static inline bool cpu_mips_hw_interrupts_pending(CPUMIPSState *env) return r; } +#endif /* !CONFIG_USER_ONLY */ +void msa_reset (CPUMIPSState *env);/* cp0_timer.c */
target/mips/cpu.c +3 -1
@@ -132,6 +132,7 @@ static vaddr mips_cpu_get_pc(CPUState *cs)return cpu->env.active_tc.PC; } +#if !defined(CONFIG_USER_ONLY )static bool mips_cpu_has_work (CPUState *cs) {CPUMIPSState *env =cpu_env (cs);
@@ -177,6 +178,7 @@ static bool mips_cpu_has_work(CPUState *cs) }return has_work; } +#endif /* !CONFIG_USER_ONLY */ static int mips_cpu_mmu_index (CPUState *cs,bool ifunc) {
@@ -534,6 +536,7 @@ static ObjectClass *mips_cpu_class_by_name(const char *cpu_model)#include "hw/core/sysemu-cpu-ops.h" static const struct SysemuCPUOps mips_sysemu_ops = { + .has_work = mips_cpu_has_work, .get_phys_page_debug = mips_cpu_get_phys_page_debug, .legacy_vmsd = &vmstate_mips_cpu, };
@@ -577,7 +580,6 @@ static void mips_cpu_class_init(ObjectClass *c, void *data) &mcc->parent_phases); cc->class_by_name = mips_cpu_class_by_name; - cc->has_work = mips_cpu_has_work; cc->mmu_index = mips_cpu_mmu_index; cc->dump_state = mips_cpu_dump_state; cc->set_pc = mips_cpu_set_pc;
Signature · 1 line
2.47.1
PATCH v2 14/24 target/openrisc: Move has_work() from CPUClass to SysemuCPUOps
In reply to Philippe Mathieu-Daudé--- target/openrisc/cpu.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
target/openrisc/cpu.c +3 -1
@@ -63,11 +63,13 @@ static void openrisc_restore_state_to_opc(CPUState *cs, } } +#ifndef CONFIG_USER_ONLY static bool openrisc_cpu_has_work (CPUState *cs) {return cs->interrupt_request & (CPU_INTERRUPT_HARD |CPU_INTERRUPT_TIMER ); } +#endif /* !CONFIG_USER_ONLY */ static int openrisc_cpu_mmu_index (CPUState *cs,bool ifetch) {
@@ -228,6 +230,7 @@ static void openrisc_any_initfn(Object *obj)#include "hw/core/sysemu-cpu-ops.h" static const struct SysemuCPUOps openrisc_sysemu_ops = { + .has_work = openrisc_cpu_has_work, .get_phys_page_debug = openrisc_cpu_get_phys_page_debug, };#endif
@@ -261,7 +264,6 @@ static void openrisc_cpu_class_init(ObjectClass *oc, void *data) &occ->parent_phases); cc->class_by_name = openrisc_cpu_class_by_name; - cc->has_work = openrisc_cpu_has_work; cc->mmu_index = openrisc_cpu_mmu_index; cc->dump_state = openrisc_cpu_dump_state; cc->set_pc = openrisc_cpu_set_pc;
Signature · 1 line
2.47.1
PATCH v2 15/24 target/ppc: Move has_work() from CPUClass to SysemuCPUOps
In reply to Philippe Mathieu-Daudé--- target/ppc/cpu_init.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
target/ppc/cpu_init.c +3 -1
@@ -7177,10 +7177,12 @@ static void ppc_restore_state_to_opc(CPUState *cs, }#endif /* CONFIG_TCG */ +#ifndef CONFIG_USER_ONLY static bool ppc_cpu_has_work (CPUState *cs) {return cs->interrupt_request &CPU_INTERRUPT_HARD ; } +#endif /* !CONFIG_USER_ONLY */ static int ppc_cpu_mmu_index (CPUState *cs,bool ifetch) {
@@ -7418,6 +7420,7 @@ static void ppc_disas_set_info(CPUState *cs, disassemble_info *info)#include "hw/core/sysemu-cpu-ops.h" static const struct SysemuCPUOps ppc_sysemu_ops = { + .has_work = ppc_cpu_has_work, .get_phys_page_debug = ppc_cpu_get_phys_page_debug, .write_elf32_note = ppc32_cpu_write_elf32_note, .write_elf64_note = ppc64_cpu_write_elf64_note,
@@ -7469,7 +7472,6 @@ static void ppc_cpu_class_init(ObjectClass *oc, void *data) &pcc->parent_phases); cc->class_by_name = ppc_cpu_class_by_name; - cc->has_work = ppc_cpu_has_work; cc->mmu_index = ppc_cpu_mmu_index; cc->dump_state = ppc_cpu_dump_state; cc->set_pc = ppc_cpu_set_pc;
Signature · 1 line
2.47.1
PATCH v2 16/24 target/riscv: Move has_work() from CPUClass to SysemuCPUOps
In reply to Philippe Mathieu-Daudé---
Cc: [email protected]
--- target/riscv/internals.h | 4 +++- target/riscv/cpu.c | 8 +++----- 2 files changed, 6 insertions(+), 6 deletions(-)
target/riscv/internals.h +3 -1
@@ -142,8 +142,10 @@ static inline float16 check_nanbox_h(CPURISCVState *env, uint64_t f) } } -/* Our implementation of CPUClass::has_work */ +#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/riscv/cpu.c +3 -5
@@ -1010,9 +1010,9 @@ static vaddr riscv_cpu_get_pc(CPUState *cs)return env->pc; } +#ifndef CONFIG_USER_ONLY bool riscv_cpu_has_work (CPUState *cs) { -#ifndef CONFIG_USER_ONLY RISCVCPU *cpu =RISCV_CPU (cs);CPURISCVState *env = &cpu->env;/*
@@ -1022,10 +1022,8 @@ bool riscv_cpu_has_work(CPUState *cs)return riscv_cpu_all_pending (env) !=0 ||riscv_cpu_sirq_pending (env) !=RISCV_EXCP_NONE || riscv_cpu_vsirq_pending(env) != RISCV_EXCP_NONE; -#else -return true; -#endif } +#endif /* !CONFIG_USER_ONLY */ static int riscv_cpu_mmu_index (CPUState *cs,bool ifetch) {
@@ -2912,6 +2910,7 @@ static int64_t riscv_get_arch_id(CPUState *cs)#include "hw/core/sysemu-cpu-ops.h" static const struct SysemuCPUOps riscv_sysemu_ops = { + .has_work = riscv_cpu_has_work, .get_phys_page_debug = riscv_cpu_get_phys_page_debug, .write_elf64_note = riscv_cpu_write_elf64_note, .write_elf32_note = riscv_cpu_write_elf32_note,
@@ -2933,7 +2932,6 @@ static void riscv_cpu_common_class_init(ObjectClass *c, void *data) &mcc->parent_phases); cc->class_by_name = riscv_cpu_class_by_name; - cc->has_work = riscv_cpu_has_work; cc->mmu_index = riscv_cpu_mmu_index; cc->dump_state = riscv_cpu_dump_state; cc->set_pc = riscv_cpu_set_pc;
Signature · 1 line
2.47.1
Re: [PATCH v2 16/24] target/riscv: Move has_work() from CPUClass to SysemuCPUOps
Quoted 7 lines · Philippe Mathieu-Daudé
Signed-off-by Philippe Mathieu-Daudé<[email protected]>---
Cc:[email protected]--- target/riscv/internals.h | 4 +++- target/riscv/cpu.c | 8 +++----- 2 files changed, 6 insertions(+), 6 deletions(-)
r~
PATCH v2 17/24 target/rx: Move has_work() from CPUClass to SysemuCPUOps
In reply to Philippe Mathieu-Daudé--- target/rx/cpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
target/rx/cpu.c +1 -1
@@ -187,6 +187,7 @@ static void rx_cpu_init(Object *obj)#include "hw/core/sysemu-cpu-ops.h" static const struct SysemuCPUOps rx_sysemu_ops = { + .has_work = rx_cpu_has_work, .get_phys_page_debug = rx_cpu_get_phys_page_debug, };
@@ -217,7 +218,6 @@ static void rx_cpu_class_init(ObjectClass *klass, void *data) &rcc->parent_phases); cc->class_by_name = rx_cpu_class_by_name; - cc->has_work = rx_cpu_has_work; cc->mmu_index = riscv_cpu_mmu_index; cc->dump_state = rx_cpu_dump_state; cc->set_pc = rx_cpu_set_pc;
Signature · 1 line
2.47.1
PATCH v2 18/24 target/s390x: Restrict I/O handler installers to system emulation
In reply to Philippe Mathieu-Daudé--- target/s390x/s390x-internal.h | 2 ++ 1 file changed, 2 insertions(+)
target/s390x/s390x-internal.h +2 -0
@@ -356,6 +356,7 @@ void cpu_inject_stop(S390CPU *cpu);/* ioinst.c */ +#ifndef CONFIG_USER_ONLY void ioinst_handle_xsch (S390CPU *cpu,uint64_t reg1,uintptr_t ra);void ioinst_handle_csch (S390CPU *cpu,uint64_t reg1,uintptr_t ra);void ioinst_handle_hsch (S390CPU *cpu,uint64_t reg1,uintptr_t ra);
@@ -373,6 +374,7 @@ void ioinst_handle_schm(S390CPU *cpu, uint64_t reg1, uint64_t reg2,void ioinst_handle_rsch (S390CPU *cpu,uint64_t reg1,uintptr_t ra);void ioinst_handle_rchp (S390CPU *cpu,uint64_t reg1,uintptr_t ra);void ioinst_handle_sal (S390CPU *cpu,uint64_t reg1,uintptr_t ra); +#endif /* CONFIG_USER_ONLY */ /* mem_helper.c */
Signature · 1 line
2.47.1
PATCH v2 19/24 target/s390x: Move has_work() from CPUClass to SysemuCPUOps
In reply to Philippe Mathieu-DaudéMove has_work() from CPUClass to SysemuCPUOps, move s390_cpu_has_work() to cpu-system.c so it is only build for system emulation binaries, restrict functions not used anymore on user emulation in interrupt.c.
--- target/s390x/s390x-internal.h | 3 +++ target/s390x/cpu-system.c | 18 ++++++++++++++++++ target/s390x/cpu.c | 18 ------------------ target/s390x/interrupt.c | 8 ++------ 4 files changed, 23 insertions(+), 24 deletions(-)
target/s390x/s390x-internal.h +3 -0
@@ -245,6 +245,7 @@ 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);#else static inline unsigned int s390_cpu_halt (S390CPU *cpu)
@@ -341,6 +342,7 @@ void cpu_unmap_lowcore(LowCore *lowcore);/* interrupt.c */ void trigger_pgm_exception (CPUS390XState *env,uint32_t code); +#ifndef CONFIG_USER_ONLY void cpu_inject_clock_comparator (S390CPU *cpu);void cpu_inject_cpu_timer (S390CPU *cpu);void cpu_inject_emergency_signal (S390CPU *cpu,uint16_t src_cpu_addr);
@@ -353,6 +355,7 @@ bool s390_cpu_has_restart_int(S390CPU *cpu);bool s390_cpu_has_stop_int (S390CPU *cpu);void cpu_inject_restart (S390CPU *cpu);void cpu_inject_stop (S390CPU *cpu); +#endif /* CONFIG_USER_ONLY */ /* ioinst.c */
target/s390x/cpu-system.c +18 -0
@@ -39,6 +39,23 @@#include "system/tcg.h" #include "hw/core/sysemu-cpu-ops.h" +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 ) { +return false; + } + +if (!(cs->interrupt_request &CPU_INTERRUPT_HARD )) { +return false; + } + +return s390_cpu_has_int (cpu); +} +/* S390CPUClass::load_normal() */ static void s390_cpu_load_normal (CPUState *s) {
@@ -158,6 +175,7 @@ void s390_cpu_finalize(Object *obj) }static const struct SysemuCPUOps s390_sysemu_ops = { + .has_work = s390_cpu_has_work, .get_phys_page_debug = s390_cpu_get_phys_page_debug, .get_crash_info = s390_cpu_get_crash_info, .write_elf64_note = s390_cpu_write_elf64_note,
target/s390x/cpu.c +0 -18
@@ -126,23 +126,6 @@ static vaddr s390_cpu_get_pc(CPUState *cs)return cpu->env.psw.addr; } -static 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 ) { -return false; - } - -if (!(cs->interrupt_request &CPU_INTERRUPT_HARD )) { -return false; - } - -return s390_cpu_has_int (cpu); -} -static int s390x_cpu_mmu_index (CPUState *cs,bool ifetch) {return s390x_env_mmu_index (cpu_env (cs), ifetch);
@@ -394,7 +377,6 @@ static void s390_cpu_class_init(ObjectClass *oc, void *data) &scc->parent_phases); cc->class_by_name = s390_cpu_class_by_name, - cc->has_work = s390_cpu_has_work; cc->mmu_index = s390x_cpu_mmu_index; cc->dump_state = s390_cpu_dump_state; cc->query_cpu_fast = s390_query_cpu_fast;
target/s390x/interrupt.c +2 -6
@@ -30,6 +30,7 @@ void trigger_pgm_exception(CPUS390XState *env, uint32_t code)/* env->int_pgm_ilen is already set, or will be set during unwinding */ } +#if !defined(CONFIG_USER_ONLY )void s390_program_interrupt (CPUS390XState *env,uint32_t code,uintptr_t ra) {if (kvm_enabled ()) {
@@ -41,7 +42,6 @@ void s390_program_interrupt(CPUS390XState *env, uint32_t code, uintptr_t ra) } } -#if !defined(CONFIG_USER_ONLY )void cpu_inject_clock_comparator (S390CPU *cpu) {CPUS390XState *env = &cpu->env;
@@ -225,11 +225,9 @@ bool s390_cpu_has_stop_int(S390CPU *cpu)return env->pending_int &INTERRUPT_STOP ; } -#endif bool s390_cpu_has_int (S390CPU *cpu) { -#ifndef CONFIG_USER_ONLY if (!tcg_enabled ()) {return false; }
@@ -238,7 +236,5 @@ bool s390_cpu_has_int(S390CPU *cpu)s390_cpu_has_io_int (cpu) ||s390_cpu_has_restart_int (cpu) || s390_cpu_has_stop_int(cpu); -#else -return false; -#endif } +#endif /* !CONFIG_USER_ONLY */
Signature · 1 line
2.47.1
PATCH v2 20/24 target/sh4: Move has_work() from CPUClass to SysemuCPUOps
In reply to Philippe Mathieu-Daudé--- target/sh4/cpu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
target/sh4/cpu.c +2 -2
@@ -82,12 +82,12 @@ static bool superh_io_recompile_replay_branch(CPUState *cs, }return false; } -#endif static bool superh_cpu_has_work (CPUState *cs) {return cs->interrupt_request &CPU_INTERRUPT_HARD ; } +#endif /* !CONFIG_USER_ONLY */ static int sh4_cpu_mmu_index (CPUState *cs,bool ifetch) {
@@ -243,6 +243,7 @@ static const VMStateDescription vmstate_sh_cpu = {#include "hw/core/sysemu-cpu-ops.h" static const struct SysemuCPUOps sh4_sysemu_ops = { + .has_work = superh_cpu_has_work, .get_phys_page_debug = superh_cpu_get_phys_page_debug, };#endif
@@ -279,7 +280,6 @@ static void superh_cpu_class_init(ObjectClass *oc, void *data) &scc->parent_phases); cc->class_by_name = superh_cpu_class_by_name; - cc->has_work = superh_cpu_has_work; cc->mmu_index = sh4_cpu_mmu_index; cc->dump_state = superh_cpu_dump_state; cc->set_pc = superh_cpu_set_pc;
Signature · 1 line
2.47.1
PATCH v2 21/24 target/sparc: Move has_work() from CPUClass to SysemuCPUOps
In reply to Philippe Mathieu-Daudé--- target/sparc/cpu.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
target/sparc/cpu.c +3 -1
@@ -776,11 +776,13 @@ static void sparc_restore_state_to_opc(CPUState *cs, } } +#ifndef CONFIG_USER_ONLY static bool sparc_cpu_has_work (CPUState *cs) {return (cs->interrupt_request &CPU_INTERRUPT_HARD ) &&cpu_interrupts_enabled (cpu_env (cs)); } +#endif /* !CONFIG_USER_ONLY */ static int sparc_cpu_mmu_index (CPUState *cs,bool ifetch) {
@@ -986,6 +988,7 @@ static const Property sparc_cpu_properties[] = {#include "hw/core/sysemu-cpu-ops.h" static const struct SysemuCPUOps sparc_sysemu_ops = { + .has_work = sparc_cpu_has_work, .get_phys_page_debug = sparc_cpu_get_phys_page_debug, .legacy_vmsd = &vmstate_sparc_cpu, };
@@ -1027,7 +1030,6 @@ static void sparc_cpu_class_init(ObjectClass *oc, void *data) cc->class_by_name = sparc_cpu_class_by_name; cc->parse_features = sparc_cpu_parse_features; - cc->has_work = sparc_cpu_has_work; cc->mmu_index = sparc_cpu_mmu_index; cc->dump_state = sparc_cpu_dump_state;#if !defined(TARGET_SPARC64 ) && !defined(CONFIG_USER_ONLY )
Signature · 1 line
2.47.1
PATCH v2 22/24 target/tricore: Move has_work() from CPUClass to SysemuCPUOps
In reply to Philippe Mathieu-Daudé--- target/tricore/cpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
target/tricore/cpu.c +1 -1
@@ -165,6 +165,7 @@ static bool tricore_cpu_exec_interrupt(CPUState *cs, int interrupt_request)#include "hw/core/sysemu-cpu-ops.h" static const struct SysemuCPUOps tricore_sysemu_ops = { + .has_work = tricore_cpu_has_work, .get_phys_page_debug = tricore_cpu_get_phys_page_debug, };
@@ -193,7 +194,6 @@ static void tricore_cpu_class_init(ObjectClass *c, void *data)resettable_class_set_parent_phases (rc,NULL , tricore_cpu_reset_hold,NULL , &mcc->parent_phases); cc->class_by_name = tricore_cpu_class_by_name; - cc->has_work = tricore_cpu_has_work; cc->mmu_index = tricore_cpu_mmu_index; cc->gdb_read_register = tricore_cpu_gdb_read_register;
Signature · 1 line
2.47.1
PATCH v2 23/24 target/xtensa: Move has_work() from CPUClass to SysemuCPUOps
In reply to Philippe Mathieu-DaudéMove has_work() from CPUClass to SysemuCPUOps, simplifying xtensa_cpu_has_work() by directly using CPU env.
--- target/xtensa/cpu.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-)
target/xtensa/cpu.c +5 -7
@@ -63,16 +63,14 @@ static void xtensa_restore_state_to_opc(CPUState *cs, cpu->env.pc = data[0 ]; } +#ifndef CONFIG_USER_ONLY static bool xtensa_cpu_has_work (CPUState *cs) { -#ifndef CONFIG_USER_ONLY -XtensaCPU *cpu =XTENSA_CPU (cs); +CPUXtensaState *env =cpu_env (cs); -return !cpu->env.runstall && cpu->env.pending_irq_level; -#else -return true; -#endif +return !env->runstall && env->pending_irq_level; } +#endif /* !CONFIG_USER_ONLY */ static int xtensa_cpu_mmu_index (CPUState *cs,bool ifetch) {
@@ -224,6 +222,7 @@ static const VMStateDescription vmstate_xtensa_cpu = {#include "hw/core/sysemu-cpu-ops.h" static const struct SysemuCPUOps xtensa_sysemu_ops = { + .has_work = xtensa_cpu_has_work, .get_phys_page_debug = xtensa_cpu_get_phys_page_debug, };#endif
@@ -261,7 +260,6 @@ static void xtensa_cpu_class_init(ObjectClass *oc, void *data) &xcc->parent_phases); cc->class_by_name = xtensa_cpu_class_by_name; - cc->has_work = xtensa_cpu_has_work; cc->mmu_index = xtensa_cpu_mmu_index; cc->dump_state = xtensa_cpu_dump_state; cc->set_pc = xtensa_cpu_set_pc;
Signature · 1 line
2.47.1
PATCH v2 24/24 cpus: Remove CPUClass::has_work() handler
In reply to Philippe Mathieu-DaudéAll handlers have been converted to SysemuCPUOps::has_work(). Remove CPUClass::has_work along with cpu_common_has_work() and simplify cpu_has_work(), making SysemuCPUOps::has_work handler mandatory.
--- include/hw/core/cpu.h | 2 -- include/hw/core/sysemu-cpu-ops.h | 2 +- cpu-target.c | 4 ++++ hw/core/cpu-common.c | 6 ------ hw/core/cpu-system.c | 7 +------ 5 files changed, 6 insertions(+), 15 deletions(-)
include/hw/core/cpu.h +0 -2
@@ -104,7 +104,6 @@ struct SysemuCPUOps;* instantiatable CPU type. * @parse_features: Callback to parse command line arguments. * @reset_dump_flags: #CPUDumpFlags to use for reset logging. -* @has_work: Callback for checking if there is work to do. * @mmu_index: Callback for choosing softmmu mmu index; * may be used internally by memory_rw_debug without TCG. * @memory_rw_debug: Callback for GDB memory access.
@@ -151,7 +150,6 @@ struct CPUClass {ObjectClass *(*class_by_name)(const char *cpu_model);void (*parse_features)(const char *typename,char *str,Error **errp); -bool (*has_work)(CPUState *cpu);int (*mmu_index)(CPUState *cpu,bool ifetch);int (*memory_rw_debug)(CPUState *cpu,vaddr addr,uint8_t *buf,int len,bool is_write);
include/hw/core/sysemu-cpu-ops.h +1 -1
@@ -19,7 +19,7 @@ typedef struct SysemuCPUOps {/** * @has_work: Callback for checking if there is work to do. */ -bool (*has_work)(CPUState *cpu); +bool (*has_work)(CPUState *cpu);/* MANDATORY NON-NULL */ /** * @get_memory_mapping: Callback for obtaining the memory mappings. */
cpu-target.c +4 -0
@@ -217,6 +217,10 @@ void cpu_class_init_props(DeviceClass *dc) {#ifndef CONFIG_USER_ONLY ObjectClass *oc =OBJECT_CLASS (dc); +const CPUClass *cc =CPU_CLASS (OBJECT_CLASS (oc)); + +/* Check mandatory SysemuCPUOps handlers */ +g_assert (cc->sysemu_ops->has_work);/* * We can't use DEFINE_PROP_BOOL in the Property array for this
hw/core/cpu-common.c +0 -6
@@ -134,11 +134,6 @@ static void cpu_common_reset_hold(Object *obj, ResetType type)cpu_exec_reset_hold (cpu); } -static bool cpu_common_has_work (CPUState *cs) -{ -return false; -} -ObjectClass *cpu_class_by_name (const char *typename,const char *cpu_model) {ObjectClass *oc;
@@ -304,7 +299,6 @@ static void cpu_common_class_init(ObjectClass *klass, void *data) k->parse_features = cpu_common_parse_features; k->get_arch_id = cpu_common_get_arch_id; - k->has_work = cpu_common_has_work; k->gdb_read_register = cpu_common_gdb_read_register; k->gdb_write_register = cpu_common_gdb_write_register;set_bit (DEVICE_CATEGORY_CPU , dc->categories);
hw/core/cpu-system.c +1 -6
@@ -25,12 +25,7 @@bool cpu_has_work (CPUState *cpu) { -if (cpu->cc->sysemu_ops->has_work) { -return cpu->cc->sysemu_ops->has_work (cpu); - } - -g_assert (cpu->cc->has_work); -return cpu->cc->has_work (cpu); +return cpu->cc->sysemu_ops->has_work (cpu); }bool cpu_paging_enabled (const CPUState *cpu)
Signature · 1 line
2.47.1
Re: [PATCH v2 24/24] cpus: Remove CPUClass::has_work() handler
Quoted 21 lines · Philippe Mathieu-Daudé
All handlers have been converted to
SysemuCPUOps::has_work(). RemoveCPUClass::has_workalong withcpu_common_has_work()and simplifycpu_has_work(), makingSysemuCPUOps::has_workhandler mandatory.Reviewed-by Richard Henderson <[email protected]>Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- include/hw/core/cpu.h | 2 -- include/hw/core/sysemu-cpu-ops.h | 2 +- cpu-target.c | 4 ++++ hw/core/cpu-common.c | 6 ------ hw/core/cpu-system.c | 7 +------ 5 files changed, 6 insertions(+), 15 deletions(-)cpu-target.c +0
-0
cpu-target.c void cpu_class_init_props(DeviceClass *dc) · line 223
Quoted 7 lines
cpu-target.c +4
-0@@ -217,6 +217,10 @@ void cpu_class_init_props(DeviceClass *dc) {#ifndef CONFIG_USER_ONLY ObjectClass *oc =OBJECT_CLASS (dc); +const CPUClass *cc =CPU_CLASS (OBJECT_CLASS (oc)); + +/* Check mandatory SysemuCPUOps handlers */ +g_assert (cc->sysemu_ops->has_work);
Thinking about it again, this function is about properties, thus this isn't the correct place to do that check. I'll revisit.
Quoted 3 lines
cpu-target.c +0
-0/* * We can't use DEFINE_PROP_BOOL in the Property array for this