sdk/emulator/qemu.git
8 years agoMerge remote-tracking branch 'remotes/rth/tags/pull-tcg-20160223' into staging
Peter Maydell [Tue, 23 Feb 2016 18:49:30 +0000 (18:49 +0000)]
Merge remote-tracking branch 'remotes/rth/tags/pull-tcg-20160223' into staging

Queued TCG patches

# gpg: Signature made Tue 23 Feb 2016 18:27:44 GMT using RSA key ID 4DD0279B
# gpg: Good signature from "Richard Henderson <rth7680@gmail.com>"
# gpg:                 aka "Richard Henderson <rth@redhat.com>"
# gpg:                 aka "Richard Henderson <rth@twiddle.net>"

* remotes/rth/tags/pull-tcg-20160223:
  tcg: Remove unnecessary osdep.h includes from tcg-target.inc.c
  scripts/clean-includes: Ignore .inc.c files
  tcg: Rename tcg-target.c to tcg-target.inc.c
  target-sparc: Use global registers for the register window
  target-sparc: Tidy global register initialization
  tcg: Allocate indirect_base temporaries in a different order
  tcg: Implement indirect memory registers
  tcg: Work around clang bug wrt enum ranges, part 2

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8 years agotcg: Remove unnecessary osdep.h includes from tcg-target.inc.c
Peter Maydell [Tue, 23 Feb 2016 14:49:43 +0000 (14:49 +0000)]
tcg: Remove unnecessary osdep.h includes from tcg-target.inc.c

Commit 757e725b58c57d added a number of #include "qemu/osdep.h"
files to the tcg-target.c files (as they were named at the time).
These are unnecessary because these files are not standalone C
files, and the tcg/tcg.c file which includes them will have
already included osdep.h on their behalf. Remove the unneeded
include directives.

Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-Id: <1456238983-10160-4-git-send-email-peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <rth@twiddle.net>
8 years agoscripts/clean-includes: Ignore .inc.c files
Peter Maydell [Tue, 23 Feb 2016 14:49:42 +0000 (14:49 +0000)]
scripts/clean-includes: Ignore .inc.c files

Ignore files which have a .inc.c extension -- these are not headers
but they are not standalone C source files either, so we can't make
any automated decisions about what #include directives they should
have.

Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-Id: <1456238983-10160-3-git-send-email-peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <rth@twiddle.net>
8 years agotcg: Rename tcg-target.c to tcg-target.inc.c
Peter Maydell [Tue, 23 Feb 2016 14:49:41 +0000 (14:49 +0000)]
tcg: Rename tcg-target.c to tcg-target.inc.c

Rename the per-architecture tcg-target.c files to tcg-target.inc.c.
This makes it clearer that they are not intended to be standalone
C files, but are instead #included into another source file.

Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-Id: <1456238983-10160-2-git-send-email-peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <rth@twiddle.net>
8 years agotarget-sparc: Use global registers for the register window
Richard Henderson [Thu, 19 Sep 2013 17:51:12 +0000 (10:51 -0700)]
target-sparc: Use global registers for the register window

Via indirection off cpu_regwptr.

Tested-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Signed-off-by: Richard Henderson <rth@twiddle.net>
8 years agoMerge remote-tracking branch 'remotes/spice/tags/pull-spice-20160223-1' into staging
Peter Maydell [Tue, 23 Feb 2016 16:14:17 +0000 (16:14 +0000)]
Merge remote-tracking branch 'remotes/spice/tags/pull-spice-20160223-1' into staging

spice: initial opengl/virgl support, postcopy migration fix.

# gpg: Signature made Tue 23 Feb 2016 12:30:40 GMT using RSA key ID D3E87138
# 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>"

* remotes/spice/tags/pull-spice-20160223-1:
  Postcopy+spice: Pass spice migration data earlier
  spice/gl: tweak debug messages.
  spice/gl: add unblock timer
  spice: add opengl/virgl/dmabuf support
  spice: reset cursor on resize
  egl-helpers: add functions for render nodes and dma-buf passing
  configure: add dma-buf support detection.
  spice: init dcl before registering qxl interface

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8 years agotarget-sparc: Tidy global register initialization
Richard Henderson [Thu, 19 Sep 2013 17:49:01 +0000 (10:49 -0700)]
target-sparc: Tidy global register initialization

Create tables for the various global registers that need allocation.
Remove one level of indirection from  gregnames and fregnames.

Tested-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Signed-off-by: Richard Henderson <rth@twiddle.net>
8 years agotcg: Allocate indirect_base temporaries in a different order
Richard Henderson [Wed, 19 Aug 2015 06:23:08 +0000 (23:23 -0700)]
tcg: Allocate indirect_base temporaries in a different order

Since we've not got liveness analysis for indirect bases,
placing them at the end of the call-saved registers makes
it more likely that it'll stay live.

Tested-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Signed-off-by: Richard Henderson <rth@twiddle.net>
8 years agotcg: Implement indirect memory registers
Richard Henderson [Thu, 19 Sep 2013 17:36:18 +0000 (10:36 -0700)]
tcg: Implement indirect memory registers

That is, global_mem registers whose base is another global_mem
register, rather than a fixed register.

Tested-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Signed-off-by: Richard Henderson <rth@twiddle.net>
8 years agotcg: Work around clang bug wrt enum ranges, part 2
Richard Henderson [Tue, 9 Feb 2016 18:20:16 +0000 (05:20 +1100)]
tcg: Work around clang bug wrt enum ranges, part 2

A previous patch patch changed the type of REG from int
to enum TCGReg, which provokes the following bug in clang:

  https://llvm.org/bugs/show_bug.cgi?id=16154

Signed-off-by: Richard Henderson <rth@twiddle.net>
8 years agotracetool: Include osdep.h in generated-ust.c
Peter Maydell [Tue, 23 Feb 2016 15:17:41 +0000 (15:17 +0000)]
tracetool: Include osdep.h in generated-ust.c

When generating the trace/generated-ust.c source file, make sure
it includes osdep.h as its first include.

This fixes compilation with --enable-trace-backends=ust

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1456240661-15422-1-git-send-email-peter.maydell@linaro.org
Reviewed-by: Eric Blake <eblake@redhat.com>
8 years agoinclude: Clean up includes
Peter Maydell [Tue, 23 Feb 2016 11:58:03 +0000 (11:58 +0000)]
include: Clean up includes

Clean up includes so that osdep.h is included first and headers
which it implies are not included manually.

This commit was created with scripts/clean-includes.

NB: If this commit breaks compilation for your out-of-tree
patchseries or fork, then you need to make sure you add
#include "qemu/osdep.h" to any new .c files that you have.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Eric Blake <eblake@redhat.com>
8 years agoall: Clean up includes
Peter Maydell [Tue, 23 Feb 2016 12:00:47 +0000 (12:00 +0000)]
all: Clean up includes

Clean up includes so that osdep.h is included first and headers
which it implies are not included manually.

This commit was created with scripts/clean-includes.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
This just catches a couple of stragglers since I posted
the last clean-includes patchset last week.

