]> git.proxmox.com Git - mirror_qemu.git/log
mirror_qemu.git
7 years agosockets: Limit SocketAddressLegacy to external interfaces
Markus Armbruster [Wed, 26 Apr 2017 07:36:41 +0000 (09:36 +0200)]
sockets: Limit SocketAddressLegacy to external interfaces

SocketAddressLegacy is a simple union, and simple unions are awkward:
they have their variant members wrapped in a "data" object on the
wire, and require additional indirections in C.  SocketAddress is the
equivalent flat union.  Convert all users of SocketAddressLegacy to
SocketAddress, except for existing external interfaces.

See also commit fce5d53..9445673 and 85a82e8..c5f1ae3.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <1493192202-3184-7-git-send-email-armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
[Minor editing accident fixed, commit message and a comment tweaked]

Signed-off-by: Markus Armbruster <armbru@redhat.com>
7 years agosockets: Rename SocketAddressFlat to SocketAddress
Markus Armbruster [Wed, 26 Apr 2017 07:36:40 +0000 (09:36 +0200)]
sockets: Rename SocketAddressFlat to SocketAddress

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <1493192202-3184-6-git-send-email-armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
7 years agosockets: Rename SocketAddress to SocketAddressLegacy
Markus Armbruster [Wed, 26 Apr 2017 07:36:39 +0000 (09:36 +0200)]
sockets: Rename SocketAddress to SocketAddressLegacy

The next commit will rename SocketAddressFlat to SocketAddress, and
the commit after that will replace most uses of SocketAddressLegacy by
SocketAddress, replacing most of this commit's renames right back.

Note that checkpatch emits a few "line over 80 characters" warnings.
The long lines are all temporary; the SocketAddressLegacy replacement
will shorten them again.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <1493192202-3184-5-git-send-email-armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
7 years agoqapi: New QAPI_CLONE_MEMBERS()
Markus Armbruster [Wed, 26 Apr 2017 07:36:38 +0000 (09:36 +0200)]
qapi: New QAPI_CLONE_MEMBERS()

QAPI_CLONE() returns a newly allocated QAPI object.  Inconvenient when
we want to clone into an existing object.  QAPI_CLONE_MEMBERS() does
exactly that.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <1493192202-3184-4-git-send-email-armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
7 years agosockets: Prepare inet_parse() for flattened SocketAddress
Markus Armbruster [Wed, 26 Apr 2017 07:36:37 +0000 (09:36 +0200)]
sockets: Prepare inet_parse() for flattened SocketAddress

I'm going to flatten SocketAddress: rename SocketAddress to
SocketAddressLegacy, SocketAddressFlat to SocketAddress, eliminate
SocketAddressLegacy except in external interfaces.

inet_parse() returns a newly allocated InetSocketAddress.  Lift the
allocation from inet_parse() into its caller socket_parse() to prepare
for flattening SocketAddress.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <1493192202-3184-3-git-send-email-armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
[Straightforward rebase]

7 years agosockets: Prepare vsock_parse() for flattened SocketAddress
Markus Armbruster [Wed, 26 Apr 2017 07:36:36 +0000 (09:36 +0200)]
sockets: Prepare vsock_parse() for flattened SocketAddress

I'm going to flatten SocketAddress: rename SocketAddress to
SocketAddressLegacy, SocketAddressFlat to SocketAddress, eliminate
SocketAddressLegacy except in external interfaces.

vsock_parse() returns a newly allocated VsockSocketAddress.  Lift the
allocation from vsock_parse() into its caller socket_parse() to
prepare for flattening SocketAddress.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <1493192202-3184-2-git-send-email-armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
7 years agotest-qga: Actually test 0xff sync bytes
Eric Blake [Thu, 27 Apr 2017 21:58:21 +0000 (16:58 -0500)]
test-qga: Actually test 0xff sync bytes

Commit 62c39b3 introduced test-qga, and at face value, appears
to be testing the 'guest-sync' behavior that is recommended for
guests in sending 0xff to QGA to force the parser to reset.  But
this aspect of the test has never actually done anything: the
qmp_fd() call chain converts its string argument into QObject,
then converts that QObject back to the actual string that is
sent over the wire - and the conversion process silently drops
the 0xff byte from the string sent to QGA, thus never resetting
the QGA parser.

An upcoming patch will get rid of the wasteful round trip
through QObject, at which point the string in test-qga will be
directly sent over the wire.

But fixing qmp_fd() to actually send 0xff over the wire is not
all we have to do - the actual QMP parser loudly complains that
0xff is not valid JSON, and sends an error message _prior_ to
actually parsing the 'guest-sync' or 'guest-sync-delimited'
command.  With 'guest-sync', we cannot easily tell if this error
message is a result of our command - which is WHY we invented
the 'guest-sync-delimited' command.  So for the testsuite, fix
things to only check 0xff behavior on 'guest-sync-delimited',
and to loop until we've consumed all garbage prior to the
requested delimiter, which is compatible with the documented actions
that a real QGA client is supposed to do.

Ideally, we'd fix the QGA JSON parser to silently ignore 0xff
rather than sending an error message back, at which point we
could enhance this test for 'guest-sync' as well as for
'guest-sync-delimited'.  But for the sake of this patch, our
testing of 'guest-sync' is no worse than it was pre-patch,
because we have never been sending 0xff over the wire in the
first place.

Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20170427215821.19397-11-eblake@redhat.com>
Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com>
[Additional comment squashed in, along with matching commit message
update]
Signed-off-by: Markus Armbruster <armbru@redhat.com>
7 years agofdc-test: Avoid deprecated 'change' command
Eric Blake [Thu, 27 Apr 2017 21:58:20 +0000 (16:58 -0500)]
fdc-test: Avoid deprecated 'change' command

Use the preferred blockdev-change-medium command instead.

Also, use of 'device' is deprecated; adding an explicit id on
the command line lets us use 'id' for both blockdev-change-medium
and eject.

Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20170427215821.19397-10-eblake@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
7 years agoQemuOpts: Simplify qemu_opts_to_qdict()
Eric Blake [Thu, 27 Apr 2017 21:58:19 +0000 (16:58 -0500)]
QemuOpts: Simplify qemu_opts_to_qdict()

Noticed while investigating Coccinelle cleanups. There is no need
for a temporary variable when we can use the new macro to do the
same thing with less typing.

Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20170427215821.19397-9-eblake@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
7 years agoblock: Simplify bdrv_append_temp_snapshot() logic
Eric Blake [Thu, 27 Apr 2017 21:58:18 +0000 (16:58 -0500)]
block: Simplify bdrv_append_temp_snapshot() logic

