Stefan Hajnoczi [Mon, 8 Aug 2011 07:34:05 +0000 (13:04 +0530)]
coroutine: add gthread dependency
Commit
1fc7bd4a86a2bfeafcec29445871eb97469a2699 removed the gthread and
gio dependency since qemu-ga did not require it. Coroutines require
gthread, so add it back in.
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Brad [Sun, 7 Aug 2011 11:06:43 +0000 (11:06 +0000)]
Fix forcing multicast msgs to loopback on OpenBSD.
Fix forcing multicast msgs to loopback on OpenBSD.
e.g.
$ sudo qemu -m 128 -no-fd-bootchk \
-hda virtual.img -boot n -nographic \
-net nic,vlan=0,model=rtl8139,macaddr=52:54:00:12:34:03 \
-net user -tftp /usr/src/sys/arch/i386/compile/TEST -bootp pxeboot \
-net nic,vlan=1,model=rtl8139,macaddr=52:54:00:23:03:01 \
-net tap,vlan=1,script=no \
-net nic,vlan=3,model=rtl8139,macaddr=52:54:00:23:03:03 \
-net socket,vlan=3,mcast=230.0.0.1:10003
setsockopt(SOL_IP, IP_MULTICAST_LOOP): Invalid argument
qemu: -net socket,vlan=3,mcast=230.0.0.1:10003: Device 'socket' could not be initialized
Signed-off-by: Brad Smith <brad@comstyle.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Tobias Nygren [Sun, 7 Aug 2011 09:57:05 +0000 (09:57 +0000)]
Use mmap to allocate execute memory
Use mmap to allocate executable memory on NetBSD as well.
Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Manuel Bouyer [Sun, 7 Aug 2011 09:48:59 +0000 (09:48 +0000)]
Fix network interface tap backend
Fix network interface tap backend work on NetBSD.
It uses an ioctl to get the tap name.
Signed-off-by: Christoph Egger<Christoph.Egger@amd.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Stefan Weil [Wed, 20 Jul 2011 19:40:18 +0000 (21:40 +0200)]
darwin-user: Remove two unused variables
cppcheck report:
darwin-user/signal.c:322: style: Unused variable: i
darwin-user/signal.c:322: style:
Variable 'err' is assigned a value that is never used
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Blue Swirl [Sat, 6 Aug 2011 13:58:47 +0000 (13:58 +0000)]
TCG: fix copy propagation
Copy propagation introduced in
22613af4a6d9602001e6d0e7b6d98aa40aa018dc
considered only global registers. However, register temps and stack
allocated locals must be handled differently because register temps
don't survive across brcond.
Fix by propagating only within same class of temps.
Tested-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Blue Swirl [Mon, 1 Aug 2011 16:12:17 +0000 (16:12 +0000)]
Remove unused is_softmmu parameter from cpu_handle_mmu_fault
Parameter is_softmmu (and its evil mutant twin brother is_softmuu)
is not used in cpu_*_handle_mmu_fault() functions, remove them
and adjust callers.
Acked-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Artyom Tarasenko [Sat, 6 Aug 2011 15:01:24 +0000 (17:01 +0200)]
Fix handling of conditional branches in delay slot of a conditional branch
Check whether dc->npc is dynamic before using its value for branch.
Signed-off-by: Artyom Tarasenko <atar4qemu@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Anthony Liguori [Fri, 5 Aug 2011 17:17:04 +0000 (12:17 -0500)]
Merge remote-tracking branch 'kiszka/queues/slirp' into staging
Stuart Yoder [Thu, 4 Aug 2011 22:10:08 +0000 (17:10 -0500)]
when overriding default tool names don't add cross-prefix
When overriding a tool name via a shell variable, don't
tack on the cross-prefix. This specifically allows the
pkg-config command to be overridden and work where it
does not exist in some cross build environments.
Signed-off-by: Stuart Yoder <stuart.yoder@freescale.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Jan Kiszka [Fri, 5 Aug 2011 07:11:26 +0000 (09:11 +0200)]
Reorganize and fix monitor resume after migration
If migration failed in migrate_fd_put_buffer, the monitor may have been
resumed not only in the error path of that function but also once again
in migrate_fd_put_ready which is called unconditionally by
migrate_fd_connect.
Fix this by establishing a cleaner policy: the monitor shall be resumed
when the migration file is closed, either via callback
(migrate_fd_close) or in migrate_fd_cleanup if no file is open (i.e. no
callback invoked).
Reported-By: Michael Tokarev <mjt@tls.msk.ru>
Tested-By: Michael Tokarev <mjt@tls.msk.ru>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Isaku Yamahata [Tue, 2 Aug 2011 01:59:13 +0000 (10:59 +0900)]
qdev: Eliminate duplicate reset
qbus_reset_all_fn was registered twice, so a lot of device reset
functions were also called twice when QEMU started.
Which was introduced by
80376c3fc2c38fdd45354e4b0eb45031f35587ed
This patch fixes it by making the main_system_bus creation not register
reset handler.
Cc: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Tested-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Jan Kiszka [Tue, 2 Aug 2011 14:10:21 +0000 (16:10 +0200)]
Avoid allocating TCG resources in non-TCG mode
Do not allocate TCG-only resources like the translation buffer when
running over KVM or XEN. Saves a "few" bytes in the qemu address space
and is also conceptually cleaner.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Avi Kivity [Wed, 3 Aug 2011 08:56:14 +0000 (11:56 +0300)]
memory: use signed arithmetic
When trying to map an alias of a ram region, where the alias starts at
address A and we map it into address B, and A > B, we had an arithmetic
underflow. Because we use unsigned arithmetic, the underflow converted
into a large number which failed addrrange_intersects() tests.
The concrete example which triggered this was cirrus vga mapping
the framebuffer at offsets 0xc0000-0xc7fff (relative to the start of
the framebuffer) into offsets 0xa0000 (relative to system addres space
start).
With our favorite analogy of a windowing system, this is equivalent to
dragging a subwindow off the left edge of the screen, and failing to clip
it into its parent window which is on screen.
Fix by switching to signed arithmetic.
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Avi Kivity [Sun, 31 Jul 2011 19:47:58 +0000 (22:47 +0300)]
memory: synchronize dirty bitmap before unmapping a range
When a range is being unmapped, ask accelerators (e.g. kvm) to synchronize the
dirty bitmap to avoid losing information forever.
Fixes grub2 screen update.
Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Jan Kiszka [Sat, 30 Jul 2011 09:39:18 +0000 (11:39 +0200)]
sdl: Refactor sdl_send_mouse_event
Replace width/height globals with the identical values from real_screen,
refactor the function according to our coding style.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Jan Kiszka [Sat, 30 Jul 2011 09:39:17 +0000 (11:39 +0200)]
sdl: Factor out event handlers from sdl_refresh
No functional changes.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Jan Kiszka [Sat, 30 Jul 2011 09:39:16 +0000 (11:39 +0200)]
sdl: Add zoom hot keys
Allow to enlarge or shrink the screen via CTRL-ALT-+/-. In contrast to
scaling the window, these controls always preserve the aspect ratio of
the current console.
CC: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Jan Kiszka [Sat, 30 Jul 2011 09:39:15 +0000 (11:39 +0200)]
sdl: Dynamically grab input in absolute mouse mode
Not grabbing the input means that special keys like ALT+TAB are still
handled by the host. Improve the usability by grabbing input once the
mouse is inside the guest screen, provided the SDL window has the input
focus. Release it again when the mouse is moved to any border. Also grab
the input when we gain the input focus and the mouse is within the
screen limits.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Jan Kiszka [Sat, 30 Jul 2011 09:39:14 +0000 (11:39 +0200)]
sdl: Fix cursor handling when switching consoles in absolute mouse mode
Restore the cursor when switching from graphic to text console while the
mouse is in absolute mode. Disable it again when returning.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Jan Kiszka [Sat, 30 Jul 2011 09:39:13 +0000 (11:39 +0200)]
sdl: Never release input while in full screen mode
It's confusing to suddenly find two mice in full screen mode when
switching consoles or accidentally hitting the grab hot keys.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Jan Kiszka [Sat, 30 Jul 2011 09:39:12 +0000 (11:39 +0200)]
sdl: Consistently avoid grabbing input for text consoles
There were some preexisting bits that released the input when switching
to text console. This patch spreads this logic consistently and also
avoids grabbing the input while a text console is active.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Jan Kiszka [Sat, 30 Jul 2011 09:39:11 +0000 (11:39 +0200)]
sdl: Initialize gui_fullscreen earlier during setup
This ensures that we actually enter full screen on startup when e.g.
'-vga none -full-screen' was specified.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Jan Kiszka [Sat, 30 Jul 2011 09:39:10 +0000 (11:39 +0200)]
sdl: Drop bogus gui_fullscreen_initial_grab
There must be no difference between initial -full-screen and switching
to this mode via the hot key.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Jan Kiszka [Sat, 30 Jul 2011 09:39:09 +0000 (11:39 +0200)]
sdl: Restore scaling mode on return from full screen
Save the scaling mode and its geometry when going full screen, restore
it when returning to windowed mode.
CC: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Jan Kiszka [Sat, 30 Jul 2011 09:39:08 +0000 (11:39 +0200)]
sdl: Fix full screen toggling from scaled mode
When switching to full screen mode from a scaled window, we need to
resize to DisplayState's dimension, not the scaled "real" screen size.
Moreover, scaling mode may have manipulated the bpp. So we need to
restore it from the DisplayState as well.
CC: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Jan Kiszka [Sat, 30 Jul 2011 09:39:07 +0000 (11:39 +0200)]
sdl: Properly mark modifier+u as hotkey
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Jan Kiszka [Sat, 30 Jul 2011 09:39:06 +0000 (11:39 +0200)]
sdl: Avoid redundant scaling deactivation
Prevents screen flickering.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Jan Kiszka [Sat, 30 Jul 2011 09:39:05 +0000 (11:39 +0200)]
sdl: Do not make full screen mode resizable
This prevents continuous resizing events and improper screen setups when
going full screen.
CC: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Jan Kiszka [Sat, 30 Jul 2011 09:39:04 +0000 (11:39 +0200)]
sdl: Fix termination in -no-shutdown mode
Just like the monitor does, we need to clear no_shutdown before calling
qemu_system_shutdown_request on quit requests. Otherwise, QEMU just
stops the VM.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
David Gibson [Mon, 1 Aug 2011 06:49:59 +0000 (16:49 +1000)]
Check fread() results to avoid gcc 4.6 warnings
When compiling with gcc 4.6, some code in fw_cfg.c complains that fop_ret
is assigned but not used (which is true). However, it looks like the
meaningless assignments to fop_ret were done to suppress other gcc warnings
due to the fact that fread() is labelled as warn_unused_result in glibc.
This patch avoids both errors, by actually checking the fread() result code
and dropping out with an error message if it fails.
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Tested-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Stefano Stabellini [Fri, 29 Jul 2011 15:05:13 +0000 (16:05 +0100)]
MAINTAINERS: add entry for Xen
Acked-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Kevin Wolf [Fri, 5 Aug 2011 10:06:11 +0000 (12:06 +0200)]
qcow2: Fix L1 table size after bdrv_snapshot_goto
When loading an internal snapshot whose L1 table is smaller than the current L1
table, the size of the current L1 would be shrunk to the snapshot's L1 size in
memory, but not on disk. This lead to incorrect refcount updates and eventuelly
to image corruption.
Instead of writing the new L1 size to disk, this simply retains the bigger L1
size that is currently in use and makes sure that the unused part is zeroed.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Tested-by: Philipp Hahn <hahn@univention.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Jan Kiszka [Fri, 5 Aug 2011 12:05:53 +0000 (14:05 +0200)]
slirp: Only start packet expiration for delayed ones
The expiration timeout must only affect packets that are queued due to
pending ARP resolutions. The old version broke ping e.g.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Jan Kiszka [Fri, 5 Aug 2011 12:04:00 +0000 (14:04 +0200)]
slirp: Read current time only once per if_start call
No need to update the current time for each packet we send from the
queue. Processing time is comparably short.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Jan Kiszka [Fri, 5 Aug 2011 10:51:11 +0000 (12:51 +0200)]
slirp: Fix types of IP address parameters
Should be uint32_t for IPv4, not int. Also avoid in_addr_t without
proper includes. Fixes build regression on mingw32.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Anthony Liguori [Thu, 4 Aug 2011 22:15:22 +0000 (17:15 -0500)]
Merge remote-tracking branch 'mst/for_anthony' into staging
Anthony Liguori [Thu, 4 Aug 2011 22:14:49 +0000 (17:14 -0500)]
Merge remote-tracking branch 'alon/pull-libcacard.data' into staging
Anthony Liguori [Thu, 4 Aug 2011 22:14:01 +0000 (17:14 -0500)]
Merge remote-tracking branch 'stefanha/trivial-patches' into staging
Anthony Liguori [Thu, 4 Aug 2011 22:13:26 +0000 (17:13 -0500)]
Merge remote-tracking branch 'spice/spice.v40' into staging
Anthony Liguori [Thu, 4 Aug 2011 22:12:34 +0000 (17:12 -0500)]
Merge remote-tracking branch 'kiszka/queues/slirp' into staging
Anthony Liguori [Thu, 4 Aug 2011 22:10:36 +0000 (17:10 -0500)]
Merge remote-tracking branch 'kraxel/usb.22' into staging
Anthony Liguori [Thu, 4 Aug 2011 21:45:17 +0000 (16:45 -0500)]
Merge remote-tracking branch 'kwolf/for-anthony' into staging
Michael Roth [Mon, 1 Aug 2011 19:52:57 +0000 (14:52 -0500)]
guest agent: add --enable-guest-agent config option
QAPI will require glib/python, but for now the guest agent is the only
user. For now, make these dependencies an explicit guest agent one, and
give users the option to disable it if need be.
Once QAPI is adopted in core QEMU code, we would basically revert this
patch.
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Brad [Sat, 30 Jul 2011 05:45:55 +0000 (01:45 -0400)]
Add support for finding libpng via pkg-config.
Signed-off-by: Brad Smith <brad@comstyle.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Richard Henderson [Sun, 31 Jul 2011 23:47:20 +0000 (16:47 -0700)]
alpha-softmmu: Disable for the 0.15 release branch.
The system emulation code was not merged before the branch.
Let's leave that work for the next release.
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Stefan Weil [Fri, 29 Jul 2011 20:40:45 +0000 (22:40 +0200)]
configure: Fix bad shell expression for non-Linux hosts
With vhost_net="" (most non-Linux hosts), configure prints an
error message:
test: 2551: =: unexpected operator
Fix this and similar code by adding the missing "".
Cc: Wolfgang Mauerer <wolfgang.mauerer@siemens.com>
Cc: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Amit Shah [Thu, 28 Jul 2011 06:06:26 +0000 (11:36 +0530)]
virtio-balloon: Unregister savevm section on device unplug
Migrating after unplugging a virtio-balloon device resulted in an error
message on the destination:
Unknown savevm section or instance '0000:00:04.0/virtio-balloon' 0
load of migration failed
Fix this by unregistering the section on device unplug.
Signed-off-by: Amit Shah <amit.shah@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Amit Shah [Wed, 27 Jul 2011 08:20:41 +0000 (13:50 +0530)]
virtio-balloon: Add exit handler, fix memleaks
Add an exit handler that will free up RAM after a virtio-balloon device
is unplugged.
Signed-off-by: Amit Shah <amit.shah@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Amit Shah [Wed, 27 Jul 2011 11:20:54 +0000 (16:50 +0530)]
balloon: Reject negative balloon values
Negative balloon values don't make sense, reject them and throw a qerror
with QERR_INVALID_PARAMETER_VALUE.
Reported-by: Mike Cao <bcao@redhat.com>
Signed-off-by: Amit Shah <amit.shah@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Amit Shah [Wed, 27 Jul 2011 06:59:33 +0000 (12:29 +0530)]
virtio-balloon: Check if balloon registration failed
Multiple balloon registrations are not allowed; check if the
registration with the qemu balloon api succeeded. If not, fail the
device init.
Signed-off-by: Amit Shah <amit.shah@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Amit Shah [Wed, 27 Jul 2011 06:58:19 +0000 (12:28 +0530)]
balloon: Don't allow multiple balloon handler registrations
Multiple balloon devices don't make sense; disallow more than one
registration attempt to register handlers.
Signed-off-by: Amit Shah <amit.shah@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Amit Shah [Wed, 20 Jul 2011 08:07:01 +0000 (13:37 +0530)]
virtio-balloon: Fix header comment; add Copyright
Signed-off-by: Amit Shah <amit.shah@redhat.com>
Amit Shah [Wed, 20 Jul 2011 08:05:30 +0000 (13:35 +0530)]
balloon: Fix header comment; add Copyright
Signed-off-by: Amit Shah <amit.shah@redhat.com>
Amit Shah [Wed, 20 Jul 2011 08:00:56 +0000 (13:30 +0530)]
balloon: Separate out stat and balloon handling
Passing on '0' as ballooning target to indicate retrieval of stats is
bad API. It also makes 'balloon 0' in the monitor cause a segfault.
Have two different functions handle the different functionality instead.
Detailed explanation from Markus's review:
1. do_info_balloon() is an info_async() method. It receives a callback
with argument, to be called exactly once (callback frees the
argument). It passes the callback via qemu_balloon_status() and
indirectly through qemu_balloon_event to virtio_balloon_to_target().
virtio_balloon_to_target() executes its balloon stats half. It
stores the callback in the device state.
If it can't send a stats request, it resets stats and calls the
callback right away.
Else, it sends a stats request. The device model runs the callback
when it receives the answer.
Works.
2. do_balloon() is a cmd_async() method. It receives a callback with
argument, to be called when the command completes. do_balloon()
calls it right before it succeeds. Odd, but should work.
Nevertheless, it passes the callback on via qemu_ballon() and
indirectly through qemu_balloon_event to virtio_balloon_to_target().
a. If the argument is non-zero, virtio_balloon_to_target() executes
its balloon half, which doesn't use the callback in any way.
Odd, but works.
b. If the argument is zero, virtio_balloon_to_target() executes its
balloon stats half, just like in 1. It either calls the callback
right away, or arranges for it to be called later.
Thus, the callback runs twice: use after free and double free.
Test case: start with -S -device virtio-balloon, execute "balloon 0" in
human monitor. Runs the callback first from virtio_balloon_to_target(),
then again from do_balloon().
Reported-by: Mike Cao <bcao@redhat.com>
Signed-off-by: Amit Shah <amit.shah@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Amit Shah [Wed, 20 Jul 2011 07:49:07 +0000 (13:19 +0530)]
virtio-balloon: Separate status handling into separate function
Separate out the code to retrieve balloon info from the code that sets
balloon values.
This will be used to separate the two callbacks from balloon.c and help
cope with 'balloon 0' on the monitor. Currently, 'balloon 0' causes a
segfault in monitor_resume().
Signed-off-by: Amit Shah <amit.shah@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Amit Shah [Wed, 20 Jul 2011 07:44:12 +0000 (13:14 +0530)]
balloon: Simplify code flow
Replace:
if (foo) {
...
} else {
return 0;
}
by
if (!foo) {
return 0;
}
...
Signed-off-by: Amit Shah <amit.shah@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Amit Shah [Wed, 20 Jul 2011 07:42:15 +0000 (13:12 +0530)]
balloon: Add braces around if statements
Signed-off-by: Amit Shah <amit.shah@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Amit Shah [Wed, 20 Jul 2011 07:38:46 +0000 (13:08 +0530)]
balloon: Make functions, local vars static
balloon.h had function declarations for a couple of functions that are
local to balloon.c. Make them static.
Drop the 'qemu_' prefix for balloon.c-local variables, and make them
static.
Signed-off-by: Amit Shah <amit.shah@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Gerd Hoffmann [Fri, 15 Jul 2011 14:14:59 +0000 (16:14 +0200)]
bluetooth: kill dummy usb device, use hid code directly.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Gerd Hoffmann [Fri, 15 Jul 2011 13:52:33 +0000 (15:52 +0200)]
hid: move idle+protocol from usb-hid to hid too.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Gerd Hoffmann [Fri, 15 Jul 2011 13:08:01 +0000 (15:08 +0200)]
usb-hid: split hid code to hw/hid.[ch]
Almost pure code motion. Unstatic hid interface functions and add
them to the header file. Some renames. Some code style cleanups.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Gerd Hoffmann [Fri, 15 Jul 2011 12:46:39 +0000 (14:46 +0200)]
usb-hid: add hid_has_events()
Add hid_has_events function, use it to figure whenever there are pending
events instead of checking and updating USBHIDState->changed.
Setting ->changed to 1 on init is removed, that should have absolutely
no effect as the initial state of ->idle is 0 so we report hid state
anyway until the guest configures some idle time. Also should clear
->idle on reset.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Gerd Hoffmann [Fri, 15 Jul 2011 12:37:15 +0000 (14:37 +0200)]
usb-hid: add event callback
Add callback for event notification, which allows to un-usbify more
functions. Also split separate hid_* functions for reset and release.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Gerd Hoffmann [Fri, 15 Jul 2011 11:12:44 +0000 (13:12 +0200)]
usb-hid: create & use HIDState
First step in separating out the HID emulation code from usb-hid, so it
can be reused without creating a dummy usb device like bluetooth does.
This creates a HIDState struct, moves the non-usbish fields from
USBHIDStruct there. Renames non-usbish structs, defines and functions
from usb* to hid*. Adapts the code to that.
Also cleans up a bunch of code style issues along the way.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Gerd Hoffmann [Wed, 13 Jul 2011 15:36:46 +0000 (17:36 +0200)]
ehci: iovec support, remove buffer
Map guest memory and pass on a direct pointer instead of copying
the bits to a indirect buffer. EHCI transfer descriptors can
reference multiple (physical guest) pages so we'll actually start
seeing usb packets wich carry iovec with more than one element.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Gerd Hoffmann [Wed, 13 Jul 2011 13:37:29 +0000 (15:37 +0200)]
uhci: remove buffer
Map guest memory and pass on a direct pointer instead of copying
the bits to a indirect buffer.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Gerd Hoffmann [Wed, 13 Jul 2011 10:32:06 +0000 (12:32 +0200)]
usb-storage: iovec support
Add full iovec support to usb-storage.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Gerd Hoffmann [Wed, 13 Jul 2011 09:28:17 +0000 (11:28 +0200)]
usb-host: iovec support
Add full support for iovecs to usb-host. The code can split large
transfers into smaller ones already, we are using this to also split
requests at iovec borders.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Gerd Hoffmann [Wed, 13 Jul 2011 08:53:23 +0000 (10:53 +0200)]
usb-serial: iovec support
Add full support for iovecs to usb-serial.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Gerd Hoffmann [Tue, 12 Jul 2011 13:22:25 +0000 (15:22 +0200)]
usb: use iovecs in USBPacket
Zap data pointer from USBPacket, add a QEMUIOVector instead.
Add a bunch of helper functions to manage USBPacket data.
Switch over users to the new interface.
Note that USBPacket->len was used for two purposes: First to
pass in the buffer size and second to return the number of
transfered bytes or the status code on async transfers. There
is a new result variable for the latter. A new status code
was added to catch uninitialized result.
Nobody creates iovecs with more than one element (yet).
Some users are (temporarely) limited to iovecs with a single
element to keep the patch size as small as possible.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Gerd Hoffmann [Tue, 12 Jul 2011 11:36:23 +0000 (13:36 +0200)]
move QEMUSGList typedef
Move the QEMUSGList typedef to qemu-common so it can easily be used.
The actual struct definition stays in dma.h.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Gerd Hoffmann [Wed, 13 Jul 2011 13:16:08 +0000 (15:16 +0200)]
Add iov_clear()
Fill the spefified area with zeros.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Gerd Hoffmann [Tue, 12 Jul 2011 11:35:10 +0000 (13:35 +0200)]
Add iov_hexdump()
Useful for debugging purposes.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Gerd Hoffmann [Thu, 4 Aug 2011 12:54:19 +0000 (14:54 +0200)]
re-activate usb-host for bsd
A bunch of code was disabled via #if 0, for a quite long time (since
Sept 2009). Surprisingly the code builds just fine when they are
removed (tested on OpenBSD). /me wonders nevertheless whenever there
are any users of those bits when this went unnoticed for almost two
years ...
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Kevin Wolf [Fri, 15 Jul 2011 14:05:00 +0000 (16:05 +0200)]
block: Use bdrv_co_* instead of synchronous versions in coroutines
If we're already in a coroutine, there is no reason to use the synchronous
version of block layer functions when a coroutine one exists. This makes
bdrv_read/write/flush use bdrv_co_* when used inside a coroutine.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Michael Walle [Thu, 21 Jul 2011 18:52:24 +0000 (20:52 +0200)]
lm32: softusb: claim to support full speed
The QEMU keyboard and mouse reports themselves as full speed devices,
though they are actually low speed devices. Until this is fixed, claim that
we are supporting full speed devices.
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Michael Walle <michael@walle.cc>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
Michael S. Tsirkin [Wed, 3 Aug 2011 12:24:41 +0000 (15:24 +0300)]
vhost: remove an incorrect assert
The 'to' can go negative when the first region gets removed
(it gets incremented by to 0 immediately afterward), which
makes the assertion fail. Nothing breaks if
to < 0 here so just remove the assert.
Tested-by: David Ahern <daahern@cisco.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Fabien Chouteau [Mon, 1 Aug 2011 16:18:37 +0000 (18:18 +0200)]
Delayed IP packets
In the current implementation, if Slirp tries to send an IP packet to a client
with an unknown hardware address, the packet is simply dropped and an ARP
request is sent (if_encap in slirp/slirp.c).
With this patch, Slirp will send the ARP request, re-queue the packet and try
to send it later. The packet is dropped after one second if the ARP reply is
not received.
Signed-off-by: Fabien Chouteau <chouteau@adacore.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Fabien Chouteau [Wed, 3 Aug 2011 10:52:54 +0000 (12:52 +0200)]
Simple ARP table
This patch adds a simple ARP table in Slirp and also adds handling of
gratuitous ARP requests.
Signed-off-by: Fabien Chouteau <chouteau@adacore.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Alexandre Raymond [Tue, 26 Jul 2011 03:56:02 +0000 (23:56 -0400)]
Makefile: delete config.log in distclean
Distclean should remove anything created by the configure script.
Signed-off-by: Alexandre Raymond <cerbere@gmail.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Zhi Yong Wu [Wed, 27 Jul 2011 09:48:16 +0000 (17:48 +0800)]
HMP: Remove the duplicated info "info kvm" in hmp-commands.hx.
Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Brad [Wed, 27 Jul 2011 03:11:26 +0000 (23:11 -0400)]
configure: display "no" for disabled kvm/vhost-net
Fix configure display for non-Linux OS's and the KVM /
vhost-net features to show "no" output instead of nothing
at the end of the line.
Signed-off-by: Brad Smith <brad@comstyle.com>
Acked-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Gerd Hoffmann [Wed, 20 Jul 2011 09:21:00 +0000 (12:21 +0300)]
qxl: bump pci rev
Inform guest drivers about the new features I/O commands we have
now (async commands, S3 support) if building with newer spice, i.e.
if SPICE_INTERFACE_QXL_MINOR >= 1.
sneaked in some 81+ column line spliting.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Alon Levy <alevy@redhat.com>
Alon Levy [Wed, 20 Jul 2011 09:20:59 +0000 (12:20 +0300)]
qxl: add QXL_IO_FLUSH_{SURFACES,RELEASE} for guest S3&S4 support
Add two new IOs.
QXL_IO_FLUSH_SURFACES - equivalent to update area for all surfaces, used
to reduce vmexits from NumSurfaces to 1 on guest S3, S4 and resolution change (windows
driver implementation is such that this is done on each of those occasions).
QXL_IO_FLUSH_RELEASE - used to ensure anything on last_release is put on the release ring
for the client to free.
Signed-off-by: Yonit Halperin <yhalperi@redhat.com>
Signed-off-by: Alon Levy <alevy@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Alon Levy [Wed, 20 Jul 2011 09:20:58 +0000 (12:20 +0300)]
qxl: async io support using new spice api
Some of the QXL port i/o commands are waiting for the spice server to
complete certain actions. Add async versions for these commands, so we
don't block the vcpu while the spice server processses the command.
Instead the qxl device will raise an IRQ when done.
The async command processing relies on an added QXLInterface::async_complete
and added QXLWorker::*_async additions, in spice server qxl >= 3.1
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Alon Levy <alevy@redhat.com>
Jan Kiszka [Wed, 27 Jul 2011 12:21:32 +0000 (14:21 +0200)]
slirp: Take maintainer token
Anthony asked me to pick up the maintenance of this subsystem, and I
agreed.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Kevin Wolf [Mon, 25 Jul 2011 17:42:37 +0000 (19:42 +0200)]
posix-aio-compat: Allow read after EOF
In order to be able to transparently replace bdrv_read calls by bdrv_co_read,
reading beyond EOF must produce zeros instead of short reads for AIO, too.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Kevin Wolf [Wed, 13 Jul 2011 13:42:52 +0000 (15:42 +0200)]
coroutines: Use one global bottom half for CoQueue
Now that AsyncContexts don't exist any more, we can use one global bottom half
for restarting coroutines instead of allocating a new one every time (before
removing AsyncContexts, the problem with having a global BH was that it had to
belong to a single AsyncContexts and wouldn't be executed in a different one -
which leads to deadlocks)
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Kevin Wolf [Fri, 15 Jul 2011 14:36:40 +0000 (16:36 +0200)]
async: Remove AsyncContext
The purpose of AsyncContexts was to protect qcow and qcow2 against reentrancy
during an emulated bdrv_read/write (which includes a qemu_aio_wait() call and
can run AIO callbacks of different requests if it weren't for AsyncContexts).
Now both qcow and qcow2 are protected by CoMutexes and AsyncContexts can be
removed.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Kevin Wolf [Fri, 15 Jul 2011 14:27:42 +0000 (16:27 +0200)]
qcow: Use coroutines
The old qcow format is another user of the AsyncContext infrastructure.
Converting it to coroutines (and therefore CoMutexes) allows to remove
AsyncContexts.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Kevin Wolf [Thu, 30 Jun 2011 15:42:09 +0000 (17:42 +0200)]
qcow2: Use coroutines
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Kevin Wolf [Thu, 30 Jun 2011 15:56:46 +0000 (17:56 +0200)]
coroutines: Locks
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Kevin Wolf [Fri, 15 Jul 2011 11:50:26 +0000 (13:50 +0200)]
block: Add bdrv_co_readv/writev emulation
In order to be able to call bdrv_co_readv/writev for drivers that don't
implement the functions natively, add an emulation that uses the AIO functions
to implement them.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Kevin Wolf [Thu, 30 Jun 2011 08:05:46 +0000 (10:05 +0200)]
block: Emulate AIO functions with bdrv_co_readv/writev
Use the bdrv_co_readv/writev callbacks to implement bdrv_aio_readv/writev and
bdrv_read/write if a driver provides the coroutine version instead of the
synchronous or AIO version.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Kevin Wolf [Thu, 14 Jul 2011 15:27:13 +0000 (17:27 +0200)]
block: Add bdrv_co_readv/writev
Add new block driver callbacks bdrv_co_readv/writev, which work on a
QEMUIOVector like bdrv_aio_*, but don't need a callback. The function may only
be called inside a coroutine, so a block driver implementing this interface can
yield instead of blocking during I/O.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Stefan Hajnoczi [Thu, 12 May 2011 07:27:39 +0000 (08:27 +0100)]
coroutine: add test-coroutine --benchmark-lifecycle
Add a microbenchmark for coroutine create, enter, and return (aka
lifecycle). This is a useful benchmark because users are expected to
create many coroutines, one per I/O request for example, and we
therefore need to provide good performance in that scenario.
To run:
make test-coroutine
./test-coroutine --benchmark-lifecycle
20000000
This will do 20,000,000 coroutine create, enter, return iterations and
print the resulting time.
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Stefan Hajnoczi [Tue, 10 May 2011 09:21:18 +0000 (10:21 +0100)]
coroutine: add test-coroutine automated tests
To run automated tests for coroutines:
make test-coroutine
./test-coroutine
On success the program terminates with exit status 0. On failure an
error message is written to stderr and the program exits with exit
status 1.
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Alon Levy [Thu, 28 Jul 2011 09:34:13 +0000 (12:34 +0300)]
libcacard: use INSTALL_DATA for data
Signed-off-by: Alon Levy <alevy@redhat.com>
Blue Swirl [Mon, 1 Aug 2011 21:26:03 +0000 (21:26 +0000)]
Sparc: fix non-faulting unassigned memory accesses
Commit
b14ef7c9ab41ea824c3ccadb070ad95567cca84e
introduced cpu_unassigned_access() function. On Sparc,
the function does not restore AREG0 used for global CPUState
on function exit, causing bugs with non-faulting unassigned
memory accesses. Alpha, Microblaze and MIPS are not affected.
Fix by restoring AREG0 on exit. Remove excess saving by
do_unassigned_access() functions.
Also ignore unassigned accesses outside of CPU context.
Reported-by: Bob Breuer <breuerr@mc.net>
Tested-by: Bob Breuer <breuerr@mc.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>