OSDN Git Service

qmiga/qemu.git
5 years agonet: cadence_gem: Add macro with max number of descriptor words
Edgar E. Iglesias [Thu, 11 Oct 2018 02:19:23 +0000 (04:19 +0200)]
net: cadence_gem: Add macro with max number of descriptor words

Add macro with max number of DMA descriptor words.
No functional change.

Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Message-id: 20181011021931.4249-5-edgar.iglesias@gmail.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agonet: cadence_gem: Use uint32_t for 32bit descriptor words
Edgar E. Iglesias [Thu, 11 Oct 2018 02:19:22 +0000 (04:19 +0200)]
net: cadence_gem: Use uint32_t for 32bit descriptor words

Use uint32_t instead of unsigned to describe 32bit descriptor words.

Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Message-id: 20181011021931.4249-4-edgar.iglesias@gmail.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agonet: cadence_gem: Disable TSU feature bit
Edgar E. Iglesias [Thu, 11 Oct 2018 02:19:20 +0000 (04:19 +0200)]
net: cadence_gem: Disable TSU feature bit

Disable the Timestamping Unit feature bit since QEMU does not
yet support it. This allows guest SW to correctly probe for
its existance.

Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Message-id: 20181011021931.4249-2-edgar.iglesias@gmail.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agotarget/arm: Fix cortex-a7 id_isar0
Richard Henderson [Mon, 8 Oct 2018 21:22:00 +0000 (14:22 -0700)]
target/arm: Fix cortex-a7 id_isar0

The incorrect value advertised only thumb2 div without arm div.

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20181008212205.17752-6-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agotarget/arm: Align cortex-r5 id_isar0
Richard Henderson [Mon, 8 Oct 2018 21:21:59 +0000 (14:21 -0700)]
target/arm: Align cortex-r5 id_isar0

The missing nibble made it more difficult to read.

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20181008212205.17752-5-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agotarget/arm: Define fields of ISAR registers
Richard Henderson [Mon, 8 Oct 2018 21:21:57 +0000 (14:21 -0700)]
target/arm: Define fields of ISAR registers

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20181008212205.17752-3-richard.henderson@linaro.org
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agotarget/arm: Fix aarch64_sve_change_el wrt EL0
Richard Henderson [Mon, 8 Oct 2018 21:21:56 +0000 (14:21 -0700)]
target/arm: Fix aarch64_sve_change_el wrt EL0

