Commit graph

206 commits

Author SHA1 Message Date
Eric Farman fcb79802e0 s390x: Vector Register IOCTLs
Handle the actual syncing of the vector registers with kernel space,
via the get/put register IOCTLs.

The vector registers that were introduced with the z13 overlay
the existing floating point registers.  FP registers 0-15 are
the high-halves of vector registers 0-15.  Thus, remove the
freg fields and replace them with the equivalent vector field
to avoid errors in duplication.  Moreover, synchronize either the
vector registers via kvm_sync_regs, or floating point registers
via the GET/SET FPU IOCTLs.

Signed-off-by: Eric Farman <farman@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
2015-05-27 17:52:03 +02:00
Eric Farman c498d8e36e s390x: Common access to floating point registers
Provide a routine to access the correct floating point register,
to simplify future expansion.

Suggested-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: Eric Farman <farman@linux.vnet.ibm.com>
Reviewed-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
2015-05-27 17:52:03 +02:00
Alexander Graf 57af7289f2 s390x: Add interlocked access facility 1 instructions
We're currently missing all instructions defined by the "interlocked-access
facility 1" which is part of zEC12. This patch implements all of them except
for LPD and LPDG.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Richard Henderson <rth@twiddle.net>
2015-05-13 14:48:54 +02:00
Alexander Graf c095ed731c s390x: Fix stoc direction
The store conditional instruction wants to store when the condition
is fulfilled, so we should branch out when it's not true.

The code today branches out when the condition is true, clearly
reversing the logic. Fix it up by negating the condition.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Richard Henderson <rth@twiddle.net>
2015-05-13 14:48:54 +02:00
Stefan Weil 631b22ea20 misc: Fix new collection of typos
All of them were reported by codespell.
Most typos are in comments, one is in an error message.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2015-04-30 16:05:48 +03:00
Richard Henderson 42a268c241 tcg: Change translator-side labels to a pointer
This is improved type checking for the translators -- it's no longer
possible to accidentally swap arguments to the branch functions.

Note that the code generating backends still manipulate labels as int.

With notable exceptions, the scope of the change is just a few lines
for each target, so it's not worth building extra machinery to do this
change in per-target increments.

Cc: Peter Maydell <peter.maydell@linaro.org>
Cc: Edgar E. Iglesias <edgar.iglesias@gmail.com>
Cc: Michael Walle <michael@walle.cc>
Cc: Leon Alrae <leon.alrae@imgtec.com>
Cc: Anthony Green <green@moxielogic.com>
Cc: Jia Liu <proljc@gmail.com>
Cc: Alexander Graf <agraf@suse.de>
Cc: Aurelien Jarno <aurelien@aurel32.net>
Cc: Blue Swirl <blauwirbel@gmail.com>
Cc: Guan Xuetao <gxt@mprc.pku.edu.cn>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Max Filippov <jcmvbkbc@gmail.com>
Reviewed-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
Signed-off-by: Richard Henderson <rth@twiddle.net>
2015-03-13 12:28:18 -07:00
Richard Henderson fe700adb3d tcg: Introduce tcg_op_buf_count and tcg_op_buf_full
The method by which we count the number of ops emitted
is going to change.  Abstract that away into some inlines.

Reviewed-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
Signed-off-by: Richard Henderson <rth@twiddle.net>
2015-02-12 21:21:38 -08:00
Richard Henderson 0a7df5da98 tcg: Move emit of INDEX_op_end into gen_tb_end
Reviewed-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
Signed-off-by: Richard Henderson <rth@twiddle.net>
2015-02-12 21:21:38 -08:00
Peter Maydell 8841d9dfc7 target-s390x: Mark check_privileged() as !CONFIG_USER_ONLY
The function check_privileged() is only used in the softmmu configs;
wrap it in an #ifndef CONFIG_USER_ONLY to avoid clang warnings on the
linux-user builds.

[rth: Remove inline marker too; it was only there to prevent exactly
this warning in GCC.]

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Stefan Weil <sw@weilnetz.de>
Message-id: 1419373100-17690-2-git-send-email-peter.maydell@linaro.org
Signed-off-by: Richard Henderson <rth@twiddle.net>
2015-02-03 12:25:48 -08:00
Richard Henderson 0774710f1b target-s390: Implement ECAG
Signed-off-by: Richard Henderson <rth@twiddle.net>
2015-02-03 12:06:37 -08:00
Richard Henderson 9c3fd85b14 target-s390: Implement LURA, LURAG, STURG
Signed-off-by: Richard Henderson <rth@twiddle.net>
2015-02-03 12:06:37 -08:00
Richard Henderson 7f745b31b3 target-s390: Fix STIDP
The implementation had been incomplete, as we did not store the
machine type.  Note that the machine_type member is still unset
during initialization, so this has no effect yet.

Signed-off-by: Richard Henderson <rth@twiddle.net>
2015-02-03 12:06:37 -08:00
Richard Henderson e30a9d3fea target-s390: Implement EPSW
Signed-off-by: Richard Henderson <rth@twiddle.net>
2015-02-03 12:06:37 -08:00
Richard Henderson 8612c93583 target-s390: Implement SAM specification exception
Also, these are user-mode instructions; allow their use
in CONFIG_USER_ONLY.

