sdk/emulator/qemu.git
11 years agoAdd compat for gdk_drawable_get_size on GTK3
Daniel P. Berrange [Mon, 25 Feb 2013 15:20:34 +0000 (15:20 +0000)]
Add compat for gdk_drawable_get_size on GTK3

GTK3 lacks the gdk_drawable_get_size method, so we create a
stub impl which gets the get_width/get_height mehtods instead

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Message-id: 1361805646-6425-2-git-send-email-berrange@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agogtk ui: unbreak spice
Gerd Hoffmann [Mon, 25 Feb 2013 15:02:30 +0000 (16:02 +0100)]
gtk ui: unbreak spice

Merge of the gtk ui brought a initialitation order issue for spice:
The using_spice variable isn't set yet when checked, leading to the
default UI being activated (additionally to spice remote access).

Let's set display_remote when we find a -spice switch on the command
line, like we do for vnc.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Message-id: 1361804550-15858-1-git-send-email-kraxel@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoMerge remote-tracking branch 'kwolf/for-anthony' into staging
Anthony Liguori [Tue, 26 Feb 2013 13:44:39 +0000 (07:44 -0600)]
Merge remote-tracking branch 'kwolf/for-anthony' into staging

# By Paolo Bonzini (7) and others
# Via Kevin Wolf
* kwolf/for-anthony: (22 commits)
  pc: add compatibility machine types for 1.4
  blockdev: enable discard by default
  qemu-nbd: add --discard option
  blockdev: add discard suboption to -drive
  block: implement BDRV_O_UNMAP
  block: complete all IOs before .bdrv_truncate
  coroutine: trim down nesting level in perf_nesting test
  coroutine: move pooling to common code
  qemu-iotests: Test qcow2 image creation options
  qemu-iotests: Add qemu-img compare test
  qemu-img: Add compare subcommand
  qemu-img: Add "Quiet mode" option
  block: Add synchronous wrapper for bdrv_co_is_allocated_above
  block: refuse negative iops and bps values
  block: use Error in do_check_io_limits()
  qcow2: support compressed clusters in BlockFragInfo
  qemu-img: add compressed clusters to BlockFragInfo
  qemu-img: fix missing space in qemu-img check output
  qcow2: record fragmentation statistics during check
  qcow2: introduce check_refcounts_l1/l2() flags
  ...

11 years agoMerge remote-tracking branch 'quintela/stats.next' into staging
Anthony Liguori [Tue, 26 Feb 2013 13:44:32 +0000 (07:44 -0600)]
Merge remote-tracking branch 'quintela/stats.next' into staging

# By Juan Quintela
# Via Juan Quintela
* quintela/stats.next:
  migration: calculate expected_downtime
  migration: don't account sleep time for calculating bandwidth
  migration: calculate end time after we have sent the data
  migration: change initial value of expected_downtime

11 years agoMerge remote-tracking branch 'luiz/queue/qmp' into staging
Anthony Liguori [Tue, 26 Feb 2013 13:44:24 +0000 (07:44 -0600)]
Merge remote-tracking branch 'luiz/queue/qmp' into staging

# By Markus Armbruster
# Via Luiz Capitulino
* luiz/queue/qmp:
  check-qjson: More thorough testing of UTF-8 in strings

11 years agotarget-ppc: Fix SUBFE carry
Richard Henderson [Mon, 25 Feb 2013 19:41:40 +0000 (11:41 -0800)]
target-ppc: Fix SUBFE carry

While ~T0+T1+CF = T1-T0+CF-1 is true for the low 32-bits,
it does not produce the correct carry-out to bit 33.  Do
exactly what the manual says.

Cc: Alexander Graf <agraf@suse.de>
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agotarget-arm: Fix sbc_CC carry
Richard Henderson [Mon, 25 Feb 2013 19:41:39 +0000 (11:41 -0800)]
target-arm: Fix sbc_CC carry

While T0+~T1+CF = T0-T1+CF-1 is true for the low 32-bits,
it does not produce the correct carry-out to bit 33.  Do
exactly what the manual says.

Using the ~T1 makes the add and subtract code paths nearly
identical, so have sbc_CC use adc_CC.

Cc: Peter Maydell <peter.maydell@linaro.org>
Reported-by: Laurent Desnogues <laurent.desnogues@gmail.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoarm/translate.c: Fix adc_CC/sbc_CC implementation
Peter Crosthwaite [Mon, 25 Feb 2013 19:41:38 +0000 (11:41 -0800)]
arm/translate.c: Fix adc_CC/sbc_CC implementation

commits 49b4c31efcce45ab714f286f14fa5d5173f9069d and
2de68a4900ef6eb67380b0c128abfe1976bc66e8 reworked the implementation of adc_CC
and sub_CC. The new implementations (on the TCG_TARGET_HAS_add2_i32 code path)
are incorrect. The new logic is:

CF:NF = 0:A +/- 0:CF
CF:NF = CF:A +/- 0:B

The lower 32 bits of the intermediate result stored in NF needs to be passes
into the second addition in place of A (s/CF:A/CF:NF):

CF:NF = 0:A +/- 0:CF
CF:NF = CF:NF +/- 0:B

This patch fixes the issue.

Cc: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agotarget-mips: fix for sign-issue in MULQ_W helper
Petar Jovanovic [Thu, 7 Feb 2013 18:36:09 +0000 (19:36 +0100)]
target-mips: fix for sign-issue in MULQ_W helper

