]> Git Repo - qemu.git/log
qemu.git
6 years agoppc: move at24c to its own CONFIG_ symbol
Paolo Bonzini [Tue, 22 May 2018 19:17:43 +0000 (21:17 +0200)]
ppc: move at24c to its own CONFIG_ symbol

AT24c EEPROM is currently gated by CONFIG_I2C, and as such it is
being included in all emulators that use I2C, even if they do not
really need it.  Separate it and, since it was added for the e500
machines, add it to qemu-system-ppc and qemu-system-ppc64.

Signed-off-by: Paolo Bonzini <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Reviewed-by: Thomas Huth <[email protected]>
Message-Id: <20180522191743[email protected]>
[lv: rebase]
Signed-off-by: Laurent Vivier <[email protected]>
6 years agohw/intc/gicv3: Remove useless parenthesis around DIV_ROUND_UP macro
Philippe Mathieu-Daudé [Thu, 5 Jul 2018 15:58:11 +0000 (12:58 -0300)]
hw/intc/gicv3: Remove useless parenthesis around DIV_ROUND_UP macro

Patch created mechanically by rerunning:

  $  spatch --sp-file scripts/coccinelle/round.cocci \
            --macro-file scripts/cocci-macro-file.h \
            --dir . --in-place

Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
Acked-by: Michael S. Tsirkin <[email protected]>
Message-Id: <20180705155811[email protected]>
Signed-off-by: Laurent Vivier <[email protected]>
6 years agohw/pci-host: Remove useless parenthesis around DIV_ROUND_UP macro
Philippe Mathieu-Daudé [Thu, 5 Jul 2018 15:58:10 +0000 (12:58 -0300)]
hw/pci-host: Remove useless parenthesis around DIV_ROUND_UP macro

Patch created mechanically by rerunning:

  $  spatch --sp-file scripts/coccinelle/round.cocci \
            --macro-file scripts/cocci-macro-file.h \
            --dir . --in-place

Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
Reviewed-by: Markus Armbruster <[email protected]>
Acked-by: Michael S. Tsirkin <[email protected]>
Message-Id: <20180705155811[email protected]>
Signed-off-by: Laurent Vivier <[email protected]>
6 years agotests/bios-tables-test: Remove an useless cast
Philippe Mathieu-Daudé [Thu, 5 Jul 2018 15:58:08 +0000 (12:58 -0300)]
tests/bios-tables-test: Remove an useless cast

Patch created mechanically by rerunning:

  $  spatch --sp-file scripts/coccinelle/typecast.cocci \
            --macro-file scripts/cocci-macro-file.h \
            --dir . --in-place

Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
Reviewed-by: Markus Armbruster <[email protected]>
Acked-by: Michael S. Tsirkin <[email protected]>
Message-Id: <20180705155811[email protected]>
Signed-off-by: Laurent Vivier <[email protected]>
6 years agoxen: Use the PCI_DEVICE macro
Philippe Mathieu-Daudé [Thu, 5 Jul 2018 15:58:07 +0000 (12:58 -0300)]
xen: Use the PCI_DEVICE macro

TYPE_XEN_PT_DEVICE is a subclass of TYPE_PCI_DEVICE, the clean way
to access the PCIDevice pointer is using the PCI_DEVICE() macro.

Suggested-by: Peter Maydell <[email protected]>
Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
Reviewed-by: Markus Armbruster <[email protected]>
Acked-by: Anthony PERARD <[email protected]>
Acked-by: Michael S. Tsirkin <[email protected]>
Message-Id: <20180705155811[email protected]>
Signed-off-by: Laurent Vivier <[email protected]>
6 years agoqobject: Catch another straggler for use of qdict_put_str()
Philippe Mathieu-Daudé [Thu, 5 Jul 2018 15:58:05 +0000 (12:58 -0300)]
qobject: Catch another straggler for use of qdict_put_str()

Patch created mechanically by rerunning:

  $  spatch --sp-file scripts/coccinelle/qobject.cocci \
            --macro-file scripts/cocci-macro-file.h \
            --dir . --in-place

Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
Reviewed-by: Markus Armbruster <[email protected]>
Acked-by: Michael S. Tsirkin <[email protected]>
Message-Id: <20180705155811[email protected]>
Signed-off-by: Laurent Vivier <[email protected]>
6 years agoconfigure: Support pkg-config for zlib
Stefan Weil [Thu, 12 Jul 2018 19:26:03 +0000 (21:26 +0200)]
configure: Support pkg-config for zlib

This is needed for builds with the mingw64-* packages from Cygwin,
but also works for Linux.

Move the zlib test also more to the end because users should
get information on the really important missing packages
(which also require zlib) first.

Signed-off-by: Stefan Weil <[email protected]>
Reviewed-by: Stefan Hajnoczi <[email protected]>
Message-Id: <20180712192603[email protected]>
Signed-off-by: Laurent Vivier <[email protected]>
6 years agotests: Fix typos in comments and help message (found by codespell)
Stefan Weil [Fri, 13 Jul 2018 05:47:55 +0000 (07:47 +0200)]
tests: Fix typos in comments and help message (found by codespell)

Fix also a grammar issue.

Signed-off-by: Stefan Weil <[email protected]>
Reviewed-by: Alex Bennée <[email protected]>
Message-Id: <20180713054755[email protected]>
Signed-off-by: Laurent Vivier <[email protected]>
6 years agocpu.h: fix a typo in comment
Li Qiang [Wed, 5 Sep 2018 12:29:08 +0000 (05:29 -0700)]
cpu.h: fix a typo in comment

Found by reading the code.

Signed-off-by: Li Qiang <[email protected]>
Message-Id: <1536150548[email protected]>
Signed-off-by: Laurent Vivier <[email protected]>
6 years agolinux-user: fix comment s/atomic_write/atomic_set/
Emilio G. Cota [Sat, 11 Aug 2018 21:10:11 +0000 (17:10 -0400)]
linux-user: fix comment s/atomic_write/atomic_set/

Signed-off-by: Emilio G. Cota <[email protected]>
Message-Id: <20180811211011[email protected]>
Signed-off-by: Laurent Vivier <[email protected]>
6 years agoqemu-iotests: make 218 executable
Cleber Rosa [Thu, 4 Oct 2018 16:18:45 +0000 (12:18 -0400)]
qemu-iotests: make 218 executable

Commit 990dc39c made all tests executable at the time, but 218 came in
later, and missing those permissions.

Signed-off-by: Cleber Rosa <[email protected]>
Message-Id: <20181004161852[email protected]>
Signed-off-by: Laurent Vivier <[email protected]>
6 years agoscripts/qemu.py: remove trailing quotes on docstring
Cleber Rosa [Thu, 4 Oct 2018 16:18:52 +0000 (12:18 -0400)]
scripts/qemu.py: remove trailing quotes on docstring

Signed-off-by: Cleber Rosa <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Message-Id: <20181004161852[email protected]>
Signed-off-by: Laurent Vivier <[email protected]>
6 years agoscripts/decodetree.py: remove unused imports
Cleber Rosa [Thu, 4 Oct 2018 16:18:49 +0000 (12:18 -0400)]
scripts/decodetree.py: remove unused imports

Signed-off-by: Cleber Rosa <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Message-Id: <20181004161852[email protected]>
Signed-off-by: Laurent Vivier <[email protected]>
6 years agodocs/devel/testing.rst: add missing newlines after code block
Cleber Rosa [Thu, 4 Oct 2018 16:18:47 +0000 (12:18 -0400)]
docs/devel/testing.rst: add missing newlines after code block

The line immediate following a ".. code::" block is considered
to contains arguments to the "code directive".  The lack of a
new line gives me during at parse time:

   testing.rst:63: (ERROR/3) Error in "code" directive:
   maximum 1 argument(s) allowed, 3 supplied.

   .. code::
     make check-unit V=1

   testing.rst:120: (ERROR/3) Error in "code" directive:
   maximum 1 argument(s) allowed, 3 supplied.

   .. code::
     make check-qtest V=1

Let's add the missing newlines, both for consistency and to
avoid the parsing errors.

Signed-off-by: Cleber Rosa <[email protected]>
Reviewed-by: John Snow <[email protected]>
Message-Id: <20181004161852[email protected]>
Signed-off-by: Laurent Vivier <[email protected]>
6 years agoqemu-iotests: fix filename containing checks
Cleber Rosa [Thu, 4 Oct 2018 16:18:46 +0000 (12:18 -0400)]
qemu-iotests: fix filename containing checks