8 years agoall: Clean up includes
Peter Maydell [Tue, 23 Feb 2016 11:58:03 +0000 (11:58 +0000)]
all: Clean up includes

Clean up includes so that osdep.h is included first and headers
which it implies are not included manually.

This commit was created with scripts/clean-includes.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Eric Blake <eblake@redhat.com>
8 years agoosdep.h: Include config-target.h if NEED_CPU_H is defined
Peter Maydell [Tue, 23 Feb 2016 11:58:02 +0000 (11:58 +0000)]
osdep.h: Include config-target.h if NEED_CPU_H is defined

NEED_CPU_H is the define we use to distinguish per-target object
compilation from common object compilation. For the former, we must
also include config-target.h so that the .c files see the necessary
CONFIG_ constants.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Eric Blake <eblake@redhat.com>
8 years agoscripts/clean-includes: Add --all option
Peter Maydell [Tue, 23 Feb 2016 11:58:02 +0000 (11:58 +0000)]
scripts/clean-includes: Add --all option

Add a --all option which will run the script on every C
source and header file in the repository (except for those
in a few directories which contain standalone guest code).

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Eric Blake <eblake@redhat.com>
8 years agoscripts/clean-includes: Enhance to handle header files
Peter Maydell [Tue, 23 Feb 2016 11:58:02 +0000 (11:58 +0000)]
scripts/clean-includes: Enhance to handle header files

Enhance clean-includes to handle header files as well as .c source
files. For headers we merely remove all the redundant #include
lines, including any includes of qemu/osdep.h itself.

There is a simple mollyguard on the include file processing to
skip a few key headers like osdep.h itself, to avoid producing
bad patches if the script is run on every file in include/.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Eric Blake <eblake@redhat.com>
8 years agodisas/arm-a64.cc: Include osdep.h first
Peter Maydell [Tue, 23 Feb 2016 11:58:02 +0000 (11:58 +0000)]
disas/arm-a64.cc: Include osdep.h first

Rearrange include directives so that we include osdep.h first.
This has to be done manually because clean-includes doesn't
handle C++.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Eric Blake <eblake@redhat.com>
8 years agoosdep.h: Define macros for the benefit of C++ before C++11
Peter Maydell [Tue, 23 Feb 2016 11:58:02 +0000 (11:58 +0000)]
osdep.h: Define macros for the benefit of C++ before C++11

For C++ before C++11, <stdint.h> requires definition of the macros
__STDC_CONSTANT_MACROS, __STDC_LIMIT_MACROS and __STDC_FORMAT_MACROS
in order to enable definition of various macros by the header file.
Define these in osdep.h, so that we get the right header file
definitions whether osdep.h is being used by plain C, C++11 or
older C++.

In particular libvixl's header files depend on this and won't
compile if osdep.h is included before them otherwise.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Eric Blake <eblake@redhat.com>
8 years agocpu: Clean up includes
Peter Maydell [Tue, 23 Feb 2016 11:58:02 +0000 (11:58 +0000)]
cpu: Clean up includes

Clean up includes so that osdep.h is included first and headers
which it implies are not included manually.

This commit was created with scripts/clean-includes.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8 years agoPostcopy+spice: Pass spice migration data earlier
Dr. David Alan Gilbert [Mon, 22 Feb 2016 17:17:32 +0000 (17:17 +0000)]
Postcopy+spice: Pass spice migration data earlier

Spice hooks the migration status changes to figure out when to
transmit information to the new spice server; but the migration
status in postcopy doesn't quite fit - the destination starts
running before the end of the source migration.

It's not a case of hanging off the migration status change to
postcopy-active either, since that happens before we stop the
guest CPU.

Fix it by sending a notify just after sending the device state,
and adding a flag that can be tested by the notify receiver.

Symptom:
   spice handover doesn't work with the error:
   red_worker.c:11540:display_channel_wait_for_migrate_data: timeout

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Amit Shah <amit.shah@redhat.com>
Message-id: 1456161452-25318-1-git-send-email-dgilbert@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
8 years agospice/gl: tweak debug messages.
Gerd Hoffmann [Tue, 16 Feb 2016 10:05:18 +0000 (11:05 +0100)]
spice/gl: tweak debug messages.

Adjust message levels, make messages more verbose.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
8 years agospice/gl: add unblock timer
Gerd Hoffmann [Fri, 19 Feb 2016 06:46:47 +0000 (07:46 +0100)]
spice/gl: add unblock timer

Pure debug aid, print a warning in case unblocking
doesn't happen within one second.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
8 years agospice: add opengl/virgl/dmabuf support
Gerd Hoffmann [Tue, 13 Oct 2015 13:39:34 +0000 (15:39 +0200)]
spice: add opengl/virgl/dmabuf support

This adds support for dma-buf passing to spice.  This makes virtio-gpu
with 3d acceleration work with spice.

Workflow:
 * virglrenderer renders the guest command stream into a texture.
 * qemu exports the texture as dma-buf and passes on that dma-buf
   to spice-server.
 * spice-server passes the dma-buf to spice-client, using unix
   socket file descriptor passing.
 * spice-client asks the window systems composer to render the
   dma-buf to the screen.

Requires cutting edge spice (server) and spice-gtk (client) builds,
from git master branch.

Also requires libvirt managing your qemu instance, and using
"virt-viewer --attach $guest".  libvirt will connect spice-server and
spice-client using unix sockets instead of tcp sockets then, which
is required for file descriptor passing.

Works for the local case (spice server and client on the same machine)
only.  Supporting remote too is planned (by feeding the dma-bufs into
gpu-assisted video encoder), but not there yet.

gl mode is turned off by default, use "-spice gl=on,$otherargs" to
enable it.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
8 years agospice: reset cursor on resize
Marc-André Lureau [Tue, 8 Dec 2015 16:08:10 +0000 (17:08 +0100)]
spice: reset cursor on resize

Spice server will clear the cursor on resize. QXL driver reset it after
resize, however, virtio and other devices do not. Teach qemu to set it
back.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
8 years agoegl-helpers: add functions for render nodes and dma-buf passing
Gerd Hoffmann [Mon, 12 Oct 2015 10:03:49 +0000 (12:03 +0200)]
egl-helpers: add functions for render nodes and dma-buf passing

Adds helpers to open a drm render node and create a opengl
context for it.  Also add a helper to export a texture as
dma-buf.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
8 years agoconfigure: add dma-buf support detection.
Gerd Hoffmann [Thu, 3 Dec 2015 11:56:34 +0000 (12:56 +0100)]
configure: add dma-buf support detection.

Set CONFIG_OPENGL_DMABUF in case both mesa and libepoxy are
new enough to have support for dma-buf import/export.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
8 years agospice: init dcl before registering qxl interface
Gerd Hoffmann [Fri, 19 Feb 2016 08:23:03 +0000 (09:23 +0100)]
spice: init dcl before registering qxl interface

Without this spice might callback into qemu before ssd->dcl.con is
initialized, resulting in a segfault due to NULL pointer dereference.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
8 years agoMerge remote-tracking branch 'remotes/kraxel/tags/pull-usb-20160223-1' into staging
Peter Maydell [Tue, 23 Feb 2016 10:57:31 +0000 (10:57 +0000)]
Merge remote-tracking branch 'remotes/kraxel/tags/pull-usb-20160223-1' into staging

