OSDN Git Service

qmiga/qemu.git
5 years agotarget/i386: Clear RF on SYSCALL instruction
Rudolf Marek [Fri, 19 Oct 2018 12:24:49 +0000 (14:24 +0200)]
target/i386: Clear RF on SYSCALL instruction

Fix the SYSCALL instruction in 64-bit (long mode). The RF flag
should be cleared in R11 as well as in the RFLAGS. Intel
and AMD CPUs behave same. AMD has this documented in the
APM vol 3.

Signed-off-by: Roman Kapl <rka@sysgo.com>
Signed-off-by: Rudolf Marek <rudolf.marek@sysgo.com>
Message-Id: <20181019122449.26387-1-rka@sysgo.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
5 years agoMAINTAINERS: remove or downgrade myself to reviewer from some subsystems
Paolo Bonzini [Fri, 19 Oct 2018 12:25:42 +0000 (14:25 +0200)]
MAINTAINERS: remove or downgrade myself to reviewer from some subsystems

Other people are doing a much better work than myself at handling some
subsystems.  For those files it is better if I downgrade myself to
reviewer or recognize that I am not actually doing any work there.

Cc: Daniel P. Berrange <berrange@redhat.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Eric Blake <eblake@redhat.com>
Cc: Thomas Huth <thuth@redhat.com>
Cc: Laurent Vivier <lvivier@redhat.com>
Cc: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
5 years agoivshmem: fix memory backend leak
Igor Mammedov [Thu, 1 Nov 2018 10:44:46 +0000 (11:44 +0100)]
ivshmem: fix memory backend leak

object_new() returns a new backend with refcount == 1 and
then later object_property_add_child() increases refcount to 2
So when ivshmem is destroyed, the backend it has created isn't
destroyed along with it as children cleanup will bring
backend's refcount only to 1, which leaks backend including
resources it is using.

Drop the original reference from object_new() once backend
is attached to its parent.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <1541069086-167036-1-git-send-email-imammedo@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Fixes: 5503e285041979dd29698ecb41729b3b22622e8d
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
5 years agoi386: clarify that the Q35 machine type implements a P35 chipset
Daniel P. Berrangé [Thu, 30 Aug 2018 10:57:57 +0000 (11:57 +0100)]
i386: clarify that the Q35 machine type implements a P35 chipset

The 'q35' machine type implements an Intel Series 3 chipset,
of which there are several variants:

  https://www.intel.com/Assets/PDF/datasheet/316966.pdf

The key difference between the 82P35 MCH ('p35', PCI device ID 0x29c0)
and 82Q35 GMCH ('q35', PCI device ID 0x29b0) variants is that the latter
has an integrated graphics adapter. QEMU does not implement integrated
graphics, so uses the PCI ID for the 82P35 chipset, despite calling the
machine type 'q35'. Thus we rename the PCI device ID constant to reflect
reality, to avoid confusing future developers. The new name more closely
matches what pci.ids reports it to be:

$ grep  P35 /usr/share/hwdata/pci.ids  | grep 29
29c0  82G33/G31/P35/P31 Express DRAM Controller
29c1  82G33/G31/P35/P31 Express PCI Express Root Port
29c4  82G33/G31/P35/P31 Express MEI Controller
29c5  82G33/G31/P35/P31 Express MEI Controller
29c6  82G33/G31/P35/P31 Express PT IDER Controller
29c7  82G33/G31/P35/P31 Express Serial KT Controller

$ grep  Q35 /usr/share/hwdata/pci.ids  | grep 29
29b0  82Q35 Express DRAM Controller
29b1  82Q35 Express PCI Express Root Port
29b2  82Q35 Express Integrated Graphics Controller
29b3  82Q35 Express Integrated Graphics Controller
29b4  82Q35 Express MEI Controller
29b5  82Q35 Express MEI Controller
29b6  82Q35 Express PT IDER Controller
29b7  82Q35 Express Serial KT Controller

Arguably the QEMU machine type should be named 'p35'. At this point in
time, however, it is not worth the churn for management applications &
documentation to worry about renaming it.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Message-Id: <20180830105757.10577-1-berrange@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
5 years agox86: hv_evmcs CPU flag support
Vitaly Kuznetsov [Mon, 22 Oct 2018 16:55:06 +0000 (18:55 +0200)]
x86: hv_evmcs CPU flag support

Adds a new CPU flag to enable the Enlightened VMCS KVM feature.
QEMU enables KVM_CAP_HYPERV_ENLIGHTENED_VMCS and gets back the
version to be advertised in lower 16 bits of CPUID.0x4000000A:EAX.

Suggested-by: Ladi Prosek <lprosek@redhat.com>
Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Message-Id: <20181022165506.30332-3-vkuznets@redhat.com>
Reviewed-by: Roman Kagan <rkagan@virtuozzo.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
5 years agoicount: fix deadlock when all cpus are sleeping
Clement Deschamps [Sun, 21 Oct 2018 14:21:03 +0000 (16:21 +0200)]
icount: fix deadlock when all cpus are sleeping

When all cpus are sleeping (e.g in WFI), to avoid a deadlock
in the main_loop, wake it up in order to start the warp timer.

Signed-off-by: Clement Deschamps <clement.deschamps@greensocs.com>
Message-Id: <20181021142103.19014-1-clement.deschamps@greensocs.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
5 years agooslib-posix: Use MAP_STACK in qemu_alloc_stack() on OpenBSD
Brad Smith [Fri, 19 Oct 2018 12:52:39 +0000 (08:52 -0400)]
oslib-posix: Use MAP_STACK in qemu_alloc_stack() on OpenBSD

Use MAP_STACK in qemu_alloc_stack() on OpenBSD.

Added to our 6.4 release.

MAP_STACK      Indicate that the mapping is used as a stack.  This
               flag must be used in combination with MAP_ANON and
               MAP_PRIVATE.

Implement MAP_STACK option for mmap().  Synchronous faults (pagefault and
syscall) confirm the stack register points at MAP_STACK memory, otherwise
SIGSEGV is delivered. sigaltstack() and pthread_attr_setstack() are modified
to create a MAP_STACK sub-region which satisfies alignment requirements.
Observe that MAP_STACK can only be set/cleared by mmap(), which zeroes the
contents of the region -- there is no mprotect() equivalent operation, so
there is no MAP_STACK-adding gadget.

Signed-off-by: Brad Smith <brad@comstyle.com>
Reviewed-by: Kamil Rytarowski <n54@gmx.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 20181019125239.GA13884@humpty.home.comstyle.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agoMerge remote-tracking branch 'remotes/cohuck/tags/s390x-20181105' into staging
Peter Maydell [Tue, 6 Nov 2018 09:10:46 +0000 (09:10 +0000)]
Merge remote-tracking branch 'remotes/cohuck/tags/s390x-20181105' into staging

- some changes in s390x maintainership
- bugfix in vfio-ap

# gpg: Signature made Mon 05 Nov 2018 16:34:03 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/s390x-20181105:
  MAINTAINERS: s390/boot: the ipl code and the bios belong together
  MAINTAINERS: s390: Remove myself
  MAINTAINERS: s390/pci: add Collin Walling as maintainer for zpci
  MAINTAINERS: s390/virtio-ccw: drop Christian, add Halil
  MAINTAINERS: s390: more maintainers for vfio-ccw
  s390x/vfio-ap: report correct error

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agoMerge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging
Peter Maydell [Mon, 5 Nov 2018 18:03:32 +0000 (18:03 +0000)]
Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging

Block layer patches:

- auto-read-only option to fix commit job when used with -blockdev
- Fix help text related qemu-iotests failure (by improving the help text
  and updating the reference output)
- quorum: Add missing checks when adding/removing child nodes
- Don't take address of fields in packed structs
- vvfat: Fix crash when reporting error about too many files in directory

# gpg: Signature made Mon 05 Nov 2018 15:35:25 GMT
# gpg:                using RSA key 7F09B272C88F2FD6
# gpg: Good signature from "Kevin Wolf <kwolf@redhat.com>"
# Primary key fingerprint: DC3D EB15 9A9A F95D 3D74  56FE 7F09 B272 C88F 2FD6