Correct sign-propagation before multiplication in MULQ_W helper.
The change also fixes previously incorrect expected values in the
tests for MULQ_RS.W and MULQ_S.W.

Signed-off-by: Petar Jovanovic <petarj@mips.com>
Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
11 years agotarget-mips: fix for incorrect multiplication with MULQ_S.PH
Petar Jovanovic [Wed, 6 Feb 2013 17:05:25 +0000 (18:05 +0100)]
target-mips: fix for incorrect multiplication with MULQ_S.PH

The change corrects sign-related issue with MULQ_S.PH. It also includes
extension to the already existing test which will trigger the issue.

Signed-off-by: Petar Jovanovic <petarj@mips.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
11 years agotarget-xtensa: Use add2/sub2 for mac
Richard Henderson [Wed, 20 Feb 2013 07:52:26 +0000 (23:52 -0800)]
target-xtensa: Use add2/sub2 for mac

Cc: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agotarget-xtensa: Use mul*2 for mul*hi
Richard Henderson [Wed, 20 Feb 2013 07:52:25 +0000 (23:52 -0800)]
target-xtensa: Use mul*2 for mul*hi

Cc: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agotarget-unicore32: Use mul*2 for do_mult
Richard Henderson [Wed, 20 Feb 2013 07:52:24 +0000 (23:52 -0800)]
target-unicore32: Use mul*2 for do_mult

Cc: Guan Xuetao <gxt@mprc.pku.edu.cn>
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agotarget-sh4: Use mul*2 for dmul*
Richard Henderson [Wed, 20 Feb 2013 07:52:23 +0000 (23:52 -0800)]
target-sh4: Use mul*2 for dmul*

Cc: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agotarget-sparc: Use mul*2 for multiply
Richard Henderson [Wed, 20 Feb 2013 07:52:22 +0000 (23:52 -0800)]
target-sparc: Use mul*2 for multiply

Cc: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agotarget-sparc: Use official add2/sub2 interfaces for addx/subx
Richard Henderson [Wed, 20 Feb 2013 07:52:21 +0000 (23:52 -0800)]
target-sparc: Use official add2/sub2 interfaces for addx/subx

Cc: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agotarget-ppc: Compute mullwo without branches
Richard Henderson [Wed, 20 Feb 2013 07:52:20 +0000 (23:52 -0800)]
target-ppc: Compute mullwo without branches

Cc: Alexander Graf <agraf@suse.de>
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agotarget-ppc: Compute arithmetic shift carry without branches
Richard Henderson [Wed, 20 Feb 2013 07:52:19 +0000 (23:52 -0800)]
target-ppc: Compute arithmetic shift carry without branches

Cc: Alexander Graf <agraf@suse.de>
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agotarget-ppc: Implement neg in terms of subf
Richard Henderson [Wed, 20 Feb 2013 07:52:18 +0000 (23:52 -0800)]
target-ppc: Implement neg in terms of subf

Cc: Alexander Graf <agraf@suse.de>
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agotarget-ppc: Use add2 for carry generation
Richard Henderson [Wed, 20 Feb 2013 07:52:17 +0000 (23:52 -0800)]
target-ppc: Use add2 for carry generation

Cc: Alexander Graf <agraf@suse.de>
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agotarget-ppc: Compute addition carry with setcond
Richard Henderson [Wed, 20 Feb 2013 07:52:16 +0000 (23:52 -0800)]
target-ppc: Compute addition carry with setcond

Cc: Alexander Graf <agraf@suse.de>
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agotarget-ppc: Compute addition overflow without branches
Richard Henderson [Wed, 20 Feb 2013 07:52:15 +0000 (23:52 -0800)]
target-ppc: Compute addition overflow without branches

Cc: Alexander Graf <agraf@suse.de>
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agotarget-ppc: Use setcond in gen_op_cmp
Richard Henderson [Wed, 20 Feb 2013 07:52:14 +0000 (23:52 -0800)]
target-ppc: Use setcond in gen_op_cmp

Which means that callers need not copy data into local tmps.

Cc: Alexander Graf <agraf@suse.de>
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agotarget-ppc: Split out SO, OV, CA fields from XER
Richard Henderson [Wed, 20 Feb 2013 07:52:13 +0000 (23:52 -0800)]
target-ppc: Split out SO, OV, CA fields from XER

In preparation for more efficient setting of these fields.

Cc: Alexander Graf <agraf@suse.de>
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agotarget-ppc: Use mul*2 in mulh* insns
Richard Henderson [Wed, 20 Feb 2013 07:52:12 +0000 (23:52 -0800)]
target-ppc: Use mul*2 in mulh* insns

Cc: Alexander Graf <agraf@suse.de>
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agotarget-cris: Use mul*2 in mul* insns
Richard Henderson [Wed, 20 Feb 2013 07:52:11 +0000 (23:52 -0800)]
target-cris: Use mul*2 in mul* insns

Cc: Edgar E. Iglesias <edgar.iglesias@gmail.com>
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agotarget-mips: Use mul[us]2 in [D]MULT[U] insns
Richard Henderson [Wed, 20 Feb 2013 07:52:10 +0000 (23:52 -0800)]
target-mips: Use mul[us]2 in [D]MULT[U] insns

Cc: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agotarget-arm: Implement sbc_cc inline
Richard Henderson [Wed, 20 Feb 2013 07:52:09 +0000 (23:52 -0800)]
target-arm: Implement sbc_cc inline

