Commit Graph

18963 Commits

Author SHA1 Message Date
Alex Barcelo 519175a2fd coroutine: adding configure choose mechanism for coroutine backend
Configure tries, as a default, ucontext functions for the
coroutines. But now the user can force another backend by
--with-coroutine=BACKEND option

v2: Using --with-coroutine=BACKEND instead of enable
disable individual configure options

Signed-off-by: Alex Barcelo <abarcelo@ac.upc.edu>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2012-03-12 15:14:07 +01:00
Alex Barcelo 3194c8ceeb coroutine: adding sigaltstack method (.c source)
This file is based in both coroutine-ucontext.c and
pth_mctx.c (from the GNU Portable Threads library).

The mechanism used to change stacks is the sigaltstack
function (variant 2 of the pth library).

v2: Some corrections. Moving global variables into
thread storage (CoroutineThreadState).

Signed-off-by: Alex Barcelo <abarcelo@ac.upc.edu>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2012-03-12 15:14:07 +01:00
Kevin Wolf 250196f19c qcow2: Reduce number of I/O requests
If the first part of a write request is allocated, but the second isn't
and it can be allocated so that the resulting area is contiguous, handle
it at once. This is a common case for sequential writes.

After this patch, alloc_cluster_offset() only checks if the clusters are
already allocated or how many new clusters can be allocated contigouosly.
The actual cluster allocation is split off into a new function
do_alloc_cluster_offset().

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2012-03-12 15:14:07 +01:00
Kevin Wolf 256900b16b qcow2: Add qcow2_alloc_clusters_at()
This function allows to allocate clusters at a given offset in the image
file. This is useful if you want to allocate the second part of an area
that must be contiguous.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2012-03-12 15:14:07 +01:00
Kevin Wolf bf319ece56 qcow2: Factor out count_cow_clusters
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2012-03-12 15:14:07 +01:00
Paolo Bonzini 6cc2a4157b qmp: convert blockdev-snapshot-sync to a wrapper around transactions
Simplify the blockdev-snapshot-sync code and gain failsafe operation
by turning it into a wrapper around the new transaction command.  A new
option is also added matching "mode".

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2012-03-12 15:14:07 +01:00
Paolo Bonzini bc8b094feb add mode field to blockdev-snapshot-sync transaction item
The mode field lets a management application create the snapshot
destination outside QEMU.

Right now, the only modes are "existing" and "absolute-paths".  Mirroring
introduces "no-backing-file".  In the future "relative-paths" could be
implemented too.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2012-03-12 15:14:07 +01:00
Paolo Bonzini 52e7c241ac rename blockdev-group-snapshot-sync
We will add other kinds of operation.  Prepare for this by adjusting
the schema.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2012-03-12 15:14:07 +01:00
Paolo Bonzini dc8fb6df5a qapi: complete implementation of unions
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Acked-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2012-03-12 15:14:07 +01:00
Paolo Bonzini 622d241998 use QSIMPLEQ_FOREACH_SAFE when freeing list elements
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2012-03-12 15:14:07 +01:00
Kevin Wolf b8c6f29eb8 Add 'make check-block'
Runs the full qemu-iotests suite for various image formats.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2012-03-12 15:14:07 +01:00
Kevin Wolf 8959449bb9 make check: Add qemu-iotests subset
Run the 'quick' group from qemu-iotests during 'make check'.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2012-03-12 15:14:07 +01:00
Kevin Wolf 3811f63acd qemu-iotests: Mark some tests as quick
This creates a new test group 'quick' for some test case that take at
most a couple of seconds each, so that the group can be run during a
quick 'make check'

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2012-03-12 15:14:07 +01:00
Kevin Wolf 259b217310 qcow2: Add error messages in qcow2_truncate
qemu-img resize has some limitations with qcow2, but the user is only
told that "this image format does not support resize". Quite confusing,
so add some more detailed error_report() calls and change "this image
format" into "this image".

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2012-03-12 15:14:06 +01:00
Stefan Hajnoczi e88774971c block: handle -EBUSY in bdrv_commit_all()
Monitor operations that manipulate image files must not execute while a
background job (like image streaming) is in progress.  This prevents
corruptions from happening when two pieces of code are manipulating the
image file without knowledge of each other.

The monitor "commit" command raises QERR_DEVICE_IN_USE when
bdrv_commit() returns -EBUSY but "commit all" has no error handling.
This is easy to fix, although note that we do not deliver a detailed
error about which device was busy in the "commit all" case.