At present we assert:

  arm_el_is_aa64: Assertion `el >= 1 && el <= 3' failed.

The comment in arm_el_is_aa64 explains why asking about EL0 without
extra information is impossible.  Add an extra argument to provide
it from the surrounding context.

Fixes: 0ab5953b00b3
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20181008212205.17752-2-richard.henderson@linaro.org
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agohw/arm/virt: add DT property /secure-chosen/stdout-path indicating secure UART
Jerome Forissier [Fri, 5 Oct 2018 08:07:29 +0000 (10:07 +0200)]
hw/arm/virt: add DT property /secure-chosen/stdout-path indicating secure UART

Bindings for /secure-chosen and /secure-chosen/stdout-path have been
proposed 1.5 years ago [1] and implemented in OP-TEE at the same time [2].
They've now been officially agreed on, so we can implement them
in QEMU.

This patch creates the property when the machine is secure.

[1] https://patchwork.kernel.org/patch/9602401/
[2] https://github.com/OP-TEE/optee_os/commit/4dc31c52544a

Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
Message-id: 20181005080729.6480-1-jerome.forissier@linaro.org
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
[PMM: commit message tweak]
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agoMerge remote-tracking branch 'remotes/awilliam/tags/vfio-updates-20181015.0' into...
Peter Maydell [Mon, 15 Oct 2018 17:44:04 +0000 (18:44 +0100)]
Merge remote-tracking branch 'remotes/awilliam/tags/vfio-updates-20181015.0' into staging

VFIO updates 2018-10-15

 - ramfb support for vfio-pci via new -nohotplug device variant
   (Gerd Hoffmann)

 - Preparation for generic DT pass-through in vfio-platform
   (Geert Uytterhoeven & Eric Auger)

 - vfio-pci QOM fixups (Li Qiang)

# gpg: Signature made Mon 15 Oct 2018 18:26:29 BST
# gpg:                using RSA key 239B9B6E3BB08B22
# gpg: Good signature from "Alex Williamson <alex.williamson@redhat.com>"
# gpg:                 aka "Alex Williamson <alex@shazbot.org>"
# gpg:                 aka "Alex Williamson <alwillia@redhat.com>"
# gpg:                 aka "Alex Williamson <alex.l.williamson@gmail.com>"
# Primary key fingerprint: 42F6 C04E 540B D1A9 9E7B  8A90 239B 9B6E 3BB0 8B22

* remotes/awilliam/tags/vfio-updates-20181015.0:
  vfio-pci: make vfio-pci device more QOM conventional
  hw/arm/virt: Allow dynamic vfio-platform devices again
  hw/arm/sysbus-fdt: Allow device matching with DT compatible value
  vfio/platform: Make the vfio-platform device non-abstract
  hw/vfio/display: add ramfb support
  stubs: add ramfb

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agovfio-pci: make vfio-pci device more QOM conventional
Li Qiang [Mon, 15 Oct 2018 16:52:10 +0000 (10:52 -0600)]
vfio-pci: make vfio-pci device more QOM conventional

Define a TYPE_VFIO_PCI and drop DO_UPCAST.

Signed-off-by: Li Qiang <liq3ea@gmail.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
5 years agohw/arm/virt: Allow dynamic vfio-platform devices again
Geert Uytterhoeven [Mon, 15 Oct 2018 16:52:10 +0000 (10:52 -0600)]
hw/arm/virt: Allow dynamic vfio-platform devices again

Allow the instantation of generic dynamic vfio-platform devices again,
without the need to create a new device-specific vfio type.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Eric Auger <eric.auger@redhat.com>
Tested-by: Eric Auger <eric.auger@redhat.com>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
5 years agohw/arm/sysbus-fdt: Allow device matching with DT compatible value
Eric Auger [Mon, 15 Oct 2018 16:52:09 +0000 (10:52 -0600)]
hw/arm/sysbus-fdt: Allow device matching with DT compatible value

Up to now we have relied on the device type to identify a device tree
node creation function.  Since we would like the vfio-platform device to
be instantiable with different compatible strings we introduce the
capability to specialize the node creation depending on actual
compatible value.

NodeCreationPair is renamed into BindingEntry. The struct is enhanced
with compat and match_fn() fields.  We introduce a new matching function
adapted to the vfio-platform generic device.

Soon, the AMD XGBE can be instantiated with either manner, i.e.:

    -device vfio-amd-xgbe,host=e0900000.xgmac

or using the new option line:

    -device vfio-platform,host=e0900000.xgmac

Signed-off-by: Eric Auger <eric.auger@redhat.com>
[geert: Match using compatible values in sysfs instead of user-supplied
manufacturer/model options, reword]
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Eric Auger <eric.auger@redhat.com>
Tested-by: Eric Auger <eric.auger@redhat.com>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
5 years agovfio/platform: Make the vfio-platform device non-abstract
Eric Auger [Mon, 15 Oct 2018 16:52:09 +0000 (10:52 -0600)]
vfio/platform: Make the vfio-platform device non-abstract

Up to now the vfio-platform device has been abstract and could not be
instantiated.  The integration of a new vfio platform device required
creating a dummy derived device which only set the compatible string.

Following the few vfio-platform device integrations we have seen the
actual requested adaptation happens on device tree node creation
(sysbus-fdt).

Hence remove the abstract setting, and read the list of compatible
values from sysfs if not set by a derived device.

Update the amd-xgbe and calxeda-xgmac drivers to fill in the number of
compatible values, as there can now be more than one.

Note that sysbus-fdt does not support the instantiation of the
vfio-platform device yet.

Signed-off-by: Eric Auger <eric.auger@redhat.com>
[geert: Rebase, set user_creatable=true, use compatible values in sysfs
instead of user-supplied manufacturer/model options, reword]
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Eric Auger <eric.auger@redhat.com>
Tested-by: Eric Auger <eric.auger@redhat.com>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
5 years agohw/vfio/display: add ramfb support
Gerd Hoffmann [Mon, 15 Oct 2018 16:52:09 +0000 (10:52 -0600)]
hw/vfio/display: add ramfb support

So we have a boot display when using a vgpu as primary display.

ramfb depends on a fw_cfg file.  fw_cfg files can not be added and
removed at runtime, therefore a ramfb-enabled vfio device can't be
hotplugged.

Add a nohotplug variant of the vfio-pci device (as child class).  Add
the ramfb property to the nohotplug variant only.  So to enable the vgpu
display with boot support use this:

  -device vfio-pci-nohotplug,display=on,ramfb=on,sysfsdev=...

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
5 years agostubs: add ramfb
Gerd Hoffmann [Mon, 15 Oct 2018 16:52:09 +0000 (10:52 -0600)]
stubs: add ramfb

Needed to make sure code using ramfb (vfio) compiles properly even on
platforms without fw_cfg (and therefore no ramfb) support.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
5 years agoMerge remote-tracking branch 'remotes/kraxel/tags/vga-20181015-pull-request' into...
Peter Maydell [Mon, 15 Oct 2018 14:03:45 +0000 (15:03 +0100)]
Merge remote-tracking branch 'remotes/kraxel/tags/vga-20181015-pull-request' into staging

vga: config tweaks, edid updates, qxl bugfix, install new vgabios blobs.

# gpg: Signature made Mon 15 Oct 2018 10:05:03 BST
# 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/vga-20181015-pull-request:
  Makefile: Install new vgabios binaries
  hw/display/cirrus_vga: Move "isa-cirrus-vga" device into a separate file
  i2c: switch ddc to use the new edid generator
  qxl: check qxl_phys2virt return value
  bochs-display: wire up edid support
  display: add separate config option for bochs-display
  edid: fix alignment issues

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agoMakefile: Install new vgabios binaries
Alex Williamson [Fri, 12 Oct 2018 16:26:31 +0000 (10:26 -0600)]
Makefile: Install new vgabios binaries

Difficult to make use of if not installed

Fixes: cd1bfd5ef336 ("seabios: update bios and vgabios binaries")
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-id: 153936155938.28040.11513367417790075721.stgit@gimli.home
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
5 years agohw/display/cirrus_vga: Move "isa-cirrus-vga" device into a separate file
Thomas Huth [Fri, 12 Oct 2018 10:11:46 +0000 (12:11 +0200)]
hw/display/cirrus_vga: Move "isa-cirrus-vga" device into a separate file

In downstream distros like RHEL we'd like to disable some of the "legacy"
devices of QEMU. The ISA version of the Cirrus VGA device is one of these
legacy devices. So let's make the build process a little bit more flexible
here by putting the Cirrus ISA code into a separate file which is only
included if both, CONFIG_VGA_CIRRUS and CONFIG_VGA_ISA are set.

Note that this disables "isa-cirrus-vga" for the ppc-softmmu and the
alpha-softmmu target since CONFIG_VGA_ISA is not set there. But I think
this is OK since these targets are only interested in the PCI variant
anyway.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Message-id: 1539339106-32427-1-git-send-email-thuth@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
5 years agoi2c: switch ddc to use the new edid generator
Gerd Hoffmann [Fri, 5 Oct 2018 11:08:37 +0000 (13:08 +0200)]
i2c: switch ddc to use the new edid generator

This also makes the default display resolution configurable,
via xres and yres properties.  The default is 1024x768.

The old code had a hard-coded resolution of 1600x1200.

Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: BALATON Zoltan <balaton@eik.bme.hu>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Message-id: 20181005110837.28209-1-kraxel@redhat.com

5 years agoqxl: check qxl_phys2virt return value
Gerd Hoffmann [Fri, 5 Oct 2018 13:46:08 +0000 (15:46 +0200)]
qxl: check qxl_phys2virt return value

Fixes: CID 1395986
Fixes: 979f7ef8966bc4495a710ed9e4af42098f92ee79
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-id: 20181005134608.1251-1-kraxel@redhat.com

5 years agobochs-display: wire up edid support
Gerd Hoffmann [Fri, 5 Oct 2018 16:01:47 +0000 (18:01 +0200)]
bochs-display: wire up edid support

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Message-id: 20181005160147.892-3-kraxel@redhat.com

5 years agodisplay: add separate config option for bochs-display
Gerd Hoffmann [Fri, 5 Oct 2018 16:01:46 +0000 (18:01 +0200)]
display: add separate config option for bochs-display

This allows modern architectures which don't care about vga
compatibility (risc-v for example) build bochs-display without
including all vga emulation too.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-id: 20181005160147.892-2-kraxel@redhat.com

5 years agoedid: fix alignment issues
Gerd Hoffmann [Mon, 15 Oct 2018 05:53:33 +0000 (07:53 +0200)]
edid: fix alignment issues

Use stl_le_p() & friends instead of casts.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-id: 20181015055333.32030-1-kraxel@redhat.com

5 years agoMerge remote-tracking branch 'remotes/kraxel/tags/ui2-20181012-pull-request' into...
Peter Maydell [Fri, 12 Oct 2018 16:24:23 +0000 (17:24 +0100)]
Merge remote-tracking branch 'remotes/kraxel/tags/ui2-20181012-pull-request' into staging

ui: drop gtk2 support.

# gpg: Signature made Fri 12 Oct 2018 15:05:25 BST
# 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/ui2-20181012-pull-request:
  ui: increase min required GTK3 version to 3.14.0
  ui: remove support for GTK2 in favour of GTK3

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agoMerge remote-tracking branch 'remotes/kraxel/tags/ui-20181012-pull-request' into...
Peter Maydell [Fri, 12 Oct 2018 15:45:51 +0000 (16:45 +0100)]
Merge remote-tracking branch 'remotes/kraxel/tags/ui-20181012-pull-request' into staging

ui: gtk fixes, support more formats in sdl2.

# gpg: Signature made Fri 12 Oct 2018 14:21:24 BST
# 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-20181012-pull-request:
  gtk: fix uninitialized variable
  sdl2: Support all virtio-gpu formats
  gtk: Don't vte_terminal_set_encoding() on new VTE versions

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agoui: increase min required GTK3 version to 3.14.0
Daniel P. Berrangé [Wed, 22 Aug 2018 13:15:53 +0000 (14:15 +0100)]
ui: increase min required GTK3 version to 3.14.0

Per supported platforms doc[1], the various min GTK3 on relevant distros is:

  RHEL-7.0: 3.8.8
  RHEL-7.2: 3.14.13
  RHEL-7.4: 3.22.10
  RHEL-7.5: 3.22.26
  Debian (Stretch): 3.22.11
  Debian (Jessie): 3.14.5
  OpenBSD (Ports): 3.22.30
  FreeBSD (Ports): 3.22.29
  OpenSUSE Leap 15: 3.22.30
  SLE12-SP2: Unknown
  Ubuntu (Xenial): 3.18.9
  macOS (Homebrew): 3.22.30

This suggests that a minimum GTK3 of 3.14.0 is a reasonable target,
as users are unlikely to be stuck on RHEL-7.0/7.1 still

[1] https://qemu.weilnetz.de/doc/qemu-doc.html#Supported-build-platforms

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Message-id: 20180822131554.3398-3-berrange@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
5 years agoui: remove support for GTK2 in favour of GTK3
Daniel P. Berrangé [Wed, 22 Aug 2018 13:15:52 +0000 (14:15 +0100)]
ui: remove support for GTK2 in favour of GTK3

GTK2 was deprecated in the 2.12.0 release with:

  commit b7715af2b31f47060cc5b4be930d16c13be93fa9
  Author: Daniel P. Berrange <berrange@redhat.com>
  Date:   Tue Dec 12 11:34:40 2017 +0000

    ui: deprecate use of GTK 2.x in favour of 3.x series

    The GTK 3.0 release was made in Feb, 2011:

      https://blog.gtk.org/2011/02/10/gtk-3-0-released/

    That will soon be 7 years ago, which is enough time to consider
    the 3.x series widely supported.

    Thus we deprecate the GTK 2.x support, which will allow us to
    delete it in the last release of 2018. By this time, GTK 3.x
    will be almost 8 years old.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
    Message-id: 20171212113440.16483-1-berrange@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
It is thus able to be removed in the 3.1.0 release.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Message-id: 20180822131554.3398-2-berrange@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
5 years agogtk: fix uninitialized variable
Paolo Bonzini [Wed, 3 Oct 2018 12:11:38 +0000 (14:11 +0200)]
gtk: fix uninitialized variable

zoom_to_fit is never initialized to false, Coverity complains
(not sure why GCC does not).

Fixes: e8b1386ea1719525a1a92df03377764703fe8c64
Cc: kraxel@redhat.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-id: 20181003121138.22037-1-pbonzini@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
5 years agosdl2: Support all virtio-gpu formats
Max Reitz [Mon, 8 Oct 2018 18:50:13 +0000 (20:50 +0200)]
sdl2: Support all virtio-gpu formats

There are some 2D resource formats that can be used through virtio-gpu,
but which are not supported by SDL2 when used for a scanout; these are
all alpha-channel formats and also XBGR (RGBX in non-BE pixman).

Add these formats in the switch converting pixman to SDL format
constants so a guest cannot crash the VM by triggering the
g_assert_not_reached() with an unsupported format.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Message-id: 20181008185013.19371-1-mreitz@redhat.com

[ kraxel: also update sdl2_2d_check_format() ]

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
5 years agogtk: Don't vte_terminal_set_encoding() on new VTE versions
Kevin Wolf [Thu, 11 Oct 2018 15:30:39 +0000 (17:30 +0200)]
gtk: Don't vte_terminal_set_encoding() on new VTE versions

The function vte_terminal_set_encoding() is deprecated since VTE 0.54,
so stop calling it from that version on. This fixes a build error
because of our use of warning flags [-Werror=deprecated-declarations].

Fixes: https://bugs.launchpad.net/bugs/1794939
Reported-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Message-id: 20181011153039.2324-1-kwolf@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
5 years agoMerge remote-tracking branch 'remotes/cohuck/tags/s390x-20181012' into staging
Peter Maydell [Fri, 12 Oct 2018 11:40:04 +0000 (12:40 +0100)]
Merge remote-tracking branch 'remotes/cohuck/tags/s390x-20181012' into staging

More s390x updates:
- introduce support for vfio-ap (s390 crypto devices), including a
  Linux headers update to get the new interfaces
- the usual fixing + cleanup

# gpg: Signature made Fri 12 Oct 2018 10:54:38 BST
# 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/s390x-20181012:
  hw/s390x: Include the tod-qemu also for builds with --disable-tcg
  s390: doc: detailed specifications for AP virtualization
  s390x/vfio: ap: Introduce VFIO AP device
  s390x/ap: base Adjunct Processor (AP) object model
  s390x/kvm: enable AP instruction interpretation for guest
  s390x/cpumodel: Set up CPU model for AP device support
  linux-headers: update
  target/s390x/excp_helper: Remove DPRINTF() macro

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agoMerge remote-tracking branch 'remotes/famz/tags/block-pull-request' into staging
Peter Maydell [Fri, 12 Oct 2018 10:56:43 +0000 (11:56 +0100)]
Merge remote-tracking branch 'remotes/famz/tags/block-pull-request' into staging

Block patches

One fix from Paolo on nvme:// driver.
One fix from Marc-Andre for iothread.

# gpg: Signature made Fri 12 Oct 2018 02:49:42 BST
# gpg:                using RSA key CA35624C6A9171C6
# gpg: Good signature from "Fam Zheng <famz@redhat.com>"
# Primary key fingerprint: 5003 7CB7 9706 0F76 F021  AD56 CA35 624C 6A91 71C6

* remotes/famz/tags/block-pull-request:
  nvme: correct locking around completion
  iothread: fix crash with invalid properties

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agoMerge remote-tracking branch 'remotes/dgilbert/tags/pull-migration-20181011a' into...
Peter Maydell [Fri, 12 Oct 2018 10:00:07 +0000 (11:00 +0100)]
Merge remote-tracking branch 'remotes/dgilbert/tags/pull-migration-20181011a' into staging

Migration pull 2018-10-11

With one bonus HMP fix.

# gpg: Signature made Thu 11 Oct 2018 20:23:12 BST
# 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-20181011a:
  migration-test: Only generate a single target architecture
  qmp, hmp: make subsystem/system-vendor identities optional
  vhost-user: Don't ask for reply on postcopy mem table set
  vhost-user: Fix userfaultfd leak
  migration: Stop postcopy fault thread before notifying
  tests/migration: Enable the migration test on s390x, too
  tests: Add migration test for aarch64

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agohw/s390x: Include the tod-qemu also for builds with --disable-tcg
Thomas Huth [Thu, 11 Oct 2018 13:32:03 +0000 (15:32 +0200)]
hw/s390x: Include the tod-qemu also for builds with --disable-tcg

The device is required for running qtests, see hw/s390x/tod.c:

void s390_init_tod(void)
{
    Object *obj;

    if (kvm_enabled()) {
        obj = object_new(TYPE_KVM_S390_TOD);
    } else {
        obj = object_new(TYPE_QEMU_S390_TOD);
    }
    [...]
  }

During qtests, we're running without kvm, so TYPE_QEMU_S390_TOD is
required to avoid that QEMU aborts here.

Fixes: 8046f374a6 ("s390x/tod: factor out TOD into separate device")
Signed-off-by: Thomas Huth <thuth@redhat.com>
Message-Id: <1539264723-741-1-git-send-email-thuth@redhat.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
5 years agos390: doc: detailed specifications for AP virtualization
Tony Krowiak [Wed, 10 Oct 2018 17:03:08 +0000 (13:03 -0400)]
s390: doc: detailed specifications for AP virtualization

This patch provides documentation describing the AP architecture and
design concepts behind the virtualization of AP devices. It also
includes an example of how to configure AP devices for exclusive
use of KVM guests.

Signed-off-by: Tony Krowiak <akrowiak@linux.ibm.com>
Reviewed-by: Pierre Morel <pmorel@linux.ibm.com>
Tested-by: Pierre Morel <pmorel@linux.ibm.com>
Tested-by: Christian Borntraeger <borntraeger@de.ibm.com>
Message-Id: <20181010170309.12045-7-akrowiak@linux.ibm.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
5 years agos390x/vfio: ap: Introduce VFIO AP device
Tony Krowiak [Wed, 10 Oct 2018 17:03:07 +0000 (13:03 -0400)]
s390x/vfio: ap: Introduce VFIO AP device

Introduces a VFIO based AP device. The device is defined via
the QEMU command line by specifying:

    -device vfio-ap,sysfsdev=<path-to-mediated-matrix-device>

There may be only one vfio-ap device configured for a guest.

The mediated matrix device is created by the VFIO AP device
driver by writing a UUID to a sysfs attribute file (see
docs/vfio-ap.txt). The mediated matrix device will be named
after the UUID. Symbolic links to the $uuid are created in
many places, so the path to the mediated matrix device $uuid
can be specified in any of the following ways:

/sys/devices/vfio_ap/matrix/$uuid
/sys/devices/vfio_ap/matrix/mdev_supported_types/vfio_ap-passthrough/devices/$uuid
/sys/bus/mdev/devices/$uuid
/sys/bus/mdev/drivers/vfio_mdev/$uuid

When the vfio-ap device is realized, it acquires and opens the
VFIO iommu group to which the mediated matrix device is
bound. This causes a VFIO group notification event to be
signaled. The vfio_ap device driver's group notification
handler will get called at which time the device driver
will configure the the AP devices to which the guest will
be granted access.

Signed-off-by: Tony Krowiak <akrowiak@linux.ibm.com>
Tested-by: Pierre Morel <pmorel@linux.ibm.com>
Acked-by: Halil Pasic <pasic@linux.ibm.com>
Tested-by: Pierre Morel <pmorel@linux.ibm.com>
Tested-by: Christian Borntraeger <borntraeger@de.ibm.com>
Message-Id: <20181010170309.12045-6-akrowiak@linux.ibm.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
[CH: added missing g_free and device category]
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
5 years agos390x/ap: base Adjunct Processor (AP) object model
Tony Krowiak [Wed, 10 Oct 2018 17:03:06 +0000 (13:03 -0400)]
s390x/ap: base Adjunct Processor (AP) object model

Introduces the base object model for virtualizing AP devices.

Signed-off-by: Tony Krowiak <akrowiak@linux.ibm.com>
Tested-by: Pierre Morel <pmorel@linux.ibm.com>
Acked-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Halil Pasic <pasic@linux.ibm.com>
Tested-by: Christian Borntraeger <borntraeger@de.ibm.com>
Message-Id: <20181010170309.12045-5-akrowiak@linux.ibm.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
5 years agos390x/kvm: enable AP instruction interpretation for guest
Tony Krowiak [Wed, 10 Oct 2018 17:03:05 +0000 (13:03 -0400)]
s390x/kvm: enable AP instruction interpretation for guest

Let's use the KVM_SET_DEVICE_ATTR ioctl to enable hardware
interpretation of AP instructions executed on the guest.
If the S390_FEAT_AP feature is switched on for the guest,
AP instructions must be interpreted by default; otherwise,
they will be intercepted.

This attribute setting may be overridden by a device. For example,
a device may want to provide AP instructions to the guest (i.e.,
S390_FEAT_AP turned on), but it may want to emulate them. In this
case, the AP instructions executed on the guest must be
intercepted; so when the device is realized, it must disable
interpretation.

Signed-off-by: Tony Krowiak <akrowiak@linux.ibm.com>
Tested-by: Pierre Morel <pmorel@linux.ibm.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>
Acked-by: Halil Pasic <pasic@linux.ibm.com>
Tested-by: Christian Borntraeger <borntraeger@de.ibm.com>
Message-Id: <20181010170309.12045-4-akrowiak@linux.ibm.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
5 years agos390x/cpumodel: Set up CPU model for AP device support
Tony Krowiak [Wed, 10 Oct 2018 17:03:04 +0000 (13:03 -0400)]
s390x/cpumodel: Set up CPU model for AP device support

A new CPU model feature and two new CPU model facilities are
introduced to support AP devices for a KVM guest.

CPU model features:

1. The S390_FEAT_AP CPU model feature indicates whether AP
   instructions are available to the guest. This feature will
   be enabled only if the AP instructions are available on the
   linux host as determined by the availability of the
   KVM_S390_VM_CRYPTO_ENABLE_APIE VM attribute which is exposed
   by KVM only if the AP instructions are available on the
   host.

   This feature must be turned on from userspace to execute AP
   instructions on the KVM guest. The QEMU command line to turn
   this feature on looks something like this:

qemu-system-s390x ... -cpu xxx,ap=on ...

   This feature will be supported for zEC12 and newer CPU models.
   The feature will not be supported for older models because
   there are few older systems on which to test and the older
   crypto cards will be going out of service in the relatively
   near future.

CPU model facilities:

1. The S390_FEAT_AP_QUERY_CONFIG_INFO feature indicates whether the
   AP Query Configuration Information (QCI) facility is available
   to the guest as determined by whether the facility is available
   on the host. This feature will be exposed by KVM only if the
   QCI facility is installed on the host.

2. The S390_FEAT_AP_FACILITY_TEST feature indicates whether the AP
   Facility Test (APFT) facility is available to the guest as
   determined by whether the facility is available on the host.
   This feature will be exposed by KVM only if APFT is installed
   on the host.

Signed-off-by: Tony Krowiak <akrowiak@linux.ibm.com>
Tested-by: Pierre Morel <pmorel@linux.ibm.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Halil Pasic <pasic@linux.ibm.com>
Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>
Tested-by: Christian Borntraeger <borntraeger@de.ibm.com>
Message-Id: <20181010170309.12045-3-akrowiak@linux.ibm.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
5 years agolinux-headers: update
Cornelia Huck [Thu, 11 Oct 2018 09:44:05 +0000 (11:44 +0200)]
linux-headers: update

Update to kvm/next commit dd5bd0a65ff6 ("Merge tag 'kvm-s390-next-4.20-1'
of git://git.kernel.org/pub/scm/linux/kernel/git/kvms390/linux into HEAD")

Signed-off-by: Cornelia Huck <cohuck@redhat.com>
5 years agotarget/s390x/excp_helper: Remove DPRINTF() macro
Thomas Huth [Fri, 5 Oct 2018 15:00:01 +0000 (17:00 +0200)]
target/s390x/excp_helper: Remove DPRINTF() macro

Debug macros that are disabled by default should be avoided (since the
code bit-rots quite easily). Thus turn these debug prints into proper
qemu_log_mask(CPU_LOG_xxx, ...) statements instead. The DPRINTF statements
in do_[ext|io|mchk]_interrupt can even be removed completely since we can
log the information in a central place, s390_cpu_do_interrupt, instead.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Message-Id: <1538751601-7433-1-git-send-email-thuth@redhat.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
5 years agonvme: correct locking around completion
Paolo Bonzini [Tue, 14 Aug 2018 06:27:39 +0000 (08:27 +0200)]
nvme: correct locking around completion

nvme_poll_queues is already protected by q->lock, and
AIO callbacks are invoked outside the AioContext lock.
So remove the acquire/release pair in nvme_handle_event.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <20180814062739.19640-1-pbonzini@redhat.com>
Signed-off-by: Fam Zheng <famz@redhat.com>
5 years agoiothread: fix crash with invalid properties
Marc-André Lureau [Tue, 21 Aug 2018 10:07:16 +0000 (12:07 +0200)]
iothread: fix crash with invalid properties

-object iothread,id=foo,? will crash qemu:

qemu-system-x86_64:qemu-thread-posix.c:128: qemu_cond_destroy: Assertion `cond->initialized' failed.