Use sub2 if available, otherwise use 64-bit arithmetic.

Cc: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agotarget-arm: Implement adc_cc inline
Richard Henderson [Wed, 20 Feb 2013 07:52:08 +0000 (23:52 -0800)]
target-arm: Implement adc_cc inline

Use add2 if available, otherwise use 64-bit arithmetic.

Cc: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agotarget-arm: Use add2 in gen_add_CC
Richard Henderson [Wed, 20 Feb 2013 07:52:07 +0000 (23:52 -0800)]
target-arm: Use add2 in gen_add_CC

Cc: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agotarget-arm: Use mul[us]2 and add2 in umlal et al
Richard Henderson [Wed, 20 Feb 2013 07:52:06 +0000 (23:52 -0800)]
target-arm: Use mul[us]2 and add2 in umlal et al

Cc: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agotarget-arm: Use mul[us]2 in gen_mul[us]_i64_i32
Richard Henderson [Wed, 20 Feb 2013 07:52:05 +0000 (23:52 -0800)]
target-arm: Use mul[us]2 in gen_mul[us]_i64_i32

Cc: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agotarget-s390x: Use mulu2 for mlgr insn
Richard Henderson [Wed, 20 Feb 2013 07:52:04 +0000 (23:52 -0800)]
target-s390x: Use mulu2 for mlgr insn

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agotarget-alpha: Use mulu2 for umulh insn
Richard Henderson [Wed, 20 Feb 2013 07:52:03 +0000 (23:52 -0800)]
target-alpha: Use mulu2 for umulh insn

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agotcg: Apply life analysis to 64-bit multiword arithmetic ops
Richard Henderson [Wed, 20 Feb 2013 07:52:02 +0000 (23:52 -0800)]
tcg: Apply life analysis to 64-bit multiword arithmetic ops

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agotcg: Implement muls2 with mulu2
Richard Henderson [Wed, 20 Feb 2013 07:52:01 +0000 (23:52 -0800)]
tcg: Implement muls2 with mulu2

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agotarget-i386: Use add2 to implement the ADX extension
Richard Henderson [Wed, 20 Feb 2013 07:52:00 +0000 (23:52 -0800)]
target-i386: Use add2 to implement the ADX extension

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agotcg-arm: Implement muls2_i32
Richard Henderson [Wed, 20 Feb 2013 07:51:58 +0000 (23:51 -0800)]
tcg-arm: Implement muls2_i32

We even had the encoding of smull already handy...

Cc: Andrzej Zaborowski <balrogg@gmail.com>
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agotcg-i386: Implement multiword arithmetic ops
Richard Henderson [Wed, 20 Feb 2013 07:51:57 +0000 (23:51 -0800)]
tcg-i386: Implement multiword arithmetic ops

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agotcg: Implement multiword addition helpers
Richard Henderson [Wed, 20 Feb 2013 07:51:56 +0000 (23:51 -0800)]
tcg: Implement multiword addition helpers

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agotcg: Implement multiword multiply helpers
Richard Henderson [Wed, 20 Feb 2013 07:51:55 +0000 (23:51 -0800)]
tcg: Implement multiword multiply helpers

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agotcg: Implement a 64-bit to 32-bit extraction helper
Richard Henderson [Wed, 20 Feb 2013 07:51:54 +0000 (23:51 -0800)]
tcg: Implement a 64-bit to 32-bit extraction helper

We're going to have use for this shortly in implementing other helpers.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agotcg: Add signed multiword multiplication operations
Richard Henderson [Wed, 20 Feb 2013 07:51:53 +0000 (23:51 -0800)]
tcg: Add signed multiword multiplication operations

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agotcg: Add 64-bit multiword arithmetic operations
Richard Henderson [Wed, 20 Feb 2013 07:51:52 +0000 (23:51 -0800)]
tcg: Add 64-bit multiword arithmetic operations

Matching the 32-bit multiword arithmetic that we already have.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agotcg-sparc: Always implement 32-bit multiword ops
Richard Henderson [Wed, 20 Feb 2013 07:51:51 +0000 (23:51 -0800)]
tcg-sparc: Always implement 32-bit multiword ops

Cc: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agotcg-i386: Always implement 32-bit multiword ops
Richard Henderson [Wed, 20 Feb 2013 07:51:50 +0000 (23:51 -0800)]
tcg-i386: Always implement 32-bit multiword ops

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agotcg: Make 32-bit multiword operations optional for 64-bit hosts
Richard Henderson [Wed, 20 Feb 2013 07:51:49 +0000 (23:51 -0800)]
tcg: Make 32-bit multiword operations optional for 64-bit hosts

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agoMerge branch 'eflags3' of git://github.com/rth7680/qemu
Blue Swirl [Sat, 23 Feb 2013 17:21:41 +0000 (17:21 +0000)]
Merge branch 'eflags3' of git://github.com/rth7680/qemu