Noticed while checking Coccinelle results. Naming a label 'out:'
when it is only used on error paths is weird.  Also, we had some
dead stores to 'ret'.  Meanwhile we know that snapshot_options
is NULL on success and that QDECREF(NULL) is safe.  So merge the
two exit paths into one by careful control over bs_snapshot.

Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20170427215821.19397-8-eblake@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
7 years agoqobject: Use simpler QDict/QList scalar insertion macros
Eric Blake [Thu, 27 Apr 2017 21:58:17 +0000 (16:58 -0500)]
qobject: Use simpler QDict/QList scalar insertion macros

We now have macros in place to make it less verbose to add a scalar
to QDict and QList, so use them.

Patch created mechanically via:
  spatch --sp-file scripts/coccinelle/qobject.cocci \
    --macro-file scripts/cocci-macro-file.h --dir . --in-place
then touched up manually to fix a couple of '?:' back to original
spacing, as well as avoiding a long line in monitor.c.

Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20170427215821.19397-7-eblake@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Alberto Garcia <berto@igalia.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
7 years agoqobject: Add helper macros for common scalar insertions
Eric Blake [Thu, 27 Apr 2017 21:58:16 +0000 (16:58 -0500)]
qobject: Add helper macros for common scalar insertions

Rather than making lots of callers wrap a scalar in a QInt, QString,
or QBool, provide helper macros that do the wrapping automatically.

Update the Coccinelle script to make mass conversions easy, although
the conversion itself will be done as a separate patches to ease
review and backport efforts.

Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20170427215821.19397-6-eblake@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
7 years agoqobject: Drop useless QObject casts
Eric Blake [Thu, 27 Apr 2017 21:58:15 +0000 (16:58 -0500)]
qobject: Drop useless QObject casts

We have macros in place to make it less verbose to add a subtype
of QObject to both QDict and QList. While we have made cleanups
like this in the past (see commit fcfcd8ffc, for example), having
it be automated by Coccinelle makes it easier to maintain.

Patch created mechanically via:
  spatch --sp-file scripts/coccinelle/qobject.cocci \
    --macro-file scripts/cocci-macro-file.h --dir . --in-place
then I verified that no manual touchups were required.

Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Alberto Garcia <berto@igalia.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20170427215821.19397-5-eblake@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
7 years agococcinelle: Add script to remove useless QObject casts
Eric Blake [Thu, 27 Apr 2017 21:58:14 +0000 (16:58 -0500)]
coccinelle: Add script to remove useless QObject casts

We have macros in place to make it less verbose to add a subtype
of QObject to both QDict and QList. While we have made cleanups
like this in the past (see commit fcfcd8ffc, for example), having
it be automated by Coccinelle makes it easier to maintain.

The script is separate from the cleanups, for ease of review and
backporting.  A later patch will then add further possible cleanups.

Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20170427215821.19397-4-eblake@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
7 years agopci: Reduce scope of error injection
Eric Blake [Thu, 27 Apr 2017 21:58:13 +0000 (16:58 -0500)]
pci: Reduce scope of error injection

No one outside of pcie_aer.h was using error injection; mark them
static for internal use.

Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Marcel Apfelbaum <marcel@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20170427215821.19397-3-eblake@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
7 years agopci: Use struct instead of QDict to pass back parameters
Eric Blake [Thu, 27 Apr 2017 21:58:12 +0000 (16:58 -0500)]
pci: Use struct instead of QDict to pass back parameters

It's simpler to just use a C struct than it is to bundle things
into a QDict in one function just to pull them back out in the
caller.  Plus, doing this gets rid of one more user of dynamic
JSON through qobject_from_jsonf(), as well as a memory leak of
the QDict.

While cleaning the code, fix things to report all errors (the
code was previously silently ignoring a failure of
pcie_aer_inject_error(), at a distance).

Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Marcel Apfelbaum <marcel@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20170427215821.19397-2-eblake@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
7 years agotest-keyval: fix leaks
Marc-André Lureau [Wed, 3 May 2017 22:38:42 +0000 (02:38 +0400)]
test-keyval: fix leaks

Spotted by ASAN.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20170503223846.6559-2-marcandre.lureau@redhat.com>
Reviewed-by: Eric blake <eblake@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
7 years agotests/check-qdict: Fix missing brackets
Dr. David Alan Gilbert [Thu, 6 Apr 2017 15:41:07 +0000 (16:41 +0100)]
tests/check-qdict: Fix missing brackets

Gcc 7 (on Fedora 26) spotted odd use of integers instead of a
boolean; it's got a point.

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Message-Id: <20170406154107.9178-1-dgilbert@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
7 years agoMerge remote-tracking branch 'elmarco/tags/chr-tests-pull-request' into staging
Stefan Hajnoczi [Fri, 5 May 2017 16:04:07 +0000 (17:04 +0100)]
Merge remote-tracking branch 'elmarco/tags/chr-tests-pull-request' into staging

# gpg: Signature made Thu 04 May 2017 12:42:10 PM BST
# gpg:                using RSA key 0xDAE8E10975969CE5
# gpg: Good signature from "Marc-André Lureau <marcandre.lureau@redhat.com>"
# gpg:                 aka "Marc-André Lureau <marcandre.lureau@gmail.com>"
# Primary key fingerprint: 87A9 BD93 3F87 C606 D276  F62D DAE8 E109 7596 9CE5

* elmarco/tags/chr-tests-pull-request: (21 commits)
  tests: add /char/console test
  tests: add /char/udp test
  tests: add /char/socket test
  tests: add /char/file test
  tests: add /char/pipe test
  tests: add alias check in /char/ringbuf
  char-udp: flush as much buffer as possible
  char-socket: add 'connected' property
  char-socket: add 'addr' property
  char-socket: update local address after listen
  char-socket: introduce update_disconnected_filename()
  char: useless NULL check
  char: remove chardevs list
  char: remove qemu_chardev_add
  char: use /chardevs container instead of chardevs list
  vl: add todo note about root container cleanup
  char: add a /chardevs container
  container: don't leak container reference
  xen: use a better chardev type check
  mux: simplfy muxes_realize_done
  ...

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
7 years agoMerge remote-tracking branch 'cohuck/tags/s390x-3270-20170504' into staging
Stefan Hajnoczi [Fri, 5 May 2017 15:56:23 +0000 (16:56 +0100)]
Merge remote-tracking branch 'cohuck/tags/s390x-3270-20170504' into staging

Basic support for using channel-attached 3270 'green-screen'
devices via tn3270. Actual handling of the data stream is
delegated to x3270; more info at http://wiki.qemu.org/Features/3270

