]> git.proxmox.com Git - mirror_qemu.git/log
mirror_qemu.git
8 years agoqga: handle possible SIGPIPE in guest-file-write
Denis V. Lunev [Tue, 13 Oct 2015 15:41:21 +0000 (18:41 +0300)]
qga: handle possible SIGPIPE in guest-file-write

qemu-ga should not exit on guest-file-write to pipe without read end
but proper error code should be returned. The behavior of the
spawned process should be default thus SIGPIPE processing should be
reset to default after fork() but before exec().

Signed-off-by: Denis V. Lunev <den@openvz.org>
Signed-off-by: Yuri Pudgorodskiy <yur@virtuozzo.com>
Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Denis V. Lunev <den@openvz.org>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
8 years agoqga: guest exec functionality
Yuri Pudgorodskiy [Tue, 13 Oct 2015 15:41:20 +0000 (18:41 +0300)]
qga: guest exec functionality

Guest-exec rewritten in platform-independent style with glib spawn.

Child process is spawn asynchronously and exit status can later
be picked up by guest-exec-status command.

stdin/stdout/stderr of the child now is redirected to /dev/null
Later we will add ability to specify stdin in guest-exec command
and to get collected stdout/stderr with guest-exec-status.

Signed-off-by: Yuri Pudgorodskiy <yur@virtuozzo.com>
Signed-off-by: Denis V. Lunev <den@openvz.org>
CC: Michael Roth <mdroth@linux.vnet.ibm.com>
* use g_new0 in place of g_malloc for GuestExec struct
* commit msg spelling fixes
* s/inp-data/input-data
* document capture-input mode as false by default
* use GetProcessId() for pids on w32 instead of casting HANDLE
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
8 years agoqga: drop guest_file_init helper and replace it with static initializers
Denis V. Lunev [Tue, 13 Oct 2015 15:41:19 +0000 (18:41 +0300)]
qga: drop guest_file_init helper and replace it with static initializers

This just makes code shorter and better.

Signed-off-by: Denis V. Lunev <den@openvz.org>
Signed-off-by: Yuri Pudgorodskiy <yur@virtuozzo.com>
Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Denis V. Lunev <den@openvz.org>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
8 years agotests: add a local test for guest agent
Marc-André Lureau [Fri, 2 Oct 2015 12:58:18 +0000 (14:58 +0200)]
tests: add a local test for guest agent

Add some local guest agent tests, as it is better than nothing, only
when CONFIG_POSIX (using unix sockets).

With the QGA_TEST_SIDE_EFFECTING environment variable, it will include
tests with side effects, such as freezing/thawing the FS or changing the
time.

(a better test would involve a managed VM (or container), but it might
be better to leave that off to autotest/avocado)

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
* use mkdtemp() in placeof g_mkdtemp() for glib 2.22 compat
* drop redundant/conflicting compat defines for
  g_assert_{true,false}, since glib-compat has them now.
* build fixes for OSX: use PRId64 instead of glib formats, drop
  g_spawn_default usage for glib compat
* assert connect_qga() doesn't fail
* only enable test-qga for linux hosts
* allow get-memory-block-info* to fail
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
8 years agoqga: guest-get-memory-blocks shouldn't fail for unexposed memory blocks
Michael Roth [Mon, 19 Oct 2015 21:38:25 +0000 (16:38 -0500)]
qga: guest-get-memory-blocks shouldn't fail for unexposed memory blocks

Some guests don't expose memory blocks via sysfs at all. This
shouldn't be a failure, instead just return an empty list. For
other access failures we still report an error.

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
8 years agoglib-compat: add 2.38/2.40/2.46 asserts
Marc-André Lureau [Fri, 2 Oct 2015 12:58:17 +0000 (14:58 +0200)]
glib-compat: add 2.38/2.40/2.46 asserts

Those are mostly useful for writing tests.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Claudio Fontana <claudio.fontana@huawei.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
8 years agoqtest: add a few fd-level qmp helpers
Marc-André Lureau [Fri, 2 Oct 2015 12:58:16 +0000 (14:58 +0200)]
qtest: add a few fd-level qmp helpers

Add a few functions to interact with qmp via a simple fd.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
8 years agoqga: do not override configuration verbosity
Marc-André Lureau [Fri, 2 Oct 2015 12:58:15 +0000 (14:58 +0200)]
qga: do not override configuration verbosity

Move the default verbosity settings before loading the configuration
file, or it will overwrite it. Found thanks to writing qga tests :)

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
8 years agoqga: add QGA_CONF environment variable
Marc-André Lureau [Fri, 2 Oct 2015 12:58:14 +0000 (14:58 +0200)]
qga: add QGA_CONF environment variable

Having a environment variable allows to override default configuration
path, useful for testing. Note that this can't easily be an argument,
since loading config is done before parsing the arguments.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
8 years agoqga: Use g_new() & friends where that makes obvious sense
Markus Armbruster [Mon, 14 Sep 2015 11:50:44 +0000 (13:50 +0200)]
qga: Use g_new() & friends where that makes obvious sense

g_new(T, n) is neater than g_malloc(sizeof(T) * n).  It's also safer,
for two reasons.  One, it catches multiplication overflowing size_t.
Two, it returns T * rather than void *, which lets the compiler catch
more type errors.

This commit only touches allocations with size arguments of the form
sizeof(T).  Same Coccinelle semantic patch as in commit b45c03f.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
8 years agobuild: qemu-ga: add 'qemu-ga' build target for w32
Michael Roth [Mon, 7 Sep 2015 23:47:05 +0000 (18:47 -0500)]
build: qemu-ga: add 'qemu-ga' build target for w32

Currently POSIX builds rely on 'qemu-ga' target to do qga-only
distributable build. On w32, as with most standalone binary targets,
we rely on 'qemu-ga.exe' target.

Unlike with POSIX, qemu-ga for w32 has a number of related targets
such as VSS DLL and MSI package. We can do the full distributable
qga-only build on w32 with:

  make qemu-ga.exe

or:

  make msi

To make that work, we tie VSS dependencies onto qemu-ga.exe.
However, in reality the DLL isn't part of the binary, so we use a
filter to pull them out of the LINK recipe, which attempts to link
against prereqs for binary targets. Additionally, it could be argued
that VSS is a separate distributable, and shouldn't be implied by
qemu-ga.exe binary target.

To avoid this, we can tie the VSS dependencies only to the 'msi'
target, but that would make it impossible to do a qga-only build of
the w32 distributable without building the 'msi' package, which was
supported in the past.

An alternative approach is to add a new target to build the whole
distributable. w32 allows us to use the same build target we use
on POSIX, 'qemu-ga', since the current binary-only target on w32
is 'qemu-ga.exe'.

To further simplify the build, we also make 'qemu-ga' build the MSI
package if the appropriate ./configure options are set, making the
full qga-only build the same on both POSIX and w32: `make qemu-ga`

Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
8 years agoMerge remote-tracking branch 'remotes/sstabellini/tags/2015-10-19-tag' into staging
Peter Maydell [Mon, 19 Oct 2015 11:13:27 +0000 (12:13 +0100)]
Merge remote-tracking branch 'remotes/sstabellini/tags/2015-10-19-tag' into staging

Xen 2015-10-19