usb: misc bugfixes.

# gpg: Signature made Tue 23 Feb 2016 10:53:01 GMT using RSA key ID D3E87138
# 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>"

* remotes/kraxel/tags/pull-usb-20160223-1:
  ohci: allocate timer only once.
  usb: add pid check at the first of uhci_handle_td()
  usb: check RNDIS buffer offsets & length
  usb: check RNDIS message length
  tusb6010: move from hw/timer to hw/usb
  usb: check USB configuration descriptor object

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8 years agoohci: allocate timer only once.
Gerd Hoffmann [Mon, 22 Feb 2016 08:50:11 +0000 (09:50 +0100)]
ohci: allocate timer only once.

Allocate timer once, at init time, instead of allocating/freeing
it all the time when starting/stopping the bus.  Simplifies the
code, also fixes bugs (memory leak) due to missing checks whenever
the time is already allocated or not.

Cc: Prasad J Pandit <pjp@fedoraproject.org>
Reported-by: Zuozhi Fzz <zuozhi.fzz@alibaba-inc.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
8 years agousb: add pid check at the first of uhci_handle_td()
Gonglei [Fri, 19 Feb 2016 07:33:58 +0000 (15:33 +0800)]
usb: add pid check at the first of uhci_handle_td()

pid can be gotten from uhci device memory in uhci_handle_td(),
so the guest can trigger assert qemu if we get an invalid pid.
And the uhci spec 2.1.2 tells us The Host Controller sets Host
Controller Process Error bit to 1 when it detects a fatal error
and indicates that the Host Controller suffered a consistency
check failure while processing a Transfer Descriptor. An example
of a consistency check failure would be finding an illegal PID
field while processing the packet header portion of the TD.
When this error occurs, the Host Controller clears the Run/Stop
bit in the Command register to prevent further schedule execution.

We'd better to set UHCI_STS_HCPERR and kick an interrupt, check
the pid value at the first of uhci_handle_td function.

https://bugzilla.redhat.com/show_bug.cgi?id=1070027

Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Message-id: 1455867238-4720-1-git-send-email-arei.gonglei@huawei.com

[ applied minor codestyle fix ]

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
8 years agousb: check RNDIS buffer offsets & length
Prasad J Pandit [Tue, 16 Feb 2016 18:53:41 +0000 (00:23 +0530)]
usb: check RNDIS buffer offsets & length

When processing remote NDIS control message packets,
the USB Net device emulator uses a fixed length(4096) data buffer.
The incoming informationBufferOffset & Length combination could
overflow and cross that range. Check control message buffer
offsets and length to avoid it.

Reported-by: Qinghao Tang <luodalongde@gmail.com>
Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
Message-id: 1455648821-17340-3-git-send-email-ppandit@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
8 years agousb: check RNDIS message length
Prasad J Pandit [Tue, 16 Feb 2016 18:53:40 +0000 (00:23 +0530)]
usb: check RNDIS message length

When processing remote NDIS control message packets, the USB Net
device emulator uses a fixed length(4096) data buffer. The incoming
packet length could exceed this limit. Add a check to avoid it.

Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
Message-id: 1455648821-17340-2-git-send-email-ppandit@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
8 years agotusb6010: move from hw/timer to hw/usb
Peter Maydell [Fri, 19 Feb 2016 12:03:24 +0000 (12:03 +0000)]
tusb6010: move from hw/timer to hw/usb

The TUSB6010 is a USB controller (as the name suggests). Move it from
hw/timer (where it was accidentally filed in 2013 when we moved
everything out of hw/) to hw/usb.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1455883404-10976-1-git-send-email-peter.maydell@linaro.org
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
8 years agousb: check USB configuration descriptor object
Prasad J Pandit [Thu, 11 Feb 2016 11:01:20 +0000 (16:31 +0530)]
usb: check USB configuration descriptor object

When processing remote NDIS control message packets, the USB Net
device emulator checks to see if the USB configuration descriptor
object is of RNDIS type(2). But it does not check if it is null,
which leads to a null dereference error. Add check to avoid it.

Reported-by: Qinghao Tang <luodalongde@gmail.com>
Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
Message-id: 1455188480-14688-1-git-send-email-ppandit@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
8 years agoMerge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging
Peter Maydell [Mon, 22 Feb 2016 16:55:41 +0000 (16:55 +0000)]
Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging

Block layer patches

# gpg: Signature made Mon 22 Feb 2016 15:59:25 GMT using RSA key ID C88F2FD6
# gpg: Good signature from "Kevin Wolf <kwolf@redhat.com>"

* remotes/kevin/tags/for-upstream: (34 commits)
  qemu-iotests: 140: make description slightly more verbose
  qemu-iotests: 140: don't use IDE device
  qemu-iotests: 067: ignore QMP events
  blockdev: unset inappropriate flags when changing medium
  MAINTAINERS: Add myself as maintainer of the throttling code
  docs: Document the throttling infrastructure
  qapi: Correct the name of the iops_rd parameter
  qemu-iotests: Extend iotest 093 to test bursts
  throttle: Test throttle_compute_wait() during bursts
  throttle: Check that burst_level leaks correctly
  qapi: Add burst length fields to BlockDeviceInfo
  qapi: Add burst length parameters to block_set_io_throttle
  throttle: Add command-line settings to define the burst periods
  throttle: Add support for burst periods
  throttle: Use throttle_config_init() to initialize ThrottleConfig
  throttle: Merge all functions that check the configuration into one
  throttle: Set always an average value when setting a maximum value
  throttle: Make throttle_is_valid() set errp
  throttle: Make throttle_max_is_missing_limit() set errp
  throttle: Make throttle_conflicting() set errp
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8 years agoMerge remote-tracking branch 'mreitz/tags/pull-block-for-kevin-2016-02-22' into queue...
Kevin Wolf [Mon, 22 Feb 2016 15:57:50 +0000 (16:57 +0100)]
Merge remote-tracking branch 'mreitz/tags/pull-block-for-kevin-2016-02-22' into queue-block

Block patches of the last three weeks.

# gpg: Signature made Mon Feb 22 16:55:33 2016 CET using RSA key ID E838ACAD
# gpg: Good signature from "Max Reitz <mreitz@redhat.com>"

* mreitz/tags/pull-block-for-kevin-2016-02-22:
  qemu-iotests: 140: make description slightly more verbose
  qemu-iotests: 140: don't use IDE device
  qemu-iotests: 067: ignore QMP events
  blockdev: unset inappropriate flags when changing medium

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
8 years agoqemu-iotests: 140: make description slightly more verbose
Sascha Silbe [Thu, 18 Feb 2016 20:37:33 +0000 (21:37 +0100)]
qemu-iotests: 140: make description slightly more verbose

Describe in a little more detail what the test is supposed to achieve.

