summaryrefslogtreecommitdiffstats
path: root/target-s390x
Commit message (Collapse)AuthorAgeFilesLines
* Switch build system to accompanied kernel headersJan Kiszka2011-06-202-10/+1
| | | | | | | | | | | | | | | | | This helps reducing our build-time checks for feature support in the available Linux kernel headers. And it helps users that do not have sufficiently recent headers installed on their build machine. Consequently, the patch removes and build-time checks for kvm and vhost in configure, the --kerneldir switch, and KVM_CFLAGS. Kernel headers are supposed to be provided by QEMU only. s390 needs some extra love as it carries redefinitions from kernel headers. CC: Alexander Graf <agraf@suse.de> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
* s390x: implement lrvgrAlexander Graf2011-06-031-0/+3
| | | | | | | The LRVGR instruction was missing. Implement it, so everyone's happy. Reported-by: Balazs Kutil <bkutil@novell.com> Signed-off-by: Alexander Graf <agraf@suse.de>
* s390x: fix cksm instructionAlexander Graf2011-06-031-20/+8
| | | | | | | | | | | The cksm instruction was implemented incorrectly, rendering UDP and TCP checksum calculation wrong, making an emulated s390x Linux guest break in most networking operations. This patch fixes odd end checksum calculation, takes the input register as input for the checksum and optimizes the overflow pieces by a bit. Signed-off-by: Alexander Graf <agraf@suse.de>
* s390x: free tmp explicitly in every opcode for disas_a5()Alexander Graf2011-06-031-1/+12
| | | | | | | | | | | The disas_a5() function provided a TCG tmp variable which was populated by the respective opcode implementations, but freed at the end of the function in generic code. That makes it really hard for code review, so let's move the freeing to the same scope as the actual allocation. Signed-off-by: Alexander Graf <agraf@suse.de>
* target-s390x: Add missing tcg_temp_free_i32()Stefan Weil2011-06-031-0/+3
| | | | | Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Alexander Graf <agraf@suse.de>
* target-s390x: Add missing tcg_temp_free_i64() in disas_s390_insn(), opc == 0x90Stefan Weil2011-06-031-0/+1
| | | | | Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Alexander Graf <agraf@suse.de>
* target-s390x: Add missing tcg_temp_free_i64() in disas_s390_insn(), opc == 0x8eStefan Weil2011-06-031-0/+2
| | | | | Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Alexander Graf <agraf@suse.de>
* target-s390x: Add missing tcg_temp_free_i64() in disas_b2()Stefan Weil2011-06-031-0/+2
| | | | | Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Alexander Graf <agraf@suse.de>
* target-s390x: Add missing tcg_temp_free_i64() in do_mh()Stefan Weil2011-06-031-0/+1
| | | | | Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Alexander Graf <agraf@suse.de>
* target-s390x: Add missing tcg_temp_free_i64() in gen_jcc()Stefan Weil2011-06-031-0/+1
| | | | | Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Alexander Graf <agraf@suse.de>
* target-s390x: Fix duplicate call of tcg_temp_new_i64Stefan Weil2011-06-031-1/+0
| | | | | | | | tmp2 = tcg_temp_new_i64() is already executed unconditionally, so there is no need to call it a second time for 64 bit hosts. Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Alexander Graf <agraf@suse.de>
* target-s390x: Fix wrong argument in call of tcg_gen_shl_i64()Stefan Weil2011-06-031-2/+2
| | | | | | | | | | | | tcg_gen_shl_i64 needs a 3rd argument of type TCGv_i64. Set tmp4 so it can be used here. v2: Don't call tcg_const_i64() inside of the loop because it creates additional code. Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Alexander Graf <agraf@suse.de>
* target-s390x: Fix build for non-linux hostsStefan Weil2011-06-031-5/+0
| | | | | | | | | | | linux/kvm.h is not always available for compilation. Neither linux/kvm.h nor kvm.h are needed, so remove both which also fixes the build problem for non-linux hosts. Cc: Alexander Graf <agraf@suse.de> Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Alexander Graf <agraf@suse.de>
* s390x: fix memory detection for guests > 64GBChristian Borntraeger2011-05-201-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>
* 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: remove compatibility cc fieldAlexander Graf2011-05-201-1/+0
| | | | | | | Remove the now unused cc field that was only required to not break bisectability. Signed-off-by: Alexander Graf <agraf@suse.de>
* s390x: translate engine for s390x CPUAlexander Graf2011-05-201-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>
* 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: Implement opcode helpersAlexander Graf2011-05-202-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>
* s390x: helper functions for system emulationAlexander Graf2011-05-203-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>
* s390x: Shift variables in CPUState for memset(0)Alexander Graf2011-05-201-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>
* s390x: keep hint on virtio managing sizeAlexander Graf2011-05-201-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>
* s390x: make kvm exported functions conditional on kvmAlexander Graf2011-05-201-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>
* 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>
* Remove unused function parameter from cpu_restore_stateStefan Weil2011-04-201-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>
* Remove unused function parameters from gen_pc_load and rename the functionStefan Weil2011-04-201-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>
* s390x: Enable s390x-softmmu targetAlexander Graf2011-04-182-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>
* s390x: Prepare cpu.h for emulationAlexander Graf2011-04-183-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>
* 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>
* always qemu_cpu_kick after unhalting a cpuPaolo Bonzini2011-03-131-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>
* inline cpu_halted into sole callerPaolo Bonzini2011-03-131-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>
* kvm: Drop return values from kvm_arch_pre/post_runJan Kiszka2011-02-141-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>
* kvm: Provide sigbus services arch-independentlyJan Kiszka2011-02-141-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>
* Merge remote branch 'qemu-kvm/uq/master' into stagingAnthony Liguori2011-02-011-1/+5
|\ | | | | | | | | | | aliguori: fix build with !defined(KVM_CAP_ASYNC_PF) Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
| * kvm: Consolidate must-have capability checksJan Kiszka2011-01-231-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>
| * kvm: Drop smp_cpus argument from init functionsJan Kiszka2011-01-231-1/+1
| | | | | | | | | | | | | | No longer used. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
* | Delete useless 'extern' qualifiers for functionsBlue Swirl2011-01-231-3/+3
|/ | | | | | | 'extern' qualifier is useless for function declarations. Delete them. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* s390: compile fixesAlexander Graf2010-12-262-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>
* target-xxx: Use fprintf_function (format checking)Stefan Weil2010-10-301-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>
* remove exec-all.h inclusion from cpu.hPaolo Bonzini2010-07-031-1/+0
| | | | | Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* move cpu_pc_from_tb to target-*/exec.hPaolo Bonzini2010-07-032-5/+6
| | | | | Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* target-s390: enable SIGP Initial ResetAlexander Graf2010-05-181-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>
* Do not stop VM if emulation failed in userspace.Gleb Natapov2010-05-111-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>
* kvm: enable smp > 1Marcelo Tosatti2010-05-111-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>
* S390: Add stub for cpu_get_phys_page_debugAlexander Graf2010-04-011-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>
* Large page TLB flushPaul Brook2010-03-171-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>
* Remove cpu_get_phys_page_debug from userspace emulationPaul Brook2010-03-121-5/+0
| | | | | | cpu_get_phys_page_debug makes no sense for userspace emulation, so remove it. Signed-off-by: Paul Brook <paul@codesourcery.com>
* Move TARGET_PHYS_ADDR_SPACE_BITS to target-*/cpu.h.Richard Henderson2010-03-121-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>
OpenPOWER on IntegriCloud