Suggested-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2012-03-12 15:14:06 +01:00
Kevin Wolf 3cce16f44d qcow2: Add some tracing
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2012-03-12 15:14:06 +01:00
Stefan Hajnoczi 14fe292d86 qed: do not evict in-use L2 table cache entries
The L2 table cache reduces QED metadata reads that would be required
when translating LBAs to offsets into the image file.  Since requests
execute in parallel it is possible to share an L2 table between multiple
requests.

There is a potential data corruption issue when an in-use L2 table is
evicted from the cache because the following situation occurs:

  1. An allocating write performs an update to L2 table "A".

  2. Another request needs L2 table "B" and causes table "A" to be
     evicted.

  3. A new read request needs L2 table "A" but it is not cached.

As a result the L2 update from #1 can overlap with the L2 fetch from #3.
We must avoid doing overlapping I/O requests here since the worst case
outcome is that the L2 fetch completes before the L2 update and yields
stale data.  In that case we would effectively discard the L2 update and
lose data clusters!

Thanks to Benoît Canet <benoit.canet@gmail.com> for extensive testing
and debugging which lead to discovery of this bug.

Reported-by: Benoît Canet <benoit.canet@gmail.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Tested-by: Benoît Canet <benoit.canet@gmail.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2012-03-12 15:14:06 +01:00
Paolo Bonzini d0895d6e39 Group snapshot: Fix format name for backing file
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2012-03-12 15:14:06 +01:00
Stefan Weil a348f10884 Add missing const attributes for MemoryRegionOps
Most MemoryRegionOps already had the const attribute.
This patch adds it to the remaining ones.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-03-11 11:40:15 +00:00
Stefan Weil 9d6fca70c7 tcg: Improve tcg_out_label and fix its usage for w64
tcg_out_label is always called with a third argument of pointer type
which was casted to tcg_target_long.

These casts can be avoided by changing the prototype of tcg_out_label.

There was also a cast to long. For most hosts with
sizeof(long) == sizeof(tcg_target_long) == sizeof(void *) this did not
matter, but for w64 it was wrong. This is fixed now.

Cc: Blue Swirl <blauwirbel@gmail.com>
Cc: Richard Henderson <rth@twiddle.net>
Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-03-11 11:28:39 +00:00
Stefan Weil f7cf5d5b71 configure: Test for libiberty.a (mingw32)
MinGW-w64 and some versions of MinGW32 don't provide libiberty.a,
so add this library only if it was found.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-03-11 11:28:07 +00:00
Stefan Weil 371c648900 w64: Don't redefine lseek, ftruncate
MinGW-w64 already defines lseek and ftruncate (and uses the 64 bit
variants). The conditional compilation avoids redefinitions
(which would be wrong) and compiler warnings.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-03-11 11:27:30 +00:00
Stefan Weil e04b289961 cache-utils: Add missing include file for uintptr_t
Commit 021ecd8b9d breaks the build for
PPC hosts because it uses uintptr_t without the necessary include file.

uintptr_t is defined in stdint.h, so add this include.

Cc: Alexander Graf <agraf@suse.de>
Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-03-11 11:25:19 +00:00
Lluís Vilanova 250b086efb build: Include config-host.mak as soon as possible
Current code depends on variables defined in config-host.mak before it is
actually included.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
Cc: Anthony Liguori <aliguori@us.ibm.com>
Cc: Paul Brook <paul@codesourcery.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-03-11 11:24:27 +00:00
Jan Kiszka 00e94dbc7f gdbstub: Do not kill target in system emulation mode
Too many VM kittens were killed since 7d03f82f81. Another one just died
under my fat fingers.

When you quit a kgdb session, does the Linux kernel power off? Or when
you terminate gdb attached to a hardware debugger, does your board
vanish in space? No.

So let's stop terminating QEMU when the gdbstub receives a kill commando
in system emulation mode. Real termination can still be achieved via
"monitor quit". We keep the behavior for user mode emulation which is
arguably more like a gdbserver scenario.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-03-11 11:23:19 +00:00
Jan Kiszka 3f2cbf0d1a target-i386: Mask NX bit from cpu_get_phys_page_debug result
This was a long pending bug, now revealed by the assert in
phys_page_find that stumbled over the large page index returned by
cpu_get_phys_page_debug for NX-marked pages: We need to mask out NX and
all user-definable bits 52..62 from PDEs and the final PTE to avoid
corrupting physical addresses.

