sdk/emulator/qemu.git
12 years agotcg/optimize: swap brcond/setcond arguments when possible
Aurelien Jarno [Thu, 6 Sep 2012 14:47:14 +0000 (16:47 +0200)]
tcg/optimize: swap brcond/setcond arguments when possible

brcond and setcond ops are not commutative, but it's easy to compute the
new condition after swapping the arguments. Try to always put the constant
argument in second position like for commutative ops, to help backends to
generate better code.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
12 years agotcg/optimize: simplify shift/rot r, 0, a => movi r, 0 cases
Aurelien Jarno [Thu, 6 Sep 2012 14:47:14 +0000 (16:47 +0200)]
tcg/optimize: simplify shift/rot r, 0, a => movi r, 0 cases

shift/rot r, 0, a is equivalent to movi r, 0.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
12 years agotcg/optimize: simplify and r, a, 0 cases
Aurelien Jarno [Thu, 6 Sep 2012 14:47:14 +0000 (16:47 +0200)]
tcg/optimize: simplify and r, a, 0 cases

and r, a, 0 is equivalent to a movi r, 0.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
12 years agotcg/optimize: simplify or/xor r, a, 0 cases
Aurelien Jarno [Thu, 6 Sep 2012 14:47:14 +0000 (16:47 +0200)]
tcg/optimize: simplify or/xor r, a, 0 cases

or/xor r, a, 0 is equivalent to a mov r, a.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
12 years agotcg/optimize: split expression simplification
Aurelien Jarno [Thu, 6 Sep 2012 14:47:13 +0000 (16:47 +0200)]
tcg/optimize: split expression simplification

Split expression simplification in multiple parts so that a given op
can appear multiple times. This patch should not change anything.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
12 years agotcg: improve profiler
Aurelien Jarno [Thu, 6 Sep 2012 14:47:13 +0000 (16:47 +0200)]
tcg: improve profiler

Now that there are two passes of optimization (optimize.c, liveness)
there is no point of outputing the statistics of the liveness part
only. Update the code to take into account both optimizations.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
12 years agoAdd ability to force enable/disable of tools build
Daniel P. Berrange [Mon, 10 Sep 2012 11:26:29 +0000 (12:26 +0100)]
Add ability to force enable/disable of tools build

The qemu-img, qemu-nbd and qemu-io tools are built conditionally
based on whether any softmmu target is enabled. These are useful
self-contained tools which can be used in many other scenarios.
Add new --enable-tools/--disable-tools args to configure to allow
the user to explicitly turn on / off their build. The default
behaviour is now to build these tools are all times, regardless
of whether any softmmu target is enabled

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoAdd ability to disable build of all targets
Daniel P. Berrange [Mon, 10 Sep 2012 11:27:21 +0000 (12:27 +0100)]
Add ability to disable build of all targets

Allow passing of '--target-list=' to configure to request that
all targets are to be disabled. This allows for doing a very
fast tools-only build of things like qemu-img, qemu-io, qemu-nbd.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoRTC: Remove the current_tm field
Paolo Bonzini [Thu, 2 Aug 2012 16:04:13 +0000 (18:04 +0200)]
RTC: Remove the current_tm field

This is not used anymore and only written to.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoRTC: Get and set time without going through s->current_tm
Paolo Bonzini [Thu, 2 Aug 2012 16:04:12 +0000 (18:04 +0200)]
RTC: Get and set time without going through s->current_tm

This patch makes rtc_set_time and rtc_set_cmos work without reading
s->current_tm.  In the case of rtc_set_time I introduce a new
function that retrieves the time and stores into a given struct tm
(not hard-coded to s->current_tm).  In the case of rtc_set_cmos, the
current time is similarly taken from a struct tm rather than
s->current_tm.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoRTC: Do not fire timer periodically to catch next alarm
Paolo Bonzini [Thu, 2 Aug 2012 16:04:11 +0000 (18:04 +0200)]
RTC: Do not fire timer periodically to catch next alarm

This patch limits further the usage of a periodic timer.  It computes the
time of the next alarm, and uses it to skip all intermediate occurrences
of the timer.

Cc: Yang Zhang <yang.z.zhang@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoRTC: Add divider reset support
Yang Zhang [Thu, 2 Aug 2012 16:04:10 +0000 (18:04 +0200)]
RTC: Add divider reset support

The first update cycle begins one-half seconds after divider
reset is removed.  This feature is useful for testing.

Signed-off-by: Yang Zhang <yang.z.zhang@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoRTC: Update the RTC clock only when reading it
Yang Zhang [Thu, 2 Aug 2012 16:04:09 +0000 (18:04 +0200)]
RTC: Update the RTC clock only when reading it

Calculate guest RTC based on the time of the last update, instead of
using timers.  The formula is

    (base_rtc + guest_time_now - guest_time_last_update + offset)

Base_rtc is the RTC value when the RTC was last updated.
Guest_time_now is the guest time when the access happens.
Guest_time_last_update was the guest time when the RTC was last updated.
Offset is used when divider reset happens or the set bit is toggled.

The timer is kept in order to signal interrupts, but it only needs to
run when either UF or AF is cleared.  When the bits are both set, the
timer does not run.

UIP is now synthesized when reading register A.  If the timer is not set,
or if there is more than one second before it (as is the case at the
end of this series), the leading edge of UIP is computed and the rising
edge occurs 220us later.  If the update timer occurs within one second,
however, the rising edge of the AF and UF bits should coincide withe
the falling edge of UIP.  We do not know exactly when this will happen
because there could be delays in the servicing of the timer.  Hence, in
this case reading register A only computes for the rising edge of UIP,
and latches the bit until the timer is fired and clears it.

Signed-off-by: Yang Zhang <yang.z.zhang@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agovmstate: add VMSTATE_TIMER_V
Paolo Bonzini [Thu, 2 Aug 2012 16:04:08 +0000 (18:04 +0200)]
vmstate: add VMSTATE_TIMER_V

Also, for consistency with other occurrences, implement VMSTATE_TIMER
as a special case of VMSTATE_TIMER_V rather than VMSTATE_TIMER_TEST.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoRTC: Update interrupt state when interrupts are masked/unmasked
Yang Zhang [Thu, 2 Aug 2012 16:04:07 +0000 (18:04 +0200)]
RTC: Update interrupt state when interrupts are masked/unmasked

