cpu: Move host_tid field to CPUState

Change cpu_index() argument to CPUState now that it is no longer used.

Signed-off-by: Andreas Färber <afaerber@suse.de>
cpu: Move running field to CPUState

Pass CPUState to cpu_exec_{start,end}() functions.

Signed-off-by: Andreas Färber <afaerber@suse.de>
cpu: Move exit_request field to CPUState

Since it was located before breakpoints field, it needs to be reset.

Signed-off-by: Andreas Färber <afaerber@suse.de>
cpu: Move current_tb field to CPUState

Change vapic_report_tpr_access() argument to CPUState. This also
resolves the use of void* for cpu.h independence.
Change vAPIC patch_instruction() argument to X86CPU.

Signed-off-by: Andreas Färber <afaerber@suse.de>
cputlb: Change cpu_unlink_tb() argument to CPUState

CPUArchState is no longer needed.

Signed-off-by: Andreas Färber <afaerber@suse.de>
kvm: Change kvm_on_sigbus_vcpu() argument to CPUState

Since commit 20d695a9254c1b086a456d3b79a3c311236643ba (kvm: Pass
CPUState to kvm_arch_*) CPUArchState is no longer needed.

Allows to change qemu_kvm_eat_signals() argument as well.

Signed-off-by: Andreas Färber <afaerber@suse.de>
cpu: Add CPUArchState pointer to CPUState

The target-specific ENV_GET_CPU() macros have allowed us to navigate
from CPUArchState to CPUState. The reverse direction was not supported.
Avoid introducing CPU_GET_ENV() macros by initializing an untyped
pointer that is initialized in derived instance_init functions.

The field may not be called "env" due to it being poisoned.

Signed-off-by: Andreas Färber <afaerber@suse.de>
cpu-defs.h: Drop qemu_work_item prototype

Commit c64ca8140e9c21cd0d44c10fbe1247cb4ade8e6e (cpu: Move
queued_work_{first,last} to CPUState) moved the qemu_work_item fields
away. Clean up the now unused prototype.

Signed-off-by: Andreas Färber <afaerber@suse.de>
target-i386: Drop version 5 CPU VMState support

Version 5 contained the halted field, that we are about to move from
CPUX86State to CPUState. To avoid inventing new VMSTATE macros for
calculating a negative offset from CPUX86State to the field in CPUState,
rather bump the minimum version from 3 to 6. We're at 12 currently.

Suggested-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
Reviewed-by: Juan Quintela <quintela@redhat.com>
target-openrisc: Clean up double QOM casts

Instead of calling openrisc_env_get_cpu(), casting to CPU() and casting
to OPENRISC_CPU() just call openrisc_env_get_cpu() directly.

Signed-off-by: Andreas Färber <afaerber@suse.de>
cpu: Move halted and interrupt_request fields to CPUState

Both fields are used in VMState, thus need to be moved together.

Signed-off-by: Andreas Färber <afaerber@suse.de>
exec: Change cpu_reset_interrupt() argument to CPUState

Move it to qom/cpu.c to avoid build failures depending on include order
of cpu-qom.h and exec/cpu-all.h.

Change opaques of various ..._irq_handler() functions to the
appropriate CPU type to facilitate using cpu_reset_interrupt().

Fix Coding Style issues while at it (missing braces, indentation).

Signed-off-by: Andreas Färber <afaerber@suse.de>
target-m68k: Return M68kCPU from cpu_m68k_init()

Turn cpu_init() into a static inline function for backwards
compatibility.

Signed-off-by: Andreas Färber <afaerber@suse.de>
mcf5206: Change mcf5206_init() argument to M68kCPU

Store it in m5206_mbar_state. Prepares for passing M68kCPU to
m68k_set_irq_level().

Signed-off-by: Andreas Färber <afaerber@suse.de>
mcf_intc: Change mcf_intc_init() argument to M68kCPU

Store it in mcf_intc_state.
Prepares for passing it to m68k_set_irq_level().

Signed-off-by: Andreas Färber <afaerber@suse.de>
target-m68k: Change m68k_set_irq_level() argument to M68kCPU

Simplifies use of cpu_reset_interrupt() et al.

Signed-off-by: Andreas Färber <afaerber@suse.de>
target-i386: Change cpu_x86_set_a20() argument to X86CPU

Prepares for cpu_interrupt() changing argument to CPUState.

Signed-off-by: Andreas Färber <afaerber@suse.de>
ppc405_uc: Change ppc40x_chip_reset() argument to PowerPCCPU

Prepares for cpu_interrupt() changing argument to CPUState.

Signed-off-by: Andreas Färber <afaerber@suse.de>
ppc405_uc: Pass PowerPCCPU to ppc40x_core_reset()

Prepares for changing cpu_interrupt() argument to CPUState.

Signed-off-by: Andreas Färber <afaerber@suse.de>
ppc405_uc: Pass PowerPCCPU to ppc40x_system_request() too

Signed-off-by: Andreas Färber <afaerber@suse.de>