Use thread_id != -1 to check if iothread_complete() finished
successfully and the mutex/cond have been initialized.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20180821100716.13803-1-marcandre.lureau@redhat.com>
Signed-off-by: Fam Zheng <famz@redhat.com>
5 years agomigration-test: Only generate a single target architecture
Juan Quintela [Thu, 13 Sep 2018 13:23:13 +0000 (15:23 +0200)]
migration-test: Only generate a single target architecture

Several changes:
- We only allow generate header "inside" the tree.  Why?  Because we
  need to connit the result, so it makes no sense to generate them on
  the build dir.
- We only generate a single target each time.  Getting all the
  cross-compilers correctly is an impossible task.  So know you do:
     make -C tests/migration $target (native)
     make CROSS_PREFIX=foo- -C tests/migratiion $target (cross)
  And you are done.

- If we are building out of tree, we have no data about if we are
  cross-compile or whatever.  So instead of guess what is happening,
  just do what I pointed on previous point.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Message-Id: <20180913132313.11370-1-quintela@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
5 years agoqmp, hmp: make subsystem/system-vendor identities optional
Denis V. Lunev [Tue, 2 Oct 2018 13:55:38 +0000 (16:55 +0300)]
qmp, hmp: make subsystem/system-vendor identities optional

According to PCI specification, subsystem id and subsystem vendor id
are present only in type 0 and type 2 headers (at different offsets),
but not in type 1 headers.

