OSDN Git Service

qmiga/qemu.git
6 years agoraspi: Add "raspi3" machine type
Pekka Enberg [Thu, 22 Feb 2018 15:12:51 +0000 (15:12 +0000)]
raspi: Add "raspi3" machine type

This patch adds a "raspi3" machine type, which can now be selected as
the machine to run on by users via the "-M" command line option to QEMU.

The machine type does *not* ignore memory transaction failures so we
likely need to add some dummy devices later when people run something
more complicated than what I'm using for testing.

Signed-off-by: Pekka Enberg <penberg@iki.fi>
[PMM: added #ifdef TARGET_AARCH64 so we don't provide the 64-bit
 board in the 32-bit only arm-softmmu build.]
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6 years agotarget/arm: Fix register definitions for VMIDR and VMPIDR
Peter Maydell [Thu, 22 Feb 2018 15:12:51 +0000 (15:12 +0000)]
target/arm: Fix register definitions for VMIDR and VMPIDR

The register definitions for VMIDR and VMPIDR have separate
reginfo structs for the AArch32 and AArch64 registers. However
the 32-bit versions are wrong:
 * they use offsetof instead of offsetoflow32 to mark where
   the 32-bit value lives in the uint64_t CPU state field
 * they don't mark themselves as ARM_CP_ALIAS