Commit cce293a2945 moved some functions from common.config to
common.rc, but the error messages still reference the old file
location.

Signed-off-by: Cleber Rosa <[email protected]>
Reviewed-by: Max Reitz <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Message-Id: <20181004161852[email protected]>
Signed-off-by: Laurent Vivier <[email protected]>
6 years agotests/tcg/README: fix location for lm32 tests
Cleber Rosa [Thu, 4 Oct 2018 16:18:44 +0000 (12:18 -0400)]
tests/tcg/README: fix location for lm32 tests

Point to the right and obvious location for lm32 tests.

Signed-off-by: Cleber Rosa <[email protected]>
Reviewed-by: Thomas Huth <[email protected]>
Acked-by: Alex Bennée <[email protected]>
Message-Id: <20181004161852[email protected]>
Signed-off-by: Laurent Vivier <[email protected]>
6 years agomemory.h: fix typos in comments
Li Qiang [Tue, 9 Oct 2018 10:21:07 +0000 (03:21 -0700)]
memory.h: fix typos in comments

Signed-off-by: Li Qiang <[email protected]>
Reviewed-by: Peter Maydell <[email protected]>
Message-Id: <1539080467[email protected]>
[lv: s/types/typos/]
Signed-off-by: Laurent Vivier <[email protected]>
6 years agovga_int: remove unused function protype
yuchenlin [Mon, 22 Oct 2018 08:00:53 +0000 (16:00 +0800)]
vga_int: remove unused function protype

Signed-off-by: yuchenlin <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Message-Id: <20181022080053[email protected]>
Signed-off-by: Laurent Vivier <[email protected]>
6 years agoconfigs/alpha: Remove unused CONFIG_PARALLEL_ISA switch
Thomas Huth [Wed, 24 Oct 2018 10:18:34 +0000 (11:18 +0100)]
configs/alpha: Remove unused CONFIG_PARALLEL_ISA switch

We don't use CONFIG_PARALLEL_ISA in any of our Makefiles, so this
is just a dead config option which can be removed.

Fixes: a4cb773928e047b137c6998209cf2eec857fac6b
Signed-off-by: Thomas Huth <[email protected]>
Acked-by: Richard Henderson <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Message-Id: <1540376314[email protected]>
Signed-off-by: Laurent Vivier <[email protected]>
6 years agoMerge remote-tracking branch 'remotes/riscv/tags/riscv-for-master-3.1-sf0' into staging
Peter Maydell [Thu, 25 Oct 2018 16:41:03 +0000 (17:41 +0100)]
Merge remote-tracking branch 'remotes/riscv/tags/riscv-for-master-3.1-sf0' into staging

First RISC-V Patch Set for the 3.1 Soft Freeze

This pull request contains a handful of patches that have been floating
around various trees for a while but haven't made it upstream.  These
patches all appear quite safe.  They're all somewhat independent from
each other:

* One refactors our IRQ management function to allow multiple interrupts
  to be raised an once.  This patch has no functional difference.
* Cleaning up the op_helper/cpu_helper split.  This patch has no
  functional difference.
* Updates to various constants to keep them in sync with the latest ISA
  specification and to remove some non-standard bits that snuck in.
* A fix for a memory leak in the PLIC driver.
* A fix to our device tree handling to avoid provinging a NULL string.

I've given this my standard test: building the port, booting a Fedora
root filesytem on the latest Linux tag, and then shutting down that
image.  Essentially I'm just following the QEMU RISC-V wiki page's
instructions.  Everything looks fine here.

We have a lot more outstanding patches so I'll definately be submitting
another PR for the soft freeze.

# gpg: Signature made Wed 17 Oct 2018 21:17:52 BST
# gpg:                using RSA key EF4CA1502CCBAB41
# gpg: Good signature from "Palmer Dabbelt <[email protected]>"
# gpg:                 aka "Palmer Dabbelt <[email protected]>"
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: 00CE 76D1 8349 60DF CE88  6DF8 EF4C A150 2CCB AB41

* remotes/riscv/tags/riscv-for-master-3.1-sf0:
  RISC-V: Don't add NULL bootargs to device-tree
  RISC-V: Add missing free for plic_hart_config
  RISC-V: Update CSR and interrupt definitions
  RISC-V: Move non-ops from op_helper to cpu_helper
  RISC-V: Allow setting and clearing multiple irqs

Signed-off-by: Peter Maydell <[email protected]>
6 years agoMerge remote-tracking branch 'remotes/berrange/tags/qcrypto-next-pull-request' into...
Peter Maydell [Wed, 24 Oct 2018 21:08:42 +0000 (22:08 +0100)]
Merge remote-tracking branch 'remotes/berrange/tags/qcrypto-next-pull-request' into staging

Improve performance of XTS cipher mode impl

The XTS cipher mode performance is approximately doubled and test
coverage is improved.

# gpg: Signature made Wed 24 Oct 2018 19:05:08 BST
# gpg:                using RSA key BE86EBB415104FDF
# gpg: Good signature from "Daniel P. Berrange <[email protected]>"
# gpg:                 aka "Daniel P. Berrange <[email protected]>"
# Primary key fingerprint: DAF3 A6FD B26B 6291 2D0E  8E3F BE86 EBB4 1510 4FDF

* remotes/berrange/tags/qcrypto-next-pull-request:
  crypto: add testing for unaligned buffers with XTS cipher mode
  crypto: refactor XTS cipher mode test suite
  crypto: annotate xts_tweak_encdec as inlineable
  crypto: convert xts_mult_x to use xts_uint128 type
  crypto: convert xts_tweak_encdec to use xts_uint128 type
  crypto: introduce a xts_uint128 data type
  crypto: remove code duplication in tweak encrypt/decrypt
  crypto: expand algorithm coverage for cipher benchmark

Signed-off-by: Peter Maydell <[email protected]>
6 years agocrypto: add testing for unaligned buffers with XTS cipher mode
Daniel P. Berrangé [Tue, 16 Oct 2018 09:17:12 +0000 (10:17 +0100)]
crypto: add testing for unaligned buffers with XTS cipher mode

Validate that the XTS cipher mode will correctly operate with plain
text, cipher text and IV buffers that are not 64-bit aligned.

Reviewed-by: Alberto Garcia <[email protected]>
Signed-off-by: Daniel P. Berrangé <[email protected]>
6 years agocrypto: refactor XTS cipher mode test suite
Daniel P. Berrangé [Mon, 15 Oct 2018 17:03:41 +0000 (18:03 +0100)]
crypto: refactor XTS cipher mode test suite

The current XTS test overloads two different tests in a single function
making the code a little hard to follow. Split it into distinct test
cases.

Reviewed-by: Alberto Garcia <[email protected]>
Signed-off-by: Daniel P. Berrangé <[email protected]>
6 years agocrypto: annotate xts_tweak_encdec as inlineable
Daniel P. Berrangé [Tue, 9 Oct 2018 09:50:43 +0000 (10:50 +0100)]
crypto: annotate xts_tweak_encdec as inlineable

Encouraging the compiler to inline xts_tweak_encdec increases the
performance for xts-aes-128 when built with gcrypt:

  Encrypt: 545 MB/s -> 580 MB/s
  Decrypt: 568 MB/s -> 602 MB/s

Reviewed-by: Alberto Garcia <[email protected]>
Signed-off-by: Daniel P. Berrangé <[email protected]>
6 years agocrypto: convert xts_mult_x to use xts_uint128 type
Daniel P. Berrangé [Tue, 9 Oct 2018 09:55:14 +0000 (10:55 +0100)]
crypto: convert xts_mult_x to use xts_uint128 type

Using 64-bit arithmetic increases the performance for xts-aes-128
when built with gcrypt:

  Encrypt: 355 MB/s -> 545 MB/s
  Decrypt: 362 MB/s -> 568 MB/s

Reviewed-by: Alberto Garcia <[email protected]>
Signed-off-by: Daniel P. Berrangé <[email protected]>
6 years agocrypto: convert xts_tweak_encdec to use xts_uint128 type
Daniel P. Berrangé [Tue, 9 Oct 2018 09:50:43 +0000 (10:50 +0100)]
crypto: convert xts_tweak_encdec to use xts_uint128 type

Using 64-bit arithmetic increases the performance for xts-aes-128
when built with gcrypt:

  Encrypt: 272 MB/s -> 355 MB/s
  Decrypt: 275 MB/s -> 362 MB/s

