sdk/emulator/qemu.git
10 years agoMerge remote-tracking branch 'remotes/juanquintela/tags/migration/20140623' into...
Peter Maydell [Tue, 24 Jun 2014 14:33:42 +0000 (15:33 +0100)]
Merge remote-tracking branch 'remotes/juanquintela/tags/migration/20140623' into staging

migration/next for 20140623

# gpg: Signature made Mon 23 Jun 2014 18:18:57 BST using RSA key ID 5872D723
# gpg: Can't check signature: public key not found

* remotes/juanquintela/tags/migration/20140623: (22 commits)
  vmstate: Refactor & increase tests for primitive types
  vmstate: Return error in case of error
  migration: Remove unneeded minimum_version_id_old
  tests: vmstate static checker: add size mismatch inside substructure
  tests: vmstate static checker: add substructure for usb-kbd for hid section
  tests: vmstate static checker: remove Subsections
  tests: vmstate static checker: remove a subsection
  tests: vmstate static checker: remove Description inside Fields
  tests: vmstate static checker: remove Description
  tests: vmstate static checker: remove Fields
  tests: vmstate static checker: change description name
  tests: vmstate static checker: remove last field in a struct
  tests: vmstate static checker: remove a field
  tests: vmstate static checker: remove a section
  tests: vmstate static checker: minimum_version_id check
  tests: vmstate static checker: version mismatch inside a Description
  tests: vmstate static checker: add version error in main section
  tests: vmstate static checker: incompat machine types
  tests: vmstate static checker: add dump1 and dump2 files
  vmstate-static-checker: script to validate vmstate changes
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agoMerge remote-tracking branch 'remotes/qmp-unstable/queue/qmp' into staging
Peter Maydell [Tue, 24 Jun 2014 12:06:13 +0000 (13:06 +0100)]
Merge remote-tracking branch 'remotes/qmp-unstable/queue/qmp' into staging

* remotes/qmp-unstable/queue/qmp: (43 commits)
  monitor: protect event emission
  monitor: protect outbuf and mux_out with mutex
  qemu-char: make writes thread-safe
  qemu-char: move pty_chr_update_read_handler around
  qemu-char: do not call chr_write directly
  qemu-char: introduce qemu_chr_alloc
  qapi event: clean up
  qapi event: convert QUORUM events
  qapi event: convert GUEST_PANICKED
  qapi event: convert BALLOON_CHANGE
  qmp: convert ACPI_DEVICE_OST event
  qapi event: convert SPICE events
  qapi event: convert VNC events
  qapi event: convert NIC_RX_FILTER_CHANGED
  qapi event: convert other BLOCK_JOB events
  qapi event: convert BLOCK_IMAGE_CORRUPTED
  qapi event: convert BLOCK_IO_ERROR and BLOCK_JOB_ERROR
  qapi event: convert DEVICE_TRAY_MOVED
  qapi event: convert DEVICE_DELETED
  qapi event: convert WATCHDOG
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agoMerge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging
Peter Maydell [Tue, 24 Jun 2014 10:14:47 +0000 (11:14 +0100)]
Merge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging

pc,pci,vhost,net fixes, enhancements

Don's patches to limit below-4g ram for pc
Marcel's pcie hotplug rewrite
Gabriel's changes to e1000 auto-negotiation
qemu char bugfixes by Stefan
misc bugfixes

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
# gpg: Signature made Mon 23 Jun 2014 16:25:19 BST using RSA key ID D28D5469
# gpg: Good signature from "Michael S. Tsirkin <mst@kernel.org>"
# gpg:                 aka "Michael S. Tsirkin <mst@redhat.com>"

* remotes/mst/tags/for_upstream: (23 commits)
  xen-hvm: Handle machine opt max-ram-below-4g
  pc & q35: Add new machine opt max-ram-below-4g
  xen-hvm: Fix xen_hvm_init() to adjust pc memory layout
  pcie: coding style tweak
  hw/pcie: better hotplug/hotunplug support
  hw/pcie: implement power controller functionality
  hw/pcie: correct debug message
  q35: Use PC_Q35_COMPAT_1_4 on pc-q35-1.4 compat_props
  virtio-pci: Report an error when msix vectors init fails
  qemu-char: avoid leaking unused fds in tcp_get_msgfds()
  qemu-char: fix qemu_chr_fe_get_msgfd()
  qapi/string-output-visitor: fix human output
  e1000: factor out checking for auto-negotiation availability
  e1000: move e1000_autoneg_timer() to after set_ics()
  e1000: signal guest on successful link auto-negotiation
  e1000: improve auto-negotiation reporting via mii-tool
  e1000: emulate auto-negotiation during external link status change
  qtest: fix vhost-user-test unbalanced mutex locks
  qtest: fix qtest for vhost-user
  libqemustub: add more stubs for qemu-char
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agoMerge remote-tracking branch 'remotes/rth/tcg-ppc-merge-1' into staging
Peter Maydell [Mon, 23 Jun 2014 17:26:58 +0000 (18:26 +0100)]
Merge remote-tracking branch 'remotes/rth/tcg-ppc-merge-1' into staging