If an interrupt flag is already set when the interrupt becomes enabled,
raise an interrupt immediately, and vice versa if interrupts become
disabled.

Signed-off-by: Yang Zhang <yang.z.zhang@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoRTC: introduce RTC_CLOCK_RATE
Paolo Bonzini [Thu, 2 Aug 2012 16:04:06 +0000 (18:04 +0200)]
RTC: introduce RTC_CLOCK_RATE

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoRTC: Rename rtc_timer_update
Yang Zhang [Thu, 2 Aug 2012 16:04:05 +0000 (18:04 +0200)]
RTC: Rename rtc_timer_update

Signed-off-by: Yang Zhang <yang.z.zhang@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoRTC: Remove the logic to update time format when DM bit changed
Yang Zhang [Thu, 2 Aug 2012 16:04:04 +0000 (18:04 +0200)]
RTC: Remove the logic to update time format when DM bit changed

Changing the DM (binary/BCD) and 24/12 control bit doesn't affect the internal
registers. It only indicates what format is used for those registers.

Signed-off-by: Yang Zhang <yang.z.zhang@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoMerge remote-tracking branch 'qemu-kvm/uq/master' into staging
Anthony Liguori [Mon, 10 Sep 2012 17:51:44 +0000 (12:51 -0500)]
Merge remote-tracking branch 'qemu-kvm/uq/master' into staging

* qemu-kvm/uq/master:
  kvm: i386: Add classic PCI device assignment
  kvm: i386: Add services required for PCI device assignment
  kvm: Introduce kvm_has_intx_set_mask
  kvm: Introduce kvm_irqchip_update_msi_route
  kvm: Clean up irqfd API
  qemu: Use valgrind annotations to mark kvm guest memory as defined

12 years agoMerge remote-tracking branch 'mst/tags/for_anthony' into staging
Anthony Liguori [Mon, 10 Sep 2012 17:48:43 +0000 (12:48 -0500)]
Merge remote-tracking branch 'mst/tags/for_anthony' into staging

* mst/tags/for_anthony:
  vhost: Pass device path to vhost_dev_init()
  monitor: Rename+move net_handle_fd_param -> monitor_handle_fd_param
  pcie_aer: clear cmask for Advanced Error Interrupt Message Number
  pcie: drop version_id field for live migration
  qemu: add .exrc

12 years agosocket: don't attempt to reconnect a TCP socket in server mode
Anthony Liguori [Wed, 5 Sep 2012 18:52:49 +0000 (13:52 -0500)]
socket: don't attempt to reconnect a TCP socket in server mode

Commit c3767ed0eb5d0bb25fe409ae5dec06e3411ff1b6 introduced a possible SEGV when
using a socket chardev with server=on because it assumes that all TCP sockets
are in client mode.

This patch adds a check to only reconnect when in client mode.

Cc: Lei Li <lilei@linux.vnet.ibm.com>
Reported-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agouse --libexecdir instead of ignoring it first and reinventing it later
Michael Tokarev [Wed, 6 Jun 2012 21:11:00 +0000 (01:11 +0400)]
use --libexecdir instead of ignoring it first and reinventing it later

Commit 7b93fadf3a38d1ed65ea5536a52efc2772c6e3b8 "Add basic version
of bridge helper" put the bridge helper executable into a fixed
${prefix}/libexec/ location, instead of using ${libexecdir} for
this.  At the same time, --libexecdir is being happily ignored
by ./configure.  Even more, the same patch sets unused $libexecdir
variable in the generated config-host.mak, and uses fixed string
(\${prefix}/libexecdir) for the bridge helper binary.

Fix this braindamage by introducing $libexecdir variable, using
it for the bridge helper binary, and recognizing --libexecdir.

This patch is applicable to stable-1.1.

Reviewed-by: Andreas Färber <afaerber@suse.de>
Reviewed-by: Corey Bryant <coreyb@linux.vnet.ibm.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Cc: Corey Bryant <coreyb@linux.vnet.ibm.com>
Cc: Richa Marwaha <rmarwah@linux.vnet.ibm.com>
Cc: qemu-stable@nongnu.org
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoMerge branch 'spice.v59' of git://anongit.freedesktop.org/spice/qemu
Aurelien Jarno [Mon, 10 Sep 2012 13:32:11 +0000 (15:32 +0200)]
Merge branch 'spice.v59' of git://anongit.freedesktop.org/spice/qemu

* 'spice.v59' of git://anongit.freedesktop.org/spice/qemu:
  Remove #ifdef QXL_COMMAND_FLAG_COMPAT_16BPP
  qxl: Add set_client_capabilities() interface to QXLInterface
  spice: make number of surfaces runtime-configurable.
  configure: print spice-protocol and spice-server versions
  qxl: add QXL_IO_MONITORS_CONFIG_ASYNC
  qxl: disallow unknown revisions
  qxl/update_area_io: guest_bug on invalid parameters
  spice: increase the verbosity of spice section in "qemu --help"
  spice: adding seamless-migration option to the command line
  spice: add 'migrated' flag to spice info
  spice migration: add QEVENT_SPICE_MIGRATE_COMPLETED
  spice: notify on vm state change only via spice_server_vm_start/stop
  spice: notify spice server on vm start/stop
  spice: abort on invalid streaming cmdline params

12 years agoMerge branch 'queue/qmp' of git://repo.or.cz/qemu/qmp-unstable
Aurelien Jarno [Mon, 10 Sep 2012 13:04:36 +0000 (15:04 +0200)]
Merge branch 'queue/qmp' of git://repo.or.cz/qemu/qmp-unstable