Reviewed-by: Alberto Garcia <[email protected]>
Signed-off-by: Daniel P. Berrangé <[email protected]>
6 years agocrypto: introduce a xts_uint128 data type
Daniel P. Berrangé [Tue, 9 Oct 2018 09:45:41 +0000 (10:45 +0100)]
crypto: introduce a xts_uint128 data type

The new type is designed to allow use of 64-bit arithmetic instead
of operating 1-byte at a time. The following patches will use this to
improve performance.

Reviewed-by: Alberto Garcia <[email protected]>
Signed-off-by: Daniel P. Berrangé <[email protected]>
6 years agocrypto: remove code duplication in tweak encrypt/decrypt
Daniel P. Berrangé [Mon, 8 Oct 2018 13:13:28 +0000 (14:13 +0100)]
crypto: remove code duplication in tweak encrypt/decrypt

The tweak encrypt/decrypt functions are identical except for the
comments, so can be merged. Profiling data shows that the compiler is
in fact already merging the two merges in the object files.

Reviewed-by: Marc-André Lureau <[email protected]>
Reviewed-by: Alberto Garcia <[email protected]>
Signed-off-by: Daniel P. Berrangé <[email protected]>
6 years agocrypto: expand algorithm coverage for cipher benchmark
Daniel P. Berrangé [Mon, 8 Oct 2018 13:12:04 +0000 (14:12 +0100)]
crypto: expand algorithm coverage for cipher benchmark

Add testing coverage for AES with XTS, ECB and CTR modes

Reviewed-by: Marc-André Lureau <[email protected]>
Reviewed-by: Alberto Garcia <[email protected]>
Signed-off-by: Daniel P. Berrangé <[email protected]>
6 years agoMerge remote-tracking branch 'remotes/amarkovic/tags/mips-queue-oct-2018-part-2-v2...
Peter Maydell [Wed, 24 Oct 2018 15:31:40 +0000 (16:31 +0100)]
Merge remote-tracking branch 'remotes/amarkovic/tags/mips-queue-oct-2018-part-2-v2' into staging

MIPS queue for October 2018 - part 2 - v2

# gpg: Signature made Wed 24 Oct 2018 14:22:54 BST
# gpg:                using RSA key D4972A8967F75A65
# gpg: Good signature from "Aleksandar Markovic <[email protected]>"
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: 8526 FBF1 5DA3 811F 4A01  DD75 D497 2A89 67F7 5A65

* remotes/amarkovic/tags/mips-queue-oct-2018-part-2-v2: (33 commits)
  target/mips: Fix decoding of ALIGN and DALIGN instructions
  target/mips: Fix the title of translate.c
  linux-user/mips: Recognize the R5900 CPU model
  target/mips: Define the R5900 CPU
  tests/tcg/mips: Add tests for R5900 DIVU1
  tests/tcg/mips: Add tests for R5900 DIV1
  tests/tcg/mips: Add tests for R5900 MTLO1 and MTHI1
  tests/tcg/mips: Add tests for R5900 MFLO1 and MFHI1
  tests/tcg/mips: Add tests for R5900 three-operand MULTU1
  tests/tcg/mips: Add tests for R5900 three-operand MULT1
  tests/tcg/mips: Add tests for R5900 three-operand MULTU
  tests/tcg/mips: Add tests for R5900 three-operand MULT
  target/mips: Make R5900 DMULT[U], DDIV[U], LL[D] and SC[D] user only
  target/mips: Support R5900 MOVN, MOVZ and PREF instructions from MIPS IV
  target/mips: Support R5900 DIV1 and DIVU1 instructions
  target/mips: Support R5900 MFLO1, MTLO1, MFHI1 and MTHI1 instructions
  target/mips: Support R5900 three-operand MULT1 and MULTU1 instructions
  target/mips: Support R5900 three-operand MULT and MULTU instructions
  target/mips: Add a placeholder for R5900 MMI3 instruction subclass
  target/mips: Add a placeholder for R5900 MMI2 instruction subclass
  ...

Signed-off-by: Peter Maydell <[email protected]>
6 years agoMerge remote-tracking branch 'remotes/huth-gitlab/tags/pull-request-2018-10-24' into...
Peter Maydell [Wed, 24 Oct 2018 15:01:05 +0000 (16:01 +0100)]
Merge remote-tracking branch 'remotes/huth-gitlab/tags/pull-request-2018-10-24' into staging

- Disable migration-test with TCG on s390x (since there are known problems)
- Small Makefile improvements
- More modern shell scripting changes (use $() instead of ``)
- Add a configure option to disable AVX2

# gpg: Signature made Wed 24 Oct 2018 08:04:33 BST
# gpg:                using RSA key 2ED9D774FE702DB5
# gpg: Good signature from "Thomas Huth <[email protected]>"
# gpg:                 aka "Thomas Huth <[email protected]>"
# gpg:                 aka "Thomas Huth <[email protected]>"
# gpg:                 aka "Thomas Huth <[email protected]>"
# Primary key fingerprint: 27B8 8847 EEE0 2501 18F3  EAB9 2ED9 D774 FE70 2DB5

* remotes/huth-gitlab/tags/pull-request-2018-10-24:
  configure: Provide option to explicitly disable AVX2
  po/Makefile: Modern shell scripting (use $() instead of ``)
  debian-bootstrap.pre: Modern shell scripting (use $() instead of ``)
  configs: Add a CONFIG_SMC37C669 switch for the "smc37c669-superio" device
  hw/core: Move null-machine into the common-obj list
  tests/migration-test: Disable s390x test when running with TCG

Signed-off-by: Peter Maydell <[email protected]>
6 years agotarget/mips: Fix decoding of ALIGN and DALIGN instructions
Aleksandar Markovic [Mon, 22 Oct 2018 11:19:25 +0000 (13:19 +0200)]
target/mips: Fix decoding of ALIGN and DALIGN instructions

Opcode for ALIGN and DALIGN must be in fact ranges of opcodes, to
allow paremeter 'bp' to occupy two and three bits, respectively.

Reviewed-by: Stefan Markovic <[email protected]>
Signed-off-by: Aleksandar Markovic <[email protected]>
6 years agotarget/mips: Fix the title of translate.c
Aleksandar Markovic [Mon, 22 Oct 2018 11:09:35 +0000 (13:09 +0200)]
target/mips: Fix the title of translate.c

Replace MIPS32 with MIPS, since the file covers all generations
of MIPS architectures.

Reviewed-by: Stefan Markovic <[email protected]>
Signed-off-by: Aleksandar Markovic <[email protected]>
6 years agolinux-user/mips: Recognize the R5900 CPU model
Fredrik Noring [Sun, 21 Oct 2018 15:44:58 +0000 (17:44 +0200)]
linux-user/mips: Recognize the R5900 CPU model

This kind of ELF for the R5900 relies on an IEEE 754-1985 compliant FPU.
The R5900 FPU hardware is noncompliant and it is therefore emulated in
software by the Linux kernel. QEMU emulates a compliant FPU accordingly.

Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Reviewed-by: Aleksandar Markovic <[email protected]>
Signed-off-by: Fredrik Noring <[email protected]>
Signed-off-by: Aleksandar Markovic <[email protected]>
6 years agotarget/mips: Define the R5900 CPU
Fredrik Noring [Sun, 21 Oct 2018 15:44:46 +0000 (17:44 +0200)]
target/mips: Define the R5900 CPU

The primary purpose of this change is to support programs compiled by
GCC for the R5900 target and thereby run R5900 Linux distributions, for
example Gentoo.

GCC in version 7.3, by itself, by inspection of the GCC source code
and inspection of the generated machine code, for the R5900 target,
only emits two instructions that are specific to the R5900: the three-
operand MULT and MULTU. GCC and libc also emit certain MIPS III
instructions that are not part of the R5900 ISA. They are normally
trapped and emulated by the Linux kernel, and therefore need to be
treated accordingly by QEMU.

A program compiled by GCC is taken to mean source code compiled by GCC
under the restrictions above. One can, with the apparent limitations,
with a bit of effort obtain a fully functioning operating system such
as R5900 Gentoo. Strictly speaking, programs need not be compiled by
GCC to make use of this change.

Instructions and other facilities of the R5900 not implemented by this
change are intended to signal provisional exceptions. One such example
is the FPU that is not compliant with IEEE 754-1985 in system mode. It
is therefore provisionally disabled. In user space the FPU is trapped
and emulated by IEEE 754-1985 compliant software in the kernel, and
this is handled accordingly by QEMU. Another example is the 93
multimedia instructions specific to the R5900 that generate provisional
reserved instruction exception signals.