* remotes/rth/tcg-ppc-merge-1: (25 commits)
  tcg-ppc: Use the return address as a base pointer
  tcg-ppc: Merge cache-utils into the backend
  qemu/osdep: Remove the need for qemu_init_auxval
  tcg-ppc: Rename the tcg/ppc64 backend
  tcg-ppc: Remove the backend
  tcg-ppc64: Merge ppc32 shifts
  tcg-ppc64: Support mulsh_i32
  tcg-ppc64: Merge ppc32 register usage
  tcg-ppc64: Merge ppc32 qemu_ld/st
  tcg-ppc64: Merge ppc32 brcond2, setcond2, muluh
  tcg-ppc64: Begin merging ppc32 with ppc64
  tcg-ppc64: Fix sub2 implementation
  tcg-ppc64: Merge 32-bit ABIs into the prologue / frame code
  tcg-ppc64: Adjust tcg_out_call for ELFv2
  tcg-ppc64: Support the ppc64 elfv2 ABI
  tcg-ppc64: Use the correct test in tcg_out_call
  tcg-ppc64: Better parameterize the stack frame
  tcg-ppc64: Fix TCG_TARGET_CALL_STACK_OFFSET
  tcg-ppc64: Move call macros out of tcg-target.h
  tcg-ppc64: Make TCG_AREG0 and TCG_REG_CALL_STACK enum constants
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agovmstate: Refactor & increase tests for primitive types
Juan Quintela [Sat, 5 Apr 2014 18:12:51 +0000 (20:12 +0200)]
vmstate: Refactor & increase tests for primitive types

This commit refactor the simple tests to test all integer types. We
move to hex because it is easier to read values of different types.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
10 years agovmstate: Return error in case of error
Juan Quintela [Sat, 5 Apr 2014 18:16:22 +0000 (20:16 +0200)]
vmstate: Return error in case of error

If there is an error while loading a field, we should stop reading and
not continue with the rest of fields.  And we should also set an error
in qemu_file.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
10 years agomigration: Remove unneeded minimum_version_id_old
Juan Quintela [Tue, 10 Jun 2014 15:04:08 +0000 (17:04 +0200)]
migration: Remove unneeded minimum_version_id_old

Once there, make checkpatch happy.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
10 years agotests: vmstate static checker: add size mismatch inside substructure
Amit Shah [Fri, 20 Jun 2014 13:26:25 +0000 (18:56 +0530)]
tests: vmstate static checker: add size mismatch inside substructure

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
10 years agotests: vmstate static checker: add substructure for usb-kbd for hid section
Amit Shah [Fri, 20 Jun 2014 13:26:24 +0000 (18:56 +0530)]
tests: vmstate static checker: add substructure for usb-kbd for hid section

This shows how the script deals with substructures added to vmstate
descriptions that don't change the on-wire format.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
10 years agotests: vmstate static checker: remove Subsections
Amit Shah [Fri, 20 Jun 2014 13:26:23 +0000 (18:56 +0530)]
tests: vmstate static checker: remove Subsections

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
10 years agotests: vmstate static checker: remove a subsection
Amit Shah [Fri, 20 Jun 2014 13:26:22 +0000 (18:56 +0530)]
tests: vmstate static checker: remove a subsection

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
10 years agotests: vmstate static checker: remove Description inside Fields
Amit Shah [Fri, 20 Jun 2014 13:26:21 +0000 (18:56 +0530)]
tests: vmstate static checker: remove Description inside Fields

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
10 years agotests: vmstate static checker: remove Description
Amit Shah [Fri, 20 Jun 2014 13:26:20 +0000 (18:56 +0530)]
tests: vmstate static checker: remove Description

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
10 years agotests: vmstate static checker: remove Fields
Amit Shah [Fri, 20 Jun 2014 13:26:19 +0000 (18:56 +0530)]
tests: vmstate static checker: remove Fields

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
10 years agotests: vmstate static checker: change description name
Amit Shah [Fri, 20 Jun 2014 13:26:18 +0000 (18:56 +0530)]
tests: vmstate static checker: change description name

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
10 years agotests: vmstate static checker: remove last field in a struct
Amit Shah [Fri, 20 Jun 2014 13:26:17 +0000 (18:56 +0530)]
tests: vmstate static checker: remove last field in a struct

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
10 years agotests: vmstate static checker: remove a field
Amit Shah [Fri, 20 Jun 2014 13:26:16 +0000 (18:56 +0530)]
tests: vmstate static checker: remove a field

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
10 years agotests: vmstate static checker: remove a section
Amit Shah [Fri, 20 Jun 2014 13:26:15 +0000 (18:56 +0530)]
tests: vmstate static checker: remove a section

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
10 years agotests: vmstate static checker: minimum_version_id check
Amit Shah [Fri, 20 Jun 2014 13:26:14 +0000 (18:56 +0530)]
tests: vmstate static checker: minimum_version_id check

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
10 years agotests: vmstate static checker: version mismatch inside a Description
Amit Shah [Fri, 20 Jun 2014 13:26:13 +0000 (18:56 +0530)]
tests: vmstate static checker: version mismatch inside a Description

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Acked-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
10 years agotests: vmstate static checker: add version error in main section
Amit Shah [Fri, 20 Jun 2014 13:26:12 +0000 (18:56 +0530)]
tests: vmstate static checker: add version error in main section

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Acked-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
10 years agotests: vmstate static checker: incompat machine types
Amit Shah [Fri, 20 Jun 2014 13:26:11 +0000 (18:56 +0530)]
tests: vmstate static checker: incompat machine types

This commit modifies the dump2 data to flag incompatibilities in the
machine types being compared.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Acked-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
10 years agotests: vmstate static checker: add dump1 and dump2 files
Amit Shah [Fri, 20 Jun 2014 13:26:10 +0000 (18:56 +0530)]
tests: vmstate static checker: add dump1 and dump2 files