Signed-off-by: Richard Henderson <rth@twiddle.net>
2015-02-03 12:06:37 -08:00
Paolo Bonzini cd42d5b236 gen-icount: check cflags instead of use_icount global
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Pavel Dovgalyuk <pavel.dovgaluk@ispras.ru>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2015-01-03 09:22:12 +01:00
Alexander Graf 44dd33ba8f s390x: Implement SAM{24,31,64}
The SAM instructions simply change 2 bits in PSW.MASK to advertise
the current memory mode. While we can't fully guarantee that 31 bit
mode (or even remotely 24 bit mode) actually work correctly, we don't
check whether lpswe modifies these bits, so we shouldn't keep the
guest from executing SAM instructions either.

This patch implements all SAM instrutions with their actual PSW changing
semantics, making more recent Linux kernels boot properly which do issue
a SAM31 call during early boot.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
Reviewed-by: Richard Henderson <rth@twiddle.net>
2014-11-05 12:01:28 +01:00
Lluís Vilanova a7e30d84ce trace: [tcg] Include TCG-tracing header on all targets
Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2014-08-12 14:26:12 +01:00
Peter Maydell 55818ad812 target-s390x: Remove unused ld_code6() function
The ld_code6() function is unused; remove it.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2014-06-24 20:01:24 +04:00
Paolo Bonzini f08b617018 softmmu: introduce cpu_ldst.h
This will collect all load and store helpers soon.  For now
it is just a replacement for softmmu_exec.h, which this patch
stops including directly, but we also include it where this will
be necessary in order to simplify the next patch.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2014-06-05 16:10:33 +02:00
Richard Henderson 2ef6175aa7 tcg: Invert the inclusion of helper.h
Rather than include helper.h with N values of GEN_HELPER, include a
secondary file that sets up the macros to include helper.h.  This
minimizes the files that must be rebuilt when changing the macros
for file N.

Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Richard Henderson <rth@twiddle.net>
2014-05-28 09:33:54 -07:00
Andreas Färber f0c3c505a8 cpu: Move breakpoints field from CPU_COMMON to CPUState
Most targets were using offsetof(CPUFooState, breakpoints) to determine
how much of CPUFooState to clear on reset. Use the next field after
CPU_COMMON instead, if any, or sizeof(CPUFooState) otherwise.

Signed-off-by: Andreas Färber <afaerber@suse.de>
2014-03-13 19:20:47 +01:00
Richard Henderson 5cd8f6210f tcg: Move helper registration into tcg_context_init
No longer needs to be done on a per-target basis.

Signed-off-by: Richard Henderson <rth@twiddle.net>
2013-10-10 11:43:37 -07:00
Richard Henderson 8cfd04959a tcg: Change tcg_gen_exit_tb argument to uintptr_t
And update all users.

Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
2013-09-02 09:08:30 -07:00
Andreas Färber ed2803da58 cpu: Move singlestep_enabled field from CPU_COMMON to CPUState
Prepares for changing cpu_single_step() argument to CPUState.

Acked-by: Michael Walle <michael@walle.cc> (for lm32)
Signed-off-by: Andreas Färber <afaerber@suse.de>
2013-07-23 02:41:32 +02:00
Andreas Färber d9916c23d3 target-s390x: Change gen_intermediate_code_internal() argument to S390CPU
Also use bool type while at it.

Prepares for moving singlestep_enabled field to CPUState.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Andreas Färber <afaerber@suse.de>
2013-07-09 21:33:03 +02:00
Andreas Färber 878096eeb2 cpu: Turn cpu_dump_{state,statistics}() into CPUState hooks
Make cpustats monitor command available unconditionally.

Prepares for changing kvm_handle_internal_error() and kvm_cpu_exec()
arguments to CPUState.

Signed-off-by: Andreas Färber <afaerber@suse.de>
2013-06-28 13:25:12 +02:00
Stefan Weil 805a250502 Trivial grammar and spelling fixes
similiar -> similar
recieve -> receive
transfered -> transferred
preperation -> preparation

Most changes are in comments, one modifies a parameter name in a function
prototype.

The spelling fixes were made using codespell.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Acked-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2013-05-01 20:55:21 +04:00
Richard Henderson 5b90a86629 target-s390: Fix SRNMT
Fallthough into abort = oops.

Cc: qemu-trivial@nongnu.org
Cc: Alexander Graf <agraf@suse.de>
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-04-05 14:54:11 +02:00
Peter Maydell 085d813407 Fix typos and misspellings
Fix various typos and misspellings. The bulk of these were found with
codespell.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-03-22 13:25:07 +01:00
Peter Maydell 806f352d3d gen-icount.h: Rename gen_icount_start/end to gen_tb_start/end
The gen_icount_start/end functions are now somewhat misnamed since they
are useful for generic "start/end of TB" code, used for more than just
icount. Rename them to gen_tb_start/end.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2013-03-03 14:29:08 +00:00
Richard Henderson dc46d1c68a target-s390x: Use mulu2 for mlgr insn
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2013-02-23 17:25:29 +00:00
Richard Henderson b7886de3f3 target-s390: Perform COMPARE AND SWAP inline
Still no proper solution for CONFIG_USER_ONLY, but the system
version is significantly better.