One of the benefits of running a Linux distribution under QEMU is that
programs can be compiled with a native compiler, where the host and
target are the same, as opposed to a cross-compiler, where they are
not the same. This is especially important in cases where the target
hardware does not have the resources to run a native compiler.

Problems with cross-compilation are often related to host and target
differences in integer sizes, pointer sizes, endianness, machine code,
ABI, etc. Sometimes cross-compilation is not even supported by the
build script for a given package. One effective way to avoid those
problems is to replace the cross-compiler with a native compiler. This
change of compilation methods does not resolve the inherent problems
with cross-compilation.

The native compiler naturally replaces the cross-compiler, because one
typically uses one or the other, and preferably the native compiler
when the circumstances admit this. The native compiler is also a good
test case for the R5900 QEMU user mode. Additionally, Gentoo is well-
known for compiling and installing its packages from sources.

This change has been tested with Gentoo compiled for R5900, including
native compilation of several packages under QEMU.

Reviewed-by: Aleksandar Markovic <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Signed-off-by: Fredrik Noring <[email protected]>
Signed-off-by: Aleksandar Markovic <[email protected]>
6 years agotests/tcg/mips: Add tests for R5900 DIVU1
Fredrik Noring [Sun, 21 Oct 2018 15:42:19 +0000 (17:42 +0200)]
tests/tcg/mips: Add tests for R5900 DIVU1

Add a test for DIVU1.

Reviewed-by: Aleksandar Markovic <[email protected]>
Signed-off-by: Fredrik Noring <[email protected]>
Signed-off-by: Aleksandar Markovic <[email protected]>
6 years agotests/tcg/mips: Add tests for R5900 DIV1
Fredrik Noring [Sun, 21 Oct 2018 15:42:08 +0000 (17:42 +0200)]
tests/tcg/mips: Add tests for R5900 DIV1

Add a test for DIV1.

Reviewed-by: Aleksandar Markovic <[email protected]>
Signed-off-by: Fredrik Noring <[email protected]>
Signed-off-by: Aleksandar Markovic <[email protected]>
6 years agotests/tcg/mips: Add tests for R5900 MTLO1 and MTHI1
Fredrik Noring [Sun, 21 Oct 2018 15:41:58 +0000 (17:41 +0200)]
tests/tcg/mips: Add tests for R5900 MTLO1 and MTHI1

Add a test for MTLO1 and MTHI1.

Reviewed-by: Aleksandar Markovic <[email protected]>
Signed-off-by: Fredrik Noring <[email protected]>
Signed-off-by: Aleksandar Markovic <[email protected]>
6 years agotests/tcg/mips: Add tests for R5900 MFLO1 and MFHI1
Fredrik Noring [Sun, 21 Oct 2018 15:41:47 +0000 (17:41 +0200)]
tests/tcg/mips: Add tests for R5900 MFLO1 and MFHI1

Add a test for MFLO1 and MFHI1.

Reviewed-by: Aleksandar Markovic <[email protected]>
Signed-off-by: Fredrik Noring <[email protected]>
Signed-off-by: Aleksandar Markovic <[email protected]>
6 years agotests/tcg/mips: Add tests for R5900 three-operand MULTU1
Fredrik Noring [Sun, 21 Oct 2018 15:41:32 +0000 (17:41 +0200)]
tests/tcg/mips: Add tests for R5900 three-operand MULTU1

Add a test for MULTU1.

Reviewed-by: Aleksandar Markovic <[email protected]>
Signed-off-by: Fredrik Noring <[email protected]>
Signed-off-by: Aleksandar Markovic <[email protected]>
6 years agotests/tcg/mips: Add tests for R5900 three-operand MULT1
Fredrik Noring [Sun, 21 Oct 2018 15:41:21 +0000 (17:41 +0200)]
tests/tcg/mips: Add tests for R5900 three-operand MULT1

Add a test for MULT1.

Reviewed-by: Aleksandar Markovic <[email protected]>
Signed-off-by: Fredrik Noring <[email protected]>
Signed-off-by: Aleksandar Markovic <[email protected]>
6 years agotests/tcg/mips: Add tests for R5900 three-operand MULTU
Fredrik Noring [Sun, 21 Oct 2018 15:41:13 +0000 (17:41 +0200)]
tests/tcg/mips: Add tests for R5900 three-operand MULTU

Add a test for MULTU.

Reviewed-by: Aleksandar Markovic <[email protected]>
Signed-off-by: Fredrik Noring <[email protected]>
Signed-off-by: Aleksandar Markovic <[email protected]>
6 years agotests/tcg/mips: Add tests for R5900 three-operand MULT
Fredrik Noring [Sun, 21 Oct 2018 15:41:01 +0000 (17:41 +0200)]
tests/tcg/mips: Add tests for R5900 three-operand MULT

Add a test for MULT.

Reviewed-by: Aleksandar Markovic <[email protected]>
Signed-off-by: Fredrik Noring <[email protected]>
Signed-off-by: Aleksandar Markovic <[email protected]>
6 years agotarget/mips: Make R5900 DMULT[U], DDIV[U], LL[D] and SC[D] user only
Fredrik Noring [Sun, 21 Oct 2018 15:40:18 +0000 (17:40 +0200)]
target/mips: Make R5900 DMULT[U], DDIV[U], LL[D] and SC[D] user only

The Linux kernel traps certain reserved instruction exceptions to
emulate the corresponding instructions. QEMU plays the role of the
kernel in user mode, so those traps are emulated by accepting the
instructions.

This change adds the function check_insn_opc_user_only to signal a
reserved instruction exception for flagged CPUs in QEMU system mode.

The MIPS III instructions DMULT[U], DDIV[U], LL[D] and SC[D] are not
implemented in R5900 hardware. They are trapped and emulated by the
Linux kernel and, accordingly, therefore QEMU user only instructions.

Reviewed-by: Aleksandar Markovic <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Signed-off-by: Fredrik Noring <[email protected]>
Signed-off-by: Aleksandar Markovic <[email protected]>
6 years agotarget/mips: Support R5900 MOVN, MOVZ and PREF instructions from MIPS IV
Fredrik Noring [Sun, 21 Oct 2018 15:39:17 +0000 (17:39 +0200)]
target/mips: Support R5900 MOVN, MOVZ and PREF instructions from MIPS IV

The R5900 is taken to be MIPS III with certain modifications. From
MIPS IV it implements the instructions MOVN, MOVZ and PREF.

Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Reviewed-by: Aleksandar Markovic <[email protected]>
Signed-off-by: Fredrik Noring <[email protected]>
Signed-off-by: Aleksandar Markovic <[email protected]>
6 years agotarget/mips: Support R5900 DIV1 and DIVU1 instructions
Fredrik Noring [Sun, 21 Oct 2018 15:39:03 +0000 (17:39 +0200)]
target/mips: Support R5900 DIV1 and DIVU1 instructions

Add support for DIV1 and DIVU1 instructions.

Reviewed-by: Aleksandar Markovic <[email protected]>
Signed-off-by: Fredrik Noring <[email protected]>
Signed-off-by: Aleksandar Markovic <[email protected]>
6 years agotarget/mips: Support R5900 MFLO1, MTLO1, MFHI1 and MTHI1 instructions
Fredrik Noring [Sun, 21 Oct 2018 15:38:49 +0000 (17:38 +0200)]
target/mips: Support R5900 MFLO1, MTLO1, MFHI1 and MTHI1 instructions

Add support for MFLO1, MTLO1, MFHI1 and MTHI1 instructions.

Reviewed-by: Aleksandar Markovic <[email protected]>
Signed-off-by: Fredrik Noring <[email protected]>
Signed-off-by: Aleksandar Markovic <[email protected]>
6 years agotarget/mips: Support R5900 three-operand MULT1 and MULTU1 instructions
Fredrik Noring [Sun, 21 Oct 2018 15:38:36 +0000 (17:38 +0200)]
target/mips: Support R5900 three-operand MULT1 and MULTU1 instructions

Add support for MULT1 and MULTU1 instructions.

Reviewed-by: Aleksandar Markovic <[email protected]>
Signed-off-by: Fredrik Noring <[email protected]>
Signed-off-by: Aleksandar Markovic <[email protected]>
6 years agotarget/mips: Support R5900 three-operand MULT and MULTU instructions
Fredrik Noring [Sun, 21 Oct 2018 15:38:21 +0000 (17:38 +0200)]
target/mips: Support R5900 three-operand MULT and MULTU instructions