Reviewed-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-03-11 11:22:39 +00:00
Anthony Liguori dac6b1b22c Merge remote-tracking branch 'stefanha/trivial-patches' into staging
* stefanha/trivial-patches:
  configure: Quote the configure args printed in config.log
  osdep: Remove local definition of macro offsetof
  libcacard: Spelling and grammar fixes in documentation
  Spelling fixes in comments (it's -> its)
  vnc: Add break statement
  libcacard: Use format specifier %u instead of %d for unsigned values
  Fix sign of sscanf format specifiers
  block/vmdk: Fix warning from splint (comparision of unsigned value)
  qmp: Fix spelling fourty -> forty
  qom: Fix spelling in documentation
  sh7750: Remove redundant 'struct' from MemoryRegionOps
2012-03-09 12:30:20 -06:00
Anthony Liguori bf75fec175 Merge remote-tracking branch 'qemu-kvm/uq/master' into staging
* qemu-kvm/uq/master:
  kvm: fill in padding to help valgrind
  kvm: x86: Add user space part for in-kernel i8254
  kvm: Add kvm_has_pit_state2 helper
  i8254: Open-code timer restore
  i8254: Factor out base class for KVM reuse
2012-03-09 12:29:55 -06:00
Anthony Liguori 9f1d43b133 Merge remote-tracking branch 'kraxel/usb.42' into staging
* kraxel/usb.42:
  xhci: fix port status
  xhci: fix control xfers
  usb: add shortcut for control transfers
  usb-host: enable pipelineing for bulk endpoints.
  usb: add pipelining option to usb endpoints
  usb: queue can have async packets
  uhci_fill_queue: zap debug printf
  usb: add USB_RET_IOERROR
  usb: return BABBLE rather then NAK when we receive too much data
  usb-ehci: Cleanup itd error handling
  usb-ehci: Fix and simplify nakcnt handling
  usb-ehci: Remove dead nakcnt code
  usb-ehci: Fix cerr tracking
  usb-ehci: Any packet completion except for NAK should set the interrupt
  usb-ehci: Rip the queues when the async or period schedule is halted
  usb-ehci: Drop cached qhs when the doorbell gets rung
  usb-ehci: always call ehci_queues_rip_unused for period queues
  usb-ehci: split our qh queue into async and periodic queues
  usb-ehci: Never follow table entries with the T-bit set
  usb-redir: Set ep type and interface
2012-03-09 12:29:40 -06:00
Hans de Goede 0202181245 libcacard: Fix compilation with gcc-4.7
VCARD_ATR_PREFIX is used as part of an array initializer so it should
not have () around it, so far this happened to work, but gcc-4.7 does
not like it.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-03-09 07:02:50 -06:00
Anthony Liguori 0d10f62708 xilinx_zynq: fix the build
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-03-09 07:02:50 -06:00
Peter Maydell 979ae168e5 configure: Quote the configure args printed in config.log
Use the same mechanism we use for printing the configure command
line to config-host.mak to print it to config.log. This fixes a
bug where the config.log version didn't quote arguments with spaces.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2012-03-08 15:22:12 +00:00
Stefan Weil 82246040ea osdep: Remove local definition of macro offsetof
The macro offsetof is defined in stddef.h. It is conforming to
the standards C89, C99 and POSIX.1-2001 (see man page), so it
is a sufficiently old standard.

Therefore chances are very high that QEMU never needs a local
definition of this macro.

osdep.h already includes stddef.h, so this patch simply removes
the unneeded code from the files configure and osdep.h.

If we ever need the local definition again, it should be added
to compiler.h (the macro is usually provided with the compiler,
it is not OS specific).

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2012-03-08 15:22:12 +00:00
Stefan Weil 4a84ebe6a6 libcacard: Spelling and grammar fixes in documentation
* it's -> its

* it's -> it is (that's no fix, but makes future checks easier)

* this functions -> this function

* replacable -> replaceable

* reader's -> readers

* logins into -> logs into

v2:
Also replace 'aid' by 'AID' (thanks to Peter Maydell for this hint).

v3:
Fix sentence (contributed by Alon Levy / Robert Relyea).

