sdk/emulator/qemu.git
13 years agone2000: convert to memory API
Avi Kivity [Mon, 8 Aug 2011 13:09:18 +0000 (16:09 +0300)]
ne2000: convert to memory API

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agoppc: convert to memory API
Avi Kivity [Mon, 8 Aug 2011 13:09:17 +0000 (16:09 +0300)]
ppc: convert to memory API

Reviewed-by: Richard Henderson <rth@twiddle.net>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agolsi53c895a: convert to memory API
Avi Kivity [Mon, 8 Aug 2011 13:09:16 +0000 (16:09 +0300)]
lsi53c895a: convert to memory API

An optimization that fast-pathed DMA reads from the SCRIPTS memory
was removed int the process.  Likely it breaks with iommus anyway.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agointel-hda: convert to memory API
Avi Kivity [Mon, 8 Aug 2011 13:09:15 +0000 (16:09 +0300)]
intel-hda: convert to memory API

Reviewed-by: Richard Henderson <rth@twiddle.net>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agoahci: convert to memory API
Avi Kivity [Mon, 8 Aug 2011 13:09:14 +0000 (16:09 +0300)]
ahci: convert to memory API

Reviewed-by: Richard Henderson <rth@twiddle.net>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agovirtio-pci: convert to memory API
Avi Kivity [Mon, 8 Aug 2011 13:09:13 +0000 (16:09 +0300)]
virtio-pci: convert to memory API

except msix.

[jan: fix build]
[aliguori: fix build]

Reviewed-by: Richard Henderson <rth@twiddle.net>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agoivshmem: convert to memory API
Avi Kivity [Mon, 8 Aug 2011 13:09:12 +0000 (16:09 +0300)]
ivshmem: convert to memory API

excluding msix.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agoide: convert to memory API
Avi Kivity [Mon, 8 Aug 2011 13:09:11 +0000 (16:09 +0300)]
ide: convert to memory API

Reviewed-by: Richard Henderson <rth@twiddle.net>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agoes1370: convert to memory API
Avi Kivity [Mon, 8 Aug 2011 13:09:10 +0000 (16:09 +0300)]
es1370: convert to memory API

Reviewed-by: Richard Henderson <rth@twiddle.net>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agoeepro100: convert to memory API
Avi Kivity [Mon, 8 Aug 2011 13:09:09 +0000 (16:09 +0300)]
eepro100: convert to memory API

Note: the existing code aliases the flash BAR into the MMIO bar.  This is
probably a bug.  This patch does not correct the problem.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agoe1000: convert to memory API
Avi Kivity [Mon, 8 Aug 2011 13:09:08 +0000 (16:09 +0300)]
e1000: convert to memory API

Reviewed-by: Richard Henderson <rth@twiddle.net>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agoac97: convert to memory API
Avi Kivity [Mon, 8 Aug 2011 13:09:07 +0000 (16:09 +0300)]
ac97: convert to memory API

fixes BAR sizing as well.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agortl8139: convert to memory API
Avi Kivity [Mon, 8 Aug 2011 13:09:06 +0000 (16:09 +0300)]
rtl8139: convert to memory API

Reviewed-by: Richard Henderson <rth@twiddle.net>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agopci: allow I/O BARs to be registered with pci_register_bar_region()
Avi Kivity [Mon, 8 Aug 2011 13:09:05 +0000 (16:09 +0300)]
pci: allow I/O BARs to be registered with pci_register_bar_region()

Reviewed-by: Richard Henderson <rth@twiddle.net>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agopci: pass I/O address space to new PCI bus
Avi Kivity [Mon, 8 Aug 2011 13:09:04 +0000 (16:09 +0300)]
pci: pass I/O address space to new PCI bus

This lets us register BARs in the I/O address space.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agoIntegrate I/O memory regions into qemu
Avi Kivity [Mon, 8 Aug 2011 13:09:03 +0000 (16:09 +0300)]
Integrate I/O memory regions into qemu

get_system_io() returns the root I/O memory region.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agocirrus: simplify linear framebuffer access functions
Avi Kivity [Mon, 8 Aug 2011 13:09:02 +0000 (16:09 +0300)]
cirrus: simplify linear framebuffer access functions

Make use of the memory API's ability to satisfy multi-byte accesses via
multiple single-byte accesses.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agovga: simplify vga window mmio access functions
Avi Kivity [Mon, 8 Aug 2011 13:09:01 +0000 (16:09 +0300)]
vga: simplify vga window mmio access functions

Make use of the memory API's ability to satisfy multi-byte accesses via
multiple single-byte accesses.