The three-operand MULT and MULTU are the only R5900-specific
instructions emitted by GCC 7.3. The R5900 also implements the three-
operand MADD and MADDU instructions, but they are omitted in QEMU for
now since they are absent in programs compiled by current GCC versions.

Likewise, the R5900-specific pipeline 1 instruction variants MULT1,
MULTU1, DIV1, DIVU1, MADD1, MADDU1, MFHI1, MFLO1, MTHI1 and MTLO1
are omitted here as well.

Reviewed-by: Aleksandar Markovic <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Signed-off-by: Fredrik Noring <[email protected]>
Signed-off-by: Aleksandar Markovic <[email protected]>
6 years agotarget/mips: Add a placeholder for R5900 MMI3 instruction subclass
Fredrik Noring [Sun, 21 Oct 2018 15:37:18 +0000 (17:37 +0200)]
target/mips: Add a placeholder for R5900 MMI3 instruction subclass

Add a placeholder for MMI3 subclass.

Reviewed-by: Aleksandar Markovic <[email protected]>
Signed-off-by: Fredrik Noring <[email protected]>
Signed-off-by: Aleksandar Markovic <[email protected]>
6 years agotarget/mips: Add a placeholder for R5900 MMI2 instruction subclass
Fredrik Noring [Sun, 21 Oct 2018 15:37:06 +0000 (17:37 +0200)]
target/mips: Add a placeholder for R5900 MMI2 instruction subclass

Add a placeholder for MMI2 subclass.

Reviewed-by: Aleksandar Markovic <[email protected]>
Signed-off-by: Fredrik Noring <[email protected]>
Signed-off-by: Aleksandar Markovic <[email protected]>
6 years agotarget/mips: Add a placeholder for R5900 MMI1 instruction subclass
Fredrik Noring [Sun, 21 Oct 2018 15:36:54 +0000 (17:36 +0200)]
target/mips: Add a placeholder for R5900 MMI1 instruction subclass

Add a placeholder for MM1 subclass.

Reviewed-by: Aleksandar Markovic <[email protected]>
Signed-off-by: Fredrik Noring <[email protected]>
Signed-off-by: Aleksandar Markovic <[email protected]>
6 years agotarget/mips: Add a placeholder for R5900 MMI0 instruction subclass
Fredrik Noring [Sun, 21 Oct 2018 15:36:41 +0000 (17:36 +0200)]
target/mips: Add a placeholder for R5900 MMI0 instruction subclass

Add a placeholder for MMI0 subclass.

Reviewed-by: Aleksandar Markovic <[email protected]>
Signed-off-by: Fredrik Noring <[email protected]>
Signed-off-by: Aleksandar Markovic <[email protected]>
6 years agotarget/mips: Add a placeholder for R5900 MMI instruction class
Fredrik Noring [Sun, 21 Oct 2018 15:36:23 +0000 (17:36 +0200)]
target/mips: Add a placeholder for R5900 MMI instruction class

Add a placeholder for MMI class. This is the main palceholder for
MMI ASE.

Reviewed-by: Aleksandar Markovic <[email protected]>
Signed-off-by: Fredrik Noring <[email protected]>
Signed-off-by: Aleksandar Markovic <[email protected]>
6 years agotarget/mips: Add a placeholder for R5900 LQ
Fredrik Noring [Sun, 21 Oct 2018 15:35:56 +0000 (17:35 +0200)]
target/mips: Add a placeholder for R5900 LQ

Add a placeholder for LQ instruction.

Reviewed-by: Aleksandar Markovic <[email protected]>
Signed-off-by: Fredrik Noring <[email protected]>
Signed-off-by: Aleksandar Markovic <[email protected]>
6 years agotarget/mips: Add a placeholder for R5900 SQ, handle user mode RDHWR
Fredrik Noring [Sun, 21 Oct 2018 15:35:41 +0000 (17:35 +0200)]
target/mips: Add a placeholder for R5900 SQ, handle user mode RDHWR

Add placeholder for SQ instruction, handle RDHWR.

Reviewed-by: Aleksandar Markovic <[email protected]>
Signed-off-by: Fredrik Noring <[email protected]>
Signed-off-by: Aleksandar Markovic <[email protected]>
6 years agotarget/mips: Define R5900 MMI3 opcode constants
Fredrik Noring [Sun, 21 Oct 2018 15:34:46 +0000 (17:34 +0200)]
target/mips: Define R5900 MMI3 opcode constants

Reviewed-by: Aleksandar Markovic <[email protected]>
Signed-off-by: Fredrik Noring <[email protected]>
Signed-off-by: Aleksandar Markovic <[email protected]>
6 years agotarget/mips: Define R5900 MMI2 opcode constants
Fredrik Noring [Sun, 21 Oct 2018 15:34:21 +0000 (17:34 +0200)]
target/mips: Define R5900 MMI2 opcode constants

Reviewed-by: Aleksandar Markovic <[email protected]>
Signed-off-by: Fredrik Noring <[email protected]>
Signed-off-by: Aleksandar Markovic <[email protected]>
6 years agotarget/mips: Define R5900 MMI1 opcode constants
Fredrik Noring [Sun, 21 Oct 2018 15:34:11 +0000 (17:34 +0200)]
target/mips: Define R5900 MMI1 opcode constants

Reviewed-by: Aleksandar Markovic <[email protected]>
Signed-off-by: Fredrik Noring <[email protected]>
Signed-off-by: Aleksandar Markovic <[email protected]>
6 years agotarget/mips: Define R5900 MMI0 opcode constants
Fredrik Noring [Sun, 21 Oct 2018 15:34:04 +0000 (17:34 +0200)]
target/mips: Define R5900 MMI0 opcode constants

Add definition of MI0 opcodes.

Reviewed-by: Aleksandar Markovic <[email protected]>
Signed-off-by: Fredrik Noring <[email protected]>
Signed-off-by: Aleksandar Markovic <[email protected]>
6 years agotarget/mips: Define R5900 MMI<0|1|2|3> subclasses and opcode constants
Fredrik Noring [Sun, 21 Oct 2018 15:33:32 +0000 (17:33 +0200)]
target/mips: Define R5900 MMI<0|1|2|3> subclasses and opcode constants

Define MMI0, MMI1, MMI2, MMI3 subclass opcodes, and other opcodes of
instructions in MMI class.

Reviewed-by: Aleksandar Markovic <[email protected]>
Signed-off-by: Fredrik Noring <[email protected]>
Signed-off-by: Aleksandar Markovic <[email protected]>
6 years agotarget/mips: Define R5900 MMI class, and LQ and SQ opcode constants
Fredrik Noring [Sun, 21 Oct 2018 15:33:20 +0000 (17:33 +0200)]
target/mips: Define R5900 MMI class, and LQ and SQ opcode constants

Define MMI class, LQ, and SQ R5900 opdoces.

Reviewed-by: Aleksandar Markovic <[email protected]>
Signed-off-by: Fredrik Noring <[email protected]>
Signed-off-by: Aleksandar Markovic <[email protected]>
6 years agotarget/mips: Add R5900 Multimedia Instruction overview note
Fredrik Noring [Sun, 21 Oct 2018 15:32:36 +0000 (17:32 +0200)]
target/mips: Add R5900 Multimedia Instruction overview note

Add a comment on R5900 MMI ASE (short overview).

Reviewed-by: Aleksandar Markovic <[email protected]>
Signed-off-by: Fredrik Noring <[email protected]>
Signed-off-by: Aleksandar Markovic <[email protected]>
6 years agotarget/mips: Define R5900 ISA, MMI ASE, and R5900 CPU preprocessor constants
Fredrik Noring [Sun, 21 Oct 2018 15:31:26 +0000 (17:31 +0200)]
target/mips: Define R5900 ISA, MMI ASE, and R5900 CPU preprocessor constants

The R5900 implements the 64-bit MIPS III instruction set except
DMULT, DMULTU, DDIV, DDIVU, LL, SC, LLD and SCD. The MIPS IV
instructions MOVN, MOVZ and PREF are implemented. It has the
R5900-specific three-operand instructions MADD, MADDU, MULT and
MULTU as well as pipeline 1 versions MULT1, MULTU1, DIV1, DIVU1,
MADD1, MADDU1, MFHI1, MFLO1, MTHI1 and MTLO1. A set of 93 128-bit
multimedia instructions specific to the R5900 is also implemented.