# gpg: Signature made Mon 19 Oct 2015 11:24:05 BST using RSA key ID 70E1AE90
# gpg: Good signature from "Stefano Stabellini <stefano.stabellini@eu.citrix.com>"

* remotes/sstabellini/tags/2015-10-19-tag:
  xen-platform: Ensure xen is enabled when initializing
  pc: Require xen when initializing xenfv machine

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8 years agoxen-platform: Ensure xen is enabled when initializing
Eduardo Habkost [Mon, 28 Sep 2015 20:01:24 +0000 (17:01 -0300)]
xen-platform: Ensure xen is enabled when initializing

The xen-platform code crashes on reset if the xen backend is not
initialized, because it calls xc_hvm_set_mem_type(). Ensure xen-platform
won't be created without initializing the xen backend.

The assert can't be triggered by the user because the device is not
hotpluggable, and the only code creating it (at pc_xen_hvm_init())
already checks xen_enabled().

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
8 years agopc: Require xen when initializing xenfv machine
Eduardo Habkost [Mon, 28 Sep 2015 20:01:23 +0000 (17:01 -0300)]
pc: Require xen when initializing xenfv machine

Without this check, the xen-platform device will crash on reset
if using the accel option with anything other than xen (e.g.
"-machine xenfv,accel=kvm").

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
8 years agoMerge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging
Peter Maydell [Mon, 19 Oct 2015 09:52:39 +0000 (10:52 +0100)]
Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging

* KVM page size fix for PPC
* Support for Linux 4.4's new Hyper-V features
* Eliminate g_slice from areas I maintain
* checkpatch fix
* Peter's cpu_reload_memory_map() cleanups
* More changes to MAINTAINERS
* Require Python 2.6
* chardev creation fixes
* PCI requester id for ARM KVM
* cleanups and doc fixes
* Allow customization of the Hyper-V vendor id

# gpg: Signature made Mon 19 Oct 2015 09:13:10 BST using RSA key ID 78C7AE83
# gpg: Good signature from "Paolo Bonzini <bonzini@gnu.org>"
# gpg:                 aka "Paolo Bonzini <pbonzini@redhat.com>"

* remotes/bonzini/tags/for-upstream: (49 commits)
  kvm: Allow the Hyper-V vendor ID to be specified
  kvm: Move x86-specific functions into target-i386/kvm.c
  kvm: Pass PCI device pointer to MSI routing functions
  hw/pci: Introduce pci_requester_id()
  kvm: Make KVM_CAP_SIGNAL_MSI globally available
  doc/rcu: fix g_free_rcu() usage example
  qemu-char: cleanup after completed conversion to cd->create
  qemu-char: convert ringbuf backend to data-driven creation
  qemu-char: convert vc backend to data-driven creation
  qemu-char: convert spice backend to data-driven creation
  qemu-char: convert console backend to data-driven creation
  qemu-char: convert stdio backend to data-driven creation
  qemu-char: convert testdev backend to data-driven creation
  qemu-char: convert braille backend to data-driven creation
  qemu-char: convert msmouse backend to data-driven creation
  qemu-char: convert mux backend to data-driven creation
  qemu-char: convert null backend to data-driven creation
  qemu-char: convert pty backend to data-driven creation
  qemu-char: convert UDP backend to data-driven creation
  qemu-char: convert socket backend to data-driven creation
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8 years agoMerge remote-tracking branch 'remotes/kraxel/tags/pull-audio-20151019-1' into staging
Peter Maydell [Mon, 19 Oct 2015 09:06:56 +0000 (10:06 +0100)]
Merge remote-tracking branch 'remotes/kraxel/tags/pull-audio-20151019-1' into staging

Remove macros IO_READ_PROTO and IO_WRITE_PROTO

# gpg: Signature made Mon 19 Oct 2015 09:19:21 BST 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-audio-20151019-1:
  Remove macros IO_READ_PROTO and IO_WRITE_PROTO

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8 years agokvm: Allow the Hyper-V vendor ID to be specified
Alex Williamson [Fri, 16 Oct 2015 15:38:22 +0000 (09:38 -0600)]
kvm: Allow the Hyper-V vendor ID to be specified

According to Microsoft documentation, the signature in the standard
hypervisor CPUID leaf at 0x40000000 identifies the Vendor ID and is
for reporting and diagnostic purposes only.  We can therefore allow
the user to change it to whatever they want, within the 12 character
limit.  Add a new hv-vendor-id option to the -cpu flag to allow
for this, ex:

 -cpu host,hv_time,hv-vendor-id=KeenlyKVM

Link: http://msdn.microsoft.com/library/windows/hardware/hh975392
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Message-Id: <20151016153356.28104.48612.stgit@gimli.home>
[Adjust error message to match the property name, use error_report. - Paolo]
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agokvm: Move x86-specific functions into target-i386/kvm.c
Thomas Huth [Thu, 15 Oct 2015 18:30:20 +0000 (20:30 +0200)]
kvm: Move x86-specific functions into target-i386/kvm.c

The functions for checking xcrs, xsave and pit_state2 are
only used on x86, so they should reside in target-i386/kvm.c.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Message-Id: <1444933820-6968-1-git-send-email-thuth@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agokvm: Pass PCI device pointer to MSI routing functions
Pavel Fedin [Thu, 15 Oct 2015 13:44:52 +0000 (16:44 +0300)]
kvm: Pass PCI device pointer to MSI routing functions

In-kernel ITS emulation on ARM64 will require to supply requester IDs.
These IDs can now be retrieved from the device pointer using new
pci_requester_id() function.

This patch adds pci_dev pointer to KVM GSI routing functions and makes
callers passing it.

x86 architecture does not use requester IDs, but hw/i386/kvm/pci-assign.c
also made passing PCI device pointer instead of NULL for consistency with
the rest of the code.

Signed-off-by: Pavel Fedin <p.fedin@samsung.com>
Message-Id: <ce081423ba2394a4efc30f30708fca07656bc500.1444916432.git.p.fedin@samsung.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agohw/pci: Introduce pci_requester_id()
Pavel Fedin [Thu, 15 Oct 2015 13:44:51 +0000 (16:44 +0300)]
hw/pci: Introduce pci_requester_id()

For GICv3 ITS implementation we are going to use requester IDs in KVM IRQ
routing code. This patch introduces reusable convenient way to obtain this
ID from the device pointer. The new function is now used in some places,
where the same calculation was used.

MemTxAttrs.stream_id also renamed to requester_id in order to better
reflect semantics of the field.

Signed-off-by: Pavel Fedin <p.fedin@samsung.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Message-Id: <5814bcb03a297f198e796b13ed9c35059c52f89b.1444916432.git.p.fedin@samsung.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agokvm: Make KVM_CAP_SIGNAL_MSI globally available
Pavel Fedin [Thu, 15 Oct 2015 13:44:50 +0000 (16:44 +0300)]
kvm: Make KVM_CAP_SIGNAL_MSI globally available

This capability is useful to determine whether we can use KVM ITS
emulation on ARM

Signed-off-by: Pavel Fedin <p.fedin@samsung.com>
Message-Id: <ff4ccb09b837d37defd639b885526949a25276de.1444916432.git.p.fedin@samsung.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agodoc/rcu: fix g_free_rcu() usage example
Sergey Fedorov [Wed, 14 Oct 2015 15:46:44 +0000 (18:46 +0300)]
doc/rcu: fix g_free_rcu() usage example