We have to keep vga_mem_{read,write}b() since they're used by cirrus.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agocirrus: simplify vga window mmio access functions
Avi Kivity [Mon, 8 Aug 2011 13:09:00 +0000 (16:09 +0300)]
cirrus: simplify vga window mmio access functions

Make use of the memory API's ability to satisfy multi-byte accesses via
multiple single-byte accesses.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agocirrus: simplify bitblt BAR access functions
Avi Kivity [Mon, 8 Aug 2011 13:08:59 +0000 (16:08 +0300)]
cirrus: simplify bitblt BAR access functions

Make use of the memory API's ability to satisfy multi-byte accesses via
multiple single-byte accesses.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agocirrus: simplify mmio BAR access functions
Avi Kivity [Mon, 8 Aug 2011 13:08:58 +0000 (16:08 +0300)]
cirrus: simplify mmio BAR access functions

Make use of the memory API's ability to satisfy multi-byte accesses via
multiple single-byte accesses.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agovga: convert vga and its derivatives to the memory API
Avi Kivity [Mon, 8 Aug 2011 13:08:57 +0000 (16:08 +0300)]
vga: convert vga and its derivatives to the memory API

Convert all vga memory to the memory API.  Note we need to fall back to
get_system_memory(), since the various buses don't pass the vga window
as a memory region.

We no longer need to sync the dirty bitmap of the cirrus mapped memory
banks, since the memory API takes care of that for us.

[jan: fix vga-pci logging]

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agovmsvga: don't remember pci BAR address in callback any more
Avi Kivity [Mon, 8 Aug 2011 13:08:56 +0000 (16:08 +0300)]
vmsvga: don't remember pci BAR address in callback any more

We're going to remove the callback, so we can't use it to save the
address.  Use the pci API instead.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agopci: add API to get a BAR's mapped address
Avi Kivity [Mon, 8 Aug 2011 13:08:55 +0000 (16:08 +0300)]
pci: add API to get a BAR's mapped address

Some (hacky) devices that have a back-channel to read this
address back outside the normal configuration mechanisms, such
as VMware svga.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agomemory: rename PORTIO_END to PORTIO_END_OF_LIST
Avi Kivity [Mon, 8 Aug 2011 13:08:54 +0000 (16:08 +0300)]
memory: rename PORTIO_END to PORTIO_END_OF_LIST

For consistency with other _END_OF_LIST macros.

Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agoUnbreak the build on ppc32
malc [Mon, 8 Aug 2011 09:46:51 +0000 (13:46 +0400)]
Unbreak the build on ppc32

Signed-off-by: malc <av1474@comtv.ru>
13 years agoMerge branch 'master' of git://git.qemu.org/qemu
malc [Mon, 8 Aug 2011 09:37:44 +0000 (13:37 +0400)]
Merge branch 'master' of git://git.qemu.org/qemu

13 years agoFix forcing multicast msgs to loopback on OpenBSD.
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>
13 years agoUse mmap to allocate execute memory
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>
13 years agoFix network interface tap backend
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>
13 years agodarwin-user: Remove two unused variables
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>
13 years agoTCG: fix copy propagation
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>
13 years agoRemove unused is_softmmu parameter from cpu_handle_mmu_fault
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>
13 years agoFix handling of conditional branches in delay slot of a conditional branch
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>
13 years agoMerge remote-tracking branch 'kiszka/queues/slirp' into staging
Anthony Liguori [Fri, 5 Aug 2011 17:17:04 +0000 (12:17 -0500)]
Merge remote-tracking branch 'kiszka/queues/slirp' into staging