The Toshiba TX System RISC TX79 Core Architecture manual:

https://wiki.qemu.org/File:C790.pdf

describes the C790 processor that is a follow-up to the R5900. There
are a few notable differences in that the R5900 FPU

- is not IEEE 754-1985 compliant,
- does not implement double format, and
- its machine code is nonstandard.

Reviewed-by: Aleksandar Markovic <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Signed-off-by: Fredrik Noring <[email protected]>
Signed-off-by: Aleksandar Markovic <[email protected]>
6 years agoMerge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20181024' into...
Peter Maydell [Wed, 24 Oct 2018 09:49:14 +0000 (10:49 +0100)]
Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20181024' into staging

target-arm queue:
 * ssi-sd: Make devices picking up backends unavailable with -device
 * Add support for VCPU event states
 * Move towards making ID registers the source of truth for
   whether a guest CPU implements a feature, rather than having
   parallel ID registers and feature bit flags
 * Implement various HCR hypervisor trap/config bits
 * Get IL bit correct for v7 syndrome values
 * Report correct syndrome for FP/SIMD traps to Hyp mode
 * hw/arm/boot: Increase compliance with kernel arm64 boot protocol
 * Refactor A32 Neon to use generic vector infrastructure
 * Fix a bug in A32 VLD2 "(multiple 2-element structures)" insn
 * net: cadence_gem: Report features correctly in ID register
 * Avoid some unnecessary TLB flushes on TTBR register writes

# gpg: Signature made Wed 24 Oct 2018 10:46:01 BST
# gpg:                using RSA key 3C2525ED14360CDE
# gpg: Good signature from "Peter Maydell <[email protected]>"
# gpg:                 aka "Peter Maydell <[email protected]>"
# gpg:                 aka "Peter Maydell <[email protected]>"
# Primary key fingerprint: E1A5 C593 CD41 9DE2 8E83  15CF 3C25 25ED 1436 0CDE

* remotes/pmaydell/tags/pull-target-arm-20181024: (44 commits)
  target/arm: Only flush tlb if ASID changes
  target/arm: Remove writefn from TTBR0_EL3
  net: cadence_gem: Announce 64bit addressing support
  net: cadence_gem: Announce availability of priority queues
  target/arm: Reorg NEON VLD/VST single element to one lane
  target/arm: Promote consecutive memory ops for aa32
  target/arm: Reorg NEON VLD/VST all elements
  target/arm: Use gvec for NEON VLD all lanes
  target/arm: Use gvec for NEON_3R_VTST_VCEQ, NEON_3R_VCGT, NEON_3R_VCGE
  target/arm: Use gvec for NEON_3R_VML
  target/arm: Use gvec for VSRI, VSLI
  target/arm: Use gvec for VSRA
  target/arm: Use gvec for VSHR, VSHL
  target/arm: Use gvec for NEON_3R_VMUL
  target/arm: Use gvec for NEON_2RM_VMN, NEON_2RM_VNEG
  target/arm: Use gvec for NEON_3R_VADD_VSUB insns
  target/arm: Use gvec for NEON_3R_LOGIC insns
  target/arm: Use gvec for NEON VMOV, VMVN, VBIC & VORR (immediate)
  target/arm: Use gvec for NEON VDUP
  target/arm: Mark some arrays const
  ...

Signed-off-by: Peter Maydell <[email protected]>
6 years agotarget/arm: Only flush tlb if ASID changes
Richard Henderson [Wed, 24 Oct 2018 06:50:20 +0000 (07:50 +0100)]
target/arm: Only flush tlb if ASID changes

Since QEMU does not implement ASIDs, changes to the ASID must flush the
tlb.  However, if the ASID does not change there is no reason to flush.

In testing a boot of the Ubuntu installer to the first menu, this reduces
the number of flushes by 30%, or nearly 600k instances.

Reviewed-by: Aaron Lindsay <[email protected]>
Signed-off-by: Richard Henderson <[email protected]>
Reviewed-by: Peter Maydell <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Message-id: 20181019015617[email protected]
Signed-off-by: Peter Maydell <[email protected]>
6 years agotarget/arm: Remove writefn from TTBR0_EL3
Richard Henderson [Wed, 24 Oct 2018 06:50:20 +0000 (07:50 +0100)]
target/arm: Remove writefn from TTBR0_EL3

The EL3 version of this register does not include an ASID,
and so the tlb_flush performed by vmsa_ttbr_write is not needed.

Reviewed-by: Aaron Lindsay <[email protected]>
Signed-off-by: Richard Henderson <[email protected]>
Reviewed-by: Peter Maydell <[email protected]>
Message-id: 20181019015617[email protected]
Signed-off-by: Peter Maydell <[email protected]>
6 years agonet: cadence_gem: Announce 64bit addressing support
Edgar E. Iglesias [Wed, 24 Oct 2018 06:50:20 +0000 (07:50 +0100)]
net: cadence_gem: Announce 64bit addressing support

Announce 64bit addressing support.

Reviewed-by: Alistair Francis <[email protected]>
Signed-off-by: Edgar E. Iglesias <[email protected]>
Message-id: 20181017213932[email protected]
Reviewed-by: Peter Maydell <[email protected]>
Signed-off-by: Peter Maydell <[email protected]>
6 years agonet: cadence_gem: Announce availability of priority queues
Edgar E. Iglesias [Wed, 24 Oct 2018 06:50:20 +0000 (07:50 +0100)]
net: cadence_gem: Announce availability of priority queues

Announce the availability of the various priority queues.
This fixes an issue where guest kernels would miss to
configure secondary queues due to inproper feature bits.

Signed-off-by: Edgar E. Iglesias <[email protected]>
Message-id: 20181017213932[email protected]
Reviewed-by: Peter Maydell <[email protected]>
Signed-off-by: Peter Maydell <[email protected]>
6 years agotarget/arm: Reorg NEON VLD/VST single element to one lane
Richard Henderson [Wed, 24 Oct 2018 06:50:20 +0000 (07:50 +0100)]
target/arm: Reorg NEON VLD/VST single element to one lane

Instead of shifts and masks, use direct loads and stores from
the neon register file.

Signed-off-by: Richard Henderson <[email protected]>
Message-id: 20181011205206[email protected]
Reviewed-by: Peter Maydell <[email protected]>
Signed-off-by: Peter Maydell <[email protected]>
6 years agotarget/arm: Promote consecutive memory ops for aa32
Richard Henderson [Wed, 24 Oct 2018 06:50:20 +0000 (07:50 +0100)]
target/arm: Promote consecutive memory ops for aa32

For a sequence of loads or stores from a single register,
little-endian operations can be promoted to an 8-byte op.
This can reduce the number of operations by a factor of 8.

Signed-off-by: Richard Henderson <[email protected]>
Message-id: 20181011205206[email protected]
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Reviewed-by: Peter Maydell <[email protected]>
Signed-off-by: Peter Maydell <[email protected]>
6 years agotarget/arm: Reorg NEON VLD/VST all elements
Richard Henderson [Wed, 24 Oct 2018 06:50:20 +0000 (07:50 +0100)]
target/arm: Reorg NEON VLD/VST all elements

Instead of shifts and masks, use direct loads and stores from the neon
register file.  Mirror the iteration structure of the ARM pseudocode
more closely.  Correct the parameters of the VLD2 A2 insn.

Note that this includes a bugfix for handling of the insn
"VLD2 (multiple 2-element structures)" -- we were using an
incorrect stride value.

Signed-off-by: Richard Henderson <[email protected]>
Message-id: 20181011205206[email protected]
Reviewed-by: Peter Maydell <[email protected]>
Signed-off-by: Peter Maydell <[email protected]>
6 years agotarget/arm: Use gvec for NEON VLD all lanes
Richard Henderson [Wed, 24 Oct 2018 06:50:20 +0000 (07:50 +0100)]
target/arm: Use gvec for NEON VLD all lanes

Signed-off-by: Richard Henderson <[email protected]>
Message-id: 20181011205206[email protected]
[PMM: added parens in ?: expression]
Reviewed-by: Peter Maydell <[email protected]>
Signed-off-by: Peter Maydell <[email protected]>
6 years agotarget/arm: Use gvec for NEON_3R_VTST_VCEQ, NEON_3R_VCGT, NEON_3R_VCGE
Richard Henderson [Wed, 24 Oct 2018 06:50:20 +0000 (07:50 +0100)]
target/arm: Use gvec for NEON_3R_VTST_VCEQ, NEON_3R_VCGT, NEON_3R_VCGE