Signed-off-by: Sascha Silbe <silbe@linux.vnet.ibm.com>
Message-id: 1455827853-33477-3-git-send-email-silbe@linux.vnet.ibm.com
Signed-off-by: Max Reitz <mreitz@redhat.com>
8 years agoqemu-iotests: 140: don't use IDE device
Sascha Silbe [Thu, 18 Feb 2016 20:37:32 +0000 (21:37 +0100)]
qemu-iotests: 140: don't use IDE device

IDE is only implemented by very few architectures (mostly PC). The
test doesn't actually need a block device attached to the
BlockBackend, so just drop it and adjust the reference output
accordingly.

Fixes: 16dee418 ("iotests: Add test for eject under NBD server")
Signed-off-by: Sascha Silbe <silbe@linux.vnet.ibm.com>
Message-id: 1455827853-33477-2-git-send-email-silbe@linux.vnet.ibm.com
Signed-off-by: Max Reitz <mreitz@redhat.com>
8 years agoqemu-iotests: 067: ignore QMP events
Sascha Silbe [Fri, 19 Feb 2016 13:01:09 +0000 (14:01 +0100)]
qemu-iotests: 067: ignore QMP events

The relative ordering of "device_del" return value and the
"DEVICE_DELETED" QMP event depends on the architecture being
tested. On x86 unplugging virtio disks is asynchronous
(=qdev_unplug()= → =hotplug_handler_unplug_request()=) while on s390x
it is synchronous (=qdev_unplug()= → =hotplug_handler_unplug()=). This
leads to the actual output on s390x consistently differing from the
reference output (that was probably produced on x86).

The easiest way to address this is to filter out QMP events in
067. The DEVICE_DELETED event is already getting explicitly tested by
the Python-based test case 139, so the test coverage should be
unaffected. Make use of the recently introduced _filter_qmp_events()
to remove QMP events from the test case output and adjust the
reference output accordingly.

The tr / sed / tr trick used for filtering was suggested by Max Reitz
<mreitz@redhat.com>.

Signed-off-by: Sascha Silbe <silbe@linux.vnet.ibm.com>
Message-id: 1455886869-139916-2-git-send-email-silbe@linux.vnet.ibm.com
Signed-off-by: Max Reitz <mreitz@redhat.com>
8 years agoblockdev: unset inappropriate flags when changing medium
Alyssa Milburn [Sat, 6 Feb 2016 13:36:18 +0000 (13:36 +0000)]
blockdev: unset inappropriate flags when changing medium

Most importantly, this removes BDRV_O_TEMPORARY, to avoid unlink()ing an
image which replaces a snapshotted one.

Signed-off-by: Alyssa Milburn <fuzzie@fuzzie.org>
Message-id: 20160206133618.GA16635@li141-249.members.linode.com
Signed-off-by: Max Reitz <mreitz@redhat.com>
8 years agoMAINTAINERS: Add myself as maintainer of the throttling code
Alberto Garcia [Thu, 18 Feb 2016 10:27:10 +0000 (12:27 +0200)]
MAINTAINERS: Add myself as maintainer of the throttling code

Signed-off-by: Alberto Garcia <berto@igalia.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
8 years agodocs: Document the throttling infrastructure
Alberto Garcia [Thu, 18 Feb 2016 10:27:09 +0000 (12:27 +0200)]
docs: Document the throttling infrastructure

Signed-off-by: Alberto Garcia <berto@igalia.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
8 years agoqapi: Correct the name of the iops_rd parameter
Alberto Garcia [Thu, 18 Feb 2016 10:27:08 +0000 (12:27 +0200)]
qapi: Correct the name of the iops_rd parameter

Signed-off-by: Alberto Garcia <berto@igalia.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
8 years agoqemu-iotests: Extend iotest 093 to test bursts
Alberto Garcia [Thu, 18 Feb 2016 10:27:07 +0000 (12:27 +0200)]
qemu-iotests: Extend iotest 093 to test bursts

This patch adds a new test that checks that the burst settings
('iops_max', 'iops_max_length', etc.) of the throttling code work as
expected.

Signed-off-by: Alberto Garcia <berto@igalia.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
8 years agothrottle: Test throttle_compute_wait() during bursts
Alberto Garcia [Thu, 18 Feb 2016 10:27:06 +0000 (12:27 +0200)]
throttle: Test throttle_compute_wait() during bursts

This test simulates an I/O burst for more than two seconds and checks
that it works as expected.

Signed-off-by: Alberto Garcia <berto@igalia.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
8 years agothrottle: Check that burst_level leaks correctly
Alberto Garcia [Thu, 18 Feb 2016 10:27:05 +0000 (12:27 +0200)]
throttle: Check that burst_level leaks correctly

This patch expands test_leak_bucket() to check that burst_level leaks
correctly.

Signed-off-by: Alberto Garcia <berto@igalia.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
8 years agoqapi: Add burst length fields to BlockDeviceInfo
Alberto Garcia [Thu, 18 Feb 2016 10:27:04 +0000 (12:27 +0200)]
qapi: Add burst length fields to BlockDeviceInfo

This patch adds the new bps_*_max_length and iops_*_max_length
parameters to the BlockDeviceInfo struct.

Signed-off-by: Alberto Garcia <berto@igalia.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
8 years agoqapi: Add burst length parameters to block_set_io_throttle
Alberto Garcia [Thu, 18 Feb 2016 10:27:03 +0000 (12:27 +0200)]
qapi: Add burst length parameters to block_set_io_throttle

This patch adds the new bps_*_max_length and iops_*_max_length
parameters to the block_set_io_throttle command.

Signed-off-by: Alberto Garcia <berto@igalia.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
8 years agothrottle: Add command-line settings to define the burst periods
Alberto Garcia [Thu, 18 Feb 2016 10:27:02 +0000 (12:27 +0200)]
throttle: Add command-line settings to define the burst periods

This patch adds all the throttling.*-max-length command-line
parameters to define the length of the burst periods.

Signed-off-by: Alberto Garcia <berto@igalia.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
8 years agothrottle: Add support for burst periods
Alberto Garcia [Thu, 18 Feb 2016 10:27:01 +0000 (12:27 +0200)]
throttle: Add support for burst periods

This patch adds support for burst periods to the throttling code.
With this feature the user can keep performing bursts as defined by
the LeakyBucket.max rate for a configurable period of time.

Signed-off-by: Alberto Garcia <berto@igalia.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
8 years agothrottle: Use throttle_config_init() to initialize ThrottleConfig
Alberto Garcia [Thu, 18 Feb 2016 10:27:00 +0000 (12:27 +0200)]
throttle: Use throttle_config_init() to initialize ThrottleConfig

We can currently initialize ThrottleConfig by zeroing all its fields,
but this will change with the new fields to define the length of the
burst periods.

This patch introduces a new throttle_config_init() function and uses it
to replace all memset() calls that initialize ThrottleConfig directly.

Signed-off-by: Alberto Garcia <berto@igalia.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
8 years agothrottle: Merge all functions that check the configuration into one
Alberto Garcia [Thu, 18 Feb 2016 10:26:59 +0000 (12:26 +0200)]
throttle: Merge all functions that check the configuration into one