The first argument of g_free_rcu() is a pointer to a structure.  But
foo_reclaim is used as a function name in the previous example along
with &foo as a pointer to the structure being reclaimed.  Make the
example consistent with the previous one.

Signed-off-by: Sergey Fedorov <serge.fdrv@gmail.com>
Message-Id: <1444837604-13712-1-git-send-email-serge.fdrv@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agoqemu-char: cleanup after completed conversion to cd->create
Paolo Bonzini [Mon, 12 Oct 2015 07:51:41 +0000 (09:51 +0200)]
qemu-char: cleanup after completed conversion to cd->create

All backends now return errors through Error*, so the "Failed to
create chardev" placeholder error can only be reached if the backend
is not available (and only from the chardev-add QMP command; instead,
the -chardev command line option fails earlier).

Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agoqemu-char: convert ringbuf backend to data-driven creation
Paolo Bonzini [Tue, 29 Sep 2015 13:51:14 +0000 (15:51 +0200)]
qemu-char: convert ringbuf backend to data-driven creation

Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agoqemu-char: convert vc backend to data-driven creation
Paolo Bonzini [Tue, 29 Sep 2015 13:49:06 +0000 (15:49 +0200)]
qemu-char: convert vc backend to data-driven creation

Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agoqemu-char: convert spice backend to data-driven creation
Paolo Bonzini [Tue, 29 Sep 2015 13:45:47 +0000 (15:45 +0200)]
qemu-char: convert spice backend to data-driven creation

Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agoqemu-char: convert console backend to data-driven creation
Paolo Bonzini [Tue, 29 Sep 2015 13:42:04 +0000 (15:42 +0200)]
qemu-char: convert console backend to data-driven creation

Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agoqemu-char: convert stdio backend to data-driven creation
Paolo Bonzini [Tue, 29 Sep 2015 13:40:28 +0000 (15:40 +0200)]
qemu-char: convert stdio backend to data-driven creation

The backend now always returns errors via the Error* argument.
This avoids a double error message.  Before:

    qemu-system-x86_64: -chardev stdio,id=base: cannot use stdio with -daemonize
    qemu-system-x86_64: -chardev stdio,id=base: Failed to create chardev

After:

    qemu-system-x86_64: -chardev stdio,id=base: cannot use stdio with -daemonize

Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agoqemu-char: convert testdev backend to data-driven creation
Paolo Bonzini [Tue, 29 Sep 2015 13:33:42 +0000 (15:33 +0200)]
qemu-char: convert testdev backend to data-driven creation

Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agoqemu-char: convert braille backend to data-driven creation
Paolo Bonzini [Tue, 29 Sep 2015 13:31:26 +0000 (15:31 +0200)]
qemu-char: convert braille backend to data-driven creation

Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agoqemu-char: convert msmouse backend to data-driven creation
Paolo Bonzini [Tue, 29 Sep 2015 13:29:15 +0000 (15:29 +0200)]
qemu-char: convert msmouse backend to data-driven creation

Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agoqemu-char: convert mux backend to data-driven creation
Paolo Bonzini [Tue, 29 Sep 2015 13:27:24 +0000 (15:27 +0200)]
qemu-char: convert mux backend to data-driven creation

Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agoqemu-char: convert null backend to data-driven creation
Paolo Bonzini [Tue, 29 Sep 2015 13:24:29 +0000 (15:24 +0200)]
qemu-char: convert null backend to data-driven creation

Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agoqemu-char: convert pty backend to data-driven creation
Paolo Bonzini [Tue, 29 Sep 2015 13:23:42 +0000 (15:23 +0200)]
qemu-char: convert pty backend to data-driven creation

Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agoqemu-char: convert UDP backend to data-driven creation
Paolo Bonzini [Tue, 29 Sep 2015 13:17:20 +0000 (15:17 +0200)]
qemu-char: convert UDP backend to data-driven creation

Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agoqemu-char: convert socket backend to data-driven creation
Paolo Bonzini [Tue, 29 Sep 2015 13:15:53 +0000 (15:15 +0200)]
qemu-char: convert socket backend to data-driven creation

Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agoqemu-char: convert pipe backend to data-driven creation
Paolo Bonzini [Tue, 29 Sep 2015 13:14:07 +0000 (15:14 +0200)]
qemu-char: convert pipe backend to data-driven creation

Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agoqemu-char: convert parallel backend to data-driven creation
Paolo Bonzini [Mon, 12 Oct 2015 07:49:28 +0000 (09:49 +0200)]
qemu-char: convert parallel backend to data-driven creation

Conversion to Error * brings better error messages; before:

    qemu-system-x86_64: -chardev id=serial,backend=parallel,path=vl.c: Failed to create chardev

After:

    qemu-system-x86_64: -chardev id=serial,backend=parallel,path=vl.c: not a parallel port: Inappropriate ioctl for device

Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agoRemove macros IO_READ_PROTO and IO_WRITE_PROTO
Nutan Shinde [Wed, 7 Oct 2015 16:32:54 +0000 (22:02 +0530)]
Remove macros IO_READ_PROTO and IO_WRITE_PROTO

Signed-off-by: Nutan Shinde <nutanshinde1992@gmail.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
8 years agohw/ide/ahci.c: Fix shift left into sign bit
Peter Maydell [Fri, 16 Oct 2015 16:19:35 +0000 (17:19 +0100)]
hw/ide/ahci.c: Fix shift left into sign bit

Avoid undefined behaviour from shifting left into the sign bit:

hw/ide/ahci.c:551:36: runtime error: left shift of 255 by 24 places cannot be represented in type 'int'

(Unfortunately C's promotion rules mean that in the expression
"some_uint8_t_variable << 24" the LHS gets promoted to signed
int before shifting.)

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: John Snow <jsnow@redhat.com>
8 years agoMerge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging
Peter Maydell [Sat, 17 Oct 2015 21:14:52 +0000 (22:14 +0100)]
Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging

Block layer patches

# gpg: Signature made Fri 16 Oct 2015 14:36:50 BST using RSA key ID C88F2FD6
# gpg: Good signature from "Kevin Wolf <kwolf@redhat.com>"

* remotes/kevin/tags/for-upstream: (29 commits)
  blkdebug: Don't confuse image as backing file
  qcow2: Remove forward declaration of QCowAIOCB
  qemu-nbd: always compile in --aio=MODE option
  blockdev: always compile in -drive aio= parsing
  raw-posix: warn about BDRV_O_NATIVE_AIO if libaio is unavailable
  block: auto-generated node-names
  util - add automated ID generation utility
  blkverify: Fix BDS leak in .bdrv_open error path
  block: Allow bdrv_unref_child(bs, NULL)
  block: Remove bdrv_swap()
  block: Add and use bdrv_replace_in_backing_chain()
  blockjob: Store device name at job creation
  block: Implement bdrv_append() without bdrv_swap()
  block: Introduce parents list
  block-backend: Add blk_set_bs()
  block/io: Make bdrv_requests_pending() public
  block: Split bdrv_move_feature_fields()
  block: Manage backing file references in bdrv_set_backing_hd()
  block: Convert bs->backing_hd to BdrvChild
  block: Remove bdrv_open_image()
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8 years agoMerge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20151016' into...
Peter Maydell [Sat, 17 Oct 2015 11:31:33 +0000 (12:31 +0100)]
Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20151016' into staging