* 'queue/qmp' of git://repo.or.cz/qemu/qmp-unstable:
  tcx: tcx_screen_dump(): add error handling
  tcx: tcx24_screen_dump(): add error handling
  g364fb: g364fb_screen_dump(): add error handling
  omap_lcdc: omap_ppm_save(): add error handling
  omap_lcdc: rename ppm_save() to omap_ppm_save()
  vga: ppm_save(): add error handling
  qapi: convert screendump
  console: vga_hw_screen_dump_ptr: take Error argument
  error: add error_setg()
  json-parser: Fix potential NULL pointer segfault
  qapi: Fix potential NULL pointer segfault
  qapi: convert sendkey
  monitor: move key_defs[] table and introduce two help functions
  qapi: add the QKeyCode enum
  qapi: generate list struct and visit_list for enum
  hmp: rename arguments
  monitor: rename keyname '<' to 'less'
  fix doc of using raw values with sendkey
  Add support for pretty-printing response in qmp-shell

12 years agohw/mcf5206: Fix buffer overflow for MBAR read / write
Stefan Weil [Tue, 4 Sep 2012 17:37:39 +0000 (19:37 +0200)]
hw/mcf5206: Fix buffer overflow for MBAR read / write

Report from smatch:

mcf5206.c:384 m5206_mbar_readb(7) error: buffer overflow 'm5206_mbar_width' 128 <= 128
mcf5206.c:403 m5206_mbar_readw(8) error: buffer overflow 'm5206_mbar_width' 128 <= 128
mcf5206.c:427 m5206_mbar_readl(8) error: buffer overflow 'm5206_mbar_width' 128 <= 128
mcf5206.c:451 m5206_mbar_writeb(9) error: buffer overflow 'm5206_mbar_width' 128 <= 128
mcf5206.c:475 m5206_mbar_writew(9) error: buffer overflow 'm5206_mbar_width' 128 <= 128
mcf5206.c:503 m5206_mbar_writel(9) error: buffer overflow 'm5206_mbar_width' 128 <= 128

m5206_mbar_width has 0x80 elements and supports 0 <= offset < 0x200.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
12 years agotarget-arm: Fix potential buffer overflow
Stefan Weil [Tue, 4 Sep 2012 05:35:57 +0000 (07:35 +0200)]
target-arm: Fix potential buffer overflow

Report from smatch:

target-arm/helper.c:651 arm946_prbs_read(6) error:
 buffer overflow 'env->cp15.c6_region' 8 <= 8
target-arm/helper.c:661 arm946_prbs_write(6) error:
 buffer overflow 'env->cp15.c6_region' 8 <= 8

c7_region is an array with 8 elements, so the index must be less than 8.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
12 years agohw/wm8750: Fix potential buffer overflow
Stefan Weil [Mon, 3 Sep 2012 20:56:00 +0000 (22:56 +0200)]
hw/wm8750: Fix potential buffer overflow

Report from smatch:

hw/wm8750.c:369 wm8750_tx(12) error: buffer overflow 's->i2c_data' 2 <= 2

It looks like the preprocessor statements were simply misplaced.

Replace also __FUNCTION__ by __func__ to please checkpatch.pl.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
12 years agokvm: i386: Add classic PCI device assignment
Jan Kiszka [Thu, 30 Aug 2012 18:30:00 +0000 (20:30 +0200)]
kvm: i386: Add classic PCI device assignment

This adds PCI device assignment for i386 targets using the classic KVM
interfaces. This version is 100% identical to what is being maintained
in qemu-kvm for several years and is supported by libvirt as well. It is
expected to remain relevant for another couple of years until kernels
without full-features and performance-wise equivalent VFIO support are
obsolete.

A refactoring to-do that should be done in-tree is to model MSI and
MSI-X support via the generic PCI layer, similar to what VFIO is already
doing for MSI-X. This should improve the correctness and clean up the
code from duplicate logic.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Acked-by: Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
12 years agokvm: i386: Add services required for PCI device assignment
Jan Kiszka [Mon, 27 Aug 2012 06:28:40 +0000 (08:28 +0200)]
kvm: i386: Add services required for PCI device assignment

These helpers abstract the interaction of upcoming pci-assign with the
KVM kernel services. Put them under i386 only as other archs will
implement device pass-through via VFIO and not this classic interface.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Acked-by: Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
12 years agokvm: Introduce kvm_has_intx_set_mask
Jan Kiszka [Mon, 27 Aug 2012 06:28:39 +0000 (08:28 +0200)]
kvm: Introduce kvm_has_intx_set_mask

Will be used by PCI device assignment code.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Acked-by: Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
12 years agokvm: Introduce kvm_irqchip_update_msi_route
Jan Kiszka [Mon, 27 Aug 2012 06:28:38 +0000 (08:28 +0200)]
kvm: Introduce kvm_irqchip_update_msi_route

This service allows to update an MSI route without releasing/reacquiring
the associated VIRQ. Will be used by PCI device assignment, later on
likely also by virtio/vhost and VFIO.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Acked-by: Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
12 years agotcg/s390: fix ld/st with CONFIG_TCG_PASS_AREG0
Aurelien Jarno [Sat, 8 Sep 2012 03:45:43 +0000 (03:45 +0000)]
tcg/s390: fix ld/st with CONFIG_TCG_PASS_AREG0

The load/store slow path has been broken in e141ab52d:
- We need to move 4 registers for store functions and 3 registers for
  load functions and not the reverse.
- According to the s390x calling convention the arguments of a function
  should be zero extended. This means that the register shift should be
  done with TCG_TYPE_I64 to ensure the higher word is correctly zero
  extended when needed.

I am aware that CONFIG_TCG_PASS_AREG0 is being removed and thus that
this patch can be improved, but doing so means it can also be applied to
the 1.1 and 1.2 stable branches.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agotarget-s390x: switch to AREG0 free mode
Blue Swirl [Sun, 2 Sep 2012 07:33:40 +0000 (07:33 +0000)]
target-s390x: switch to AREG0 free mode

Add an explicit CPUState parameter instead of relying on AREG0.

Remove temporary wrappers and switch to AREG0 free mode.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
[agraf: fix conflicts]
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agotarget-s390x: avoid AREG0 for misc helpers
Blue Swirl [Sun, 2 Sep 2012 07:33:39 +0000 (07:33 +0000)]
target-s390x: avoid AREG0 for misc helpers