* 'eflags3' of git://github.com/rth7680/qemu: (61 commits)
  target-i386: Use movcond to implement shiftd.
  target-i386: Discard CC_OP computation in set_cc_op also
  target-i386: Use movcond to implement rotate flags.
  target-i386: Use movcond to implement shift flags.
  target-i386: Add CC_OP_CLR
  target-i386: Implement tzcnt and fix lzcnt
  target-i386: Use clz/ctz for bsf/bsr helpers
  target-i386: Implement ADX extension
  target-i386: Implement RORX
  target-i386: Implement SHLX, SARX, SHRX
  target-i386: Implement PDEP, PEXT
  target-i386: Implement MULX
  target-i386: Implement BZHI
  target-i386: Implement BLSR, BLSMSK, BLSI
  target-i386: Implement BEXTR
  target-i386: Implement ANDN
  target-i386: Implement MOVBE
  target-i386: Decode the VEX prefixes
  target-i386: Tidy prefix parsing
  target-i386: Use CC_SRC2 for ADC and SBB
  ...

11 years agoReplace all setjmp()/longjmp() with sigsetjmp()/siglongjmp()
Peter Maydell [Wed, 20 Feb 2013 15:21:09 +0000 (15:21 +0000)]
Replace all setjmp()/longjmp() with sigsetjmp()/siglongjmp()

The setjmp() function doesn't specify whether signal masks are saved and
restored; on Linux they are not, but on BSD (including MacOSX) they are.
We want to have consistent behaviour across platforms, so we should
always use "don't save/restore signal mask" (this is also generally
going to be faster). This also works around a bug in MacOSX where the
signal-restoration on longjmp() affects the signal mask for a completely
different thread, not just the mask for the thread which did the longjmp.
The most visible effect of this was that ctrl-C was ignored on MacOSX
because the CPU thread did a longjmp which resulted in its signal mask
being applied to every thread, so that all threads had SIGINT and SIGTERM
blocked.

The POSIX-sanctioned portable way to do a jump without affecting signal
masks is to siglongjmp() to a sigjmp_buf which was created by calling
sigsetjmp() with a zero savemask parameter, so change all uses of
setjmp()/longjmp() accordingly. [Technically POSIX allows sigsetjmp(buf, 0)
to save the signal mask; however the following siglongjmp() must not
restore the signal mask, so the pair can be effectively considered as
"sigjmp/longjmp which don't touch the mask".]

For Windows we provide a trivial sigsetjmp/siglongjmp in terms of
setjmp/longjmp -- this is OK because no user will ever pass a non-zero
savemask.

The setjmp() uses in tests/tcg/test-i386.c and tests/tcg/linux-test.c
are left untouched because these are self-contained singlethreaded
test programs intended to be run under QEMU's Linux emulation, so they
have neither the portability nor the multithreading issues to deal with.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Tested-by: Stefan Weil <sw@weilnetz.de>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agoSPARC LEON power-down support added
Ronald Hecht [Tue, 19 Feb 2013 11:45:07 +0000 (12:45 +0100)]
SPARC LEON power-down support added

Signed-off-by: Ronald Hecht <address@hidden>
Signed-off-by: Fabien Chouteau <chouteau@adacore.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agoAdded LEON MMU ASI mappings and corrected LEON3 MMU masks.
Ronald Hecht [Tue, 19 Feb 2013 11:45:06 +0000 (12:45 +0100)]
Added LEON MMU ASI mappings and corrected LEON3 MMU masks.

This patch adds SPARC ASI mappings that are used by the LEON processor.It also
corrects the MMU context register and context table pointer mask of the LEON3.

Signed-off-by: Ronald Hecht <ronald.hecht@gmx.de>
Signed-off-by: Fabien Chouteau <chouteau@adacore.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agogrlib-apbuart: Add support of various flags
Ronald Hecht [Tue, 19 Feb 2013 16:22:11 +0000 (17:22 +0100)]
grlib-apbuart: Add support of various flags

 - enable/disable Rx and Tx
 - Rx and Tx interrupt
 - Tx FIFO empty and Tx SHIFT empty

Signed-off-by: Fabien Chouteau <chouteau@adacore.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agoTypo: replace gptimer by apbuart
Fabien Chouteau [Tue, 19 Feb 2013 16:22:10 +0000 (17:22 +0100)]
Typo: replace gptimer by apbuart

Signed-off-by: Fabien Chouteau <chouteau@adacore.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agodisas/i386.c: Add explicit braces round empty for-loop body
Peter Maydell [Sat, 2 Feb 2013 17:17:54 +0000 (17:17 +0000)]
disas/i386.c: Add explicit braces round empty for-loop body

Add explicit braces round an empty for-loop body; this fits
QEMU style and is easier to read than an inconspicuous semicolon
at the end of the line. It also silences a clang warning:

disas/i386.c:4723:49: warning: for loop has empty body [-Wempty-body]
          for (i = 0; tmp[i] == '0' && tmp[i + 1]; i++);
                                                       ^
disas/i386.c:4723:49: note: put the semicolon on a separate line to silence this warning [-Wempty-body]

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agoqemu-log: Remove qemu_log_try_set_file() and its users
Peter Maydell [Tue, 12 Feb 2013 16:13:27 +0000 (16:13 +0000)]
qemu-log: Remove qemu_log_try_set_file() and its users

Remove the function qemu_log_try_set_file() and its users (which
are all in TCG code generation functions for various targets).
This function was added to abstract out code which was originally
written as "if (!logfile) logfile = stderr;" in order that BUG:
case code which did an unguarded "fprintf(logfile, ...)" would
not crash if debug logging was not enabled. Since those direct
uses of logfile have also been abstracted away into qemu_log()
calls which check for a NULL logfile, there is no need for the
target-* files to mess with the user's chosen logging settings.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Acked-by: Michael Walle <michael@walle.cc>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agoxhci: fix bad print specifier
Hervé Poussineau [Thu, 21 Feb 2013 21:58:08 +0000 (22:58 +0100)]
xhci: fix bad print specifier