target-arm queue:
 * break TBs after ISB instructions
 * more support code for future implementation of EL2 and 64-bit EL3
 * tell guest if KVM is enabled in SMBIOS version string
 * implement OSLAR/OSLSR system registers
 * provide better help text for Sharp PDA machine names
 * rename imx25_pdk to imx25-pdk (since it has never been released
   with the underscore-version name)
 * fix MMIO writes in zynq_slcr
 * implement MDCR_EL2
 * virt: allow the guest to configure PCI BARs with zero PCI addresses
 * fix breakpoint handling code

# gpg: Signature made Fri 16 Oct 2015 14:56:15 BST 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-target-arm-20151016:
  target-arm: Fix CPU breakpoint handling
  target-arm: Fix GDB breakpoint handling
  target-arm: implement arm_debug_target_el()
  hw/arm/virt: Allow zero address for PCI IO space
  target-arm: Add MDCR_EL2
  misc: zynq_slcr: Fix MMIO writes
  arm: imx25-pdk: Fix machine name
  target-arm: Provide model numbers for Sharp PDAs
  target-arm: Implement AArch64 OSLAR/OSLSR_EL1 sysregs
  hw/arm/virt: smbios: inform guest of kvm
  target-arm: Avoid calling arm_el_is_aa64() function for unimplemented EL
  target-arm: Break the TB after ISB to execute self-modified code correctly
  target-arm: Add missing 'static' attribute

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8 years agoMerge remote-tracking branch 'remotes/pmaydell/tags/pull-cocoa-20151016' into staging
Peter Maydell [Fri, 16 Oct 2015 18:11:59 +0000 (19:11 +0100)]
Merge remote-tracking branch 'remotes/pmaydell/tags/pull-cocoa-20151016' into staging

cocoa queue:
 * fixes for compiler warnings
 * fix mouse cursor flickering

# gpg: Signature made Fri 16 Oct 2015 11:09:46 BST 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-cocoa-20151016:
  ui/cocoa.m: blinky mouse cursor fix
  ui/cocoa.m: addRemovableDevicesMenuItems() warning fix
  ui/cocoa.m: eliminate normalWindow warning

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8 years agoMerge remote-tracking branch 'remotes/armbru/tags/pull-qapi-2015-10-15' into staging
Peter Maydell [Fri, 16 Oct 2015 16:13:05 +0000 (17:13 +0100)]
Merge remote-tracking branch 'remotes/armbru/tags/pull-qapi-2015-10-15' into staging

QAPI patches

# gpg: Signature made Thu 15 Oct 2015 07:40:46 BST 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-2015-10-15:
  qapi: Track location that created an implicit type
  qapi: Create simple union type member earlier
  qapi: Lazy creation of array types
  qapi: Don't use info as witness of implicit object type
  qapi: Drop redundant args-member-array test
  qapi: Drop redundant flat-union-reverse-define test
  qapi: Drop redundant returns-int test
  qapi: Move empty-enum to compile-time test
  qapi: Drop redundant alternate-good test
  qapi: Prepare for errors during check()
  qapi: Use predicate callback to determine visit filtering
  qapi: Fix regression with '-netdev help'

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8 years agoMerge remote-tracking branch 'remotes/juanquintela/tags/migration/20151015' into...
Peter Maydell [Fri, 16 Oct 2015 14:47:59 +0000 (15:47 +0100)]
Merge remote-tracking branch 'remotes/juanquintela/tags/migration/20151015' into staging

migration/next for 20151015

# gpg: Signature made Thu 15 Oct 2015 07:25:27 BST using RSA key ID 5872D723
# gpg: Good signature from "Juan Quintela <quintela@redhat.com>"
# gpg:                 aka "Juan Quintela <quintela@trasno.org>"

* remotes/juanquintela/tags/migration/20151015:
  migration: fix deadlock
  migration: announce VM's new home just before VM is runnable
  Migration: Generate the completed event only when we complete

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8 years agotarget-arm: Fix CPU breakpoint handling
Sergey Fedorov [Tue, 13 Oct 2015 09:56:28 +0000 (12:56 +0300)]
target-arm: Fix CPU breakpoint handling

A QEMU breakpoint match is not definitely an architectural breakpoint
match. If an exception is generated unconditionally during translation,
it is hardly possible to ignore it in the debug exception handler.

Generate a call to a helper to check CPU breakpoints and raise an
exception only if any breakpoint matches architecturally.

Signed-off-by: Sergey Fedorov <serge.fdrv@gmail.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8 years agotarget-arm: Fix GDB breakpoint handling
Sergey Fedorov [Tue, 13 Oct 2015 09:56:27 +0000 (12:56 +0300)]
target-arm: Fix GDB breakpoint handling

GDB breakpoints have higher priority so they have to be checked first.
Should GDB breakpoint match, just return from the debug exception
handler.

Signed-off-by: Sergey Fedorov <serge.fdrv@gmail.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8 years agoblkdebug: Don't confuse image as backing file
Fam Zheng [Fri, 16 Oct 2015 10:46:04 +0000 (18:46 +0800)]
blkdebug: Don't confuse image as backing file

The word "backing file" nowadays refers to the backing_hd in the
external snapshot sense (i.e. bs->backing_hd), instead of the file sense
(bs->file). Correct the comment to use the right term.

Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Alberto Garcia <berto@igalia.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
8 years agoqcow2: Remove forward declaration of QCowAIOCB
Kevin Wolf [Fri, 10 Jul 2015 20:19:23 +0000 (22:19 +0200)]
qcow2: Remove forward declaration of QCowAIOCB

This struct doesn't exist any more since commit 3fc48d09 in August 2011,
it's about time to remove its forward declaration.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
8 years agoqemu-nbd: always compile in --aio=MODE option
Stefan Hajnoczi [Thu, 23 Jul 2015 12:48:36 +0000 (13:48 +0100)]
qemu-nbd: always compile in --aio=MODE option

The --aio=MODE option enables Linux AIO or Windows overlapped I/O.

The #ifdef CONFIG_LINUX_AIO was a layering violation that also prevented
Windows overlapped I/O from being used.

Now that raw-posix.c prints an error when Linux AIO has not been
compiled in, we can unconditionally compile the option into qemu-nbd.

After this patch qemu-nbd --aio=native works on Windows.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
8 years agoblockdev: always compile in -drive aio= parsing
Stefan Hajnoczi [Thu, 23 Jul 2015 12:48:35 +0000 (13:48 +0100)]
blockdev: always compile in -drive aio= parsing

CONFIG_LINUX_AIO is an implementation detail of raw-posix.c.  Don't
mention CONFIG_LINUX_AIO in blockdev.c.  Let block drivers decide what
to do with BDRV_O_NATIVE_AIO.  They may print an error if it is
unsupported.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
8 years agoraw-posix: warn about BDRV_O_NATIVE_AIO if libaio is unavailable
Stefan Hajnoczi [Thu, 23 Jul 2015 12:48:34 +0000 (13:48 +0100)]
raw-posix: warn about BDRV_O_NATIVE_AIO if libaio is unavailable

