summaryrefslogtreecommitdiff
path: root/target-s390x/kvm.c
AgeCommit message (Collapse)AuthorFilesLines
2013-10-14exec: Fix prototype of phys_mem_set_alloc and related functionsStefan Weil1-2/+2
phys_mem_alloc and its assigned values qemu_anon_ram_alloc and legacy_s390_alloc must have identical argument lists. legacy_s390_alloc uses the size parameter to call mmap, so size_t is good enough for all of them. This patch fixes compiler errors on i686 Linux hosts: CC alpha-softmmu/exec.o exec.c:752:51: error: initialization from incompatible pointer type [-Werror] exec.c: In function 'qemu_ram_alloc_from_ptr': exec.c:1139:32: error: comparison of distinct pointer types lacks a cast [-Werror] exec.c: In function 'qemu_ram_remap': exec.c:1283:21: error: comparison of distinct pointer types lacks a cast [-Werror] Signed-off-by: Stefan Weil <sw@weilnetz.de> Reviewed-by: Markus Armbruster <armbru@redhat.com> Message-id: 1380481005-32399-1-git-send-email-sw@weilnetz.de Signed-off-by: Anthony Liguori <aliguori@amazon.com>
2013-09-20s390/ioinst: Moved the CC setting to the IO instruction handlersThomas Huth1-24/+14
The IO instruction handlers now take care of setting the CC value on their own, so that the confusing return code magic in kvm_handle_css_inst() is not needed anymore. 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-09-20s390/cpu: Make setcc() function available to other filesThomas Huth1-12/+0
Moved the setcc() function to cpu.h so that it can be used by other files, too. It now also does not modify the kvm state anymore since this gets updated during kvm_arch_put_registers() anyway. Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
2013-09-20s390/kvm: Add check for priviledged SCLP handlerThomas Huth1-0/+4
The SCLP instruction is priviledged, so we should make sure that we generate an exception when it is called from the problem state. Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
2013-09-12exec: Don't abort when we can't allocate guest memoryMarkus Armbruster1-5/+1
We abort() on memory allocation failure. abort() is appropriate for programming errors. Maybe most memory allocation failures are programming errors, maybe not. But guest memory allocation failure isn't, and aborting when the user asks for more memory than we can provide is not nice. exit(1) instead, and do it in just one place, so the error message is consistent. Tested-by: Christian Borntraeger <borntraeger@de.ibm.com> Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Andreas Färber <afaerber@suse.de> Acked-by: Laszlo Ersek <lersek@redhat.com> Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Acked-by: Christian Borntraeger <borntraeger@de.ibm.com> Message-id: 1375276272-15988-8-git-send-email-armbru@redhat.com Signed-off-by: Anthony Liguori <anthony@codemonkey.ws>
2013-09-12exec: Simplify the guest physical memory allocation hookMarkus Armbruster1-11/+6
Make it a generic hook rather than a KVM hook. Less code and ifdeffery. Since the only user of the hook is old S390 KVM, there's hope we can get rid of it some day. Acked-by: Christian Borntraeger <borntraeger@de.ibm.com> Signed-off-by: Markus Armbruster <armbru@redhat.com> Acked-by: Laszlo Ersek <lersek@redhat.com> Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Message-id: 1375276272-15988-5-git-send-email-armbru@redhat.com Signed-off-by: Anthony Liguori <anthony@codemonkey.ws>
2013-08-30s390: wire up nmi command to raise a RESTART interrupt on S390Eugene (jno) Dvurechenski1-3/+3
There is the 'nmi' command that is used to trigger a guest dump via kdump feature on x86. s390 uses RESTART interrupt to trigger kdump. So, this patch provides a mean to use 'nmi' command on s390 to raise RESTART interrupt. The CPU to receive the RESTART interrupt is the "default" one. There is an infrastructure to select the "default" CPU using 'cpu' command. The 'info cpus' command can be used to see which one is the "default". In order to wire up the RESTART to 'nmi' command we had to: 1. implement the kvm_s390_cpu_restart function by exporting the existing code 2. implement s390_cpu_restart function as kvm-aware wrapper 3. modify the qmp_inject_nmi function to enable (for s390) the scan for "default" CPU and call s390_cpu_restart for it; 3. fix some messages. Signed-off-by: Eugene (jno) Dvurechenski <jno@linux.vnet.ibm.com> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com> Acked-by: Alexander Graf <agraf@suse.de>
2013-08-30s390/kvm: basic implementation of diagnose 308 subcode 6Eugene (jno) Dvurechenski1-0/+14
Linux uses a check for subcode 6 to decide if other subcodes are available. Provide a minimal implementation for subcode 6, as well as for subcode 5. Signed-off-by: Eugene (jno) Dvurechenski <jno@linux.vnet.ibm.com> Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com> [Move code from kvm.c into misc_helper.c]
2013-08-30s390x/kvm: Fix switch/case indentation for handle_diagChristian Borntraeger1-10/+10
This alignes case statements to switch statements in the handle_diag function as mandated by coding style. Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
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-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-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-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-01virtio-ccw: fix build breakage on windowsCornelia Huck1-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>
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 Huck1-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>
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-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-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. Herne1-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>
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-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-02-01target-s390x: Pass S390CPU to s390_{add, del}_running_cpu()Andreas Färber1-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>
2013-01-29s390: Wire up channel I/O in kvm.Cornelia Huck1-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>
2013-01-27kvm: Create kvm_arch_vcpu_id() functionEduardo Habkost1-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>
2013-01-18s390: Add a hypercall registration interface.Cornelia Huck1-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>
2013-01-18s390x: fix indentationAlexander Graf1-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>
2013-01-18s390: Add CPU reset handlerJens Freimann1-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>
2013-01-18s390: new contributions GPLv2 or laterChristian Borntraeger1-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>
2012-12-23Merge branch 'master' of git://git.qemu.org/qemu into qom-cpuAndreas Färber1-4/+4
Adapt header include paths. Signed-off-by: Andreas Färber <afaerber@suse.de>
2012-12-19cpu: Move kvm_run into CPUStateAndreas Färber1-36/+41
Pass CPUState / {X86,S390}CPU to helper functions. Signed-off-by: Andreas Färber <afaerber@suse.de>
2012-12-19cpu: Move kvm_state field into CPUStateAndreas Färber1-3/+2
Adapt some functions to take CPUState / {PowerPC,S390}CPU argument. Signed-off-by: Andreas Färber <afaerber@suse.de>
2012-12-19kvm: Pass CPUState to kvm_vcpu_ioctl()Andreas Färber1-29/+33
Adapt helper functions to pass X86CPU / PowerPCCPU / S390CPU. Signed-off-by: Andreas Färber <afaerber@suse.de>
2012-12-19kvm: Pass CPUState to kvm_arch_*Andreas Färber1-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>
2012-12-19softmmu: move include files to include/sysemu/Paolo Bonzini1-3/+3
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-12-19misc: move include files to include/qemu/Paolo Bonzini1-1/+1
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-10-31cpus: Pass CPUState to qemu_cpu_kick()Andreas Färber1-1/+1
CPUArchState is no longer needed there. Signed-off-by: Andreas Färber <afaerber@suse.de>
2012-10-29s390: sclp base supportHeinz Graalfs1-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>
2012-10-29s390: use sync regs for register transferChristian Borntraeger1-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>
2012-08-15s390: Fix error handling and condition code of service callChristian Borntraeger1-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>
2012-07-10s390: autodetect map privateChristian Borntraeger1-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>
2012-06-18s390: stop target cpu on sigp initial resetChristian Borntraeger1-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>
2012-06-11target-s390x: Pass S390CPU to s390_cpu_restart()Andreas Färber1-2/+4
Needed for qemu_cpu_kick(). Signed-off-by: Andreas Färber <afaerber@suse.de>
2012-06-11s390-virtio: Let s390_cpu_addr2state() return S390CPUAndreas Färber1-2/+4
Convert ipi_states to S390CPU**. Needed for s390_cpu_restart() in handle_sigp(). Signed-off-by: Andreas Färber <afaerber@suse.de>
2012-05-01S390: dont call system_shutdown on disabled waitChristian Borntraeger1-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>
2012-05-01S390: support reboot for kvm on s390Jens Freimann1-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>
2012-03-14target-s390x: Don't overuse CPUStateAndreas Färber1-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>