]> Git Repo - qemu.git/log
qemu.git
10 years agobsd-user: replace fprintf(stderr, ...) with error_report()
Le Tan [Fri, 9 May 2014 23:55:22 +0000 (07:55 +0800)]
bsd-user: replace fprintf(stderr, ...) with error_report()

Replace fprintf(stderr,...) with error_report() in files bsd-user/*.
The trailing "\n"s of the @fmt argument have been removed
because @fmt of error_report() should not contain newline.

Signed-off-by: Le Tan <[email protected]>
Signed-off-by: Michael Tokarev <[email protected]>
10 years agoaudio: replace fprintf(stderr, ...) with error_report() in audio
Le Tan [Fri, 9 May 2014 23:55:20 +0000 (07:55 +0800)]
audio: replace fprintf(stderr, ...) with error_report() in audio

Replace fprintf(stderr,...) with error_report() in files audio/*.
The trailing "\n"s of the @fmt argument have been removed
because @fmt of error_report() should not contain newline.

Signed-off-by: Le Tan <[email protected]>
Signed-off-by: Michael Tokarev <[email protected]>
10 years agolibcacard: fix wrong array expansion logic
Michael Tokarev [Fri, 23 May 2014 20:47:39 +0000 (00:47 +0400)]
libcacard: fix wrong array expansion logic

The currrent code in libcacard/vcard_emul_nss.c:vcard_emul_options()
has a weird bug in variable usage around expanding opts->vreader
array.

There's a helper variable, vreaderOpt, which is first needlessly
initialized to NULL, next, conditionally, only we have to expand
opts->vreader, receives array expansion from g_renew(), and next,
even if we don't actually perform expansion, the value of this
variable is assigned to the actual array, opts->vreader, which
was supposed to be expanded.

So, since we expand the array by READER_STEP increments, only
once in READER_STEP (=4) the code will work, in other 3/4 times
it will fail badly.

Fix this by not using this temp variable when expanding the
array, and by dropping the useless =NULL initializer too -
if it wasn't in place initially, compiler would have warned
us about this problem at the beginning.

Signed-off-by: Michael Tokarev <[email protected]>
Reviewed-by: Markus Armbruster <[email protected]>
10 years agolibcacard/vcard_emul_nss: Drop a redundant conditional
Markus Armbruster [Fri, 23 May 2014 11:24:39 +0000 (13:24 +0200)]
libcacard/vcard_emul_nss: Drop a redundant conditional

Bailing out when PK11_FindGenericObjects() returns null ensures the
loop that follows it executes at least once.  The "loop did not
execute" test right after it is useless.  Drop it.

Spotted by Coverity.

Signed-off-by: Markus Armbruster <[email protected]>
Reviewed-by: Alon Levy <[email protected]>
Signed-off-by: Michael Tokarev <[email protected]>
10 years agolibcacard: Convert two leftover realloc() to GLib
Markus Armbruster [Fri, 23 May 2014 11:24:37 +0000 (13:24 +0200)]
libcacard: Convert two leftover realloc() to GLib

Signed-off-by: Markus Armbruster <[email protected]>
Reviewed-by: Alon Levy <[email protected]>
Signed-off-by: Michael Tokarev <[email protected]>
10 years agolibcacard/vreader: Tighten assertion to clarify intent
Markus Armbruster [Fri, 23 May 2014 11:24:36 +0000 (13:24 +0200)]
libcacard/vreader: Tighten assertion to clarify intent

Bonus: hushes up Coverity.

Signed-off-by: Markus Armbruster <[email protected]>
Reviewed-by: Alon Levy <[email protected]>
Signed-off-by: Michael Tokarev <[email protected]>
10 years agolibcacard/vreader: Drop broken recovery from failed assertion
Markus Armbruster [Fri, 23 May 2014 11:24:35 +0000 (13:24 +0200)]
libcacard/vreader: Drop broken recovery from failed assertion

We suppress some code when we got unexpected status and assertion
checking is off:

     assert(card_status == VCARD_DONE);
     if (card_status == VCARD_DONE) {
         int size = MIN(*receive_buf_len, response->b_total_len);
         memcpy(receive_buf, response->b_data, size);
         *receive_buf_len = size;
    }

Such "recovery" is of dubious value even when it works.  This one
doesn't: it fails to assign to receive_buf[] and *receive_buf_len,
which the callers expect.

Make the code unconditional.

Signed-off-by: Markus Armbruster <[email protected]>
Reviewed-by: Alon Levy <[email protected]>
Signed-off-by: Michael Tokarev <[email protected]>
10 years agolibcacard: Plug memory leaks around vreader_get_reader_list()
Markus Armbruster [Fri, 23 May 2014 11:24:34 +0000 (13:24 +0200)]
libcacard: Plug memory leaks around vreader_get_reader_list()

Spotted by Coverity.

Signed-off-by: Markus Armbruster <[email protected]>
Reviewed-by: Alon Levy <[email protected]>
Signed-off-by: Michael Tokarev <[email protected]>
10 years agolibcacard/vscclient: Bury some dead code
Markus Armbruster [Fri, 23 May 2014 11:24:33 +0000 (13:24 +0200)]
libcacard/vscclient: Bury some dead code

Spotted by Coverity.

Signed-off-by: Markus Armbruster <[email protected]>
Reviewed-by: Alon Levy <[email protected]>
Signed-off-by: Michael Tokarev <[email protected]>
10 years agovl: fix 'name' option to work with -readconfig
Dr. David Alan Gilbert [Tue, 6 May 2014 11:15:55 +0000 (12:15 +0100)]
vl: fix 'name' option to work with -readconfig

The 'name' option silently failed when used in config files
( http://lists.gnu.org/archive/html/qemu-devel/2014-04/msg00378.html )

-readconfig stores the configuration read in QemuOpts.  Command line
option parsing should do the same, and no more.  In particular it should
not act upon the option.  That needs to be done separately, where both
command line and -readconfig settings are visible in QemuOpts.

Signed-off-by: Dr. David Alan Gilbert <[email protected]>
Reported-by: William Dauchy <[email protected]>
Tested-by: William Dauchy <[email protected]>
Reviewed-by: Markus Armbruster <[email protected]>
Signed-off-by: Michael Tokarev <[email protected]>
(mjt: added commit message by ambru@ and subject prefix)

10 years agoconfigure: Put tempfiles in a subdir of the build directory
Peter Maydell [Fri, 23 May 2014 16:07:24 +0000 (17:07 +0100)]
configure: Put tempfiles in a subdir of the build directory

When libtool support was added to configure, the new temporary files
were left out of the list of files cleaned up on exit; this results
in a lot of stale .lo files being left around in /tmp. Worse, libtool
creates a /tmp/.libs directory which we can't easily clean up.

Put all our temporary files in a single temporary directory created
as a subdirectory of the build directory, so we can easily clean it up,
and don't need fragile or complicated code for creation to avoid it
clashing with temporary directories from other instances of QEMU
configure or being subject to attack from adversaries who can write
to /tmp.

Since the temporaries now live in the build tree, we have no
need to jump through hoops with a trap handler to try to remove
them when configure exits; this fixes some weird bugs where hitting
^C during a configure run wouldn't actually make it stop, because
we would run the trap handler but then not stop. (It is possible
to get the trap handler semantics right but it is convoluted largely
because of bugs in dash, so it is simpler to just avoid it.)

Note that "temporary files go in the build directory, not /tmp" is
the way autoconf behaves.

Signed-off-by: Peter Maydell <[email protected]>
Reviewed-by: Eric Blake <[email protected]>
Signed-off-by: Michael Tokarev <[email protected]>
10 years agodma-helpers: avoid calling dma_bdrv_unmap() twice
Jules Wang [Fri, 23 May 2014 03:44:05 +0000 (11:44 +0800)]
dma-helpers: avoid calling dma_bdrv_unmap() twice

Calling dma_bdrv_unmap() twice is not necessary and may cause
potential problems if some code changes.

Signed-off-by: Jules Wang <[email protected]>
Reviewed-by: Paolo Bonzini <[email protected]>
Signed-off-by: Michael Tokarev <[email protected]>
10 years agoarch_init: replace fprintf(stderr, ...) with error_report()
Le Tan [Wed, 21 May 2014 00:10:38 +0000 (08:10 +0800)]
arch_init: replace fprintf(stderr, ...) with error_report()

Replace fprintf(stderr,...) with error_report() in the file
arch_init.c. The trailing "\n"s of the @fmt argument have been removed
because @fmt of error_report() should not contain newline.

Signed-off-by: Le Tan <[email protected]>
Reviewed-by: Andreas Färber <[email protected]>
Signed-off-by: Michael Tokarev <[email protected]>
10 years agopci: move dereferencing of root only after verifying valid root pointer
Saravanakumar [Thu, 22 May 2014 11:33:50 +0000 (17:03 +0530)]
pci: move dereferencing of root only after verifying valid root pointer

Signed-off-by: Saravanakumar <[email protected]>
Reviewed-by: Andreas Färber <[email protected]>
Reviewed-by: Paolo Bonzini <[email protected]>
Signed-off-by: Michael Tokarev <[email protected]>
10 years agojazz_led: Add missing break in switch case
Saravanakumar [Wed, 21 May 2014 10:41:40 +0000 (16:11 +0530)]
jazz_led: Add missing break in switch case

Signed-off-by: Saravanakumar <[email protected]>
Reviewed-by: Paolo Bonizni <[email protected]>
Signed-off-by: Michael Tokarev <[email protected]>
10 years agobswap.h: Rename ldl_p, stl_p, etc to ldl_he_p, stl_he_p, etc
Peter Maydell [Fri, 2 May 2014 17:32:38 +0000 (18:32 +0100)]
bswap.h: Rename ldl_p, stl_p, etc to ldl_he_p, stl_he_p, etc

We have an unfortunate naming clash between the functions
ldl_p, stl_p, etc defined in bswap.h (which have semantics
"load/store in host endianness") and the #defines of the same
name in cpu-all.h (which have the semantics "load/store in
target endianness").

Fortunately it turns out that the only users of the bswap.h
functions are all within bswap.h itself, so we can simply
rename them to include a _he_ infix for "host endianness".

Signed-off-by: Peter Maydell <[email protected]>
Reviewed-by: Richard Henderson <[email protected]>
Signed-off-by: Michael Tokarev <[email protected]>
10 years agoconfigure: Automatically select GTK+ 3.0 if GTK+ 2.0 is unavailable
Stefan Weil [Sat, 17 May 2014 14:29:18 +0000 (16:29 +0200)]
configure: Automatically select GTK+ 3.0 if GTK+ 2.0 is unavailable

The configure option --with-gtkabi=3.0 is still supported, but no longer
needed when GTK+-2.0 is missing. When no GTK+ ABI is selected by the
user, configure first tries 2.0, then 3.0.

For some platforms (e.g. Windows) newer binaries of GTK+ are only
available for GTK+ 3.0. Now building on these platforms is a little bit
easier.

Signed-off-by: Stefan Weil <[email protected]>
Signed-off-by: Michael Tokarev <[email protected]>
10 years agonbd: Miscellaneous typo fixes.
Hani Benhabiles [Mon, 12 May 2014 23:35:16 +0000 (00:35 +0100)]
nbd: Miscellaneous typo fixes.

Signed-off-by: Hani Benhabiles <[email protected]>
Acked-by: Paolo Bonzini <[email protected]>
Reviewed-by: Stefan Hajnoczi <[email protected]>
Signed-off-by: Michael Tokarev <[email protected]>
10 years agonbd: Close socket on negotiation failure.
Hani Benhabiles [Mon, 12 May 2014 23:35:15 +0000 (00:35 +0100)]
nbd: Close socket on negotiation failure.

Otherwise, the nbd client may hang waiting for the server response.

Signed-off-by: Hani Benhabiles <[email protected]>
Acked-by: Paolo Bonzini <[email protected]>
Signed-off-by: Michael Tokarev <[email protected]>
10 years agoiohandler.c: Properly initialize sigaction struct
Peter Maydell [Fri, 16 May 2014 13:00:03 +0000 (14:00 +0100)]
iohandler.c: Properly initialize sigaction struct

The code in qemu_init_child_watch() wasn't clearing the 'struct
sigaction' before passing it to sigaction(); this meant that we
would block a random set of signals while executing the SIGCHLD
handler. Initialize properly by using memset() on the struct,
as we do in similar cases elsewhere.

Signed-off-by: Peter Maydell <[email protected]>
Signed-off-by: Michael Tokarev <[email protected]>
10 years agolibcacard: g_malloc cleanups
Michael Tokarev [Thu, 8 May 2014 15:51:01 +0000 (19:51 +0400)]
libcacard: g_malloc cleanups

This patch replaces g_malloc() in libcacard into g_new()
or g_new0() where appropriate (removing some init-to-zero
surrounding code), g_malloc+memcpy into g_memdup() and the
like.

Signed-off-by: Michael Tokarev <[email protected]>
Reviewed-by: Alon Levy <[email protected]>
10 years agoMerge remote-tracking branch 'remotes/kraxel/tags/pull-chardev-2' into staging
Peter Maydell [Thu, 22 May 2014 17:14:01 +0000 (18:14 +0100)]
Merge remote-tracking branch 'remotes/kraxel/tags/pull-chardev-2' into staging

purge error_is_set()

# gpg: Signature made Wed 21 May 2014 11:43:44 BST using RSA key ID D3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <[email protected]>"
# gpg:                 aka "Gerd Hoffmann <[email protected]>"
# gpg:                 aka "Gerd Hoffmann (private) <[email protected]>"

* remotes/kraxel/tags/pull-chardev-2:
  error: error_is_set() is finally unused; remove
  char: Explain qmp_chardev_add()'s unusual error handling
  char: Clean up fragile use of error_is_set()
  char: Use return values instead of error_is_set(errp)
  qemu-socket: Clean up inet_connect_opts()

Signed-off-by: Peter Maydell <[email protected]>
10 years agoMerge remote-tracking branch 'remotes/kraxel/tags/pull-audio-5' into staging
Peter Maydell [Thu, 22 May 2014 16:05:36 +0000 (17:05 +0100)]
Merge remote-tracking branch 'remotes/kraxel/tags/pull-audio-5' into staging

audio: two intel-hda fixes.

# gpg: Signature made Wed 21 May 2014 09:49:39 BST using RSA key ID D3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <[email protected]>"
# gpg:                 aka "Gerd Hoffmann <[email protected]>"
# gpg:                 aka "Gerd Hoffmann (private) <[email protected]>"

* remotes/kraxel/tags/pull-audio-5:
  hw/audio/intel-hda: Avoid shift into sign bit
  audio/intel-hda: support FIFORDY

Signed-off-by: Peter Maydell <[email protected]>
10 years agoMerge remote-tracking branch 'remotes/cohuck/tags/s390x-20140520' into staging
Peter Maydell [Thu, 22 May 2014 15:14:01 +0000 (16:14 +0100)]
Merge remote-tracking branch 'remotes/cohuck/tags/s390x-20140520' into staging

some s390 patches:

- Enable irqfds on s390 via the new adapter interrupt routing type.
  As a prereq, fix the kvm enable_cap helpers for some compilers and
  split the s390 flic into kvm and non-kvm parts.
- Enable software and hardware debugging support on s390. This needs a
  kernel headers update.

# gpg: Signature made Tue 20 May 2014 12:30:54 BST using RSA key ID C6F02FAF
# gpg: Can't check signature: public key not found

* remotes/cohuck/tags/s390x-20140520:
  s390x/kvm: hw debugging support via guest PER facility
  s390x/kvm: software breakpoint support
  s390x: remove duplicate definitions of DIAG 501
  linux-headers: update
  s390x/virtio-ccw: wire up irq routing and irqfds
  s390x/virtio-ccw: reference-counted indicators
  s390x: add I/O adapter registration
  s390x: split flic into kvm and non-kvm parts
  kvm: Fix enable_cap helpers on older gcc

Signed-off-by: Peter Maydell <[email protected]>
10 years agoMerge remote-tracking branch 'remotes/bonzini/scsi-next' into staging
Peter Maydell [Thu, 22 May 2014 14:27:46 +0000 (15:27 +0100)]
Merge remote-tracking branch 'remotes/bonzini/scsi-next' into staging

* remotes/bonzini/scsi-next:
  megasas: remove buildtime strings
  block: iscsi build fix if LIBISCSI_FEATURE_IOVECTOR is not defined
  virtio-scsi: Plug memory leak on virtio_scsi_push_event() error path
  scsi: Document intentional fall through in scsi_req_length()

Signed-off-by: Peter Maydell <[email protected]>
10 years agoerror: error_is_set() is finally unused; remove
Markus Armbruster [Mon, 19 May 2014 16:57:38 +0000 (18:57 +0200)]
error: error_is_set() is finally unused; remove

Signed-off-by: Markus Armbruster <[email protected]>
Signed-off-by: Gerd Hoffmann <[email protected]>
10 years agochar: Explain qmp_chardev_add()'s unusual error handling
Markus Armbruster [Mon, 19 May 2014 16:57:36 +0000 (18:57 +0200)]
char: Explain qmp_chardev_add()'s unusual error handling

Character backend open hasn't been fully converted to the Error API.
Some opens fail without setting an error.  qmp_chardev_add() needs to
detect when that happens, and set a generic error.  Explain that in a
comment, and inline error_is_set() for clarity.

Signed-off-by: Markus Armbruster <[email protected]>
Signed-off-by: Gerd Hoffmann <[email protected]>
10 years agochar: Clean up fragile use of error_is_set()
Markus Armbruster [Mon, 19 May 2014 16:57:35 +0000 (18:57 +0200)]
char: Clean up fragile use of error_is_set()

Using error_is_set(ERRP) to find out whether a function failed is
either wrong, fragile, or unnecessarily opaque.  It's wrong when ERRP
may be null, because errors go undetected when it is.  It's fragile
when proving ERRP non-null involves a non-local argument.  Else, it's
unnecessarily opaque (see commit 84d18f0).

The error_is_set(errp) in qemu_chr_new_from_opts() is merely fragile,
because the callers never pass a null errp argument.

Make the code more robust and more obviously correct: receive the
error in a local variable, then propagate it through the parameter.

Signed-off-by: Markus Armbruster <[email protected]>
Signed-off-by: Gerd Hoffmann <[email protected]>
10 years agochar: Use return values instead of error_is_set(errp)
Markus Armbruster [Mon, 19 May 2014 16:57:34 +0000 (18:57 +0200)]
char: Use return values instead of error_is_set(errp)

Using error_is_set(errp) to check whether a function call failed is
fragile: it breaks when errp is null.  Check perfectly suitable return
values instead when possible.  As far as I can tell, errp can't be
null there, but this is more robust and more obviously correct

Signed-off-by: Markus Armbruster <[email protected]>
Signed-off-by: Gerd Hoffmann <[email protected]>
10 years agoqemu-socket: Clean up inet_connect_opts()
Markus Armbruster [Mon, 19 May 2014 16:57:37 +0000 (18:57 +0200)]
qemu-socket: Clean up inet_connect_opts()

Separate the search for a working addrinfo from the code that does
something with it.  Makes for a clearer search loop.

Use a local Error * to simplify resetting the error in the search
loop.

Signed-off-by: Markus Armbruster <[email protected]>
Reviewed-by: Paolo Bonzini <[email protected]>
Signed-off-by: Gerd Hoffmann <[email protected]>
10 years agomegasas: remove buildtime strings
Olaf Hering [Thu, 3 Apr 2014 13:47:34 +0000 (15:47 +0200)]
megasas: remove buildtime strings

Using __DATE__ or __TIME__ in binary pkgs changes the checksum of
compiled binaries if they get rebuilt, even if there are no other
source changes.  Replace the dynamic strings with some equally
informative static strings.

Signed-off-by: Olaf Hering <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
10 years agos390x/kvm: hw debugging support via guest PER facility
David Hildenbrand [Mon, 3 Sep 2012 11:09:10 +0000 (13:09 +0200)]
s390x/kvm: hw debugging support via guest PER facility

This patch makes use of the hw debugging support in kvm (provided by the guest's
PER facility) on s390. It enables the following features, available using the
gdbserver:
- single-stepping
- hw breakpoints
- hw watchpoints

Signed-off-by: David Hildenbrand <[email protected]>
Signed-off-by: Jens Freimann <[email protected]>
Signed-off-by: Cornelia Huck <[email protected]>
10 years agos390x/kvm: software breakpoint support
David Hildenbrand [Tue, 25 Feb 2014 14:53:00 +0000 (15:53 +0100)]
s390x/kvm: software breakpoint support

This patch allows to insert and remove sw breakpoints using the QEMU gdbserver
on s390 as well as to interrupt execution on a breakpoint hit when running
with KVM enabled.

Whenever a software breakpoint is inserted, common code calls kvm ioctl
KVM_UPDATE_GUEST_DEBUG. As this method's default on s390 is to return an error
if not implement, the insertion will fail. Therefore, KVM also has to be
updated in order to make use of software breakpoints.

Signed-off-by: David Hildenbrand <[email protected]>
Signed-off-by: Jens Freimann <[email protected]>
Reviewed-by: Cornelia Huck <[email protected]>
Signed-off-by: Cornelia Huck <[email protected]>
10 years agos390x: remove duplicate definitions of DIAG 501
David Hildenbrand [Tue, 25 Feb 2014 14:58:45 +0000 (15:58 +0100)]
s390x: remove duplicate definitions of DIAG 501

When restoring the previously saved instruction in
kvm_arch_remove_sw_breakpoint(), we only restored one byte. Let's use
the sizeof() operator to make sure we restore the entire instruction.

While we are at it, let's remove the duplicate definitions of DIAG 501
and replace its size (used when reading/writing the instruction) with
a sizeof() operator to make the code self explaining and less error-prone.

Signed-off-by: David Hildenbrand <[email protected]>
Reviewed-by: Cornelia Huck <[email protected]>
Signed-off-by: Jens Freimann <[email protected]>
Signed-off-by: Cornelia Huck <[email protected]>
10 years agolinux-headers: update
Jens Freimann [Mon, 12 May 2014 08:03:46 +0000 (10:03 +0200)]
linux-headers: update

Sync linux-headers with kvm/next (87c00572ba05aa8c9db118da75c608f47eb10b9e)

Signed-off-by: Jens Freimann <[email protected]>
Signed-off-by: Cornelia Huck <[email protected]>
10 years agos390x/virtio-ccw: wire up irq routing and irqfds
Cornelia Huck [Mon, 15 Jul 2013 15:45:03 +0000 (17:45 +0200)]
s390x/virtio-ccw: wire up irq routing and irqfds

Make use of the new s390 adapter irq routing support to enable real
in-kernel irqfds for virtio-ccw with adapter interrupts.

Note that s390 doesn't provide the common KVM_CAP_IRQCHIP capability, but
rather needs KVM_CAP_S390_IRQCHIP to be enabled. This is to ensure backward
compatibility.

Reviewed-by: Thomas Huth <[email protected]>
Reviewed-by: Christian Borntraeger <[email protected]>
Acked-by: Paolo Bonzini <[email protected]>
Signed-off-by: Cornelia Huck <[email protected]>
10 years agos390x/virtio-ccw: reference-counted indicators
Cornelia Huck [Thu, 1 Aug 2013 15:27:00 +0000 (17:27 +0200)]
s390x/virtio-ccw: reference-counted indicators

Make code using the same indicators point to a single allocated structure
that is freed when the last user goes away.

This will be used by the irqfd code to unmap addresses after the last user
is gone.

Reviewed-by: Thomas Huth <[email protected]>
Reviewed-by: Christian Borntraeger <[email protected]>
Signed-off-by: Cornelia Huck <[email protected]>
10 years agos390x: add I/O adapter registration
Cornelia Huck [Mon, 15 Jul 2013 15:45:03 +0000 (17:45 +0200)]
s390x: add I/O adapter registration

Register an I/O adapter interrupt source for when virtio-ccw devices start
using adapter interrupts.

Reviewed-by: Thomas Huth <[email protected]>
Reviewed-by: Christian Borntraeger <[email protected]>
Signed-off-by: Cornelia Huck <[email protected]>
10 years agos390x: split flic into kvm and non-kvm parts
Cornelia Huck [Thu, 17 Apr 2014 13:59:48 +0000 (15:59 +0200)]
s390x: split flic into kvm and non-kvm parts

Introduce a common parent class for both cases, where kvm and non-kvm
can hook up callbacks. This will be used by follow-on patches for
adapter registration and mapping.

We now always have a flic, regardless of whether we use kvm; the
non-kvm implementation just doesn't do anything.

Reviewed-by: Jens Freimann <[email protected]>
Reviewed-by: Christian Borntraeger <[email protected]>
Signed-off-by: Cornelia Huck <[email protected]>
10 years agokvm: Fix enable_cap helpers on older gcc
Alexander Graf [Mon, 12 May 2014 09:51:37 +0000 (11:51 +0200)]
kvm: Fix enable_cap helpers on older gcc

Commit 40f1ee27aa1 introduced handy helpers for enable_cap calls on
vcpu and vm level. Unfortunately some older gcc versions (4.7.1, 4.6)
seem to choke on signedness detection in inline created variables:

target-ppc/kvm.c: In function 'kvmppc_booke_watchdog_enable':
target-ppc/kvm.c:1302:21: error: comparison of unsigned expression < 0 is always false [-Werror=type-limits]
target-ppc/kvm.c: In function 'kvmppc_set_papr':
target-ppc/kvm.c:1504:21: error: comparison of unsigned expression < 0 is always false [-Werror=type-limits]

However - thanks to Thomas Huth for the suggestion - we can just cast the
offending potentially 0 value to a signed type, making the comparison signed.

Reviewed-by: Thomas Huth <[email protected]>
Acked-by: Cornelia Huck <[email protected]>
Signed-off-by: Alexander Graf <[email protected]>
Signed-off-by: Cornelia Huck <[email protected]>
10 years agoMerge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging
Peter Maydell [Tue, 20 May 2014 10:57:52 +0000 (11:57 +0100)]
Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging

Block patches

# gpg: Signature made Mon 19 May 2014 15:21:14 BST using RSA key ID C88F2FD6
# gpg: Good signature from "Kevin Wolf <[email protected]>"

* remotes/kevin/tags/for-upstream: (22 commits)
  block: optimize zero writes with bdrv_write_zeroes
  blockdev: add a function to parse enum ids from strings
  util: add qemu_iovec_is_zero
  qcow1: Stricter backing file length check
  qcow1: Validate image size (CVE-2014-0223)
  qcow1: Validate L2 table size (CVE-2014-0222)
  qcow1: Check maximum cluster size
  qcow1: Make padding in the header explicit
  curl: Add usage documentation
  curl: Add sslverify option
  curl: Remove broken parsing of options from url
  curl: Fix build when curl_multi_socket_action isn't available
  qemu-iotests: Fix blkdebug in VM drive in 030
  qemu-iotests: Fix core dump suppression in test 039
  iotests: Add test for the JSON protocol
  block: Allow JSON filenames
  check-qdict: Add test for qdict_join()
  qdict: Add qdict_join()
  block: add test for vhdx image created by Disk2VHD
  block: vhdx - account for identical header sections
  ...

Signed-off-by: Peter Maydell <[email protected]>
10 years agoblock: iscsi build fix if LIBISCSI_FEATURE_IOVECTOR is not defined
Jeff Cody [Mon, 19 May 2014 21:13:06 +0000 (17:13 -0400)]
block: iscsi build fix if LIBISCSI_FEATURE_IOVECTOR is not defined

Commit b03c380 introduced the function
iscsi_allocationmap_is_allocated(), however it is only used within a
code block that is conditionally compiled.  This produces a warning
(error with -werror) of "defined but not used" for the the function, if
LIBISCSI_FEATURE_IOVECTOR is not defined.

This wraps iscsi_allocationmap_is_allocated() in the same conditional.

Signed-off-by: Jeff Cody <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
10 years agohw/audio/intel-hda: Avoid shift into sign bit
Peter Maydell [Fri, 9 May 2014 13:22:53 +0000 (14:22 +0100)]
hw/audio/intel-hda: Avoid shift into sign bit

Add a U suffix to avoid shifting into the sign bit (which is
undefined behaviour in C).

Signed-off-by: Peter Maydell <[email protected]>
Signed-off-by: Gerd Hoffmann <[email protected]>
10 years agoaudio/intel-hda: support FIFORDY
Stanislav Vorobiov [Tue, 29 Apr 2014 12:48:47 +0000 (16:48 +0400)]
audio/intel-hda: support FIFORDY

linux kernel 3.12 has changed intel-hda
driver to always check for FIFORDY, this
causes long hangs in guest since QEMU
always has this bit set to 0. We now simply set
it to 1 always, since we're synchronous anyway
and always ready to receive the stream

Signed-off-by: Stanislav Vorobiov <[email protected]>
Signed-off-by: Gerd Hoffmann <[email protected]>
10 years agoMerge remote-tracking branch 'remotes/qmp-unstable/queue/qmp' into staging
Peter Maydell [Mon, 19 May 2014 13:10:00 +0000 (14:10 +0100)]
Merge remote-tracking branch 'remotes/qmp-unstable/queue/qmp' into staging

* remotes/qmp-unstable/queue/qmp:
  qapi: skip redundant includes
  monitor: Add netdev_del id argument completion.
  monitor: Add netdev_add type argument completion.
  monitor: Add set_link arguments completion.
  monitor: Add chardev-add backend argument completion.
  monitor: Add chardev-remove command completion.
  monitor: Convert sendkey to use command_completion.
  qapi: Show qapi-commands.py invocation in qapi-code-gen.txt
  qapi: Replace uncommon use of the error API by the common one
  tests: Don't call visit_end_struct() after visit_start_struct() fails
  hw: Don't call visit_end_struct() after visit_start_struct() fails
  hmp: Call visit_end_struct() after visit_start_struct() succeeds
  qapi: Un-inline visit of implicit struct
  qapi-visit.py: Clean up a sloppy use of field prefix
  qapi: Clean up shadowing of parameters and locals in inner scopes
  qapi-visit.py: Clean up confusing push_indent() / pop_indent() use
  qapi: Replace start_optional()/end_optional() by optional()
  qapi: Remove unused Visitor callbacks start_handle(), end_handle()
  qapi: Normalize marshalling's visitor initialization and cleanup
  qapi: Update qapi-code-gen.txt example to match current code

Signed-off-by: Peter Maydell <[email protected]>
10 years agoMerge remote-tracking branch 'remotes/kraxel/tags/pull-input-8' into staging
Peter Maydell [Mon, 19 May 2014 11:53:07 +0000 (12:53 +0100)]
Merge remote-tracking branch 'remotes/kraxel/tags/pull-input-8' into staging

Input code update:
 - add keycode mapping helpers to core.
 - start switching devices to new input api.
 - misc bugfixes.

# gpg: Signature made Fri 16 May 2014 07:43:45 BST using RSA key ID D3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <[email protected]>"
# gpg:                 aka "Gerd Hoffmann <[email protected]>"
# gpg:                 aka "Gerd Hoffmann (private) <[email protected]>"

* remotes/kraxel/tags/pull-input-8:
  input: sparc32 kbd: claim en-us layout
  input: sparc32 kbd: fix some key mappings
  input: remove sparc keymap hack
  input: switch sparc32 kbd to new input api
  input: switch ps/2 mouse to new input api
  input: switch ps/2 kbd to new input api
  input: use KeyValue directly in sendkey monitor command
  input: add qemu_input_handler_deactivate
  input: key mapping helpers
  ps2: set ps/2 output buffer size as the same as kernel

Signed-off-by: Peter Maydell <[email protected]>
10 years agoblock: optimize zero writes with bdrv_write_zeroes
Peter Lieven [Sat, 17 May 2014 22:58:19 +0000 (00:58 +0200)]
block: optimize zero writes with bdrv_write_zeroes

this patch tries to optimize zero write requests
by automatically using bdrv_write_zeroes if it is
supported by the format.

This significantly speeds up file system initialization and
should speed zero write test used to test backend storage
performance.

I ran the following 2 tests on my internal SSD with a
50G QCOW2 container and on an attached iSCSI storage.

a) mkfs.ext4 -E lazy_itable_init=0,lazy_journal_init=0 /dev/vdX

QCOW2         [off]     [on]     [unmap]
-----
runtime:       14secs    1.1secs  1.1secs
filesize:      937M      18M      18M

iSCSI         [off]     [on]     [unmap]
----
runtime:       9.3s      0.9s     0.9s

b) dd if=/dev/zero of=/dev/vdX bs=1M oflag=direct

QCOW2         [off]     [on]     [unmap]
-----
runtime:       246secs   18secs   18secs
filesize:      51G       192K     192K
throughput:    203M/s    2.3G/s   2.3G/s

iSCSI*        [off]     [on]     [unmap]
----
runtime:       8mins     45secs   33secs
throughput:    106M/s    1.2G/s   1.6G/s
allocated:     100%      100%     0%

* The storage was connected via an 1Gbit interface.
  It seems to internally handle writing zeroes
  via WRITESAME16 very fast.

Signed-off-by: Peter Lieven <[email protected]>
Signed-off-by: Kevin Wolf <[email protected]>
10 years agoMerge remote-tracking branch 'remotes/bonzini/scsi-next' into staging
Peter Maydell [Mon, 19 May 2014 11:30:06 +0000 (12:30 +0100)]
Merge remote-tracking branch 'remotes/bonzini/scsi-next' into staging

* remotes/bonzini/scsi-next:
  [PATCH] block/iscsi: bump year in copyright notice
  block/iscsi: allow cluster_size of 4K and greater
  block/iscsi: clarify the meaning of ISCSI_CHECKALLOC_THRES
  block/iscsi: speed up read for unallocated sectors
  block/iscsi: allow fall back to WRITE SAME without UNMAP
  MAINTAINERS: mark megasas as maintained
  megasas: Add MSI support
  megasas: Enable MSI-X support
  megasas: Implement LD_LIST_QUERY
  scsi: Improve error messages more
  scsi-disk: Improve error messager if can't get version number

Signed-off-by: Peter Maydell <[email protected]>
10 years agoblockdev: add a function to parse enum ids from strings
Peter Lieven [Sat, 17 May 2014 22:58:18 +0000 (00:58 +0200)]
blockdev: add a function to parse enum ids from strings

this adds a generic function to recover the enum id of a parameter
given as a string.

Signed-off-by: Peter Lieven <[email protected]>
Signed-off-by: Kevin Wolf <[email protected]>
10 years agoutil: add qemu_iovec_is_zero
Peter Lieven [Sat, 17 May 2014 22:58:17 +0000 (00:58 +0200)]
util: add qemu_iovec_is_zero

Signed-off-by: Peter Lieven <[email protected]>
Signed-off-by: Kevin Wolf <[email protected]>
10 years agoqcow1: Stricter backing file length check
Kevin Wolf [Thu, 8 May 2014 11:35:09 +0000 (13:35 +0200)]
qcow1: Stricter backing file length check

Like qcow2 since commit 6d33e8e7, error out on invalid lengths instead
of silently truncating them to 1023.

Also don't rely on bdrv_pread() catching integer overflows that make len
negative, but use unsigned variables in the first place.

Cc: [email protected]
Signed-off-by: Kevin Wolf <[email protected]>
Reviewed-by: Benoit Canet <[email protected]>
10 years agoqcow1: Validate image size (CVE-2014-0223)
Kevin Wolf [Thu, 8 May 2014 11:08:20 +0000 (13:08 +0200)]
qcow1: Validate image size (CVE-2014-0223)

A huge image size could cause s->l1_size to overflow. Make sure that
images never require a L1 table larger than what fits in s->l1_size.

This cannot only cause unbounded allocations, but also the allocation of
a too small L1 table, resulting in out-of-bounds array accesses (both
reads and writes).

Cc: [email protected]
Signed-off-by: Kevin Wolf <[email protected]>
10 years agoqcow1: Validate L2 table size (CVE-2014-0222)
Kevin Wolf [Thu, 15 May 2014 14:10:11 +0000 (16:10 +0200)]
qcow1: Validate L2 table size (CVE-2014-0222)

Too large L2 table sizes cause unbounded allocations. Images actually
created by qemu-img only have 512 byte or 4k L2 tables.

To keep things consistent with cluster sizes, allow ranges between 512
bytes and 64k (in fact, down to 1 entry = 8 bytes is technically
working, but L2 table sizes smaller than a cluster don't make a lot of
sense).

This also means that the number of bytes on the virtual disk that are
described by the same L2 table is limited to at most 8k * 64k or 2^29,
preventively avoiding any integer overflows.

Cc: [email protected]
Signed-off-by: Kevin Wolf <[email protected]>
Reviewed-by: Benoit Canet <[email protected]>
10 years agoqcow1: Check maximum cluster size
Kevin Wolf [Wed, 7 May 2014 15:30:30 +0000 (17:30 +0200)]
qcow1: Check maximum cluster size

Huge values for header.cluster_bits cause unbounded allocations (e.g.
for s->cluster_cache) and crash qemu this way. Less huge values may
survive those allocations, but can cause integer overflows later on.

The only cluster sizes that qemu can create are 4k (for standalone
images) and 512 (for images with backing files), so we can limit it
to 64k.

Cc: [email protected]
Signed-off-by: Kevin Wolf <[email protected]>
Reviewed-by: Benoit Canet <[email protected]>
10 years agoqcow1: Make padding in the header explicit
Kevin Wolf [Wed, 7 May 2014 14:56:10 +0000 (16:56 +0200)]
qcow1: Make padding in the header explicit

We were relying on all compilers inserting the same padding in the
header struct that is used for the on-disk format. Let's not do that.
Mark the struct as packed and insert an explicit padding field for
compatibility.

Cc: [email protected]
Signed-off-by: Kevin Wolf <[email protected]>
Reviewed-by: Benoit Canet <[email protected]>
10 years agocurl: Add usage documentation
Matthew Booth [Wed, 14 May 2014 23:28:43 +0000 (19:28 -0400)]
curl: Add usage documentation

Signed-off-by: Matthew Booth <[email protected]>
Signed-off-by: Kevin Wolf <[email protected]>
10 years agocurl: Add sslverify option
Matthew Booth [Wed, 14 May 2014 23:28:42 +0000 (19:28 -0400)]
curl: Add sslverify option

This allows qemu to use images over https with a self-signed certificate. It
defaults to verifying the certificate.

Signed-off-by: Matthew Booth <[email protected]>
Signed-off-by: Kevin Wolf <[email protected]>
10 years agocurl: Remove broken parsing of options from url
Matthew Booth [Wed, 14 May 2014 23:28:41 +0000 (19:28 -0400)]
curl: Remove broken parsing of options from url

The block layer now supports a generic json syntax for passing option parameters
explicitly, making parsing of options from the url redundant.

Signed-off-by: Matthew Booth <[email protected]>
Signed-off-by: Kevin Wolf <[email protected]>
10 years agocurl: Fix build when curl_multi_socket_action isn't available
Matthew Booth [Wed, 14 May 2014 23:28:40 +0000 (19:28 -0400)]
curl: Fix build when curl_multi_socket_action isn't available

Signed-off-by: Matthew Booth <[email protected]>
Signed-off-by: Kevin Wolf <[email protected]>
10 years agoqemu-iotests: Fix blkdebug in VM drive in 030
Fam Zheng [Wed, 14 May 2014 12:30:45 +0000 (20:30 +0800)]
qemu-iotests: Fix blkdebug in VM drive in 030

The test test_stream_pause in this class uses vm.pause_drive, which
requires a blkdebug driver on top of image, otherwise it's no-op and the
test running is undeterministic.

So add it.

Signed-off-by: Fam Zheng <[email protected]>
Signed-off-by: Kevin Wolf <[email protected]>
10 years agoqemu-iotests: Fix core dump suppression in test 039
Markus Armbruster [Wed, 14 May 2014 13:12:34 +0000 (15:12 +0200)]
qemu-iotests: Fix core dump suppression in test 039

The shell script attempts to suppress core dumps like this:

    old_ulimit=$(ulimit -c)
    ulimit -c 0
    $QEMU_IO arg...
    ulimit -c "$old_ulimit"

This breaks the test hard unless the limit was zero to begin with!
ulimit sets both hard and soft limit by default, and (re-)raising the
hard limit requires privileges.  Broken since it was added in commit
dc68afe.

Could be fixed by adding -S to set only the soft limit, but I'm not
sure how portable that is in practice.  Simply do it in a subshell
instead, like this:

    (ulimit -c 0; exec $QEMU_IO arg...)

Signed-off-by: Markus Armbruster <[email protected]>
Reviewed-by: Fam Zheng <[email protected]>
Signed-off-by: Kevin Wolf <[email protected]>
10 years agoiotests: Add test for the JSON protocol
Max Reitz [Thu, 8 May 2014 18:12:42 +0000 (20:12 +0200)]
iotests: Add test for the JSON protocol

Add a test for the JSON protocol driver.

Signed-off-by: Max Reitz <[email protected]>
Reviewed-by: Eric Blake <[email protected]>
Signed-off-by: Kevin Wolf <[email protected]>
10 years agoblock: Allow JSON filenames
Max Reitz [Thu, 8 May 2014 18:12:41 +0000 (20:12 +0200)]
block: Allow JSON filenames

If the filename given to bdrv_open() is prefixed with "json:", parse the
rest as a JSON object and merge the result into the options QDict. If
there are conflicts, the options QDict takes precedence.

Signed-off-by: Max Reitz <[email protected]>
Reviewed-by: Eric Blake <[email protected]>
Signed-off-by: Kevin Wolf <[email protected]>
10 years agocheck-qdict: Add test for qdict_join()
Max Reitz [Thu, 8 May 2014 18:12:40 +0000 (20:12 +0200)]
check-qdict: Add test for qdict_join()

Add some test cases for qdict_join().

Signed-off-by: Max Reitz <[email protected]>
Reviewed-by: Eric Blake <[email protected]>
Reviewed-by: Benoit Canet <[email protected]>
Signed-off-by: Kevin Wolf <[email protected]>
10 years agoqdict: Add qdict_join()
Max Reitz [Thu, 8 May 2014 18:12:39 +0000 (20:12 +0200)]
qdict: Add qdict_join()

This function joins two QDicts by absorbing one into the other.

Signed-off-by: Max Reitz <[email protected]>
Reviewed-by: Benoit Canet <[email protected]>
Reviewed-by: Eric Blake <[email protected]>
Signed-off-by: Kevin Wolf <[email protected]>
10 years agoblock: add test for vhdx image created by Disk2VHD
Jeff Cody [Tue, 13 May 2014 14:00:53 +0000 (10:00 -0400)]
block: add test for vhdx image created by Disk2VHD

This adds a test for VHDX images created by Microsoft's tool, Disk2VHD.

VHDX images created by this tool have 2 identical header sections, with
identical sequence numbers.  This makes sure we detect VHDX images with
identical headers, and do not flag them as corrupt.

Signed-off-by: Jeff Cody <[email protected]>
Reviewed-by: Fam Zheng <[email protected]>
Signed-off-by: Kevin Wolf <[email protected]>
10 years agoblock: vhdx - account for identical header sections
Jeff Cody [Tue, 13 May 2014 14:00:52 +0000 (10:00 -0400)]
block: vhdx - account for identical header sections

The VHDX spec v1.00 declares that "a header is current if it is the only
valid header or if it is valid and its SequenceNumber field is greater
than the other header’s SequenceNumber field. The parser must only use
data from the current header. If there is no current header, then the
VHDX file is corrupt."

However, the Disk2VHD tool from Microsoft creates a VHDX image file that
has 2 identical headers, including matching checksums and matching
sequence numbers.  Likely, as a shortcut the tool is just writing the
header twice, for the active and inactive headers, during the image
creation.  Technically, this should be considered a corrupt VHDX file
(at least per the 1.00 spec, and that is how we currently treat it).

But in order to accomodate images created with Disk2VHD, we can safely
create an exception for this case.  If we find identical sequence
numbers, then we check the VHDXHeader-sized chunks of each 64KB header
sections (we won't rely just on the crc32c to indicate the headers are
the same).  If they are identical, then we go ahead and use the first
one.

Reported-by: Nerijus Baliūnas <[email protected]>
Signed-off-by: Jeff Cody <[email protected]>
Signed-off-by: Kevin Wolf <[email protected]>
10 years agoRemove g_sequence_lookup from qemu-img help function
Mike Day [Tue, 13 May 2014 21:11:06 +0000 (17:11 -0400)]
Remove g_sequence_lookup from qemu-img help function

g_sequence_lookup is not supported by glib < 2.28. The usage
of g_sequence_lookup is not essential in this context (it's a
safeguard against duplicate values in the help message).
Removing the call enables the build on all platforms and
does not change the operation of the help function.

Signed-off-by: Mike Day <[email protected]>
Reviewed-by: Eric Blake <[email protected]>
Signed-off-by: Kevin Wolf <[email protected]>
10 years agoblock: Fix bdrv_is_allocated() for short backing files
Kevin Wolf [Tue, 6 May 2014 13:25:36 +0000 (15:25 +0200)]
block: Fix bdrv_is_allocated() for short backing files

bdrv_is_allocated() shouldn't return true for sectors that are
unallocated, but after the end of a short backing file, even though
such sectors are (correctly) marked as containing zeros.

Signed-off-by: Kevin Wolf <[email protected]>
Reviewed-by: Max Reitz <[email protected]>
10 years agovirtio-scsi: Plug memory leak on virtio_scsi_push_event() error path
Markus Armbruster [Fri, 16 May 2014 15:44:06 +0000 (17:44 +0200)]
virtio-scsi: Plug memory leak on virtio_scsi_push_event() error path

Spotted by Coverity.

Signed-off-by: Markus Armbruster <[email protected]>
Cc: [email protected]
Signed-off-by: Paolo Bonzini <[email protected]>
10 years agoscsi: Document intentional fall through in scsi_req_length()
Markus Armbruster [Fri, 16 May 2014 15:44:05 +0000 (17:44 +0200)]
scsi: Document intentional fall through in scsi_req_length()

For clarity, and to hush up Coverity.

Signed-off-by: Markus Armbruster <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
10 years agoqapi: skip redundant includes
Benoît Canet [Fri, 16 May 2014 10:51:56 +0000 (12:51 +0200)]
qapi: skip redundant includes

The purpose of this change is to help create a json file containing
common definitions; each bit of generated C code must be emitted
only one time.

A second history global to all QAPISchema instances has been added
to detect when a file is included more than one time and skip these
includes.
It does not act as a stack and the changes made to it by the
__init__ function are propagated back to the caller so it's really
a global state.

Signed-off-by: Benoit Canet <[email protected]>
Reviewed-by: Eric Blake <[email protected]>
Signed-off-by: Luiz Capitulino <[email protected]>
10 years agoinput: sparc32 kbd: claim en-us layout
Gerd Hoffmann [Tue, 6 May 2014 12:11:16 +0000 (14:11 +0200)]
input: sparc32 kbd: claim en-us layout

Reported-by: Olivier Danet <[email protected]>
Signed-off-by: Gerd Hoffmann <[email protected]>
10 years agoinput: sparc32 kbd: fix some key mappings
Gerd Hoffmann [Tue, 29 Apr 2014 11:19:32 +0000 (13:19 +0200)]
input: sparc32 kbd: fix some key mappings

Reported-by: Olivier Danet <[email protected]>
Signed-off-by: Gerd Hoffmann <[email protected]>
10 years agoinput: remove sparc keymap hack
Gerd Hoffmann [Fri, 28 Mar 2014 07:56:15 +0000 (08:56 +0100)]
input: remove sparc keymap hack

With sparc keyboard going directly from QKeyValue to sparc keycodes
this should not be needed any more.

Signed-off-by: Gerd Hoffmann <[email protected]>
10 years agoinput: switch sparc32 kbd to new input api
Gerd Hoffmann [Tue, 25 Mar 2014 12:16:21 +0000 (13:16 +0100)]
input: switch sparc32 kbd to new input api

Nasty 0xe0 logic is gone.  We map through QKeyCode now, giving us a
nice, readable mapping table.

Quick smoke test in OpenFirmware looks ok.  Careful check from arch
maintainers would be very nice, especially on the capslock and numlock
logic.  I'm not fully sure whenever I got it translated correctly and
also what it is supposed to do in the first place ...

Signed-off-by: Gerd Hoffmann <[email protected]>
10 years agoinput: switch ps/2 mouse to new input api
Gerd Hoffmann [Thu, 13 Mar 2014 11:58:29 +0000 (12:58 +0100)]
input: switch ps/2 mouse to new input api

Signed-off-by: Gerd Hoffmann <[email protected]>
10 years agoinput: switch ps/2 kbd to new input api
Gerd Hoffmann [Thu, 13 Mar 2014 11:39:38 +0000 (12:39 +0100)]
input: switch ps/2 kbd to new input api

Signed-off-by: Gerd Hoffmann <[email protected]>
10 years agoinput: use KeyValue directly in sendkey monitor command
Gerd Hoffmann [Tue, 29 Apr 2014 11:17:43 +0000 (13:17 +0200)]
input: use KeyValue directly in sendkey monitor command

Signed-off-by: Gerd Hoffmann <[email protected]>
10 years agoinput: add qemu_input_handler_deactivate
Gerd Hoffmann [Sat, 15 Mar 2014 23:38:45 +0000 (00:38 +0100)]
input: add qemu_input_handler_deactivate

Signed-off-by: Gerd Hoffmann <[email protected]>
10 years agoinput: key mapping helpers
Gerd Hoffmann [Tue, 11 Mar 2014 11:15:39 +0000 (12:15 +0100)]
input: key mapping helpers

Add helper functions to translate KeyValue (qapi key representation)
into other representations: traditional qemu key numbers, qapi key
codes (Q_KEY_CODE_*) and scancode sequences.

Signed-off-by: Gerd Hoffmann <[email protected]>
10 years agops2: set ps/2 output buffer size as the same as kernel
Gonglei [Thu, 24 Apr 2014 12:06:19 +0000 (20:06 +0800)]
ps2: set ps/2 output buffer size as the same as kernel

According to the PS/2 Mouse/Keyboard Protocol, the keyboard outupt buffer size
is 16 bytes. And the PS2_QUEUE_SIZE 256 was introduced in Qemu from the very
beginning.

When I started a  redhat5.6 32bit guest, meanwhile tapped the keyboard as quickly as
possible, the screen would show me "i8042.c: No controller found". As a result,
I couldn't use the keyboard in the VNC client.

Previous discussion about the issue in maillist:
http://thread.gmane.org/gmane.comp.emulators.qemu/43294/focus=47180

This patch has been tested on redhat5.6 32-bit/suse11sp3 64-bit guests.
More easy meathod to reproduce:
1.boot a guest with libvirt.
2.connect to VNC client.
3.as you see the BIOS, bootloader, Linux booting, run the follow simply shell script:
for((i=0;i<10000000;i++)) do virsh send-key redhat5.6 KEY_A; done

Actual results:
dmesg show "i8042.c: No controller found." And the keyboard is out of work.

Signed-off-by: Gonglei <[email protected]>
Reviewed-by: Juan Quintela <[email protected]>
Signed-off-by: Gerd Hoffmann <[email protected]>
10 years agomonitor: Add netdev_del id argument completion.
Hani Benhabiles [Wed, 7 May 2014 22:41:32 +0000 (23:41 +0100)]
monitor: Add netdev_del id argument completion.

Signed-off-by: Hani Benhabiles <[email protected]>
Reviewed-by: Stefan Hajnoczi <[email protected]>
Signed-off-by: Luiz Capitulino <[email protected]>
10 years agomonitor: Add netdev_add type argument completion.
Hani Benhabiles [Wed, 7 May 2014 22:41:31 +0000 (23:41 +0100)]
monitor: Add netdev_add type argument completion.

Also update the command's documentation.

Signed-off-by: Hani Benhabiles <[email protected]>
Reviewed-by: Stefan Hajnoczi <[email protected]>
Signed-off-by: Luiz Capitulino <[email protected]>
10 years agomonitor: Add set_link arguments completion.
Hani Benhabiles [Wed, 7 May 2014 22:41:30 +0000 (23:41 +0100)]
monitor: Add set_link arguments completion.

Make it possible to query all net clients without specifying an ID when calling
qemu_find_net_clients_except().

This also adds the add_completion_option() function which is to be used for
other commands completions as well.

Signed-off-by: Hani Benhabiles <[email protected]>
Reviewed-by: Stefan Hajnoczi <[email protected]>
Signed-off-by: Luiz Capitulino <[email protected]>
10 years agomonitor: Add chardev-add backend argument completion.
Hani Benhabiles [Wed, 7 May 2014 22:41:29 +0000 (23:41 +0100)]
monitor: Add chardev-add backend argument completion.

Signed-off-by: Hani Benhabiles <[email protected]>
Signed-off-by: Luiz Capitulino <[email protected]>
10 years agomonitor: Add chardev-remove command completion.
Hani Benhabiles [Wed, 7 May 2014 22:41:28 +0000 (23:41 +0100)]
monitor: Add chardev-remove command completion.

Signed-off-by: Hani Benhabiles <[email protected]>
Signed-off-by: Luiz Capitulino <[email protected]>
10 years agomonitor: Convert sendkey to use command_completion.
Hani Benhabiles [Wed, 7 May 2014 22:41:27 +0000 (23:41 +0100)]
monitor: Convert sendkey to use command_completion.

Signed-off-by: Hani Benhabiles <[email protected]>
Signed-off-by: Luiz Capitulino <[email protected]>
10 years agoqapi: Show qapi-commands.py invocation in qapi-code-gen.txt
Markus Armbruster [Wed, 14 May 2014 15:27:23 +0000 (17:27 +0200)]
qapi: Show qapi-commands.py invocation in qapi-code-gen.txt

While there, pare down the shell prompts.

Signed-off-by: Markus Armbruster <[email protected]>
Reviewed-by: Eric Blake <[email protected]>
Signed-off-by: Luiz Capitulino <[email protected]>
10 years agoqapi: Replace uncommon use of the error API by the common one
Markus Armbruster [Wed, 7 May 2014 07:53:54 +0000 (09:53 +0200)]
qapi: Replace uncommon use of the error API by the common one

We commonly use the error API like this:

    err = NULL;
    foo(..., &err);
    if (err) {
        goto out;
    }
    bar(..., &err);

Every error source is checked separately.  The second function is only
called when the first one succeeds.  Both functions are free to pass
their argument to error_set().  Because error_set() asserts no error
has been set, this effectively means they must not be called with an
error set.

The qapi-generated code uses the error API differently:

    // *errp was initialized to NULL somewhere up the call chain
    frob(..., errp);
    gnat(..., errp);

Errors accumulate in *errp: first error wins, subsequent errors get
dropped.  To make this work, the second function does nothing when
called with an error set.  Requires non-null errp, or else the second
function can't see the first one fail.

This usage has also bled into visitor tests, and two device model
object property getters rtc_get_date() and balloon_stats_get_all().

With the "accumulate" technique, you need fewer error checks in
callers, and buy that with an error check in every callee.  Can be
nice.

However, mixing the two techniques is confusing.  You can't use the
"accumulate" technique with functions designed for the "check
separately" technique.  You can use the "check separately" technique
with functions designed for the "accumulate" technique, but then
error_set() can't catch you setting an error more than once.

Standardize on the "check separately" technique for now, because it's
overwhelmingly prevalent.

Signed-off-by: Markus Armbruster <[email protected]>
Reviewed-by: Eric Blake <[email protected]>
Signed-off-by: Luiz Capitulino <[email protected]>
10 years agotests: Don't call visit_end_struct() after visit_start_struct() fails
Markus Armbruster [Wed, 7 May 2014 07:53:53 +0000 (09:53 +0200)]
tests: Don't call visit_end_struct() after visit_start_struct() fails

When visit_start_struct() fails, visit_end_struct() must not be
called.  Three out of four visit_type_TestStruct() call it anyway.  As
far as I can tell, visit_start_struct() doesn't actually fail there.
Fix them anyway.

Signed-off-by: Markus Armbruster <[email protected]>
Reviewed-by: Eric Blake <[email protected]>
Signed-off-by: Luiz Capitulino <[email protected]>
10 years agohw: Don't call visit_end_struct() after visit_start_struct() fails
Markus Armbruster [Wed, 7 May 2014 07:53:52 +0000 (09:53 +0200)]
hw: Don't call visit_end_struct() after visit_start_struct() fails

When visit_start_struct() fails, visit_end_struct() must not be
called.  rtc_get_date() and balloon_stats_all() call it anyway.  As
far as I can tell, they're only used with the string output visitor,
which doesn't care.  Fix them anyway.

Signed-off-by: Markus Armbruster <[email protected]>
Reviewed-by: Eric Blake <[email protected]>
Signed-off-by: Luiz Capitulino <[email protected]>
10 years agohmp: Call visit_end_struct() after visit_start_struct() succeeds
Markus Armbruster [Wed, 7 May 2014 07:53:51 +0000 (09:53 +0200)]
hmp: Call visit_end_struct() after visit_start_struct() succeeds

When visit_start_struct() succeeds, visit_end_struct() must be called.
hmp_object_add() doesn't when a member visit fails.  As far as I can
tell, the opts visitor copes okay with the misuse.  Fix it anyway.

Signed-off-by: Markus Armbruster <[email protected]>
Reviewed-by: Eric Blake <[email protected]>
Signed-off-by: Luiz Capitulino <[email protected]>
10 years agoqapi: Un-inline visit of implicit struct
Markus Armbruster [Wed, 7 May 2014 07:53:50 +0000 (09:53 +0200)]
qapi: Un-inline visit of implicit struct

In preparation of error handling changes.  Bonus: generates less
duplicated code.

Signed-off-by: Markus Armbruster <[email protected]>
Reviewed-by: Eric Blake <[email protected]>
Signed-off-by: Luiz Capitulino <[email protected]>
10 years agoqapi-visit.py: Clean up a sloppy use of field prefix
Markus Armbruster [Wed, 7 May 2014 07:53:49 +0000 (09:53 +0200)]
qapi-visit.py: Clean up a sloppy use of field prefix

generate_visit_struct_fields() generates the base type's struct member
name both with and without the field prefix.  Harmless, because the
field prefix is always empty there: only unboxed complex members have
a prefix, and those can't have a base type.

Clean it up anyway.

Signed-off-by: Markus Armbruster <[email protected]>
Reviewed-by: Eric Blake <[email protected]>
Signed-off-by: Luiz Capitulino <[email protected]>
10 years agoqapi: Clean up shadowing of parameters and locals in inner scopes
Markus Armbruster [Wed, 7 May 2014 07:53:48 +0000 (09:53 +0200)]
qapi: Clean up shadowing of parameters and locals in inner scopes

By un-inlining the visit of nested complex types.

Signed-off-by: Markus Armbruster <[email protected]>
Reviewed-by: Eric Blake <[email protected]>
Signed-off-by: Luiz Capitulino <[email protected]>
10 years agoqapi-visit.py: Clean up confusing push_indent() / pop_indent() use
Markus Armbruster [Wed, 7 May 2014 07:53:47 +0000 (09:53 +0200)]
qapi-visit.py: Clean up confusing push_indent() / pop_indent() use

Changing implicit indentation in the middle of generating a block
makes following the code being generated unnecessarily hard.

Signed-off-by: Markus Armbruster <[email protected]>
Reviewed-by: Eric Blake <[email protected]>
Signed-off-by: Luiz Capitulino <[email protected]>
10 years agoqapi: Replace start_optional()/end_optional() by optional()
Markus Armbruster [Wed, 7 May 2014 07:53:46 +0000 (09:53 +0200)]
qapi: Replace start_optional()/end_optional() by optional()

Semantics of end_optional() differ subtly from the other end_FOO()
callbacks: when start_FOO() succeeds, the matching end_FOO() gets
called regardless of what happens in between.  end_optional() gets
called only when everything in between succeeds as well.  Entirely
undocumented, like all of the visitor API.

The only user of Visitor Callback end_optional() never did anything,
and was removed in commit 9f9ab46.

I'm about to clean up error handling in the generated visitor code,
and end_optional() is in my way.  No users mean no test cases, and
making non-trivial cleanup transformations without test cases doesn't
strike me as a good idea.

Drop end_optional(), and rename start_optional() to optional().  We
can always go back to a pair of callbacks when we have an actual need.

Signed-off-by: Markus Armbruster <[email protected]>
Reviewed-by: Eric Blake <[email protected]>
Signed-off-by: Luiz Capitulino <[email protected]>
10 years agoqapi: Remove unused Visitor callbacks start_handle(), end_handle()
Markus Armbruster [Wed, 7 May 2014 07:53:45 +0000 (09:53 +0200)]
qapi: Remove unused Visitor callbacks start_handle(), end_handle()

These have never been called or implemented by anything, and their
intended use is undocumented, like all of the visitor API.

Signed-off-by: Markus Armbruster <[email protected]>
Reviewed-by: Eric Blake <[email protected]>
Signed-off-by: Luiz Capitulino <[email protected]>
10 years agoqapi: Normalize marshalling's visitor initialization and cleanup
Markus Armbruster [Wed, 7 May 2014 07:53:44 +0000 (09:53 +0200)]
qapi: Normalize marshalling's visitor initialization and cleanup

Input and output marshalling functions do it differently.  Change them
to work the same: initialize the I/O visitor, use it, clean it up,
initialize the dealloc visitor, use it, clean it up.

This delays dealloc visitor initialization in output marshalling
functions, and input visitor cleanup in input marshalling functions.
No functional change, but the latter will be convenient when I change
the error handling.

Signed-off-by: Markus Armbruster <[email protected]>
Reviewed-by: Eric Blake <[email protected]>
Signed-off-by: Luiz Capitulino <[email protected]>
This page took 0.081645 seconds and 4 git commands to generate.