Move cmtst_op expanders from translate-a64.c.

Signed-off-by: Richard Henderson <[email protected]>
Message-id: 20181011205206[email protected]
Reviewed-by: Peter Maydell <[email protected]>
Signed-off-by: Peter Maydell <[email protected]>
6 years agotarget/arm: Use gvec for NEON_3R_VML
Richard Henderson [Wed, 24 Oct 2018 06:50:19 +0000 (07:50 +0100)]
target/arm: Use gvec for NEON_3R_VML

Move mla_op and mls_op expanders from translate-a64.c.

Signed-off-by: Richard Henderson <[email protected]>
Message-id: 20181011205206[email protected]
Reviewed-by: Peter Maydell <[email protected]>
Signed-off-by: Peter Maydell <[email protected]>
6 years agotarget/arm: Use gvec for VSRI, VSLI
Richard Henderson [Wed, 24 Oct 2018 06:50:19 +0000 (07:50 +0100)]
target/arm: Use gvec for VSRI, VSLI

Move shi_op and sli_op expanders from translate-a64.c.

Signed-off-by: Richard Henderson <[email protected]>
Message-id: 20181011205206[email protected]
Reviewed-by: Peter Maydell <[email protected]>
Signed-off-by: Peter Maydell <[email protected]>
6 years agotarget/arm: Use gvec for VSRA
Richard Henderson [Wed, 24 Oct 2018 06:50:19 +0000 (07:50 +0100)]
target/arm: Use gvec for VSRA

Move ssra_op and usra_op expanders from translate-a64.c.

Signed-off-by: Richard Henderson <[email protected]>
Message-id: 20181011205206[email protected]
Reviewed-by: Peter Maydell <[email protected]>
Signed-off-by: Peter Maydell <[email protected]>
6 years agotarget/arm: Use gvec for VSHR, VSHL
Richard Henderson [Wed, 24 Oct 2018 06:50:19 +0000 (07:50 +0100)]
target/arm: Use gvec for VSHR, VSHL

Signed-off-by: Richard Henderson <[email protected]>
Message-id: 20181011205206[email protected]
Reviewed-by: Peter Maydell <[email protected]>
Signed-off-by: Peter Maydell <[email protected]>
6 years agotarget/arm: Use gvec for NEON_3R_VMUL
Richard Henderson [Wed, 24 Oct 2018 06:50:19 +0000 (07:50 +0100)]
target/arm: Use gvec for NEON_3R_VMUL

Signed-off-by: Richard Henderson <[email protected]>
Message-id: 20181011205206[email protected]
Reviewed-by: Peter Maydell <[email protected]>
Signed-off-by: Peter Maydell <[email protected]>
6 years agotarget/arm: Use gvec for NEON_2RM_VMN, NEON_2RM_VNEG
Richard Henderson [Wed, 24 Oct 2018 06:50:19 +0000 (07:50 +0100)]
target/arm: Use gvec for NEON_2RM_VMN, NEON_2RM_VNEG

Signed-off-by: Richard Henderson <[email protected]>
Message-id: 20181011205206[email protected]
Reviewed-by: Peter Maydell <[email protected]>
Signed-off-by: Peter Maydell <[email protected]>
6 years agotarget/arm: Use gvec for NEON_3R_VADD_VSUB insns
Richard Henderson [Wed, 24 Oct 2018 06:50:19 +0000 (07:50 +0100)]
target/arm: Use gvec for NEON_3R_VADD_VSUB insns

Signed-off-by: Richard Henderson <[email protected]>
Message-id: 20181011205206[email protected]
Reviewed-by: Peter Maydell <[email protected]>
Signed-off-by: Peter Maydell <[email protected]>
6 years agotarget/arm: Use gvec for NEON_3R_LOGIC insns
Richard Henderson [Wed, 24 Oct 2018 06:50:19 +0000 (07:50 +0100)]
target/arm: Use gvec for NEON_3R_LOGIC insns

Move expanders for VBSL, VBIT, and VBIF from translate-a64.c.

Signed-off-by: Richard Henderson <[email protected]>
Message-id: 20181011205206[email protected]
Reviewed-by: Peter Maydell <[email protected]>
Signed-off-by: Peter Maydell <[email protected]>
6 years agotarget/arm: Use gvec for NEON VMOV, VMVN, VBIC & VORR (immediate)
Richard Henderson [Wed, 24 Oct 2018 06:50:19 +0000 (07:50 +0100)]
target/arm: Use gvec for NEON VMOV, VMVN, VBIC & VORR (immediate)

Signed-off-by: Richard Henderson <[email protected]>
Message-id: 20181011205206[email protected]
Reviewed-by: Peter Maydell <[email protected]>
Signed-off-by: Peter Maydell <[email protected]>
6 years agotarget/arm: Use gvec for NEON VDUP
Richard Henderson [Wed, 24 Oct 2018 06:50:19 +0000 (07:50 +0100)]
target/arm: Use gvec for NEON VDUP

Also introduces neon_element_offset to find the env offset
of a specific element within a neon register.

Signed-off-by: Richard Henderson <[email protected]>
Message-id: 20181011205206[email protected]
Reviewed-by: Peter Maydell <[email protected]>
Signed-off-by: Peter Maydell <[email protected]>
6 years agotarget/arm: Mark some arrays const
Richard Henderson [Wed, 24 Oct 2018 06:50:18 +0000 (07:50 +0100)]
target/arm: Mark some arrays const

Signed-off-by: Richard Henderson <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Message-id: 20181011205206[email protected]
[PMM: drop change to now-deleted cpu_mode_names array]
Reviewed-by: Peter Maydell <[email protected]>
Signed-off-by: Peter Maydell <[email protected]>
6 years agotarget/arm: Promote consecutive memory ops for aa64
Richard Henderson [Wed, 24 Oct 2018 06:50:18 +0000 (07:50 +0100)]
target/arm: Promote consecutive memory ops for aa64

For a sequence of loads or stores from a single register,
little-endian operations can be promoted to an 8-byte op.
This can reduce the number of operations by a factor of 8.

Signed-off-by: Richard Henderson <[email protected]>
Message-id: 20181011205206[email protected]
Reviewed-by: Peter Maydell <[email protected]>
Signed-off-by: Peter Maydell <[email protected]>
6 years agotarget/arm: Use tcg_gen_gvec_dup_i64 for LD[1-4]R
Richard Henderson [Wed, 24 Oct 2018 06:50:18 +0000 (07:50 +0100)]
target/arm: Use tcg_gen_gvec_dup_i64 for LD[1-4]R

Signed-off-by: Richard Henderson <[email protected]>
Message-id: 20181011205206[email protected]
Reviewed-by: Peter Maydell <[email protected]>
Signed-off-by: Peter Maydell <[email protected]>
6 years agotarget/arm: Don't call tcg_clear_temp_count
Richard Henderson [Wed, 24 Oct 2018 06:50:18 +0000 (07:50 +0100)]
target/arm: Don't call tcg_clear_temp_count

This is done generically in translator_loop.

Reported-by: Laurent Desnogues <[email protected]>
Signed-off-by: Richard Henderson <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Message-id: 20181011205206[email protected]
Reviewed-by: Peter Maydell <[email protected]>
Signed-off-by: Peter Maydell <[email protected]>
6 years agotarget/arm: Hoist address increment for vector memory ops
Richard Henderson [Wed, 24 Oct 2018 06:50:18 +0000 (07:50 +0100)]
target/arm: Hoist address increment for vector memory ops

This can reduce the number of opcodes required for certain
complex forms of load-multiple (e.g. ld4.16b).

Signed-off-by: Richard Henderson <[email protected]>
Message-id: 20181011205206[email protected]
Reviewed-by: Peter Maydell <[email protected]>
Signed-off-by: Peter Maydell <[email protected]>
6 years agohw/arm/boot: Increase compliance with kernel arm64 boot protocol
Stewart Hildebrand [Wed, 24 Oct 2018 06:50:18 +0000 (07:50 +0100)]
hw/arm/boot: Increase compliance with kernel arm64 boot protocol

"The Image must be placed text_offset bytes from a 2MB aligned base
address anywhere in usable system RAM and called there."