There's no need to keep throttle_conflicting(), throttle_is_valid()
and throttle_max_is_missing_limit() as separate functions, so this
patch merges all three into one.

As a consequence, check_throttle_config() becomes redundant and can be
replaced with throttle_is_valid().

Signed-off-by: Alberto Garcia <berto@igalia.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
8 years agothrottle: Set always an average value when setting a maximum value
Alberto Garcia [Thu, 18 Feb 2016 10:26:58 +0000 (12:26 +0200)]
throttle: Set always an average value when setting a maximum value

When testing the ranges of valid values, set_cfg_value() creates
sometimes invalid throttling configurations by setting bucket.max
while leaving bucket.avg uninitialized.

While this doesn't break the current tests, it will as soon as
we unify all functions that check the validity of the throttling
configuration.

This patch ensures that the value of bucket.avg is valid when setting
bucket.max.

Signed-off-by: Alberto Garcia <berto@igalia.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
8 years agothrottle: Make throttle_is_valid() set errp
Alberto Garcia [Thu, 18 Feb 2016 10:26:57 +0000 (12:26 +0200)]
throttle: Make throttle_is_valid() set errp

The caller does not need to set it, and this will allow us to refactor
this function later.

Signed-off-by: Alberto Garcia <berto@igalia.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
8 years agothrottle: Make throttle_max_is_missing_limit() set errp
Alberto Garcia [Thu, 18 Feb 2016 10:26:56 +0000 (12:26 +0200)]
throttle: Make throttle_max_is_missing_limit() set errp

The caller does not need to set it, and this will allow us to refactor
this function later.

Signed-off-by: Alberto Garcia <berto@igalia.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
8 years agothrottle: Make throttle_conflicting() set errp
Alberto Garcia [Thu, 18 Feb 2016 10:26:55 +0000 (12:26 +0200)]
throttle: Make throttle_conflicting() set errp

The caller does not need to set it, and this will allow us to refactor
this function later.

Signed-off-by: Alberto Garcia <berto@igalia.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
8 years agothrottle: Make throttle_compute_timer() static
Alberto Garcia [Thu, 18 Feb 2016 10:26:54 +0000 (12:26 +0200)]
throttle: Make throttle_compute_timer() static

This function is only used internally in throttle.c

Signed-off-by: Alberto Garcia <berto@igalia.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
8 years agoMerge remote-tracking branch 'remotes/kraxel/tags/pull-ui-20160222-1' into staging
Peter Maydell [Mon, 22 Feb 2016 11:10:46 +0000 (11:10 +0000)]
Merge remote-tracking branch 'remotes/kraxel/tags/pull-ui-20160222-1' into staging

gtk: fix uninitialized temporary VirtualConsole

# gpg: Signature made Mon 22 Feb 2016 08:30:39 GMT using RSA key ID D3E87138
# 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>"

* remotes/kraxel/tags/pull-ui-20160222-1:
  gtk: fix uninitialized temporary VirtualConsole

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8 years agoblock migration: Activate image on destination before writing to it
Kevin Wolf [Mon, 22 Feb 2016 09:21:15 +0000 (10:21 +0100)]
block migration: Activate image on destination before writing to it

When using 'migrate -b', we must make sure to take ownership of the
image before writing to it. Otherwise metadata would be thrown away on
migration completion; this was caught by the assertions introduced in
commit 09e0c771.

Reported-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
8 years agoqemu-io: use no_argument/required_argument constants
Daniel P. Berrange [Wed, 17 Feb 2016 10:10:23 +0000 (10:10 +0000)]
qemu-io: use no_argument/required_argument constants

When declaring the 'struct option' array, use the standard
constants no_argument/required_argument, instead of magic
values 0 and 1.

Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
8 years agoqemu-nbd: use no_argument/required_argument constants
Daniel P. Berrange [Wed, 17 Feb 2016 10:10:22 +0000 (10:10 +0000)]
qemu-nbd: use no_argument/required_argument constants

When declaring the 'struct option' array, use the standard
constants no_argument/required_argument, instead of magic
values 0 and 1.

Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
8 years agoqemu-nbd: don't overlap long option values with short options
Daniel P. Berrange [Wed, 17 Feb 2016 10:10:21 +0000 (10:10 +0000)]
qemu-nbd: don't overlap long option values with short options

When defining values for long options, the normal practice is
to start numbering from 256, to avoid overlap with the range
of valid values for short options.

Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
8 years agoqemu-img: allow specifying image as a set of options args
Daniel P. Berrange [Wed, 17 Feb 2016 10:10:20 +0000 (10:10 +0000)]
qemu-img: allow specifying image as a set of options args

Currently qemu-img allows an image filename to be passed on the
command line, but unless using the JSON format, it does not have
a way to set any options except the format eg

   qemu-img info https://127.0.0.1/images/centos7.iso

This adds a --image-opts arg that indicates that the positional
filename should be interpreted as a full option string, not
just a filename.

   qemu-img info --image-opts driver=https,url=https://127.0.0.1/images,sslverify=off

This flag is mutually exclusive with the '-f' / '-F' flags.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
8 years agoqemu-nbd: allow specifying image as a set of options args
Daniel P. Berrange [Wed, 17 Feb 2016 10:10:19 +0000 (10:10 +0000)]
qemu-nbd: allow specifying image as a set of options args

Currently qemu-nbd allows an image filename to be passed on the
command line, but unless using the JSON format, it does not have
a way to set any options except the format eg

   qemu-nbd https://127.0.0.1/images/centos7.iso
   qemu-nbd /home/berrange/demo.qcow2

This adds a --image-opts arg that indicates that the positional
filename should be interpreted as a full option string, not
just a filename.

   qemu-nbd --image-opts driver=https,url=https://127.0.0.1/images,sslverify=off
   qemu-nbd --image-opts driver=file,filename=/home/berrange/demo.qcow2

This flag is mutually exclusive with the '-f' flag.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
8 years agoqemu-io: allow specifying image as a set of options args
Daniel P. Berrange [Wed, 17 Feb 2016 10:10:18 +0000 (10:10 +0000)]
qemu-io: allow specifying image as a set of options args

Currently qemu-io allows an image filename to be passed on the
command line, but unless using the JSON format, it does not have
a way to set any options except the format eg

 qemu-io https://127.0.0.1/images/centos7.iso
 qemu-io /home/berrange/demo.qcow2

By contrast when using the interactive shell, it is possible to
use --option with the 'open' command, or to omit the filename.

This adds a --image-opts arg that indicates that the positional
filename should be interpreted as a full option string, not
just a filename.

 qemu-io --image-opts driver=https,url=https://127.0.0.1/images,sslverify=off
 qemu-io --image-opts driver=qcow2,file.filename=/home/berrange/demo.qcow2

This flag is mutually exclusive with the '-f' flag and with
the '-o' flag to the 'open' command

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
8 years agoqemu-img: add support for --object command line arg
Daniel P. Berrange [Wed, 17 Feb 2016 10:10:17 +0000 (10:10 +0000)]
qemu-img: add support for --object command line arg