Thus we should make this data optional in struct PciDeviceId and skip
reporting them via HMP if the information is not available.

Additional (wrong information) about PCI bridges (Type1 devices) has been
added in 5383a705 and fortunately not released. This patch fixes that
problem. The problem was spotted by Markus.

Signed-off-by: Denis V. Lunev <den@openvz.org>
CC: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
CC: Eric Blake <eblake@redhat.com>
CC: Markus Armbruster <armbru@redhat.com>
Message-Id: <20181002135538.12113-1-den@openvz.org>
Reported-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
5 years agovhost-user: Don't ask for reply on postcopy mem table set
Ilya Maximets [Tue, 2 Oct 2018 14:09:47 +0000 (17:09 +0300)]
vhost-user: Don't ask for reply on postcopy mem table set

According to documentation, NEED_REPLY_MASK should not be set
for VHOST_USER_SET_MEM_TABLE request in postcopy mode.
This restriction was mistakenly applied to 'reply_supported'
variable, which is local and used only for non-postcopy case.

CC: Dr. David Alan Gilbert <dgilbert@redhat.com>
Fixes: 9bb38019942c ("vhost+postcopy: Send address back to qemu")
Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Message-Id: <20181002140947.4107-1-i.maximets@samsung.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
5 years agovhost-user: Fix userfaultfd leak
Ilya Maximets [Mon, 8 Oct 2018 16:05:36 +0000 (19:05 +0300)]
vhost-user: Fix userfaultfd leak

'fd' received from the vhost side is never freed.
Also, everything (including 'postcopy_listen' state) should be
cleaned up on vhost cleanup.

Fixes: 46343570c06e ("vhost+postcopy: Wire up POSTCOPY_END notify")
Fixes: f82c11165ffa ("vhost+postcopy: Register shared ufd with postcopy")
Cc: qemu-stable@nongnu.org
Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Message-Id: <20181008160536.6332-3-i.maximets@samsung.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
5 years agomigration: Stop postcopy fault thread before notifying
Ilya Maximets [Mon, 8 Oct 2018 16:05:35 +0000 (19:05 +0300)]
migration: Stop postcopy fault thread before notifying

POSTCOPY_NOTIFY_INBOUND_END handlers will remove userfault fds
from the postcopy_remote_fds array which could be still in
use by the fault thread. Let's stop the thread before
notification to avoid possible accessing wrong memory.

Fixes: 46343570c06e ("vhost+postcopy: Wire up POSTCOPY_END notify")
Cc: qemu-stable@nongnu.org
Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Message-Id: <20181008160536.6332-2-i.maximets@samsung.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
5 years agotests/migration: Enable the migration test on s390x, too
Thomas Huth [Tue, 9 Oct 2018 09:51:17 +0000 (11:51 +0200)]
tests/migration: Enable the migration test on s390x, too

We can re-use the s390-ccw bios code to implement a small firmware
for a s390x guest which prints out the "A" and "B" characters and
modifies the memory, as required for the migration test.

[quintela: Converted the compile script to Makefile rules]
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
Message-Id: <1539078677-25396-1-git-send-email-thuth@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
  Fixed up Makefile since the aarch patch sneaked in first

5 years agotests: Add migration test for aarch64
Wei Huang [Thu, 4 Oct 2018 16:08:46 +0000 (12:08 -0400)]
tests: Add migration test for aarch64

