summaryrefslogtreecommitdiff
path: root/target-s390x/kvm.c
AgeCommit message (Collapse)AuthorFilesLines
2015-02-18s390x/ioinst: Set condition code in ioinst_handle_tsch() handlerThomas Huth1-7/+2
Move the setting of the condition code from kvm.c into the handler function in ioinst.c itself, just like it has been done with the other handlers already (TSCH has just not been changed yet since it is called from a different dispatcher in kvm.c). Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com> Signed-off-by: Jens Freimann <jfrei@linux.vnet.ibm.com> Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com> Reviewed-by: David Hildenbrand <dahi@linux.vnet.ibm.com> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
2015-02-18s390x/kvm: Add function for injecting pgm access exceptionsThomas Huth1-0/+12
Program access exceptions are defined to deliver a translation exception code in the low-core. Add a function trigger_access_exception() that generates the proper program interrupt on both KVM and non-KVM systems and switch the existing code to use it. Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com> Signed-off-by: Jens Freimann <jfrei@linux.vnet.ibm.com> Reviewed-by: David Hildenbrand <dahi@linux.vnet.ibm.com> Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
2015-02-13s390x/ipl: drop reipl parameters on resetsFan Zhang1-1/+2
Whenever a reboot initiated by the guest is done, the reipl parameters should remain valid. The disk configured by the guest is to be used for ipl'ing. External reboot/reset request (e.g. via virsh reset guest) should completely reset the guest to the initial state, and therefore also reset the reipl parameters, resulting in an ipl behaviour of the initially configured guest. This could be an external kernel or a disk. Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com> Reviewed-by: David Hildenbrand <dahi@linux.vnet.ibm.com> Acked-by: Christian Borntraeger <borntraeger@de.ibm.com> Signed-off-by: Jens Freimann <jfrei@linux.vnet.ibm.com> Signed-off-by: Fan Zhang <zhangfan@linux.vnet.ibm.com> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
2015-02-03s390x/kvm: unknown DIAGNOSE code should give a specification exceptionChristian Borntraeger1-1/+1
As described in CP programming services an unimplemented DIAGNOSE function should return a specification exception. Today we give the guest an operation exception. As both exception types are suppressing and Linux as a guest does not care about the type of program check in its exception table handler as long as both types have the same kind of error handling (nullifying, terminating, suppressing etc.) this was unnoticed. Reviewed-by: Thomas Huth <thuth@linux.vnet.ibm.com> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com> Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
2015-02-03s390x/kvm: Fix diag-308 register decodingThomas Huth1-1/+1
Fix the decoding of the r1 register number in the diagnose 308 handler. Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com> Reviewed-by: Michael Mueller <mimu@linux.vnet.ibm.com> Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
2015-01-12kvm: extend kvm_irqchip_add_msi_route to work on s390Frank Blaschka1-0/+26
on s390 MSI-X irqs are presented as thin or adapter interrupts for this we have to reorganize the routing entry to contain valid information for the adapter interrupt code on s390. To minimize impact on existing code we introduce an architecture function to fixup the routing entry. Signed-off-by: Frank Blaschka <frank.blaschka@de.ibm.com> Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
2015-01-12s390: implement pci instructionsFrank Blaschka1-0/+153
This patch implements the s390 pci instructions in qemu. It allows to access and drive pci devices attached to the s390 pci bus. Because of platform constrains devices using IO BARs are not supported. Also a device has to support MSI/MSI-X to run on s390. Signed-off-by: Frank Blaschka <frank.blaschka@de.ibm.com> Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
2015-01-12s390x/kvm: avoid syscalls by syncing registers with kvm_runDavid Hildenbrand1-22/+50
We can avoid loads of syscalls when dropping to user space by storing the values of more registers directly within kvm_run. Support is added for: - ARCH0: CPU timer, clock comparator, TOD programmable register, guest breaking-event register, program parameter - PFAULT: pfault parameters (token, select, compare) Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com> Signed-off-by: Jens Freimann <jfrei@linux.vnet.ibm.com> Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com> Acked-by: Christian Borntraeger <borntraeger@de.ibm.com> Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
2015-01-12s390x/kvm: sync register support helper functionDavid Hildenbrand1-10/+12
Let's unify the code to sync registers by moving the checks into a helper function can_sync_regs(). Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com> Signed-off-by: Jens Freimann <jfrei@linux.vnet.ibm.com> Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com> Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
2014-12-15Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into stagingPeter Maydell1-2/+1
- Migration and linuxboot fixes for 2.2 regressions - valgrind/KVM support - small i386 patches - PCI SD host controller support - malloc/free cleanups from Markus (x86/scsi) - IvyBridge model - XSAVES support for KVM - initial patches from record/replay # gpg: Signature made Mon 15 Dec 2014 16:35:08 GMT using RSA key ID 78C7AE83 # gpg: Good signature from "Paolo Bonzini <bonzini@gnu.org>" # gpg: aka "Paolo Bonzini <pbonzini@redhat.com>" # gpg: WARNING: This key is not certified with sufficiently trusted signatures! # gpg: It is not certain that the signature belongs to the owner. # Primary key fingerprint: 46F5 9FBD 57D6 12E7 BFD4 E2F7 7E15 100C CD36 69B1 # Subkey fingerprint: F133 3857 4B66 2389 866C 7682 BFFB D25F 78C7 AE83 * remotes/bonzini/tags/for-upstream: (47 commits) sdhci: Support SDHCI devices on PCI sdhci: Define SDHCI PCI ids sdhci: Add "sysbus" to sdhci QOM types and methods sdhci: Remove class "virtual" methods sdhci: Set a default frequency clock serial: only resample THR interrupt on rising edge of IER.THRI serial: update LSR on enabling/disabling FIFOs serial: clean up THRE/TEMT handling serial: reset thri_pending on IER writes with THRI=0 linuxboot: fix loading old kernels kvm/apic: fix 2.2->2.1 migration target-i386: add Ivy Bridge CPU model target-i386: add f16c and rdrand to Haswell and Broadwell target-i386: add VME to all CPUs pc: add 2.3 machine types i386: do not cross the pages boundaries in replay mode cpus: make icount warp behave well with respect to stop/cont timer: introduce new QEMU_CLOCK_VIRTUAL_RT clock cpu-exec: invalidate nocache translation if they are interrupted icount: introduce cpu_get_icount_raw ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2014-12-15valgrind/s390x: avoid false positives on KVM_SET_FPU ioctlChristian Borntraeger1-1/+1
struct kvm_fpu contains an alignment padding on s390x. Let's use a designated initializer to avoid false positives from valgrind/memcheck. Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2014-12-15KVM_CAP_IRQFD and KVM_CAP_IRQFD_RESAMPLE checksEric Auger1-1/+0
Compute kvm_irqfds_allowed by checking the KVM_CAP_IRQFD extension. Remove direct settings in architecture specific files. Add a new kvm_resamplefds_allowed variable, initialized by checking the KVM_CAP_IRQFD_RESAMPLE extension. Add a corresponding kvm_resamplefds_enabled() function. A special notice for s390 where KVM_CAP_IRQFD was not immediatly advirtised when irqfd capability was introduced in the kernel. KVM_CAP_IRQ_ROUTING was advertised instead. This was fixed in "KVM: s390: announce irqfd capability", ebc3226202d5956a5963185222982d435378b899 whereas irqfd support was brought in 84223598778ba08041f4297fda485df83414d57e, "KVM: s390: irq routing for adapter interrupts". Both commits first appear in 3.15 so there should not be any kernel version impacted by this QEMU modification. Signed-off-by: Eric Auger <eric.auger@linaro.org> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2014-11-26s390x/kvm: Fix compile errorChristian Borntraeger1-2/+2
commit a2b257d6212a "memory: expose alignment used for allocating RAM as MemoryRegion API" triggered a compile error on KVM/s390x. Fix the prototype and the implementation of legacy_s390_alloc. Cc: Igor Mammedov <imammedo@redhat.com> Cc: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2014-11-23memory: expose alignment used for allocating RAM as MemoryRegion APIIgor Mammedov1-1/+1
introduce memory_region_get_alignment() that returns underlying memory block alignment or 0 if it's not relevant/implemented for backend. Signed-off-by: Igor Mammedov <imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2014-11-05s390x/kvm: Fix warning from sparseThomas Huth1-1/+1
When running "sparse" with the s390x kvm.c code, it complains that "constant 0x00400f1d40330000 is so big it is long" - let's fix this by appending a proper suffix. Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com> Reviewed-by: David Hildenbrand <dahi@linux.vnet.ibm.com> Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com> Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
2014-11-05s390x/kvm: Fix opcode decoding for eb instruction handlerFrank Blaschka1-4/+4
The second byte of the opcode is encoded in the lowest byte of the ipb field, not the lowest byte of the ipa field. Signed-off-by: Frank Blaschka <blaschka@linux.vnet.ibm.com> Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com> Reviewed-by: Thomas Huth <thuth@linux.vnet.ibm.com>
2014-10-10s390x/kvm: synchronize the cpu state after SIGP (INITIAL) CPU RESETDavid Hildenbrand1-0/+2
We need to synchronize registers after a reset has been performed. The current code does that in qemu_system_reset(), load_normal_reset() and modified_clear_reset() for all vcpus. After SIGP (INITIAL) CPU RESET, this needs to be done for the targeted vcpu as well, so let's call cpu_synchronize_post_reset() in the respective handlers. Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com> Signed-off-by: Jens Freimann <jfrei@linux.vnet.ibm.com> Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com> CC: Andreas Faerber <afaerber@suse.de> Tested-by: Christian Borntraeger <borntraeger@de.ibm.com> Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
2014-10-10s390x/kvm: reuse kvm_s390_reset_vcpu() to get rid of ifdefsDavid Hildenbrand1-1/+1
This patch reuses kvm_s390_reset_vcpu() to get rid of some CONFIG_KVM and CONFIG_USER_ONLY ifdefs in cpu.c. In order to get rid of CONFIG_USER_ONLY, kvm_s390_reset_vcpu() has to provide a dummy implementation - the two definitions are moved to the proper section in cpu.h. Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com> Signed-off-by: Jens Freimann <jfrei@linux.vnet.ibm.com> Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com> CC: Andreas Faerber <afaerber@suse.de> Tested-by: Christian Borntraeger <borntraeger@de.ibm.com> Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
2014-10-10s390x/kvm: propagate s390 cpu state to kvmDavid Hildenbrand1-2/+41
Let QEMU propagate the cpu state to kvm. If kvm doesn't yet support it, it is silently ignored as kvm will still handle the cpu state itself in that case. The state is not synced back, thus kvm won't have a chance to actively modify the cpu state. To do so, control has to be given back to QEMU (which is already done so in all relevant cases). Setting of the cpu state can fail either because kvm doesn't support the interface yet, or because the state is invalid/not supported. Failed attempts will be traced Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com> Signed-off-by: Jens Freimann <jfrei@linux.vnet.ibm.com> Reviewed-by: Thomas Huth <thuth@linux.vnet.ibm.com> Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com> CC: Andreas Faerber <afaerber@suse.de> Tested-by: Christian Borntraeger <borntraeger@de.ibm.com> Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
2014-10-10s390x/kvm: proper use of the cpu states OPERATING and STOPPEDDavid Hildenbrand1-5/+6
This patch makes sure that halting a cpu and stopping a cpu are two different things. Stopping a cpu will also set the cpu halted - this is needed for common infrastructure to work (note that the stop and stopped flag cannot be used for our purpose because they are already used by other mechanisms). A cpu can be halted ("waiting") when it is operating. If interrupts are disabled, this is called a "disabled wait", as it can't be woken up anymore. A stopped cpu is treated like a "disabled wait" cpu, but in order to prepare for a proper cpu state synchronization with the kvm part, we need to track the real logical state of a cpu. Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com> Signed-off-by: Jens Freimann <jfrei@linux.vnet.ibm.com> Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com> Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com> CC: Andreas Faerber <afaerber@suse.de> Tested-by: Christian Borntraeger <borntraeger@de.ibm.com> Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
2014-09-01sclp-s390: Add memory hotplug SCLPsMatthew Rosato1-0/+5
Add memory information to read SCP info and add handlers for Read Storage Element Information, Attach Storage Element, Assign Storage and Unassign Storage. Signed-off-by: Matthew Rosato <mjrosato@linux.vnet.ibm.com> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
2014-09-01s390x/kvm: execute sigp orders on the target vcpu threadDavid Hildenbrand1-7/+16
All sigp orders that can result in ioctls on the target vcpu should be executed on the associated vcpu thread. Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com> Acked-by: Christian Borntraeger <borntraeger@de.ibm.com> Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com> Signed-off-by: Jens Freimann <jfrei@linux.vnet.ibm.com> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
2014-07-14s390x/kvm: synchronize guest floating point registersJason J. Herne1-0/+23
Add code to kvm_arch_get_registers and kvm_arch_put_registers to save/restore floating point registers. This missing sync was unnoticed until migration of userspace that uses fprs. Signed-off-by: Jason J. Herne <jjherne@us.ibm.com> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com> [Update patch to latest upstream] Cc: qemu-stable@nongnu.org Reviewed-by: Alexander Graf <agraf@suse.de> Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
2014-06-23qapi event: convert GUEST_PANICKEDWenchao Xia1-6/+3
'monitor.h' is still included in target-s390x/kvm.c, since I have no good way to verify whether other code need it on my x86 host. Signed-off-by: Wenchao Xia <wenchaoqemu@gmail.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2014-06-10s390x/kvm: inject via flicCornelia Huck1-1/+18
Try to inject floating interrupts via the flic if it is available. This allows us to inject the full range of floating interrupts. Reviewed-by: Jens Freimann <jfrei@linux.vnet.ibm.com> Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
2014-06-10s390x: cleanup interrupt injectionCornelia Huck1-59/+45
Remove the need for a cpu to inject a floating interrupt on kvm. Acked-by: Thomas Huth <thuth@linux.vnet.ibm.com> Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
2014-06-10s390x/kvm: add alternative injection interfaceCornelia Huck1-0/+86
Add kvm_s390_{vcpu,floating}_interrupt, which offer the possibility to inject interrupts with larger payloads (when a kvm backend becomes available). Moreover, kvm_s390_floating_interrupt() does no longer have the bogus requirement for a vcpu. Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
2014-06-10s390x: consolidate floating interruptsCornelia Huck1-0/+5
Move the injection code for all floating interrupts to interrupt.c and add a comment. Also get rid of the #ifdef CONFIG_KVM for the service interrupt. Reviewed-by: Thomas Huth <thuth@linux.vnet.ibm.com> Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
2014-06-10s390x/kvm: Log unmanageable program interruptionsThomas Huth1-0/+6
The kernel only drops to userspace if an endless program interrupt loop has been detected. Let's print an error message in this case to inform the user about the crash and stop the affected CPU with a panic event, just like it is already done for the external interruption loop detection. Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com> Signed-off-by: Jens Freimann <jfrei@linux.vnet.ibm.com> Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com> Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
2014-06-10s390x/kvm: Log unmanageable external interruptionsThomas Huth1-6/+29
Interception code 0x14 only drops to userspace when an unmanageable external interruption interception occured (e.g. if the External New PSW does not disable external interruptions). Instead of bailing out via the default handler, it is better to inform the user with a proper error message that also includes the bad PSW, and to stop the affected CPU with a panic event instead. Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com> Signed-off-by: Jens Freimann <jfrei@linux.vnet.ibm.com> Reviewed-by: David Hildenbrand <dahi@linux.vnet.ibm.com> Acked-by: Christian Borntraeger <borntraeger@de.ibm.com> Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
2014-06-10s390x/kvm: enable/reset cmma via vm attributesDominik Dingel1-0/+58
Exploit the new api for userspace-controlled cmma. If supported, enable cmma during kvm initialization and register a reset handler for cmma, which is also called directly from the load IPL code. The reset functionality is needed to reset the cmma state of the guest pages, e.g. if a system reset is triggered via qemu monitor; otherwise this could result in data corruption. A guest triggered reboot may now lead to multiple cmma resets; this is OK, however, as this is slowpath anyway and the simplest way to achieve the intended effects. Signed-off-by: Dominik Dingel <dingel@linux.vnet.ibm.com> Acked-by: Christian Borntraeger <borntraeger@de.ibm.com> Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com> Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
2014-05-20s390x/kvm: hw debugging support via guest PER facilityDavid Hildenbrand1-3/+143
This patch makes use of the hw debugging support in kvm (provided by the guest's PER facility) on s390. It enables the following features, available using the gdbserver: - single-stepping - hw breakpoints - hw watchpoints Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com> Signed-off-by: Jens Freimann <jfrei@linux.vnet.ibm.com> Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
2014-05-20s390x/kvm: software breakpoint supportDavid Hildenbrand1-3/+22
This patch allows to insert and remove sw breakpoints using the QEMU gdbserver on s390 as well as to interrupt execution on a breakpoint hit when running with KVM enabled. Whenever a software breakpoint is inserted, common code calls kvm ioctl KVM_UPDATE_GUEST_DEBUG. As this method's default on s390 is to return an error if not implement, the insertion will fail. Therefore, KVM also has to be updated in order to make use of software breakpoints. Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com> Signed-off-by: Jens Freimann <jfrei@linux.vnet.ibm.com> Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com> Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
2014-05-20s390x: remove duplicate definitions of DIAG 501David Hildenbrand1-8/+12
When restoring the previously saved instruction in kvm_arch_remove_sw_breakpoint(), we only restored one byte. Let's use the sizeof() operator to make sure we restore the entire instruction. While we are at it, let's remove the duplicate definitions of DIAG 501 and replace its size (used when reading/writing the instruction) with a sizeof() operator to make the code self explaining and less error-prone. Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com> Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com> Signed-off-by: Jens Freimann <jfrei@linux.vnet.ibm.com> Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
2014-05-20s390x/virtio-ccw: wire up irq routing and irqfdsCornelia Huck1-0/+10
Make use of the new s390 adapter irq routing support to enable real in-kernel irqfds for virtio-ccw with adapter interrupts. Note that s390 doesn't provide the common KVM_CAP_IRQCHIP capability, but rather needs KVM_CAP_S390_IRQCHIP to be enabled. This is to ensure backward compatibility. Reviewed-by: Thomas Huth <thuth@linux.vnet.ibm.com> Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com> Acked-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
2014-05-13kvm: reset state from the CPU's reset methodPaolo Bonzini1-2/+4
Now that we have a CPU object with a reset method, it is better to keep the KVM reset close to the CPU reset. Using qemu_register_reset as we do now keeps them far apart. With this patch, PPC no longer calls the kvm_arch_ function, so it can get removed there. Other arches call it from their CPU reset handler, and the function gets an ARMCPU/X86CPU/S390CPU. Note that ARM- and s390-specific functions are called kvm_arm_* and kvm_s390_*, while x86-specific functions are called kvm_arch_*. That follows the convention used by the different architectures. Changing that is the topic of a separate patch. Reviewed-by: Gleb Natapov <gnatapov@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2014-05-13kvm: make one_reg helpers available for everyoneCornelia Huck1-29/+0
s390x introduced helper functions for getting/setting one_regs with commit 860643bc. However, nothing about these is s390-specific. Alexey Kardashevskiy had already posted a general version, so let's merge the two patches and massage the code a bit. CC: Alexey Kardashevskiy <aik@ozlabs.ru> Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2014-04-30s390x: use kvm_vcpu_enable_cap()Cornelia Huck1-3/+1
Make kvm_s390_enable_css_support() use new interface. Reviewed-by: Thomas Huth <thuth@linux.vnet.ibm.com> Reviewed-by: Alexander Graf <agraf@suse.de> Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
2014-04-25s390x/kvm: sync gbea and pp registerChristian Borntraeger1-0/+4
We also need to sync guest breaking event address and program parameter register for migration support. Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com> Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com> Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
2014-04-25s390x/kvm: rework KVM synchronize to tracing for some ONEREGSChristian Borntraeger1-78/+65
Some ONE_REGS on s390 are not protected by a capability. Older kernels might not provide those and return an error. Fortunately these registers are only critical for the migration path. There is no need to error out on reset and normal runtime. Furthermore, these kernels don't provide a proper dirty bitmap anyway, so let's use tracing for those errors. Also provide generic one reg helper to simplify the code. Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com> Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com> Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
2014-04-25s390x: empty function stubs in preparation for __KVM_HAVE_GUEST_DEBUGDavid Hildenbrand1-0/+28
This patch creates empty function stubs (used by the gdbserver) in preparation for the hw debugging support by kvm on s390, which will enable the __KVM_HAVE_GUEST_DEBUG define in the linux headers and require these methods on the qemu side. Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com> Signed-off-by: Jens Freimann <jfrei@linux.vnet.ibm.com> Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com> Cc: qemu-stable@nongnu.org Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
2014-03-05s390x/virtio-ccw: Adapter interrupt support.Cornelia Huck1-2/+6
Handle the new CCW_CMD_SET_IND_ADAPTER command enabling adapter interrupts on guest request. When active, host->guest notifications will be handled via global_indicator -> queue indicators instead of queue indicators + subchannel I/O interrupt. Indicators for virtqueues may be present at an offset. Acked-by: Christian Borntraeger <borntraeger@de.ibm.com> Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
2014-02-27s390x/kvm: Rework priv instruction handlersFrank Blaschka1-59/+80
The current implementation uses the second byte of the instruction to identify the instruction handler. This is not sufficient to support instructions not starting with 0xb2. This patch adds separate handlers for 0xb2, 0xb9 and 0xeb to be able to support the full instruction set. Signed-off-by: Frank Blaschka <blaschka@linux.vnet.ibm.com> Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com> Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
2014-02-27s390x/kvm: Add missing SIGP CPU RESET orderThomas Huth1-0/+13
The SIGP order CPU RESET was still missing in the list of our supported handler. This patch now adds a simple implementation, by using the cpu_reset() function that is already available in target-s390x/cpu.c. Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com> Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com> Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
2014-02-27s390x/kvm: Rework SIGP INITIAL CPU RESET handlerThomas Huth1-18/+7
The s390_cpu_initial_reset() function had two deficiencies: First, it used an ioctl for the destination CPU, and this ioctl could block nearly forever, as long as the destination CPU was running in the SIE loop. Second, it also cleared the general purpose registers - something it should not do according to the Principles of Operations. Since we've already got another function for the initial CPU reset in cpu.c, we can also use that function instead. And by using run_on_cpu() for executing this code, we make sure that the destination CPU is correctly kicked out of kernel mode now. Suggested-by: Christian Borntraeger <borntraeger@de.ibm.com> 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>
2014-02-27s390x/sclp: Fixed setting of condition code registerThomas Huth1-1/+2
In the SCLP handler function, the condition code register must only be set if no exception occured. 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>
2014-02-27s390x/sclp: Add missing checks to SCLP handlerThomas Huth1-5/+1
If the 51 most significant bits of the SCCB address are zero or equal to the prefix, we should throw an specification exception, too. Also moved the check for privileged mode to sclp_service_call() to have all program checks in one place now. 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>
2014-02-27s390x/sclp: Fixed the size of sccb and code parameterThomas Huth1-2/+2
The pointer to the SCCB should not be limited to 32 bits only. In contrast to this, the command word parameter is only 32 bits (the upper 32 bits should be ignored). 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>
2014-02-27s390x/virtio-hcall: Specification exception for illegal subcodesThomas Huth1-2/+7
So far, the DIAG 500 hypervisor call was only setting -EINVAL in R2 when a guest tried to call this function with an illegal subcode. This patch now changes the behavior so that a specification exception is thrown instead, since this is the common behavior of other DIAG functions (and other CPU instructions) when being called with illegal parameters. 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>
2014-02-27s390x/kvm: Fixed bad SIGP SET-ARCHITECTURE handlerThomas Huth1-2/+4
The SET-ARCHITECTURE handler in QEMU caused a program interruption. This is wrong according to the "Principles of Operations" specification (since SIGP should never cause a program interrupt) and was likely only introduced for debugging purposes. Since we handle SET-ARCHITECTURE in the kernel already and only dropped to user space in case of bad mode parameters, we should just report INVALID PARAMETER in QEMU 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>