Allow creation of user creatable object types with qemu-img
via a new --object command line arg. This will be used to supply
passwords and/or encryption keys to the various block driver
backends via the recently added 'secret' object type.

 # printf letmein > mypasswd.txt
 # qemu-img info --object secret,id=sec0,file=mypasswd.txt \
      ...other info args...

Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
8 years agoqemu-io: add support for --object command line arg
Daniel P. Berrange [Wed, 17 Feb 2016 10:10:16 +0000 (10:10 +0000)]
qemu-io: add support for --object command line arg

Allow creation of user creatable object types with qemu-io
via a new --object command line arg. This will be used to supply
passwords and/or encryption keys to the various block driver
backends via the recently added 'secret' object type.

 # printf letmein > mypasswd.txt
 # qemu-io --object secret,id=sec0,file=mypasswd.txt \
      ...other args...

Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
8 years agoblock: Fix -incoming with snapshot=on
Kevin Wolf [Fri, 19 Feb 2016 15:48:10 +0000 (16:48 +0100)]
block: Fix -incoming with snapshot=on

The BDRV_O_INACTIVE flag should only be set for images explicitly opened
by the user. snapshot=on needs to create a new qcow2 image and write
some metadata to it. This is not a problem because it can't come from
the source, so there's no reason to mark it as BDRV_O_INACTIVE, even
though it is opened while waiting for the migration to complete.

This fixes an assertion failure when -incoming and snapshot=on are
combined.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
8 years agospec: add qcow2 bitmaps extension specification
Vladimir Sementsov-Ogievskiy [Fri, 5 Feb 2016 08:58:33 +0000 (11:58 +0300)]
spec: add qcow2 bitmaps extension specification

The new feature for qcow2: storing bitmaps.

This patch adds new header extension to qcow2 - Bitmaps Extension. It
provides an ability to store virtual disk related bitmaps in a qcow2
image. For now there is only one type of such bitmaps: Dirty Tracking
Bitmap, which just tracks virtual disk changes from some moment.

Note: Only bitmaps, relative to the virtual disk, stored in qcow2 file,
should be stored in this qcow2 file. The size of each bitmap
(considering its granularity) is equal to virtual disk size.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
8 years agoquorum: fix segfault when read fails in fifo mode
Changlong Xie [Fri, 5 Feb 2016 02:25:22 +0000 (10:25 +0800)]
quorum: fix segfault when read fails in fifo mode

Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>
Signed-off-by: Changlong Xie <xiecl.fnst@cn.fujitsu.com>
Reviewed-by: Alberto Garcia <berto@igalia.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
8 years agoqemu-img: initialize MapEntry object
John Snow [Fri, 5 Feb 2016 18:12:33 +0000 (13:12 -0500)]
qemu-img: initialize MapEntry object

Commit 16b0d555 introduced an issue where we are not initializing
has_filename for the 'next' MapEntry object, which leads to interesting
errors in both Valgrind and Clang -fsanitize=undefined.

Zero the stack object at allocation AND make sure the utility to
populate the fields properly marks has_filename as false if applicable.

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
8 years agogtk: fix uninitialized temporary VirtualConsole
Paolo Bonzini [Tue, 9 Feb 2016 10:59:16 +0000 (11:59 +0100)]
gtk: fix uninitialized temporary VirtualConsole

Only the echo field is used in the temporary VirtualConsole, so the
damage was limited.  But still, if echo was incorrectly set to true,
the result would be some puzzling output in VTE monitor and serial
consoles.

Fixes: fba958c692e47a373d15c1fd3d72b255bf76adbd
Cc: Gerd Hoffmann <kraxel@redhat.com>
Tested-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-id: 1455015557-15106-2-git-send-email-pbonzini@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
8 years agoetraxfs_dma: Dont forward zero-length payload to clients
Edgar E. Iglesias [Tue, 16 Feb 2016 11:42:49 +0000 (12:42 +0100)]
etraxfs_dma: Dont forward zero-length payload to clients

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
8 years agoMerge remote-tracking branch 'remotes/awilliam/tags/vfio-update-20160219.1' into...
Peter Maydell [Fri, 19 Feb 2016 17:44:24 +0000 (17:44 +0000)]
Merge remote-tracking branch 'remotes/awilliam/tags/vfio-update-20160219.1' into staging

VFIO updates 2016-02-19

 - AER pre-enable and misc fixes (Cao jin and Chen Fan)
 - PCI_CAP_LIST_NEXT & PCI_MSIX_FLAGS cleanup (Wei Yang)
 - AMD XGBE KVM platform passthrough (Eric Auger)

# gpg: Signature made Fri 19 Feb 2016 17:28:36 GMT using RSA key ID 3BB08B22
# 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>"

* remotes/awilliam/tags/vfio-update-20160219.1:
  vfio/pci: use PCI_MSIX_FLAGS on retrieving the MSIX entries
  hw/arm/sysbus-fdt: remove qemu_fdt_setprop returned value check
  hw/arm/sysbus-fdt: enable amd-xgbe dynamic instantiation
  hw/arm/sysbus-fdt: helpers for clock node generation
  device_tree: qemu_fdt_getprop_cell converted to use the error API
  device_tree: qemu_fdt_getprop converted to use the error API
  device_tree: introduce qemu_fdt_node_path
  device_tree: introduce load_device_tree_from_sysfs
  hw/vfio/platform: amd-xgbe device
  vfio/pci: replace 1 with PCI_CAP_LIST_NEXT to make code self-explain
  pcie_aer: expose pcie_aer_msg() interface
  aer: impove pcie_aer_init to support vfio device
  vfio: make the 4 bytes aligned for capability size
  pcie: modify the capability size assert

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8 years agoMerge remote-tracking branch 'remotes/pmaydell/tags/pull-softfloat-20160219' into...
Peter Maydell [Fri, 19 Feb 2016 16:49:49 +0000 (16:49 +0000)]
Merge remote-tracking branch 'remotes/pmaydell/tags/pull-softfloat-20160219' into staging

softfloat queue:
 * update MAINTAINERS with a section for softfloat
 * drop all the uses of int_fast*_t types

# gpg: Signature made Fri 19 Feb 2016 16:34:35 GMT using RSA key ID 14360CDE
# 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>"

* remotes/pmaydell/tags/pull-softfloat-20160219:
  MAINTAINERS: Add section for FPU emulation
  osdep.h: Remove int_fast*_t Solaris compatibility code
  fpu: Use plain 'int' rather than 'int_fast16_t' for exponents
  fpu: Use plain 'int' rather than 'int_fast16_t' for shift counts
  fpu: Remove use of int_fast16_t in conversions to int16
  target-mips: Stop using uint_fast*_t types in r4k_tlb_t struct

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8 years agovfio/pci: use PCI_MSIX_FLAGS on retrieving the MSIX entries
Wei Yang [Fri, 19 Feb 2016 16:42:32 +0000 (09:42 -0700)]
vfio/pci: use PCI_MSIX_FLAGS on retrieving the MSIX entries

Even PCI_CAP_FLAGS has the same value as PCI_MSIX_FLAGS, the later one is
the more proper on retrieving MSIX entries.