* remotes/kevin/tags/for-upstream: (36 commits)
  include: Add a comment to explain the origin of sizes' lookup table
  vdi: Use a literal number of bytes for DEFAULT_CLUSTER_SIZE
  fw_cfg: Drop newline in @file description
  object: Make option help nicer to read
  qdev-monitor: Make device options help nicer
  chardev: Indent list of chardevs
  option: Make option help nicer to read
  qemu-iotests: Test auto-read-only with -drive and -blockdev
  block: Make auto-read-only=on default for -drive
  iscsi: Support auto-read-only option
  gluster: Support auto-read-only option
  curl: Support auto-read-only option
  file-posix: Support auto-read-only option
  nbd: Support auto-read-only option
  block: Require auto-read-only for existing fallbacks
  rbd: Close image in qemu_rbd_open() error path
  block: Add auto-read-only option
  block: Update flags in bdrv_set_read_only()
  iotest: Test x-blockdev-change on a Quorum
  quorum: Forbid adding children in blkverify mode
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agoinclude: Add a comment to explain the origin of sizes' lookup table
Leonid Bloch [Sun, 4 Nov 2018 18:07:28 +0000 (18:07 +0000)]
include: Add a comment to explain the origin of sizes' lookup table

The lookup table for power-of-two sizes was added in commit 540b8492618eb
for the purpose of having convenient shortcuts for these sizes in cases
when the literal number has to be present at compile time, and
expressions as '(1 * KiB)' can not be used. One such case is the
stringification of sizes. Beyond that, it is convenient to use these
shortcuts for all power-of-two sizes, even if they don't have to be
literal numbers.

Despite its convenience, this table introduced 55 lines of "dumb" code,
the purpose and origin of which are obscure without reading the message
of the commit which introduced it. This patch fixes that by adding a
comment to the code itself with a brief explanation for the reasoning
behind this table. This comment includes the short AWK script that
generated the table, so that anyone who's interested could make sure
that the values in it are correct (otherwise these values look as if
they were typed manually).

Signed-off-by: Leonid Bloch <lbloch@janustech.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
5 years agovdi: Use a literal number of bytes for DEFAULT_CLUSTER_SIZE
Leonid Bloch [Sun, 4 Nov 2018 18:09:28 +0000 (18:09 +0000)]
vdi: Use a literal number of bytes for DEFAULT_CLUSTER_SIZE

If an expression is used to define DEFAULT_CLUSTER_SIZE, when compiled,
it will be embedded as a literal expression in the binary (as the
default value) because it is stringified to mark the size of the default
value. Now this is fixed by using a defined number to define this value.

Signed-off-by: Leonid Bloch <lbloch@janustech.com>
Reviewed-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
5 years agofw_cfg: Drop newline in @file description
Max Reitz [Fri, 19 Oct 2018 16:49:29 +0000 (18:49 +0200)]
fw_cfg: Drop newline in @file description

There is no good reason why there should be a newline in this
description, so remove it.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
5 years agoobject: Make option help nicer to read
Max Reitz [Fri, 19 Oct 2018 16:49:28 +0000 (18:49 +0200)]
object: Make option help nicer to read

Just like in qemu_opts_print_help(), print the object name as a caption
instead of on every single line, indent all options, add angle brackets
around types, and align the descriptions after 24 characters.

Also, indent every object name in the list of available objects.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
5 years agoqdev-monitor: Make device options help nicer
Max Reitz [Fri, 19 Oct 2018 16:49:27 +0000 (18:49 +0200)]
qdev-monitor: Make device options help nicer

Just like in qemu_opts_print_help(), print the device name as a caption
instead of on every single line, indent all options, add angle brackets
around types, and align the descriptions after 24 characters.  Also,
separate the descriptions with " - " instead of putting them in
parentheses, because that is what we do everywhere else.  This does look
a bit funny here because basically all bits have the description
"on/off", but funny does not mean it is less readable.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
5 years agochardev: Indent list of chardevs
Max Reitz [Fri, 19 Oct 2018 16:49:26 +0000 (18:49 +0200)]
chardev: Indent list of chardevs

Following the example of qemu_opts_print_help(), indent all entries in
the list of character devices.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
5 years agooption: Make option help nicer to read
Max Reitz [Fri, 19 Oct 2018 16:49:25 +0000 (18:49 +0200)]
option: Make option help nicer to read

This adds some whitespace into the option help (including indentation)
and puts angle brackets around the type names.  Furthermore, the list
name is no longer printed as part of every line, but only once in
advance, and only if the caller did not print a caption already.

This patch also restores the description alignment we had before commit
9cbef9d68ee1d8d0, just at 24 instead of 16 characters like we used to.
This increase is because now we have the type and two spaces of
indentation before the description, and with a usual type name length of
three chracters, this sums up to eight additional characters -- which
means that we now need 24 characters to get the same amount of padding
for most options.  Also, 24 is a third of 80, which makes it kind of a
round number in terminal terms.

Finally, this patch amends the reference output of iotest 082 to match
the changes (and thus makes it pass again).

Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
5 years agoqemu-iotests: Test auto-read-only with -drive and -blockdev
Kevin Wolf [Fri, 19 Oct 2018 16:26:06 +0000 (18:26 +0200)]
qemu-iotests: Test auto-read-only with -drive and -blockdev

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
5 years agoblock: Make auto-read-only=on default for -drive
Kevin Wolf [Wed, 17 Oct 2018 16:24:30 +0000 (18:24 +0200)]
block: Make auto-read-only=on default for -drive

While we want machine interfaces like -blockdev and QMP blockdev-add to
add as little auto-detection as possible so that management tools are
explicit about their needs, -drive is a convenience option for human
users. Enabling auto-read-only=on by default there enables users to use
read-only images for read-only guest devices without having to specify
read-only=on explicitly. If they try to attach the image to a read-write
device, they will still get an error message.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
5 years agoiscsi: Support auto-read-only option
Kevin Wolf [Mon, 8 Oct 2018 15:27:18 +0000 (17:27 +0200)]
iscsi: Support auto-read-only option

If read-only=off, but auto-read-only=on is given, open the volume
read-write if we have the permissions, but instead of erroring out for
read-only volumes, just degrade to read-only.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
5 years agogluster: Support auto-read-only option
Kevin Wolf [Mon, 8 Oct 2018 15:27:18 +0000 (17:27 +0200)]
gluster: Support auto-read-only option

If read-only=off, but auto-read-only=on is given, open the file
read-write if we have the permissions, but instead of erroring out for
read-only files, just degrade to read-only.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Niels de Vos <ndevos@redhat.com>
5 years agocurl: Support auto-read-only option
Kevin Wolf [Mon, 8 Oct 2018 15:27:18 +0000 (17:27 +0200)]
curl: Support auto-read-only option

If read-only=off, but auto-read-only=on is given, just degrade to
read-only.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
5 years agofile-posix: Support auto-read-only option
Kevin Wolf [Mon, 8 Oct 2018 15:27:18 +0000 (17:27 +0200)]
file-posix: Support auto-read-only option

If read-only=off, but auto-read-only=on is given, open the file
read-write if we have the permissions, but instead of erroring out for
read-only files, just degrade to read-only.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
5 years agonbd: Support auto-read-only option
Kevin Wolf [Mon, 8 Oct 2018 15:27:18 +0000 (17:27 +0200)]
nbd: Support auto-read-only option

If read-only=off, but auto-read-only=on is given, open a read-write NBD
connection if the server provides a read-write export, but instead of
erroring out for read-only exports, just degrade to read-only.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
5 years agoblock: Require auto-read-only for existing fallbacks
Kevin Wolf [Fri, 12 Oct 2018 09:27:41 +0000 (11:27 +0200)]
block: Require auto-read-only for existing fallbacks

Some block drivers have traditionally changed their node to read-only
mode without asking the user. This behaviour has been marked deprecated
since 2.11, expecting users to provide an explicit read-only=on option.

Now that we have auto-read-only=on, enable these drivers to make use of
the option.

This is the only use of bdrv_set_read_only(), so we can make it a bit
more specific and turn it into a bdrv_apply_auto_read_only() that is
more convenient for drivers to use.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
5 years agorbd: Close image in qemu_rbd_open() error path
Kevin Wolf [Thu, 18 Oct 2018 13:17:26 +0000 (15:17 +0200)]
rbd: Close image in qemu_rbd_open() error path

Commit e2b8247a322 introduced an error path in qemu_rbd_open() after
calling rbd_open(), but neglected to close the image again in this error
path. The error path should contain everything that the regular close
function qemu_rbd_close() contains.

This adds the missing rbd_close() call.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
5 years agoblock: Add auto-read-only option
Kevin Wolf [Fri, 5 Oct 2018 16:57:40 +0000 (18:57 +0200)]
block: Add auto-read-only option