This fixes the following compilation error:
hw/usb/hcd-xhci.c:1156:17: error: format â€˜%llx’ expects argument of type
‘long long unsigned int’, but argument 4 has type â€˜unsigned int’

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Reviewed-by: Stefan Weil <sw@weilnetz.de>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agogtk: Rename File to Machine menu and add pause, reset and power down items
Jan Kiszka [Fri, 22 Feb 2013 19:53:33 +0000 (20:53 +0100)]
gtk: Rename File to Machine menu and add pause, reset and power down items

This adds basic guest control commands to the "Machine" menu - a nice
added-value for the GTK UI.

We use "pause" as the term for stopping the machine here. So reword also
the related caption tag.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoui/gtk: Use menu item from stock for full screen
Stefan Weil [Fri, 22 Feb 2013 19:33:34 +0000 (20:33 +0100)]
ui/gtk: Use menu item from stock for full screen

This reduces the required translations and gives a nicer menu
with an icon.

The full screen menu item is no longer a check menu item.
A checked item is not visible in full screen mode,
so it is not needed for this special menu item.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Message-id: 1361561614-11180-1-git-send-email-sw@weilnetz.de
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoui/gtk: Support versions of VTE before 0.26
Stefan Weil [Fri, 22 Feb 2013 19:09:59 +0000 (20:09 +0100)]
ui/gtk: Support versions of VTE before 0.26

This is needed for current Debian stable (Squeeze).

VTE versions before 0.26 did not support VtePty.

Lower the version requirement and use alternate code which works for Debian.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Message-id: 1361560199-28906-1-git-send-email-sw@weilnetz.de
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoReenable -Wstrict-prototypes
Kevin Wolf [Fri, 22 Feb 2013 20:08:51 +0000 (21:08 +0100)]
Reenable -Wstrict-prototypes

One part of this patch reverts commit 22bc9a46, which disabled the
warning. The rest of it deals with the warning by adding a #pragma for
newer gcc and by disabling -Werror for compilers that can't deal with
the #pragma.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Message-id: 1361563731-13307-1-git-send-email-kwolf@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agopc: add compatibility machine types for 1.4
Paolo Bonzini [Fri, 8 Feb 2013 13:06:15 +0000 (14:06 +0100)]
pc: add compatibility machine types for 1.4

Adds both pc-i440fx-1.4 and pc-q35-1.4.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoblockdev: enable discard by default
Paolo Bonzini [Fri, 8 Feb 2013 13:06:14 +0000 (14:06 +0100)]
blockdev: enable discard by default

Because discard is now a host parameter, we can always fake it as enabled
in the guest.  This is an extension of the current choice to ignore
"not supported" errors from the host when discard_granularity is set
to nonzero.

The default granularity is set to the logical block size or 4k, whichever
is largest, because cluster sizes below 4k are rarely used and 4K is a
typical block size for files.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoqemu-nbd: add --discard option
Paolo Bonzini [Fri, 8 Feb 2013 13:06:13 +0000 (14:06 +0100)]
qemu-nbd: add --discard option

Similar to --cache and --aio, this option mimics the discard suboption
of "-drive".

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoblockdev: add discard suboption to -drive
Paolo Bonzini [Fri, 8 Feb 2013 13:06:12 +0000 (14:06 +0100)]
blockdev: add discard suboption to -drive

Add support for BDRV_O_UNMAP from the QEMU command-line.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoblock: implement BDRV_O_UNMAP
Paolo Bonzini [Fri, 8 Feb 2013 13:06:11 +0000 (14:06 +0100)]
block: implement BDRV_O_UNMAP

It is better to present homogeneous hardware independent of the storage
technology that is chosen on the host, hence we make discard a host
parameter; the user can choose whether to pass it down to the image
format and protocol, or to ignore it.

Using DISCARD with filesystems can cause very severe fragmentation, so it
is left default-off for now.  This can change later when we implement the
"anchor" operation for efficient management of preallocated files.

There is still one choice to make: whether DISCARD has an effect on the
dirty bitmap or not.  I chose yes, though there is a disadvantage: if
the guest is buggy and issues discards for data that is in use, there
will be no way to migrate storage for that guest without downgrading
the machine type to an older one.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoblock: complete all IOs before .bdrv_truncate
Peter Lieven [Mon, 18 Feb 2013 12:48:31 +0000 (13:48 +0100)]
block: complete all IOs before .bdrv_truncate

bdrv_truncate() invalidates the bdrv_check_request() result for
in-flight requests, so there should better be none.

Cc: qemu-stable@nongnu.org
Signed-off-by: Peter Lieven <pl@kamp.de>
Reported-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agocoroutine: trim down nesting level in perf_nesting test
Paolo Bonzini [Tue, 19 Feb 2013 10:59:10 +0000 (11:59 +0100)]
coroutine: trim down nesting level in perf_nesting test

20000 nested coroutines require 20 GB of virtual address space.
Only nest 1000 of them so that the test (only enabled with
"-m perf" on the command line) runs on 32-bit machines too.

Cc: qemu-stable@nongnu.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agocoroutine: move pooling to common code
Paolo Bonzini [Tue, 19 Feb 2013 10:59:09 +0000 (11:59 +0100)]
coroutine: move pooling to common code