Signed-off-by: Richard Henderson <rth@twiddle.net>
2013-01-05 12:18:46 -08:00
Richard Henderson bacf43c62e target-s390: Optimize get_address
Don't load the displacement into a register first, add it second
so that tcg_gen_addi_i64 can eliminate zeros.  Don't mask the
displacement first so that we don't turn small negative numbers
into large positive numbers.

Signed-off-by: Richard Henderson <rth@twiddle.net>
2013-01-05 12:18:46 -08:00
Richard Henderson c95ec459c6 target-s390: Optimize ADDC/SUBB
Giving the proper mask to disas_jcc allows us to generate an inline
comparison generating the carry/borrow with setcond.

In the very worst case, when we must use the external helper to compute
a value for CC, we generate (cc > 1) instead of (cc >> 1), which is only
very slightly slower on common cpus.

In the very best case, when the CC comes from a COMPARE insn and the
compiler is using ALCG with zero, everything folds out to become just
the setcond that the compiler wanted.

Signed-off-by: Richard Henderson <rth@twiddle.net>
2013-01-05 12:18:46 -08:00
Richard Henderson a359b770c6 target-s390: Optimize ADDU/SUBU CC testing
We can easily generate some masks for logical add/subtract inline.

Signed-off-by: Richard Henderson <rth@twiddle.net>
2013-01-05 12:18:45 -08:00
Richard Henderson de379661d5 target-s390: Tidy comparisons
After full conversion, we can audit the uses of LTGT cc ops
and see that none of the instructions can ever set CC=3.
Thus we can extend the table to treat that bit as ignored.

This fixes a regression wrt the pre-conversion translation
in which NE was used for both m=6 and m=7.

Signed-off-by: Richard Henderson <rth@twiddle.net>
2013-01-05 12:18:45 -08:00
Richard Henderson f24c49c24a target-s390: Optmize emitting discards
While they aren't expensive, they aren't free to process.  When we
know that the three cc helper variables are dead, don't kill them.

Signed-off-by: Richard Henderson <rth@twiddle.net>
2013-01-05 12:18:45 -08:00
Richard Henderson d074ac6d26 target-s390: Optimize XC
Notice XC with same address and convert that to store of zero.

Signed-off-by: Richard Henderson <rth@twiddle.net>
2013-01-05 12:18:45 -08:00
Richard Henderson 411edc22cb target-s390: Implement LOAD/SET FP AND SIGNAL
Signed-off-by: Richard Henderson <rth@twiddle.net>
2013-01-05 12:18:45 -08:00
Richard Henderson a12000b9ec target-s390: Implement SET ROUNDING MODE
Signed-off-by: Richard Henderson <rth@twiddle.net>
2013-01-05 12:18:45 -08:00
Richard Henderson 49f7ee802f target-s390: Check insn operand specifications
Removes all the fixmes for even register numbers, etc.

Signed-off-by: Richard Henderson <rth@twiddle.net>
2013-01-05 12:18:45 -08:00
Richard Henderson 2db014b5a7 target-s390: Implement CPSDR
Signed-off-by: Richard Henderson <rth@twiddle.net>
2013-01-05 12:18:45 -08:00
Richard Henderson 99b4f24b3e target-s390: Implement POPCNT
Signed-off-by: Richard Henderson <rth@twiddle.net>
2013-01-05 12:18:45 -08:00
Richard Henderson 2112bf1bfb target-s390: Implement CONVERT FROM LOGICAL
Signed-off-by: Richard Henderson <rth@twiddle.net>
2013-01-05 12:18:44 -08:00
Richard Henderson 6ac1b45f9b target-s390: Implement CONVERT TO LOGICAL
Signed-off-by: Richard Henderson <rth@twiddle.net>
2013-01-05 12:18:44 -08:00
Richard Henderson b92fa33486 target-s390: Implement STORE ON CONDITION
Signed-off-by: Richard Henderson <rth@twiddle.net>
2013-01-05 12:18:44 -08:00
Richard Henderson 632086da28 target-s390: Implement LOAD ON CONDITION
Signed-off-by: Richard Henderson <rth@twiddle.net>
2013-01-05 12:18:44 -08:00
Richard Henderson 1c26875182 target-s390: Implement COMPARE AND TRAP
Signed-off-by: Richard Henderson <rth@twiddle.net>
2013-01-05 12:18:44 -08:00
Richard Henderson d6c6372e18 target-s390: Implement R[NOX]SBG
Signed-off-by: Richard Henderson <rth@twiddle.net>
2013-01-05 12:18:44 -08:00
Richard Henderson 2d6a869833 target-s390: Implement RISBG
Signed-off-by: Richard Henderson <rth@twiddle.net>
2013-01-05 12:18:44 -08:00