These are stripped-down JSON data as obtained from the -dump-vmstate
option.  The two files are identical in this commit, and will be
modified in the later commits to show what the script does with the
data.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Acked-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
10 years agovmstate-static-checker: script to validate vmstate changes
Amit Shah [Fri, 20 Jun 2014 13:26:09 +0000 (18:56 +0530)]
vmstate-static-checker: script to validate vmstate changes

This script compares the vmstate dumps in JSON format as output by QEMU
with the -dump-vmstate option.

It flags various errors, like version mismatch, sections going away,
size mismatches, etc.

This script is tolerant of a few changes that do not change the on-wire
format, like embedding a few fields within substructs.

The script takes -s/--src and -d/--dest parameters, to which filenames
are given as arguments.

Example:

(in a qemu 2.0 tree):
./x86_64-softmmu/qemu-system-x86_64 -dump-vmstate qemu-2.0.json

(in a qemu 2.2 tree:)
./x86_64-softmmu/qemu-system-x86_64 -dump-vmstate -M pc-i440fx-2.0 \
   qemu-2.2-m2.0.json

./scripts/vmstate-static-checker.py -s qemu-2.0.json -d qemu-2.2-m2.0.json

The script also takes a --reverse parameter to switch the src and dest
jsons.  This is just a shorthand for reversing the src and dest.

The --help parameter shows usage information.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
10 years agomigration: dump vmstate info as a json file for static analysis
Amit Shah [Fri, 20 Jun 2014 13:26:08 +0000 (18:56 +0530)]
migration: dump vmstate info as a json file for static analysis

This commit adds a new command, '-dump-vmstate', that takes a filename
as an argument.  When executed, QEMU will dump the vmstate information
for the machine type it's invoked with to the file, and quit.

The JSON-format output can then be used to compare the vmstate info for
different QEMU versions, specifically to test whether live migration
would break due to changes in the vmstate data.

A Python script that compares the output of such JSON dumps is included
in the following commit.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
10 years agordma: bug fixes
Michael R. Hines [Tue, 18 Feb 2014 02:34:06 +0000 (10:34 +0800)]
rdma: bug fixes

1. Fix small memory leak in parsing inet address from command line in data_init()
2. Fix ibv_post_send() return value check and pass error code back up correctly.
3. Fix rdma_destroy_qp() segfault after failure to connect to destination.

Reported-by: frank.yangjie@gmail.com
Reported-by: dgilbert@redhat.com
Signed-off-by: Michael R. Hines <mrhines@us.ibm.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
10 years agoMerge remote-tracking branch 'remotes/cohuck/tags/s390x-20140623-2' into staging
Peter Maydell [Mon, 23 Jun 2014 16:47:28 +0000 (17:47 +0100)]
Merge remote-tracking branch 'remotes/cohuck/tags/s390x-20140623-2' into staging

A couple of s390-ccw bios bugfixes: Fix booting for some bootmaps and get
the devices to a sane state before running the guest.

# gpg: Signature made Mon 23 Jun 2014 13:22:32 BST using RSA key ID C6F02FAF
# gpg: Can't check signature: public key not found

* remotes/cohuck/tags/s390x-20140623-2:
  pc-bios/s390-ccw: update s390-ccw.img binary
  pc-bios/s390-ccw: fix for fragmented SCSI bootmap
  pc-bios/s390-ccw: do a subsystem reset before running the guest
  pc-bios/s390-ccw: virtio_load_direct() can't load max number of sectors

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agomonitor: protect event emission
Paolo Bonzini [Wed, 18 Jun 2014 06:44:00 +0000 (08:44 +0200)]
monitor: protect event emission

Event emission must be protected by a mutex because of access to
the shared rate-limiting state, and to guard against concurrent
monitor "hot-plug" by means of human-monitor-command.

Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agomonitor: protect outbuf and mux_out with mutex
Paolo Bonzini [Wed, 18 Jun 2014 06:43:59 +0000 (08:43 +0200)]
monitor: protect outbuf and mux_out with mutex

This lets the block layer emit QMP events from outside the I/O thread.

Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agoqemu-char: make writes thread-safe
Paolo Bonzini [Wed, 18 Jun 2014 06:43:58 +0000 (08:43 +0200)]
qemu-char: make writes thread-safe

This will let threads other than the I/O thread raise QMP events.

GIOChannel is thread-safe, and send and receive state is usually
well-separated.  The only driver that requires some care is the
pty driver, where some of the state is shared by the read and write
sides.  That state is protected with the chr_write_lock too.

Reviewed-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agoqemu-char: move pty_chr_update_read_handler around
Paolo Bonzini [Wed, 18 Jun 2014 06:43:57 +0000 (08:43 +0200)]
qemu-char: move pty_chr_update_read_handler around

Reviewed-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agoqemu-char: do not call chr_write directly
Paolo Bonzini [Wed, 18 Jun 2014 06:43:56 +0000 (08:43 +0200)]
qemu-char: do not call chr_write directly

Make the mux always go through qemu_chr_fe_write, so that we'll get
the mutex for the underlying chardev.

Reviewed-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agoqemu-char: introduce qemu_chr_alloc
Paolo Bonzini [Wed, 18 Jun 2014 06:43:55 +0000 (08:43 +0200)]
qemu-char: introduce qemu_chr_alloc

The next patch will modify this function to initialize state that is
common to all backends.

Reviewed-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agoqapi event: clean up
Wenchao Xia [Wed, 18 Jun 2014 06:43:54 +0000 (08:43 +0200)]
qapi event: clean up