For the virt board, we write our startup bootloader at the very
bottom of RAM, so that bit can't be used for the image. To avoid
overlap in case the image requests to be loaded at an offset
smaller than our bootloader, we increment the load offset to the
next 2MB.

This fixes a boot failure for Xen AArch64.

Signed-off-by: Stewart Hildebrand <[email protected]>
Tested-by: Andre Przywara <[email protected]>
Message-id: b8a89518794b4436af0c151ed10de4fa@dornerworks.com
[PMM: Rephrased a comment a bit]
Reviewed-by: Peter Maydell <[email protected]>
Signed-off-by: Peter Maydell <[email protected]>
6 years agotarget/arm: Report correct syndrome for FP/SIMD traps to Hyp mode
Peter Maydell [Wed, 24 Oct 2018 06:50:18 +0000 (07:50 +0100)]
target/arm: Report correct syndrome for FP/SIMD traps to Hyp mode

For traps of FP/SIMD instructions to AArch32 Hyp mode, the syndrome
provided in HSR has more information than is reported to AArch64.
Specifically, there are extra fields TA and coproc which indicate
whether the trapped instruction was FP or SIMD. Add this extra
information to the syndromes we construct, and mask it out when
taking the exception to AArch64.

Signed-off-by: Peter Maydell <[email protected]>
Reviewed-by: Richard Henderson <[email protected]>
Message-id: 20181012144235[email protected]

6 years agotarget/arm: Get IL bit correct for v7 syndrome values
Peter Maydell [Wed, 24 Oct 2018 06:50:18 +0000 (07:50 +0100)]
target/arm: Get IL bit correct for v7 syndrome values

For the v7 version of the Arm architecture, the IL bit in
syndrome register values where the field is not valid was
defined to be UNK/SBZP. In v8 this is RES1, which is what
QEMU currently implements. Handle the desired v7 behaviour
by squashing the IL bit for the affected cases:
 * EC == EC_UNCATEGORIZED
 * prefetch aborts
 * data aborts where ISV is 0

(The fourth case listed in the v8 Arm ARM DDI 0487C.a in
section G7.2.70, "illegal state exception", can't happen
on a v7 CPU.)

This deals with a corner case noted in a comment.

Signed-off-by: Peter Maydell <[email protected]>
Reviewed-by: Richard Henderson <[email protected]>
Message-id: 20181012144235[email protected]

6 years agotarget/arm: New utility function to extract EC from syndrome
Peter Maydell [Wed, 24 Oct 2018 06:50:18 +0000 (07:50 +0100)]
target/arm: New utility function to extract EC from syndrome

Create and use a utility function to extract the EC field
from a syndrome, rather than open-coding the shift.

Signed-off-by: Peter Maydell <[email protected]>
Reviewed-by: Richard Henderson <[email protected]>
Message-id: 20181012144235[email protected]

6 years agotarget/arm: Implement HCR.PTW
Peter Maydell [Wed, 24 Oct 2018 06:50:18 +0000 (07:50 +0100)]
target/arm: Implement HCR.PTW

If the HCR_EL2 PTW virtualizaiton configuration register bit
is set, then this means that a stage 2 Permission fault must
be generated if a stage 1 translation table access is made
to an address that is mapped as Device memory in stage 2.
Implement this.

Signed-off-by: Peter Maydell <[email protected]>
Reviewed-by: Richard Henderson <[email protected]>
Message-id: 20181012144235[email protected]

6 years agotarget/arm: Implement HCR.VI and VF
Peter Maydell [Wed, 24 Oct 2018 06:50:17 +0000 (07:50 +0100)]
target/arm: Implement HCR.VI and VF

The HCR_EL2 VI and VF bits are supposed to track whether there is
a pending virtual IRQ or virtual FIQ. For QEMU we store the
pending VIRQ/VFIQ status in cs->interrupt_request, so this means:
 * if the register is read we must get these bit values from
   cs->interrupt_request
 * if the register is written then we must write the bit
   values back into cs->interrupt_request

Signed-off-by: Peter Maydell <[email protected]>
Reviewed-by: Richard Henderson <[email protected]>
Message-id: 20181012144235[email protected]

6 years agotarget/arm: ISR_EL1 bits track virtual interrupts if IMO/FMO set
Peter Maydell [Wed, 24 Oct 2018 06:50:17 +0000 (07:50 +0100)]
target/arm: ISR_EL1 bits track virtual interrupts if IMO/FMO set

The A/I/F bits in ISR_EL1 should track the virtual interrupt
status, not the physical interrupt status, if the associated
HCR_EL2.AMO/IMO/FMO bit is set. Implement this, rather than
always showing the physical interrupt status.

We don't currently implement anything to do with external
aborts, so this applies only to the I and F bits (though it
ought to be possible for the outer guest to present a virtual
external abort to the inner guest, even if QEMU doesn't
emulate physical external aborts, so there is missing
functionality in this area).

Signed-off-by: Peter Maydell <[email protected]>
Reviewed-by: Richard Henderson <[email protected]>
Message-id: 20181012144235[email protected]

6 years agotarget/arm: Implement HCR.DC
Peter Maydell [Wed, 24 Oct 2018 06:50:17 +0000 (07:50 +0100)]
target/arm: Implement HCR.DC

The HCR.DC virtualization configuration register bit has the
following effects:
 * SCTLR.M behaves as if it is 0 for all purposes except
   direct reads of the bit
 * HCR.VM behaves as if it is 1 for all purposes except
   direct reads of the bit
 * the memory type produced by the first stage of the EL1&EL0
   translation regime is Normal Non-Shareable,
   Inner Write-Back Read-Allocate Write-Allocate,
   Outer Write-Back Read-Allocate Write-Allocate.

Implement this behaviour.

Signed-off-by: Peter Maydell <[email protected]>
Reviewed-by: Richard Henderson <[email protected]>
Message-id: 20181012144235[email protected]

6 years agotarget/arm: Implement HCR.FB
Peter Maydell [Wed, 24 Oct 2018 06:50:17 +0000 (07:50 +0100)]
target/arm: Implement HCR.FB

The HCR.FB virtualization configuration register bit requests that
TLB maintenance, branch predictor invalidate-all and icache
invalidate-all operations performed in NS EL1 should be upgraded
from "local CPU only to "broadcast within Inner Shareable domain".
For QEMU we NOP the branch predictor and icache operations, so
we only need to upgrade the TLB invalidates:
 AArch32 TLBIALL, TLBIMVA, TLBIASID, DTLBIALL, DTLBIMVA, DTLBIASID,
         ITLBIALL, ITLBIMVA, ITLBIASID, TLBIMVAA, TLBIMVAL, TLBIMVAAL
 AArch64 TLBI VMALLE1, TLBI VAE1, TLBI ASIDE1, TLBI VAAE1,
         TLBI VALE1, TLBI VAALE1

Signed-off-by: Peter Maydell <[email protected]>
Reviewed-by: Richard Henderson <[email protected]>
Message-id: 20181012144235[email protected]

6 years agotarget/arm: Make switch_mode() file-local
Peter Maydell [Wed, 24 Oct 2018 06:50:17 +0000 (07:50 +0100)]
target/arm: Make switch_mode() file-local

The switch_mode() function is defined in target/arm/helper.c and used
only in that file and nowhere else, so we can make it file-local
rather than global.

Signed-off-by: Peter Maydell <[email protected]>
Reviewed-by: Richard Henderson <[email protected]>
Message-id: 20181012144235[email protected]

6 years agotarget/arm: Improve debug logging of AArch32 exception return
Peter Maydell [Wed, 24 Oct 2018 06:50:17 +0000 (07:50 +0100)]
target/arm: Improve debug logging of AArch32 exception return

For AArch32, exception return happens through certain kinds
of CPSR write. We don't currently have any CPU_LOG_INT logging
of these events (unlike AArch64, where we log in the ERET
instruction). Add some suitable logging.

This will log exception returns like this:
Exception return from AArch32 hyp to usr PC 0x80100374

paralleling the existing logging in the exception_return
helper for AArch64 exception returns:
Exception return from AArch64 EL2 to AArch64 EL0 PC 0x8003045c
Exception return from AArch64 EL2 to AArch32 EL0 PC 0x8003045c

(Note that an AArch32 exception return can only be
AArch32->AArch32, never to AArch64.)

Signed-off-by: Peter Maydell <[email protected]>
Reviewed-by: Richard Henderson <[email protected]>
Message-id: 20181012144235[email protected]

This page took 0.086805 seconds and 4 git commands to generate.