# gpg: Signature made Thu 04 May 2017 11:36:51 AM BST
# gpg:                using RSA key 0xDECF6B93C6F02FAF
# gpg: Good signature from "Cornelia Huck <conny@cornelia-huck.de>"
# gpg:                 aka "Cornelia Huck <cohuck@kernel.org>"
# gpg:                 aka "Cornelia Huck <cornelia.huck@de.ibm.com>"
# gpg:                 aka "Cornelia Huck <huckc@linux.vnet.ibm.com>"
# Primary key fingerprint: C3D0 D66D C362 4FF6 A8C0  18CE DECF 6B93 C6F0 2FAF

* cohuck/tags/s390x-3270-20170504:
  s390x/3270: Mark non-migratable and enable the device
  s390x/3270: Detect for continued presence of a 3270 client
  s390x/3270: Add the TCP socket events handler for 3270
  s390x/3270: 3270 data stream handling
  s390x/3270: Add emulated terminal3270 device
  s390x/3270: Add abstract emulated ccw-attached 3270 device
  s390x/css: Add an algorithm to find a free chpid
  chardev: Basic support for TN3270

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
7 years agoMerge remote-tracking branch 'quintela/tags/migration/20170504' into staging
Stefan Hajnoczi [Fri, 5 May 2017 15:52:12 +0000 (16:52 +0100)]
Merge remote-tracking branch 'quintela/tags/migration/20170504' into staging

migration/next for 20170504

# gpg: Signature made Thu 04 May 2017 10:35:41 AM BST
# gpg:                using RSA key 0xF487EF185872D723
# gpg: Good signature from "Juan Quintela <quintela@redhat.com>"
# gpg:                 aka "Juan Quintela <quintela@trasno.org>"
# Primary key fingerprint: 1899 FF8E DEBF 58CC EE03  4B82 F487 EF18 5872 D723

* quintela/tags/migration/20170504:
  migration: Extra tracing
  migration: Move postcopy-ram.h to migration/
  monitor: Move hmp_info_snapshots from savevm.c to hmp.c
  monitor: Move hmp_delvm from savevm.c to hmp.c
  monitor: Move hmp_savevm from savevm.c to hmp.c
  monitor: Move hmp_loadvm from monitor.c to hmp.c
  monitor: Remove monitor parameter from save_vmstate
  migration: to_dst_file at that point is NULL
  migration: setup bi-directional I/O channel for exec: protocol
  ram: Split dirty bitmap by RAMBlock

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
7 years agoMerge remote-tracking branch 'kraxel/tags/pull-audio-20170504-1' into staging
Stefan Hajnoczi [Fri, 5 May 2017 15:46:51 +0000 (16:46 +0100)]
Merge remote-tracking branch 'kraxel/tags/pull-audio-20170504-1' into staging

audio: cleanups, bugfixes (memory leaks).

# gpg: Signature made Thu 04 May 2017 08:16:50 AM BST
# gpg:                using RSA key 0x4CB6D8EED3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>"
# gpg:                 aka "Gerd Hoffmann <gerd@kraxel.org>"
# gpg:                 aka "Gerd Hoffmann (private) <kraxel@gmail.com>"
# Primary key fingerprint: A032 8CFF B93A 17A7 9901  FE7D 4CB6 D8EE D3E8 7138

* kraxel/tags/pull-audio-20170504-1: (30 commits)
  audio: Use ARRAY_SIZE from qemu/osdep.h
  audio: un-export OPLResetChip
  audio: Remove unused typedefs
  audio: UpdateHandler is not used anymore
  audio: IRQHandler is not used anymore
  audio: OPLSetUpdateHandler is not used anywhere
  audio: OPLSetIRQHandler is not used anywhere
  audio: GUSsample is int16_t
  audio: GUSword is uint16_t
  audio: GUSword is uint16_t
  audio: remove GUSchar
  audio: GUSbyte is uint8_t
  audio: Remove unused fields
  audio: Remove type field
  audio: Remove Unused OPL_TYPE_*
  audio: Unfold OPLSAMPLE
  audio: Remove INT32
  audio: remove INT16
  audio: Remove INT8
  audio: remove UINT32
  ...

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
7 years agoMerge remote-tracking branch 'kraxel/tags/pull-input-20170504-1' into staging
Stefan Hajnoczi [Fri, 5 May 2017 15:30:59 +0000 (16:30 +0100)]
Merge remote-tracking branch 'kraxel/tags/pull-input-20170504-1' into staging

input: limit kbd queue depth
input: don't queue delay if paused
input: Add trace event for empty keyboard queue

# gpg: Signature made Thu 04 May 2017 06:48:37 AM BST
# gpg:                using RSA key 0x4CB6D8EED3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>"
# gpg:                 aka "Gerd Hoffmann <gerd@kraxel.org>"
# gpg:                 aka "Gerd Hoffmann (private) <kraxel@gmail.com>"
# Primary key fingerprint: A032 8CFF B93A 17A7 9901  FE7D 4CB6 D8EE D3E8 7138

* kraxel/tags/pull-input-20170504-1:
  input: Add trace event for empty keyboard queue
  input: don't queue delay if paused
  input: limit kbd queue depth

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
7 years agoMerge remote-tracking branch 'shorne/tags/pull-or-20170504' into staging
Stefan Hajnoczi [Fri, 5 May 2017 15:21:00 +0000 (16:21 +0100)]
Merge remote-tracking branch 'shorne/tags/pull-or-20170504' into staging

Openrisc Features and Fixes for qemu 2.10

# gpg: Signature made Thu 04 May 2017 01:41:45 AM BST
# gpg:                using RSA key 0xC3B31C2D5E6627E4
# gpg: Good signature from "Stafford Horne <shorne@gmail.com>"
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: D9C4 7354 AEF8 6C10 3A25  EFF1 C3B3 1C2D 5E66 27E4

* shorne/tags/pull-or-20170504:
  target/openrisc: Support non-busy idle state using PMR SPR
  target/openrisc: Remove duplicate features property
  target/openrisc: Implement full vmstate serialization
  migration: Add VMSTATE_STRUCT_2DARRAY()
  target/openrisc: implement shadow registers
  migration: Add VMSTATE_UINTTL_2DARRAY()
  target/openrisc: add numcores and coreid support
  target/openrisc: Fixes for memory debugging
  target/openrisc: Implement EPH bit
  target/openrisc: Implement EVBAR register
  MAINTAINERS: Add myself as openrisc maintainer

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
7 years agoMerge remote-tracking branch 'awilliam/tags/vfio-updates-20170503.0' into staging
Stefan Hajnoczi [Fri, 5 May 2017 15:14:08 +0000 (16:14 +0100)]
Merge remote-tracking branch 'awilliam/tags/vfio-updates-20170503.0' into staging