This patch adds migration test support for aarch64. The test code, which
implements the same functionality as x86, is booted as a kernel in qemu.
Here are the design choices we make for aarch64:

 * We choose this -kernel approach because aarch64 QEMU doesn't provide a
   built-in fw like x86 does. So instead of relying on a boot loader, we
   use -kernel approach for aarch64.
 * The serial output is sent to PL011 directly.
 * The physical memory base for mach-virt machine is 0x40000000. We change
   the start_address and end_address for aarch64.

In addition to providing the binary, this patch also includes the source
code and the build script in tests/migration/aarch64. So users can change
the source and/or re-compile the binary as they wish.

Reviewed-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Andrew Jones <drjones@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Wei Huang <wei@redhat.com>
Message-Id: <1538669326-28135-1-git-send-email-wei@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
5 years agoMerge remote-tracking branch 'remotes/armbru/tags/pull-misc-2018-10-10' into staging
Peter Maydell [Thu, 11 Oct 2018 09:43:37 +0000 (10:43 +0100)]
Merge remote-tracking branch 'remotes/armbru/tags/pull-misc-2018-10-10' into staging

Miscellaneous patches for 2018-10-10

# gpg: Signature made Wed 10 Oct 2018 07:03:10 BST
# gpg:                using RSA key 3870B400EB918653
# gpg: Good signature from "Markus Armbruster <armbru@redhat.com>"
# gpg:                 aka "Markus Armbruster <armbru@pond.sub.org>"
# Primary key fingerprint: 354B C8B3 D7EB 2A6B 6867  4E5F 3870 B400 EB91 8653

* remotes/armbru/tags/pull-misc-2018-10-10:
  ivshmem: Fix unplug of device "ivshmem-plain"
  libqtest: Inline g_assert_no_errno()
  tests: Restore check-qdict unit test
  qapi/misc.json: Remove superfluous words in CpuModelExpansionType
  tests/check-qjson: fix a leak

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agoivshmem: Fix unplug of device "ivshmem-plain"
Markus Armbruster [Wed, 26 Sep 2018 16:37:09 +0000 (18:37 +0200)]
ivshmem: Fix unplug of device "ivshmem-plain"

Commit 2aece63c8a "hostmem: detect host backend memory is being used
properly" fixed "ivshmem-plain" to reject memory backends that are
already in use, and to block their deletion while in use.  Two bugs
escaped review:

* New ivshmem_plain_exit() fails to call ivshmem_exit().  This breaks
  unplug.  Reproducer: migration after unplug still fails with
  "Migration is disabled when using feature 'peer mode' in device
  'ivshmem'".

* It failed to update legacy "ivshmem".  Harmless, because it creates
  the memory backend itself, and nothing else should use it.

Fix by moving the two host_memory_backend_set_mapped() calls into
ivshmem_common_realize() and ivshmem_exit(), guarded by s->hostmem.

Fixes: 2aece63c8a9d2c3a8ff41d2febc4cdeff2633331
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20180926163709.22876-1-armbru@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
5 years agolibqtest: Inline g_assert_no_errno()
Markus Armbruster [Wed, 26 Sep 2018 12:29:33 +0000 (14:29 +0200)]
libqtest: Inline g_assert_no_errno()

Macro g_assert_no_errno() intrudes into GLib's namespace.  It's also
pretty pointless.  Inline.

At one call site, its redundancy is now obvious.  Delete it there.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20180926122933.3858-1-armbru@redhat.com>
Reviewed-by: Laurent Vivier <lvivier@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
5 years agotests: Restore check-qdict unit test
Markus Armbruster [Wed, 26 Sep 2018 12:23:09 +0000 (14:23 +0200)]
tests: Restore check-qdict unit test

Commit 0bcc8e5bd8d accidentally dropped check-qdict from the list of
unit tests (again, see commit 4429532b48a).  Put it back, and fix up
the test.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20180926122309.30631-1-armbru@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
5 years agoqapi/misc.json: Remove superfluous words in CpuModelExpansionType
Kashyap Chamarthy [Wed, 3 Oct 2018 10:46:05 +0000 (12:46 +0200)]
qapi/misc.json: Remove superfluous words in CpuModelExpansionType

Remove repetition of 'independent of'.  While at it, s/QMU/QEMU in
@CpuDefinitionInfo.

Signed-off-by: Kashyap Chamarthy <kchamart@redhat.com>
Message-Id: <20181003104605.8477-1-kchamart@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
[Commit message updated as requested by Kashyap]
Signed-off-by: Markus Armbruster <armbru@redhat.com>
5 years agotests/check-qjson: fix a leak
Marc-André Lureau [Sat, 1 Sep 2018 21:19:17 +0000 (23:19 +0200)]
tests/check-qjson: fix a leak

Spotted by ASAN:
=================================================================
==11893==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 1120 byte(s) in 28 object(s) allocated from:
    #0 0x7fd0515b0c48 in malloc (/lib64/libasan.so.5+0xeec48)
    #1 0x7fd050ffa3c5 in g_malloc (/lib64/libglib-2.0.so.0+0x523c5)
    #2 0x559e708b56a4 in qstring_from_str /home/elmarco/src/qq/qobject/qstring.c:66
    #3 0x559e708b4fe0 in qstring_new /home/elmarco/src/qq/qobject/qstring.c:23
    #4 0x559e708bda7d in parse_string /home/elmarco/src/qq/qobject/json-parser.c:143
    #5 0x559e708c1009 in parse_literal /home/elmarco/src/qq/qobject/json-parser.c:484
    #6 0x559e708c1627 in parse_value /home/elmarco/src/qq/qobject/json-parser.c:547
    #7 0x559e708c1c67 in json_parser_parse /home/elmarco/src/qq/qobject/json-parser.c:573
    #8 0x559e708bc0ff in json_message_process_token /home/elmarco/src/qq/qobject/json-streamer.c:92
    #9 0x559e708d1655 in json_lexer_feed_char /home/elmarco/src/qq/qobject/json-lexer.c:292
    #10 0x559e708d1fe1 in json_lexer_feed /home/elmarco/src/qq/qobject/json-lexer.c:339
    #11 0x559e708bc856 in json_message_parser_feed /home/elmarco/src/qq/qobject/json-streamer.c:121
    #12 0x559e708b8b4b in qobject_from_jsonv /home/elmarco/src/qq/qobject/qjson.c:69
    #13 0x559e708b8d02 in qobject_from_json /home/elmarco/src/qq/qobject/qjson.c:83
    #14 0x559e708a74ae in from_json_str /home/elmarco/src/qq/tests/check-qjson.c:30
    #15 0x559e708a9f83 in utf8_string /home/elmarco/src/qq/tests/check-qjson.c:781
    #16 0x7fd05101bc49 in test_case_run gtestutils.c:2255
    #17 0x7fd05101bc49 in g_test_run_suite_internal gtestutils.c:2339

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20180901211917.10372-1-marcandre.lureau@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
5 years agos390x/tcg: always enable AFP for linux-user
David Hildenbrand [Mon, 8 Oct 2018 15:32:04 +0000 (17:32 +0200)]
s390x/tcg: always enable AFP for linux-user

linux-user should always enable AFP, otherwise our emulated binary
might crash once it tries to make use of additional floating-point
registers or instructions.

Cc: Peter Maydell <peter.maydell@linaro.org>
Cc: Alex Bennée <alex.bennee@linaro.org>
Fixes: db0504154e ("s390x/tcg: check for AFP-register, BFP and DFP data exceptions")
Reported-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Tested-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Tested-by: Cornelia Huck <cohuck@redhat.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agoMerge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20181008' into...
Peter Maydell [Mon, 8 Oct 2018 14:01:30 +0000 (15:01 +0100)]
Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20181008' into staging

target-arm queue:
 * target/arm: fix error in a code comment
 * virt: Suppress external aborts on virt-2.10 and earlier
 * target/arm: Correct condition for v8M callee stack push
 * target/arm: Don't read r4 from v8M exception stackframe twice
 * target/arm: Support SVE in system emulation mode
 * target/arm: Implement v8M hardware stack limit checking
 * hw/display/bcm2835_fb: Silence Coverity warning about multiply overflow

