target-cris/helper.c: Update Coding Style

Reindent, add missing braces and drop/adjust whitespace.

Prepares for CPUArchState-to-CPUState field movements in
cpu_cris_handle_mmu_fault(), do_interruptv10() and do_interrupt().
The remaining functions were so minor that they can be fixed in one go.

Signed-off-by: Andreas Färber <afaerber@suse.de>
target-s390x: Clean up cpu_inject_*() signatures

Despite cautioning that S390CPU is needed for upcoming CPUState
refactorings, commit 5d69c547d947798cba92d836d06f6e017ba2b19d (s390:
I/O interrupt and machine check injection.) added functions
cpu_inject_io() and cpu_inject_crw_mchk() with CPUS390XState argument,
claiming consistency with cpu_inject_ext().

This complicates making cpu_interrupt() take a CPUState even more and it
required to pass &cpu->env from some S390CPU-aware call sites already,
creating inconsistency elsewhere. Address that.

This also eliminates the need for CPUS390XState in s390_virtio_irq().

Cc: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
target-s390x: Pass S390CPU to s390_{add,del}_running_cpu()

This prepares for moving the halted field to CPUState.
Most call sites can already supply S390CPU, for some env becomes unused.

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: Pass M68kCPU to mcf5206_init()

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: Pass M68kCPU to mcf_intc_init()

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: Pass M68kCPU to m68k_set_irq_level()

Simplifies use of cpu_reset_interrupt() et al.

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

Change gdbstub's cpu_index() argument to CPUState now that CPUArchState
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

Explictly NULL it on CPU reset since it was located before breakpoints.

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: Pass CPUState to cpu_unlink_tb()

CPUArchState is no longer needed.

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>
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>
cpu: Move halted and interrupt_request fields to CPUState

Both fields are used in VMState, thus need to be moved together.
Explicitly zero them on reset since they were located before
breakpoints.

Pass PowerPCCPU to kvmppc_handle_halt().

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

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>
cpu: Pass CPUState to cpu_interrupt()

Move it to qom/cpu.h to avoid issues with include order.

Change pc_acpi_smi_interrupt() opaque to X86CPU.

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