VFIO fixes 2017-05-03

 - Enable 8-byte memory region accesses (Jose Ricardo Ziviani)
 - Fix vfio-pci error message (Dong Jia Shi)

# gpg: Signature made Wed 03 May 2017 10:28:55 PM BST
# gpg:                using RSA key 0x239B9B6E3BB08B22
# gpg: Good signature from "Alex Williamson <alex.williamson@redhat.com>"
# gpg:                 aka "Alex Williamson <alex@shazbot.org>"
# gpg:                 aka "Alex Williamson <alwillia@redhat.com>"
# gpg:                 aka "Alex Williamson <alex.l.williamson@gmail.com>"
# Primary key fingerprint: 42F6 C04E 540B D1A9 9E7B  8A90 239B 9B6E 3BB0 8B22

* awilliam/tags/vfio-updates-20170503.0:
  vfio/pci: Fix incorrect error message
  vfio: enable 8-byte reads/writes to vfio
  vfio: Set MemoryRegionOps:max_access_size and min_access_size

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
7 years agoMerge remote-tracking branch 'cohuck/tags/s390x-20170502' into staging
Stefan Hajnoczi [Fri, 5 May 2017 14:59:56 +0000 (15:59 +0100)]
Merge remote-tracking branch 'cohuck/tags/s390x-20170502' into staging

More s390x patches, this time boot related:
- LOADPARM machine property, exposed to the guest via SCLP and
  diagnose 308
- Use LOADPARM in the s390-ccw bios to select a boot entry
- Fix a crash in the ipl device code when a virtio-scsi-pci device
  has been specified

# gpg: Signature made Tue 02 May 2017 02:29:26 PM BST
# gpg:                using RSA key 0xDECF6B93C6F02FAF
# gpg: Good signature from "Cornelia Huck <conny@cornelia-huck.de>"
# gpg:                 aka "Cornelia Huck <cohuck@kernel.org>"
# gpg:                 aka "Cornelia Huck <cornelia.huck@de.ibm.com>"
# gpg:                 aka "Cornelia Huck <huckc@linux.vnet.ibm.com>"
# Primary key fingerprint: C3D0 D66D C362 4FF6 A8C0  18CE DECF 6B93 C6F0 2FAF

* cohuck/tags/s390x-20170502:
  hw/s390x/ipl: Fix crash with virtio-scsi-pci device
  pc-bios/s390-ccw.img: update image
  pc-bios/s390-ccw: add boot entry selection to El Torito routine
  pc-bios/s390-ccw: add boot entry selection for ECKD DASD
  pc-bios/s390-ccw: provide entry selection on LOADPARM for SCSI disk
  pc-bios/s390-ccw: provide a function to interpret LOADPARM value
  pc-bios/s390-ccw: get LOADPARM stored in SCP Read Info
  pc-bios/s390-ccw: Make ebcdic/ascii conversion public
  util/qemu-config: Add loadparm to qemu machine_opts
  hw/s390x/sclp: update LOADPARM in SCP Info
  hw/s390x/ipl: enable LOADPARM in IPIB for a boot device
  hw/s390x: provide loadparm property for the machine

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
7 years agoMerge remote-tracking branch 'kwolf/tags/for-upstream' into staging
Stefan Hajnoczi [Thu, 4 May 2017 12:44:32 +0000 (13:44 +0100)]
Merge remote-tracking branch 'kwolf/tags/for-upstream' into staging

Block layer patches

# gpg: Signature made Fri 28 Apr 2017 09:20:17 PM BST
# gpg:                using RSA key 0x7F09B272C88F2FD6
# gpg: Good signature from "Kevin Wolf <kwolf@redhat.com>"
# Primary key fingerprint: DC3D EB15 9A9A F95D 3D74  56FE 7F09 B272 C88F 2FD6

* kwolf/tags/for-upstream: (34 commits)
  progress: Show current progress on SIGINFO
  iotests: fix exclusion option
  iotests: clarify help text
  qemu-img: use blk_co_pwrite_zeroes for zero sectors when compressed
  qemu-img: improve convert_iteration_sectors()
  block: assert no image modification under BDRV_O_INACTIVE
  block: fix obvious coding style mistakes in block_int.h
  qcow2: Allow discard of final unaligned cluster
  block: Add .bdrv_truncate() error messages
  block: Add errp to BD.bdrv_truncate()
  block: Add errp to b{lk,drv}_truncate()
  block/vhdx: Make vhdx_create() always set errp
  qemu-img: Document backing options
  qemu-img/convert: Move bs_n > 1 && -B check down
  qemu-img/convert: Use @opts for one thing only
  block: fix alignment calculations in bdrv_co_do_zero_pwritev
  block: Do not unref bs->file on error in BD's open
  iotests: 109: Filter out "len" of failed jobs
  iotests: Fix typo in 026
  Issue a deprecation warning if the user specifies the "-hdachs" option.
  ...

Message-id: 1493411622-5343-1-git-send-email-kwolf@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
7 years agotests: add /char/console test
Marc-André Lureau [Tue, 3 Jan 2017 18:55:55 +0000 (19:55 +0100)]
tests: add /char/console test

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
7 years agotests: add /char/udp test
Marc-André Lureau [Tue, 3 Jan 2017 18:22:19 +0000 (19:22 +0100)]
tests: add /char/udp test

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
7 years agotests: add /char/socket test
Marc-André Lureau [Tue, 3 Jan 2017 18:22:03 +0000 (19:22 +0100)]
tests: add /char/socket test

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
7 years agotests: add /char/file test
Marc-André Lureau [Tue, 3 Jan 2017 18:21:39 +0000 (19:21 +0100)]
tests: add /char/file test

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
7 years agotests: add /char/pipe test
Marc-André Lureau [Tue, 3 Jan 2017 18:20:05 +0000 (19:20 +0100)]
tests: add /char/pipe test

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
7 years agotests: add alias check in /char/ringbuf
Marc-André Lureau [Tue, 3 Jan 2017 18:21:09 +0000 (19:21 +0100)]
tests: add alias check in /char/ringbuf

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
7 years agochar-udp: flush as much buffer as possible
Marc-André Lureau [Fri, 23 Dec 2016 13:55:54 +0000 (14:55 +0100)]
char-udp: flush as much buffer as possible

Instead of flushing the buffer byte by byte, call qemu_chr_be_write()
with as much byte possible accepted by the front-end.