Cc: Alon Levy <alevy@redhat.com>
Cc: Robert Relyea <rrelyea@redhat.com>
Cc: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2012-03-08 15:22:11 +00:00
Stefan Weil 93148aa5c3 Spelling fixes in comments (it's -> its)
* it's -> its (fixed for all files)
* dont -> don't (only fixed in a line which was touched by the previous fix)
* distrub -> disturb (fixed in the same line)

Reviewed-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2012-03-08 15:22:11 +00:00
Stefan Weil 0ea5c0cdb0 vnc: Add break statement
This was not a bug, but it is not common practice to omit the break statement
from the last case statement before an empty default case.

Any change of the default case would introduce a bug.

This was reported as a warning by splint.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2012-03-08 15:22:11 +00:00
Stefan Weil ba79c88604 libcacard: Use format specifier %u instead of %d for unsigned values
splint reported warnings for those code statements.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2012-03-08 15:22:11 +00:00
Stefan Weil 1c467855da Fix sign of sscanf format specifiers
All values read by sscanf are unsigned, so replace %d by %u.

This signed / unsigned mismatch was detected by splint.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2012-03-07 13:03:51 +00:00
Stefan Weil 75d1234103 block/vmdk: Fix warning from splint (comparision of unsigned value)
l1_entry_sectors will never be less than 0.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2012-03-07 13:03:51 +00:00
Stefan Weil beae9d7990 qmp: Fix spelling fourty -> forty
This was found by codespell.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Acked-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2012-03-07 13:03:51 +00:00
Stefan Weil 441dd5ebd5 qom: Fix spelling in documentation
This fixes a new spelling issue which was detected by codespell.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2012-03-07 13:03:51 +00:00
Stefan Weil 12f30833b9 sh7750: Remove redundant 'struct' from MemoryRegionOps
The 'struct' is not needed, and all other MemoryRegionOps don't use it.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2012-03-07 13:03:50 +00:00
Gerd Hoffmann cf21a4aef7 xhci: fix port status
Don't signal port status change if the usb device isn't in attached
state.  Happens with usb-host devices with the pass-through device
being plugged out at the host.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-03-07 12:28:05 +01:00
Gerd Hoffmann 2850ca9ed1 xhci: fix control xfers
Use the new, direct control transfer submission method instead of
bypassing the usb core by calling usb_device_handle_control directly.
The later fails for async control transfers.

This patch gets xhci + usb-host combo going.
2012-03-07 12:28:05 +01:00
Gerd Hoffmann 1b4b29a114 usb: add shortcut for control transfers
Add a more direct code path to submit control transfers.  Instead of
feeding three usb packets (setup, data, ack) to usb_handle_packet and
have the do_token_* functions in usb.c poke the control transfer
parameters out of it just submit a single packet carrying the actual
data with the control xfer parameters filled into USBPacket->parameters.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-03-07 12:28:05 +01:00
Gerd Hoffmann 9424d4e7c6 usb-host: enable pipelineing for bulk endpoints.
We really don't want to wait for packets finish before submitting the
next, we want keep the data flow running.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-03-07 12:28:05 +01:00
Gerd Hoffmann 7936e0f0d2 usb: add pipelining option to usb endpoints
With this patch applied USB drivers can enable pipelining per endpoint.
With pipelining enabled the usb core will continue submitting packets
even when there are still async transfers in flight instead of passing
them on one by one.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-03-07 12:28:05 +01:00
Gerd Hoffmann eb9d4673e3 usb: queue can have async packets
This can happen today in case the ->complete() callback queues up the
next packet.  Also we'll support pipelining soon, which allows to have
multiple packets per queue in flight (aka ASYNC) state.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-03-07 12:28:05 +01:00
Gerd Hoffmann 7c308b7e38 uhci_fill_queue: zap debug printf 2012-03-07 12:28:04 +01:00
Hans de Goede d61000a8b1 usb: add USB_RET_IOERROR
We already have USB_RET_NAK, but that means that a device does not want
to send/receive right now. But with host / network redirection we can
actually have a transaction fail due to some io error, rather then ie
the device just not having any data atm.

This patch adds a new error code named USB_RET_IOERROR for this, and uses
it were appropriate.

Notes:
-Currently all usb-controllers handle this the same as NODEV, but that
 may change in the future, OHCI could indicate a CRC error instead for example.
-This patch does not touch hw/usb-musb.c, that is because the code in there
 handles STALL and NAK specially and has a if status < 0 generic catch all
 for all other errors

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-03-07 12:28:04 +01:00