target-s390: Reorg exception handling
Make the user path more like the system path. Prepare for more kindsof runtime exceptions. Rename ILC to ILEN to make it clear that wewant to pass around a full instruction length, rather than a "code" that happens to be stored one bit left in a larger field....
target-s390: Convert ADD HALFWORD
Signed-off-by: Richard Henderson <rth@twiddle.net>
target-s390: Fix gdbstub
The real gdb protocol doesn't split out pc or cc as real registers.Those are pseudos that are extracted as needed from the PSW. Don'tmodify env->cc_op during read -- that way lies heisenbugs.
Fill in the XXX for the fp registers....
target-s390: Add missing temp_free in gen_op_calc_cc
target-s390: Use TCG registers for FPR
At the same time, tidy other usages of tcg_gen_deposit_i64.In some cases we can "type cast" rather than extend, and inothers we can allow tcg_gen_deposit_i64 itself to optimizethe HOST_LONG_BITS==32 case.
target-s390: Register helpers
Which highlights a lot of cc helpers that no longer exist.
target-s390: Fix SACF exit
DISAS_EXCP is exit via exception; we wanted DISAS_JUMP.This matters when we start cleaning up the TB exit paths.
target-s390: Fix BCR
There were are two exit paths for which we forgot tocopy s->cc_op back to the tcg register.
target-s390: Tidy unconditional BRCL
Yes, we're about to rewrite all of this, but having this unconditionaljump recompute cc_op is a large source of "false diff errors" whentrying to examine before and after dumps.
target-s390: Fix PSW_MASK handling
We were treating psw.mask as the 32-bit quantity it is in ESA mode.In particular, the CC field was at the wrong place.
target-s390: Add format based disassassmbly infrastructure
target-s390: Split out disas_jcc
Lots of duplicated code replaced with a couple of tables. We no longerattempt to manually invert the logic operation: the comments now matchthe code. In the fully general test, constant propagate (1 << (3 - cc))into (8 >> cc)....
Merge branch 'master' of git://git.qemu.org/qemu into qom-cpu
Adapt header include paths.
Signed-off-by: Andreas Färber <afaerber@suse.de>
cpu: Move kvm_state field into CPUState
Adapt some functions to take CPUState / {PowerPC,S390}CPU argument.
cpu: Move kvm_run into CPUState
Pass CPUState / {X86,S390}CPU to helper functions.
kvm: Pass CPUState to kvm_arch_*
Move kvm_vcpu_dirty field into CPUState to simplify things and changeits type to bool while at it.
kvm: Pass CPUState to kvm_vcpu_ioctl()
Adapt helper functions to pass X86CPU / PowerPCCPU / S390CPU.
fpu: move public header file to include/fpu
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
softmmu: move include files to include/sysemu/
misc: move include files to include/qemu/
qom: move include files to include/qom/
exec: move include files to include/exec/
build: kill libdis, move disassemblers to disas/
exec: refactor cpu_restore_state
Refactor common code around calls to cpu_restore_state().
tb_find_pc() has now no external users, make it static.
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
TCG: Use gen_opc_instr_start from context instead of global variable.
Signed-off-by: Evgeny Voevodin <e.voevodin@samsung.com>Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
TCG: Use gen_opc_pc from context instead of global variable.
TCG: Use gen_opc_icount from context instead of global variable.
TCG: Use gen_opc_buf from context instead of global variable.
Signed-off-by: Evgeny Voevodin <e.voevodin@samsung.com>Reviewed-by: Richard Henderson <rth@twiddle.net>Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
TCG: Use gen_opc_ptr from context instead of global variable.
disas: avoid using cpu_single_env
Pass around CPUArchState instead of using global cpu_single_env.
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>Acked-by: Richard Henderson <rth@twiddle.net>Acked-by: Aurelien Jarno <aurelien@aurel32.net>Acked-by: Guan Xuetao <gxt@mprc.pku.edu.cn>
cpus: Pass CPUState to [qemu_]cpu_has_work()
For target-mips also change the return type to bool.
Make include paths for cpu-qom.h consistent for alpha and unicore32.
Signed-off-by: Andreas Färber <afaerber@suse.de>[AF: Updated new target-openrisc function accordingly]...
cpus: Pass CPUState to qemu_cpu_kick()
CPUArchState is no longer needed there.
s390: use sync regs for register transfer
Newer kernels provide the guest registers in kvm_run. Lets usethose if available (i.e. the capability is set). This avoidsioctls on cpu_synchronize_state making intercepts faster.
In addition, we have now the prefix register, the access registers...
s390: sclp base support
This adds a more generic infrastructure for handling Service-Callrequests on s390. Currently we only support a small subset of ReadSCP Info directly in target-s390x. This patch provides the baseinfrastructure for supporting more commands and moves Read SCP...
target-s390x: rename helper flags
Rename helper flags to the new ones. This is purely a mechanical change,it's possible to use better flags by looking at the helpers.
Cc: Alexander Graf <agraf@suse.de>Reviewed-by: Richard Henderson <rth@twiddle.net>Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Rename target_phys_addr_t to hwaddr
target_phys_addr_t is unwieldly, violates the C standard (_t suffixes arereserved) and its purpose doesn't match the name (most target_phys_addr_taddresses are not target specific). Replace it with a finger-friendly,...
s390: avoid reaching into memory core internals
use cpu_physical_memory_is_io() instead.
Signed-off-by: Avi Kivity <avi@redhat.com>
target-s390x: Avoid double CPU_LOG_TB_CPU
This is already handled generically in cpu_exec.
Reviewed-by: Alexander Graf <agraf@suse.de>Signed-off-by: Richard Henderson <rth@twiddle.net>Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
target-s390x: Tidy cpu_dump_state
The blank lines inside the single dump make it difficult for theeye to pick out the block. Worse, with interior newlines, butno blank line following, the PSW line appears to belong to thenext dump block.
Reviewed-by: Alexander Graf <agraf@suse.de>...
target-s390x: Use CPU_LOG_INT
Three places in the interrupt code did we not honor the mask.
target-s390x: Call tcg_gen_debug_insn_start
Cc: Alexander Graf <agraf@suse.de>Signed-off-by: Richard Henderson <rth@twiddle.net>Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
target-s390x: avoid cpu_single_env
Pass around CPUState instead of using global cpu_single_env.
target-s390x: avoid AREG0 for misc helpers
Make misc helpers take a parameter for CPUState insteadof relying on global env.
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>[agraf: fix conflict]Signed-off-by: Alexander Graf <agraf@suse.de>
target-s390x: switch to AREG0 free mode
Add an explicit CPUState parameter instead of relying on AREG0.
Remove temporary wrappers and switch to AREG0 free mode.
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>[agraf: fix conflicts]Signed-off-by: Alexander Graf <agraf@suse.de>
target-s390x: fix style
Before splitting op_helper.c and helper.c in the next patches,fix style issues. No functional changes.
Replace also GCC specific FUNCTION withstandard func.
Don't init static variable (cpu_s390x_init:inited) with 0.
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>...
target-s390x: split FPU ops
Move floating point instructions to fpu_helper.c.
While exporting some condition code helpers,avoid duplicate identifier conflict with translate.c.
Remove unused set_cc_nz_f64() in translate.c.
target-s390x: split condition code helpers
Move condition code helpers to cc_helper.c.
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>Signed-off-by: Alexander Graf <agraf@suse.de>
target-s390x: split integer helpers
Move integer helpers to int_helper.c.
target-s390x: split memory access helpers
Move memory access helpers to mem_helper.c.
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>[agraf: fold softmmu include ifdefs together]Signed-off-by: Alexander Graf <agraf@suse.de>
target-s390x: rename op_helper.c to misc_helper.c
Now op_helper.c contains miscellaneous helpers, renameit to misc_helper.c.
target-s390x: avoid AREG0 for FPU helpers
Make FPU helpers take a parameter for CPUState insteadof relying on global env.
Introduce temporary wrappers for FPU load and store ops.
target-s390x: avoid AREG0 for integer helpers
Make integer helpers take a parameter for CPUState insteadof relying on global env.
target-s390x: avoid AREG0 for condition code helpers
Make condition code helpers take a parameter for CPUState insteadof relying on global env.
s390: Fix error handling and condition code of service call
Invalid sccb addresses will cause specification or addressing exception.Lets add those checks. Furthermore, the good case (cc=0) was incorrectfor KVM, we did not set the CC at all. We now use return codes < 0...
s390: provide interface for service interrupt/introduce interrupt.c
This patch creates interrupt.c. The first user is a callback for hw/*code to trigger an service interrupt for a given sccb value. Severalinterrupt types for s390 are floating (can be delivered to all CPUs)....
s390: autodetect map private
By default qemu will use MAP_PRIVATE for guest pages. This will writeprotect pages and thus break on s390 systems that dont support this feature.Therefore qemu has a hack to always use MAP_SHARED for s390. But MAP_SHAREDhas other problems (no dirty pages tracking, a lot more swap overhead etc.)...
Merge branch 's390-for-upstream' of git://repo.or.cz/qemu/agraf
qemu-log: use LOG_UNIMP for some target CPU cases
Use LOG_UNIMP for some target CPU cases.
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>Acked-by: Alexander Graf <agraf@suse.de>
s390: stop target cpu on sigp initial reset
We must not run the target cpu after an initial reset. This makessystem_reset more reliable for smp guests.
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>Signed-off-by: Alexander Graf <agraf@suse.de>
target-s390x: Pass S390CPU to s390_cpu_restart()
Needed for qemu_cpu_kick().
target-s390x: Let cpu_s390x_init() return S390CPU
Let cpu_init() return CPUS390XState for backwards compatibility.
s390-virtio: Let s390_cpu_addr2state() return S390CPU
Convert ipi_states to S390CPU**.
Needed for s390_cpu_restart() in handle_sigp().
build: move other target-*/ objects to nested Makefile.objs
build: move libobj-y variable to nested Makefile.objs
build: move obj-TARGET-y variables to nested Makefile.objs
Also drop duplicate occurrence of device-hotplug.o.
Kill off cpu_state_reset()
In commit 1bba0dc932e8826a7d030df3767daf0bc339f9a2 cpu_reset()was renamed to cpu_state_reset(), to allow introducing a new cpu_reset()that would operate on QOM objects.
All callers have been updated except for one in target-mips, so drop all...
S390: support reboot for kvm on s390
This patch adds reboot support for s390x-softmmu by callingthe generic reboot support in kvm.
Signed-off-by: Jens Freimann <jfrei@linux.vnet.ibm.com>Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>Signed-off-by: Alexander Graf <agraf@suse.de>
S390: dont call system_shutdown on disabled wait
A disabled wait usually indicates a guest problem. Dont shutdown theguest to allow guest dumping.Have some special cases, e.g. a quiesce disabled wait. In that casewe want to shutdown.
Long term solution might be a crashed/panic indication....
Use uintptr_t for various op related functions
Use uintptr_t instead of void * or unsigned long inseveral op related functions, env->mem_io_pc andGETPC macro.
Reviewed-by: Stefan Weil <sw@weilnetz.de>Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
target-s390x: Update s390x_{tod,cpu}_timer() to use S390CPU
In place of CPUS390XState pass S390CPU as opaque from the new initfn.cpu_interrupt() is anticipated to take a CPUState in the future.
Signed-off-by: Andreas Färber <afaerber@suse.de>Tested-by: Christian Borntraeger <borntraeger@de.ibm.com>
target-s390x: QOM'ify CPU init
Move code from cpu_s390x_init() into an initfn.
target-s390x: QOM'ify CPU reset
Move code from cpu_state_reset() to s390_cpu_reset().
target-s390x: QOM'ify CPU
Embed CPUS390XState as first member of S390CPU.Since -cpu is being ignored, make TYPE_S390_CPU non-abstract.
Rename CPUState -> CPUArchState
Scripted conversion: for file in .[hc] hw/.[hc] hw/kvm/*.[hc] linux-user/*.[hc] linux-user/m68k/*.[hc] bsd-user/*.[hc] darwin-user/*.[hc] tcg/*/*.[hc] target-*/cpu.h; do sed -i "s/CPUState/CPUArchState/g" $file done...
target-s390x: Don't overuse CPUState
Scripted conversion: sed -i "s/CPUState/CPUS390XState/g" target-s390x/*.[hc] sed -i "s/#define CPUS390XState/#define CPUState/" target-s390x/cpu.h
Signed-off-by: Andreas Färber <afaerber@suse.de>Acked-by: Anthony Liguori <aliguori@us.ibm.com>
Rename cpu_reset() to cpu_state_reset()
Frees the identifier cpu_reset for QOM CPUs (manual rename).
Don't hide the parameter type behind explicit casts, use staticfunctions with strongly typed argument to indirect.
Signed-off-by: Andreas Färber <afaerber@suse.de>...
Move helpers.h to helper.h
Provides a file naming scheme consistent with other targets.
Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>Signed-off-by: Alexander Graf <agraf@suse.de>
target-s390x: Clean includes
The change in cpu.h is needed when HOST_LONG_BITS is defined in qemu-common.h.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
s390x: add TR function for EXECUTE
Newer gcc versions (or glibc?) also generate code that tries to EXECUTEthe TR opcode. Implement it so that we don't break valid guests.
Reported-by: Andreas Faerber <afaerber@suse.de>Signed-off-by: Alexander Graf <agraf@suse.de>
s390: fix cpu hotplug / cpu activity on interrupts
The add_del/running_cpu code and env->halted are tracking stopped cpus.Sleeping cpus (idle and enabled for interrupts) are waiting inside thekernel.No interrupt besides the restart can move a cpu from stopped to...
Fix spelling in comments, documentation and messages
accidently->accidentallyannother->anotherchoosen->chosenconsideres->considersdecriptor->descriptordevelopement->developmentparamter->parameterpreceed->precedepreceeding->precedingpriviledge->privilege...
fix typo: delete redundant semicolon
Double semicolons should be single.
Signed-off-by: Dong Xu Wang <wdongxu@linux.vnet.ibm.com>Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
s390x: add ldeb instruction
While running perl, we encountered the ldeb instruction to be used,so we implement it :).
Signed-off-by: Alexander Graf <agraf@suse.de>
s390x: make ipte 31-bit aware
When running 31-bit code we can potentially map the same virtualaddress twice - once as 0x0yyyyyyy and once as 0x8yyyyyyy, becausethe upper bit gets ignored.
This also should be reflected in the tlb invalidation path, so we...
s390x: update R and C bits in storage key
When the s390x maps a page or writes happen to a page, the R and Cbits get updated. The easiest way to implement this in qemu is tosimply update them whenever we map a TLB translation and act accordingto the permissions....
s390x: implement rrbe instruction properly
The rrbe instruction resets the reference bit in the given storage key.So far, we merely made it a nop and also returned an invalid CC value,so that the kernel never knew if a page actually got accessed.
This patch implements it properly, flushing the R bit and returning the...
s390x: implement SIGP restart and shutdown
An s390x OS does reboot and shutdown triggers through hypercalls thatwe didn't implement on the TCG backend yet. That means that so far wecouldn't shut down virtual machines for example, having them hang onshutdown when not using KVM....
s390: Fix cpu shutdown for KVM
On s390 a shutdown is the state of all CPUs being either stoppedor disabled (for interrupts) waiting. We have to track the overallnumber of running CPUs to call the shutdown sequence accordingly.This patch implements the counting and shutdown handling for the...
s390x: Add shutdown for TCG s390-virtio machine
Now that we have code in place to do refcounting of online CPUs, wecan drag the TCG code along and implement shutdown for that one too,so it doesn't feel left out by its KVM counterpart.
softmmu_header: pass CPUState to tlb_fill
Pass CPUState pointer to tlb_fill() instead of architecture localcpu_single_env hacks.
Use new macro QEMU_PACKED for packed structures
Most changes were made using these commands:
git grep -la '__attribute__((packed))'|xargs perl -pi -e 's/__attribute__\(\(packed\)\)/QEMU_PACKED/'git grep -la '__attribute__ ((packed))'|xargs perl -pi -e 's/__attribute__ \(\(packed\)\)/QEMU_PACKED/'...
Fix conversions from pointer to tcg_target_long
tcg_gen_exit_tb takes a parameter of type tcg_target_long,so the type casts of pointer to long should be replaced bytype casts of pointer to tcg_target_long.
These changes are needed for build environments where...
Use glib memory allocation and free functions
qemu_malloc/qemu_free no longer exist after this commit.
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Remove unused is_softmmu parameter from cpu_handle_mmu_fault
Parameter is_softmmu (and its evil mutant twin brother is_softmuu)is not used in cpu_*_handle_mmu_fault() functions, remove themand adjust callers.
Acked-by: Richard Henderson <rth@twiddle.net>...
Avoid allocating TCG resources in non-TCG mode
Do not allocate TCG-only resources like the translation buffer whenrunning over KVM or XEN. Saves a "few" bytes in the qemu address spaceand is also conceptually cleaner.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>...
exec.h cleanup
Move softmmu_exec.h include directives from target-*/exec.h totarget-*/op_helper.c. Move also various other stuff only used inop_helper.c there.
Define global env in dyngen-exec.h.
For i386, move wrappers for segment and FPU helpers from user-exec.c...
Remove exec-all.h include directives
Most exec-all.h include directives are now useless, remove them.
Move cpu_has_work and cpu_pc_from_tb to cpu.h
Move functions cpu_has_work() and cpu_pc_from_tb() from exec.h to cpu.h. This isneeded by later patches.
exec.h: fix coding style and change cpu_has_work to return bool
Before the next patch, fix coding style of the areas affected.
Change the type of the return value from cpu_has_work() andqemu_cpu_has_work() to bool.
cpu_loop_exit: avoid using AREG0
Make cpu_loop_exit() take a parameter for CPUState instead of relyingon global env.