sdk/emulator/qemu.git
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 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>
10 years agotcg-ppc64: Merge ppc32 register usage
Richard Henderson [Wed, 30 Apr 2014 19:12:16 +0000 (12:12 -0700)]
tcg-ppc64: Merge ppc32 register usage

Good enough to run some instructions before things go awry.

Tested-by: Tom Musta <tommusta@gmail.com>
Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg-ppc64: Merge ppc32 qemu_ld/st
Richard Henderson [Tue, 25 Mar 2014 19:11:48 +0000 (12:11 -0700)]
tcg-ppc64: Merge ppc32 qemu_ld/st

Tested-by: Tom Musta <tommusta@gmail.com>
Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg-ppc64: Merge ppc32 brcond2, setcond2, muluh
Richard Henderson [Wed, 30 Apr 2014 18:55:34 +0000 (11:55 -0700)]
tcg-ppc64: Merge ppc32 brcond2, setcond2, muluh

Now passes tcg_add_target_add_op_defs assertions, but
not complete enough to function.

Tested-by: Tom Musta <tommusta@gmail.com>
Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg-ppc64: Begin merging ppc32 with ppc64
Richard Henderson [Wed, 30 Apr 2014 18:39:20 +0000 (11:39 -0700)]
tcg-ppc64: Begin merging ppc32 with ppc64

Just enough to compile, assuming you edit config-host.mak manually.
It will still abort at runtime, due to missing brcond2, setcond2, mulu2.

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

All sorts of confusion on argument ordering.

Tested-by: Tom Musta <tommusta@gmail.com>
Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg-ppc64: Merge 32-bit ABIs into the prologue / frame code
Richard Henderson [Tue, 25 Mar 2014 16:13:38 +0000 (09:13 -0700)]
tcg-ppc64: Merge 32-bit ABIs into the prologue / frame code

Tested-by: Tom Musta <tommusta@gmail.com>
Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg-ppc64: Adjust tcg_out_call for ELFv2
Ulrich Weigand [Wed, 30 Apr 2014 21:33:05 +0000 (14:33 -0700)]
tcg-ppc64: Adjust tcg_out_call for ELFv2

The new ELFv2 ABI, used by default on powerpc64le-linux hosts,
introduced some changes that are incompatible with code currently
generated by the ppc64 TGC target.  In particular, we no longer
use function descriptors.

This patch adds support for the ELFv2 ABI in the ppc64 TGC
function call and function prologue sequences.

Tested-by: Tom Musta <tommusta@gmail.com>
Signed-off-by: Ulrich Weigand <ulrich.weigand@de.ibm.com>
Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg-ppc64: Support the ppc64 elfv2 ABI
Richard Henderson [Tue, 25 Mar 2014 15:57:23 +0000 (08:57 -0700)]
tcg-ppc64: Support the ppc64 elfv2 ABI

Tested-by: Tom Musta <tommusta@gmail.com>
Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg-ppc64: Use the correct test in tcg_out_call
Richard Henderson [Wed, 30 Apr 2014 18:57:11 +0000 (11:57 -0700)]
tcg-ppc64: Use the correct test in tcg_out_call

The correct test uses the _CALL_AIX macro, not a host-specific macro.

Tested-by: Tom Musta <tommusta@gmail.com>
Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg-ppc64: Better parameterize the stack frame
Richard Henderson [Tue, 25 Mar 2014 15:55:12 +0000 (08:55 -0700)]
tcg-ppc64: Better parameterize the stack frame

In preparation for supporting other ABIs.

Tested-by: Tom Musta <tommusta@gmail.com>
Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg-ppc64: Fix TCG_TARGET_CALL_STACK_OFFSET
Richard Henderson [Tue, 25 Mar 2014 15:32:04 +0000 (08:32 -0700)]
tcg-ppc64: Fix TCG_TARGET_CALL_STACK_OFFSET

The calling convention reserves space for the 8 register parameters on
the stack, so using only 6*8=48 as the offset was wrong.  We never saw
this bug because we don't have any helpers with more than 5 parameters.

Tested-by: Tom Musta <tommusta@gmail.com>
Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg-ppc64: Move call macros out of tcg-target.h
Richard Henderson [Tue, 25 Mar 2014 15:11:53 +0000 (08:11 -0700)]
tcg-ppc64: Move call macros out of tcg-target.h

These values are private to tcg.c; we don't need to expose
this nonsense to the translators.

Tested-by: Tom Musta <tommusta@gmail.com>
Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg-ppc64: Make TCG_AREG0 and TCG_REG_CALL_STACK enum constants
Richard Henderson [Tue, 25 Mar 2014 15:06:43 +0000 (08:06 -0700)]
tcg-ppc64: Make TCG_AREG0 and TCG_REG_CALL_STACK enum constants

Tested-by: Tom Musta <tommusta@gmail.com>
Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg-ppc64: Use tcg_out_{ld,st,cmp} internally
Richard Henderson [Mon, 24 Mar 2014 23:03:59 +0000 (16:03 -0700)]
tcg-ppc64: Use tcg_out_{ld,st,cmp} internally

