summaryrefslogtreecommitdiff
path: root/target-s390x
AgeCommit message (Collapse)AuthorFilesLines
2011-05-20s390x: fix memory detection for guests > 64GBChristian Borntraeger1-2/+6
the s390 memory detection has a 16bit field that specifies the amount of increments. This patch adopts the memory size to always fit into that scheme. This also fixes virtio detection for these guests, since the descriptor page is located after the main memory. Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com> Signed-off-by: Alexander Graf <agraf@suse.de>
2011-05-20s390x: Fix debugging for unknown sigp order codesChristian Borntraeger1-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>
2011-05-20s390x: remove compatibility cc fieldAlexander Graf1-1/+0
Remove the now unused cc field that was only required to not break bisectability. Signed-off-by: Alexander Graf <agraf@suse.de>
2011-05-20s390x: translate engine for s390x CPUAlexander Graf1-2/+5161
This is the main meat part of the patch set. It implements emulation for an s390x CPU. The code does all the optimizations that are common for TCG code: - direct branches - cc optimization - unrolling of simple microcode loops I'm still open for suggestions on speedups of course :). Signed-off-by: Alexander Graf <agraf@suse.de>
2011-05-20s390x: Adjust internal kvm codeAlexander Graf1-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>
2011-05-20s390x: Implement opcode helpersAlexander Graf2-2/+3068
There are some instructions that can't (or shouldn't) be expressed by pure tcg code. For those, we call into externally compiled C functions. This patch implements those C functions. Signed-off-by: Alexander Graf <agraf@suse.de>
2011-05-20s390x: helper functions for system emulationAlexander Graf3-10/+565
When running system emulation, we need to transverse through the MMU and deliver interrupts according to the specification. This patch implements those two pieces and in addition adjusts the CPU initialization code to account for the new fields in CPUState. Signed-off-by: Alexander Graf <agraf@suse.de>
2011-05-20s390x: Shift variables in CPUState for memset(0)Alexander Graf1-3/+4
The default reset handler does a memset(0) until right in between CPU_COMMON. I incorrectly changed that behavior on the s390x port, so let's move the fields in CPUState around to reflect the correct split up to which point memset(0) zeros out everything. Signed-off-by: Alexander Graf <agraf@suse.de>
2011-05-20s390x: keep hint on virtio managing sizeAlexander Graf1-0/+3
The s390x virtio bus keeps management information on virtio after the top of the guest's RAM. We need to be able to tell the guest the size of its RAM (without virtio stuff), but also be able to trap when the guest accesses RAM outside of its scope (including virtio stuff). So we need a variable telling us the size of the virtio stuff, so we can calculate the highest available RAM address from that. While at it, also increase the maximum number of virtio pages, so we play along well with more recent kernels that spawn a ridiculous number of virtio console adapters. Signed-off-by: Alexander Graf <agraf@suse.de>
2011-05-20s390x: make kvm exported functions conditional on kvmAlexander Graf1-0/+17
We have some helper functions we use to directly invoke KVM functionality from device emulation code. This patch replaces those exported functions with static inline stubs when not building with KVM enabled. Signed-off-by: Alexander Graf <agraf@suse.de>
2011-05-20s390x: fix smp support for kvmChristian Borntraeger1-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>
2011-04-20Remove unused function parameter from cpu_restore_stateStefan Weil1-1/+1
The previous patch removed the need for parameter puc. Is is now unused, so remove it. Cc: Aurelien Jarno <aurelien@aurel32.net> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Stefan Weil <weil@mail.berlios.de>
2011-04-20Remove unused function parameters from gen_pc_load and rename the functionStefan Weil1-2/+1
Function gen_pc_load was introduced in commit d2856f1ad4c259e5766847c49acbb4e390731bd4. The only reason for parameter searched_pc was a debug statement in target-i386/translate.c. Parameter puc was needed by target-sparc until commit d7da2a10402f1644128b66414ca8f86bdea9ae7c. Remove searched_pc from the debug statement and remove both parameters from the parameter list of gen_pc_load. As the function name gen_pc_load was also misleading, it is now called restore_state_to_opc. This new name was suggested by Peter Maydell, thanks. v2: Remove last parameter, too, and rename the function. v3: Fix [] typo in target-arm/translate.c. Fix wrong SHA1 object name in commit message (copy+paste error). Cc: Aurelien Jarno <aurelien@aurel32.net> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Stefan Weil <weil@mail.berlios.de>
2011-04-18s390x: Enable s390x-softmmu targetAlexander Graf2-1/+14
This patch adds some code paths for running s390x guest OSs without the need for KVM. Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2011-04-18s390x: Prepare cpu.h for emulationAlexander Graf3-54/+739
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>
2011-04-04s390x: fix KVM targetAlexander Graf1-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>
2011-03-16kvm: Align kvm_arch_handle_exit to kvm_cpu_exec changesJan Kiszka1-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>
2011-03-15kvm: Rename kvm_arch_process_irqchip_events to async_eventsJan Kiszka1-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>
2011-03-13always qemu_cpu_kick after unhalting a cpuPaolo Bonzini1-0/+1
This ensures env->halt_cond is broadcast, and the loop in qemu_tcg_wait_io_event and qemu_kvm_wait_io_event is exited naturally rather than through a timeout. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-03-13inline cpu_halted into sole callerPaolo Bonzini1-12/+0
All implementations are now the same, and there is only one caller, so inline the function there. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-02-14kvm: Drop return values from kvm_arch_pre/post_runJan Kiszka1-4/+2
We do not check them, and the only arch with non-empty implementations always returns 0 (this is also true for qemu-kvm). Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> CC: Alexander Graf <agraf@suse.de> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
2011-02-14kvm: Provide sigbus services arch-independentlyJan Kiszka1-0/+10
Provide arch-independent kvm_on_sigbus* stubs to remove the #ifdef'ery from cpus.c. This patch also fixes --disable-kvm build by providing the missing kvm_on_sigbus_vcpu kvm-stub. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Acked-by: Alexander Graf <agraf@suse.de> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
2011-02-01Merge remote branch 'qemu-kvm/uq/master' into stagingAnthony Liguori1-1/+5
aliguori: fix build with !defined(KVM_CAP_ASYNC_PF) Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-01-23Delete useless 'extern' qualifiers for functionsBlue Swirl1-3/+3
'extern' qualifier is useless for function declarations. Delete them. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-01-23kvm: Consolidate must-have capability checksJan Kiszka1-0/+4
Instead of splattering the code with #ifdefs and runtime checks for capabilities we cannot work without anyway, provide central test infrastructure for verifying their availability both at build and runtime. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
2011-01-23kvm: Drop smp_cpus argument from init functionsJan Kiszka1-1/+1
No longer used. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
2010-12-26s390: compile fixesAlexander Graf2-2/+2
The s390 target doesn't compile out of the box anymore. This patch fixes all the obvious glitches that got introduced in the last few weeks. Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-10-30target-xxx: Use fprintf_function (format checking)Stefan Weil1-2/+1
fprintf_function uses format checking with GCC_FMT_ATTR. Format errors were fixed in * target-i386/helper.c * target-mips/translate.c * target-ppc/translate.c Cc: Blue Swirl <blauwirbel@gmail.com> Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-07-03remove exec-all.h inclusion from cpu.hPaolo Bonzini1-1/+0
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-07-03move cpu_pc_from_tb to target-*/exec.hPaolo Bonzini2-5/+6
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-05-18target-s390: enable SIGP Initial ResetAlexander Graf1-3/+14
For SMP to work with KVM, we need to properly emulate the SIGP Initial Reset Command. Recent (2.6.32) kernels issue that before the SIGP Reset command that actually wakes up the vcpu. This patch makes -smp work on S390x. Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-05-11Do not stop VM if emulation failed in userspace.Gleb Natapov1-0/+5
Continue vcpu execution in case emulation failure happened while vcpu was in userspace. In this case #UD will be injected into the guest allowing guest OS to kill offending process and continue. Signed-off-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
2010-05-11kvm: enable smp > 1Marcelo Tosatti1-0/+5
Process INIT/SIPI requests and enable -smp > 1. Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>
2010-04-01S390: Add stub for cpu_get_phys_page_debugAlexander Graf1-0/+5
We don't implement any virtual memory in the S390 target so far, so let's add a stub for this now mandatory function. Fixes building of S390 target. Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-03-17Large page TLB flushPaul Brook1-4/+5
QEMU uses a fixed page size for the CPU TLB. If the guest uses large pages then we effectively split these into multiple smaller pages, and populate the corresponding TLB entries on demand. When the guest invalidates the TLB by virtual address we must invalidate all entries covered by the large page. However the address used to invalidate the entry may not be present in the QEMU TLB, so we do not know which regions to clear. Implementing a full vaiable size TLB is hard and slow, so just keep a simple address/mask pair to record which addresses may have been mapped by large pages. If the guest invalidates this region then flush the whole TLB. Signed-off-by: Paul Brook <paul@codesourcery.com>
2010-03-12Remove cpu_get_phys_page_debug from userspace emulationPaul Brook1-5/+0
cpu_get_phys_page_debug makes no sense for userspace emulation, so remove it. Signed-off-by: Paul Brook <paul@codesourcery.com>
2010-03-12Move TARGET_PHYS_ADDR_SPACE_BITS to target-*/cpu.h.Richard Henderson1-0/+5
Removes a set of ifdefs from exec.c. Introduce TARGET_VIRT_ADDR_SPACE_BITS for all targets other than Alpha. This will be used for page_find_alloc, which is supposed to be using virtual addresses in the first place. Signed-off-by: Richard Henderson <rth@twiddle.net>
2010-03-07Update to a hopefully more future proof FSF addressBlue Swirl5-10/+5
See also 8167ee883931cb20c6264fc19d040ce2dc6ceaaa, 530e7615ce3c01882e582c84dc6304ab98a3d5c5 and fad6cb1a565bb73f83fc0e2654489457b489e436. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-03-04KVM: Rework VCPU state writeback APIJan Kiszka1-2/+1
This grand cleanup drops all reset and vmsave/load related synchronization points in favor of four(!) generic hooks: - cpu_synchronize_all_states in qemu_savevm_state_complete (initial sync from kernel before vmsave) - cpu_synchronize_all_post_init in qemu_loadvm_state (writeback after vmload) - cpu_synchronize_all_post_init in main after machine init - cpu_synchronize_all_post_reset in qemu_system_reset (writeback after system reset) These writeback points + the existing one of VCPU exec after cpu_synchronize_state map on three levels of writeback: - KVM_PUT_RUNTIME_STATE (during runtime, other VCPUs continue to run) - KVM_PUT_RESET_STATE (on synchronous system reset, all VCPUs stopped) - KVM_PUT_FULL_STATE (on init or vmload, all VCPUs stopped as well) This level is passed to the arch-specific VCPU state writing function that will decide which concrete substates need to be written. That way, no writer of load, save or reset functions that interact with in-kernel KVM states will ever have to worry about synchronization again. That also means that a lot of reasons for races, segfaults and deadlocks are eliminated. cpu_synchronize_state remains untouched, just as Anthony suggested. We continue to need it before reading or writing of VCPU states that are also tracked by in-kernel KVM subsystems. Consequently, this patch removes many cpu_synchronize_state calls that are now redundant, just like remaining explicit register syncs. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
2010-02-14Fix incorrect exception_index useBlue Swirl1-2/+2
env->exception_index should be cleared with -1, not 0. See also 821b19fe923ac49a24cdb4af902584fdd019cee6. Spotted by Igor Kovalenko. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-01-19kill regs_to_env and env_to_regsPaolo Bonzini1-8/+0
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-12-18target-s390: Fail on unknown instructionsAlexander Graf1-1/+1
We were being a bit too nice and didn't give the guest an invalid instruction interrupt. While that works, it's not exactly the fastest thing to do, since now the guest doesn't know that we're not really implementing that instruction, so it continues doing it. We run into this with the set_page_unstable hint instruction. So let's bail out in these cases. Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2009-12-05Add support for S390x system emulationAlexander Graf4-2/+208
Let's enable the basics for system emulation so we can run virtual machines with KVM! Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2009-12-05Add KVM support for S390xAlexander Graf1-0/+483
S390x was one of the first platforms that received support for KVM back in the day. Unfortunately until now there hasn't been a qemu implementation that would enable users to actually run guests. So let's include support for KVM S390x in qemu! Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2009-12-05S/390 CPU fake emulationAlexander Graf5-0/+372
Because Qemu currently requires a TCG target to exist and there are quite some useful helpers here to lay the groundwork for out KVM target, let's create a stub TCG emulation target for S390X CPUs. This is required to make tcg happy. The emulation target itself won't work though. Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>