Make misc helpers take a parameter for CPUState instead
of relying on global env.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
[agraf: fix conflict]
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agotarget-s390x: avoid AREG0 for condition code helpers
Blue Swirl [Sun, 2 Sep 2012 07:33:38 +0000 (07:33 +0000)]
target-s390x: avoid AREG0 for condition code helpers

Make condition code helpers take a parameter for CPUState instead
of relying on global env.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agotarget-s390x: avoid AREG0 for integer helpers
Blue Swirl [Sun, 2 Sep 2012 07:33:37 +0000 (07:33 +0000)]
target-s390x: avoid AREG0 for integer helpers

Make integer helpers take a parameter for CPUState instead
of relying on global env.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agotarget-s390x: avoid AREG0 for FPU helpers
Blue Swirl [Sun, 2 Sep 2012 07:33:36 +0000 (07:33 +0000)]
target-s390x: avoid AREG0 for FPU helpers

Make FPU helpers take a parameter for CPUState instead
of relying on global env.

Introduce temporary wrappers for FPU load and store ops.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agotarget-s390x: rename op_helper.c to misc_helper.c
Blue Swirl [Sun, 2 Sep 2012 07:33:35 +0000 (07:33 +0000)]
target-s390x: rename op_helper.c to misc_helper.c

Now op_helper.c contains miscellaneous helpers, rename
it to misc_helper.c.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
[agraf: fix conflict]
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agotarget-s390x: split memory access helpers
Blue Swirl [Sun, 2 Sep 2012 07:33:34 +0000 (07:33 +0000)]
target-s390x: split memory access helpers

Move memory access helpers to mem_helper.c.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
[agraf: fold softmmu include ifdefs together]
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agotarget-s390x: split integer helpers
Blue Swirl [Sun, 2 Sep 2012 07:33:33 +0000 (07:33 +0000)]
target-s390x: split integer helpers

Move integer helpers to int_helper.c.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agotarget-s390x: split condition code helpers
Blue Swirl [Sun, 2 Sep 2012 07:33:32 +0000 (07:33 +0000)]
target-s390x: split condition code helpers

Move condition code helpers to cc_helper.c.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agotarget-s390x: split FPU ops
Blue Swirl [Sun, 2 Sep 2012 07:33:31 +0000 (07:33 +0000)]
target-s390x: split FPU ops

Move floating point instructions to fpu_helper.c.

While exporting some condition code helpers,
avoid duplicate identifier conflict with translate.c.

Remove unused set_cc_nz_f64() in translate.c.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agotarget-s390x: fix style
Blue Swirl [Sun, 2 Sep 2012 07:33:30 +0000 (07:33 +0000)]
target-s390x: fix style

Before splitting op_helper.c and helper.c in the next patches,
fix style issues. No functional changes.

Replace also GCC specific __FUNCTION__ with
standard __func__.

Don't init static variable (cpu_s390x_init:inited) with 0.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agokvm: Clean up irqfd API
Jan Kiszka [Mon, 20 Aug 2012 08:55:56 +0000 (10:55 +0200)]
kvm: Clean up irqfd API

No need to expose the fd-based interface, everyone will already be fine
with the more handy EventNotifier variant. Rename the latter to clarify
that we are still talking about irqfds here.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Acked-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
12 years agoqemu: Use valgrind annotations to mark kvm guest memory as defined
Christian Borntraeger [Fri, 10 Aug 2012 13:11:45 +0000 (15:11 +0200)]
qemu: Use valgrind annotations to mark kvm guest memory as defined

valgrind with kvm produces a big amount of false positives regarding
"Conditional jump or move depends on uninitialised value(s)". This
happens because the guest memory is allocated with qemu_vmalloc which
boils down posix_memalign etc. This function is (correctly) considered
by valgrind as returning undefined memory.

Since valgrind is based on jitting code, it will not be able to see
changes made by the guest to guest memory if this is done by KVM_RUN,
thus keeping most of the guest memory undefined.

Now lots of places in qemu will then use guest memory to change behaviour.
To avoid the flood of these messages, lets declare the whole guest
memory as defined. This will reduce the noise and allows us to see real
problems.

In the future we might want to make this conditional, since there
is actually something that we can use those false positives for:
These messages will point to code that depends on guest memory, so
we can use these backtraces to actually make an audit that is focussed
only at those code places. For normal development we dont want to
see those messages, though.

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
12 years agomusicpal: Fix flash mapping
Jan Kiszka [Sat, 8 Sep 2012 09:52:39 +0000 (11:52 +0200)]
musicpal: Fix flash mapping

The old arithmetic assumed 32 physical address bits which is no longer
true for ARM since 3cc0cd61f4.

Signed-off-by: Jan Kiszka <jan.kiszka@web.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoAdd MAINTAINERS entry for leon3
Fabien Chouteau [Tue, 22 May 2012 08:14:28 +0000 (10:14 +0200)]
Add MAINTAINERS entry for leon3

Signed-off-by: Fabien Chouteau <chouteau@adacore.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agotarget-sparc: fix fcmp{s,d,q} instructions wrt exception
Aurelien Jarno [Fri, 7 Sep 2012 15:13:28 +0000 (17:13 +0200)]
target-sparc: fix fcmp{s,d,q} instructions wrt exception

fcmp{s,d,q} instructions are supposed to ignore quiet NaN (contrary to
the fcmpe{s,d,q} instructions), but the current code is wrongly setting
the NV exception in that case. Moreover the current code is duplicated:
first the arguments are checked for NaN to generate an exception, and
later in case the comparison is unordered (which can only happens if one
of the argument is a NaN), the same check is done to generate an
exception.

Fix that by calling clear_float_exceptions() followed by
check_ieee_exceptions() as for the other floating point instructions.
Use the _compare_quiet functions for fcmp{s,d,q} and the _compare ones
for fcmpe{s,d,q}. Simplify the flag setting by not clearing a flag that
is set the line just below.

This fix allows the math glibc testsuite to pass.

Cc: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agotarget-xtensa: fix missing errno codes for mingw32
Max Filippov [Thu, 6 Sep 2012 00:36:46 +0000 (04:36 +0400)]
target-xtensa: fix missing errno codes for mingw32

Put the following errno value mappings under #ifdef:

xtensa-semi.c: In function 'errno_h2g':
xtensa-semi.c:113: error: 'ENOTBLK' undeclared (first use in this function)
xtensa-semi.c:113: error: (Each undeclared identifier is reported only once
xtensa-semi.c:113: error: for each function it appears in.)
xtensa-semi.c:113: error: array index in initializer not of integer type
xtensa-semi.c:113: error: (near initialization for 'guest_errno')
xtensa-semi.c:124: error: 'ETXTBSY' undeclared (first use in this function)
xtensa-semi.c:124: error: array index in initializer not of integer type
xtensa-semi.c:124: error: (near initialization for 'guest_errno')
xtensa-semi.c:134: error: 'ELOOP' undeclared (first use in this function)
xtensa-semi.c:134: error: array index in initializer not of integer type
xtensa-semi.c:134: error: (near initialization for 'guest_errno')

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agotarget-cris: Fix buffer overflow
Stefan Weil [Fri, 7 Sep 2012 20:36:08 +0000 (22:36 +0200)]
target-cris: Fix buffer overflow

Report from smatch:

target-cris/translate.c:3464 cpu_dump_state(32) error:
 buffer overflow 'env->sregs' 4 <= 255

sregs is declared 'uint32_t sregs[4][16]', so the first index must be
less than 4 or ARRAY_SIZE(env->sregs).

Signed-off-by: Stefan Weil <sw@weilnetz.de>
12 years agoMIPS/user: Fix reset CPU state initialization
Maciej W. Rozycki [Fri, 8 Jun 2012 01:04:40 +0000 (02:04 +0100)]
MIPS/user: Fix reset CPU state initialization

 This change updates the CPU reset sequence to use a common piece of code
that figures out CPU state flags, fixing the problem with MIPS_HFLAG_COP1X
not being set where applicable that causes floating-point MADD family
instructions (and other instructions from the MIPS IV FP subset) to trap.

 As compute_hflags is now shared between op_helper.c and translate.c, the
function is now moved to a common header.  There are no changes to this
function.

 The problem was seen with the 24Kf MIPS32r2 processor in user emulation.
The new approach prevents system and user emulation from diverging -- all
the hflags state is initialized in one place now.

Signed-off-by: Maciej W. Rozycki <macro@codesourcery.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
12 years agolan9118: fix multicast filtering
Aurelien Jarno [Sun, 10 Jun 2012 21:18:44 +0000 (23:18 +0200)]
lan9118: fix multicast filtering

The lan9118 emulation tries to compute the multicast index by calling
directly the crc32() function from zlib, but fails to get the correct
result.

Use the common compute_mcast_idx() function instead, which gives the
correct result. This fixes IPv6 support.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
12 years agofix entry pointer for ELF kernels loaded with -kernel option
Henning Schild [Wed, 5 Sep 2012 12:56:39 +0000 (14:56 +0200)]
fix entry pointer for ELF kernels loaded with -kernel option

 Find a hopefully proper patch attached. Take it or leave it.

Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Henning Schild <henning@hennsch.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
12 years agovhost: Pass device path to vhost_dev_init()
Stefan Hajnoczi [Tue, 21 Aug 2012 20:52:08 +0000 (20:52 +0000)]
vhost: Pass device path to vhost_dev_init()

The path to /dev/vhost-net is currently hardcoded in vhost_dev_init().
This needs to be changed so that /dev/vhost-scsi can be used.  Pass in
the device path instead of hardcoding it.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
12 years agomonitor: Rename+move net_handle_fd_param -> monitor_handle_fd_param
Nicholas Bellinger [Tue, 21 Aug 2012 20:52:07 +0000 (20:52 +0000)]
monitor: Rename+move net_handle_fd_param -> monitor_handle_fd_param

This patch renames+moves the net_handle_fd_param() caller used to
obtain a file descriptor from either qemu_parse_fd() (the normal case)
or from monitor_get_fd() (migration case) into a generically prefixed
monitor_handle_fd_param() to be used by vhost-scsi code.

Also update net/[socket,tap].c consumers to use the new prefix.

Reported-by: Michael S. Tsirkin <mst@redhat.com>
Cc: Michael S. Tsirkin <mst@redhat.com>
Cc: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
12 years agopcie_aer: clear cmask for Advanced Error Interrupt Message Number
Jason Baron [Tue, 4 Sep 2012 20:22:46 +0000 (16:22 -0400)]
pcie_aer: clear cmask for Advanced Error Interrupt Message Number

The Advanced Error Interrupt Message Number (bits 31:27 of the Root
Error Status Register) is updated when the number of msi messages assigned to a
device changes. Migration of windows 7 on q35 chipset failed because the check
in get_pci_config_device() fails due to cmask being set on these bits. Its valid
to update these bits and we must restore this state across migration.

Signed-off-by: Jason Baron <jbaron@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
12 years agopcie: drop version_id field for live migration
Jason Baron [Wed, 8 Aug 2012 18:29:12 +0000 (14:29 -0400)]
pcie: drop version_id field for live migration

While testing q35 live migration, I found that the migration would abort with
the following error: "Unknown savevm section type 76".