Rather than using tcg_out32 and opcodes directly.  This allows us
to remove LD_ADDR and CMP_L macros.

Tested-by: Tom Musta <tommusta@gmail.com>
Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg-ppc64: Relax register restrictions in tcg_out_mem_long
Richard Henderson [Tue, 25 Mar 2014 19:22:18 +0000 (12:22 -0700)]
tcg-ppc64: Relax register restrictions in tcg_out_mem_long

In order to be able to use tcg_out_ld/st sensibly with scratch
registers, assert only when we'd incorrectly clobber a scratch.

Tested-by: Tom Musta <tommusta@gmail.com>
Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg-ppc64: Move functions around
Richard Henderson [Mon, 24 Mar 2014 22:44:09 +0000 (15:44 -0700)]
tcg-ppc64: Move functions around

Code movement only.  This will allow us to make use of the
other tcg_out_* functions in tidying their implementations.

Tested-by: Tom Musta <tommusta@gmail.com>
Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg-ppc64: Avoid some hard-codings of TCG_TYPE_I64
Richard Henderson [Mon, 24 Mar 2014 22:22:35 +0000 (15:22 -0700)]
tcg-ppc64: Avoid some hard-codings of TCG_TYPE_I64

Using more appropriate _PTR or _REG where possible.

Tested-by: Tom Musta <tommusta@gmail.com>
Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg-ppc: Use uintptr_t in ppc_tb_set_jmp_target
Richard Henderson [Wed, 30 Apr 2014 18:40:58 +0000 (11:40 -0700)]
tcg-ppc: Use uintptr_t in ppc_tb_set_jmp_target

Tested-by: Tom Musta <tommusta@gmail.com>
Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agopc-bios/s390-ccw: update s390-ccw.img binary
Jens Freimann [Wed, 18 Jun 2014 12:16:47 +0000 (14:16 +0200)]
pc-bios/s390-ccw: update s390-ccw.img binary

Update s390-ccw.img to match with latest fixes

Signed-off-by: Jens Freimann <jfrei@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
10 years agopc-bios/s390-ccw: fix for fragmented SCSI bootmap
Eugene (jno) Dvurechenski [Wed, 18 Jun 2014 12:16:46 +0000 (14:16 +0200)]
pc-bios/s390-ccw: fix for fragmented SCSI bootmap

We need to interpret the last entry of the bootmap with zero
block count as "continuation pointer".
The "last entry" is being detected by pre-filling of the scratch
space with known values and respective look-ahead.

Signed-off-by: Eugene (jno) Dvurechenski <jno@linux.vnet.ibm.com>
Signed-off-by: Jens Freimann <jfrei@linux.vnet.ibm.com>
Tested-by: Christian Borntraeger <borntraeger@de.ibm.com>
Reviewed-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Reviewed-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
10 years agopc-bios/s390-ccw: do a subsystem reset before running the guest
Christian Borntraeger [Wed, 18 Jun 2014 12:16:45 +0000 (14:16 +0200)]
pc-bios/s390-ccw: do a subsystem reset before running the guest

The loader BIOS has already activated several devices. Let's do a
subsystem reset before jumping into the guest. As there is no direct
way of doing so, we use diagnose 308 to bring the system in a
defined state. This is similar to what kdump on s390 uses. We have
to define a small trampoline function that restores the low bytes
to whatever the bootmap has written there.

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Jens Freimann <jfrei@linux.vnet.ibm.com>
Reviewed-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
10 years agopc-bios/s390-ccw: virtio_load_direct() can't load max number of sectors
David Hildenbrand [Wed, 18 Jun 2014 12:16:44 +0000 (14:16 +0200)]
pc-bios/s390-ccw: virtio_load_direct() can't load max number of sectors

The number of sectors to read is given by the last 16 bit of rec_list2.
1 is added in order to get to the real number of sectors to read (0x0000
-> read 1 block). For now, the maximum number (0xffff) led to 0 sectors
being read.

This fixes a bug where a large initrd (62MB) could not be ipled anymore.

Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: Jens Freimann <jfrei@linux.vnet.ibm.com>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Reviewed-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
10 years agoMerge remote-tracking branch 'remotes/stefanha/tags/block-pull-request' into staging
Peter Maydell [Mon, 23 Jun 2014 11:55:22 +0000 (12:55 +0100)]
Merge remote-tracking branch 'remotes/stefanha/tags/block-pull-request' into staging

Block pull request

# gpg: Signature made Mon 23 Jun 2014 09:53:49 BST using RSA key ID 81AB73C8
# gpg: Good signature from "Stefan Hajnoczi <stefanha@redhat.com>"
# gpg:                 aka "Stefan Hajnoczi <stefanha@gmail.com>"

* remotes/stefanha/tags/block-pull-request:
  block: asynchronously stop the VM on I/O errors
  vl: allow other threads to do qemu_system_vmstop_request
  sheepdog: fix NULL dereference in sd_create
  QemuOpts: check NULL opts in qemu_opt_get functions
  block: m25p80: Support read only bdrvs.
  block: m25p80: sync_page(): Deindent function body.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>