This patch uses PCI_MSIX_FLAGS to retrieve the MSIX entries.

Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
8 years agohw/arm/sysbus-fdt: remove qemu_fdt_setprop returned value check
Eric Auger [Fri, 19 Feb 2016 16:42:31 +0000 (09:42 -0700)]
hw/arm/sysbus-fdt: remove qemu_fdt_setprop returned value check

qemu_fdt_setprop asserts in case of error hence no need to check
the returned value.

Signed-off-by: Eric Auger <eric.auger@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
8 years agohw/arm/sysbus-fdt: enable amd-xgbe dynamic instantiation
Eric Auger [Fri, 19 Feb 2016 16:42:31 +0000 (09:42 -0700)]
hw/arm/sysbus-fdt: enable amd-xgbe dynamic instantiation

This patch allows the instantiation of the vfio-amd-xgbe device
from the QEMU command line (-device vfio-amd-xgbe,host="<device>").

The guest is exposed with a device tree node that combines the description
of both XGBE and PHY (representation supported from 4.2 onwards kernel):
Documentation/devicetree/bindings/net/amd-xgbe.txt.

There are 5 register regions, 6 interrupts including 4 optional
edge-sensitive per-channel interrupts.

Some property values are inherited from host device tree. Host device tree
must feature a combined XGBE/PHY representation (>= 4.2 host kernel).

2 clock nodes (dma and ptp) also are created. It is checked those clocks
are fixed on host side.

AMD XGBE node creation function has a dependency on vfio Linux header and
more generally node creation function for VFIO platform devices only make
sense with CONFIG_LINUX so let's protect this code with #ifdef CONFIG_LINUX.

Signed-off-by: Eric Auger <eric.auger@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
8 years agohw/arm/sysbus-fdt: helpers for clock node generation
Eric Auger [Fri, 19 Feb 2016 16:42:31 +0000 (09:42 -0700)]
hw/arm/sysbus-fdt: helpers for clock node generation

Some passthrough'ed devices depend on clock nodes. Those need to be
generated in the guest device tree. This patch introduces some helpers
to build a clock node from information retrieved in the host device tree.

- copy_properties_from_host copies properties from a host device tree
  node to a guest device tree node
- fdt_build_clock_node builds a guest clock node and checks the host
  fellow clock is a fixed one.

fdt_build_clock_node will become static as soon as it gets used. A
dummy pre-declaration is needed for compilation of this patch.

Signed-off-by: Eric Auger <eric.auger@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
8 years agodevice_tree: qemu_fdt_getprop_cell converted to use the error API
Eric Auger [Fri, 19 Feb 2016 16:42:30 +0000 (09:42 -0700)]
device_tree: qemu_fdt_getprop_cell converted to use the error API

This patch aligns the prototype with qemu_fdt_getprop. The caller
can choose whether the function self-asserts on error (passing
&error_fatal as Error ** argument, corresponding to the legacy behavior),
or behaves differently such as simply output a message.

In this later case the caller can use the new lenp parameter to interpret
the error if any.

Signed-off-by: Eric Auger <eric.auger@linaro.org>
Reviewed-by: Peter Crosthwaite <crosthwaite.peter@gmail.com>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
8 years agodevice_tree: qemu_fdt_getprop converted to use the error API
Eric Auger [Fri, 19 Feb 2016 16:42:30 +0000 (09:42 -0700)]
device_tree: qemu_fdt_getprop converted to use the error API

Current qemu_fdt_getprop exits if the property is not found. It is
sometimes needed to read an optional property, in which case we do
not wish to exit but simply returns a null value.

This patch converts qemu_fdt_getprop to accept an Error **, and existing
users are converted to pass &error_fatal. This preserves the existing
behaviour. Then to use the API with your optional semantic a null
parameter can be conveyed.

Signed-off-by: Eric Auger <eric.auger@linaro.org>
Reviewed-by: Peter Crosthwaite <crosthwaite.peter@gmail.com>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
8 years agodevice_tree: introduce qemu_fdt_node_path
Eric Auger [Fri, 19 Feb 2016 16:42:30 +0000 (09:42 -0700)]
device_tree: introduce qemu_fdt_node_path

This new helper routine returns a NULL terminated array of
node paths matching a node name and a compat string.

Signed-off-by: Eric Auger <eric.auger@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
8 years agodevice_tree: introduce load_device_tree_from_sysfs
Eric Auger [Fri, 19 Feb 2016 16:42:29 +0000 (09:42 -0700)]
device_tree: introduce load_device_tree_from_sysfs

This function returns the host device tree blob from sysfs
(/proc/device-tree). It uses a recursive function inspired
from dtc read_fstree.

Signed-off-by: Eric Auger <eric.auger@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
8 years agohw/vfio/platform: amd-xgbe device
Eric Auger [Fri, 19 Feb 2016 16:42:29 +0000 (09:42 -0700)]
hw/vfio/platform: amd-xgbe device

This patch introduces the amd-xgbe VFIO platform device. It
allows the guest to do passthrough on a device exposing an
"amd,xgbe-seattle-v1a" compat string.

Signed-off-by: Eric Auger <eric.auger@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
8 years agovfio/pci: replace 1 with PCI_CAP_LIST_NEXT to make code self-explain
Wei Yang [Fri, 19 Feb 2016 16:42:29 +0000 (09:42 -0700)]
vfio/pci: replace 1 with PCI_CAP_LIST_NEXT to make code self-explain

Use the macro PCI_CAP_LIST_NEXT instead of 1, so that the code would be
more self-explain.

This patch makes this change and also fixs one typo in comment.

Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
8 years agopcie_aer: expose pcie_aer_msg() interface
Chen Fan [Fri, 19 Feb 2016 16:42:28 +0000 (09:42 -0700)]
pcie_aer: expose pcie_aer_msg() interface

For vfio device, we need to propagate the aer error to
Guest OS. we use the pcie_aer_msg() to send aer error
to guest.

Signed-off-by: Chen Fan <chen.fan.fnst@cn.fujitsu.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
8 years agoaer: impove pcie_aer_init to support vfio device
Chen Fan [Fri, 19 Feb 2016 16:42:28 +0000 (09:42 -0700)]
aer: impove pcie_aer_init to support vfio device

pcie_aer_init was used to emulate an aer capability for pcie device,
but for vfio device, the aer config space size is mutable and is not
always equal to PCI_ERR_SIZEOF(0x48). it depends on where the TLP Prefix
register required, so here we add a size argument.

Signed-off-by: Chen Fan <chen.fan.fnst@cn.fujitsu.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
8 years agovfio: make the 4 bytes aligned for capability size
Chen Fan [Fri, 19 Feb 2016 16:42:28 +0000 (09:42 -0700)]
vfio: make the 4 bytes aligned for capability size

this function search the capability from the end, the last
size should 0x100 - pos, not 0xff - pos.

Signed-off-by: Chen Fan <chen.fan.fnst@cn.fujitsu.com>
Reviewed-by: Marcel Apfelbaum <marcel@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
8 years agopcie: modify the capability size assert
Chen Fan [Fri, 19 Feb 2016 16:42:27 +0000 (09:42 -0700)]
pcie: modify the capability size assert