Signed-off-by: Wenchao Xia <wenchaoqemu@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agoqapi event: convert QUORUM events
Wenchao Xia [Wed, 18 Jun 2014 06:43:53 +0000 (08:43 +0200)]
qapi event: convert QUORUM events

Signed-off-by: Wenchao Xia <wenchaoqemu@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agoqapi event: convert GUEST_PANICKED
Wenchao Xia [Wed, 18 Jun 2014 06:43:52 +0000 (08:43 +0200)]
qapi event: convert GUEST_PANICKED

'monitor.h' is still included in target-s390x/kvm.c, since I have
no good way to verify whether other code need it on my x86 host.

Signed-off-by: Wenchao Xia <wenchaoqemu@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agoqapi event: convert BALLOON_CHANGE
Wenchao Xia [Wed, 18 Jun 2014 06:43:51 +0000 (08:43 +0200)]
qapi event: convert BALLOON_CHANGE

Signed-off-by: Wenchao Xia <wenchaoqemu@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agoqmp: convert ACPI_DEVICE_OST event
Igor Mammedov [Mon, 23 Jun 2014 13:26:57 +0000 (15:26 +0200)]
qmp: convert ACPI_DEVICE_OST event

... using new QAPI event infrastructure

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agoqapi event: convert SPICE events
Wenchao Xia [Wed, 18 Jun 2014 06:43:50 +0000 (08:43 +0200)]
qapi event: convert SPICE events

SPICE_INITIALIZED, SPICE_CONNECTED, SPICE_DISCONNECTED and
SPICE_MIGRATE_COMPLETED are converted in one patch, since they
use some common functions. inet_strfamily() is removed since no
callers exist anymore.

Note that there is no existing doc for SPICE_MIGRATE_COMPLETED
in docs/qmp/qmp-events.txt before this patch.

Signed-off-by: Wenchao Xia <wenchaoqemu@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agoqapi event: convert VNC events
Wenchao Xia [Wed, 18 Jun 2014 06:43:49 +0000 (08:43 +0200)]
qapi event: convert VNC events

Since VNC_CONNECTED, VNC_DISCONNECTED, VNC_INITIALIZED share some
common functions, convert them in one patch.

Signed-off-by: Wenchao Xia <wenchaoqemu@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agoqapi event: convert NIC_RX_FILTER_CHANGED
Wenchao Xia [Wed, 18 Jun 2014 06:43:48 +0000 (08:43 +0200)]
qapi event: convert NIC_RX_FILTER_CHANGED

Param name is declared as optional, since in code it is an optional
one.

Signed-off-by: Wenchao Xia <wenchaoqemu@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agoqapi event: convert other BLOCK_JOB events
Wenchao Xia [Wed, 18 Jun 2014 06:43:47 +0000 (08:43 +0200)]
qapi event: convert other BLOCK_JOB events

Since BLOCK_JOB_COMPLETED, BLOCK_JOB_CANCELLED, BLOCK_JOB_READY are
related, convert them in one patch. The block_job_event_* functions
are used to keep encapsulation of BlockJob structure.

Signed-off-by: Wenchao Xia <wenchaoqemu@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agoqapi event: convert BLOCK_IMAGE_CORRUPTED
Wenchao Xia [Wed, 18 Jun 2014 06:43:46 +0000 (08:43 +0200)]
qapi event: convert BLOCK_IMAGE_CORRUPTED

Signed-off-by: Wenchao Xia <wenchaoqemu@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agoqapi event: convert BLOCK_IO_ERROR and BLOCK_JOB_ERROR
Wenchao Xia [Wed, 18 Jun 2014 06:43:45 +0000 (08:43 +0200)]
qapi event: convert BLOCK_IO_ERROR and BLOCK_JOB_ERROR

Signed-off-by: Wenchao Xia <wenchaoqemu@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agoqapi event: convert DEVICE_TRAY_MOVED
Wenchao Xia [Wed, 18 Jun 2014 06:43:44 +0000 (08:43 +0200)]
qapi event: convert DEVICE_TRAY_MOVED

Signed-off-by: Wenchao Xia <wenchaoqemu@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agoqapi event: convert DEVICE_DELETED
Wenchao Xia [Wed, 18 Jun 2014 06:43:43 +0000 (08:43 +0200)]
qapi event: convert DEVICE_DELETED

Signed-off-by: Wenchao Xia <wenchaoqemu@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agoqapi event: convert WATCHDOG
Wenchao Xia [Wed, 18 Jun 2014 06:43:42 +0000 (08:43 +0200)]
qapi event: convert WATCHDOG

Signed-off-by: Wenchao Xia <wenchaoqemu@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agoqapi event: convert RTC_CHANGE
Wenchao Xia [Wed, 18 Jun 2014 06:43:41 +0000 (08:43 +0200)]
qapi event: convert RTC_CHANGE

This patch also eliminates build time warning caused by no caller
of monitor_qapi_event_throttle().

Signed-off-by: Wenchao Xia <wenchaoqemu@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agoqapi event: convert WAKEUP
Wenchao Xia [Wed, 18 Jun 2014 06:43:40 +0000 (08:43 +0200)]
qapi event: convert WAKEUP

Signed-off-by: Wenchao Xia <wenchaoqemu@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agoqapi event: convert SUSPEND_DISK
Wenchao Xia [Wed, 18 Jun 2014 06:43:39 +0000 (08:43 +0200)]
qapi event: convert SUSPEND_DISK

