summaryrefslogtreecommitdiff
path: root/target-s390x
AgeCommit message (Collapse)AuthorFilesLines
2013-07-30s390x/kvm: Remove redundant return codeThomas Huth1-3/+2
Removed the redundant return code statement from handle_instruction() - it always returned 0 and never reports any errors to its caller, since errors from the sub-functions are already reported via program exceptions instead. Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
2013-07-30s390x/kvm: Reworked/fixed handling of cc3 in kvm_handle_css_inst()Thomas Huth1-48/+11
Consolidated the setting of the condition code in kvm_handle_css_inst(). For the (unhandled) instructions EQBS and SQBS, we have to return an operation exception instead of cc3. Also removed the is_ioinst() function to avoid decoding the opcode twice. Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com> Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
2013-07-30s390x/ioinst: Fixed priority of operand exceptionsThomas Huth1-17/+13
Operand exceptions have a lower priority than specification and address exceptions. Thus the checks for operand exceptions must be done later. Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com> Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
2013-07-30s390x/ioinst: Fixed alignment check in SCHM instructionThomas Huth1-1/+1
Register 2 only has to be aligned to a 32-byte boundary, not a full page boundary. Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com> Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
2013-07-30s390x/ioinst: Throw addressing exception when memory_map failedThomas Huth1-7/+7
So far, the IO instructions were throwing specification exceptions when there was a problem with accessing the memory. However, the better way is to throw an addressing exception instead. Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com> Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
2013-07-30s390x/ioinst: Add missing alignment checks for IO instructionsThomas Huth1-0/+25
The IO instructions MSCH, SSCH, STSCH, TSCH, STCRW and TPI require that the second operand address must be aligned on a word boundary. Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com> Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
2013-07-29s390x: Rename 'dprintf' to 'DPRINTF'Peter Maydell1-9/+10
'dprintf' is the name of a POSIX standard function so we should not be stealing it for our debug macro. Rename to 'DPRINTF' (in line with a number of other source files.) Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Andreas Färber <afaerber@suse.de> Reviewed-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp> Acked-by: Richard Henderson <rth@twiddle.net> Acked-by: Kevin Wolf <kwolf@redhat.com> Message-id: 1375100199-13934-3-git-send-email-peter.maydell@linaro.org Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-07-29cpu: Partially revert "cpu: Change qemu_init_vcpu() argument to CPUState"Andreas Färber1-2/+3
Commit c643bed99 moved qemu_init_vcpu() calls to common CPUState code. This causes x86 cpu-add to fail with "KVM: setting VAPIC address failed". The reason for the failure is that CPUClass::kvm_fd is not yet initialized in the following call graph: ->x86_cpu_realizefn ->x86_cpu_apic_realize ->qdev_init ->device_set_realized ->device_reset (hotplugged == 1) ->apic_reset_common ->vapic_base_update ->kvm_apic_vapic_base_update This causes attempted KVM vCPU ioctls to fail. By contrast, in the non-hotplug case the APIC is reset much later, when the vCPU is already initialized. As a quick and safe solution, move the qemu_init_vcpu() call back into the targets' realize functions. Reported-by: Chen Fan <chen.fan.fnst@cn.fujitsu.com> Acked-by: Igor Mammedov <imammedo@redhat.com> (for i386) Tested-by: Jia Liu <proljc@gmail.com> (for openrisc) Signed-off-by: Andreas Färber <afaerber@suse.de>
2013-07-27cpu: Introduce CPUClass::gdb_{read,write}_register()Andreas Färber4-2/+15
Completes migration of target-specific code to new target-*/gdbstub.c. Acked-by: Michael Walle <michael@walle.cc> (for lm32) Acked-by: Max Filippov <jcmvbkbc@gmail.com> (for xtensa) Signed-off-by: Andreas Färber <afaerber@suse.de>
2013-07-27gdbstub: Replace GET_REG*() macros with gdb_get_reg*() functionsAndreas Färber1-6/+6
This avoids polluting the global namespace with a non-prefixed macro and makes it obvious in the call sites that we return. Semi-automatic conversion using, e.g., sed -i 's/GET_REGL(/return gdb_get_regl(mem_buf, /g' target-*/gdbstub.c followed by manual tweaking for sparc's GET_REGA() and Coding Style. Acked-by: Michael Walle <michael@walle.cc> (for lm32) Acked-by: Max Filippov <jcmvbkbc@gmail.com> (for xtensa) Signed-off-by: Andreas Färber <afaerber@suse.de>
2013-07-27target-s390x: Move cpu_gdb_{read,write}_register()Andreas Färber1-0/+80
Signed-off-by: Andreas Färber <afaerber@suse.de>
2013-07-26cpu: Introduce CPUState::gdb_num_regs and CPUClass::gdb_num_core_regsAndreas Färber1-0/+1
CPUState::gdb_num_regs replaces num_g_regs. CPUClass::gdb_num_core_regs replaces NUM_CORE_REGS. Allows building gdb_register_coprocessor() for xtensa, too. As a side effect this should fix coprocessor register numbering for SMP. Acked-by: Michael Walle <michael@walle.cc> (for lm32) Acked-by: Max Filippov <jcmvbkbc@gmail.com> (for xtensa) Signed-off-by: Andreas Färber <afaerber@suse.de>
2013-07-26target-s390x: Fix CPUState rework falloutChristian Borntraeger1-8/+4
Commit f17ec444c3d39f76bcd8b71c2c05d5754bfe333e exec: Change cpu_memory_rw_debug() argument to CPUState missed to update s390x KVM code, breaking the build. Let's fix it up. Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
2013-07-23cpu: Turn cpu_get_phys_page_debug() into a CPUClass hookAndreas Färber3-2/+7
Change breakpoint_invalidate() argument to CPUState alongside. Since all targets now assign a softmmu-only field, we can drop helpers cpu_class_set_{do_unassigned_access,vmsd}() and device_class_set_vmsd(). Prepares for changing cpu_memory_rw_debug() argument to CPUState. Acked-by: Max Filippov <jcmvbkbc@gmail.com> (for xtensa) Signed-off-by: Andreas Färber <afaerber@suse.de>
2013-07-23cpu: Move singlestep_enabled field from CPU_COMMON to CPUStateAndreas Färber1-2/+3
Prepares for changing cpu_single_step() argument to CPUState. Acked-by: Michael Walle <michael@walle.cc> (for lm32) Signed-off-by: Andreas Färber <afaerber@suse.de>
2013-07-23cpu: Introduce CPUClass::synchronize_from_tb() for cpu_pc_from_tb()Andreas Färber1-5/+0
Where no extra implementation is needed, fall back to CPUClass::set_pc(). Acked-by: Michael Walle <michael@walle.cc> (for lm32) Signed-off-by: Andreas Färber <afaerber@suse.de>
2013-07-23cpu: Introduce CPUClass::set_pc() for gdb_set_cpu_pc()Andreas Färber1-0/+8
This moves setting the Program Counter from gdbstub into target code. Use vaddr type as upper-bound replacement for target_ulong. Signed-off-by: Andreas Färber <afaerber@suse.de>
2013-07-09cpu: Move reset logging to CPUStateAndreas Färber1-5/+0
x86 was using additional CPU_DUMP_* flags, so make that configurable in CPUClass::reset_dump_flags. This adds reset logging for alpha, unicore32 and xtensa. Acked-by: Michael Walle <michael@walle.cc> (for lm32) Reviewed-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Andreas Färber <afaerber@suse.de>
2013-07-09log: Change log_cpu_state[_mask]() argument to CPUStateAndreas Färber1-1/+1
Since commit 878096eeb278a8ac1ccd6667af73e026f29b4cf5 (cpu: Turn cpu_dump_{state,statistics}() into CPUState hooks) CPUArchState is no longer needed. Add documentation and make the functions available through qemu/log.h outside NEED_CPU_H to allow use in qom/cpu.c. Moving them to qom/cpu.h was not yet possible due to convoluted include paths, so that some devices grow an implicit and unneeded dependency on qom/cpu.h for now. Acked-by: Michael Walle <michael@walle.cc> (for lm32) Reviewed-by: Richard Henderson <rth@twiddle.net> [AF: Simplified mb_cpu_do_interrupt() and do_interrupt_all() changes] Signed-off-by: Andreas Färber <afaerber@suse.de>
2013-07-09target-s390x: Change gen_intermediate_code_internal() argument to S390CPUAndreas Färber1-4/+5
Also use bool type while at it. Prepares for moving singlestep_enabled field to CPUState. Reviewed-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Andreas Färber <afaerber@suse.de>
2013-07-09target-s390x: Change handle_{hypercall,diag}() argument to S390CPUAndreas Färber1-6/+6
This allows to get rid of the last remaining ENV_GET_CPU() in target-s390x/ by using CPU() cast directly on the argument. Cc: Jason J. Herne <jjherne@us.ibm.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
2013-07-09target-s390x: Don't overuse ENV_GET_CPU()Andreas Färber1-1/+1
Commit 3474b679486caa8f6448bae974e131370f360c13 (Utilize selective runtime reg sync for hot code paths) introduced two uses of ENV_GET_CPU() inside target-s390x/ KVM code. In one case we can use a direct CPU() cast instead. Cc: Jason J. Herne <jjherne@us.ibm.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
2013-07-09cpu: Drop unnecessary dynamic casts in *_env_get_cpu()Andreas Färber1-1/+1
A transition from CPUFooState to FooCPU can be considered safe, just like FooCPU::env access in the opposite direction. The only benefit of the FOO_CPU() casts would be protection against bogus CPUFooState pointers, but then surrounding code would likely break, too. This should slightly improve interrupt etc. performance when going from CPUFooState to FooCPU. For any additional CPU() casts see 3556c233d931ad5ffa46a35cb25cfc057732ebb8 (qom: allow turning cast debugging off). Reported-by: Anthony Liguori <aliguori@us.ibm.com> Acked-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Andreas Färber <afaerber@suse.de>
2013-07-09linux-user: Move cpu_clone_regs() and cpu_set_tls() into linux-userPeter Maydell1-16/+0
The functions cpu_clone_regs() and cpu_set_tls() are not purely CPU related -- they are specific to the TLS ABI for a a particular OS. Move them into the linux-user/ tree where they belong. target-lm32 had entirely unused implementations, since it has no linux-user target; just drop them. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Acked-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Andreas Färber <afaerber@suse.de>
2013-07-01virtio-ccw: fix build breakage on windowsCornelia Huck2-6/+10
event_notifier_get_fd() is not available on windows hosts. Fix this by moving the calls to event_notifier_get_fd() to the kvm code. Reported-by: Stefan Weil <sw@weilnetz.de> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
2013-06-28cpu: Change qemu_init_vcpu() argument to CPUStateAndreas Färber1-1/+0
This allows to move the call into CPUState's realizefn. Therefore move the stub into libqemustub.a. Reviewed-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Andreas Färber <afaerber@suse.de>
2013-06-28cpu: Turn cpu_dump_{state,statistics}() into CPUState hooksAndreas Färber3-2/+7
Make cpustats monitor command available unconditionally. Prepares for changing kvm_handle_internal_error() and kvm_cpu_exec() arguments to CPUState. Signed-off-by: Andreas Färber <afaerber@suse.de>
2013-06-28kvm: Change cpu_synchronize_state() argument to CPUStateAndreas Färber1-4/+5
Change Monitor::mon_cpu to CPUState as well. Reviewed-by: liguang <lig.fnst@cn.fujitsu.com> Acked-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
2013-06-25virtio-ccw: Wire up ioeventfd.Cornelia Huck2-0/+35
On hosts that support ioeventfd, make use of it for host-to-guest notifications via diagnose 500. Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
2013-06-20Revert "s390x: reduce TARGET_PHYS_ADDR_SPACE_BITS to 62"Paolo Bonzini1-4/+1
This reverts commit 311f83ca08c011b048c063c2fd3038a8957970bc. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2013-06-12KVM: S390: Add dummy kvm_arch_init_irq_routing()Alexey Kardashevskiy1-0/+4
The common KVM code insists on calling kvm_arch_init_irq_routing() as soon as it sees kernel header support for it (regardless of whether QEMU supports it). Provide a dummy function to satisfy this. Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2013-06-01Remove unnecessary break statementsStefan Weil1-1/+0
Fix these warnings from cppcheck: hw/display/cirrus_vga.c:2603: hw/sd/sd.c:348: hw/timer/exynos4210_mct.c:1033: target-arm/translate.c:9886: target-s390x/mem_helper.c:518: target-unicore32/translate.c:1936: style: Consecutive return, break, continue, goto or throw statements are unnecessary. Signed-off-by: Stefan Weil <sw@weilnetz.de> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Andreas Färber <afaerber@suse.de> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2013-05-24s390x: reduce TARGET_PHYS_ADDR_SPACE_BITS to 62Paolo Bonzini1-1/+4
With the next patch, the memory API will complain if the TARGET_PHYS_ADDR_SPACE_BITS gets dangerously close to an overflow. s390x can handle up to 64 bit of physical address space from its page tables, but we never use that much. Just decrease the value. Cc: Alexander Graf <agraf@suse.de> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2013-05-14osdep, kvm: rename low-level RAM allocation functionsPaolo Bonzini1-1/+1
This is preparatory to the introduction of a separate freeing API. Reported-by: Amos Kong <akong@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Amos Kong <akong@redhat.com> Message-id: 1368454796-14989-2-git-send-email-pbonzini@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-05-01Trivial grammar and spelling fixesStefan Weil1-1/+1
similiar -> similar recieve -> receive transfered -> transferred preperation -> preparation Most changes are in comments, one modifies a parameter name in a function prototype. The spelling fixes were made using codespell. Signed-off-by: Stefan Weil <sw@weilnetz.de> Acked-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2013-04-30Wire up disabled wait a panicked event on s390Christian Borntraeger1-3/+14
On s390 the disabled wait state indicates a state of attention. For example Linux uses that state after a panic. Lets put the system into panicked state. An alternative implementation would be to state disabled-wait <address> instead of pause in the action field. (e.g. z/OS, z/VM and other classic OSes use the address of the disabled wait to indicate an error code). Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com> Message-id: 6cf41156322e27e81a727b69f03728dbc225d5bb.1366945969.git.hutao@cn.fujitsu.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-04-26Utilize selective runtime reg sync for hot code pathsJason J. Herne1-3/+12
Make use of new kvm_s390_get_registers_partial() for kvm_handle_css_inst() and handle_hypercall() since they only need registers from the partial set and they are called quite frequently. Signed-off-by: Jason J. Herne <jjherne@us.ibm.com> Signed-off-by: Alexander Graf <agraf@suse.de>
2013-04-26Allow selective runtime register synchronizationJason J. Herne2-0/+84
We want to avoid expensive register synchronization IOCTL's on the hot path so a new kvm_s390_get_registers_partial() is introduced as a compliment to kvm_arch_get_registers(). The new function is called on the hot path, and kvm_arch_get_registers() is called when we need the complete runtime register state. kvm_arch_put_registers() is updated to only sync the partial runtime set when we've only dirtied the partial runtime set. This is to avoid sending bad data back to KVM if we've only partially synced the runtime register set. Signed-off-by: Jason J. Herne <jjherne@us.ibm.com> Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com> Signed-off-by: Alexander Graf <agraf@suse.de>
2013-04-26s390x: use CONFIG_INT128 to detect __uint128_tGabriel Kerneis1-2/+1
Target s390x uses ad-hoc macro magic to guess if the compiler supports the GCC extension __uint128_t. This patch uses the the dedicated macro CONFIG_INT128 defined by configure instead. This fixes compilation with the CIL source code analyzer, which uses GCC as a preprocessor but does not support __uint128_t. Signed-off-by: Gabriel Kerneis <gabriel@kerneis.info> Reviewed-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-04-12Typo, spelling and grammatical fixesPeter Maydell1-4/+4
Minor fixes to documentation and code comments. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-04-05target-s390: Fix SRNMTRichard Henderson1-0/+1
Fallthough into abort = oops. Cc: qemu-trivial@nongnu.org Cc: Alexander Graf <agraf@suse.de> Signed-off-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-03-22Fix typos and misspellingsPeter Maydell1-1/+1
Fix various typos and misspellings. The bulk of these were found with codespell. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-03-17s390: Fix cpu refactoring fallout.Cornelia Huck1-2/+1
Commit 259186a7 "cpu: Move halted and interrupt_request fields to CPUState" seems to have missed one instance in target-s390x/kvm.c: /home/cohuck/git/qemu/target-s390x/kvm.c: In function ‘kvm_arch_process_async_events’: /home/cohuck/git/qemu/target-s390x/kvm.c:319: error: ‘CPUS390XState’ has no member named ‘halted’ /home/cohuck/git/qemu/target-s390x/kvm.c:320: warning: control reaches end of non-void function make[1]: *** [target-s390x/kvm.o] Error 1 Let's just switch to cs->halted. Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com> Acked-by: Alexander Graf <agraf@suse.de> Acked-by: Andreas Färber <afaerber@suse.de> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2013-03-12cpu: Replace do_interrupt() by CPUClass::do_interrupt methodAndreas Färber4-6/+10
This removes a global per-target function and thus takes us one step closer to compiling multiple targets into one executable. It will also allow to override the interrupt handling for certain CPU families. Signed-off-by: Andreas Färber <afaerber@suse.de>
2013-03-12cpu: Pass CPUState to cpu_interrupt()Andreas Färber2-5/+5
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>
2013-03-12cpu: Move halted and interrupt_request fields to CPUStateAndreas Färber3-8/+12
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>
2013-03-08s390/css: Fix subchannel detectionChristian Borntraeger2-2/+2
We have to consider the m bit to find the real channel subsystem when determining the last subchannel. If we fail to take this into account, removal of a subchannel in the middle of a big list of devices will stop device detection after a reboot. Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com> Signed-off-by: Jens Freimann <jfrei@linux.vnet.ibm.com> Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com> Signed-off-by: Alexander Graf <agraf@suse.de>
2013-03-08s390: simplify kvm cpu initChristian Borntraeger1-7/+2
There is no special code right now and the reset ioctl is done later on in the the reset handler anyway. Lets simplify the cpu init. Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com> Signed-off-by: Alexander Graf <agraf@suse.de>
2013-03-03gen-icount.h: Rename gen_icount_start/end to gen_tb_start/endPeter Maydell1-2/+2
The gen_icount_start/end functions are now somewhat misnamed since they are useful for generic "start/end of TB" code, used for more than just icount. Rename them to gen_tb_start/end. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2013-03-03cpu: Introduce ENV_OFFSET macrosAndreas Färber1-0/+1
Introduce ENV_OFFSET macros which can be used in non-target-specific code that needs to generate TCG instructions which reference CPUState fields given the cpu_env register that TCG targets set up with a pointer to the CPUArchState struct. Signed-off-by: Andreas Färber <afaerber@suse.de> Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>