Factor out buffer flushing in a common function udp_chr_flush_buffer().

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
7 years agochar-socket: add 'connected' property
Marc-André Lureau [Wed, 21 Dec 2016 14:43:46 +0000 (15:43 +0100)]
char-socket: add 'connected' property

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
7 years agochar-socket: add 'addr' property
Marc-André Lureau [Wed, 21 Dec 2016 11:26:38 +0000 (12:26 +0100)]
char-socket: add 'addr' property

Add a property to lookup the connection details.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
7 years agochar-socket: update local address after listen
Marc-André Lureau [Tue, 20 Dec 2016 14:36:57 +0000 (15:36 +0100)]
char-socket: update local address after listen

This is mainly useful to know the actual bound port when using port 0.

For example, when starting qemu with socket on port 0, before:
QEMU waiting for connection on: disconnected:tcp:localhost:0,server
After:
QEMU waiting for connection on: disconnected:tcp:localhost:32454,server

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
7 years agochar-socket: introduce update_disconnected_filename()
Marc-André Lureau [Tue, 20 Dec 2016 14:32:31 +0000 (15:32 +0100)]
char-socket: introduce update_disconnected_filename()

This helper will be used in yet another place in the following patch.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
7 years agochar: useless NULL check
Marc-André Lureau [Wed, 14 Dec 2016 20:15:44 +0000 (23:15 +0300)]
char: useless NULL check

g_strdup(NULL) returns NULL already.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
7 years agochar: remove chardevs list
Marc-André Lureau [Wed, 14 Dec 2016 19:47:29 +0000 (22:47 +0300)]
char: remove chardevs list

The list is now empty, the chardev cleanup is taken care of by the unref
of the root container.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
7 years agochar: remove qemu_chardev_add
Marc-André Lureau [Wed, 14 Dec 2016 17:58:50 +0000 (20:58 +0300)]
char: remove qemu_chardev_add

qemu_chardev_new() now uses object_new_with_props() with /chardevs
parent container. It will fail to insert the object if the same "id"
already exists. "chardevs" list usage has been removed in previous
commits.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
7 years agochar: use /chardevs container instead of chardevs list
Marc-André Lureau [Wed, 14 Dec 2016 13:44:19 +0000 (16:44 +0300)]
char: use /chardevs container instead of chardevs list

Use object_resolve_path_component() and object_child_foreach() on
/chardevs container instead of iterating over chardevs list.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
7 years agovl: add todo note about root container cleanup
Marc-André Lureau [Fri, 10 Feb 2017 10:27:28 +0000 (14:27 +0400)]
vl: add todo note about root container cleanup

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
7 years agochar: add a /chardevs container
Marc-André Lureau [Wed, 14 Dec 2016 12:23:36 +0000 (15:23 +0300)]
char: add a /chardevs container

Add a /chardevs container object to hold the list of chardevs.
(Note: QTAILQ chardevs is going away in the following commits)

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
7 years agocontainer: don't leak container reference
Marc-André Lureau [Wed, 14 Dec 2016 19:42:55 +0000 (22:42 +0300)]
container: don't leak container reference

object_property_add_child() references the child, unref it after to
avoid ref leaks.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
7 years agoxen: use a better chardev type check
Marc-André Lureau [Wed, 14 Dec 2016 12:23:13 +0000 (15:23 +0300)]
xen: use a better chardev type check

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
7 years agomux: simplfy muxes_realize_done
Marc-André Lureau [Wed, 14 Dec 2016 11:40:45 +0000 (14:40 +0300)]
mux: simplfy muxes_realize_done

mux_chr_event() already send events to all backends, rename it,
export it, and use it from muxes_realize_done. This should help abstract
away mux implementation.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
7 years agochar: remove qemu_chr_be_generic_open
Marc-André Lureau [Wed, 14 Dec 2016 11:23:02 +0000 (14:23 +0300)]
char: remove qemu_chr_be_generic_open

The function simply alias and hides the real event function.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
7 years agomigration: Extra tracing
Dr. David Alan Gilbert [Wed, 26 Apr 2017 18:37:21 +0000 (19:37 +0100)]
migration: Extra tracing

A couple more traces that would have made fixing that postcopy
bug a bit easier.

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
7 years agomigration: Move postcopy-ram.h to migration/
Juan Quintela [Thu, 20 Apr 2017 11:12:24 +0000 (13:12 +0200)]
migration: Move postcopy-ram.h to migration/

It is internal to migration, not intended for other users.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
7 years agos390x/3270: Mark non-migratable and enable the device
Jing Liu [Thu, 12 Jan 2017 09:38:25 +0000 (10:38 +0100)]
s390x/3270: Mark non-migratable and enable the device

Mark 3270 as non-migratable for the experimental stage. Enable
the 3270 device so that we can use x3270 client to operate the guest.

Run qemu with the arguments:
    -chardev socket,id=char3270_0,host=0.0.0.0,port=23,nowait,server,tn3270 \
    -device x-terminal3270,chardev=char3270_0,devno=fe.0.000a,id=terminal3270_0 \

There are some restrictions for the first stage: We don't support SSL
connections, multiple client connections and client resizing. Only
tested with the x3270 client.

Signed-off-by: Jing Liu <liujbjl@linux.vnet.ibm.com>
Signed-off-by: Yang Chen <bjcyang@linux.vnet.ibm.com>
Reviewed-by: QingFeng Hao <haoqf@linux.vnet.ibm.com>
Reviewed-by: Dong Jia Shi <bjsdjshi@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
7 years agos390x/3270: Detect for continued presence of a 3270 client
Jing Liu [Fri, 14 Oct 2016 09:16:23 +0000 (11:16 +0200)]
s390x/3270: Detect for continued presence of a 3270 client

To ensure that we do not keep any 3270 sockets where the client is not
connected anymore, we send a packet with the timing mark option after
ten minutes of client inactivity. If the client does not answer it,
then the socket will be closed automatically.

This helps to ensure that there is no half-open situation on the 3270
socket.

Signed-off-by: Jing Liu <liujbjl@linux.vnet.ibm.com>
Reviewed-by: QingFeng Hao <haoqf@linux.vnet.ibm.com>
Reviewed-by: Dong Jia Shi <bjsdjshi@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
7 years agos390x/3270: Add the TCP socket events handler for 3270
Jing Liu [Thu, 21 Jul 2016 06:00:58 +0000 (08:00 +0200)]
s390x/3270: Add the TCP socket events handler for 3270

This introduces a chr_event handler to handle the 3270 connection
and disconnection events.

Signed-off-by: Jing Liu <liujbjl@linux.vnet.ibm.com>
Reviewed-by: QingFeng Hao <haoqf@linux.vnet.ibm.com>
Reviewed-by: Dong Jia Shi <bjsdjshi@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
7 years agos390x/3270: 3270 data stream handling
Jing Liu [Fri, 1 Apr 2016 06:32:58 +0000 (08:32 +0200)]
s390x/3270: 3270 data stream handling