raw-posix.c silently ignores BDRV_O_NATIVE_AIO if libaio is unavailable.
It is confusing when aio=native performance is identical to aio=threads
because the binary was accidentally built without libaio.

Print a deprecation warning if -drive aio=native is used with a binary
that does not support libaio.  There are probably users using aio=native
who would be inconvenienced if QEMU suddenly refused to start their
guests.  In the future this will become an error.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
8 years agoblock: auto-generated node-names
Jeff Cody [Mon, 12 Oct 2015 23:36:50 +0000 (19:36 -0400)]
block: auto-generated node-names

If a node-name is not specified, automatically generate the node-name.

Generated node-names will use the "block" sub-system identifier.

Signed-off-by: Jeff Cody <jcody@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
8 years agoutil - add automated ID generation utility
Jeff Cody [Mon, 12 Oct 2015 23:36:49 +0000 (19:36 -0400)]
util - add automated ID generation utility

Multiple sub-systems in QEMU may find it useful to generate IDs
for objects that a user may reference via QMP or HMP.  This patch
presents a standardized way to do it, so that automatic ID generation
follows the same rules.

This patch enforces the following rules when generating an ID:

1.) Guarantee no collisions with a user-specified ID
2.) Identify the sub-system the ID belongs to
3.) Guarantee of uniqueness
4.) Spoiling predictability, to avoid creating an assumption
    of object ordering and parsing (i.e., we don't want users to think
    they can guess the next ID based on prior behavior).

The scheme for this is as follows (no spaces):

                # subsys D RR
Reserved char --|    |   | |
Subsystem String ----|   | |
Unique number (64-bit) --| |
Two-digit random number ---|

For example, a generated node-name for the block sub-system may look
like this:

    #block076

The caller of id_generate() is responsible for freeing the generated
node name string with g_free().

Reviewed-by: John Snow <jsnow@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Alberto Garcia <berto@igalia.com>
Signed-off-by: Jeff Cody <jcody@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
8 years agoblkverify: Fix BDS leak in .bdrv_open error path
Kevin Wolf [Tue, 13 Oct 2015 12:15:53 +0000 (14:15 +0200)]
blkverify: Fix BDS leak in .bdrv_open error path

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Jeff Cody <jcody@redhat.com>
8 years agoblock: Allow bdrv_unref_child(bs, NULL)
Kevin Wolf [Tue, 13 Oct 2015 12:09:44 +0000 (14:09 +0200)]
block: Allow bdrv_unref_child(bs, NULL)

bdrv_unref() can be called with a NULL argument and doesn't do anything
then. Make bdrv_unref_child() consistent with it.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Jeff Cody <jcody@redhat.com>
8 years agoblock: Remove bdrv_swap()
Kevin Wolf [Wed, 16 Sep 2015 14:18:38 +0000 (16:18 +0200)]
block: Remove bdrv_swap()

bdrv_swap() is unused now. Remove it and all functions that have
no other users than bdrv_swap(). In particular, this removes the
.bdrv_rebind callbacks from block drivers.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Alberto Garcia <berto@igalia.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
8 years agoblock: Add and use bdrv_replace_in_backing_chain()
Kevin Wolf [Tue, 15 Sep 2015 09:58:23 +0000 (11:58 +0200)]
block: Add and use bdrv_replace_in_backing_chain()

This cleans up the mess we left behind in the mirror code after the
previous patch. Instead of using bdrv_swap(), just change pointers.

The interface change of the mirror job that callers must consider is
that after job completion, their local BDS pointers still point to the
same node now. qemu-img must change its code accordingly (which makes it
easier to understand); the other callers stays unchanged because after
completion they don't do anything with the BDS, but just with the job,
and the job is still owned by the source BDS.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
8 years agoblockjob: Store device name at job creation
Kevin Wolf [Wed, 16 Sep 2015 11:34:54 +0000 (13:34 +0200)]
blockjob: Store device name at job creation

Some block jobs change the block device graph on completion. This means
that the device that owns the job and originally was addressed with its
device name may no longer be what the corresponding BlockBackend points
to.

Previously, the effects of bdrv_swap() ensured that the job was (at
least partially) transferred to the target image. Events that contain
the device name could still use bdrv_get_device_name(job->bs) and get
the same result.

After removing bdrv_swap(), this won't work any more. Instead, save the
device name at job creation and use that copy for QMP events and
anything else identifying the job.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Alberto Garcia <berto@igalia.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
8 years agoblock: Implement bdrv_append() without bdrv_swap()
Kevin Wolf [Thu, 18 Jun 2015 12:09:57 +0000 (14:09 +0200)]
block: Implement bdrv_append() without bdrv_swap()

Remember all parent nodes and just change the pointers there instead of
swapping the contents of the BlockDriverState.

Handling of snapshot=on must be moved further down in bdrv_open()
because *pbs (which is the bs pointer in the BlockBackend) must already
be set before bdrv_append() is called. Otherwise bdrv_append() changes
the BB's pointer to the temporary snapshot, but bdrv_open() overwrites
it with the read-only original image.

We also need to be careful to update callers as the interface changes
(becomes less insane): Previously, the meaning of the two parameters was
inverted when bdrv_append() returns. Now any BDS pointers keep pointing
to the same node.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
8 years agoblock: Introduce parents list
Kevin Wolf [Thu, 17 Sep 2015 11:18:23 +0000 (13:18 +0200)]
block: Introduce parents list

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
8 years agoblock-backend: Add blk_set_bs()
Kevin Wolf [Thu, 17 Sep 2015 11:01:50 +0000 (13:01 +0200)]
block-backend: Add blk_set_bs()

It allows changing the BlockDriverState that a BlockBackend points to.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Alberto Garcia <berto@igalia.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
8 years agoblock/io: Make bdrv_requests_pending() public
Kevin Wolf [Wed, 16 Sep 2015 14:08:17 +0000 (16:08 +0200)]
block/io: Make bdrv_requests_pending() public

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Alberto Garcia <berto@igalia.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
8 years agoblock: Split bdrv_move_feature_fields()
Kevin Wolf [Thu, 17 Sep 2015 10:33:26 +0000 (12:33 +0200)]
block: Split bdrv_move_feature_fields()

After bdrv_swap(), some fields must be moved back to their original BDS
to compensate for the effects that a swap of the contents of the objects
has while keeping the old addresses. Other fields must be moved back
because they should logically be moved and must stay on top

When replacing bdrv_swap() with operations changing the pointers in the
parents, we only need the latter and must avoid swapping the former.
Split the function accordingly.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Alberto Garcia <berto@igalia.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
8 years agoblock: Manage backing file references in bdrv_set_backing_hd()
Kevin Wolf [Mon, 14 Sep 2015 13:33:33 +0000 (15:33 +0200)]
block: Manage backing file references in bdrv_set_backing_hd()

This simplifies the code somewhat, especially when dropping whole
backing file subchains.

The exception is the mirroring code that does adventurous things with
bdrv_swap() and in order to keep it working, I had to duplicate most of
bdrv_set_backing_hd() locally. We'll get rid again of this ugliness
shortly.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Alberto Garcia <berto@igalia.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
8 years agoblock: Convert bs->backing_hd to BdrvChild
Kevin Wolf [Wed, 17 Jun 2015 12:55:21 +0000 (14:55 +0200)]
block: Convert bs->backing_hd to BdrvChild