The error is due to this check failing in 'vmstate_load_state()':

    while(field->name) {
        if ((field->field_exists &&
             field->field_exists(opaque, version_id)) ||
            (!field->field_exists &&
             field->version_id <= version_id)) {

The VMSTATE_PCIE_DEVICE() currently has a 'version_id' set to 2. However,
'version_id' in the above check is 1. And thus we fail to load the pcie device
field. Further the code returns to 'qemu_loadvm_state()' which produces the
error that I saw.

I'm proposing to fix this by simply dropping the 'version_id' field from
VMSTATE_PCIE_DEVICE(). VMSTATE_PCI_DEVICE() defines no such field and further
the vmstate_pcie_device that VMSTATE_PCI_DEVICE() refers to is already
versioned. Thus, any versioning issues could be detected at the vmsd level.

Taking a step back, I think that the 'field->version_id' should be compared
against a saved version number for the field not the 'version_id'. Futhermore,
once vmstate_load_state() is called recursively on another vmsd, the check of:

    if (version_id > vmsd->version_id) {
        return -EINVAL;
    }

Will never fail since version_id is always equal to vmsd->version_id. So I'm
wondering why we aren't storing the vmsd version id of the source in the
migration stream?

This patch also renames the 'name' field of vmstate_pcie_device from:
PCIDevice -> PCIEDevice to differentiate it from vmstate_pci_device.

Signed-off-by: Jason Baron <jbaron@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
12 years agoqemu: add .exrc
Michael S. Tsirkin [Thu, 19 Jul 2012 14:26:10 +0000 (17:26 +0300)]
qemu: add .exrc

I've been using this to get correct indenting with vim
in qemu for a while, but it's a bit easier if we
put the settings in the central place.
Note that
1. you still need to enable 'exrc' and 'secure'
   options in your vimrc for these settings to take effect.
2. you can create a .vimrc file if 'exrc' is on but there's
   need to bypass this configuration.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
12 years agohw/pl110: Fix spelling of 'palette'
Peter Maydell [Mon, 27 Aug 2012 11:32:36 +0000 (12:32 +0100)]
hw/pl110: Fix spelling of 'palette'

Fix the spelling of 'palette' used in various local variables,
structure members and comments.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
12 years agotarget-xtensa: convert host errno values to guest
Max Filippov [Wed, 29 Aug 2012 19:54:25 +0000 (23:54 +0400)]
target-xtensa: convert host errno values to guest

Guest errno values are taken from the newlib. Convert only those errno
values that can be returned from used system calls.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoCHECKPATCH: Add warning for single else statement.
Don Slutz [Sun, 2 Sep 2012 23:22:38 +0000 (19:22 -0400)]
CHECKPATCH: Add warning for single else statement.

For an example:

WARNING: braces {} are necessary even for single statement blocks
+    } else
+        return env->regs[R_EAX];

total: 0 errors, 1 warnings, 41 lines checked
Signed-off-by: Don Slutz <Don@CloudSwitch.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoCHECKPATCH: Add --debug adv_apw
Don Slutz [Sun, 2 Sep 2012 23:22:37 +0000 (19:22 -0400)]
CHECKPATCH: Add --debug adv_apw

Add debug options to find this issue.  They were not listed
in the help because the are not simple to understand the output of.

Signed-off-by: Don Slutz <Don@CloudSwitch.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoCHECKPATCH: Add --debug adv_checking
Don Slutz [Sun, 2 Sep 2012 23:22:36 +0000 (19:22 -0400)]
CHECKPATCH: Add --debug adv_checking

Add debug options to find this issue.  They were not listed
in the help because the are not simple to understand the output of.

Signed-off-by: Don Slutz <Don@CloudSwitch.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoCHECKPATCH: Add --debug adv_dcs
Don Slutz [Sun, 2 Sep 2012 23:22:35 +0000 (19:22 -0400)]
CHECKPATCH: Add --debug adv_dcs

Add debug options to find this issue.  They were not listed
in the help because the are not simple to understand the output of.

Signed-off-by: Don Slutz <Don@CloudSwitch.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agotcx: tcx_screen_dump(): add error handling
Luiz Capitulino [Thu, 24 May 2012 14:33:25 +0000 (11:33 -0300)]
tcx: tcx_screen_dump(): add error handling

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
12 years agotcx: tcx24_screen_dump(): add error handling
Luiz Capitulino [Thu, 24 May 2012 14:30:40 +0000 (11:30 -0300)]
tcx: tcx24_screen_dump(): add error handling

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
12 years agog364fb: g364fb_screen_dump(): add error handling
Luiz Capitulino [Thu, 24 May 2012 14:28:17 +0000 (11:28 -0300)]
g364fb: g364fb_screen_dump(): add error handling

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
12 years agoomap_lcdc: omap_ppm_save(): add error handling
Luiz Capitulino [Thu, 24 May 2012 14:24:34 +0000 (11:24 -0300)]
omap_lcdc: omap_ppm_save(): add error handling

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
12 years agoomap_lcdc: rename ppm_save() to omap_ppm_save()
Luiz Capitulino [Mon, 21 May 2012 18:18:58 +0000 (15:18 -0300)]
omap_lcdc: rename ppm_save() to omap_ppm_save()

Avoids confusion with the global ppm_save() defined in hw/vga.c.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
12 years agovga: ppm_save(): add error handling
Luiz Capitulino [Thu, 24 May 2012 13:42:25 +0000 (10:42 -0300)]
vga: ppm_save(): add error handling

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
12 years agoqapi: convert screendump
Luiz Capitulino [Thu, 24 May 2012 16:48:23 +0000 (13:48 -0300)]
qapi: convert screendump

Next commits will update devices to propagate errors.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
12 years agoconsole: vga_hw_screen_dump_ptr: take Error argument
Luiz Capitulino [Mon, 21 May 2012 19:41:37 +0000 (16:41 -0300)]
console: vga_hw_screen_dump_ptr: take Error argument

All devices that register a screen dump callback via
graphic_console_init() are updated.

The new argument is not used in this commit. Error handling will
be added to each device individually later.

This change is a preparation to convert the screendump command
to the QAPI.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
12 years agoerror: add error_setg()
Luiz Capitulino [Wed, 29 Aug 2012 14:20:57 +0000 (11:20 -0300)]
error: add error_setg()

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
12 years agojson-parser: Fix potential NULL pointer segfault
Stefan Weil [Mon, 3 Sep 2012 19:19:11 +0000 (21:19 +0200)]
json-parser: Fix potential NULL pointer segfault

Report from smatch:
json-parser.c:474 parse_object(62) error: potential null derefence 'dict'.
json-parser.c:553 parse_array(75) error: potential null derefence 'list'.

Label 'out' in json-parser.c can be called with list == NULL
which is passed to QDECREF.

Modify QDECREF to handle a NULL argument (inline function qobject_decref
already handles them, too).

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
12 years agoqapi: Fix potential NULL pointer segfault
Stefan Weil [Sat, 1 Sep 2012 07:30:39 +0000 (09:30 +0200)]
qapi: Fix potential NULL pointer segfault

Report from smatch:

qapi-visit.c:1640 visit_type_BlockdevAction(8) error:
 we previously assumed 'obj' could be null (see line 1639)
qapi-visit.c:2432 visit_type_NetClientOptions(8) error:
 we previously assumed 'obj' could be null (see line 2431)

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
12 years agoqapi: convert sendkey
Amos Kong [Fri, 31 Aug 2012 02:56:26 +0000 (10:56 +0800)]
qapi: convert sendkey

Convert 'sendkey' to use QAPI.

QAPI passes key's index of mapping table to qmp_send_key(),
not keycode. So we use help functions to convert key/code to
index of key_defs, and 'index' will be converted to 'keycode'
inside qmp_send_key().

For qmp, QAPI would check invalid key and raise error.
For hmp, invalid key is checked in hmp_send_key().

'send-key' of QMP doesn't support key in hexadecimal format.

Signed-off-by: Amos Kong <akong@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
12 years agomonitor: move key_defs[] table and introduce two help functions
Amos Kong [Fri, 31 Aug 2012 02:56:25 +0000 (10:56 +0800)]
monitor: move key_defs[] table and introduce two help functions

This patch added two help functions to convert key/code to index of
mapping table, those functions will return Q_KEY_CODE_MAX if the
code/key is invalid.

Patch also moved key_defs[] to input.c, and removed useless KeyDef struct.
Key's index in QKeyCode enmu is same as keycode's index in new key_defs[].
Monitor functions were changed to access key_defs[] directly.

key_defs[] is used in do_send_key(), so export key_defs[]. It will be
changed to static in next patch.

Signed-off-by: Amos Kong <akong@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
12 years agoqapi: add the QKeyCode enum
Amos Kong [Fri, 31 Aug 2012 02:56:24 +0000 (10:56 +0800)]
qapi: add the QKeyCode enum

key_defs[] in monitor.c is a mapping table of keys and keycodes,
this patch added a QKeyCode enum. Key's index in the enmu is same
as keycode's index in key_defs[].

Signed-off-by: Amos Kong <akong@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
12 years agoqapi: generate list struct and visit_list for enum
Amos Kong [Fri, 31 Aug 2012 02:56:23 +0000 (10:56 +0800)]
qapi: generate list struct and visit_list for enum

Currently, if we define an 'enum' and use it in one command's
data, list struct for enum could not be generated, but it's
used in qmp function.

For example: KeyCodesList could not be generated.
>>> qapi-schema.json:
{ 'enum': 'KeyCodes',
  'data': [ 'shift', 'alt' ... ] }
{ 'command': 'sendkey',
  'data': { 'keys': ['KeyCodes'], '*hold-time': 'int' } }

>>> qmp-command.h:
void qmp_sendkey(KeyCodesList * keys, bool has_hold_time, int64_t
hold_time, Error **errp);

This patch lets qapi generate list struct and visit_list for enum.

Signed-off-by: Amos Kong <akong@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
12 years agohmp: rename arguments
Amos Kong [Fri, 31 Aug 2012 02:56:22 +0000 (10:56 +0800)]
hmp: rename arguments

Rename 'string' to 'keys', rename 'hold_time' to 'hold-time'.

Signed-off-by: Amos Kong <akong@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
12 years agomonitor: rename keyname '<' to 'less'
Amos Kong [Fri, 31 Aug 2012 02:56:21 +0000 (10:56 +0800)]
monitor: rename keyname '<' to 'less'

There are many maps of keycode 0x56 in pc-bios/keymaps/*
  pc-bios/keymaps/common:less 0x56
  pc-bios/keymaps/common:greater 0x56 shift
  pc-bios/keymaps/common:bar 0x56 altgr
  pc-bios/keymaps/common:brokenbar 0x56 shift altgr

This patch just renamed '<' to 'less', QAPI might add new
variable by adding a prefix to keyname, '$PREFIX_<' is not
available, '$PREFIX_less' is ok.

For compatibility, convert user inputted '<' to 'less'.

Signed-off-by: Amos Kong <akong@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
12 years agofix doc of using raw values with sendkey
Amos Kong [Fri, 31 Aug 2012 02:56:20 +0000 (10:56 +0800)]
fix doc of using raw values with sendkey

(qemu) sendkey a
(qemu) sendkey 0x1e
(qemu) sendkey #0x1e
 unknown key: '#0x1e'

The last command doesn't work, '#' is not requested before
raw values, and the raw value in decimal format is not supported.

Signed-off-by: Amos Kong <akong@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
12 years agoAdd support for pretty-printing response in qmp-shell
Daniel P. Berrange [Wed, 15 Aug 2012 10:33:47 +0000 (11:33 +0100)]
Add support for pretty-printing response in qmp-shell

Add a '-p' arg to the QMP/qmp-shell test program, which uses
the python pprint module to pretty-print the dictionary
returned from a command

  $ qmp-shell -p /tmp/qemu
  Welcome to the QMP low-level shell!
  Connected to QEMU 1.1.50

  (QEMU) query-cpus
  {   u'return': [   {   u'CPU': 0,
                         u'current': True,
                         u'halted': True,
                         u'pc': 1048556,
                         u'thread_id': 7108}]}

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
12 years agoOpen up 1.3 development tree
Anthony Liguori [Wed, 5 Sep 2012 16:44:53 +0000 (11:44 -0500)]
Open up 1.3 development tree

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoRemove #ifdef QXL_COMMAND_FLAG_COMPAT_16BPP
Søren Sandmann Pedersen [Tue, 4 Sep 2012 14:14:49 +0000 (10:14 -0400)]
Remove #ifdef QXL_COMMAND_FLAG_COMPAT_16BPP

We require spice >= 0.8 now, so this flag is always present.

Signed-off-by: Soren Sandmann <ssp@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
12 years agoqxl: Add set_client_capabilities() interface to QXLInterface
Søren Sandmann Pedersen [Tue, 4 Sep 2012 14:14:48 +0000 (10:14 -0400)]
qxl: Add set_client_capabilities() interface to QXLInterface

This new interface lets spice server inform the guest whether

(a) a client is connected
(b) what capabilities the client has

There is a fixed number (464) of bits reserved for capabilities, and
when the capabilities bits change, the QXL_INTERRUPT_CLIENT interrupt
is generated.

Signed-off-by: Soren Sandmann <ssp@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
12 years agospice: make number of surfaces runtime-configurable.
Gerd Hoffmann [Tue, 4 Sep 2012 09:39:41 +0000 (11:39 +0200)]
spice: make number of surfaces runtime-configurable.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
12 years agoconfigure: print spice-protocol and spice-server versions
Alon Levy [Wed, 22 Aug 2012 08:16:26 +0000 (11:16 +0300)]
configure: print spice-protocol and spice-server versions

Signed-off-by: Alon Levy <alevy@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
12 years agoqxl: add QXL_IO_MONITORS_CONFIG_ASYNC
Alon Levy [Wed, 22 Aug 2012 08:16:25 +0000 (11:16 +0300)]
qxl: add QXL_IO_MONITORS_CONFIG_ASYNC

Revision bumped to 4 for new IO support, enabled for spice-server >=
0.11.1. New io enabled if revision is 4. Revision can be set to 4.

[ kraxel: 3 continues to be the default revision.  Once we have a new
          stable spice-server release and the qemu patches to enable
          the new bits merged we'll go flip the switch and make rev4
          the default ]

This io calls the corresponding new spice api
spice_qxl_monitors_config_async to let spice-server read a new guest set
monitors config and notify the client.

On migration reissue spice_qxl_monitors_config_async.

RHBZ: 770842

Signed-off-by: Alon Levy <alevy@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
fixup

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
12 years agoqxl: disallow unknown revisions
Alon Levy [Tue, 21 Aug 2012 10:51:32 +0000 (13:51 +0300)]
qxl: disallow unknown revisions

Signed-off-by: Alon Levy <alevy@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
12 years agoqxl/update_area_io: guest_bug on invalid parameters
Alon Levy [Tue, 21 Aug 2012 10:51:31 +0000 (13:51 +0300)]
qxl/update_area_io: guest_bug on invalid parameters

Signed-off-by: Alon Levy <alevy@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
12 years agospice: increase the verbosity of spice section in "qemu --help"
Yonit Halperin [Tue, 21 Aug 2012 10:54:20 +0000 (13:54 +0300)]
spice: increase the verbosity of spice section in "qemu --help"

Added all spice options to the help string. This can be used by libvirt
to determine which spice related features are supported by qemu.

Signed-off-by: Yonit Halperin <yhalperi@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
12 years agospice: adding seamless-migration option to the command line
Yonit Halperin [Tue, 21 Aug 2012 08:51:59 +0000 (11:51 +0300)]
spice: adding seamless-migration option to the command line

The seamless-migration flag is required in order to identify
whether libvirt supports the new QEVENT_SPICE_MIGRATE_COMPLETED or not
(by default the flag is off).
New libvirt versions that wait for QEVENT_SPICE_MIGRATE_COMPLETED should turn on this flag.
When this flag is off, spice fallbacks to its old migration method, which
can result in data loss.

Signed-off-by: Yonit Halperin <yhalperi@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
12 years agospice: add 'migrated' flag to spice info
Yonit Halperin [Tue, 21 Aug 2012 08:51:58 +0000 (11:51 +0300)]
spice: add 'migrated' flag to spice info

The flag is 'true' when spice migration has completed on the src side.
It is needed for a case where libvirt dies before migration completes
and it misses the event QEVENT_SPICE_MIGRATE_COMPLETED.
When libvirt is restored and queries the migration status, it also needs
to query spice and check if its migration has completed.

Signed-off-by: Yonit Halperin <yhalperi@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
12 years agospice migration: add QEVENT_SPICE_MIGRATE_COMPLETED
Yonit Halperin [Tue, 21 Aug 2012 08:51:57 +0000 (11:51 +0300)]
spice migration: add QEVENT_SPICE_MIGRATE_COMPLETED

When migrating, libvirt queries the migration status, and upon migration
completions, it closes the migration src. On the other hand, when
migration is completed, spice transfers data from the src to destination
via the client. This data is required for keeping the spice session
after migration, without suffering from data loss and inconsistencies.
In order to allow this data transfer, we add QEVENT for signaling
libvirt that spice migration has completed, and libvirt needs to wait
for this event before quitting the src process.

Signed-off-by: Yonit Halperin <yhalperi@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
12 years agospice: notify on vm state change only via spice_server_vm_start/stop
Yonit Halperin [Tue, 21 Aug 2012 08:51:56 +0000 (11:51 +0300)]
spice: notify on vm state change only via spice_server_vm_start/stop

QXLWorker->start/stop are deprecated since spice-server 0.11.2

Signed-off-by: Yonit Halperin <yhalperi@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
12 years agospice: notify spice server on vm start/stop
Yonit Halperin [Tue, 21 Aug 2012 08:51:55 +0000 (11:51 +0300)]
spice: notify spice server on vm start/stop

Spice server needs to know about the vm state in order to prevent
attempts to write to devices when they are stopped, mainly during
the non-live stage of migration.
Instead, spice will take care of restoring this writes, on the migration
target side, after migration completes.

Signed-off-by: Yonit Halperin <yhalperi@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
12 years agospice: abort on invalid streaming cmdline params
Christophe Fergeau [Mon, 13 Aug 2012 08:32:32 +0000 (10:32 +0200)]
spice: abort on invalid streaming cmdline params

When parsing its command line parameters, spice aborts when it
finds unexpected values, except for the 'streaming-video' option.
This happens because the parsing of the parameters for this option
is done using the 'name2enum' helper, which does not error out
on unknown values. Using the 'parse_name' helper makes sure we
error out in this case. Looking at git history, the use of
'name2enum' instead of 'parse_name' seems to have been an oversight,
so let's change to that now.

Fixes rhbz#831708

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
12 years agoUpdate version for 1.2.0
Anthony Liguori [Wed, 5 Sep 2012 12:50:01 +0000 (07:50 -0500)]
Update version for 1.2.0

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoconsole: bounds check whenever changing the cursor due to an escape code
Ian Campbell [Tue, 4 Sep 2012 15:26:09 +0000 (10:26 -0500)]
console: bounds check whenever changing the cursor due to an escape code

This is XSA-17 / CVE-2012-3515

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>