This introduces the input and output handlers for 3270 device, setting
up the data tunnel among guest kernel, qemu and the 3270 client.

After the client connected and TN3270 handshake done, signal the not-ready
to ready status by an unsolicited device-end interrupt, and then the 3270
data stream could be handled correctly between the channel and socket.
Multiple commands generated by "Reset" key on x3270 are not supported now,
just simply terminate the connection.

Signed-off-by: Jing Liu <liujbjl@linux.vnet.ibm.com>
Signed-off-by: Yang Chen <bjcyang@linux.vnet.ibm.com>
Reviewed-by: QingFeng Hao <haoqf@linux.vnet.ibm.com>
Reviewed-by: Dong Jia Shi <bjsdjshi@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
7 years agos390x/3270: Add emulated terminal3270 device
Yang Chen [Fri, 19 Feb 2016 09:45:26 +0000 (10:45 +0100)]
s390x/3270: Add emulated terminal3270 device

This is a basic implementation of the emulated ccw-attached 3270
called x-terminal3270, which provides visibility of the device in
the qemu monitor and guest. The x prefix indicates that this is
just an experimental implementation for the current stage. This
device will not be compiled until the basic functions are available.

Signed-off-by: Yang Chen <bjcyang@linux.vnet.ibm.com>
Signed-off-by: Jing Liu <liujbjl@linux.vnet.ibm.com>
Reviewed-by: QingFeng Hao <haoqf@linux.vnet.ibm.com>
Reviewed-by: Dong Jia Shi <bjsdjshi@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
7 years agos390x/3270: Add abstract emulated ccw-attached 3270 device
Yang Chen [Mon, 19 Sep 2016 07:46:33 +0000 (09:46 +0200)]
s390x/3270: Add abstract emulated ccw-attached 3270 device

This introduces the infrastructure for the emulated 3270
devices, which will be attached to the virtual-css-bus.

Signed-off-by: Yang Chen <bjcyang@linux.vnet.ibm.com>
Signed-off-by: Jing Liu <liujbjl@linux.vnet.ibm.com>
Reviewed-by: QingFeng Hao <haoqf@linux.vnet.ibm.com>
Reviewed-by: Dong Jia Shi <bjsdjshi@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
7 years agos390x/css: Add an algorithm to find a free chpid
Jing Liu [Mon, 19 Sep 2016 07:10:43 +0000 (09:10 +0200)]
s390x/css: Add an algorithm to find a free chpid

This introduces a function named css_find_free_chpid() to find a
free channel path. Because virtio-ccw device used zero as its
channel path number, it would be sensible to skip the reserved one
and search upwards.

Signed-off-by: Jing Liu <liujbjl@linux.vnet.ibm.com>
Reviewed-by: QingFeng Hao <haoqf@linux.vnet.ibm.com>
Reviewed-by: Dong Jia Shi <bjsdjshi@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
7 years agochardev: Basic support for TN3270
Jing Liu [Fri, 23 Sep 2016 06:06:11 +0000 (08:06 +0200)]
chardev: Basic support for TN3270

This introduces basic support for TN3270, which needs to negotiate
three Telnet options during handshake:
  - End of Record
  - Binary Transmission
  - Terminal-Type

As a basic implementation, this simply ignores NOP and Interrupt
Process(IP) commands. More work should be done for them later.

For more details, please refer to RFC 854 and 1576.

Signed-off-by: Jing Liu <liujbjl@linux.vnet.ibm.com>
Signed-off-by: Yang Chen <bjcyang@linux.vnet.ibm.com>
Reviewed-by: QingFeng Hao <haoqf@linux.vnet.ibm.com>
Acked-by: Dong Jia Shi <bjsdjshi@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
7 years agomonitor: Move hmp_info_snapshots from savevm.c to hmp.c
Juan Quintela [Tue, 18 Apr 2017 09:51:06 +0000 (11:51 +0200)]
monitor: Move hmp_info_snapshots from savevm.c to hmp.c