Device's Offset and size can reach PCIE_CONFIG_SPACE_SIZE,
fix the corresponding assert.

Signed-off-by: Chen Fan <chen.fan.fnst@cn.fujitsu.com>
Reviewed-by: Marcel Apfelbaum <marcel@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
8 years agoMAINTAINERS: Add section for FPU emulation
Peter Maydell [Fri, 19 Feb 2016 16:25:01 +0000 (16:25 +0000)]
MAINTAINERS: Add section for FPU emulation

Add an entry to the MAINTAINERS file for our softfloat FPU
emulation code. This code is only 'odd fixes' but it's useful to
record who to cc on patches to it.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1453814875-440-1-git-send-email-peter.maydell@linaro.org

8 years agoosdep.h: Remove int_fast*_t Solaris compatibility code
Peter Maydell [Fri, 19 Feb 2016 16:25:01 +0000 (16:25 +0000)]
osdep.h: Remove int_fast*_t Solaris compatibility code

We now do not use the int_fast*_t types anywhere in QEMU, so we can
remove the compatibility definitions we were providing for the
benefit of ancient Solaris versions.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Message-id: 1453807806-32698-5-git-send-email-peter.maydell@linaro.org

8 years agofpu: Use plain 'int' rather than 'int_fast16_t' for exponents
Peter Maydell [Fri, 19 Feb 2016 16:25:01 +0000 (16:25 +0000)]
fpu: Use plain 'int' rather than 'int_fast16_t' for exponents

Use the plain 'int' type rather than 'int_fast16_t' for handling
exponents. Exponents don't need to be exactly 16 bits, so using int16_t
for them would confuse more than it clarified.

This should be a safe change because int_fast16_t semantics
permit use of 'int' (and on 32-bit glibc that is what you get).

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Message-id: 1453807806-32698-4-git-send-email-peter.maydell@linaro.org

8 years agofpu: Use plain 'int' rather than 'int_fast16_t' for shift counts
Peter Maydell [Fri, 19 Feb 2016 16:25:00 +0000 (16:25 +0000)]
fpu: Use plain 'int' rather than 'int_fast16_t' for shift counts

Use the plain 'int' type rather than 'int_fast16_t' for shift counts
in the various shift related functions, since we don't actually care
about the size of the integer at all here, and using int16_t would
be confusing.

This should be a safe change because int_fast16_t semantics
permit use of 'int' (and on 32-bit glibc that is what you get).

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Message-id: 1453807806-32698-3-git-send-email-peter.maydell@linaro.org

8 years agofpu: Remove use of int_fast16_t in conversions to int16
Peter Maydell [Fri, 19 Feb 2016 16:25:00 +0000 (16:25 +0000)]
fpu: Remove use of int_fast16_t in conversions to int16

Make the functions which convert floating point to 16 bit integer
return int16_t rather than int_fast16_t, and correspondingly use
int_fast16_t in their internal implementations where appropriate.

(These functions are used only by the ARM target.)

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Message-id: 1453807806-32698-2-git-send-email-peter.maydell@linaro.org

8 years agotarget-mips: Stop using uint_fast*_t types in r4k_tlb_t struct
Peter Maydell [Mon, 25 Jan 2016 17:40:49 +0000 (17:40 +0000)]
target-mips: Stop using uint_fast*_t types in r4k_tlb_t struct

The r4k_tlb_t structure uses the uint_fast*_t types. Most of these
uses are in bitfields and are thus pointless, because the bitfield
itself specifies the width of the type; just use 'unsigned int'
instead. (On glibc uint_fast16_t is defined as either 32 or 64 bits,
so we know the code is not reliant on it being exactly 16 bits.)
There is also one use of uint_fast8_t, which we replace with uint8_t,
because both are exactly 8 bits on glibc and this is the only
place outside the softfloat code which uses an int_fast*_t type.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
8 years agoMerge remote-tracking branch 'remotes/armbru/tags/pull-error-2016-02-19' into staging
Peter Maydell [Fri, 19 Feb 2016 15:19:13 +0000 (15:19 +0000)]
Merge remote-tracking branch 'remotes/armbru/tags/pull-error-2016-02-19' into staging

Error reporting patches for 2016-02-19

# gpg: Signature made Fri 19 Feb 2016 12:47:50 GMT using RSA key ID EB918653
# gpg: Good signature from "Markus Armbruster <armbru@redhat.com>"
# gpg:                 aka "Markus Armbruster <armbru@pond.sub.org>"

* remotes/armbru/tags/pull-error-2016-02-19:
  vl: Clean up machine selection in main().
  vl: Set error location when parsing memory options
  replay: Set error location properly when parsing options
  vl: Reset location after handling command-line arguments
  vl.c: Fix regression in machine error message

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8 years agoMerge remote-tracking branch 'remotes/armbru/tags/pull-qapi-2016-02-19' into staging
Peter Maydell [Fri, 19 Feb 2016 14:18:21 +0000 (14:18 +0000)]
Merge remote-tracking branch 'remotes/armbru/tags/pull-qapi-2016-02-19' into staging

QAPI patches for 2016-02-19

# gpg: Signature made Fri 19 Feb 2016 10:10:18 GMT using RSA key ID EB918653
# gpg: Good signature from "Markus Armbruster <armbru@redhat.com>"
# gpg:                 aka "Markus Armbruster <armbru@pond.sub.org>"

* remotes/armbru/tags/pull-qapi-2016-02-19:
  qapi: Change visit_start_implicit_struct to visit_start_alternate
  qapi: Don't box branches of flat unions
  qapi: Don't box struct branch of alternate
  qapi-visit: Use common idiom in gen_visit_fields_decl()
  qapi: Emit structs used as variants in topological order
  qapi: Adjust layout of FooList types
  qapi-visit: Less indirection in visit_type_Foo_fields()
  qapi-visit: Unify struct and union visit
  qapi: Visit variants in visit_type_FOO_fields()
  qapi-visit: Simplify how we visit common union members
  qapi: Add tests of complex objects within alternate
  qapi: Forbid 'any' inside an alternate
  qapi: Forbid empty unions and useless alternates
  qapi: Simplify excess input reporting in input visitors
  qapi-visit: Honor prefix of discriminator enum

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8 years agovl: Clean up machine selection in main().
Markus Armbruster [Tue, 16 Feb 2016 14:51:53 +0000 (15:51 +0100)]
vl: Clean up machine selection in main().

We set machine_class to the default first, and update it to the real
one later.  Any use of machine_class in between is almost certainly
wrong (there are no such uses right now).  Set it once and for all
instead.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Marcel Apfelbaum <marcel@redhat.com>
8 years agovl: Set error location when parsing memory options
Eduardo Habkost [Fri, 12 Feb 2016 19:02:27 +0000 (17:02 -0200)]
vl: Set error location when parsing memory options

Set error location so the error_report() calls will show
appropriate command-line argument or config file info.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Message-Id: <1455303747-19776-5-git-send-email-ehabkost@redhat.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>