Signed-off-by: Wenchao Xia <wenchaoqemu@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agoqapi event: convert SUSPEND
Wenchao Xia [Wed, 18 Jun 2014 06:43:38 +0000 (08:43 +0200)]
qapi event: convert SUSPEND

Signed-off-by: Wenchao Xia <wenchaoqemu@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agoqapi event: convert RESUME
Wenchao Xia [Wed, 18 Jun 2014 06:43:37 +0000 (08:43 +0200)]
qapi event: convert RESUME

Signed-off-by: Wenchao Xia <wenchaoqemu@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agoxen-hvm: Handle machine opt max-ram-below-4g
Don Slutz [Fri, 20 Jun 2014 01:40:26 +0000 (21:40 -0400)]
xen-hvm: Handle machine opt max-ram-below-4g

This is the xen part of "pc & q35: Add new machine opt max-ram-below-4g"

Note: this machine option cannot be used to increase the amount
of ram below 4G.

Signed-off-by: Don Slutz <dslutz@verizon.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agopc & q35: Add new machine opt max-ram-below-4g
Don Slutz [Fri, 20 Jun 2014 01:40:25 +0000 (21:40 -0400)]
pc & q35: Add new machine opt max-ram-below-4g

This is a pc & q35 only machine opt.

If you add enough PCI devices then all mmio for them will not fit
below 4G which may not be the layout the user wanted. This allows
you to increase the below 4G address space that PCI devices can use
(aka decrease ram below 4G) and therefore in more cases not have any
mmio that is above 4G.

For example using "-machine pc,max-ram-below-4g=2G" on the command
line will limit the amount of ram that is below 4G to 2G.

Note: this machine option cannot be used to increase the amount
of ram below 4G.

Signed-off-by: Don Slutz <dslutz@verizon.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
MST: fix 32 bit

10 years agoqapi event: convert STOP
Wenchao Xia [Wed, 18 Jun 2014 06:43:36 +0000 (08:43 +0200)]
qapi event: convert STOP

Signed-off-by: Wenchao Xia <wenchaoqemu@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agoqapi event: convert RESET
Wenchao Xia [Wed, 18 Jun 2014 06:43:35 +0000 (08:43 +0200)]
qapi event: convert RESET

Signed-off-by: Wenchao Xia <wenchaoqemu@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agoqapi event: convert POWERDOWN
Wenchao Xia [Wed, 18 Jun 2014 06:43:34 +0000 (08:43 +0200)]
qapi event: convert POWERDOWN

There is no existing comments for POWERDOWN in doc/qmp/qmp-events.txt,
so no change on it like other conversion patch.

Signed-off-by: Wenchao Xia <wenchaoqemu@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agoqapi event: convert SHUTDOWN
Wenchao Xia [Wed, 18 Jun 2014 06:43:33 +0000 (08:43 +0200)]
qapi event: convert SHUTDOWN

This patch also eliminates build time warning caused by
QAPI_EVENT_MAX = 0.

Signed-off-by: Wenchao Xia <wenchaoqemu@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agoqapi: add new schema file qapi-event.json
Wenchao Xia [Wed, 18 Jun 2014 06:43:32 +0000 (08:43 +0200)]
qapi: add new schema file qapi-event.json

Signed-off-by: Wenchao Xia <wenchaoqemu@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agomonitor: add an implemention of qapi event emit method
Wenchao Xia [Wed, 18 Jun 2014 06:43:31 +0000 (08:43 +0200)]
monitor: add an implemention of qapi event emit method

The monitor is now hooked on the new event mechanism, so that later
patches can convert event callers one by one. Most code are copied from
old monitor_protocol_* functions with some modification.

Note that two build time warnings will be raised after this patch. One is
caused by no caller of monitor_qapi_event_throttle(), the other one is
caused by QAPI_EVENT_MAX = 0. They will be fixed automatically after
full event conversion later.

Signed-off-by: Wenchao Xia <wenchaoqemu@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agoqapi: adjust existing defines
Wenchao Xia [Wed, 18 Jun 2014 06:43:30 +0000 (08:43 +0200)]
qapi: adjust existing defines

In order to let event defines use existing types later, instead of
redefine new ones, some old type defines for spice and vnc are changed,
and BlockErrorAction is moved from block.h to qapi schema. Note that
BlockErrorAction is not merged with BlockdevOnError.

At this point, VncInfo is not made a child of VncBasicInfo, because
VncBasicInfo has mandatory fields where VncInfo makes them optional.

Signed-off-by: Wenchao Xia <wenchaoqemu@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agotest: add test cases for qapi event
Wenchao Xia [Wed, 18 Jun 2014 06:43:29 +0000 (08:43 +0200)]
test: add test cases for qapi event

These cases will verify whether the expected qdict is built.

Signed-off-by: Wenchao Xia <wenchaoqemu@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agoqapi script: add event support
Wenchao Xia [Wed, 18 Jun 2014 06:43:28 +0000 (08:43 +0200)]
qapi script: add event support

qapi-event.py will parse the schema and generate qapi-event.c, then
the API in qapi-event.c can be used to handle events in qemu code.
All API have prefix "qapi_event".

The script mainly includes two parts: generate API for each event
define, generate an enum type for all defined events.

Since in some cases the real emit behavior may change, for example,
qemu-img would not send a event, a callback layer is used to
control the behavior. As a result, the stubs at compile time
can be saved, the binding of block layer code and monitor code
will become looser.