It only uses block/* functions, nothing from migration.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Laurent Vivier <lvivier@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
7 years agomonitor: Move hmp_delvm from savevm.c to hmp.c
Juan Quintela [Tue, 18 Apr 2017 09:46:23 +0000 (11:46 +0200)]
monitor: Move hmp_delvm from savevm.c to hmp.c

It really uses block/* stuff, not migration one.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Laurent Vivier <lvivier@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
7 years agomonitor: Move hmp_savevm from savevm.c to hmp.c
Juan Quintela [Tue, 18 Apr 2017 09:44:16 +0000 (11:44 +0200)]
monitor: Move hmp_savevm from savevm.c to hmp.c

It is a monitor command, and has nothing migration specific in it.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Laurent Vivier <lvivier@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
7 years agomonitor: Move hmp_loadvm from monitor.c to hmp.c
Juan Quintela [Tue, 18 Apr 2017 09:40:56 +0000 (11:40 +0200)]
monitor: Move hmp_loadvm from monitor.c to hmp.c

We are going to move the rest of hmp snapshots functions there instead
of monitor.c.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Laurent Vivier <lvivier@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
7 years agomonitor: Remove monitor parameter from save_vmstate
Juan Quintela [Tue, 18 Apr 2017 09:35:04 +0000 (11:35 +0200)]
monitor: Remove monitor parameter from save_vmstate

load_vmstate() already use error_report, so be consistent.  There is
an identical error message in load_vmstate() that ends in a
period. Remove it.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Laurent Vivier <lvivier@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
7 years agomigration: to_dst_file at that point is NULL
Juan Quintela [Wed, 5 Apr 2017 15:32:56 +0000 (17:32 +0200)]
migration: to_dst_file at that point is NULL

We have just arrived as:

migration.c: qemu_migrate()
  ....
  s = migrate_init() <- puts it to NULL
  ....
  {tcp,unix}_start_outgoing_migration ->
     socket_outgoing_migration
        migration_channel_connect()
   sets to_dst_file

if tls is enabled, we do another round through
migrate_channel_tls_connect(), but we only set it up if there is no
error.  So we don't need the assignation.  I am removing it to remove
in the follwing patches the knowledge about MigrationState in that two
files.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Laurent Vivier <lvivier@redhat.com>
Reviewed-by: Daniel P. Berrange <berrange@redhat.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
7 years agomigration: setup bi-directional I/O channel for exec: protocol
Daniel P. Berrange [Fri, 21 Apr 2017 11:12:20 +0000 (12:12 +0100)]
migration: setup bi-directional I/O channel for exec: protocol

Historically the migration data channel has only needed to be
unidirectional. Thus the 'exec:' protocol was requesting an
I/O channel with O_RDONLY on incoming side, and O_WRONLY on
the outgoing side.

This is fine for classic migration, but if you then try to run
TLS over it, this fails because the TLS handshake requires a
bi-directional channel.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
7 years agoram: Split dirty bitmap by RAMBlock
Juan Quintela [Wed, 22 Mar 2017 14:18:04 +0000 (15:18 +0100)]
ram: Split dirty bitmap by RAMBlock

Both the ram bitmap and the unsent bitmap are split by RAMBlock.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: zhanghailiang <zhang.zhanghailiang@huawei.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
--

Fix compilation when DEBUG_POSTCOPY is enabled (thanks Hailiang)

7 years agoaudio: Use ARRAY_SIZE from qemu/osdep.h
Juan Quintela [Tue, 25 Apr 2017 22:37:39 +0000 (00:37 +0200)]
audio: Use ARRAY_SIZE from qemu/osdep.h

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-id: 20170425223739.6703-27-quintela@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
7 years agoaudio: un-export OPLResetChip
Juan Quintela [Tue, 25 Apr 2017 22:37:38 +0000 (00:37 +0200)]
audio: un-export OPLResetChip

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-id: 20170425223739.6703-26-quintela@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
7 years agoaudio: Remove unused typedefs
Juan Quintela [Tue, 25 Apr 2017 22:37:37 +0000 (00:37 +0200)]
audio: Remove unused typedefs

Signed-off-by: Juan Quintela <quintela@redhat.com>
Message-id: 20170425223739.6703-25-quintela@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
7 years agoaudio: UpdateHandler is not used anymore
Juan Quintela [Tue, 25 Apr 2017 22:37:36 +0000 (00:37 +0200)]
audio: UpdateHandler is not used anymore

Signed-off-by: Juan Quintela <quintela@redhat.com>
Message-id: 20170425223739.6703-24-quintela@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
7 years agoaudio: IRQHandler is not used anymore
Juan Quintela [Tue, 25 Apr 2017 22:37:35 +0000 (00:37 +0200)]
audio: IRQHandler is not used anymore

Signed-off-by: Juan Quintela <quintela@redhat.com>
Message-id: 20170425223739.6703-23-quintela@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
7 years agoaudio: OPLSetUpdateHandler is not used anywhere
Juan Quintela [Tue, 25 Apr 2017 22:37:34 +0000 (00:37 +0200)]
audio: OPLSetUpdateHandler is not used anywhere

Signed-off-by: Juan Quintela <quintela@redhat.com>
Message-id: 20170425223739.6703-22-quintela@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
7 years agoaudio: OPLSetIRQHandler is not used anywhere
Juan Quintela [Tue, 25 Apr 2017 22:37:33 +0000 (00:37 +0200)]
audio: OPLSetIRQHandler is not used anywhere

Signed-off-by: Juan Quintela <quintela@redhat.com>
Message-id: 20170425223739.6703-21-quintela@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
7 years agoaudio: GUSsample is int16_t
Juan Quintela [Tue, 25 Apr 2017 22:37:32 +0000 (00:37 +0200)]
audio: GUSsample is int16_t

Signed-off-by: Juan Quintela <quintela@redhat.com>
Message-id: 20170425223739.6703-20-quintela@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
7 years agoaudio: GUSword is uint16_t
Juan Quintela [Tue, 25 Apr 2017 22:37:31 +0000 (00:37 +0200)]
audio: GUSword is uint16_t

Signed-off-by: Juan Quintela <quintela@redhat.com>
Message-id: 20170425223739.6703-19-quintela@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
7 years agoaudio: GUSword is uint16_t
Juan Quintela [Tue, 25 Apr 2017 22:37:30 +0000 (00:37 +0200)]
audio: GUSword is uint16_t

Signed-off-by: Juan Quintela <quintela@redhat.com>
Message-id: 20170425223739.6703-18-quintela@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
7 years agoaudio: remove GUSchar
Juan Quintela [Tue, 25 Apr 2017 22:37:29 +0000 (00:37 +0200)]
audio: remove GUSchar

Signed-off-by: Juan Quintela <quintela@redhat.com>
Message-id: 20170425223739.6703-17-quintela@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
7 years agoaudio: GUSbyte is uint8_t
Juan Quintela [Tue, 25 Apr 2017 22:37:28 +0000 (00:37 +0200)]
audio: GUSbyte is uint8_t

Signed-off-by: Juan Quintela <quintela@redhat.com>
Message-id: 20170425223739.6703-16-quintela@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
7 years agoaudio: Remove unused fields
Juan Quintela [Tue, 25 Apr 2017 22:37:27 +0000 (00:37 +0200)]
audio: Remove unused fields

These were used for the remove stuff.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Message-id: 20170425223739.6703-15-quintela@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
7 years agoaudio: Remove type field
Juan Quintela [Tue, 25 Apr 2017 22:37:26 +0000 (00:37 +0200)]
audio: Remove type field

It was not used anymore as now there is only one type of devices.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Message-id: 20170425223739.6703-14-quintela@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
7 years agoaudio: Remove Unused OPL_TYPE_*
Juan Quintela [Tue, 25 Apr 2017 22:37:25 +0000 (00:37 +0200)]
audio: Remove Unused OPL_TYPE_*

Since we removed the previous unused devices, they are not used anymore.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Message-id: 20170425223739.6703-13-quintela@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
7 years agoaudio: Unfold OPLSAMPLE
Juan Quintela [Tue, 25 Apr 2017 22:37:24 +0000 (00:37 +0200)]
audio: Unfold OPLSAMPLE

It was used only once, and now it was always int16_t.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Message-id: 20170425223739.6703-12-quintela@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
7 years agoaudio: Remove INT32
Juan Quintela [Tue, 25 Apr 2017 22:37:23 +0000 (00:37 +0200)]
audio: Remove INT32

Signed-off-by: Juan Quintela <quintela@redhat.com>
Message-id: 20170425223739.6703-11-quintela@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
7 years agoaudio: remove INT16
Juan Quintela [Tue, 25 Apr 2017 22:37:22 +0000 (00:37 +0200)]
audio: remove INT16

Signed-off-by: Juan Quintela <quintela@redhat.com>
Message-id: 20170425223739.6703-10-quintela@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
7 years agoaudio: Remove INT8
Juan Quintela [Tue, 25 Apr 2017 22:37:21 +0000 (00:37 +0200)]
audio: Remove INT8

Signed-off-by: Juan Quintela <quintela@redhat.com>
Message-id: 20170425223739.6703-9-quintela@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
7 years agoaudio: remove UINT32
Juan Quintela [Tue, 25 Apr 2017 22:37:20 +0000 (00:37 +0200)]
audio: remove UINT32

Signed-off-by: Juan Quintela <quintela@redhat.com>
Message-id: 20170425223739.6703-8-quintela@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
7 years agoaudio: remove UINT16
Juan Quintela [Tue, 25 Apr 2017 22:37:19 +0000 (00:37 +0200)]
audio: remove UINT16

More modernitation.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Message-id: 20170425223739.6703-7-quintela@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
7 years agoaudio: Remove UINT8
Juan Quintela [Tue, 25 Apr 2017 22:37:18 +0000 (00:37 +0200)]
audio: Remove UINT8

uint8_t has existed since ..... all this century?

Signed-off-by: Juan Quintela <quintela@redhat.com>
Message-id: 20170425223739.6703-6-quintela@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
7 years agoaudio: YM3812 was always defined
Juan Quintela [Tue, 25 Apr 2017 22:37:17 +0000 (00:37 +0200)]
audio: YM3812 was always defined

So, remove the ifdefs.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Message-id: 20170425223739.6703-5-quintela@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
7 years agoaudio: Remove YM3526 support
Juan Quintela [Tue, 25 Apr 2017 22:37:16 +0000 (00:37 +0200)]
audio: Remove YM3526 support

It was never compiled in.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Message-id: 20170425223739.6703-4-quintela@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
7 years agoaudio: remove Y8950 configuration
Juan Quintela [Tue, 25 Apr 2017 22:37:15 +0000 (00:37 +0200)]
audio: remove Y8950 configuration

Include file has never been on qemu and it has been undefined from the very beginning.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Message-id: 20170425223739.6703-3-quintela@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
7 years agoadlib: Remove support for YMF262
Juan Quintela [Tue, 25 Apr 2017 22:37:14 +0000 (00:37 +0200)]
adlib: Remove support for YMF262

Notice that the code was supposed to be in the file ymf262.h, that has
never been on qemu source tree.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Message-id: 20170425223739.6703-2-quintela@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
7 years agoaudio: fix WAVState leak
Marc-André Lureau [Wed, 3 May 2017 22:38:44 +0000 (02:38 +0400)]
audio: fix WAVState leak

Spotted by ASAN.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-id: 20170503223846.6559-4-marcandre.lureau@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
7 years agoaudio: release capture buffers
Gerd Hoffmann [Fri, 28 Apr 2017 07:56:12 +0000 (09:56 +0200)]
audio: release capture buffers

AUD_add_capture() allocates two buffers which are never released.
Add the missing calls to AUD_del_capture().

Impact: Allows vnc clients to exhaust host memory by repeatedly
starting and stopping audio capture.

Fixes: CVE-2017-8309
Cc: P J P <ppandit@redhat.com>
Cc: Huawei PSIRT <PSIRT@huawei.com>
Reported-by: "Jiangxin (hunter, SCC)" <jiangxin1@huawei.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Prasad J Pandit <pjp@fedoraproject.org>
Message-id: 20170428075612.9997-1-kraxel@redhat.com

7 years agohw/audio: convert exit callback in HDACodecDeviceClass to void
Zihan Yang [Wed, 26 Apr 2017 12:53:08 +0000 (20:53 +0800)]
hw/audio: convert exit callback in HDACodecDeviceClass to void

The exit callback always return 0, convert it to void

Signed-off-by: Zihan Yang <tgnyang@gmail.com>
Message-id: 1493211188-24086-5-git-send-email-tgnyang@gmail.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
7 years agohw/audio: replace exit with unrealize in hda_codec_device_class_init
Zihan Yang [Wed, 26 Apr 2017 12:53:07 +0000 (20:53 +0800)]
hw/audio: replace exit with unrealize in hda_codec_device_class_init

The exit callback of DeviceClass will be removed in the future, so
convert to unrealize in the init functioin

Signed-off-by: Zihan Yang <tgnyang@gmail.com>
Message-id: 1493211188-24086-4-git-send-email-tgnyang@gmail.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
7 years agotarget/openrisc: Support non-busy idle state using PMR SPR
Stafford Horne [Sun, 23 Apr 2017 21:07:42 +0000 (06:07 +0900)]
target/openrisc: Support non-busy idle state using PMR SPR

The OpenRISC architecture has the Power Management Register (PMR)
special purpose register to manage cpu power states.  The interesting
modes are:

 * Doze Mode (DME) - Stop cpu except timer & pic - wake on interrupt
 * Sleep Mode (SME) - Stop cpu and all units - wake on interrupt
 * Suspend Model (SUME) - Stop cpu and all units - wake on reset

The linux kernel will set DME when idle.

This patch implements the PMR SPR and halts the qemu cpu when there is a
change to DME or SME.  This means that openrisc qemu in no longer peggs
a host cpu at 100%.

In order for this to work we need to kick the CPU when timers are
expired.  Update the cpu timer to kick the cpu upon each timer event.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Stafford Horne <shorne@gmail.com>
7 years agotarget/openrisc: Remove duplicate features property
Stafford Horne [Fri, 21 Apr 2017 15:28:55 +0000 (00:28 +0900)]
target/openrisc: Remove duplicate features property

The features property has stored the exact same thing as the cpucfgr
spr. Remove the feature enum and property as it is not needed.

In order to preserve the behavior or keeping features accross reset this
patch moves cpucfgr into the non reset region of the state struct.  Since
the cpucfgr is read only this means we only need to sset cpucfgr once
during class init.

Signed-off-by: Stafford Horne <shorne@gmail.com>
7 years agotarget/openrisc: Implement full vmstate serialization
Stafford Horne [Sun, 16 Apr 2017 10:44:58 +0000 (19:44 +0900)]
target/openrisc: Implement full vmstate serialization

Previously serialization did not persist the tlb, timer, pic and other
key state items.  This meant snapshotting and restoring a running os
would crash. After adding these I am able to take snapshots of a
running linux os and restore at a later time.

I am currently not trying to maintain capatibility with older versions
as I do not believe this really worked before or anyone used it.

Signed-off-by: Stafford Horne <shorne@gmail.com>
7 years agomigration: Add VMSTATE_STRUCT_2DARRAY()
Stafford Horne [Sun, 16 Apr 2017 10:43:23 +0000 (19:43 +0900)]
migration: Add VMSTATE_STRUCT_2DARRAY()

For openrisc we implement tlb state as a 2d array of tlb entry structs.
This is added to allow easy storing of state of 2d arrays.

Signed-off-by: Stafford Horne <shorne@gmail.com>