This is the final step in converting all of the BlockDriverState
pointers that block drivers use to BdrvChild.

After this patch, bs->children contains the full list of child nodes
that are referenced by a given BDS, and these children are only
referenced through BdrvChild, so that updating the pointer in there is
enough for changing edges in the graph.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Alberto Garcia <berto@igalia.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
8 years agoblock: Remove bdrv_open_image()
Kevin Wolf [Tue, 16 Jun 2015 14:23:54 +0000 (16:23 +0200)]
block: Remove bdrv_open_image()

It is unused now.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Alberto Garcia <berto@igalia.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Jeff Cody <jcody@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
8 years agoblock: Convert bs->file to BdrvChild
Kevin Wolf [Tue, 16 Jun 2015 12:19:22 +0000 (14:19 +0200)]
block: Convert bs->file to BdrvChild

This patch removes the temporary duplication between bs->file and
bs->file_child by converting everything to BdrvChild.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Alberto Garcia <berto@igalia.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
8 years agoquorum: Convert to BdrvChild
Kevin Wolf [Tue, 16 Jun 2015 09:29:22 +0000 (11:29 +0200)]
quorum: Convert to BdrvChild

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Alberto Garcia <berto@igalia.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Jeff Cody <jcody@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
8 years agoblkverify: Convert s->test_file to BdrvChild
Kevin Wolf [Tue, 16 Jun 2015 09:13:47 +0000 (11:13 +0200)]
blkverify: Convert s->test_file to BdrvChild

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Alberto Garcia <berto@igalia.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Jeff Cody <jcody@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
8 years agovmdk: Use BdrvChild instead of BDS for references to extents
Kevin Wolf [Mon, 15 Jun 2015 11:50:20 +0000 (13:50 +0200)]
vmdk: Use BdrvChild instead of BDS for references to extents

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Alberto Garcia <berto@igalia.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Jeff Cody <jcody@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
8 years agoblock: Introduce BDS.file_child
Kevin Wolf [Mon, 15 Jun 2015 12:11:51 +0000 (14:11 +0200)]
block: Introduce BDS.file_child

Store the BdrvChild for bs->file. At this point, bs->file_child->bs just
duplicates the bs->file pointer. Later, it will completely replace it.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Alberto Garcia <berto@igalia.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Jeff Cody <jcody@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
8 years agoblock: qemu-iotests - fix vmdk test 059.out
Jeff Cody [Tue, 13 Oct 2015 00:18:07 +0000 (20:18 -0400)]
block: qemu-iotests - fix vmdk test 059.out

In commit fe646693acc13ac48b98435d14149ab04dc597bc, the option
printout format changed.

This updates the VMDK test 059.out to the correct output.

Signed-off-by: Jeff Cody <jcody@redhat.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
8 years agoqmp-commands.hx: Update the supported 'transaction' operations
Kashyap Chamarthy [Fri, 2 Oct 2015 12:12:34 +0000 (14:12 +0200)]
qmp-commands.hx: Update the supported 'transaction' operations

Although the canonical source of reference for QMP commands is
qapi-schema.json, for consistency's sake, update qmp-commands.hx to
state the list of supported transactionable operations, namely:

    drive-backup
    blockdev-backup
    blockdev-snapshot-internal-sync
    abort
    block-dirty-bitmap-add
    block-dirty-bitmap-clear

Also update the possible values for the "type" action array.

Signed-off-by: Kashyap Chamarthy <kchamart@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
8 years agothrottle: test that snapshots move the throttling configuration
Alberto Garcia [Thu, 17 Sep 2015 14:33:06 +0000 (17:33 +0300)]
throttle: test that snapshots move the throttling configuration

If a snapshot is performed on a device that has I/O limits they should
be moved to the target image (the new active layer).

Signed-off-by: Alberto Garcia <berto@igalia.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
8 years agoiotests: disable core dumps in test 061
Alberto Garcia [Mon, 28 Sep 2015 14:23:00 +0000 (17:23 +0300)]
iotests: disable core dumps in test 061

Commit 934659c460 disabled the supression of segmentation faults in
bash tests. The new output of test 061, however, assumes that a core
dump will be produced if a program aborts. This is not necessarily the
case because core dumps can be disabled using ulimit.

Since we cannot guarantee that abort() will produce a core dump, we
should use SIGKILL instead (that does not produce any) and update the
test output accordingly.

Signed-off-by: Alberto Garcia <berto@igalia.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
8 years agotarget-arm: implement arm_debug_target_el()
Sergey Fedorov [Mon, 14 Sep 2015 10:53:48 +0000 (13:53 +0300)]
target-arm: implement arm_debug_target_el()

Implement debug exception routing according to ARM ARM D2.3.1 Pseudocode
description of routing debug exceptions.

Signed-off-by: Sergey Fedorov <serge.fdrv@gmail.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8 years agohw/arm/virt: Allow zero address for PCI IO space
Alexander Gordeev [Fri, 16 Oct 2015 10:14:54 +0000 (11:14 +0100)]
hw/arm/virt: Allow zero address for PCI IO space

Currently PCI IO address 0 is not allowed even though
the IO space starts from 0. This update makes  PCI IO
address 0 usable.

CC: Peter Maydell <peter.maydell@linaro.org>
CC: Andrew Jones <drjones@redhat.com>
Signed-off-by: Alexander Gordeev <agordeev@redhat.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8 years agotarget-arm: Add MDCR_EL2
Sergey Fedorov [Fri, 16 Oct 2015 10:14:54 +0000 (11:14 +0100)]
target-arm: Add MDCR_EL2

Add the MDCR_EL2 register. We don't implement any of
the debug-related traps this register controls yet, so
currently it simply reads back as written.

Signed-off-by: Sergey Fedorov <serge.fdrv@gmail.com>
Message-id: 1444383794-16767-1-git-send-email-serge.fdrv@gmail.com
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
[PMM: tweaked commit message; moved non-dummy definition from
debug_cp_reginfo to el2_cp_reginfo.]
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8 years agomisc: zynq_slcr: Fix MMIO writes
Peter Crosthwaite [Fri, 16 Oct 2015 10:14:53 +0000 (11:14 +0100)]
misc: zynq_slcr: Fix MMIO writes

The /4 for offset calculation in MMIO writes was happening twice giving
wrong write offsets. Fix.

While touching the code, change the if-else to be a short returning if
and convert the debug message to a GUEST_ERROR, which is more accurate
for this condition.

Cc: qemu-stable@nongnu.org
Cc: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Peter Crosthwaite <crosthwaite.peter@gmail.com>
Reviewed-by: Alistair Francis <alistair.francis@xilinx.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8 years agoarm: imx25-pdk: Fix machine name
Peter Crosthwaite [Fri, 16 Oct 2015 10:14:53 +0000 (11:14 +0100)]
arm: imx25-pdk: Fix machine name

ARM uses dashes instead of underscores for machine names. Fix imx25_pdk
which has not seen a release yet (so there is no legacy yet).