# gpg: Signature made Mon 08 Oct 2018 14:58:53 BST
# 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-20181008: (33 commits)
  hw/display/bcm2835_fb: Silence Coverity warning about multiply overflow
  target/arm: Add v8M stack checks for MSR to SP_NS
  target/arm: Add v8M stack checks for VLDM/VSTM
  target/arm: Add v8M stack checks for Thumb push/pop
  target/arm: Add v8M stack checks for T32 load/store single
  target/arm: Add v8M stack checks for Thumb2 LDM/STM
  target/arm: Add v8M stack checks for LDRD/STRD (imm)
  target/arm: Add v8M stack limit checks on NS function calls
  target/arm: Add v8M stack checks on exception entry
  target/arm: Add some comments in Thumb decode
  target/arm: Add v8M stack checks on ADD/SUB/MOV of SP
  target/arm: Move v7m_using_psp() to internals.h
  target/arm: Define new EXCP type for v8M stack overflows
  target/arm: Define new TBFLAG for v8M stack checking
  target/arm: Pass TCGMemOpIdx to sve memory helpers
  target/arm: Rewrite vector gather first-fault loads
  target/arm: Rewrite vector gather stores
  target/arm: Rewrite vector gather loads
  target/arm: Split contiguous stores for endianness
  target/arm: Split contiguous loads for endianness
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agohw/display/bcm2835_fb: Silence Coverity warning about multiply overflow
Peter Maydell [Mon, 8 Oct 2018 13:55:05 +0000 (14:55 +0100)]
hw/display/bcm2835_fb: Silence Coverity warning about multiply overflow

Coverity complains (CID 1395628) that the multiply in the calculation
of the framebuffer base is performed as 32x32 but then used in a
context that takes a 64-bit hwaddr. This can't actually ever
overflow the 32-bit result, because of the constraints placed on
the s->config values in bcm2835_fb_validate_config(). But we
can placate Coverity anyway, by explicitly casting one of the
inputs to a hwaddr, so the whole expression is calculated with
64-bit arithmetic.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Message-id: 20181005133012.26490-1-peter.maydell@linaro.org

5 years agotarget/arm: Add v8M stack checks for MSR to SP_NS
Peter Maydell [Mon, 8 Oct 2018 13:55:05 +0000 (14:55 +0100)]
target/arm: Add v8M stack checks for MSR to SP_NS

Updating the NS stack pointer via MSR to SP_NS should include
a check whether the new SP value is below the stack limit.
No other kinds of update to the various stack pointer and
limit registers via MSR should perform a check.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20181002163556.10279-14-peter.maydell@linaro.org

5 years agotarget/arm: Add v8M stack checks for VLDM/VSTM
Peter Maydell [Mon, 8 Oct 2018 13:55:05 +0000 (14:55 +0100)]
target/arm: Add v8M stack checks for VLDM/VSTM

Add the v8M stack checks for the VLDM/VSTM
(aka VPUSH/VPOP) instructions. This code is currently
unreachable because we haven't yet implemented M profile
floating point support, but since the change is simple,
we add it now because otherwise we're likely to forget to
do it later.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20181002163556.10279-13-peter.maydell@linaro.org

5 years agotarget/arm: Add v8M stack checks for Thumb push/pop
Peter Maydell [Mon, 8 Oct 2018 13:55:05 +0000 (14:55 +0100)]
target/arm: Add v8M stack checks for Thumb push/pop

Add v8M stack checks for the 16-bit Thumb push/pop
encodings: STMDB, STMFD, LDM, LDMIA, LDMFD.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20181002163556.10279-12-peter.maydell@linaro.org

5 years agotarget/arm: Add v8M stack checks for T32 load/store single
Peter Maydell [Mon, 8 Oct 2018 13:55:04 +0000 (14:55 +0100)]
target/arm: Add v8M stack checks for T32 load/store single

Add v8M stack checks for the instructions in the T32
"load/store single" encoding class: these are the
"immediate pre-indexed" and "immediate, post-indexed"
LDR and STR instructions.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20181002163556.10279-11-peter.maydell@linaro.org

5 years agotarget/arm: Add v8M stack checks for Thumb2 LDM/STM
Peter Maydell [Mon, 8 Oct 2018 13:55:04 +0000 (14:55 +0100)]
target/arm: Add v8M stack checks for Thumb2 LDM/STM

Add the v8M stack checks for:
 * LDM (T2 encoding)
 * STM (T2 encoding)

This includes the 32-bit encodings of the instructions listed
in v8M ARM ARM rule R_YVWT as
 * LDM, LDMIA, LDMFD
 * LDMDB, LDMEA
 * POP (multiple registers)
 * PUSH (muliple registers)
 * STM, STMIA, STMEA
 * STMDB, STMFD

We perform the stack limit before doing any other part
of the load or store.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20181002163556.10279-10-peter.maydell@linaro.org

5 years agotarget/arm: Add v8M stack checks for LDRD/STRD (imm)
Peter Maydell [Mon, 8 Oct 2018 13:55:04 +0000 (14:55 +0100)]
target/arm: Add v8M stack checks for LDRD/STRD (imm)

Add the v8M stack checks for:
 * LDRD (immediate)
 * STRD (immediate)

Loads and stores are more complicated than ADD/SUB/MOV, because we
must ensure that memory accesses below the stack limit are not
performed, so we can't simply do the check when we actually update
SP.

For these instructions, if the stack limit check triggers
we must not:
 * perform any memory access below the SP limit
 * update PC, SP or the load/store base register
but it is IMPDEF whether we:
 * perform any accesses above or equal to the SP limit
 * update destination registers for loads

For QEMU we choose to always check the limit before doing any other
part of the load or store, so we won't update any registers or
perform any memory accesses.

It is UNKNOWN whether the limit check triggers for a load or store
where the initial SP value is below the limit and one of the stores
would be below the limit, but the writeback moves SP to above the
limit.  For QEMU we choose to trigger the check in this situation.

Note that limit checks happen only for loads and stores which update
SP via writeback; they do not happen for loads and stores which
simply use SP as a base register.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20181002163556.10279-9-peter.maydell@linaro.org

5 years agotarget/arm: Add v8M stack limit checks on NS function calls
Peter Maydell [Mon, 8 Oct 2018 13:55:04 +0000 (14:55 +0100)]
target/arm: Add v8M stack limit checks on NS function calls

Check the v8M stack limits when pushing the frame for a
non-secure function call via BLXNS.

In order to be able to generate the exception we need to
promote raise_exception() from being local to op_helper.c
so we can call it from helper.c.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20181002163556.10279-8-peter.maydell@linaro.org

5 years agotarget/arm: Add v8M stack checks on exception entry
Peter Maydell [Mon, 8 Oct 2018 13:55:04 +0000 (14:55 +0100)]
target/arm: Add v8M stack checks on exception entry

Add checks for breaches of the v8M stack limit when the
stack pointer is decremented to push the exception frame
for exception entry.

Note that the exception-entry case is unique in that the
stack pointer is updated to be the limit value if the limit
is hit (per rule R_ZLZG).

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20181002163556.10279-7-peter.maydell@linaro.org

5 years agotarget/arm: Add some comments in Thumb decode
Peter Maydell [Mon, 8 Oct 2018 13:55:04 +0000 (14:55 +0100)]
target/arm: Add some comments in Thumb decode

Add some comments to the Thumb decoder indicating what bits
of the instruction have been decoded at various points in
the code.

This is not an exhaustive set of comments; we're gradually
adding comments as we work with particular bits of the code.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20181002163556.10279-6-peter.maydell@linaro.org

5 years agotarget/arm: Add v8M stack checks on ADD/SUB/MOV of SP
Peter Maydell [Mon, 8 Oct 2018 13:55:04 +0000 (14:55 +0100)]
target/arm: Add v8M stack checks on ADD/SUB/MOV of SP

Add code to insert calls to a helper function to do the stack
limit checking when we handle these forms of instruction
that write to SP:
 * ADD (SP plus immediate)
 * ADD (SP plus register)
 * SUB (SP minus immediate)
 * SUB (SP minus register)
 * MOV (register)

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20181002163556.10279-5-peter.maydell@linaro.org

5 years agotarget/arm: Move v7m_using_psp() to internals.h
Peter Maydell [Mon, 8 Oct 2018 13:55:04 +0000 (14:55 +0100)]
target/arm: Move v7m_using_psp() to internals.h

We're going to want v7m_using_psp() in op_helper.c in the
next patch, so move it from helper.c to internals.h.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20181002163556.10279-4-peter.maydell@linaro.org

5 years agotarget/arm: Define new EXCP type for v8M stack overflows
Peter Maydell [Mon, 8 Oct 2018 13:55:04 +0000 (14:55 +0100)]
target/arm: Define new EXCP type for v8M stack overflows

Define EXCP_STKOF, and arrange for it to cause us to take
a UsageFault with CFSR.STKOF set.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20181002163556.10279-3-peter.maydell@linaro.org

5 years agotarget/arm: Define new TBFLAG for v8M stack checking
Peter Maydell [Mon, 8 Oct 2018 13:55:04 +0000 (14:55 +0100)]
target/arm: Define new TBFLAG for v8M stack checking

The Arm v8M architecture includes hardware stack limit checking.
When certain instructions update the stack pointer, if the new
value of SP is below the limit set in the associated limit register
then an exception is taken. Add a TB flag that tracks whether
the limit-checking code needs to be emitted.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-id: 20181002163556.10279-2-peter.maydell@linaro.org