13 years agowhen overriding default tool names don't add cross-prefix
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>
13 years agoReorganize and fix monitor resume after migration
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>
13 years agoqdev: Eliminate duplicate reset
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>
13 years agoAvoid allocating TCG resources in non-TCG mode
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>
13 years agomemory: use signed arithmetic
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>
13 years agomemory: synchronize dirty bitmap before unmapping a range
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>
13 years agosdl: Refactor sdl_send_mouse_event
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>
13 years agosdl: Factor out event handlers from sdl_refresh
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>
13 years agosdl: Add zoom hot keys
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>
13 years agosdl: Dynamically grab input in absolute mouse mode
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>
13 years agosdl: Fix cursor handling when switching consoles in absolute mouse mode
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>
13 years agosdl: Never release input while in full screen mode
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>
13 years agosdl: Consistently avoid grabbing input for text consoles
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>
13 years agosdl: Initialize gui_fullscreen earlier during setup
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>
13 years agosdl: Drop bogus gui_fullscreen_initial_grab
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>
13 years agosdl: Restore scaling mode on return from full screen
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>
13 years agosdl: Fix full screen toggling from scaled mode
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>
13 years agosdl: Properly mark modifier+u as hotkey
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>
13 years agosdl: Avoid redundant scaling deactivation
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>
13 years agosdl: Do not make full screen mode resizable
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>
13 years agosdl: Fix termination in -no-shutdown mode
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>
13 years agoCheck fread() results to avoid gcc 4.6 warnings
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>
13 years agoMAINTAINERS: add entry for Xen
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>
13 years agoqcow2: Fix L1 table size after bdrv_snapshot_goto
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>
13 years agoslirp: Only start packet expiration for delayed ones
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>
13 years agoslirp: Read current time only once per if_start call
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>
13 years agoslirp: Fix types of IP address parameters
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>
13 years agoMerge branch 'master' of git://git.qemu.org/qemu
malc [Fri, 5 Aug 2011 06:07:10 +0000 (10:07 +0400)]
Merge branch 'master' of git://git.qemu.org/qemu

13 years agoMerge remote-tracking branch 'mst/for_anthony' into staging
Anthony Liguori [Thu, 4 Aug 2011 22:15:22 +0000 (17:15 -0500)]
Merge remote-tracking branch 'mst/for_anthony' into staging

13 years agoMerge remote-tracking branch 'alon/pull-libcacard.data' 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

13 years agoMerge remote-tracking branch 'stefanha/trivial-patches' into staging
Anthony Liguori [Thu, 4 Aug 2011 22:14:01 +0000 (17:14 -0500)]
Merge remote-tracking branch 'stefanha/trivial-patches' into staging

13 years agoMerge remote-tracking branch 'spice/spice.v40' into staging
Anthony Liguori [Thu, 4 Aug 2011 22:13:26 +0000 (17:13 -0500)]
Merge remote-tracking branch 'spice/spice.v40' into staging

13 years agoMerge remote-tracking branch 'kiszka/queues/slirp' into staging
Anthony Liguori [Thu, 4 Aug 2011 22:12:34 +0000 (17:12 -0500)]
Merge remote-tracking branch 'kiszka/queues/slirp' into staging

13 years agoMerge remote-tracking branch 'kraxel/usb.22' into staging
Anthony Liguori [Thu, 4 Aug 2011 22:10:36 +0000 (17:10 -0500)]
Merge remote-tracking branch 'kraxel/usb.22' into staging

13 years agoMerge remote-tracking branch 'kwolf/for-anthony' into staging
Anthony Liguori [Thu, 4 Aug 2011 21:45:17 +0000 (16:45 -0500)]
Merge remote-tracking branch 'kwolf/for-anthony' into staging

13 years agoguest agent: add --enable-guest-agent config option
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>
13 years agoAdd support for finding libpng via pkg-config.
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>
13 years agoalpha-softmmu: Disable for the 0.15 release branch.
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>
13 years agoconfigure: Fix bad shell expression for non-Linux hosts
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>
13 years agovirtio-balloon: Unregister savevm section on device unplug
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>
13 years agovirtio-balloon: Add exit handler, fix memleaks
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>
13 years agoballoon: Reject negative balloon values
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>
13 years agovirtio-balloon: Check if balloon registration failed
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>
13 years agoballoon: Don't allow multiple balloon handler registrations
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>
13 years agovirtio-balloon: Fix header comment; add Copyright
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>
13 years agoballoon: Fix header comment; add Copyright
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>
13 years agoballoon: Separate out stat and balloon handling
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>
13 years agovirtio-balloon: Separate status handling into separate function
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>
13 years agoballoon: Simplify code flow
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>
13 years agoballoon: Add braces around if statements
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>
13 years agoballoon: Make functions, local vars static
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>
13 years agobluetooth: kill dummy usb device, use hid code directly.
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>
13 years agohid: move idle+protocol from usb-hid to hid too.
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>
13 years agousb-hid: split hid code to hw/hid.[ch]
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>
13 years agousb-hid: add hid_has_events()
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>
13 years agousb-hid: add event callback
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>
13 years agousb-hid: create & use HIDState
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>
13 years agoehci: iovec support, remove buffer
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>
13 years agouhci: remove buffer
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>
13 years agousb-storage: iovec support
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>
13 years agousb-host: iovec support
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>
13 years agousb-serial: iovec support
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>
13 years agousb: use iovecs in USBPacket
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>
13 years agomove QEMUSGList typedef
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>
13 years agoAdd iov_clear()
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>