Cc: Jean-Christophe Dubois <jcd@tribudubois.net>
Signed-off-by: Peter Crosthwaite <crosthwaite.peter@gmail.com>
Message-id: 1444445785-3648-1-git-send-email-crosthwaite.peter@gmail.com
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
[PMM: Added change to tests/ds1338-test.c to use new machine name]
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8 years agotarget-arm: Provide model numbers for Sharp PDAs
Ryo ONODERA [Fri, 16 Oct 2015 10:14:53 +0000 (11:14 +0100)]
target-arm: Provide model numbers for Sharp PDAs

* For Collie, Akita, Spitz, Borzoi, Terrier and Tosa PDAs, provide
  model numbers and manufacturer (Sharp) information.

Signed-off-by: Ryo ONODERA <ryo_on@yk.rim.or.jp>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8 years agotarget-arm: Implement AArch64 OSLAR/OSLSR_EL1 sysregs
Davorin Mista [Fri, 16 Oct 2015 10:14:53 +0000 (11:14 +0100)]
target-arm: Implement AArch64 OSLAR/OSLSR_EL1 sysregs

Added oslar_write function to OSLAR_EL1 sysreg, using a status variable
in ARMCPUState.cp15 struct (oslsr_el1). This variable is also linked
to the newly added read-only OSLSR_EL1 register.

Linux reads from this register during its suspend/resume procedure.

Signed-off-by: Davorin Mista <davorin.mista@aggios.com>
[PMM: folded a long line and tweaked a comment]
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8 years agohw/arm/virt: smbios: inform guest of kvm
Andrew Jones [Fri, 16 Oct 2015 10:14:53 +0000 (11:14 +0100)]
hw/arm/virt: smbios: inform guest of kvm

ARM/AArch64 KVM guests don't have any way to identify
themselves as KVM guests (x86 guests use a CPUID leaf). Now, we
could discuss all sorts of reasons why guests shouldn't need to
know that, but then there's always some case where it'd be
nice... Anyway, now that we have SMBIOS tables in ARM guests,
it's easy for the guest to know that it's a QEMU instance. This
patch takes that one step further, also identifying KVM, when
appropriate. Again, we could debate why generally nothing
should care whether it's of type QEMU or QEMU/KVM, but again,
sometimes it's nice to know...

Signed-off-by: Andrew Jones <drjones@redhat.com>
Reviewed-by: Wei Huang <wei@redhat.com>
Message-id: 1443017892-15567-1-git-send-email-drjones@redhat.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8 years agotarget-arm: Avoid calling arm_el_is_aa64() function for unimplemented EL
Sergey Sorokin [Fri, 16 Oct 2015 10:14:52 +0000 (11:14 +0100)]
target-arm: Avoid calling arm_el_is_aa64() function for unimplemented EL

It is incorrect to call arm_el_is_aa64() function for unimplemented EL.
This patch fixes several attempts to do so.

Signed-off-by: Sergey Sorokin <afarallax@yandex.ru>
[PMM: Reworked several of the comments to be more verbose.]
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8 years agotarget-arm: Break the TB after ISB to execute self-modified code correctly
Sergey Sorokin [Fri, 16 Oct 2015 10:14:52 +0000 (11:14 +0100)]
target-arm: Break the TB after ISB to execute self-modified code correctly

If any store instruction writes the code inside the same TB
after this store insn, the execution of the TB must be stopped
to execute new code correctly.
As described in ARMv8 manual D3.4.6 self-modifying code must do an
IC invalidation to be valid, and an ISB after it. So it's enough to end
the TB after ISB instruction on the code translation.
Also this TB break is necessary to take any pending interrupts immediately
after an ISB (as required by ARMv8 ARM D1.14.4).

Signed-off-by: Sergey Sorokin <afarallax@yandex.ru>
[PMM: tweaked commit message and comments slightly]
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8 years agotarget-arm: Add missing 'static' attribute
Stefan Weil [Fri, 16 Oct 2015 10:14:52 +0000 (11:14 +0100)]
target-arm: Add missing 'static' attribute

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Message-id: 1443213733-9807-1-git-send-email-sw@weilnetz.de
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8 years agoui/cocoa.m: blinky mouse cursor fix
John Arbuckle [Tue, 13 Oct 2015 20:51:18 +0000 (21:51 +0100)]
ui/cocoa.m: blinky mouse cursor fix

The mouse cursor can become blinky when being moved a lot. This patch fixes that
problem by issuing the redraw sooner.

Signed-off-by: John Arbuckle <programmingkidx@gmail.com>
Message-id: AAA87DD7-EC20-4F4B-B71E-C38461D9FCBA@gmail.com
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8 years agoui/cocoa.m: addRemovableDevicesMenuItems() warning fix
John Arbuckle [Tue, 13 Oct 2015 20:51:18 +0000 (21:51 +0100)]
ui/cocoa.m: addRemovableDevicesMenuItems() warning fix

Eliminate this warning associated with the addRemovableDevicesMenuItems()
function:

ui/cocoa.m:1344:13: warning: function declaration isn't a prototype
[-Wstrict-prototypes]
 static void addRemovableDevicesMenuItems()
             ^
ui/cocoa.m: In function 'addRemovableDevicesMenuItems':
ui/cocoa.m:1344:13: warning: old-style function definition [-Wold-style-definition]

Signed-off-by: John Arbuckle <programmingkidx@gmail.com>
Message-id: 7B365FC2-072B-4E8D-A1D9-922C2D691A83@gmail.com
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8 years agoqapi: Track location that created an implicit type
Eric Blake [Tue, 13 Oct 2015 04:22:32 +0000 (22:22 -0600)]
qapi: Track location that created an implicit type

A future patch will move some error checking from the parser
to the various QAPISchema*.check() methods, which run only
after parsing completes.  It will thus be possible to create
a python instance representing an implicit QAPI type that
parses fine but will fail validation during check().  Since
all errors have to have an associated 'info' location, we
need a location to be associated with those implicit types.
The intuitive info to use is the location of the enclosing
entity that caused the creation of the implicit type.

Note that we do not anticipate builtin types being used in
an error message (as they are not part of the user's QAPI
input, the user can't cause a semantic error in their
behavior), so we exempt those types from requiring info, by
setting a flag to track the completion of _def_predefineds(),
and tracking that flag in _def_entity().

No change to the generated code.

Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <1444710158-8723-13-git-send-email-eblake@redhat.com>
[Missing QAPISchemaArrayType.is_implicit() supplied]
Signed-off-by: Markus Armbruster <armbru@redhat.com>
8 years agoqapi: Create simple union type member earlier
Eric Blake [Tue, 13 Oct 2015 04:22:29 +0000 (22:22 -0600)]
qapi: Create simple union type member earlier

For simple unions, we were creating the implicit 'type' tag
member during the QAPISchemaObjectTypeVariants constructor.
This is different from every other implicit QAPISchemaEntity
object, which get created by QAPISchema methods.  Hoist the
creation to the caller (renaming _make_tag_enum() to
_make_implicit_tag()), and pass the entity rather than the
string name, so that we have the nice property that no
entities are created as a side effect within a different
entity.  A later patch will then have an easier time of
associating location info with each entity creation.

No change to generated code.

Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <1444710158-8723-10-git-send-email-eblake@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
8 years agoqapi: Lazy creation of array types
Eric Blake [Tue, 13 Oct 2015 04:22:28 +0000 (22:22 -0600)]
qapi: Lazy creation of array types