5 years agotarget/arm: Pass TCGMemOpIdx to sve memory helpers
Richard Henderson [Mon, 8 Oct 2018 13:55:03 +0000 (14:55 +0100)]
target/arm: Pass TCGMemOpIdx to sve memory helpers

There is quite a lot of code required to compute cpu_mem_index,
or even put together the full TCGMemOpIdx.  This can easily be
done at translation time.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Tested-by: Laurent Desnogues <laurent.desnogues@gmail.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20181005175350.30752-16-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agotarget/arm: Rewrite vector gather first-fault loads
Richard Henderson [Mon, 8 Oct 2018 13:55:03 +0000 (14:55 +0100)]
target/arm: Rewrite vector gather first-fault loads

This implements the feature for softmmu, and moves the
main loop out of a macro and into a function.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Tested-by: Laurent Desnogues <laurent.desnogues@gmail.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20181005175350.30752-15-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agotarget/arm: Rewrite vector gather stores
Richard Henderson [Mon, 8 Oct 2018 13:55:03 +0000 (14:55 +0100)]
target/arm: Rewrite vector gather stores

This fixes the endianness problem for softmmu, and moves
the main loop out of a macro and into an inlined function.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Tested-by: Laurent Desnogues <laurent.desnogues@gmail.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20181005175350.30752-14-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agotarget/arm: Rewrite vector gather loads
Richard Henderson [Mon, 8 Oct 2018 13:55:03 +0000 (14:55 +0100)]
target/arm: Rewrite vector gather loads

This fixes the endianness problem for softmmu, and moves
the main loop out of a macro and into an inlined function.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Tested-by: Laurent Desnogues <laurent.desnogues@gmail.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20181005175350.30752-13-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agotarget/arm: Split contiguous stores for endianness
Richard Henderson [Mon, 8 Oct 2018 13:55:03 +0000 (14:55 +0100)]
target/arm: Split contiguous stores for endianness

We can choose the endianness at translation time, rather than
re-computing it at execution time.

Tested-by: Laurent Desnogues <laurent.desnogues@gmail.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20181005175350.30752-12-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agotarget/arm: Split contiguous loads for endianness
Richard Henderson [Mon, 8 Oct 2018 13:55:03 +0000 (14:55 +0100)]
target/arm: Split contiguous loads for endianness

We can choose the endianness at translation time, rather than
re-computing it at execution time.

Tested-by: Laurent Desnogues <laurent.desnogues@gmail.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20181005175350.30752-11-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agotarget/arm: Rewrite helper_sve_st[1234]*_r
Richard Henderson [Mon, 8 Oct 2018 13:55:03 +0000 (14:55 +0100)]
target/arm: Rewrite helper_sve_st[1234]*_r

This fixes the endianness problem for softmmu, and moves the
main loop out of a macro and into an inlined function.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Tested-by: Laurent Desnogues <laurent.desnogues@gmail.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20181005175350.30752-10-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agotarget/arm: Rewrite helper_sve_ld[234]*_r
Richard Henderson [Mon, 8 Oct 2018 13:55:03 +0000 (14:55 +0100)]
target/arm: Rewrite helper_sve_ld[234]*_r

Use the same *_tlb primitives as we use for ld1.

For linux-user, this hoists the set of helper_retaddr.  For softmmu,
hoists the computation of the current mmu_idx outside the loop,
fixes the endianness problem, and moves the main loop out of a
macro and into an inlined function.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Tested-by: Laurent Desnogues <laurent.desnogues@gmail.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20181005175350.30752-9-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agotarget/arm: Rewrite helper_sve_ld1*_r using pages
Richard Henderson [Mon, 8 Oct 2018 13:55:03 +0000 (14:55 +0100)]
target/arm: Rewrite helper_sve_ld1*_r using pages

Uses tlb_vaddr_to_host for correct operation with softmmu.
Optimize for accesses within a single page or pair of pages.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20181005175350.30752-8-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agotarget/arm: Clear unused predicate bits for LD1RQ
Richard Henderson [Mon, 8 Oct 2018 13:55:03 +0000 (14:55 +0100)]
target/arm: Clear unused predicate bits for LD1RQ

The 16-byte load only uses 16 predicate bits.  But while
reusing the other load infrastructure, we find other bits
that are set and trigger an assert.  To avoid this and
retain the assert, zero-extend the predicate that we pass
to the LD1 helper.

Tested-by: Laurent Desnogues <laurent.desnogues@gmail.com>
Reported-by: Laurent Desnogues <laurent.desnogues@gmail.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20181005175350.30752-7-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agotarget/arm: Adjust aarch64_cpu_dump_state for system mode SVE
Richard Henderson [Mon, 8 Oct 2018 13:55:03 +0000 (14:55 +0100)]
target/arm: Adjust aarch64_cpu_dump_state for system mode SVE

Use the existing helpers to determine if (1) the fpu is enabled,
(2) sve state is enabled, and (3) the current sve vector length.

Tested-by: Laurent Desnogues <laurent.desnogues@gmail.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20181005175350.30752-6-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agotarget/arm: Handle SVE vector length changes in system mode
Richard Henderson [Mon, 8 Oct 2018 13:55:02 +0000 (14:55 +0100)]
target/arm: Handle SVE vector length changes in system mode

SVE vector length can change when changing EL, or when writing
to one of the ZCR_ELn registers.

For correctness, our implementation requires that predicate bits
that are inaccessible are never set.  Which means noticing length
changes and zeroing the appropriate register bits.

Tested-by: Laurent Desnogues <laurent.desnogues@gmail.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20181005175350.30752-5-richard.henderson@linaro.org
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agotarget/arm: Pass in current_el to fp and sve_exception_el
Richard Henderson [Mon, 8 Oct 2018 13:55:02 +0000 (14:55 +0100)]
target/arm: Pass in current_el to fp and sve_exception_el

We are going to want to determine whether sve is enabled
for EL other than current.

Tested-by: Laurent Desnogues <laurent.desnogues@gmail.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20181005175350.30752-4-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agotarget/arm: Adjust sve_exception_el
Richard Henderson [Mon, 8 Oct 2018 13:55:02 +0000 (14:55 +0100)]
target/arm: Adjust sve_exception_el

Check for EL3 before testing CPTR_EL3.EZ.  Return 0 when the exception
should be routed via AdvSIMDFPAccessTrap.  Mirror the structure of
CheckSVEEnabled more closely.

Fixes: 5be5e8eda78
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Tested-by: Laurent Desnogues <laurent.desnogues@gmail.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20181005175350.30752-3-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agotarget/arm: Define ID_AA64ZFR0_EL1
Richard Henderson [Mon, 8 Oct 2018 13:55:02 +0000 (14:55 +0100)]
target/arm: Define ID_AA64ZFR0_EL1

Given that the only field defined for this new register may only
be 0, we don't actually need to change anything except the name.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Tested-by: Laurent Desnogues <laurent.desnogues@gmail.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20181005175350.30752-2-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agotarget/arm: Don't read r4 from v8M exception stackframe twice
Peter Maydell [Mon, 8 Oct 2018 13:55:02 +0000 (14:55 +0100)]
target/arm: Don't read r4 from v8M exception stackframe twice

A cut-and-paste error meant we were reading r4 from the v8M
callee-saves exception stack frame twice. This is harmless
since it just meant we did two memory accesses to the same
location, but it's unnecessary. Delete it.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20181002150304.2287-1-peter.maydell@linaro.org

5 years agotarget/arm: Correct condition for v8M callee stack push
Peter Maydell [Mon, 8 Oct 2018 13:55:02 +0000 (14:55 +0100)]
target/arm: Correct condition for v8M callee stack push

In v7m_exception_taken() we were incorrectly using a
"LR bit EXCRET.ES is 1" check when it should be 0
(compare the pseudocode ExceptionTaken() function).
This meant we didn't stack the callee-saved registers
when tailchaining from a NonSecure to a Secure exception.

Cc: qemu-stable@nongnu.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20181002145940.30931-1-peter.maydell@linaro.org

5 years agovirt: Suppress external aborts on virt-2.10 and earlier
Peter Maydell [Mon, 8 Oct 2018 13:55:02 +0000 (14:55 +0100)]
virt: Suppress external aborts on virt-2.10 and earlier

In commit c79c0a314c43b78 we enabled emulation of external aborts
when the guest attempts to access a physical address with no
mapped device. In commit 4672cbd7bed88dc6 we suppress this for
most legacy boards to prevent breakage of previously working
guests, but we didn't suppress it in the 'virt' board, with
the rationale "we know that guests won't try to prod devices
that we don't describe in the device tree or ACPI tables". This
is mostly true, but we've had a report of a Linux guest image
that this did break. The problem seems to be that the guest
is (incorrectly) configured with a DEBUG_UART_PHYS value that
tells it there is a uart at 0x10009000 (which is true for
vexpress but not for virt), so in early bootup the kernel
probes this bogus address.