Signed-off-by: Wenchao Xia <wenchaoqemu@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agoqapi: add event helper functions
Wenchao Xia [Wed, 18 Jun 2014 06:43:27 +0000 (08:43 +0200)]
qapi: add event helper functions

This file holds some functions that do not need to be generated.

Signed-off-by: Wenchao Xia <wenchaoqemu@gmail.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agoqapi: Add includes from qapi/ as dependencies
Max Reitz [Wed, 18 Jun 2014 06:43:26 +0000 (08:43 +0200)]
qapi: Add includes from qapi/ as dependencies

qapi-schema.json has been split into three smaller JSON files in qapi/.
Add them as dependencies for the code generation in the Makefile, so
changes to them will result in a rebuilt of all QAPI-dependent code.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agoos-posix: include sys/time.h
Wenchao Xia [Wed, 18 Jun 2014 06:43:25 +0000 (08:43 +0200)]
os-posix: include sys/time.h

Since gettimeofday() is used in this header file as a macro define,
include the function's define header file, to avoid compile warning
when other file include os-posix.h.

Signed-off-by: Wenchao Xia <wenchaoqemu@gmail.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agojson-lexer: fix escaped backslash in single-quoted string
Paolo Bonzini [Fri, 13 Jun 2014 08:13:02 +0000 (10:13 +0200)]
json-lexer: fix escaped backslash in single-quoted string

This made the lexer wait for a closing *double* quote.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Amos Kong <akong@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agoqapi: Suppress unwanted space between type and identifier
Amos Kong [Tue, 10 Jun 2014 11:25:53 +0000 (19:25 +0800)]
qapi: Suppress unwanted space between type and identifier

We always generate a space between type and identifier in parameter
and variable declarations, even when idiomatic C style doesn't have
a space there.  Suppress it.

Signed-off-by: Amos Kong <akong@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agoqapi: add const prefix to 'char *' insider c_type()
Amos Kong [Tue, 10 Jun 2014 11:25:52 +0000 (19:25 +0800)]
qapi: add const prefix to 'char *' insider c_type()

It's ugly to add const prefix for parameter type by an if statement
outside c_type(). This patch adds a parameter to do it.

Signed-off-by: Amos Kong <akong@redhat.com>
Suggested-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agoqapi: fix coding style in parameters list
Amos Kong [Tue, 10 Jun 2014 11:25:51 +0000 (19:25 +0800)]
qapi: fix coding style in parameters list

A space after * when declaring a pointer type is redundant.

Signed-off-by: Amos Kong <akong@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agoaudio: fmopl: drop INLINE macro
Luiz Capitulino [Thu, 19 Jun 2014 14:19:32 +0000 (10:19 -0400)]
audio: fmopl: drop INLINE macro

This commit expands all uses of the INLINE macro and drop it.

The reason for this is to avoid clashes with external libraries with
bad name conventions and also because renaming keywords is not a good
practice.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agofpu: softfloat: drop INLINE macro
Luiz Capitulino [Thu, 19 Jun 2014 14:13:43 +0000 (10:13 -0400)]
fpu: softfloat: drop INLINE macro

This commit expands all uses of the INLINE macro and drop it.

The reason for this is to avoid clashes with external libraries with
bad name conventions and also because renaming keywords is not a good
practice.

PS: I'm fine with this change to be licensed under softfloat-2a or
softfloat-2b.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
10 years agoxen-hvm: Fix xen_hvm_init() to adjust pc memory layout
Don Slutz [Fri, 20 Jun 2014 01:40:24 +0000 (21:40 -0400)]
xen-hvm: Fix xen_hvm_init() to adjust pc memory layout

This is just below_4g_mem_size and above_4g_mem_size which is used later in QEMU.

Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Don Slutz <dslutz@verizon.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agopcie: coding style tweak
Michael S. Tsirkin [Mon, 23 Jun 2014 14:36:55 +0000 (17:36 +0300)]
pcie: coding style tweak

- whitespace fix
- unnecessary != 0 in a condition

Cc: Marcel Apfelbaum <marcel.a@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agohw/pcie: better hotplug/hotunplug support
Marcel Apfelbaum [Mon, 23 Jun 2014 14:32:49 +0000 (17:32 +0300)]
hw/pcie: better hotplug/hotunplug support

The current code is broken: it does surprise removal which crashes guests.

Reimplemented the steps:
 - Hotplug triggers both 'present detect change' and
   'attention button pressed'.

 - Hotunplug starts by triggering 'attention button pressed',
   then waits for the OS to power off the device and only
   then detaches it.

Fixes CVE-2014-3471.

Signed-off-by: Marcel Apfelbaum <marcel.a@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agohw/pcie: implement power controller functionality
Marcel Apfelbaum [Mon, 23 Jun 2014 14:32:48 +0000 (17:32 +0300)]
hw/pcie: implement power controller functionality

It is needed by hot-unplug in order to get an indication
from the OS when the device can be physically detached.

Signed-off-by: Marcel Apfelbaum <marcel.a@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agohw/pcie: correct debug message
Marcel Apfelbaum [Mon, 23 Jun 2014 14:32:47 +0000 (17:32 +0300)]
hw/pcie: correct debug message

Trivial issue, discovered while debugging.

Signed-off-by: Marcel Apfelbaum <marcel.a@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agoq35: Use PC_Q35_COMPAT_1_4 on pc-q35-1.4 compat_props
Eduardo Habkost [Fri, 13 Jun 2014 03:28:32 +0000 (00:28 -0300)]
q35: Use PC_Q35_COMPAT_1_4 on pc-q35-1.4 compat_props