Commit ac88219a had several TODO markers about whether we needed
to automatically create the corresponding array type alongside
any other type.  It turns out that most of the time, we don't!

There are a few exceptions: 1) We have a few situations where we
use an array type in internal code but do not expose that type
through QMP; fix it by declaring a dummy type that forces the
generator to see that we want to use the array type.

2) The builtin arrays (such as intList for QAPI ['int']) must
always be generated, because of the way our QAPI_TYPES_BUILTIN
compile guard works: we have situations (at the very least
tests/test-qmp-output-visitor.c) that include both top-level
"qapi-types.h" (via "error.h") and a secondary
"test-qapi-types.h". If we were to only emit the builtin types
when used locally, then the first .h file would not include all
types, but the second .h does not declare anything at all because
the first .h set QAPI_TYPES_BUILTIN, and we would end up with
compilation error due to things like unknown type 'int8List'.

Actually, we may need to revisit how we do type guards, and
change from a single QAPI_TYPES_BUILTIN over to a different
usage pattern that does one #ifdef per qapi type - right now,
the only types that are declared multiple times between two qapi
.json files for inclusion by a single .c file happen to be the
builtin arrays.  But now that we have QAPI 'include' statements,
it is logical to assume that we will soon reach a point where
we want to reuse non-builtin types (yes, I'm thinking about what
it will take to add introspection to QGA, where we will want to
reuse the SchemaInfo type and friends).  One #ifdef per type
will help ensure that generating the same qapi type into more
than one qapi-types.h won't cause collisions when both are
included in the same .c file; but we also have to solve how to
avoid creating duplicate qapi-types.c entry points.  So that
is a problem left for another day.

Generated code for qapi-types and qapi-visit is drastically
reduced; less than a third of the arrays that were blindly
created were actually needed (a quick grep shows we dropped
from 219 to 69 *List types), and the .o files lost more than
30% of their bulk.  [For best results, diff the generated
files with 'git diff --patience --no-index pre post'.]

Interestingly, the introspection output is unchanged - this is
because we already cull all types that are not indirectly
reachable from a command or event, so introspection was already
using only a subset of array types.  The subset of types
introspected is now a much larger percentage of the overall set
of array types emitted in qapi-types.h (since the larger set
shrunk), but still not 100% (evidence that the array types
emitted for our new Dummy structs, and the new struct itself,
don't affect QMP).

Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <1444710158-8723-9-git-send-email-eblake@redhat.com>
[Moved array info tracking to a later patch]
Signed-off-by: Markus Armbruster <armbru@redhat.com>
8 years agoqapi: Don't use info as witness of implicit object type
Eric Blake [Tue, 13 Oct 2015 04:22:27 +0000 (22:22 -0600)]
qapi: Don't use info as witness of implicit object type

A future patch will enable error reporting from the various
QAPISchema*.check() methods.  But to report an error related
to an implicit type, we'll need to associate a location with
the type (the same location as the top-level entity that is
causing the creation of the implicit type), and once we do
that, keying off of whether foo.info exists is no longer a
viable way to determine if foo is an implicit type.

Instead, add an is_implicit() method to QAPISchemaEntity, and use it.
It can be overridden later for ObjectType and EnumType, when implicit
instances of those classes gain info.

Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <1444710158-8723-8-git-send-email-eblake@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
8 years agoqapi: Drop redundant args-member-array test
Eric Blake [Tue, 13 Oct 2015 18:26:47 +0000 (12:26 -0600)]
qapi: Drop redundant args-member-array test

qapi-schema-test already ensures that we can correctly compile
an array of enums (__org.qemu_x-command), an array of builtins
(UserDefNativeListUnion), and an array of structs (again
__org.qemu_x-command).  That means args-member-array is not
adding any additional parse-only test coverage, so drop it.

Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <1444760807-11307-1-git-send-email-eblake@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
8 years agoqapi: Drop redundant flat-union-reverse-define test
Eric Blake [Tue, 13 Oct 2015 04:22:26 +0000 (22:22 -0600)]
qapi: Drop redundant flat-union-reverse-define test

As of commit 8c3f8e77, we test compilation of forward references
for a struct base type (UserDefOne), flat union base type
(UserDefUnionBase), and flat union branch type
(UserDefFlatUnion2). The only remaining forward reference being
tested for parsing in flat-union-reverse-define was a forward
enum declaration.  Once we make sure that always compiles,
the smaller parse-only test is redundant and can be deleted.

Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <1444710158-8723-7-git-send-email-eblake@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
8 years agoqapi: Drop redundant returns-int test
Eric Blake [Tue, 13 Oct 2015 04:22:25 +0000 (22:22 -0600)]
qapi: Drop redundant returns-int test

qapi-schema-test was already testing that we could have a
command returning int, but burned a command name in the whitelist.
Merge the redundant positive test returns-int, and pick a name
that reduces the whitelist size.

Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <1444710158-8723-6-git-send-email-eblake@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
8 years agoqapi: Move empty-enum to compile-time test
Eric Blake [Tue, 13 Oct 2015 04:22:24 +0000 (22:22 -0600)]
qapi: Move empty-enum to compile-time test

Rather than just asserting that we can parse an empty enum,
let's also make sure we can compile it, by including it in
qapi-schema-test.

Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <1444710158-8723-5-git-send-email-eblake@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
8 years agoqapi: Drop redundant alternate-good test
Eric Blake [Tue, 13 Oct 2015 04:22:23 +0000 (22:22 -0600)]
qapi: Drop redundant alternate-good test

The alternate-good.json test was already covered by
qapi-schema-test.json.  As future commits will be tweaking
how alternates are laid out, removing the duplicate test now
reduces churn.

Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <1444710158-8723-4-git-send-email-eblake@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
8 years agoqapi: Prepare for errors during check()
Eric Blake [Tue, 13 Oct 2015 04:22:22 +0000 (22:22 -0600)]
qapi: Prepare for errors during check()

The next few patches will start migrating error checking from
ad hoc parse methods into the QAPISchema*.check() methods.  But
for an error message to display, we first have to fix the
overall 'try' to catch those errors.  We also want to enable a
few more assertions, such as making sure every attempt to
raise a semantic error is passed a valid location info, or that
various preconditions hold.

The general approach for moving error checking will then be to
relax an assertion into an if that raises an exception if the
condition does not hold, and removing the counterpart ad hoc
check done during the parse phase.

Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <1444710158-8723-3-git-send-email-eblake@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
8 years agoqapi: Use predicate callback to determine visit filtering
Eric Blake [Tue, 13 Oct 2015 04:22:21 +0000 (22:22 -0600)]
qapi: Use predicate callback to determine visit filtering

Previously, qapi-types and qapi-visit filtered out implicit
objects during visit_object_type() by using 'info' (works since
implicit objects do not [yet] have associated info); meanwhile
qapi-introspect filtered out all schema types on the first pass
by returning a python type from visit_begin(), which was then
used at a distance in QAPISchema.visit() to do the filtering.

Rather than keeping these ad hoc approaches, add a new visitor
callback visit_needed() which returns False to skip a given
entity, and which defaults to True unless overridden.  Use the
new mechanism to simplify all three filtering visitors.

No change to the generated code.

Suggested-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <1444710158-8723-2-git-send-email-eblake@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>