This is a misconfigured guest, so we don't need to worry
about it too much, but we can arrange that guests that ran
on QEMU v2.10 (before c79c0a314c43b78) will still run on
the "virt-2.10" board model, by suppressing external aborts
only for that version and earlier. This seems a reasonable
compromise: "virt-2.10" is supposed to behave the same way
that "virt" did in the 2.10 release, and making it do that
provides a usable workaround for guests with bugs like this.

Cc: qemu-stable@nongnu.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 20180925144127.31965-1-peter.maydell@linaro.org
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
5 years agotarget/arm: fix code comments error
Dongjiu Geng [Mon, 8 Oct 2018 13:55:02 +0000 (14:55 +0100)]
target/arm: fix code comments error

The parameter of kvm_arm_init_cpreg_list() is ARMCPU instead of
CPUState, so correct the note to make it match the code.

Signed-off-by: Dongjiu Geng <gengdongjiu@huawei.com>
Message-id: 1538069046-5757-1-git-send-email-gengdongjiu@huawei.com
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agoMerge remote-tracking branch 'remotes/rth/tags/pull-fpu-20181005' into staging
Peter Maydell [Mon, 8 Oct 2018 11:44:35 +0000 (12:44 +0100)]
Merge remote-tracking branch 'remotes/rth/tags/pull-fpu-20181005' into staging

Testing infrastructure for softfpu (not run by default).
Drop countLeadingZeros.
Fix div_floats.
Add udiv_qrnnd specializations for x86_64, s390x, ppc64 hosts.

# gpg: Signature made Fri 05 Oct 2018 19:00:09 BST
# gpg:                using RSA key 64DF38E8AF7E215F
# gpg: Good signature from "Richard Henderson <richard.henderson@linaro.org>"
# Primary key fingerprint: 7A48 1E78 868B 4DB6 A85A  05C0 64DF 38E8 AF7E 215F

* remotes/rth/tags/pull-fpu-20181005:
  softfloat: Specialize udiv_qrnnd for ppc64
  softfloat: Specialize udiv_qrnnd for s390x
  softfloat: Specialize udiv_qrnnd for x86_64
  softfloat: Fix division
  softfloat: Replace countLeadingZeros32/64 with clz32/64
  tests/fp/fp-test: add floating point tests
  gitmodules: add berkeley's softfloat + testfloat version 3
  softfloat: remove float64_trunc_to_int

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agoMerge remote-tracking branch 'remotes/thibault/tags/samuel-thibault' into staging
Peter Maydell [Mon, 8 Oct 2018 10:20:17 +0000 (11:20 +0100)]
Merge remote-tracking branch 'remotes/thibault/tags/samuel-thibault' into staging

slirp updates

Andrew Oates (1):
  slirp: fix ICMP handling on macOS hosts

Gavin Grant (1):
  slirp: Propagate host TCP RST packet to the guest after socket
    disconnected

Peter Maydell (1):
  slirp: document mbuf pointers and sizes

# gpg: Signature made Sun 07 Oct 2018 19:04:13 BST
# gpg:                using RSA key E3F65A9E9560DB4C
# gpg: Good signature from "Samuel Thibault <samuel.thibault@aquilenet.fr>"
# gpg:                 aka "Samuel Thibault <sthibault@debian.org>"
# gpg:                 aka "Samuel Thibault <samuel.thibault@gnu.org>"
# gpg:                 aka "Samuel Thibault <samuel.thibault@inria.fr>"
# gpg:                 aka "Samuel Thibault <samuel.thibault@labri.fr>"
# gpg:                 aka "Samuel Thibault <samuel.thibault@ens-lyon.org>"
# gpg:                 aka "Samuel Thibault <samuel.thibault@u-bordeaux.fr>"
# 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: 900C B024 B679 31D4 0F82  304B D017 8C76 7D06 9EE6
#      Subkey fingerprint: 33FA 7B64 6195 01F8 CE9C  8F97 E3F6 5A9E 9560 DB4C

* remotes/thibault/tags/samuel-thibault:
  slirp: Propagate host TCP RST packet to the guest after socket disconnected
  slirp: fix ICMP handling on macOS hosts
  slirp: document mbuf pointers and sizes

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agoMerge remote-tracking branch 'remotes/elmarco/tags/option-pull-request' into staging
Peter Maydell [Mon, 8 Oct 2018 09:04:15 +0000 (10:04 +0100)]
Merge remote-tracking branch 'remotes/elmarco/tags/option-pull-request' into staging

CLI help improvements

PULLv2:
 - fix uninitialized "seentype" variable in qom-test

# gpg: Signature made Fri 05 Oct 2018 13:28:21 BST
# gpg:                using RSA key DAE8E10975969CE5
# gpg: Good signature from "Marc-André Lureau <marcandre.lureau@redhat.com>"
# gpg:                 aka "Marc-André Lureau <marcandre.lureau@gmail.com>"
# Primary key fingerprint: 87A9 BD93 3F87 C606 D276  F62D DAE8 E109 7596 9CE5

* remotes/elmarco/tags/option-pull-request:
  vl: list user creatable properties when 'help' is argument
  hostmem: add some properties description
  vl: handle -object help
  tests/qom-proplist: check class properties iterator
  tests/qom-proplist: check properties are not listed multiple times
  tests/qom-proplist: check duplicate "bv" property registration failed
  qom/object: register 'type' property as class property
  qom/object: fix iterating properties over a class
  qemu-option: improve qemu_opts_print_help() output
  qemu-option: add help fallback to print the list of options
  cutils: add qemu_pstrcmp0()
  qdev-monitor: print help to stdout

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agoslirp: Propagate host TCP RST packet to the guest after socket disconnected
Gavin Grant [Thu, 30 Aug 2018 15:57:57 +0000 (16:57 +0100)]
slirp: Propagate host TCP RST packet to the guest after socket disconnected

Commit 27d92ebc5ed1bb0b518d0ebc4c609182ad20a799 handled the case where the TCP
connection is abruptly closed via a RST packet, by checking for the ECONNRESET
errno. However it does not consider the case where the connection has been
half-closed by the host (FIN/ACK), then the host socket is disconnected. For
example, if the host application calls close() on the socket, then the
application exits.

In this case, the socket still exists due to the file descriptor in SLIRP, but
it is disconnected. recv() does not indicate an error since an orderly socket
close has previously occurred. The socket will then be stuck in FIN_WAIT_2,
until the peer sends FIN/ACK or a timeout occurs. Instead we can send a RST
to the peer and transition to the CLOSED state.

Signed-off-by: Gavin Grant <gavingrant@protonmail.com>
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
5 years agoslirp: fix ICMP handling on macOS hosts
Andrew Oates [Thu, 16 Aug 2018 00:18:45 +0000 (20:18 -0400)]
slirp: fix ICMP handling on macOS hosts

On Linux, SOCK_DGRAM+IPPROTO_ICMP sockets give only the ICMP packet when
read from.  On macOS, however, the socket acts like a SOCK_RAW socket
and includes the IP header as well.

This change strips the extra IP header from the received packet on macOS
before sending it to the guest.  SOCK_DGRAM ICMP sockets aren't
supported on other BSDs, but we enable this behavior for them as well to
treat the sockets the same as raw sockets.

Signed-off-by: Andrew Oates <aoates@google.com>
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
5 years agoslirp: document mbuf pointers and sizes
Peter Maydell [Thu, 9 Aug 2018 21:52:59 +0000 (23:52 +0200)]
slirp: document mbuf pointers and sizes

and fix confusing datasize name into gapsize in m_inc.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
5 years agosoftfloat: Specialize udiv_qrnnd for ppc64
Richard Henderson [Wed, 3 Oct 2018 17:10:17 +0000 (17:10 +0000)]
softfloat: Specialize udiv_qrnnd for ppc64

The ISA has a 128/64-bit division instruction, though it assumes the
low 64-bits of the numerator are 0, and so requires a bit more fixup
than a full 128-bit division insn.

Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
5 years agosoftfloat: Specialize udiv_qrnnd for s390x
Richard Henderson [Wed, 3 Oct 2018 16:34:25 +0000 (11:34 -0500)]
softfloat: Specialize udiv_qrnnd for s390x

The ISA has a 128/64-bit division instruction.

Reviewed-by: David Hildenbrand <david@redhat.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
5 years agosoftfloat: Specialize udiv_qrnnd for x86_64
Richard Henderson [Wed, 3 Oct 2018 16:32:09 +0000 (11:32 -0500)]
softfloat: Specialize udiv_qrnnd for x86_64

The ISA has a 128/64-bit division instruction.

Tested-by: Emilio G. Cota <cota@braap.org>
Tested-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>