In particular this means that if you try to use an Arm guest CPU
which enables EL2 on a big-endian host it will assert at reset:
 target/arm/cpu.c:114: cp_reg_check_reset: Assertion `oldvalue == newvalue' failed.

because the reset of the 32-bit register writes to the top
half of the uint64_t.

Correct the errors in the structures.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
This is necessary for 'make check' to pass on big endian
systems with the 'raspi3' board enabled, which is the
first board which has an EL2-enabled-by-default CPU.

6 years agoMerge remote-tracking branch 'remotes/mcayland/tags/qemu-openbios-signed' into staging
Peter Maydell [Thu, 22 Feb 2018 11:37:05 +0000 (11:37 +0000)]
Merge remote-tracking branch 'remotes/mcayland/tags/qemu-openbios-signed' into staging

Update OpenBIOS images

# gpg: Signature made Thu 22 Feb 2018 08:12:01 GMT
# gpg:                using RSA key 5BC2C56FAE0F321F
# gpg: Good signature from "Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>"
# Primary key fingerprint: CC62 1AB9 8E82 200D 915C  C9C4 5BC2 C56F AE0F 321F

* remotes/mcayland/tags/qemu-openbios-signed:
  Update OpenBIOS images to 54d959d9 built from submodule.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6 years agoMerge remote-tracking branch 'remotes/stsquad/tags/pull-softfloat-refactor-210218...
Peter Maydell [Thu, 22 Feb 2018 10:01:23 +0000 (10:01 +0000)]
Merge remote-tracking branch 'remotes/stsquad/tags/pull-softfloat-refactor-210218-1' into staging

This is the re-factor of softfloat:

  - shared common code path float16/32/64
  - well commented and easy to follow code
  - added a bunch of float16 support

While some operations are slower the key ones exercised by the
floating point dbt-bench are the same: https://i.imgur.com/oXNJNql.png

# gpg: Signature made Wed 21 Feb 2018 10:44:14 GMT
# gpg:                using RSA key FBD0DB095A9E2A44
# gpg: Good signature from "Alex Bennée (Master Work Key) <alex.bennee@linaro.org>"
# Primary key fingerprint: 6685 AE99 E751 67BC AFC8  DF35 FBD0 DB09 5A9E 2A44

* remotes/stsquad/tags/pull-softfloat-refactor-210218-1: (22 commits)
  fpu/softfloat: re-factor sqrt
  fpu/softfloat: re-factor compare
  fpu/softfloat: re-factor minmax
  fpu/softfloat: re-factor scalbn
  fpu/softfloat: re-factor int/uint to float
  fpu/softfloat: re-factor float to int/uint
  fpu/softfloat: re-factor round_to_int
  fpu/softfloat: re-factor muladd
  fpu/softfloat: re-factor div
  fpu/softfloat: re-factor mul
  fpu/softfloat: re-factor add/sub
  fpu/softfloat: define decompose structures
  fpu/softfloat: move the extract functions to the top of the file
  fpu/softfloat: improve comments on ARM NaN propagation
  include/fpu/softfloat: add some float16 constants
  include/fpu/softfloat: implement float16_set_sign helper
  include/fpu/softfloat: implement float16_chs helper
  include/fpu/softfloat: implement float16_abs helper
  target/*/cpu.h: remove softfloat.h
  fpu/softfloat-types: new header to prevent excessive re-builds
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6 years agoUpdate OpenBIOS images to 54d959d9 built from submodule.
Mark Cave-Ayland [Thu, 22 Feb 2018 07:55:01 +0000 (07:55 +0000)]
Update OpenBIOS images to 54d959d9 built from submodule.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
6 years agofpu/softfloat: re-factor sqrt
Alex Bennée [Fri, 12 Jan 2018 11:24:02 +0000 (11:24 +0000)]
fpu/softfloat: re-factor sqrt

This is a little bit of a departure from softfloat's original approach
as we skip the estimate step in favour of a straight iteration. There
is a minor optimisation to avoid calculating more bits of precision
than we need however this still brings a performance drop, especially
for float64 operations.

Suggested-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
6 years agofpu/softfloat: re-factor compare
Alex Bennée [Tue, 5 Dec 2017 17:14:42 +0000 (17:14 +0000)]
fpu/softfloat: re-factor compare

The compare function was already expanded from a macro. I keep the
macro expansion but move most of the logic into a compare_decomposed.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
6 years agofpu/softfloat: re-factor minmax
Alex Bennée [Tue, 5 Dec 2017 12:36:01 +0000 (12:36 +0000)]
fpu/softfloat: re-factor minmax

Let's do the same re-factor treatment for minmax functions. I still
use the MACRO trick to expand but now all the checking code is common.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
6 years agofpu/softfloat: re-factor scalbn
Alex Bennée [Thu, 30 Nov 2017 11:31:40 +0000 (11:31 +0000)]
fpu/softfloat: re-factor scalbn

This is one of the simpler manipulations you could make to a floating
point number.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
6 years agofpu/softfloat: re-factor int/uint to float
Alex Bennée [Thu, 30 Nov 2017 10:57:08 +0000 (10:57 +0000)]
fpu/softfloat: re-factor int/uint to float

These are considerably simpler as the lower order integers can just
use the higher order conversion function. As the decomposed fractional
part is a full 64 bit rounding and inexact handling comes from the
pack functions.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
6 years agofpu/softfloat: re-factor float to int/uint
Alex Bennée [Wed, 29 Nov 2017 10:56:06 +0000 (10:56 +0000)]
fpu/softfloat: re-factor float to int/uint

We share the common int64/uint64_pack_decomposed function across all
the helpers and simply limit the final result depending on the final
size.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
6 years agofpu/softfloat: re-factor round_to_int
Alex Bennée [Wed, 29 Nov 2017 10:21:25 +0000 (10:21 +0000)]
fpu/softfloat: re-factor round_to_int

We can now add float16_round_to_int and use the common round_decomposed and
canonicalize functions to have a single implementation for
float16/32/64 round_to_int functions.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
6 years agofpu/softfloat: re-factor muladd
Alex Bennée [Tue, 28 Nov 2017 17:04:44 +0000 (17:04 +0000)]
fpu/softfloat: re-factor muladd

We can now add float16_muladd and use the common decompose and
canonicalize functions to have a single implementation for
float16/32/64 muladd functions.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
6 years agofpu/softfloat: re-factor div
Alex Bennée [Mon, 27 Nov 2017 16:13:36 +0000 (16:13 +0000)]
fpu/softfloat: re-factor div

We can now add float16_div and use the common decompose and
canonicalize functions to have a single implementation for
float16/32/64 versions.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
6 years agofpu/softfloat: re-factor mul
Alex Bennée [Thu, 7 Dec 2017 18:56:50 +0000 (18:56 +0000)]
fpu/softfloat: re-factor mul

We can now add float16_mul and use the common decompose and
canonicalize functions to have a single implementation for
float16/32/64 versions.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
6 years agofpu/softfloat: re-factor add/sub
Alex Bennée [Mon, 27 Nov 2017 14:15:17 +0000 (14:15 +0000)]
fpu/softfloat: re-factor add/sub

We can now add float16_add/sub and use the common decompose and
canonicalize functions to have a single implementation for
float16/32/64 add and sub functions.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
6 years agofpu/softfloat: define decompose structures
Alex Bennée [Mon, 27 Nov 2017 14:02:26 +0000 (14:02 +0000)]
fpu/softfloat: define decompose structures

These structures pave the way for generic softfloat helper routines
that will operate on fully decomposed numbers.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
6 years agofpu/softfloat: move the extract functions to the top of the file
Alex Bennée [Mon, 27 Nov 2017 13:58:23 +0000 (13:58 +0000)]
fpu/softfloat: move the extract functions to the top of the file

This is pure code-motion during re-factoring as the helpers will be
needed earlier.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
6 years agofpu/softfloat: improve comments on ARM NaN propagation
Alex Bennée [Wed, 19 Jul 2017 10:49:42 +0000 (11:49 +0100)]
fpu/softfloat: improve comments on ARM NaN propagation

Mention the pseudo-code fragment from which this is based.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
6 years agoinclude/fpu/softfloat: add some float16 constants
Alex Bennée [Fri, 8 Dec 2017 17:13:19 +0000 (17:13 +0000)]
include/fpu/softfloat: add some float16 constants

This defines the same set of common constants for float 16 as defined
for 32 and 64 bit floats. These are often used by target helper
functions. I've also removed constants that are not used by anybody.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
6 years agoinclude/fpu/softfloat: implement float16_set_sign helper
Alex Bennée [Fri, 8 Dec 2017 17:03:13 +0000 (17:03 +0000)]
include/fpu/softfloat: implement float16_set_sign helper

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
6 years agoinclude/fpu/softfloat: implement float16_chs helper
Alex Bennée [Thu, 7 Dec 2017 19:09:24 +0000 (19:09 +0000)]
include/fpu/softfloat: implement float16_chs helper

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
6 years agoinclude/fpu/softfloat: implement float16_abs helper
Alex Bennée [Mon, 3 Jul 2017 13:33:08 +0000 (14:33 +0100)]
include/fpu/softfloat: implement float16_abs helper

This will be required when expanding the MINMAX() macro for 16
bit/half-precision operations.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
6 years agotarget/*/cpu.h: remove softfloat.h
Alex Bennée [Fri, 19 Jan 2018 18:24:22 +0000 (18:24 +0000)]
target/*/cpu.h: remove softfloat.h

As cpu.h is another typically widely included file which doesn't need
full access to the softfloat API we can remove the includes from here
as well. Where they do need types it's typically for float_status and
the rounding modes so we move that to softfloat-types.h as well.

As a result of not having softfloat in every cpu.h call we now need to
add it to various helpers that do need the full softfloat.h
definitions.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
[For PPC parts]
Acked-by: David Gibson <david@gibson.dropbear.id.au>
6 years agofpu/softfloat-types: new header to prevent excessive re-builds
Alex Bennée [Fri, 19 Jan 2018 16:36:40 +0000 (16:36 +0000)]
fpu/softfloat-types: new header to prevent excessive re-builds

The main culprit here is bswap.h which pulled in softfloat.h so it
could use the types in its CPU_Float* and ldfl/stfql functions. As
bswap.h is very widely included this added a compile dependency every
time we touch softfloat.h. Move the typedefs for each float type into
their own file so we don't re-build the world every time we tweak the
main softfloat.h header.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
6 years agoinclude/fpu/softfloat: remove USE_SOFTFLOAT_STRUCT_TYPES
Alex Bennée [Fri, 5 Jan 2018 20:18:55 +0000 (20:18 +0000)]
include/fpu/softfloat: remove USE_SOFTFLOAT_STRUCT_TYPES

It's not actively built and when enabled things fail to compile. I'm
not sure the type-checking is really helping here. Seeing as we "own"
our softfloat now lets remove the cruft.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
6 years agofpu/softfloat: implement float16_squash_input_denormal
Alex Bennée [Mon, 3 Jul 2017 13:30:06 +0000 (14:30 +0100)]
fpu/softfloat: implement float16_squash_input_denormal

This will be required when expanding the MINMAX() macro for 16
bit/half-precision operations.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
6 years agoMerge remote-tracking branch 'remotes/kraxel/tags/ui-20180220-pull-request' into...
Peter Maydell [Tue, 20 Feb 2018 14:05:00 +0000 (14:05 +0000)]
Merge remote-tracking branch 'remotes/kraxel/tags/ui-20180220-pull-request' into staging

ui: reorganize and cleanup display command line parsing.
gtk: fix gtk3 warnings.

# gpg: Signature made Tue 20 Feb 2018 13:46:53 GMT
# gpg:                using RSA key 4CB6D8EED3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>"
# gpg:                 aka "Gerd Hoffmann <gerd@kraxel.org>"
# gpg:                 aka "Gerd Hoffmann (private) <kraxel@gmail.com>"
# Primary key fingerprint: A032 8CFF B93A 17A7 9901  FE7D 4CB6 D8EE D3E8 7138

* remotes/kraxel/tags/ui-20180220-pull-request:
  ui: Reorder vte terminal packing to avoid gtk3 warnings
  vl: drop display_type variable
  vl: drop request_opengl variable
  vl: drop full_screen variable
  cocoa: use DisplayOptions
  curses: use DisplayOptions
  egl-headless: use DisplayOptions
  vl: drop no_quit variable
  sdl: use DisplayOptions
  gtk: add and use DisplayOptions + DisplayGTK
  vl: rename DisplayType to LegacyDisplayType
  vl: deprecate -no-frame

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6 years agoMerge remote-tracking branch 'remotes/gkurz/tags/for-upstream' into staging
Peter Maydell [Tue, 20 Feb 2018 11:52:24 +0000 (11:52 +0000)]
Merge remote-tracking branch 'remotes/gkurz/tags/for-upstream' into staging

Fix memory leak in synth backend.

# gpg: Signature made Mon 19 Feb 2018 17:29:49 GMT
# gpg:                using RSA key 71D4D5E5822F73D6
# gpg: Good signature from "Greg Kurz <groug@kaod.org>"
# gpg:                 aka "Gregory Kurz <gregory.kurz@free.fr>"
# gpg:                 aka "[jpeg image of size 3330]"
# Primary key fingerprint: B482 8BAF 9431 40CE F2A3  4910 71D4 D5E5 822F 73D6

* remotes/gkurz/tags/for-upstream:
  9p: fix leak in synth_name_to_path()
  9p: v9fs_path_copy() readability

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6 years agoui: Reorder vte terminal packing to avoid gtk3 warnings
Jan Kiszka [Sat, 17 Feb 2018 11:26:49 +0000 (12:26 +0100)]
ui: Reorder vte terminal packing to avoid gtk3 warnings

Fill the terminal box from right to left to avoid

Gtk-WARNING **: Allocating size to GtkScrollbar 0x55f6d54b0200 without
    calling gtk_widget_get_preferred_width/height(). How does the code
    know the size to allocate?

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Message-id: 902aaef8-d20e-0530-dea2-cdfe3db33ff3@web.de
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
6 years agovl: drop display_type variable
Gerd Hoffmann [Fri, 2 Feb 2018 11:10:22 +0000 (12:10 +0100)]
vl: drop display_type variable

Switch over all leftover users to qapi DisplayType.
Then delete the unused display_type variable.

Add 'default' DisplayType, which isn't an actual display type but
a placeholder for "user didn't specify a display".  It will be replaced
by the DisplayType actually used, which in turn depends on the
DisplayTypes availabel in the particular build.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-id: 20180202111022.19269-13-kraxel@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
6 years agovl: drop request_opengl variable
Gerd Hoffmann [Fri, 2 Feb 2018 11:10:21 +0000 (12:10 +0100)]
vl: drop request_opengl variable

Switch over the one leftover user to qapi DisplayType.
The delete the unused request_opengl variable.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-id: 20180202111022.19269-12-kraxel@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
6 years agovl: drop full_screen variable
Gerd Hoffmann [Fri, 2 Feb 2018 11:10:20 +0000 (12:10 +0100)]
vl: drop full_screen variable

Not used any more, delete it.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-id: 20180202111022.19269-11-kraxel@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
6 years agococoa: use DisplayOptions
Gerd Hoffmann [Fri, 2 Feb 2018 11:10:19 +0000 (12:10 +0100)]
cocoa: use DisplayOptions

Switch cocoa ui to use qapi DisplayOptions for configuration.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-id: 20180202111022.19269-10-kraxel@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
6 years agocurses: use DisplayOptions
Gerd Hoffmann [Fri, 2 Feb 2018 11:10:18 +0000 (12:10 +0100)]
curses: use DisplayOptions

Switch curses ui to use qapi DisplayOptions for configuration.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-id: 20180202111022.19269-9-kraxel@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
6 years agoegl-headless: use DisplayOptions
Gerd Hoffmann [Fri, 2 Feb 2018 11:10:17 +0000 (12:10 +0100)]
egl-headless: use DisplayOptions

Switch egl-headless ui to use qapi DisplayOptions for configuration.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-id: 20180202111022.19269-8-kraxel@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
6 years agovl: drop no_quit variable
Gerd Hoffmann [Fri, 2 Feb 2018 11:10:16 +0000 (12:10 +0100)]
vl: drop no_quit variable

Not used any more, delete it.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Message-id: 20180202111022.19269-7-kraxel@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
6 years agosdl: use DisplayOptions
Gerd Hoffmann [Fri, 2 Feb 2018 11:10:15 +0000 (12:10 +0100)]
sdl: use DisplayOptions

Switch sdl ui to use qapi DisplayOptions for configuration.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-id: 20180202111022.19269-6-kraxel@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
6 years agogtk: add and use DisplayOptions + DisplayGTK
Gerd Hoffmann [Fri, 2 Feb 2018 11:10:14 +0000 (12:10 +0100)]
gtk: add and use DisplayOptions + DisplayGTK

Add QAPI DisplayType enum, DisplayOptions union and DisplayGTK struct.
Switch gtk configuration to use the qapi type.

Some bookkeeping (fullscreen for example) is done twice now, this is
temporary until more/all UIs are switched over to qapi configuration.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-id: 20180202111022.19269-5-kraxel@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
6 years agovl: rename DisplayType to LegacyDisplayType
Gerd Hoffmann [Fri, 2 Feb 2018 11:10:13 +0000 (12:10 +0100)]
vl: rename DisplayType to LegacyDisplayType

qapi DisplayType will replace the current enum.  For the transition both
will coexist though, so rename it so we don't have a name clash.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-id: 20180202111022.19269-4-kraxel@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
6 years agovl: deprecate -no-frame
Gerd Hoffmann [Fri, 2 Feb 2018 11:10:11 +0000 (12:10 +0100)]
vl: deprecate -no-frame

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Message-id: 20180202111022.19269-2-kraxel@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
6 years agoMerge remote-tracking branch 'remotes/vivier2/tags/linux-user-for-2.12-pull-request...
Peter Maydell [Tue, 20 Feb 2018 09:40:51 +0000 (09:40 +0000)]
Merge remote-tracking branch 'remotes/vivier2/tags/linux-user-for-2.12-pull-request' into staging

# gpg: Signature made Tue 20 Feb 2018 09:16:18 GMT
# gpg:                using RSA key F30C38BD3F2FBE3C
# gpg: Good signature from "Laurent Vivier <lvivier@redhat.com>"
# gpg:                 aka "Laurent Vivier <laurent@vivier.eu>"
# gpg:                 aka "Laurent Vivier (Red Hat) <lvivier@redhat.com>"
# Primary key fingerprint: CD2F 75DD C8E3 A4DC 2E4F  5173 F30C 38BD 3F2F BE3C

* remotes/vivier2/tags/linux-user-for-2.12-pull-request:
  linux-user: Remove THREAD macro
  linux-user: Fix sched_getaffinity mask size
  linux-user: Fix register used for 6th and 7th syscall argument on aarch64
  linux-user: Implement ioctl cmd TIOCGPTPEER

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6 years ago9p: fix leak in synth_name_to_path()
Marc-André Lureau [Mon, 19 Feb 2018 17:27:15 +0000 (18:27 +0100)]
9p: fix leak in synth_name_to_path()

Leak found thanks to ASAN:

Direct leak of 8 byte(s) in 1 object(s) allocated from:
    #0 0x55995789ac90 in __interceptor_malloc (/home/elmarco/src/qemu/build/x86_64-softmmu/qemu-system-x86_64+0x1510c90)
    #1 0x7f0a91190f0c in g_malloc /home/elmarco/src/gnome/glib/builddir/../glib/gmem.c:94
    #2 0x5599580a281c in v9fs_path_copy /home/elmarco/src/qemu/hw/9pfs/9p.c:196:17
    #3 0x559958f9ec5d in coroutine_trampoline /home/elmarco/src/qemu/util/coroutine-ucontext.c:116:9
    #4 0x7f0a8766ebbf  (/lib64/libc.so.6+0x50bbf)

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Greg Kurz <groug@kaod.org>
6 years ago9p: v9fs_path_copy() readability
Marc-André Lureau [Mon, 19 Feb 2018 17:27:15 +0000 (18:27 +0100)]
9p: v9fs_path_copy() readability

lhs/rhs doesn't tell much about how argument are handled, dst/src is
and const arguments is clearer in my mind. Use g_memdup() while at it.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Greg Kurz <groug@kaod.org>
6 years agoMerge remote-tracking branch 'remotes/stefanha/tags/tracing-pull-request' into staging
Peter Maydell [Mon, 19 Feb 2018 16:44:12 +0000 (16:44 +0000)]
Merge remote-tracking branch 'remotes/stefanha/tags/tracing-pull-request' into staging

# gpg: Signature made Mon 19 Feb 2018 16:19:46 GMT
# gpg:                using RSA key 9CA4ABB381AB73C8
# gpg: Good signature from "Stefan Hajnoczi <stefanha@redhat.com>"
# gpg:                 aka "Stefan Hajnoczi <stefanha@gmail.com>"
# Primary key fingerprint: 8695 A8BF D3F9 7CDA AC35  775A 9CA4 ABB3 81AB 73C8

* remotes/stefanha/tags/tracing-pull-request:
  trace: avoid SystemTap "char const" warnings
  tracetool: For ust trace bool type as ctf_integer
  tracetool: Update argument format regex to non-greedy star

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6 years agotrace: avoid SystemTap "char const" warnings
Stefan Hajnoczi [Thu, 1 Feb 2018 16:26:25 +0000 (16:26 +0000)]
trace: avoid SystemTap "char const" warnings

SystemTap's dtrace(1) produces the following warning when it encounters
"char const" instead of "const char":

  Warning: /usr/bin/dtrace:trace-dtrace-root.dtrace:66: syntax error near:
  probe flatview_destroy_rcu

  Warning: Proceeding as if --no-pyparsing was given.

This is a limitation in current SystemTap releases.  I have sent a patch
upstream to accept "char const" since it is valid C:

  https://sourceware.org/ml/systemtap/2018-q1/msg00017.html

In QEMU we still wish to avoid warnings in the current SystemTap
release.  It's simple enough to replace "char const" with "const char".

I'm not changing the documentation or implementing checks to prevent
this from occurring again in the future.  The next release of SystemTap
will hopefully resolve this issue.

Cc: Daniel P. Berrange <berrange@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Daniel P. Berrange <berrange@redhat.com>
Message-id: 20180201162625.4276-1-stefanha@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
6 years agotracetool: For ust trace bool type as ctf_integer
Jon Emil Jahren [Mon, 29 Jan 2018 04:16:48 +0000 (05:16 +0100)]
tracetool: For ust trace bool type as ctf_integer

Previously functions having arguments of type bool was not traced
properly. The bool arguments were missing from the trace.

Signed-off-by: Jon Emil Jahren <jonemilj@gmail.com>
Message-id: 20180129041648.30884-3-jonemilj@gmail.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
6 years agotracetool: Update argument format regex to non-greedy star
Jon Emil Jahren [Mon, 29 Jan 2018 04:16:47 +0000 (05:16 +0100)]
tracetool: Update argument format regex to non-greedy star

Using the greedy star matching, arguments like "...%"PRIx64 caused issues
for functions with multiple PRI formats.

The issue was only seen with the ust backend, as it is the only one
using the format regex.

The result for many functions was that the arguments coming after the
greedy star end was left out of the tracepoint, and in some cases some
of the arguments that was traced had the wrong format.

Signed-off-by: Jon Emil Jahren <jonemilj@gmail.com>
Message-id: 20180129041648.30884-2-jonemilj@gmail.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
6 years agoMerge remote-tracking branch 'remotes/marcel/tags/rdma-pull-request' into staging
Peter Maydell [Mon, 19 Feb 2018 12:51:11 +0000 (12:51 +0000)]
Merge remote-tracking branch 'remotes/marcel/tags/rdma-pull-request' into staging

PVRDMA implementation

# gpg: Signature made Mon 19 Feb 2018 11:08:49 GMT
# gpg:                using RSA key 36D4C0F0CF2FE46D
# gpg: Good signature from "Marcel Apfelbaum <marcel@redhat.com>"
# gpg: WARNING: This key is not certified with sufficiently trusted signatures!
# gpg:          It is not certain that the signature belongs to the owner.
# Primary key fingerprint: B1C6 3A57 F92E 08F2 640F  31F5 36D4 C0F0 CF2F E46D

* remotes/marcel/tags/rdma-pull-request:
  MAINTAINERS: add entry for hw/rdma
  hw/rdma: Implementation of PVRDMA device
  hw/rdma: PVRDMA commands and data-path ops
  hw/rdma: Implementation of generic rdma device layers
  hw/rdma: Definitions for rdma device and rdma resource manager
  hw/rdma: Add wrappers and macros
  include/standard-headers: add pvrdma related headers
  scripts/update-linux-headers: import pvrdma headers
  docs: add pvrdma device documentation.
  mem: add share parameter to memory-backend-ram

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6 years agoMAINTAINERS: add entry for hw/rdma
Marcel Apfelbaum [Thu, 14 Dec 2017 15:32:23 +0000 (17:32 +0200)]
MAINTAINERS: add entry for hw/rdma

Signed-off-by: Marcel Apfelbaum <marcel@redhat.com>
Signed-off-by: Yuval Shaia <yuval.shaia@oracle.com>
6 years agohw/rdma: Implementation of PVRDMA device
Yuval Shaia [Fri, 9 Feb 2018 13:44:14 +0000 (15:44 +0200)]
hw/rdma: Implementation of PVRDMA device

PVRDMA is the QEMU implementation of VMware's paravirtualized RDMA device.
It works with its Linux Kernel driver AS IS, no need for any special
guest modifications.

While it complies with the VMware device, it can also communicate with
bare metal RDMA-enabled machines and does not require an RDMA HCA in the
host, it can work with Soft-RoCE (rxe).

It does not require the whole guest RAM to be pinned allowing memory
over-commit and, even if not implemented yet, migration support will be
possible with some HW assistance.

Implementation is divided into 2 components, rdma general and pvRDMA
specific functions and structures.

The second PVRDMA sub-module - interaction with PCI layer.
- Device configuration and setup (MSIX, BARs etc).
- Setup of DSR (Device Shared Resources)
- Setup of device ring.
- Device management.

Reviewed-by: Dotan Barak <dotanb@mellanox.com>
Reviewed-by: Zhu Yanjun <yanjun.zhu@oracle.com>
Signed-off-by: Yuval Shaia <yuval.shaia@oracle.com>
Signed-off-by: Marcel Apfelbaum <marcel@redhat.com>
6 years agohw/rdma: PVRDMA commands and data-path ops
Yuval Shaia [Fri, 9 Feb 2018 13:39:19 +0000 (15:39 +0200)]
hw/rdma: PVRDMA commands and data-path ops

First PVRDMA sub-module - implementation of the PVRDMA device.
- PVRDMA commands such as create CQ and create MR.
- Data path QP operations - post_send and post_recv.
- Completion handler.

Reviewed-by: Dotan Barak <dotanb@mellanox.com>
Reviewed-by: Zhu Yanjun <yanjun.zhu@oracle.com>
Signed-off-by: Yuval Shaia <yuval.shaia@oracle.com>
Signed-off-by: Marcel Apfelbaum <marcel@redhat.com>
6 years agohw/rdma: Implementation of generic rdma device layers
Yuval Shaia [Fri, 9 Feb 2018 13:23:18 +0000 (15:23 +0200)]
hw/rdma: Implementation of generic rdma device layers

This layer is composed of two sub-modules, backend and resource manager.
Backend sub-module is responsible for all the interaction with IB layers
such as ibverbs and umad (external libraries).
Resource manager is a collection of functions and structures to manage
RDMA resources such as QPs, CQs and MRs.

Reviewed-by: Dotan Barak <dotanb@mellanox.com>
Reviewed-by: Zhu Yanjun <yanjun.zhu@oracle.com>
Signed-off-by: Yuval Shaia <yuval.shaia@oracle.com>
Signed-off-by: Marcel Apfelbaum <marcel@redhat.com>
6 years agohw/rdma: Definitions for rdma device and rdma resource manager
Yuval Shaia [Fri, 9 Feb 2018 13:00:59 +0000 (15:00 +0200)]
hw/rdma: Definitions for rdma device and rdma resource manager

Definition of various structures and constants used in backend and
resource manager modules.

Reviewed-by: Dotan Barak <dotanb@mellanox.com>
Reviewed-by: Zhu Yanjun <yanjun.zhu@oracle.com>
Signed-off-by: Yuval Shaia <yuval.shaia@oracle.com>
Signed-off-by: Marcel Apfelbaum <marcel@redhat.com>
6 years agohw/rdma: Add wrappers and macros
Yuval Shaia [Fri, 9 Feb 2018 13:15:00 +0000 (15:15 +0200)]
hw/rdma: Add wrappers and macros

As all mapping for this device are from driver to device,
declare wrappers on top of pci_dma_*map functions.

In addition, declare macros to be used for debug messages.

Reviewed-by: Dotan Barak <dotanb@mellanox.com>
Reviewed-by: Zhu Yanjun <yanjun.zhu@oracle.com>
Signed-off-by: Yuval Shaia <yuval.shaia@oracle.com>
Signed-off-by: Marcel Apfelbaum <marcel@redhat.com>
6 years agoinclude/standard-headers: add pvrdma related headers
Marcel Apfelbaum [Mon, 12 Feb 2018 11:49:08 +0000 (13:49 +0200)]
include/standard-headers: add pvrdma related headers

Import the headers used by the pvrdma device.
Part of them are interfaces between the guest driver and the device,
imported under include/standart-headers/drivers/infiniband/... .

Signed-off-by: Marcel Apfelbaum <marcel@redhat.com>
Signed-off-by: Yuval Shaia <yuval.shaia@oracle.com>
6 years agoscripts/update-linux-headers: import pvrdma headers
Marcel Apfelbaum [Wed, 14 Feb 2018 17:35:27 +0000 (19:35 +0200)]
scripts/update-linux-headers: import pvrdma headers

Modify the script to import the headers used by the pvrdma device.
Part of them are interfaces between the guest driver and the device,
import them under include/standart-headers/drivers/infiniband/... .

Remove the unused functions from pvrdma_verbs.h avoiding the
unnecessary import of several infiniband/networking/other headers.

Reviewed-by: Gal Hammer <ghammer@redhat.com>
Signed-off-by: Marcel Apfelbaum <marcel@redhat.com>
Signed-off-by: Yuval Shaia <yuval.shaia@oracle.com>
6 years agodocs: add pvrdma device documentation.
Marcel Apfelbaum [Thu, 14 Dec 2017 15:26:37 +0000 (17:26 +0200)]
docs: add pvrdma device documentation.

Signed-off-by: Marcel Apfelbaum <marcel@redhat.com>
Signed-off-by: Yuval Shaia <yuval.shaia@oracle.com>
Reviewed-by: Shamir Rabinovitch <shamir.rabinovitch@oracle.com>
6 years agomem: add share parameter to memory-backend-ram
Marcel Apfelbaum [Wed, 13 Dec 2017 14:37:37 +0000 (16:37 +0200)]
mem: add share parameter to memory-backend-ram

Currently only file backed memory backend can
be created with a "share" flag in order to allow
sharing guest RAM with other processes in the host.

Add the "share" flag also to RAM Memory Backend
in order to allow remapping parts of the guest RAM
to different host virtual addresses. This is needed
by the RDMA devices in order to remap non-contiguous
QEMU virtual addresses to a contiguous virtual address range.

Moved the "share" flag to the Host Memory base class,
modified phys_mem_alloc to include the new parameter
and a new interface memory_region_init_ram_shared_nomigrate.

There are no functional changes if the new flag is not used.

Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Marcel Apfelbaum <marcel@redhat.com>
6 years agoMerge remote-tracking branch 'remotes/cohuck/tags/stable-doc-20180219' into staging
Peter Maydell [Mon, 19 Feb 2018 10:28:34 +0000 (10:28 +0000)]
Merge remote-tracking branch 'remotes/cohuck/tags/stable-doc-20180219' into staging

Add some doc for the stable process.

# gpg: Signature made Mon 19 Feb 2018 10:01:19 GMT
# gpg:                using RSA key DECF6B93C6F02FAF
# gpg: Good signature from "Cornelia Huck <conny@cornelia-huck.de>"
# gpg:                 aka "Cornelia Huck <huckc@linux.vnet.ibm.com>"
# gpg:                 aka "Cornelia Huck <cornelia.huck@de.ibm.com>"
# gpg:                 aka "Cornelia Huck <cohuck@kernel.org>"
# gpg:                 aka "Cornelia Huck <cohuck@redhat.com>"
# Primary key fingerprint: C3D0 D66D C362 4FF6 A8C0  18CE DECF 6B93 C6F0 2FAF

* remotes/cohuck/tags/stable-doc-20180219:
  docs: document our stable process

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6 years agodocs: document our stable process
Cornelia Huck [Fri, 9 Feb 2018 13:03:33 +0000 (14:03 +0100)]
docs: document our stable process

Some pointers on how to get a patch into stable.

[contains some suggestions by mdroth and eblake]
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
6 years agolinux-user: Remove THREAD macro
Peter Maydell [Tue, 13 Feb 2018 13:22:46 +0000 (13:22 +0000)]
linux-user: Remove THREAD macro

Back when we used to support compiling either with or without
NPTL threading library support, we used a macro THREAD which would
expand either to nothing (no thread support) or to __thread (threads
supported). For a long time now we have required thread support,
so remove the macro and just use __thread directly as other parts
of QEMU do.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20180213132246.26844-1-peter.maydell@linaro.org>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
6 years agolinux-user: Fix sched_getaffinity mask size
Samuel Thibault [Sun, 11 Feb 2018 17:47:04 +0000 (18:47 +0100)]
linux-user: Fix sched_getaffinity mask size

We properly computed the capped mask size to be put to the application
buffer, but didn't actually used it. Also, we need to return the capped mask
size instead of 0 on success.

Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <20180211174704.27441-1-samuel.thibault@ens-lyon.org>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
6 years agolinux-user: Fix register used for 6th and 7th syscall argument on aarch64
Guido Günther [Fri, 2 Feb 2018 10:02:25 +0000 (11:02 +0100)]
linux-user: Fix register used for 6th and 7th syscall argument on aarch64

This unbreaks the testcase from

    http://lists.nongnu.org/archive/html/qemu-arm/2018-01/msg00514.html

Thanks to Laurent Vivier for spotting the 7th one.

Signed-off-by: Guido Günther <agx@sigxcpu.org>
Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Suggested-by: Laurent Vivier <laurent@vivier.eu>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <671eaa99f4e0bf3a58f76f9151f7cfa24662227f.1517565566.git.agx@sigxcpu.org>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
6 years agolinux-user: Implement ioctl cmd TIOCGPTPEER
Andreas Schwab [Mon, 29 Jan 2018 10:47:06 +0000 (11:47 +0100)]
linux-user: Implement ioctl cmd TIOCGPTPEER

With glibc 2.27 the openpty function prefers the TIOCGPTPEER ioctl.

Signed-off-by: Andreas Schwab <schwab@suse.de>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <mvmbmhdosb9.fsf_-_@suse.de>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
6 years agoMerge remote-tracking branch 'remotes/dgilbert/tags/pull-hmp-20180216' into staging
Peter Maydell [Fri, 16 Feb 2018 18:39:04 +0000 (18:39 +0000)]
Merge remote-tracking branch 'remotes/dgilbert/tags/pull-hmp-20180216' into staging

HMP pull 2018-02-16

# gpg: Signature made Fri 16 Feb 2018 17:45:06 GMT
# gpg:                using RSA key 0516331EBC5BFDE7
# gpg: Good signature from "Dr. David Alan Gilbert (RH2) <dgilbert@redhat.com>"
# Primary key fingerprint: 45F5 C71B 4A0C B7FB 977A  9FA9 0516 331E BC5B FDE7

* remotes/dgilbert/tags/pull-hmp-20180216:
  monitor.c: Fix infinite loop in monitor's auto-complete
  monitor: Remove legacy "-mon default=on" parameter

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6 years agocuda.h: Fix multiple typedef
Dr. David Alan Gilbert [Fri, 16 Feb 2018 17:31:11 +0000 (17:31 +0000)]
cuda.h: Fix multiple typedef

RHEL6's compilers don't like the repeated typedef.

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6 years agomonitor.c: Fix infinite loop in monitor's auto-complete
Dr. David Alan Gilbert [Tue, 13 Feb 2018 12:51:43 +0000 (12:51 +0000)]
monitor.c: Fix infinite loop in monitor's auto-complete

The QEMU monitor enters an infinite loop when trying to auto-complete commands
that accept only optional parameters. The commands currently affected by this
issue are 'info registers' and 'info mtree'.

Reported-by: Dimitris Karagkasidis <t.pagef.lt@gmail.com>
Fixes: 48fe86f6400574165979e0db6f5937ad487b6888
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Message-Id: <20180213125143.23488-1-dgilbert@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
6 years agomonitor: Remove legacy "-mon default=on" parameter
Thomas Huth [Tue, 19 Dec 2017 16:17:33 +0000 (17:17 +0100)]
monitor: Remove legacy "-mon default=on" parameter

The "default" parameter of the "-mon" option is useless since
QEMU v2.4.0, and marked as deprecated since QEMU v2.8.0. That
should have been long enough to let people update their scripts,
so time to remove it now.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Message-Id: <1513700253-10045-1-git-send-email-thuth@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
6 years agoMerge remote-tracking branch 'remotes/kraxel/tags/ui-20180216-pull-request' into...
Peter Maydell [Fri, 16 Feb 2018 15:55:45 +0000 (15:55 +0000)]
Merge remote-tracking branch 'remotes/kraxel/tags/ui-20180216-pull-request' into staging

bugfixes for vnc and sdl2

# gpg: Signature made Fri 16 Feb 2018 11:53:37 GMT
# gpg:                using RSA key 4CB6D8EED3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>"
# gpg:                 aka "Gerd Hoffmann <gerd@kraxel.org>"
# gpg:                 aka "Gerd Hoffmann (private) <kraxel@gmail.com>"
# Primary key fingerprint: A032 8CFF B93A 17A7 9901  FE7D 4CB6 D8EE D3E8 7138

* remotes/kraxel/tags/ui-20180216-pull-request:
  ui: extend VNC trottling tracing to SASL codepaths
  ui: check VNC audio frequency limit at time of reading from client
  ui: avoid 'local_err' variable shadowing in VNC SASL auth
  ui: avoid risk of 32-bit int overflow in VNC buffer check
  sdl2: fix mouse grab
  sdl: restore optimized redraw
  vnc: fix segfault in closed connection handling
  vnc: add qapi/error.h include to stubs
  vnc: remove bogus object_unref on client socket

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6 years agoMerge remote-tracking branch 'remotes/dgibson/tags/ppc-for-2.12-20180216' into staging
Peter Maydell [Fri, 16 Feb 2018 14:26:12 +0000 (14:26 +0000)]
Merge remote-tracking branch 'remotes/dgibson/tags/ppc-for-2.12-20180216' into staging

ppc patch queue 2018-02-16

Highlights of this batch:
  * Conversion to TranslatorOps (Emilio Cota)
  * Further bugfixes and cleanups to vcpu id allocation for pseries
    (Greg Kurz)
  * Another bugfix for HPT resizing (Daniel Henrique-Barboza)
  * Macintosh CUDA cleanups (Mark Cave-Ayland)
  * Further tweaks to Spectre/Meltdown mitigations (Suraj Singh)

# gpg: Signature made Fri 16 Feb 2018 10:00:02 GMT
# gpg:                using RSA key 6C38CACA20D9B392
# gpg: Good signature from "David Gibson <david@gibson.dropbear.id.au>"
# gpg:                 aka "David Gibson (Red Hat) <dgibson@redhat.com>"
# gpg:                 aka "David Gibson (ozlabs.org) <dgibson@ozlabs.org>"
# gpg:                 aka "David Gibson (kernel.org) <dwg@kernel.org>"
# Primary key fingerprint: 75F4 6586 AE61 A66C C44E  87DC 6C38 CACA 20D9 B392

* remotes/dgibson/tags/ppc-for-2.12-20180216:
  ppc4xx: Add device models found in PPC440 core SoCs
  ppc/spapr-caps: Disallow setting workaround for spapr-cap-ibs
  target/ppc: convert to TranslatorOps
  target/ppc: convert to DisasContextBase
  spapr: consolidate the VCPU id numbering logic in a single place
  spapr: rename spapr_vcpu_id() to spapr_get_vcpu_id()
  spapr: move VCPU calculation to core machine code
  spapr: use spapr->vsmt to compute VCPU ids
  ppc/spapr-caps: Change migration macro to take full spapr-cap name
  hw/char: remove legacy interface escc_init()
  hw/ppc/spapr_hcall: set htab_shift after kvmppc_resize_hpt_commit
  cuda: convert to trace-events
  ppc: move CUDAState and other CUDA-related definitions into separate cuda.h file
  cuda: convert to use the shared mos6522 device

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6 years agoMerge remote-tracking branch 'remotes/dgilbert/tags/pull-migration-20180214a' into...
Peter Maydell [Fri, 16 Feb 2018 12:51:40 +0000 (12:51 +0000)]
Merge remote-tracking branch 'remotes/dgilbert/tags/pull-migration-20180214a' into staging

Migration pull 20180214

Note that the 'Add test for migration to bad destination' displays
a 'Connection refused' during running, but still gives the correct exit
code and OK (It's checking that the source doesn't fail when
it can't connect, so that's the right error).
If it's particularly disliked that patch can be skipped individually.

# gpg: Signature made Wed 14 Feb 2018 15:33:04 GMT
# gpg:                using RSA key 0516331EBC5BFDE7
# gpg: Good signature from "Dr. David Alan Gilbert (RH2) <dgilbert@redhat.com>"
# Primary key fingerprint: 45F5 C71B 4A0C B7FB 977A  9FA9 0516 331E BC5B FDE7

* remotes/dgilbert/tags/pull-migration-20180214a:
  migration: pass MigrationState to migrate_init()
  migration: allow send_rq to fail
  migration: provide postcopy_fault_thread_notify()
  migration: reuse mis->userfault_quit_fd
  migration: better error handling with QEMUFile
  tests/migration: Add test for migration to bad destination
  migration: Fix early failure cleanup
  tests/migration: Add source to PC boot block
  migration: improve documentation of postcopy-ram
  migration/xen: Check return value of qemu_fclose

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6 years agoui: extend VNC trottling tracing to SASL codepaths
Daniel P. Berrangé [Mon, 5 Feb 2018 11:49:38 +0000 (11:49 +0000)]
ui: extend VNC trottling tracing to SASL codepaths

In previous commit:

  commit 6aa22a29187e1908f5db738d27c64a9efc8d0bfa
  Author: Daniel P. Berrange <berrange@redhat.com>
  Date:   Mon Dec 18 19:12:27 2017 +0000

    ui: add trace events related to VNC client throttling

trace points related to unthrottling client I/O were missed from the
SASL codepaths.

Reported-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Message-id: 20180205114938.15784-5-berrange@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
6 years agoui: check VNC audio frequency limit at time of reading from client
Daniel P. Berrangé [Mon, 5 Feb 2018 11:49:37 +0000 (11:49 +0000)]
ui: check VNC audio frequency limit at time of reading from client

The 'vs->as.freq' value is a signed integer, which is read from an
unsigned 32-bit int field on the wire. There is thus a risk of overflow
on 32-bit platforms. Move the frequency limit checking to be done at
time of read before casting to a signed integer.

Reported-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-id: 20180205114938.15784-4-berrange@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
6 years agoui: avoid 'local_err' variable shadowing in VNC SASL auth
Daniel P. Berrangé [Mon, 5 Feb 2018 11:49:36 +0000 (11:49 +0000)]
ui: avoid 'local_err' variable shadowing in VNC SASL auth

The start_auth_sasl() method declares a 'Error *local_err' variable in
an inner if () {...} scope, which shadows a variable of the same name
declared at the start of the method. This is confusing for reviewers and
may trigger compiler warnings.

Reported-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-id: 20180205114938.15784-3-berrange@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
6 years agoui: avoid risk of 32-bit int overflow in VNC buffer check
Daniel P. Berrangé [Mon, 5 Feb 2018 11:49:35 +0000 (11:49 +0000)]
ui: avoid risk of 32-bit int overflow in VNC buffer check

For very large framebuffers, it is theoretically possible for the result
of 'vs->throttle_output_offset * VNC_THROTTLE_OUTPUT_LIMIT_SCALE' to
exceed the size of a 32-bit int. For this to happen in practice, the
video RAM would have to be set to a large enough value, which is not
likely today. None the less we can be paranoid against future growth by
using division instead of multiplication when checking the limits.

Reported-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-id: 20180205114938.15784-2-berrange@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
6 years agosdl2: fix mouse grab
Gerd Hoffmann [Fri, 2 Feb 2018 12:08:03 +0000 (13:08 +0100)]
sdl2: fix mouse grab

When qemu mouse mode changes from relative to absolute
we must turn off sdl relative mouse mode too.

Fixes: https://bugs.launchpad.net/qemu/+bug/1703795
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Message-Id: <20180202120803.11501-1-kraxel@redhat.com>

6 years agosdl: restore optimized redraw
Anatoly Trosinenko [Mon, 5 Feb 2018 13:32:28 +0000 (16:32 +0300)]
sdl: restore optimized redraw

The documentation on SDL_RenderPresent function states that
"the backbuffer should be considered invalidated after each present",
so copy the entire texture on each redraw.

On the other hand, SDL_UpdateTexture function is described as
"fairly slow function", so restrict it to just the changed pixels.

Also added SDL_RenderClear call, as suggested in the documentation
page on SDL_RenderPresent.

Signed-off-by: Anatoly Trosinenko <anatoly.trosinenko@gmail.com>
Message-id: 20180205133228.25082-1-anatoly.trosinenko@gmail.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
6 years agovnc: fix segfault in closed connection handling
Klim Kireev [Wed, 7 Feb 2018 09:48:44 +0000 (12:48 +0300)]
vnc: fix segfault in closed connection handling

On one of our client's node, due to trying to read from closed ioc,
a segmentation fault occured. Corresponding backtrace:

0  object_get_class (obj=obj@entry=0x0)
1  qio_channel_readv_full (ioc=0x0, iov=0x7ffe55277180 ...
2  qio_channel_read (ioc=<optimized out> ...
3  vnc_client_read_buf (vs=vs@entry=0x55625f3c6000, ...
4  vnc_client_read_plain (vs=0x55625f3c6000)
5  vnc_client_read (vs=0x55625f3c6000)
6  vnc_client_io (ioc=<optimized out>, condition=G_IO_IN, ...
7  g_main_dispatch (context=0x556251568a50)
8  g_main_context_dispatch (context=context@entry=0x556251568a50)
9  glib_pollfds_poll ()
10 os_host_main_loop_wait (timeout=<optimized out>)
11 main_loop_wait (nonblocking=nonblocking@entry=0)
12 main_loop () at vl.c:1909
13 main (argc=<optimized out>, argv=<optimized out>, ...

Having analyzed the coredump, I understood that the reason is that
ioc_tag is reset on vnc_disconnect_start and ioc is cleaned
in vnc_disconnect_finish. Between these two events due to some
reasons the ioc_tag was set again and after vnc_disconnect_finish
the handler is running with freed ioc,
which led to the segmentation fault.

The patch checks vs->disconnecting in places where we call
qio_channel_add_watch and resets handler if disconnecting == TRUE
to prevent such an occurrence.

Signed-off-by: Klim Kireev <klim.kireev@virtuozzo.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Message-id: 20180207094844.21402-1-klim.kireev@virtuozzo.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
6 years agovnc: add qapi/error.h include to stubs
Gerd Hoffmann [Tue, 13 Feb 2018 07:05:26 +0000 (08:05 +0100)]
vnc: add qapi/error.h include to stubs

Fixes --disable-vnc build failure.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-id: 20180213070526.22475-1-kraxel@redhat.com

6 years agovnc: remove bogus object_unref on client socket
Daniel P. Berrangé [Thu, 15 Feb 2018 10:26:02 +0000 (10:26 +0000)]
vnc: remove bogus object_unref on client socket

vnc_listen_io() does not own the reference on the 'cioc' parameter is it
passed, so should not be unref'ing it.

Fixes: 13e1d0e71e78a925848258391a6e616b6b5ae219
Reported-by: Bandan Das <bsd@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-id: 20180215102602.10864-1-berrange@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
6 years agoMerge remote-tracking branch 'remotes/berrange/tags/qio-next-pull-request' into staging
Peter Maydell [Fri, 16 Feb 2018 11:19:37 +0000 (11:19 +0000)]
Merge remote-tracking branch 'remotes/berrange/tags/qio-next-pull-request' into staging

# gpg: Signature made Thu 15 Feb 2018 17:50:22 GMT
# gpg:                using RSA key BE86EBB415104FDF
# gpg: Good signature from "Daniel P. Berrange <dan@berrange.com>"
# gpg:                 aka "Daniel P. Berrange <berrange@redhat.com>"
# Primary key fingerprint: DAF3 A6FD B26B 6291 2D0E  8E3F BE86 EBB4 1510 4FDF

* remotes/berrange/tags/qio-next-pull-request:
  allow to build with older sed
  io/channel-command: Do not kill the child process after closing the pipe
  io: Add /dev/fdset/ support to QIOChannelFile
  io: Don't call close multiple times in QIOChannelFile
  io: Fix QIOChannelFile when creating and opening read-write
  io/channel-websock: handle continuous reads without any data
  io: fix QIONetListener memory leak

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6 years agotests/boot-serial-test: Fix problem with timeout due to dropped characters
Thomas Huth [Fri, 16 Feb 2018 06:12:44 +0000 (07:12 +0100)]
tests/boot-serial-test: Fix problem with timeout due to dropped characters

Commit 92b540dac9fc3a5 introduce a counter to handle the timeouts in a
better way. But in case ccnt reaches 512, the current read character is
ignored - and if that character is part of the string that we are looking
for, the test fails to match the string.

Almost all of the tests look for a string within the first 512 bytes of
firmware output, so the problem never triggered there. But the hppa test
that has been added recently looks for a longer string at the very end of
a long output, thus there's a chance that we miss a character there so
that the test fails unexpectedly. Fix it by *not* reading and dropping a
character if the counter reaches 512.

Fixes: 92b540dac9fc3a572c7342edd0b073000f5a6abf
Signed-off-by: Thomas Huth <thuth@redhat.com>
Message-id: 1518761564-9899-1-git-send-email-thuth@redhat.com
[PMM: added initializer for nbd to silence false-positive warning
 from OpenBSD 6 compiler]
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6 years agoppc4xx: Add device models found in PPC440 core SoCs
BALATON Zoltan [Thu, 15 Feb 2018 21:27:06 +0000 (22:27 +0100)]
ppc4xx: Add device models found in PPC440 core SoCs

These devices are found in newer SoCs based on 440 core e.g. the 460EX
(http://www.embeddeddeveloper.com/assets/processors/amcc/datasheets/
PP460EX_DS2063.pdf)

Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
6 years agoppc/spapr-caps: Disallow setting workaround for spapr-cap-ibs
Suraj Jitindar Singh [Fri, 16 Feb 2018 02:33:27 +0000 (13:33 +1100)]
ppc/spapr-caps: Disallow setting workaround for spapr-cap-ibs

The spapr-cap cap-ibs can only have values broken or fixed as there is
no explicit workaround required. Currently setting the value workaround
for this cap will hit an assert if the guest makes the hcall
h_get_cpu_characteristics.

Report an error when attempting to apply the setting with a more helpful
error message.

Reported-by: Satheesh Rajendran <sathnaga@linux.vnet.ibm.com>
Signed-off-by: Suraj Jitindar Singh <sjitindarsingh@gmail.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
6 years agotarget/ppc: convert to TranslatorOps
Emilio G. Cota [Thu, 15 Feb 2018 19:51:49 +0000 (14:51 -0500)]
target/ppc: convert to TranslatorOps

A few changes worth noting:

- Didn't migrate ctx->exception to DISAS_* since the exception field is
  in many cases architecturally relevant.

- Moved the cross-page check from the end of translate_insn to tb_start.

- Removed the exit(1) after a TCG temp leak; changed the fprintf there to
  qemu_log.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Emilio G. Cota <cota@braap.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
6 years agotarget/ppc: convert to DisasContextBase
Emilio G. Cota [Thu, 15 Feb 2018 19:51:48 +0000 (14:51 -0500)]
target/ppc: convert to DisasContextBase

A couple of notes:

- removed ctx->nip in favour of base->pc_next. Yes, it is annoying,
  but didn't want to waste its 4 bytes.

- ctx->singlestep_enabled does a lot more than
  base.singlestep_enabled; this confused me at first.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Emilio G. Cota <cota@braap.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
6 years agospapr: consolidate the VCPU id numbering logic in a single place
Greg Kurz [Wed, 14 Feb 2018 19:40:53 +0000 (20:40 +0100)]
spapr: consolidate the VCPU id numbering logic in a single place

Several places in the code need to calculate a VCPU id:

    (cpu_index / smp_threads) * spapr->vsmt + cpu_index % smp_threads
    (core_id / smp_threads) * spapr->vsmt (1 user)
    index * spapr->vsmt (2 users)

or guess that the VCPU id of a given VCPU is the first thread of a virtual
core:

    index % spapr->vsmt != 0

Even if the numbering logic isn't that complex, it is rather fragile to
have these assumptions open-coded in several places. FWIW this was
proved with recent issues related to VSMT.

This patch moves the VCPU id formula to a single function to be called
everywhere the code needs to compute one. It also adds an helper to
guess if a VCPU is the first thread of a VCORE.

Signed-off-by: Greg Kurz <groug@kaod.org>
[dwg: Rename spapr_is_vcore() to spapr_is_thread0_in_vcore() for clarity]
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
6 years agospapr: rename spapr_vcpu_id() to spapr_get_vcpu_id()
Greg Kurz [Wed, 14 Feb 2018 19:40:44 +0000 (20:40 +0100)]
spapr: rename spapr_vcpu_id() to spapr_get_vcpu_id()

The spapr_vcpu_id() function is an accessor actually. Let's rename it
for symmetry with the recently added spapr_set_vcpu_id() helper.

The motivation behind this is that a later patch will consolidate
the VCPU id formula in a function and spapr_vcpu_id looks like an
appropriate name.

Signed-off-by: Greg Kurz <groug@kaod.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
6 years agospapr: move VCPU calculation to core machine code
Greg Kurz [Wed, 14 Feb 2018 19:40:35 +0000 (20:40 +0100)]
spapr: move VCPU calculation to core machine code

The VCPU ids are currently computed and assigned to each individual
CPU threads in spapr_cpu_core_realize(). But the numbering logic
of VCPU ids is actually a machine-level concept, and many places
in hw/ppc/spapr.c also have to compute VCPU ids out of CPU indexes.

The current formula used in spapr_cpu_core_realize() is:

    vcpu_id = (cc->core_id * spapr->vsmt / smp_threads) + i

where:

    cc->core_id is a multiple of smp_threads
    cpu_index = cc->core_id + i
    0 <= i < smp_threads

So we have:

    cpu_index % smp_threads == i
    cc->core_id / smp_threads == cpu_index / smp_threads

hence:

    vcpu_id =
        (cpu_index / smp_threads) * spapr->vsmt + cpu_index % smp_threads;

This formula was used before VSMT at the time VCPU ids where computed
at the target emulation level. It has the advantage of being useable
to derive a VPCU id out of a CPU index only. It is fitted for all the
places where the machine code has to compute a VCPU id.

This patch introduces an accessor to set the VCPU id in a PowerPCCPU object
using the above formula. It is a first step to consolidate all the VCPU id
logic in a single place.

Signed-off-by: Greg Kurz <groug@kaod.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
6 years agospapr: use spapr->vsmt to compute VCPU ids
Greg Kurz [Wed, 14 Feb 2018 19:40:26 +0000 (20:40 +0100)]
spapr: use spapr->vsmt to compute VCPU ids

Since the introduction of VSMT in 2.11, the spacing of VCPU ids
between cores is controllable through a machine property instead
of being only dictated by the SMT mode of the host:

    cpu->vcpu_id = (cc->core_id * spapr->vsmt / smp_threads) + i

Until recently, the machine code would try to change the SMT mode
of the host to be equal to VSMT or exit. This allowed the rest of
the code to assume that kvmppc_smt_threads() == spapr->vsmt is
always true.

Recent commit "8904e5a75005 spapr: Adjust default VSMT value for
better migration compatibility" relaxed the rule. If the VSMT
mode cannot be set in KVM for some reasons, but the requested
CPU topology is compatible with the current SMT mode, then we
let the guest run with  kvmppc_smt_threads() != spapr->vsmt.

This breaks quite a few places in the code, in particular when
calculating DRC indexes.

This is what happens on a POWER host with subcores-per-core=2 (ie,
supports up to SMT4) when passing the following topology:

    -smp threads=4,maxcpus=16 \
    -device host-spapr-cpu-core,core-id=4,id=core1 \
    -device host-spapr-cpu-core,core-id=8,id=core2

qemu-system-ppc64: warning: Failed to set KVM's VSMT mode to 8 (errno -22)

This is expected since KVM is limited to SMT4, but the guest is started
anyway because this topology can run on SMT4 even with a VSMT8 spacing.

But when we look at the DT, things get nastier:

cpus {
        ...
        ibm,drc-indexes = <0x4 0x10000000 0x10000004 0x10000008 0x1000000c>;

This means that we have the following association:

 CPU core device |     DRC    | VCPU id
-----------------+------------+---------
   boot core     | 0x10000000 | 0
   core1         | 0x10000004 | 4
   core2         | 0x10000008 | 8
   core3         | 0x1000000c | 12

But since the spacing of VCPU ids is 8, the DRC for core1 points to a
VCPU that doesn't exist, the DRC for core2 points to the first VCPU of
core1 and and so on...

        ...

        PowerPC,POWER8@0 {
                ...
                ibm,my-drc-index = <0x10000000>;
                ...
        };

        PowerPC,POWER8@8 {
                ...
                ibm,my-drc-index = <0x10000008>;
                ...
        };

        PowerPC,POWER8@10 {
                ...

No ibm,my-drc-index property for this core since 0x10000010 doesn't
exist in ibm,drc-indexes above.

                ...
        };
};

...

interrupt-controller {
        ...
        ibm,interrupt-server-ranges = <0x0 0x10>;

With a spacing of 8, the highest VCPU id for the given topology should be:
        16 * 8 / 4 = 32 and not 16

        ...
        linux,phandle = <0x7e7323b8>;
        interrupt-controller;
};

And CPU hot-plug/unplug is broken:

(qemu) device_del core1
pseries-hotplug-cpu: Cannot find CPU (drc index 10000004) to remove

(qemu) device_del core2
cpu 4 (hwid 8) Ready to die...
cpu 5 (hwid 9) Ready to die...
cpu 6 (hwid 10) Ready to die...
cpu 7 (hwid 11) Ready to die...

These are the VCPU ids of core1 actually

(qemu) device_add host-spapr-cpu-core,core-id=12,id=core3
(qemu) device_del core3
pseries-hotplug-cpu: Cannot find CPU (drc index 1000000c) to remove

This patches all the code in hw/ppc/spapr.c to assume the VSMT
spacing when manipulating VCPU ids.

Fixes: 8904e5a75005
Signed-off-by: Greg Kurz <groug@kaod.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
6 years agoppc/spapr-caps: Change migration macro to take full spapr-cap name
Suraj Jitindar Singh [Thu, 15 Feb 2018 00:44:41 +0000 (11:44 +1100)]
ppc/spapr-caps: Change migration macro to take full spapr-cap name

Change the macro that generates the vmstate migration field and the needed
function for the spapr-caps to take the full spapr-cap name. This has
the benefit of meaning this instance will be picked up when greping
for the spapr-caps and making it more obvious what this macro is doing.

Signed-off-by: Suraj Jitindar Singh <sjitindarsingh@gmail.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
6 years agohw/char: remove legacy interface escc_init()
Laurent Vivier [Wed, 14 Feb 2018 06:35:58 +0000 (07:35 +0100)]
hw/char: remove legacy interface escc_init()

Move necessary stuff in escc.h and update type names.
Remove slavio_serial_ms_kbd_init().
Fix code style problems reported by checkpatch.pl
Update mac_newworld, mac_oldworld and sun4m to use directly the
QDEV interface.

Signed-off-by: Laurent Vivier <lvivier@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
6 years agohw/ppc/spapr_hcall: set htab_shift after kvmppc_resize_hpt_commit
Daniel Henrique Barboza [Tue, 13 Feb 2018 17:37:16 +0000 (15:37 -0200)]
hw/ppc/spapr_hcall: set htab_shift after kvmppc_resize_hpt_commit

Newer kernels have a htab resize capability when adding or remove
memory. At these situations, the guest kernel might reallocate its
htab to a more suitable size based on the resulting memory.

However, we're not setting the new value back into the machine state
when a KVM guest resizes its htab. At first this doesn't seem harmful,
but when migrating or saving the guest state (via virsh managedsave,
for instance) this mismatch between the htab size of QEMU and the
kernel makes the guest hangs when trying to load its state.

Inside h_resize_hpt_commit, the hypercall that commits the hash page
resize changes, let's set spapr->htab_shift to the new value if we're
sure that kvmppc_resize_hpt_commit were successful.

While we're here, add a "not RADIX" sanity check as it is already done
in the related hypercall h_resize_hpt_prepare.

Fixes: https://github.com/open-power-host-os/qemu/issues/28
Reported-by: Satheesh Rajendran <sathnaga@linux.vnet.ibm.com>
Signed-off-by: Daniel Henrique Barboza <danielhb@linux.vnet.ibm.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
6 years agocuda: convert to trace-events
Mark Cave-Ayland [Fri, 9 Feb 2018 18:51:42 +0000 (18:51 +0000)]
cuda: convert to trace-events

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
6 years agoppc: move CUDAState and other CUDA-related definitions into separate cuda.h file
Mark Cave-Ayland [Fri, 9 Feb 2018 18:51:41 +0000 (18:51 +0000)]
ppc: move CUDAState and other CUDA-related definitions into separate cuda.h file

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
6 years agocuda: convert to use the shared mos6522 device
Mark Cave-Ayland [Fri, 9 Feb 2018 18:51:40 +0000 (18:51 +0000)]
cuda: convert to use the shared mos6522 device

Add the relevant hooks as required for the MacOS timer calibration and delayed
SR interrupt.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
6 years agoMerge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20180215-1' into...
Peter Maydell [Thu, 15 Feb 2018 18:37:46 +0000 (18:37 +0000)]
Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20180215-1' into staging

target-arm queue:
 * aspeed: code cleanup to use unimplemented_device
 * preparatory work for 'raspi3' RaspberryPi 3 machine model
 * more SVE prep work
 * v8M: add minor missing registers
 * v7M: fix bug where we weren't migrating v7m.other_sp
 * v7M: fix bugs in handling of interrupt registers for
   external interrupts beyond 32

# gpg: Signature made Thu 15 Feb 2018 18:34:40 GMT
# gpg:                using RSA key 3C2525ED14360CDE
# gpg: Good signature from "Peter Maydell <peter.maydell@linaro.org>"
# gpg:                 aka "Peter Maydell <pmaydell@gmail.com>"
# gpg:                 aka "Peter Maydell <pmaydell@chiark.greenend.org.uk>"
# Primary key fingerprint: E1A5 C593 CD41 9DE2 8E83  15CF 3C25 25ED 1436 0CDE

* remotes/pmaydell/tags/pull-target-arm-20180215-1:
  raspi: Raspberry Pi 3 support
  bcm2836: Make CPU type configurable
  target/arm: Implement v8M MSPLIM and PSPLIM registers
  target/arm: Migrate v7m.other_sp
  target/arm: Add AIRCR to vmstate struct
  hw/intc/armv7m_nvic: Fix byte-to-interrupt number conversions
  target/arm: Implement writing to CONTROL_NS for v8M
  hw/intc/armv7m_nvic: Implement SCR
  hw/intc/armv7m_nvic: Implement cache ID registers
  hw/intc/armv7m_nvic: Implement v8M CPPWR register
  hw/intc/armv7m_nvic: Implement M profile cache maintenance ops
  hw/intc/armv7m_nvic: Fix ICSR PENDNMISET/CLR handling
  hw/intc/armv7m_nvic: Don't hardcode M profile ID registers in NVIC
  target/arm: Handle SVE registers when using clear_vec_high
  target/arm: Enforce access to ZCR_EL at translation
  target/arm: Suppress TB end for FPCR/FPSR
  target/arm: Enforce FP access to FPCR/FPSR
  target/arm: Remove ARM_CP_64BIT from ZCR_EL registers
  hw/arm/aspeed: simplify using the 'unimplemented device' for aspeed_soc.io
  hw/arm/aspeed: directly map the serial device to the system address space

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6 years agoraspi: Raspberry Pi 3 support
Pekka Enberg [Thu, 15 Feb 2018 18:29:36 +0000 (18:29 +0000)]
raspi: Raspberry Pi 3 support

This patch adds Raspberry Pi 3 support to hw/arm/raspi.c. The
differences to Pi 2 are:

 - Firmware address
 - Board ID
 - Board revision

The CPU is different too, but that's going to be configured as part of
the machine default CPU when we introduce a new machine type.

The patch was written from scratch by me but the logic is similar to
Zoltán Baldaszti's previous work, which I used as a reference (with
permission from the author):

  https://github.com/bztsrc/qemu-raspi3

Signed-off-by: Pekka Enberg <penberg@iki.fi>
[PMM: fixed trailing whitespace on one line]
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6 years agobcm2836: Make CPU type configurable
Pekka Enberg [Thu, 15 Feb 2018 18:29:36 +0000 (18:29 +0000)]
bcm2836: Make CPU type configurable

This patch adds a "cpu-type" property to BCM2836 SoC in preparation for
reusing the code for the Raspberry Pi 3, which has a different processor
model.

Signed-off-by: Pekka Enberg <penberg@iki.fi>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>