cpu: Add CPUArchState pointer to CPUState
The target-specific ENV_GET_CPU() macros have allowed us to navigatefrom CPUArchState to CPUState. The reverse direction was not supported.Avoid introducing CPU_GET_ENV() macros by initializing an untypedpointer that is initialized in derived instance_init functions....
target-s390x: Drop unused cpu_s390x_close() prototype
It was never implemented.
Signed-off-by: Andreas Färber <afaerber@suse.de>
target-s390x: Move TCG initialization to S390CPU initfn
Ensures that a QOM-created S390CPU is usable.
Acked-by: Richard Henderson <rth@twiddle.net>Signed-off-by: Andreas Färber <afaerber@suse.de>
target-s390x: Introduce QOM realizefn for S390CPU
Introduce realizefn and set realized = true in cpu_s390x_init().
Defer CPU reset from initfn to realizefn.
Acked-by: Richard Henderson <rth@twiddle.net>[AF: Invoke parent's realizefn]Signed-off-by: Andreas Färber <afaerber@suse.de>
s390: Keep I/O interrupts enabled for all iscs.
do_io_interrupt() would stop scanning further iscs if it foundan I/O interrupt it could inject. This might cause the pendinginterrupt indication for I/O interrupts to be reset although theremight be queued I/O interrupts for subsequent iscs....
s390: Fix handling of iscs.
There are two ways to express an interruption subclass:- As a bitmask, as used in cr6.- As a number, as used in the I/O interruption word.
Unfortunately, we have treated to I/O interruption word as if itcontained the bitmask as well, which went unnoticed so far as...
s390x: silence warning from GCC on uninitialized values
As best I can tell, this is a false positive.
[aliguori@ccnode4 qemu-s390]$ make CC s390x-softmmu/target-s390x/helper.o /home/aliguori/git/qemu/target-s390x/helper.c: In function ‘do_interrupt’:...
target-s390x: Fix wrong comparison in interrupt handling
gcc with -Wextra complains about an ordered pointer comparison:
target-s390x/helper.c:660:27: warning: ordered comparison of pointer with integer zero [-Wextra]
Obviously the index was missing in the code....
Merge remote-tracking branch 'agraf/s390-for-upstream' into staging
target-s390x: Fix debug output (continued)
Since its introduction in d5a439645a5a70fed5431318c3bce9dc2caa950f(s390x: helper functions for system emulation) the variable name wasraddr. Fix this.
Signed-off-by: Andreas Färber <afaerber@suse.de>Signed-off-by: Alexander Graf <agraf@suse.de>
target-s390x: Fix debug output
Commit 71e470886fb6092504503a5fe41092ace71c096c (target-s390x: fixstyle) renamed the cpu_s390x_handle_mmu_fault() argument from _vaddr toorig_vaddr. Update the debug output code.
Signed-off-by: Andreas Färber <afaerber@suse.de>...
target-s390x: Clean up cpu_inject_*() signatures
Despite cautioning that S390CPU is needed for upcoming CPUStaterefactorings, commit 5d69c547d947798cba92d836d06f6e017ba2b19d (s390:I/O interrupt and machine check injection.) added functionscpu_inject_io() and cpu_inject_crw_mchk() with CPUS390XState argument,...
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>Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com>...
target-s390x: Mark as unmigratable
CPU_SAVE_VERSION was undefined, so "cpu_common" VMState andcpu_{save,load}() were not registered. They were no-ops.Therefore there is no backwards compatibility to keep, so we can markS390CPU as unmigratable at device level....
s390: Use s390_cpu_physical_memory_map for tpi.
Map the I/O interruption code before calling into css.
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>Signed-off-by: Alexander Graf <agraf@suse.de>
s390: Lowcore mapping helper.
Create a lowcore mapping helper that includes a check for sufficientlength.
s390: Add mapping helper functions.
Add s390_cpu_physical_memory_{map,unmap} with special handlingfor the lowcore.
s390: Channel I/O basic definitions.
Basic channel I/O structures and helper function.
s390: I/O interrupt and machine check injection.
I/O interrupts are queued per isc. Only crw pending machine checksare supported.
s390: Add channel I/O instructions.
Provide handlers for (most) channel I/O instructions.
s390: Virtual channel subsystem support.
Provide a mechanism for qemu to provide fully virtual subchannels tothe guest.
s390: Wire up channel I/O in kvm.
Trigger the code for our virtual css in case of instructionintercepts for I/O instructions.
Handle the tsch exit for the subchannel-related part of tsch.
kvm: Create kvm_arch_vcpu_id() function
This will allow each architecture to define how the VCPU ID is set onthe KVM_CREATE_VCPU ioctl call.
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>Acked-by: Gleb Natapov <gleb@redhat.com>Signed-off-by: Andreas Färber <afaerber@suse.de>
s390: new contributions GPLv2 or later
IBMs s390 contributions were meant to to be gplv2 or later (sincewe were contributing to qemu). Several of the s390 specific fileslink to gpl code anyway, so lets clarify the licence statement fornew contributions for those files that we have touched multiple...
S390: Enable -cpu help and QMP query-cpu-definitions
This enables qemu -cpu help to return a list of supported CPU modelson s390 and also to query for cpu definitions in the monitor.Initially only cpu model = host is returned. This needs to be reworked...
s390x: Remove inline function ebcdic_put and related data from cpu.h
The function is only used in misc_helper.c, so move it to that file.
This reduces the size of debug executables (compiled without optimization)because they get unused code and data for each compilation which includes...
s390: Add CPU reset handler
Add a CPU reset handler to have all CPUs in a PoP compliantstate.
Signed-off-by: Jens Freimann <jfrei@linux.vnet.ibm.com>[agraf: move hw/hw.h into existing ifdef]Signed-off-by: Alexander Graf <agraf@suse.de>
s390x: fix indentation
In one of the last commits we accidently got 3-space indentation intothe tree. Fix it up so it's 4 spaces wide.
Reported-by: Andreas Faerber <afaerber@suse.de>Signed-off-by: Alexander Graf <agraf@suse.de>
target-s390x: Unregister reset callback on finalization
Since commit "s390: Add CPU reset handler" the CPU's instance_initregisters a reset callback. Unregister that on instance_finalize.
s390: Add a hypercall registration interface.
Allow virtio machines to register for different diag500 functioncodes and convert s390-virtio to use it.
cpu: Move cpu_index field to CPUState
Note that target-alpha accesses this field from TCG, now using anegative offset. Therefore the field is placed last in CPUState.
Pass PowerPCCPU to [kvm]ppc_fixup_cpu() to facilitate this change.
Move common parts of mips cpu_state_reset() to mips_cpu_reset()....
target-s390: Optimize ADDC/SUBB
Giving the proper mask to disas_jcc allows us to generate an inlinecomparison generating the carry/borrow with setcond.
In the very worst case, when we must use the external helper to computea value for CC, we generate (cc > 1) instead of (cc >> 1), which is only...
target-s390: Optimize get_address
Don't load the displacement into a register first, add it secondso that tcg_gen_addi_i64 can eliminate zeros. Don't mask thedisplacement first so that we don't turn small negative numbersinto large positive numbers....
target-s390: Perform COMPARE AND SWAP inline
Still no proper solution for CONFIG_USER_ONLY, but the systemversion is significantly better.
Signed-off-by: Richard Henderson <rth@twiddle.net>
target-s390: Use TCG_CALL_NO_WG for memory helpers
Those that do not read or write tcg registers, but canraise exceptions via memory faults.
target-s390: Use TCG_CALL_NO_WG for floating-point helpers
None of them read or write tcg registers, but most canraise fp exceptions.
target-s390: Use TCG_CALL_NO_WG for integer helpers
The division routines do not read or write tcg registers,but can raise fixed-point divide exceptions.
target-s390: Use TCG_CALL_NO_WG for misc helpers
target-s390: Use noreturn for exception and load_psw
Both always exit the cpu loop.
target-s390: Implement POPCNT
target-s390: Implement CPSDR
target-s390: Check insn operand specifications
Removes all the fixmes for even register numbers, etc.
target-s390: Implement LCDFR
target-s390: Use uint64_to_float128
target-s390: Implement SET ROUNDING MODE
target-s390: Implement LOAD/SET FP AND SIGNAL
target-s390: Fix cpu_clone_regs
R2 is the syscall return register, not R0.
target-s390: Optimize XC
Notice XC with same address and convert that to store of zero.
target-s390: Optmize emitting discards
While they aren't expensive, they aren't free to process. When weknow that the three cc helper variables are dead, don't kill them.
target-s390: Tidy comparisons
After full conversion, we can audit the uses of LTGT cc opsand see that none of the instructions can ever set CC=3.Thus we can extend the table to treat that bit as ignored.
This fixes a regression wrt the pre-conversion translation...
target-s390: Optimize ADDU/SUBU CC testing
We can easily generate some masks for logical add/subtract inline.
target-s390: Implement BRANCH ON INDEX
target-s390: Tidy s->op_cc handling
There's no need to force computation of the true cc_op when taking anexception or single stepping. In either case we'll enter the next TBwith s->cc_op = DYNAMIC and recompute anyway. Just make sure thats->cc_op is stored back to env->cc_op as needed....
target-s390: Implement COMPARE AND BRANCH
target-s390: Implement RISBG
target-s390: Implement LDGR, LGDR
target-s390: Implement R[NOX]SBG
target-s390: Implement PREFETCH
target-s390: Implement COMPARE RELATIVE LONG
target-s390: Implement COMPARE AND TRAP
target-s390: Implement LOAD ON CONDITION
target-s390: Implement STORE ON CONDITION
target-s390: Implement CONVERT TO LOGICAL
target-s390: Implement CONVERT FROM LOGICAL
target-s390: Convert SPX, STPX
target-s390: Convert STAP
target-s390: Convert IPTE
target-s390: Convert ISKE
target-s390: Convert SSKE
target-s390: Convert RRBE
target-s390: Convert subchannel instructions
While we're at it, list all of the chapter 14 subchannel insns.Which is easy since all merely need indicate non-operation.
target-s390: Convert STURA
target-s390: Convert CSP
target-s390: Convert STCKE
target-s390: Convert SACF
target-s390: Convert STSI
target-s390: Convert STFL
target-s390: Convert LPSWE
target-s390: Convert SERVC
target-s390: Delete dead code from old translator
The use of inline restricts detection of static functions that areno longer used. Limit the use of inline to those functions thatare conditionally used based on CONFIG_USER_ONLY.
target-s390: Convert IPM
Note that the previous placement of the PM field was incorrect.
target-s390: Convert CKSM
target-s390: Convert EAR, SAR
target-s390: Convert MVPG
target-s390: Convert CLST, MVST
target-s390: Convert SRST
target-s390: Convert STIDP
target-s390: Convert SCK
target-s390: Convert STCK
target-s390: Convert SCKC, STCKC
target-s390: Convert SPT, STPT
target-s390: Convert SPKA
target-s390: Convert PTLB
target-s390: Convert FP LOAD COMPLIMENT, NEGATIVE, POSITIVE
target-s390: Convert FP SQUARE ROOT
target-s390: Convert LOAD ZERO
target-s390: Convert CONVERT TO FIXED
target-s390: Convert CONVERT FROM FIXED
target-s390: Convert FLOGR
target-s390: Convert LFPC, SFPC
Note that we were failing to set the rounding mode in fpu_status.