pc-q35-1.4 was incorrectly using PC_COMPAT_1_4 instead of
PC_Q35_COMPAT_1_4.

The only side-effect was that the hpet compat property (inherited from
PC_Q35_COMPAT_1_7) was missing.

Without this patch, pc-q35-1.4 inicorrectly initializes hpet-intcap to
0xff0104 (behavior introduced in QEMU 2.0, by commit
7a10ef51c2397ac4323bc786af02c58b413b5cd2).

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
10 years agovirtio-pci: Report an error when msix vectors init fails
Fam Zheng [Mon, 23 Jun 2014 09:06:25 +0000 (17:06 +0800)]
virtio-pci: Report an error when msix vectors init fails

Currently vectors silently cleared to 0 if the initialization is failed,
but user should at least have one way to notice this.

Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agoqemu-char: avoid leaking unused fds in tcp_get_msgfds()
Stefan Hajnoczi [Sun, 22 Jun 2014 02:38:37 +0000 (10:38 +0800)]
qemu-char: avoid leaking unused fds in tcp_get_msgfds()

Commit c76bf6bb8fbbb233a7d3641e09229d23747d5ee3 ("Add chardev API
qemu_chr_fe_get_msgfds") extended the get_msgfds API from one to
multiple file descriptors.  It forgot to close unused file descriptors
before freeing the file descriptor array.

This patch prevents a file descriptor leak if the tcp_get_msgfds()
callers requests fewer file descriptors than are available.

Cc: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agoqemu-char: fix qemu_chr_fe_get_msgfd()
Stefan Hajnoczi [Sun, 22 Jun 2014 02:38:36 +0000 (10:38 +0800)]
qemu-char: fix qemu_chr_fe_get_msgfd()

Commit c76bf6bb8fbbb233a7d3641e09229d23747d5ee3 ("Add chardev API
qemu_chr_fe_get_msgfds") broke qemu_chr_fe_get_msgfd() because it
changed the return value.

Callers expect -1 if no fd is available.  The commit changed the return
value to 0 (which is a valid file descriptor number) so callers always
detected a file descriptor even if none was available.

This patch fixes qemu-iotests 045:

  $ cd tests/qemu-iotests && ./check 045
  [...]
  +FAIL: test_add_fd_invalid_fd (__main__.TestFdSets)
  +----------------------------------------------------------------------
  +Traceback (most recent call last):
  +  File "./045", line 123, in test_add_fd_invalid_fd
  +    self.assert_qmp(result, 'error/class', 'GenericError')
  +  File "/home/stefanha/qemu/tests/qemu-iotests/iotests.py", line 232, in assert_qmp
  +    result = self.dictpath(d, path)
  +  File "/home/stefanha/qemu/tests/qemu-iotests/iotests.py", line 211, in dictpath
  +    self.fail('failed path traversal for "%s" in "%s"' % (path, str(d)))
  +AssertionError: failed path traversal for "error/class" in "{u'return': {u'fdset-id': 2, u'fd': 0}}"

Cc: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agoqapi/string-output-visitor: fix human output
Hu Tao [Fri, 20 Jun 2014 05:55:42 +0000 (13:55 +0800)]
qapi/string-output-visitor: fix human output

"0x1-0x10" looks better than "0x1-10"

Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
10 years agoe1000: factor out checking for auto-negotiation availability
Gabriel L. Somlo [Thu, 19 Jun 2014 19:40:51 +0000 (15:40 -0400)]
e1000: factor out checking for auto-negotiation availability

Also fix minor indentation issues in the surrounding code.

Suggested-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Gabriel Somlo <somlo@cmu.edu>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agoe1000: move e1000_autoneg_timer() to after set_ics()
Gabriel L. Somlo [Thu, 19 Jun 2014 15:55:35 +0000 (11:55 -0400)]
e1000: move e1000_autoneg_timer() to after set_ics()

Enable calling set_ics() from within e1000_autoneg_timer() without
the need for a forward declaration.

This patch contains no functional changes.

Signed-off-by: Gabriel Somlo <somlo@cmu.edu>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agoe1000: signal guest on successful link auto-negotiation
Gabriel L. Somlo [Thu, 19 Jun 2014 15:55:36 +0000 (11:55 -0400)]
e1000: signal guest on successful link auto-negotiation

Generate a link status change interrupt once link auto-netotiation
is successfully completed. This does not affect Linux and Windows
(XP and 7 tested) in any way, but is needed by the stock OS X driver
(AppleIntel8254XEthernet.kext), which would otherwise fail to notice
the link status change event.

Signed-off-by: Gabriel Somlo <somlo@cmu.edu>
Reviewed-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agoe1000: improve auto-negotiation reporting via mii-tool
Gabriel L. Somlo [Thu, 19 Jun 2014 15:55:34 +0000 (11:55 -0400)]
e1000: improve auto-negotiation reporting via mii-tool

Using mii-tool (on F20-live), the following output is produced:

  SIOCGMIIREG on ens3 failed: Input/output error
  ens3: no autonegotiation, 1000baseT-FD flow-control, link ok

The first line (SIOCGMIIREG error) is due to mii-tool's inability
to read the PHY auto-negotiation expansion register.
On the second line, "no autonegotiation" is wrong, and caused by
the absence of a flag in the link partner ability register which
would indicate that our link partner has acked us. This flag is
listed as "reserved" in the Intel e1000 manual, but mii-tool uses
it as LPA_LPACK from /usr/include/linux/mii.h.

This patch adds read access to PHY_AUTONEG_EXP and defines the
link partner ack flag, allowing mii-tool to generate output as
normally expected:

  ens3: negotiated 1000baseT-FD flow-control, link ok

Signed-off-by: Gabriel Somlo <somlo@cmu.edu>
Reviewed-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agoe1000: emulate auto-negotiation during external link status change
Gabriel L. Somlo [Thu, 19 Jun 2014 15:55:33 +0000 (11:55 -0400)]
e1000: emulate auto-negotiation during external link status change

This patch emulates auto-negotiation when the network link status
is modified externally (i.e. via "set_link <id> off/on").

Also, a couple of cleanup items:
  - unset PHY status reg. AUTONEG_COMPLETE during link_down()
  - set PHY status reg. AUTONEG_COMPLETE during autoneg_timer() only
    if we actually brought the link up.
  - group all checks for "can we, and should we autonegotiate?"
    together for more clarity.

Signed-off-by: Gabriel Somlo <somlo@cmu.edu>
Reviewed-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agoqtest: fix vhost-user-test unbalanced mutex locks
Nikolay Nikolaev [Thu, 19 Jun 2014 15:08:18 +0000 (18:08 +0300)]
qtest: fix vhost-user-test unbalanced mutex locks

Signed-off-by: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agoqtest: fix qtest for vhost-user
Nikolay Nikolaev [Thu, 19 Jun 2014 15:07:59 +0000 (18:07 +0300)]
qtest: fix qtest for vhost-user

Fix compile for older glib, provide conditionally compiled versions of the
used glib APIs.

Signed-off-by: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agolibqemustub: add more stubs for qemu-char
Nikolay Nikolaev [Thu, 19 Jun 2014 15:07:40 +0000 (18:07 +0300)]
libqemustub: add more stubs for qemu-char

Additional stubs:
 - chr_baum_init
 - qemu_chr_open_spice_vmc
 - qemu_chr_open_spice_port

Signed-off-by: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agoqapi/hmp: use 'backend' instead of 'device' with memory backend
Igor Mammedov [Thu, 19 Jun 2014 14:14:43 +0000 (16:14 +0200)]
qapi/hmp: use 'backend' instead of 'device' with memory backend

fixup documentation comments and HMP message/help text

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agovhost: fix resource leak in error handling
Michael S. Tsirkin [Wed, 18 Jun 2014 15:55:22 +0000 (18:55 +0300)]
vhost: fix resource leak in error handling

vhost_verify_ring_mappings leaks mappings on error.
Fix this up.

Cc: qemu-stable@nongnu.org
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agovhost: block migration if backend does not log memory
Michael S. Tsirkin [Wed, 18 Jun 2014 14:20:42 +0000 (17:20 +0300)]
vhost: block migration if backend does not log memory

vhost user does not support LOG_ALL feature bit.
Generally, we should not try to set this bit without
checking that backend can support it first.

Detect and block migration.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
10 years agotcg-ppc: Use the return address as a base pointer
Richard Henderson [Fri, 28 Mar 2014 13:53:53 +0000 (06:53 -0700)]
tcg-ppc: Use the return address as a base pointer

This can significantly reduce code size for generation of (some)
64-bit constants.  With the side effect that we know for a fact
that exit_tb can use the register to good effect.

Tested-by: Tom Musta <tommusta@gmail.com>
Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg-ppc: Merge cache-utils into the backend
Richard Henderson [Wed, 30 Apr 2014 20:56:50 +0000 (13:56 -0700)]
tcg-ppc: Merge cache-utils into the backend

As a "utility", it only supported ppc, and in a way that other
tcg backends provided directly in tcg-target.h.  Removing this
disparity is easier now that the two ppc backends are merged.

Tested-by: Tom Musta <tommusta@gmail.com>
Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agoqemu/osdep: Remove the need for qemu_init_auxval
Richard Henderson [Wed, 30 Apr 2014 20:49:11 +0000 (13:49 -0700)]
qemu/osdep: Remove the need for qemu_init_auxval

Instead of getting backup auxv data from the env pointer given to main,
read it from /proc/self/auxv.  We can do this at any time, so we're not
tied to any ordering wrt a call to qemu_init_auxval from main.

Tested-by: Tom Musta <tommusta@gmail.com>
Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg-ppc: Rename the tcg/ppc64 backend
Richard Henderson [Wed, 30 Apr 2014 21:07:47 +0000 (14:07 -0700)]
tcg-ppc: Rename the tcg/ppc64 backend

The other tcg backends that support 32- and 64-bit modes
use the 32-bit name for the port.  Follow suit.

Tested-by: Tom Musta <tommusta@gmail.com>
Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg-ppc: Remove the backend
Richard Henderson [Wed, 30 Apr 2014 21:05:39 +0000 (14:05 -0700)]
tcg-ppc: Remove the backend

Vectoring the 32-bit build to the ppc64 directory.

Tested-by: Tom Musta <tommusta@gmail.com>
Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg-ppc64: Merge ppc32 shifts
Richard Henderson [Thu, 27 Mar 2014 01:10:43 +0000 (18:10 -0700)]
tcg-ppc64: Merge ppc32 shifts

Tested-by: Tom Musta <tommusta@gmail.com>
Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg-ppc64: Support mulsh_i32
Richard Henderson [Wed, 26 Mar 2014 18:37:06 +0000 (11:37 -0700)]
tcg-ppc64: Support mulsh_i32

Tested-by: Tom Musta <tommusta@gmail.com>
Signed-off-by: Richard Henderson <rth@twiddle.net>