If a management application builds the block graph node by node, the
protocol layer doesn't inherit its read-only option from the format
layer any more, so it must be set explicitly.

Backing files should work on read-only storage, but at the same time, a
block job like commit should be able to reopen them read-write if they
are on read-write storage. However, without option inheritance, reopen
only changes the read-only option for the root node (typically the
format layer), but not the protocol layer, so reopening fails (the
format layer wants to get write permissions, but the protocol layer is
still read-only).

A simple workaround for the problem in the management tool would be to
open the protocol layer always read-write and to make only the format
layer read-only for backing files. However, sometimes the file is
actually stored on read-only storage and we don't know whether the image
can be opened read-write (for example, for NBD it depends on the server
we're trying to connect to). This adds an option that makes QEMU try to
open the image read-write, but allows it to degrade to a read-only mode
without returning an error.

The documentation for this option is consciously phrased in a way that
allows QEMU to switch to a better model eventually: Instead of trying
when the image is first opened, making the read-only flag dynamic and
changing it automatically whenever the first BLK_PERM_WRITE user is
attached or the last one is detached would be much more useful
behaviour.

Unfortunately, this more useful behaviour is also a lot harder to
implement, and libvirt needs a solution now before it can switch to
-blockdev, so let's start with this easier approach for now.

Instead of adding a new auto-read-only option, turning the existing
read-only into an enum (with a bool alternate for compatibility) was
considered, but it complicated the implementation to the point that it
didn't seem to be worth it.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
5 years agoblock: Update flags in bdrv_set_read_only()
Kevin Wolf [Tue, 9 Oct 2018 14:57:12 +0000 (16:57 +0200)]
block: Update flags in bdrv_set_read_only()

To fully change the read-only state of a node, we must not only change
bs->read_only, but also update bs->open_flags.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Alberto Garcia <berto@igalia.com>
5 years agoiotest: Test x-blockdev-change on a Quorum
Alberto Garcia [Thu, 18 Oct 2018 08:59:04 +0000 (11:59 +0300)]
iotest: Test x-blockdev-change on a Quorum

This patch tests that you can add and remove drives from a Quorum
using the x-blockdev-change command.

Signed-off-by: Alberto Garcia <berto@igalia.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
5 years agoquorum: Forbid adding children in blkverify mode
Alberto Garcia [Thu, 18 Oct 2018 08:59:03 +0000 (11:59 +0300)]
quorum: Forbid adding children in blkverify mode

The blkverify mode of Quorum only works when the number of children is
exactly two, so any attempt to add a new one must return an error.

quorum_del_child() on the other hand doesn't need any additional check
because decreasing the number of children would make it go under the
vote threshold.

Signed-off-by: Alberto Garcia <berto@igalia.com>
Reported-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
5 years agoiotest: Test the blkverify mode of the Quorum driver
Alberto Garcia [Wed, 17 Oct 2018 14:33:51 +0000 (17:33 +0300)]
iotest: Test the blkverify mode of the Quorum driver

Signed-off-by: Alberto Garcia <berto@igalia.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
5 years agoquorum: Return an error if the blkverify mode has invalid settings
Alberto Garcia [Wed, 17 Oct 2018 14:33:50 +0000 (17:33 +0300)]
quorum: Return an error if the blkverify mode has invalid settings

The blkverify mode of Quorum can only be enabled if the number of
children is exactly two and the value of vote-threshold is also two.

If the user tries to enable it but the other settings are incorrect
then QEMU simply prints an error message to stderr and carries on
disabling the blkverify setting.

This patch makes quorum_open() fail and return an error in this case.

Signed-off-by: Alberto Garcia <berto@igalia.com>
Reported-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
5 years agoquorum: Remove quorum_err()
Alberto Garcia [Wed, 17 Oct 2018 14:33:49 +0000 (17:33 +0300)]
quorum: Remove quorum_err()

This is a static function with only one caller, so there's no need to
keep it. Inlining the code in quorum_compare() makes it much simpler.

Signed-off-by: Alberto Garcia <berto@igalia.com>
Reported-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
5 years agoblock/vdi: Don't take address of fields in packed structs
Peter Maydell [Tue, 16 Oct 2018 17:25:03 +0000 (18:25 +0100)]
block/vdi: Don't take address of fields in packed structs

Taking the address of a field in a packed struct is a bad idea, because
it might not be actually aligned enough for that pointer type (and
thus cause a crash on dereference on some host architectures). Newer
versions of clang warn about this. Avoid the bug by not using the
"modify in place" byte swapping functions.

There are a few places where the in-place swap function is
used on something other than a packed struct field; we convert
those anyway, for consistency.

Patch produced with scripts/coccinelle/inplace-byteswaps.cocci.

There are other places where we take the address of a packed member
in this file for other purposes than passing it to a byteswap
function (all the calls to qemu_uuid_*()); we leave those for now.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
5 years agoblock/vhdx: Don't take address of fields in packed structs
Peter Maydell [Tue, 16 Oct 2018 17:09:38 +0000 (18:09 +0100)]
block/vhdx: Don't take address of fields in packed structs

Taking the address of a field in a packed struct is a bad idea, because
it might not be actually aligned enough for that pointer type (and
thus cause a crash on dereference on some host architectures). Newer
versions of clang warn about this. Avoid the bug by not using the
"modify in place" byte swapping functions.

There are a few places where the in-place swap function is
used on something other than a packed struct field; we convert
those anyway, for consistency.

Patch produced with scripts/coccinelle/inplace-byteswaps.cocci.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
5 years agovpc: Don't leak opts in vpc_open()
Kevin Wolf [Wed, 17 Oct 2018 13:33:14 +0000 (15:33 +0200)]
vpc: Don't leak opts in vpc_open()

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Alberto Garcia <berto@igalia.com>
5 years agoiotests: make 083 specific to raw
Cleber Rosa [Mon, 15 Oct 2018 20:03:19 +0000 (16:03 -0400)]
iotests: make 083 specific to raw

While testing the Python 3 changes which touch the 083 test, I noticed
that it would fail with qcow2.  Expanding the testing, I noticed it
had nothing to do with the Python 3 changes, and in fact, it would not
pass on anything but raw:

 raw: pass
 bochs: not generic
 cloop: not generic
 parallels: fail
 qcow: fail
 qcow2: fail
 qed: fail
 vdi: fail
 vhdx: fail
 vmdk: fail
 vpc: fail
 luks: fail

The errors are a mixture I/O and "image not in xxx format", such as:

  === Check disconnect before data ===

  Unexpected end-of-file before all bytes were read
 -read failed: Input/output error
 +can't open device nbd+tcp://127.0.0.1:PORT/foo: Could not open 'nbd://127.0.0.1:PORT/foo': Input/output error

  === Check disconnect after data ===

 -read 512/512 bytes at offset 0
 -512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 +can't open device nbd+tcp://127.0.0.1:PORT/foo: Image not in qcow format

I'm not aware if there's a quick fix, so, for the time being, it looks
like the honest approach is to make the test known to work on raw
only.

Signed-off-by: Cleber Rosa <crosa@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
5 years agoblock: change some function return type to bool
Li Qiang [Sat, 13 Oct 2018 08:52:31 +0000 (01:52 -0700)]
block: change some function return type to bool

Signed-off-by: Li Qiang <liq3ea@163.com>
Reviewed-by: Alberto Garcia <berto@igalia.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
5 years agoqcow2: Get the request alignment for encrypted images from QCryptoBlock
Alberto Garcia [Thu, 11 Oct 2018 10:58:02 +0000 (13:58 +0300)]
qcow2: Get the request alignment for encrypted images from QCryptoBlock

This doesn't have any practical effect at the moment because the
values of BDRV_SECTOR_SIZE, QCRYPTO_BLOCK_LUKS_SECTOR_SIZE and
QCRYPTO_BLOCK_QCOW_SECTOR_SIZE are all the same (512 bytes), but
future encryption methods could have different requirements.

Signed-off-by: Alberto Garcia <berto@igalia.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
5 years agocrypto: initialize sector size even when opening with no IO flag
Daniel P. Berrangé [Tue, 16 Oct 2018 10:31:05 +0000 (11:31 +0100)]
crypto: initialize sector size even when opening with no IO flag

The qcow2 block driver expects to see a valid sector size even when it
has opened the crypto layer with QCRYPTO_BLOCK_OPEN_NO_IO.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Alberto Garcia <berto@igalia.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
5 years agoblock/qcow2-bitmap: Don't take address of fields in packed structs
Peter Maydell [Tue, 9 Oct 2018 17:25:01 +0000 (18:25 +0100)]
block/qcow2-bitmap: Don't take address of fields in packed structs

Taking the address of a field in a packed struct is a bad idea, because
it might not be actually aligned enough for that pointer type (and
thus cause a crash on dereference on some host architectures). Newer
versions of clang warn about this. Avoid the bug by not using the
"modify in place" byte swapping functions.

There are a few places where the in-place swap function is
used on something other than a packed struct field; we convert
those anyway, for consistency.

This patch was produced with the following spatch script:

@@
expression E;
@@
-be16_to_cpus(&E);
+E = be16_to_cpu(E);
@@
expression E;
@@
-be32_to_cpus(&E);
+E = be32_to_cpu(E);
@@
expression E;
@@
-be64_to_cpus(&E);
+E = be64_to_cpu(E);
@@
expression E;
@@
-cpu_to_be16s(&E);
+E = cpu_to_be16(E);
@@
expression E;
@@
-cpu_to_be32s(&E);
+E = cpu_to_be32(E);
@@
expression E;
@@
-cpu_to_be64s(&E);
+E = cpu_to_be64(E);

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Tested-by: John Snow <jsnow@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
5 years agoblock/qcow: Don't take address of fields in packed structs
Peter Maydell [Tue, 9 Oct 2018 17:25:00 +0000 (18:25 +0100)]
block/qcow: Don't take address of fields in packed structs

Taking the address of a field in a packed struct is a bad idea, because
it might not be actually aligned enough for that pointer type (and
thus cause a crash on dereference on some host architectures). Newer
versions of clang warn about this. Avoid the bug by not using the
"modify in place" byte swapping functions.

There are a few places where the in-place swap function is
used on something other than a packed struct field; we convert
those anyway, for consistency.

This patch was produced with the following spatch script:

@@
expression E;
@@
-be16_to_cpus(&E);
+E = be16_to_cpu(E);
@@
expression E;
@@
-be32_to_cpus(&E);
+E = be32_to_cpu(E);
@@
expression E;
@@
-be64_to_cpus(&E);
+E = be64_to_cpu(E);
@@
expression E;
@@
-cpu_to_be16s(&E);
+E = cpu_to_be16(E);
@@
expression E;
@@
-cpu_to_be32s(&E);
+E = cpu_to_be32(E);
@@
expression E;
@@
-cpu_to_be64s(&E);
+E = cpu_to_be64(E);

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Tested-by: John Snow <jsnow@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
5 years agoblock/qcow2: Don't take address of fields in packed structs
Peter Maydell [Tue, 9 Oct 2018 17:24:59 +0000 (18:24 +0100)]
block/qcow2: Don't take address of fields in packed structs

Taking the address of a field in a packed struct is a bad idea, because
it might not be actually aligned enough for that pointer type (and
thus cause a crash on dereference on some host architectures). Newer
versions of clang warn about this. Avoid the bug by not using the
"modify in place" byte swapping functions.

There are a few places where the in-place swap function is
used on something other than a packed struct field; we convert
those anyway, for consistency.

This patch was produced with the following spatch script
(and hand-editing to fold a few resulting overlength lines):

@@
expression E;
@@
-be16_to_cpus(&E);
+E = be16_to_cpu(E);
@@
expression E;
@@
-be32_to_cpus(&E);
+E = be32_to_cpu(E);
@@
expression E;
@@
-be64_to_cpus(&E);
+E = be64_to_cpu(E);
@@
expression E;
@@
-cpu_to_be16s(&E);
+E = cpu_to_be16(E);
@@
expression E;
@@
-cpu_to_be32s(&E);
+E = cpu_to_be32(E);
@@
expression E;
@@
-cpu_to_be64s(&E);
+E = cpu_to_be64(E);

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Tested-by: John Snow <jsnow@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
5 years agoqemu-io-cmds: Fix two format strings
Stefan Weil [Sat, 6 Oct 2018 18:38:51 +0000 (20:38 +0200)]
qemu-io-cmds: Fix two format strings

Use %zu instead of %zd for unsigned numbers.

This fixes two error messages from the LSTM static code analyzer:

    This argument should be of type 'ssize_t' but is of type 'unsigned long'

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
5 years agoblock: replace "discard" literal with BDRV_OPT_DISCARD macro
Alberto Garcia [Wed, 3 Oct 2018 10:23:13 +0000 (13:23 +0300)]
block: replace "discard" literal with BDRV_OPT_DISCARD macro

Signed-off-by: Alberto Garcia <berto@igalia.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
5 years agoblock/vvfat: Fix crash when reporting error about too many files in directory
Thomas Huth [Tue, 24 Jul 2018 11:52:04 +0000 (13:52 +0200)]
block/vvfat: Fix crash when reporting error about too many files in directory

When using the vvfat driver with a directory that contains too many files,
QEMU currently crashes. This can be triggered like this for example:

 mkdir /tmp/vvfattest
 cd /tmp/vvfattest
 for ((x=0;x<=513;x++)); do mkdir $x; done
 qemu-system-x86_64 -drive \
   file.driver=vvfat,file.dir=.,read-only=on,media=cdrom

Seems like read_directory() is changing the mapping->path variable. Make
sure we use the right pointer instead.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
5 years agoMerge remote-tracking branch 'remotes/rth/tags/pull-softfloat-20181104' into staging
Peter Maydell [Mon, 5 Nov 2018 10:32:49 +0000 (10:32 +0000)]
Merge remote-tracking branch 'remotes/rth/tags/pull-softfloat-20181104' into staging

Only use divdeu insn with Power7 and later.

# gpg: Signature made Sun 04 Nov 2018 10:05:50 GMT
# 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-softfloat-20181104:
  softfloat: Don't execute divdeu without power7

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agoMAINTAINERS: s390/boot: the ipl code and the bios belong together
Christian Borntraeger [Mon, 29 Oct 2018 15:42:25 +0000 (16:42 +0100)]
MAINTAINERS: s390/boot: the ipl code and the bios belong together

The s390-ccw bios and the ipl code do work in lock-step. Let us merge
them in the maintainer file.

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Message-Id: <1540827745-20795-5-git-send-email-borntraeger@de.ibm.com>
Acked-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
5 years agoMAINTAINERS: s390: Remove myself
Alexander Graf [Tue, 30 Oct 2018 09:37:15 +0000 (10:37 +0100)]
MAINTAINERS: s390: Remove myself

I haven't realistically maintained s390 related parts for quite a while
now, so let's remove my name from the MAINTAINERS file to reflect reality.

Signed-off-by: Alexander Graf <agraf@suse.de>
Message-Id: <20181030093715.18793-1-agraf@suse.de>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
5 years agoMAINTAINERS: s390/pci: add Collin Walling as maintainer for zpci
Christian Borntraeger [Mon, 29 Oct 2018 15:42:24 +0000 (16:42 +0100)]
MAINTAINERS: s390/pci: add Collin Walling as maintainer for zpci

Collin will take over the maintainership from Yi Min. Let us add a
separate s390 pci section.

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Message-Id: <1540827745-20795-4-git-send-email-borntraeger@de.ibm.com>
Acked-by: Collin Walling <walling@linux.ibm.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
5 years agoMAINTAINERS: s390/virtio-ccw: drop Christian, add Halil
Christian Borntraeger [Mon, 29 Oct 2018 15:42:23 +0000 (16:42 +0100)]
MAINTAINERS: s390/virtio-ccw: drop Christian, add Halil

Halil does all the work anyway.

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Message-Id: <1540827745-20795-3-git-send-email-borntraeger@de.ibm.com>
Acked-by: Halil Pasic <pasic@linux.ibm.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
5 years agoMAINTAINERS: s390: more maintainers for vfio-ccw
Christian Borntraeger [Mon, 29 Oct 2018 15:42:22 +0000 (16:42 +0100)]
MAINTAINERS: s390: more maintainers for vfio-ccw

Eric and Farhan will help with maintaining vfio-ccw.

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Message-Id: <1540827745-20795-2-git-send-email-borntraeger@de.ibm.com>
Acked-by: Eric Farman <farman@linux.ibm.com>
Acked-by: Farhan Ali <alifm@linux.ibm.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
5 years agos390x/vfio-ap: report correct error
Cornelia Huck [Tue, 16 Oct 2018 11:51:54 +0000 (13:51 +0200)]
s390x/vfio-ap: report correct error

If ioctl(..., VFIO_DEVICE_RESET) fails, we want to report errno
instead of ret (which is always -1 on error).

Fixes Coverity issue CID 1396176.

Reported-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Tony Krowiak <akrowiak@linux.ibm.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
5 years agosoftfloat: Don't execute divdeu without power7
Richard Henderson [Thu, 1 Nov 2018 19:57:44 +0000 (19:57 +0000)]
softfloat: Don't execute divdeu without power7

The divdeu instruction was added to ISA 2.06 (Power7).
Exclude this block from older cpus.

Fixes: 27ae5109a2ba (softfloat: Specialize udiv_qrnnd for ppc64)
Reported-by: Laurent Vivier <laurent@vivier.eu>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
5 years agoMerge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20181102' into...
Peter Maydell [Fri, 2 Nov 2018 17:17:12 +0000 (17:17 +0000)]
Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20181102' into staging

target-arm queue:
 * microbit: Add the UART to our nRF51 SoC model
 * Add a virtual Xilinx Versal board "xlnx-versal-virt"
 * hw/arm/virt: Set VIRT_COMPAT_3_0 compat
 * MAINTAINERS: Remove bouncing email in ARM ACPI
 * strongarm: mask off high[31:28] bits from dir and state registers
 * target/arm: Conditionalize some asserts on aarch32 support
 * hw/arm/xilinx_zynq: Use the ARRAY_SIZE macro

# gpg: Signature made Fri 02 Nov 2018 17:14:43 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-20181102:
  hw/arm: versal: Add a virtual Xilinx Versal board
  hw/arm: versal: Add a model of Xilinx Versal SoC
  target/arm: Conditionalize some asserts on aarch32 support
  hw/arm/xilinx_zynq: Use the ARRAY_SIZE macro
  strongarm: mask off high[31:28] bits from dir and state registers
  MAINTAINERS: Remove bouncing email in ARM ACPI
  tests/boot-serial-test: Add microbit board testcase
  hw/arm/nrf51_soc: Connect UART to nRF51 SoC
  hw/char: Implement nRF51 SoC UART
  hw/arm/virt: Set VIRT_COMPAT_3_0 compat

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agohw/arm: versal: Add a virtual Xilinx Versal board
Edgar E. Iglesias [Fri, 2 Nov 2018 13:19:13 +0000 (14:19 +0100)]
hw/arm: versal: Add a virtual Xilinx Versal board

Add a virtual Xilinx Versal board.

This board is based on the Xilinx Versal SoC. The exact
details of what peripherals are attached to this board
will remain in control of QEMU. QEMU will generate an
FDT on the fly for Linux and other software to auto-discover
peripherals.

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Message-id: 20181102131913.1535-3-edgar.iglesias@xilinx.com
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agohw/arm: versal: Add a model of Xilinx Versal SoC
Edgar E. Iglesias [Fri, 2 Nov 2018 13:19:12 +0000 (14:19 +0100)]
hw/arm: versal: Add a model of Xilinx Versal SoC

Add a model of Xilinx Versal SoC.

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Message-id: 20181102131913.1535-2-edgar.iglesias@xilinx.com
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agotarget/arm: Conditionalize some asserts on aarch32 support
Richard Henderson [Fri, 2 Nov 2018 10:20:25 +0000 (10:20 +0000)]
target/arm: Conditionalize some asserts on aarch32 support

When populating id registers from kvm, on a host that doesn't support
aarch32 mode at all, neither arm_div nor jazelle will be supported either.

Signed-off-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>
Message-id: 20181102102025.3546-1-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/xilinx_zynq: Use the ARRAY_SIZE macro
Philippe Mathieu-Daudé [Tue, 30 Oct 2018 15:23:56 +0000 (15:23 +0000)]
hw/arm/xilinx_zynq: Use the ARRAY_SIZE macro

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agostrongarm: mask off high[31:28] bits from dir and state registers
Prasad J Pandit [Tue, 30 Oct 2018 15:23:56 +0000 (15:23 +0000)]
strongarm: mask off high[31:28] bits from dir and state registers

The high[31:28] bits of 'direction' and 'state' registers of
SA-1100/SA-1110 device are reserved. Setting them may lead to
OOB 's->handler[]' array access issue. Mask off [31:28] bits to
avoid it.

Reported-by: Moguofang <moguofang@huawei.com>
Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
Message-id: 20181030114635.31232-1-ppandit@redhat.com
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agoMAINTAINERS: Remove bouncing email in ARM ACPI
Philippe Mathieu-Daudé [Tue, 30 Oct 2018 15:23:56 +0000 (15:23 +0000)]
MAINTAINERS: Remove bouncing email in ARM ACPI

Shannon Zhao's email at Huawei is bouncing: remove it.

    X-Failed-Recipients: zhaoshenglong@huawei.com
    ** Address not found **
    Your message wasn't delivered to zhaoshenglong@huawei.com because the address couldn't be found, or is unable to receive mail.

Note that the section still contains his personal email (see e59f13d76bb).

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Acked-by: Shannon Zhao <shannon.zhaosl@gmail.com>
Message-id: 20181029195931.8747-1-philmd@redhat.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agotests/boot-serial-test: Add microbit board testcase
Julia Suvorova [Tue, 30 Oct 2018 15:23:56 +0000 (15:23 +0000)]
tests/boot-serial-test: Add microbit board testcase

New mini-kernel test for nRF51 SoC UART.

Signed-off-by: Julia Suvorova <jusual@mail.ru>
Acked-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agohw/arm/nrf51_soc: Connect UART to nRF51 SoC
Julia Suvorova [Tue, 30 Oct 2018 15:23:56 +0000 (15:23 +0000)]
hw/arm/nrf51_soc: Connect UART to nRF51 SoC

Wire up nRF51 UART in the corresponding SoC.

Signed-off-by: Julia Suvorova <jusual@mail.ru>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agohw/char: Implement nRF51 SoC UART
Julia Suvorova [Tue, 30 Oct 2018 15:23:56 +0000 (15:23 +0000)]
hw/char: Implement nRF51 SoC UART

Not implemented: CTS/NCTS, PSEL*.

Signed-off-by: Julia Suvorova <jusual@mail.ru>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agohw/arm/virt: Set VIRT_COMPAT_3_0 compat
Eric Auger [Tue, 30 Oct 2018 15:23:56 +0000 (15:23 +0000)]
hw/arm/virt: Set VIRT_COMPAT_3_0 compat

We are missing the VIRT_COMPAT_3_0 definition and setting.
Let's add them.

Signed-off-by: Eric Auger <eric.auger@redhat.com>
Reviewed-by: Andrew Jones <drjones@redhat.com>
Message-id: 20181024085602.16611-1-eric.auger@redhat.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agoMerge remote-tracking branch 'remotes/riscv/tags/riscv-for-master-3.1-sf1' into staging
Peter Maydell [Fri, 2 Nov 2018 13:16:13 +0000 (13:16 +0000)]
Merge remote-tracking branch 'remotes/riscv/tags/riscv-for-master-3.1-sf1' into staging

RISC-V Patches for the 3.1 Soft Freeze, Part 2

This tag contains a few simple patches that I'd like to target for the
QEMU soft freeze.  There's only one code change: a fix to our PMP
implementation that avoids an internal truncation while computing a
partial PMP read.

I also have two updates to the MAINTAINERS file: one to add Alistair as
a RISC-V maintainer, and one to add our newly created mailing list.

# gpg: Signature made Tue 30 Oct 2018 18:17:17 GMT
# gpg:                using RSA key EF4CA1502CCBAB41
# gpg: Good signature from "Palmer Dabbelt <palmer@dabbelt.com>"
# gpg:                 aka "Palmer Dabbelt <palmer@sifive.com>"
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: 00CE 76D1 8349 60DF CE88  6DF8 EF4C A150 2CCB AB41

* remotes/riscv/tags/riscv-for-master-3.1-sf1:
  Add qemu-riscv@nongnu.org as the RISC-V list
  Add Alistair as a RISC-V Maintainer
  target/riscv/pmp.c: pmpcfg_csr_read returns bogus value on RV64

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agoMerge remote-tracking branch 'remotes/vivier/tags/m68k-for-3.1-pull-request' into...
Peter Maydell [Fri, 2 Nov 2018 11:27:46 +0000 (11:27 +0000)]
Merge remote-tracking branch 'remotes/vivier/tags/m68k-for-3.1-pull-request' into staging

Fix illegal instruction exception number

# gpg: Signature made Thu 01 Nov 2018 11:34:49 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/vivier/tags/m68k-for-3.1-pull-request:
  target/m68k: use EXCP_ILLEGAL instead of EXCP_UNSUPPORTED

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agoMerge remote-tracking branch 'remotes/elmarco/tags/chrdev-pull-request' into staging
Peter Maydell [Fri, 2 Nov 2018 10:53:00 +0000 (10:53 +0000)]
Merge remote-tracking branch 'remotes/elmarco/tags/chrdev-pull-request' into staging

- add websocket support
- socket: make 'fd' incompatible with 'reconnect'
- fix a websocket leak
- unrelated editorconfig patch that missed -trivial (included for
  convenience)
- v2: fix commit author field

# gpg: Signature made Thu 01 Nov 2018 08:23:39 GMT
# 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/chrdev-pull-request:
  editorconfig: set emacs mode
  tests/test-char: Check websocket chardev functionality
  chardev: Add websocket support
  chardev/char-socket: Function headers refactoring
  char-socket: make 'fd' incompatible with 'reconnect'
  char-socket: correctly set has_reconnect when parsing QemuOpts
  websock: fix handshake leak

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agoMerge remote-tracking branch 'remotes/dgilbert/tags/pull-migration-20181031a' into...
Peter Maydell [Fri, 2 Nov 2018 09:49:35 +0000 (09:49 +0000)]
Merge remote-tracking branch 'remotes/dgilbert/tags/pull-migration-20181031a' into staging

Minor migration fixes 2018-10-31

# gpg: Signature made Wed 31 Oct 2018 16:55:40 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-20181031a:
  migration: avoid segmentfault when take a snapshot of a VM which being migrated
  qapi: Fix COLOStatus and query-colo-status since version
  COLO: Fix Colo doc secondeary should be secondary

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agoMerge remote-tracking branch 'remotes/rth/tags/pull-dt-20181031' into staging
Peter Maydell [Thu, 1 Nov 2018 18:28:29 +0000 (18:28 +0000)]
Merge remote-tracking branch 'remotes/rth/tags/pull-dt-20181031' into staging

Updates to decodetree.py for risc-v.

# gpg: Signature made Wed 31 Oct 2018 16:52:07 GMT
# 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-dt-20181031:
  decodetree: Allow multiple input files
  decodetree: Remove "insn" argument from trans_* expanders
  decodetree: Add !extern flag to argument sets

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agoMerge remote-tracking branch 'remotes/mdroth/tags/qga-pull-2018-10-30-v3-tag' into...
Peter Maydell [Thu, 1 Nov 2018 17:26:16 +0000 (17:26 +0000)]
Merge remote-tracking branch 'remotes/mdroth/tags/qga-pull-2018-10-30-v3-tag' into staging

qemu-ga patch queue for soft-freeze

* support for --retry-path option for recovering from communication
  path failures
* support for serial/device name in guest-get-fsinfo for linux/w32
* support for freezing individual mount points in guest-fsfreeze-*
* fixes for unicode paths on w32, not-present vcpus in guest-get-vcpus,
  buffer overflow in guest-get-fsinfo for w32, and other minor fixes

v3:
* remove redundant check for --static in configure
* correct authorship on "qga-win: add debugging information"

v2:
* set libudev=off in configure for static builds

# gpg: Signature made Wed 31 Oct 2018 14:13:58 GMT
# gpg:                using RSA key 3353C9CEF108B584
# gpg: Good signature from "Michael Roth <flukshun@gmail.com>"
# gpg:                 aka "Michael Roth <mdroth@utexas.edu>"
# gpg:                 aka "Michael Roth <mdroth@linux.vnet.ibm.com>"
# Primary key fingerprint: CEAC C9E1 5534 EBAB B82D  3FA0 3353 C9CE F108 B584

* remotes/mdroth/tags/qga-pull-2018-10-30-v3-tag: (24 commits)
  qga-win: changing --retry-path option behavior
  qga-win: report specific error when failing to open channel
  qga-win: install service with --retry-path set by default
  qga: add --retry-path option for re-initializing channel on failure
  qga: move w32 service handling out of run_agent()
  qga: hang GAConfig/socket_activation off of GAState global
  qga: group agent init/cleanup init separate routines
  qga: fix an off-by-one issue
  qga-win: demystify namespace stripping
  qga-win: return disk device in guest-get-fsinfo
  qga-win: handle multi-disk volumes
  qga-win: refactor disk info
  qga-win: report disk serial number
  qga-win: refactor disk properties (bus)
  qga-win: add debugging information
  build: rename CONFIG_QGA_NTDDDISK to CONFIG_QGA_NTDDSCSI
  qga-win: fsinfo: pci-info: allow partial info
  qga-win: prevent crash when executing fsinfo command
  qga: linux: return disk device in guest-get-fsinfo
  qga: linux: report disk serial number
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agoMerge remote-tracking branch 'remotes/ehabkost/tags/x86-next-pull-request' into staging
Peter Maydell [Thu, 1 Nov 2018 16:32:54 +0000 (16:32 +0000)]
Merge remote-tracking branch 'remotes/ehabkost/tags/x86-next-pull-request' into staging

x86 queue, 2018-10-30

* MSR-based feature support for
  MSR_IA32_ARCH_CAPABILITIES bits (Robert Hoo)
* Cascadelake-Server CPU model (Tao Xu)
* Add PKU on Skylake-Server CPU model (Tao Xu)
* Correct cpu_x86_cpuid(0xd) (Sebastian Andrzej Siewior)
* Remove dead code (Peter Maydell)

# gpg: Signature made Wed 31 Oct 2018 14:05:25 GMT
# gpg:                using RSA key 2807936F984DC5A6
# gpg: Good signature from "Eduardo Habkost <ehabkost@redhat.com>"
# Primary key fingerprint: 5A32 2FD5 ABC4 D3DB ACCF  D1AA 2807 936F 984D C5A6

* remotes/ehabkost/tags/x86-next-pull-request:
  i386: Add PKU on Skylake-Server CPU model
  i386: Add new model of Cascadelake-Server
  x86: define a new MSR based feature word -- FEATURE_WORDS_ARCH_CAPABILITIES
  x86: Data structure changes to support MSR based features
  kvm: Add support to KVM_GET_MSR_FEATURE_INDEX_LIST and KVM_GET_MSRS system ioctl
  target/i386: Remove #ifdeffed-out icebp debugging hack
  i386: correct cpu_x86_cpuid(0xd)

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agoMerge remote-tracking branch 'remotes/rth/tags/pull-tcg-20181031' into staging
Peter Maydell [Thu, 1 Nov 2018 15:04:36 +0000 (15:04 +0000)]
Merge remote-tracking branch 'remotes/rth/tags/pull-tcg-20181031' into staging

Track mmu_idx for which the TLB is clean and need not be flushed again.

# gpg: Signature made Wed 31 Oct 2018 12:19:31 GMT
# 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-tcg-20181031:
  cputlb: Remove tlb_c.pending_flushes
  cputlb: Filter flushes on already clean tlbs
  cputlb: Count "partial" and "elided" tlb flushes
  cputlb: Merge tlb_flush_page into tlb_flush_page_by_mmuidx
  cputlb: Merge tlb_flush_nocheck into tlb_flush_by_mmuidx_async_work
  cputlb: Move env->vtlb_index to env->tlb_d.vindex
  cputlb: Split large page tracking per mmu_idx
  cputlb: Move cpu->pending_tlb_flush to env->tlb_c.pending_flush
  cputlb: Remove tcg_enabled hack from tlb_flush_nocheck
  cputlb: Move tlb_lock to CPUTLBCommon

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agoMerge remote-tracking branch 'remotes/berrange/tags/misc-next-pull-request' into...
Peter Maydell [Thu, 1 Nov 2018 14:38:50 +0000 (14:38 +0000)]
Merge remote-tracking branch 'remotes/berrange/tags/misc-next-pull-request' into staging

Merge misc fixes

# gpg: Signature made Wed 31 Oct 2018 11:36:12 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/misc-next-pull-request:
  scripts: report on author emails that are mangled by the mailing list
  block: drop moderated sheepdog mailing list from MAINTAINERS file

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agoMerge remote-tracking branch 'remotes/ehabkost/tags/python-next-pull-request' into...
Peter Maydell [Thu, 1 Nov 2018 13:24:51 +0000 (13:24 +0000)]
Merge remote-tracking branch 'remotes/ehabkost/tags/python-next-pull-request' into staging

Python queue, 2018-10-30

* Makefile rule for running acceptance tests
  (make check-acceptance) (Cleber Rosa)
* Make iotests compatible with Python 3
  (Max Reitz)
* device-crash-test whitelist update (Thomas Huth)
* Misc cleanups (Cleber Rosa)

# gpg: Signature made Wed 31 Oct 2018 00:28:39 GMT
# gpg:                using RSA key 2807936F984DC5A6
# gpg: Good signature from "Eduardo Habkost <ehabkost@redhat.com>"
# Primary key fingerprint: 5A32 2FD5 ABC4 D3DB ACCF  D1AA 2807 936F 984D C5A6

* remotes/ehabkost/tags/python-next-pull-request:
  scripts/qemu.py: use a more consistent docstring style
  scripts/decodetree.py: fix reference to attributes
  Travis support for the acceptance tests
  Acceptance tests: add make rule for running them
  Bootstrap Python venv for tests
  iotests: Unify log outputs between Python 2 and 3
  iotests: Modify imports for Python 3
  iotests: 'new' module replacement in 169
  iotests: Explicitly bequeath FDs in Python
  iotests: Different iterator behavior in Python 3
  iotests: Use // for Python integer division
  iotests: Use Python byte strings where appropriate
  iotests: Flush in iotests.py's QemuIoInteractive
  iotests: Make nbd-fault-injector flush
  scripts/device-crash-test: Remove devices that are not user_creatable anymore

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agoMerge remote-tracking branch 'remotes/stefanberger/tags/pull-tpm-2018-10-29-2' into...
Peter Maydell [Thu, 1 Nov 2018 12:08:10 +0000 (12:08 +0000)]
Merge remote-tracking branch 'remotes/stefanberger/tags/pull-tpm-2018-10-29-2' into staging

Merge tpm 2018/10/29 v2

# gpg: Signature made Tue 30 Oct 2018 21:40:24 GMT
# gpg:                using RSA key 75AD65802A0B4211
# gpg: Good signature from "Stefan Berger <stefanb@linux.vnet.ibm.com>"
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: B818 B9CA DF90 89C2 D5CE  C66B 75AD 6580 2A0B 4211

* remotes/stefanberger/tags/pull-tpm-2018-10-29-2:
  tpm: Zero-init structure to avoid uninitialized variables in valgrind log
  MAINTAINERS: Change my email address to the new domain
  docs: tpm: Mention implemented TPM CRB interface emulation and specs
  tests/tpm: Display if swtpm is not found or --tpm2 not supported
  tests/tpm: fix tpm_util_swtpm_has_tpm2()

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agotarget/m68k: use EXCP_ILLEGAL instead of EXCP_UNSUPPORTED
Laurent Vivier [Tue, 30 Oct 2018 16:55:54 +0000 (17:55 +0100)]
target/m68k: use EXCP_ILLEGAL instead of EXCP_UNSUPPORTED

Coldfire defines an "Unsupported instruction" exception if execution
of a valid instruction is attempted but the required hardware is not
present in the processor.

We use it with instructions that are in fact undefined or illegal,
and the exception expected in this case by the kernel is the
illegal exception, so this patch fixes that.

Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20181030165554.5761-1-laurent@vivier.eu>

5 years agoeditorconfig: set emacs mode
Marc-André Lureau [Tue, 21 Aug 2018 10:35:28 +0000 (12:35 +0200)]
editorconfig: set emacs mode

Some time ago, I proposed to use an (eval) in .dir-locals.el to set
the mode for all json files and Makefile. Unfortunately, this isn't
safe, and emacs will prompt the user, which isn't very friendly.

Fortunately, editorconfig provides a special config key which does
allow to set the emacs mode. Add a few missing entries and set the
emacs mode.

Update top comment to provide a short summary about the file and the
IDE plugins while at it.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Acked-by: Markus Armbruster <armbru@redhat.com>
5 years agotests/test-char: Check websocket chardev functionality
Julia Suvorova [Thu, 18 Oct 2018 22:35:01 +0000 (01:35 +0300)]
tests/test-char: Check websocket chardev functionality

Test order:
    Creating server websocket chardev
    Creating usual tcp chardev client
    Sending handshake message from client
    Receiving handshake reply
    Sending ping frame with "hello" payload
    Receiving pong reply
    Sending binary data "world"
    Checking the received data on server side
    Checking of closing handshake

Signed-off-by: Julia Suvorova <jusual@mail.ru>
Message-Id: <20181018223501.21683-4-jusual@mail.ru>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
5 years agochardev: Add websocket support
Julia Suvorova [Thu, 18 Oct 2018 22:35:00 +0000 (01:35 +0300)]
chardev: Add websocket support

New option "websocket" added to allow using WebSocket protocol for
chardev socket backend.
Example:
    -chardev socket,websocket,server,id=...

Signed-off-by: Julia Suvorova <jusual@mail.ru>
Message-Id: <20181018223501.21683-3-jusual@mail.ru>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
5 years agochardev/char-socket: Function headers refactoring
Julia Suvorova [Thu, 18 Oct 2018 22:34:59 +0000 (01:34 +0300)]
chardev/char-socket: Function headers refactoring

Upcoming websocket support requires additional parameters in function
headers that are already overloaded. This patch replaces the bunch of
parameters with a single structure pointer.

Signed-off-by: Julia Suvorova <jusual@mail.ru>
Message-Id: <20181018223501.21683-2-jusual@mail.ru>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
5 years agochar-socket: make 'fd' incompatible with 'reconnect'
Marc-André Lureau [Tue, 17 Jul 2018 12:31:45 +0000 (14:31 +0200)]
char-socket: make 'fd' incompatible with 'reconnect'

A chardev socket created with the 'fd=' argument is not going to
handle reconnection properly by recycling the same fd (or not in a
supported way). Let's forbid this case.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agochar-socket: correctly set has_reconnect when parsing QemuOpts
Marc-André Lureau [Tue, 17 Jul 2018 12:43:51 +0000 (14:43 +0200)]
char-socket: correctly set has_reconnect when parsing QemuOpts

qemu_chr_parse_socket() fills all ChardevSocket fields, but that
doesn't reflect correctly the arguments given with the options / on
the command line. "reconnect" takes a number as argument, and the
default value is 0, which doesn't help to identify the missing
option. The other arguments have default values that are less
problematic, leave them set by default for now.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agowebsock: fix handshake leak
Marc-André Lureau [Fri, 19 Oct 2018 10:12:14 +0000 (14:12 +0400)]
websock: fix handshake leak

Missed in f69a8bde293.
Thanks Valgrind:

==955== 217 bytes in 1 blocks are definitely lost in loss record 275 of 321
==955==    at 0x483A965: realloc (vg_replace_malloc.c:785)
==955==    by 0x50B6839: __vasprintf_chk (in /usr/lib64/libc-2.28.so)
==955==    by 0x49AA05C: g_vasprintf (in /usr/lib64/libglib-2.0.so.0.5800.1)
==955==    by 0x4983440: g_strdup_vprintf (in /usr/lib64/libglib-2.0.so.0.5800.1)
==955==    by 0x126048: qio_channel_websock_handshake_send_res (channel-websock.c:162)
==955==    by 0x1266E6: qio_channel_websock_handshake_send_res_ok (channel-websock.c:362)
==955==    by 0x126D3E: qio_channel_websock_handshake_process (channel-websock.c:468)
==955==    by 0x126EF2: qio_channel_websock_handshake_read (channel-websock.c:511)
==955==    by 0x12715B: qio_channel_websock_handshake_io (channel-websock.c:571)
==955==    by 0x125027: qio_channel_fd_source_dispatch (channel-watch.c:84)
==955==    by 0x496326C: g_main_context_dispatch (in /usr/lib64/libglib-2.0.so.0.5800.1)
==955==    by 0x169EC3: glib_pollfds_poll (main-loop.c:215)

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
5 years agodecodetree: Allow multiple input files
Richard Henderson [Fri, 26 Oct 2018 13:59:43 +0000 (14:59 +0100)]
decodetree: Allow multiple input files

While it would be possible to concatenate input files with make,
passing the original input files to decodetree.py allows us to
generate error messages which allows compilation environments
(read: emacs) to next-error to the correct input file.

Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
5 years agodecodetree: Remove "insn" argument from trans_* expanders
Richard Henderson [Tue, 23 Oct 2018 10:05:27 +0000 (11:05 +0100)]
decodetree: Remove "insn" argument from trans_* expanders

This allows trans_* expanders to be shared between decoders
for 32 and 16-bit insns, by not tying the expander to the
size of the insn that produced it.

This change requires adjusting the two existing users to match.

Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
5 years agodecodetree: Add !extern flag to argument sets
Richard Henderson [Tue, 23 Oct 2018 09:26:25 +0000 (10:26 +0100)]
decodetree: Add !extern flag to argument sets

Allow argument sets to be shared between two decoders by avoiding
a re-declaration error.  Make sure that anonymous argument sets
and anonymous formats have unique names.

Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
5 years agoMerge remote-tracking branch 'remotes/xtensa/tags/20181030-xtensa' into staging
Peter Maydell [Wed, 31 Oct 2018 16:11:43 +0000 (16:11 +0000)]
Merge remote-tracking branch 'remotes/xtensa/tags/20181030-xtensa' into staging

target/xtensa: support for bFLT binaries

- add support for bFLT binaries for target/xtensa
- fix per-architecture target_flat.h customization
- fix initial stack pointer for bFLT

# gpg: Signature made Tue 30 Oct 2018 18:27:42 GMT
# gpg:                using RSA key 51F9CC91F83FA044
# gpg: Good signature from "Max Filippov <filippov@cadence.com>"
# gpg:                 aka "Max Filippov <max.filippov@cogentembedded.com>"
# gpg:                 aka "Max Filippov <jcmvbkbc@gmail.com>"
# Primary key fingerprint: 2B67 854B 98E5 327D CDEB  17D8 51F9 CC91 F83F A044

* remotes/xtensa/tags/20181030-xtensa:
  linux-user/flatload: fix initial stack pointer alignment
  linux-user: xtensa: enable bFLT support

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agoqga-win: changing --retry-path option behavior
Bishara AbuHattoum [Sun, 7 Oct 2018 11:02:23 +0000 (14:02 +0300)]
qga-win: changing --retry-path option behavior

Currently whenever the qemu-ga's service doesn't find the virtio-serial
the run_agent() loops in a QGA_RETRY_INTERVAL (default 5 seconds)
intervals and try to restart the qemu-ga which causes a synchronous loop.
Changed to wait and listen for the serial events by registering for
notifications a proper serial event handler that deals with events:
  DBT_DEVICEARRIVAL        indicates that the device has been inserted and
                           is available
  DBT_DEVICEREMOVECOMPLETE indicates that the devive has been removed
Which allow us to determine when the channel path is available for the
qemu-ga to restart.

Signed-off-by: Bishara AbuHattoum <bishara@daynix.com>
Signed-off-by: Sameeh Jubran <sameeh@daynix.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
5 years agoqga-win: report specific error when failing to open channel
Michael Roth [Sun, 7 Oct 2018 11:02:22 +0000 (14:02 +0300)]
qga-win: report specific error when failing to open channel

Useful in general, but especially now that errors might occur more
frequently with --retry-path set.

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
5 years agoqga-win: install service with --retry-path set by default
Michael Roth [Sun, 7 Oct 2018 11:02:21 +0000 (14:02 +0300)]
qga-win: install service with --retry-path set by default

It's nicer from a management perspective that the agent can survive
hotplug/unplug of the channel device, or be started prior to the
installation of the channel device's driver without and still be able
to resume normal function afterward. On linux there are alternatives
like systemd to support this, but on w32 --retry-path is the only
option so it makes sense to set it by default when installed as a
w32 service.

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
5 years agoqga: add --retry-path option for re-initializing channel on failure
Michael Roth [Sun, 7 Oct 2018 11:02:20 +0000 (14:02 +0300)]
qga: add --retry-path option for re-initializing channel on failure

This adds an option to instruct the agent to periodically attempt
re-opening the communication channel after a channel error has
occurred. The main use-case for this is providing an OS-independent
way of allowing the agent to survive situations like hotplug/unplug of
the communication channel, or initial guest set up where the agent may
be installed/started prior to the installation of the channel device's
driver.

There are nicer ways of implementing this functionality via things
like systemd services, but this option is useful for platforms like
*BSD/w32.

Currently a channel error will result in the GSource for that channel
being removed from the GMainLoop, but the main loop continuing to run.
That behavior results in a dead loop when --retry-path isn't set, and
prevents us from knowing when to attempt re-opening the channel when
it is set, so we also force the loop to exit as part of this patch.

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
5 years agoqga: move w32 service handling out of run_agent()
Michael Roth [Sun, 7 Oct 2018 11:02:19 +0000 (14:02 +0300)]
qga: move w32 service handling out of run_agent()

Eventually we want a w32 service to be able to restart the qga main
loop from within service_main(). To allow for this we move service
handling out of run_agent() such that service_main() calls
run_agent() instead of the reverse.

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Bishara AbuHattoum <bishara@daynix.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
5 years agoqga: hang GAConfig/socket_activation off of GAState global
Michael Roth [Sun, 7 Oct 2018 11:02:18 +0000 (14:02 +0300)]
qga: hang GAConfig/socket_activation off of GAState global

For w32 services we rely on the global GAState to access resources
associated with the agent within service_main(). Currently this is
sufficient for starting the agent since we open the channel once prior
to calling service_main(), and simply start the GMainLoop to start the
agent from within service_main().

Eventually we want to be able to also [re-]open the communication
channel from within service_main(), which requires access to
config/socket_activation variables, so we hang them off GAState in
preparation for that.

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Sameeh Jubran <sameeh@daynix.com>
*dont move GAConfig struct, just the typedef
*fix build bisect for w32
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
5 years agoqga: group agent init/cleanup init separate routines
Michael Roth [Sun, 7 Oct 2018 11:02:17 +0000 (14:02 +0300)]
qga: group agent init/cleanup init separate routines

This patch better separates the init/cleanup routines out into
separate functions to make the start-up procedure a bit easier to
follow. This will be useful when we eventually break out the actual
start/stop of the agent's main loop into separates routines that
can be called multiple times after the init phase.

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
5 years agoqga: fix an off-by-one issue
Li Qiang [Thu, 18 Oct 2018 02:10:37 +0000 (19:10 -0700)]
qga: fix an off-by-one issue

Signed-off-by: Li Qiang <liq3ea@gmail.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
5 years agoqga-win: demystify namespace stripping
Tomáš Golembiovský [Tue, 23 Oct 2018 11:23:23 +0000 (13:23 +0200)]
qga-win: demystify namespace stripping

It was not obvious what exactly the cryptic string copying does to the
GUID. This change makes the intent clearer.

Signed-off-by: Tomáš Golembiovský <tgolembi@redhat.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
5 years agoqga-win: return disk device in guest-get-fsinfo
Tomáš Golembiovský [Tue, 23 Oct 2018 11:23:22 +0000 (13:23 +0200)]
qga-win: return disk device in guest-get-fsinfo

Report device UNC of the disk. It is reported as "\\.\PhysicalDriveX".

Signed-off-by: Tomáš Golembiovský <tgolembi@redhat.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
5 years agoqga-win: handle multi-disk volumes
Tomáš Golembiovský [Tue, 23 Oct 2018 11:23:21 +0000 (13:23 +0200)]
qga-win: handle multi-disk volumes

Probe the volume for disk extents and return list of all disks.
Originally only first disk of composite volume was returned.

Note that the patch changes get_pci_info() from one state of brokenness
into a different state of brokenness. In other words it still does not do
what it's supposed to do (see comment in code). If anyone knows how to
fix it, please step in.

Signed-off-by: Tomáš Golembiovský <tgolembi@redhat.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
5 years agoqga-win: refactor disk info
Tomáš Golembiovský [Tue, 23 Oct 2018 11:23:20 +0000 (13:23 +0200)]
qga-win: refactor disk info

Refactor building of disk info into a function that builds the list and
a function that returns infor for single disk. This will be used in
future commit that will handle multi-disk volumes.

Signed-off-by: Tomáš Golembiovský <tgolembi@redhat.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
5 years agoqga-win: report disk serial number
Tomáš Golembiovský [Tue, 23 Oct 2018 11:23:19 +0000 (13:23 +0200)]
qga-win: report disk serial number

Signed-off-by: Tomáš Golembiovský <tgolembi@redhat.com>
*coding style fix-ups (declarations at beginning of block)
*improve readability for user-visible errors
*cover additional edge-cases with debug statements
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>