summaryrefslogtreecommitdiffstats
path: root/target-s390x/kvm.c
Commit message (Collapse)AuthorAgeFilesLines
* s390x/kvm: Remove redundant return codeThomas Huth2013-07-301-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>
* s390x/kvm: Reworked/fixed handling of cc3 in kvm_handle_css_inst()Thomas Huth2013-07-301-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>
* s390x: Rename 'dprintf' to 'DPRINTF'Peter Maydell2013-07-291-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>
* target-s390x: Fix CPUState rework falloutChristian Borntraeger2013-07-261-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>
* target-s390x: Change handle_{hypercall,diag}() argument to S390CPUAndreas Färber2013-07-091-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>
* target-s390x: Don't overuse ENV_GET_CPU()Andreas Färber2013-07-091-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>
* virtio-ccw: fix build breakage on windowsCornelia Huck2013-07-011-2/+3
| | | | | | | | | 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>
* kvm: Change cpu_synchronize_state() argument to CPUStateAndreas Färber2013-06-281-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>
* virtio-ccw: Wire up ioeventfd.Cornelia Huck2013-06-251-0/+19
| | | | | | | 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>
* KVM: S390: Add dummy kvm_arch_init_irq_routing()Alexey Kardashevskiy2013-06-121-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>
* osdep, kvm: rename low-level RAM allocation functionsPaolo Bonzini2013-05-141-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>
* Wire up disabled wait a panicked event on s390Christian Borntraeger2013-04-301-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>
* Utilize selective runtime reg sync for hot code pathsJason J. Herne2013-04-261-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>
* Allow selective runtime register synchronizationJason J. Herne2013-04-261-0/+67
| | | | | | | | | | | | | | | | 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>
* s390: Fix cpu refactoring fallout.Cornelia Huck2013-03-171-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>
* s390: simplify kvm cpu initChristian Borntraeger2013-03-081-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>
* target-s390x: Pass S390CPU to s390_{add, del}_running_cpu()Andreas Färber2013-02-011-8/+5
| | | | | | | | | 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> Signed-off-by: Alexander Graf <agraf@suse.de>
* s390: Wire up channel I/O in kvm.Cornelia Huck2013-01-291-13/+226
| | | | | | | | | | Trigger the code for our virtual css in case of instruction intercepts for I/O instructions. Handle the tsch exit for the subchannel-related part of tsch. Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com> Signed-off-by: Alexander Graf <agraf@suse.de>
* kvm: Create kvm_arch_vcpu_id() functionEduardo Habkost2013-01-271-0/+5
| | | | | | | | | This will allow each architecture to define how the VCPU ID is set on the 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: Add a hypercall registration interface.Cornelia Huck2013-01-181-1/+1
| | | | | | | | Allow virtio machines to register for different diag500 function codes and convert s390-virtio to use it. Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com> Signed-off-by: Alexander Graf <agraf@suse.de>
* s390x: fix indentationAlexander Graf2013-01-181-5/+5
| | | | | | | | In one of the last commits we accidently got 3-space indentation into the 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>
* s390: Add CPU reset handlerJens Freimann2013-01-181-1/+8
| | | | | | | | | Add a CPU reset handler to have all CPUs in a PoP compliant state. 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>
* s390: new contributions GPLv2 or laterChristian Borntraeger2013-01-181-1/+5
| | | | | | | | | | | | | IBMs s390 contributions were meant to to be gplv2 or later (since we were contributing to qemu). Several of the s390 specific files link to gpl code anyway, so lets clarify the licence statement for new contributions for those files that we have touched multiple times or will likely touch again. This patch does not touch files that mostly deal with tcg. Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com> Signed-off-by: Alexander Graf <agraf@suse.de>
* Merge branch 'master' of git://git.qemu.org/qemu into qom-cpuAndreas Färber2012-12-231-4/+4
|\ | | | | | | | | | | Adapt header include paths. Signed-off-by: Andreas Färber <afaerber@suse.de>
| * softmmu: move include files to include/sysemu/Paolo Bonzini2012-12-191-3/+3
| | | | | | | | Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
| * misc: move include files to include/qemu/Paolo Bonzini2012-12-191-1/+1
| | | | | | | | Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* | cpu: Move kvm_run into CPUStateAndreas Färber2012-12-191-36/+41
| | | | | | | | | | | | Pass CPUState / {X86,S390}CPU to helper functions. Signed-off-by: Andreas Färber <afaerber@suse.de>
* | cpu: Move kvm_state field into CPUStateAndreas Färber2012-12-191-3/+2
| | | | | | | | | | | | Adapt some functions to take CPUState / {PowerPC,S390}CPU argument. Signed-off-by: Andreas Färber <afaerber@suse.de>
* | kvm: Pass CPUState to kvm_vcpu_ioctl()Andreas Färber2012-12-191-29/+33
| | | | | | | | | | | | Adapt helper functions to pass X86CPU / PowerPCCPU / S390CPU. Signed-off-by: Andreas Färber <afaerber@suse.de>
* | kvm: Pass CPUState to kvm_arch_*Andreas Färber2012-12-191-13/+25
|/ | | | | | | Move kvm_vcpu_dirty field into CPUState to simplify things and change its type to bool while at it. Signed-off-by: Andreas Färber <afaerber@suse.de>
* cpus: Pass CPUState to qemu_cpu_kick()Andreas Färber2012-10-311-1/+1
| | | | | | CPUArchState is no longer needed there. Signed-off-by: Andreas Färber <afaerber@suse.de>
* s390: sclp base supportHeinz Graalfs2012-10-291-4/+1
| | | | | | | | | | | | | | | This adds a more generic infrastructure for handling Service-Call requests on s390. Currently we only support a small subset of Read SCP Info directly in target-s390x. This patch provides the base infrastructure for supporting more commands and moves Read SCP Info. In the future we could add additional commands for hotplug, call home and event handling. Signed-off-by: Heinz Graalfs <graalfs@linux.vnet.ibm.com> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com> Signed-off-by: Jens Freimann <jfrei@linux.vnet.ibm.com> Signed-off-by: Alexander Graf <agraf@suse.de>
* s390: use sync regs for register transferChristian Borntraeger2012-10-291-20/+92
| | | | | | | | | | | | | | | | | Newer kernels provide the guest registers in kvm_run. Lets use those if available (i.e. the capability is set). This avoids ioctls on cpu_synchronize_state making intercepts faster. In addition, we have now the prefix register, the access registers the control registers up to date. This helps in certain cases, e.g. for resolving kernel module addresses with gdb on a guest. On return, we update the registers according to the level statement, i.e. we put all registers for KVM_PUT_FULL_STATE and _RESET_STATE. Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com> Signed-off-by: Jens Freimann <jfrei@linux.vnet.ibm.com> Signed-off-by: Alexander Graf <agraf@suse.de>
* s390: Fix error handling and condition code of service callChristian Borntraeger2012-08-151-2/+3
| | | | | | | | | | Invalid sccb addresses will cause specification or addressing exception. Lets add those checks. Furthermore, the good case (cc=0) was incorrect for KVM, we did not set the CC at all. We now use return codes < 0 as program checks and return codes > 0 as condition code values. Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com> Signed-off-by: Alexander Graf <agraf@suse.de>
* s390: autodetect map privateChristian Borntraeger2012-07-101-0/+35
| | | | | | | | | | | | | | | By default qemu will use MAP_PRIVATE for guest pages. This will write protect 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_SHARED has other problems (no dirty pages tracking, a lot more swap overhead etc.) Newer systems allow the distinction via KVM_CAP_S390_COW. With this feature qemu can use the standard qemu alloc if available, otherwise it will use the old s390 hack. Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com> Signed-off-by: Jens Freimann <jfrei@linux.vnet.ibm.com> Acked-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Alexander Graf <agraf@suse.de>
* s390: stop target cpu on sigp initial resetChristian Borntraeger2012-06-181-0/+1
| | | | | | | | We must not run the target cpu after an initial reset. This makes system_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()Andreas Färber2012-06-111-2/+4
| | | | | | Needed for qemu_cpu_kick(). Signed-off-by: Andreas Färber <afaerber@suse.de>
* s390-virtio: Let s390_cpu_addr2state() return S390CPUAndreas Färber2012-06-111-2/+4
| | | | | | | | Convert ipi_states to S390CPU**. Needed for s390_cpu_restart() in handle_sigp(). Signed-off-by: Andreas Färber <afaerber@suse.de>
* S390: dont call system_shutdown on disabled waitChristian Borntraeger2012-05-011-0/+12
| | | | | | | | | | | | A disabled wait usually indicates a guest problem. Dont shutdown the guest to allow guest dumping. Have some special cases, e.g. a quiesce disabled wait. In that case we want to shutdown. Long term solution might be a crashed/panic indication. Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com> Signed-off-by: Alexander Graf <agraf@suse.de>
* S390: support reboot for kvm on s390Jens Freimann2012-05-011-2/+1
| | | | | | | | | This patch adds reboot support for s390x-softmmu by calling the 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>
* target-s390x: Don't overuse CPUStateAndreas Färber2012-03-141-28/+28
| | | | | | | | | 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>
* s390: fix cpu hotplug / cpu activity on interruptsChristian Borntraeger2012-01-041-3/+0
| | | | | | | | | | | | | | | | | | | The add_del/running_cpu code and env->halted are tracking stopped cpus. Sleeping cpus (idle and enabled for interrupts) are waiting inside the kernel. No interrupt besides the restart can move a cpu from stopped to operational. This is already handled over there. So lets just remove the bogus wakup from the common interrupt delivery, otherwise any interrupt will wake up a cpu, even if this cpu is stopped (Thus leading to strange hangs on sigp restart) This fixes echo 0 > /sys/devices/system/cpu/cpu0/online echo 1 > /sys/devices/system/cpu/cpu0/online in the guest Signed-off-by: Christian Borntraeger<borntraeger@de.ibm.com> Signed-off-by: Alexander Graf <agraf@suse.de>
* s390: Fix cpu shutdown for KVMChristian Borntraeger2011-11-141-12/+7
| | | | | | | | | | | | On s390 a shutdown is the state of all CPUs being either stopped or disabled (for interrupts) waiting. We have to track the overall number of running CPUs to call the shutdown sequence accordingly. This patch implements the counting and shutdown handling for the kvm path in qemu. Lets also wrap changes to env->halted and env->exception_index. Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com> Signed-off-by: Alexander Graf <agraf@suse.de>
* s390x: Fix debugging for unknown sigp order codesChristian Borntraeger2011-05-201-1/+1
| | | | | | | | | | On unknown sigp order codes we print a debug message. This patch fixes the output, since we want to see the order_code and not the register numbers. Patch applies on agraf tree. Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com> Signed-off-by: Alexander Graf <agraf@suse.de>
* s390x: Adjust internal kvm codeAlexander Graf2011-05-201-37/+7
| | | | | | | | | | We're now finally emulating an s390x CPU, so we can move quite some logic from the kvm code out into generic CPU code. This patch does this and adjusts the interfaces according to what the code around now expects to be able to call. Signed-off-by: Alexander Graf <agraf@suse.de>
* s390x: fix smp support for kvmChristian Borntraeger2011-05-201-1/+1
| | | | | | | | | | | | | | Currently smp support for kvm does not work. Qemu does a kvm run even on secondary CPUs which dont have a sane state (initial psw == 0) triggering some program faults. Architecturally these cpus are in the stopped state, so we should not do the kvm run ioctl. (these CPUs will be started by a SIGP restart later during the boot process) We need to tell the loop that this cpu should not run. Jan Kiszka pointed out that kvm_arch_process_async_events is the right place to do. Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com> Signed-off-by: Alexander Graf <agraf@suse.de>
* s390x: Prepare cpu.h for emulationAlexander Graf2011-04-181-9/+8
| | | | | | | | | We need to add some more logic to the CPU description to leverage emulation of an s390x CPU. This patch adds all the required helpers, fields in CPUState and constant definitions required for user and system emulation. Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
* s390x: fix KVM targetAlexander Graf2011-04-041-1/+1
| | | | | | | | | | | | During Jan's rework of the generic KVM layer, he added some more error checks and actually aborted if something went wrong. Unfortunately, one of the s390 internal error codes slipped through, aborting the VM without needing to. This patch fixes booting of S390x virtual machines in KVM. Signed-off-by: Alexander Graf <agraf@suse.de> CC: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
* kvm: Align kvm_arch_handle_exit to kvm_cpu_exec changesJan Kiszka2011-03-161-0/+5
| | | | | | | | | | | Make the return code of kvm_arch_handle_exit directly usable for kvm_cpu_exec. This is straightforward for x86 and ppc, just s390 would require more work. Avoid this for now by pushing the return code translation logic into s390's kvm_arch_handle_exit. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> CC: Alexander Graf <agraf@suse.de> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
* kvm: Rename kvm_arch_process_irqchip_events to async_eventsJan Kiszka2011-03-151-1/+1
| | | | | | | We will broaden the scope of this function on x86 beyond irqchip events. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
OpenPOWER on IntegriCloud