The coroutine pool code is duplicated between the ucontext and
sigaltstack backends, and absent from the win32 backend.  But the
code can be shared easily by moving it to qemu-coroutine.c.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoqemu-iotests: Test qcow2 image creation options
Kevin Wolf [Tue, 29 Jan 2013 09:46:52 +0000 (10:46 +0100)]
qemu-iotests: Test qcow2 image creation options

Just create lots of images and try out each of the creation options that
qcow2 provides (except backing_file/fmt for now)

I'm not totally happy with the behaviour of qemu-img in each of the
cases, but let's be explicit and update the test when we do change
things later.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoqemu-iotests: Add qemu-img compare test
Miroslav Rezanina [Wed, 13 Feb 2013 08:09:42 +0000 (09:09 +0100)]
qemu-iotests: Add qemu-img compare test

Simple test for qemu-img compare to check it's working correctly.

Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agoqemu-img: Add compare subcommand
Miroslav Rezanina [Wed, 13 Feb 2013 08:09:41 +0000 (09:09 +0100)]
qemu-img: Add compare subcommand

This patch adds new qemu-img subcommand that compares content of two disk
images.

Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agoqemu-img: Add "Quiet mode" option
Miroslav Rezanina [Wed, 13 Feb 2013 08:09:40 +0000 (09:09 +0100)]
qemu-img: Add "Quiet mode" option

There can be a need to turn output to stdout off. This patch adds a -q option
that enable "Quiet mode". In Quiet mode, only errors are printed out.

Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agoblock: Add synchronous wrapper for bdrv_co_is_allocated_above
Miroslav Rezanina [Wed, 13 Feb 2013 08:09:39 +0000 (09:09 +0100)]
block: Add synchronous wrapper for bdrv_co_is_allocated_above

There's no synchronous wrapper for bdrv_co_is_allocated_above function
so it's not possible to check for sector allocation in an image with
a backing file.

Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agoblock: refuse negative iops and bps values
Stefan Hajnoczi [Wed, 13 Feb 2013 15:53:43 +0000 (16:53 +0100)]
block: refuse negative iops and bps values

Negative I/O throttling iops and bps values do not make sense so reject
them with an error message.

Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agoblock: use Error in do_check_io_limits()
Stefan Hajnoczi [Wed, 13 Feb 2013 15:53:42 +0000 (16:53 +0100)]
block: use Error in do_check_io_limits()

The do_check_io_limits() function returns false when I/O limits are
invalid but it doesn't set an Error to indicate why.  The two
do_check_io_limits() callers duplicate error reporting.  Solve this by
passing an Error pointer into do_check_io_limits().

Note that the two callers report slightly different errors: drive_init()
prints a custom error message while qmp_block_set_io_throttle() does
error_set(errp, QERR_INVALID_PARAMETER_COMBINATION).

QERR_INVALID_PARAMETER_COMBINATION is a generic error, see
include/qapi/qmp/qerror.h:

  #define QERR_INVALID_PARAMETER_COMBINATION \
    ERROR_CLASS_GENERIC_ERROR, "Invalid parameter combination"

Since it is generic we are not obliged to keep this error.  Switch to
the custom error message which contains more information.

This patch prepares for adding additional checks with their own error
messages to do_check_io_limits().  The next patch adds a new check.

Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agoqcow2: support compressed clusters in BlockFragInfo
Stefan Hajnoczi [Thu, 7 Feb 2013 16:15:05 +0000 (17:15 +0100)]
qcow2: support compressed clusters in BlockFragInfo

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agoqemu-img: add compressed clusters to BlockFragInfo
Stefan Hajnoczi [Thu, 7 Feb 2013 16:15:04 +0000 (17:15 +0100)]
qemu-img: add compressed clusters to BlockFragInfo

Show how many clusters are compressed.  This can be used to monitor how
many compressed clusters remain and whether to recompress the image.

Suggested-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agoqemu-img: fix missing space in qemu-img check output
Stefan Hajnoczi [Thu, 7 Feb 2013 16:15:03 +0000 (17:15 +0100)]
qemu-img: fix missing space in qemu-img check output

The qemu-img check fragmentation printf() is missing a space before the
'=' sign.  The human output is not guaranteed to be stable and we are
not aware of screen scrapers, so add the missing space.

Also fix the missing indentation of the printf() arguments.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agoqcow2: record fragmentation statistics during check
Stefan Hajnoczi [Thu, 7 Feb 2013 16:15:02 +0000 (17:15 +0100)]
qcow2: record fragmentation statistics during check

The qemu-img check command can display fragmentation statistics:
 * Total number of clusters in virtual disk
 * Number of allocated clusters
 * Number of fragmented clusters

This patch adds fragmentation statistics support to qcow2.

Compressed and normal clusters count as allocated.  Zero clusters are
not counted as allocated unless their L2 entry has a non-zero offset
(e.g. preallocation).

Only the current L1 table counts towards the statistics - snapshots are
ignored.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agoqcow2: introduce check_refcounts_l1/l2() flags
Stefan Hajnoczi [Thu, 7 Feb 2013 16:15:01 +0000 (17:15 +0100)]
qcow2: introduce check_refcounts_l1/l2() flags

The check_refcounts_l1/l2() functions have a check_copied argument to
check that the QCOW_O_COPIED flag is consistent with refcount == 1.
This should be a bool, not an int.

However, the next patch introduces qcow2 fragmentation statistics and
also needs to pass an option to check_refcounts_l1/l2().  This is a good
opportunity to use an int flags field.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agoqemu-img: add json output option to the check command
Federico Simoncelli [Mon, 28 Jan 2013 11:59:47 +0000 (06:59 -0500)]
qemu-img: add json output option to the check command

This option --output=[human|json] makes qemu-img check output a human
or JSON representation at the choice of the user.

Signed-off-by: Federico Simoncelli <fsimonce@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoqemu-img: find the image end offset during check
Federico Simoncelli [Mon, 28 Jan 2013 11:59:46 +0000 (06:59 -0500)]
qemu-img: find the image end offset during check

This patch adds the support for reporting the image end offset (in
bytes). This is particularly useful after a conversion (or a rebase)
where the destination is a block device in order to find the first
unused byte at the end of the image.

Signed-off-by: Federico Simoncelli <fsimonce@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoui/gtk: require at least GTK 2.18 and VTE 0.26
Anthony Liguori [Fri, 22 Feb 2013 14:40:30 +0000 (08:40 -0600)]
ui/gtk: require at least GTK 2.18 and VTE 0.26

This gives us the bare amount of features we need.  We can add work arounds
for older versions and lower the requirement but this should be a good
starting point.

Suggested-by: Daniel Berrange <berrange@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
---
v1 -> v2
 - tremendous simplification suggested by danpb

11 years agounbreak hw/usb/redirect.c build
Gerd Hoffmann [Fri, 22 Feb 2013 11:11:59 +0000 (12:11 +0100)]
unbreak hw/usb/redirect.c build

Commit 8550a02d1239415342959f6a32d178bc05c557cc added a streams
parameter to usb_wakeup and didn't update redirect.c.  Fix it.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoui/gtk: Fix build (missing include for setlocale)
Stefan Weil [Fri, 22 Feb 2013 06:28:01 +0000 (07:28 +0100)]
ui/gtk: Fix build (missing include for setlocale)

At least for Ubuntu Linux locale.h is needed.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Message-id: 1361514481-26164-1-git-send-email-sw@weilnetz.de
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agomigration: calculate expected_downtime
Juan Quintela [Fri, 1 Feb 2013 12:22:37 +0000 (13:22 +0100)]
migration: calculate expected_downtime

We removed the calculation in commit e4ed1541ac9413eac494a03532e34beaf8a7d1c5

Now we add it back.  We need to create dirty_bytes_rate because we
can't include cpu-all.h from migration.c, and there is no other way to
include TARGET_PAGE_SIZE.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Orit Wasserman <owasserm@redhat.com>
11 years agomigration: don't account sleep time for calculating bandwidth
Juan Quintela [Fri, 1 Feb 2013 11:41:38 +0000 (12:41 +0100)]
migration: don't account sleep time for calculating bandwidth

While we are sleeping we are not sending, so we should not use that
time to estimate our bandwidth.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Orit Wasserman <owasserm@redhat.com>
11 years agomigration: calculate end time after we have sent the data
Juan Quintela [Fri, 1 Feb 2013 11:39:08 +0000 (12:39 +0100)]
migration: calculate end time after we have sent the data

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Orit Wasserman <owasserm@redhat.com>
11 years agomigration: change initial value of expected_downtime
Juan Quintela [Fri, 1 Feb 2013 10:12:26 +0000 (11:12 +0100)]
migration: change initial value of expected_downtime

0 is a very bad initial value, what we are trying to get is
max_downtime, so that is a much better estimation.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Orit Wasserman <owasserm@redhat.com>
11 years agogtk: suppress accelerators from the File menu when grab is active
Anthony Liguori [Wed, 20 Feb 2013 13:43:26 +0000 (07:43 -0600)]
gtk: suppress accelerators from the File menu when grab is active

If you're full screen, you probably expect Ctrl-Q to go to the guest,
not the host.  I think restricting certain menus is the right way to
handle this generally speaking.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Message-id: 1361367806-4599-10-git-send-email-aliguori@us.ibm.com

11 years agogtk: make default UI (v5)
Anthony Liguori [Wed, 20 Feb 2013 13:43:25 +0000 (07:43 -0600)]
gtk: make default UI (v5)

A user can still enable SDL with '-sdl' or '-display sdl' but start making the
default display GTK by default.

I'd also like to deprecate the SDL display and remove it in a few releases.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Message-id: 1361367806-4599-9-git-send-email-aliguori@us.ibm.com

11 years agogtk: add translation support (v5)
Anthony Liguori [Wed, 20 Feb 2013 13:43:24 +0000 (07:43 -0600)]
gtk: add translation support (v5)

This includes a de_DE translation from Kevin Wolf and an it translation from
Paolo Bonzini.

Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Kevin Wolf <kwolf@redhat.com>
Cc: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Message-id: 1361367806-4599-8-git-send-email-aliguori@us.ibm.com

11 years agogtk: add support for screen scaling and full screen (v5)
Anthony Liguori [Wed, 20 Feb 2013 13:43:23 +0000 (07:43 -0600)]
gtk: add support for screen scaling and full screen (v5)

Basic menu items to enter full screen mode and zoom in/out.  Unlike SDL, we
don't allow arbitrary scaling based on window resizing.  The current behavior
with SDL causes a lot of problems for me.

Sometimes I accidentally resize the window a tiny bit while trying to move it
(Ubuntu's 1-pixel window decorations don't help here).  After that, scaling is
now active and if the screen changes size again, badness ensues since the
aspect ratio is skewed.

Allowing zooming by 25% in and out should cover most use cases.  We can add a
more flexible scaling later but for now, I think this is a more friendly
behavior.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Message-id: 1361367806-4599-7-git-send-email-aliguori@us.ibm.com

11 years agogtk: add support for input grabbing (v2)
Anthony Liguori [Wed, 20 Feb 2013 13:43:22 +0000 (07:43 -0600)]
gtk: add support for input grabbing (v2)

There is a small deviation from SDL's behavior here.  Instead of Ctrl+Alt
triggering grab, we now use Ctrl-Alt-g to trigger grab.

GTK will not accept Ctrl+Alt as an accelerator since it just consists of
modifiers.  Having grab as a proper accelerator is important as it allows a user
to override the accelerator for accessibility purposes.

We also are not automatically grabbing on left-click.  Besides the inability to
tie mouse clicks to an accelerator, I think this behavior is hard to discover
and since it only happens depending on the guest state, it can lead to confusing
behavior.

This can be changed in the future if there's a strong resistence to dropping
left-click-to-grab, but I think we're better off dropping it.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Message-id: 1361367806-4599-6-git-send-email-aliguori@us.ibm.com

11 years agogtk: add virtual console support (v2)
Anthony Liguori [Wed, 20 Feb 2013 13:43:21 +0000 (07:43 -0600)]
gtk: add virtual console support (v2)

This enables VteTerminal to be used to render the text consoles.  VteTerminal is
the same widget used by gnome-terminal which means it's VT100 emulation is as
good as they come.

It's also screen reader accessible, supports copy/paste, proper scrolling and
most of the other features you would expect from a terminal widget.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Message-id: 1361367806-4599-5-git-send-email-aliguori@us.ibm.com

11 years agoui: add basic GTK gui (v5)
Anthony Liguori [Wed, 20 Feb 2013 13:43:20 +0000 (07:43 -0600)]
ui: add basic GTK gui (v5)

This is minimalistic and just contains the basic widget infrastructure.  The GUI
consists of a menu and a GtkNotebook.  To start with, the notebook has its tabs
hidden which provides a UI that looks very similar to SDL with the exception of
the menu bar.

The menu bar allows a user to toggle the visibility of the tabs.  Cairo is used
for rendering.

I used gtk-vnc as a reference.  gtk-vnc solves the same basic problems as QEMU
since it was originally written as a remote display for QEMU.  So for the most
part, the approach to rendering and keyboard handling should be pretty solid for
GTK.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Message-id: 1361367806-4599-4-git-send-email-aliguori@us.ibm.com

11 years agoconsole: allow VCs to be overridden by UI
Anthony Liguori [Wed, 20 Feb 2013 13:43:19 +0000 (07:43 -0600)]
console: allow VCs to be overridden by UI

We want to expose VCs using a VteTerminal widget.  We need access to provide our
own CharDriverState in order to do this.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Message-id: 1361367806-4599-3-git-send-email-aliguori@us.ibm.com

11 years agobuild: disable Wstrict-prototypes
Anthony Liguori [Wed, 20 Feb 2013 13:43:18 +0000 (07:43 -0600)]
build: disable Wstrict-prototypes

GTK won't build with strict-prototypes due to gtkitemfactory.h:

    /* We use () here to mean unspecified arguments. This is deprecated
     * as of C99, but we can't change it without breaking compatibility.
     * (Note that if we are included from a C++ program () will mean
     * (void) so an explicit cast will be needed.)
     */
    typedef void (*GtkItemFactoryCallback)  ();

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Message-id: 1361367806-4599-2-git-send-email-aliguori@us.ibm.com

11 years agoqom/object.c: Allow itf cast with num_itfs = 0
Peter Crosthwaite [Tue, 19 Feb 2013 04:02:10 +0000 (14:02 +1000)]
qom/object.c: Allow itf cast with num_itfs = 0

num_interfaces only tells you how many interfaces the concrete child class has
(as defined in the TypeInfo). This means if you have a child class which defines
no interfaces of its own, but its parent has interfaces you cannot cast to those
parent interfaces.

Fixed changing the guard to check the class->interfaces list instead (which is
a complete flattened list of implemented interfaces).

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Message-id: a8c2db3b9b1f3c4bb81aca352b69e33260f36545.1361246206.git.peter.crosthwaite@xilinx.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoqom/object.c: Reset interface list on inheritance
Peter Crosthwaite [Tue, 19 Feb 2013 04:02:09 +0000 (14:02 +1000)]
qom/object.c: Reset interface list on inheritance

The QOM framework will attempt the recreate a classes interface list from
scratch for each class. This means that a child class should zero out the
list of interfaces when cloned from the parent class.

Currently the list is memcpy()d from the parent to the child. As the interface
list is just a pointer to a list, this means the parent and child will share
the same list of interfaces. When the child inits, it will append its own
interfaces to the parents list. This is incorrect as the parent should not pick
up its childs interfaces.

This actually causes an infinite loop at class init time, as the child will
iterate through the parent interface list adding each itf to its own list(in
type_initialize()). As the list is (erroneously) shared, the new interface
instances for the child are appended to the parent, and the iterator never hits
the tail and loops forever.

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Message-id: 1f58d2b629d82865dbb2fd5ba8445854049c4382.1361246206.git.peter.crosthwaite@xilinx.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>