sdk/emulator/qemu.git
14 years agoremove remaining occurrences AREG[1-9] and TCG_AREG[1-9]
Paolo Bonzini [Fri, 19 Mar 2010 10:31:15 +0000 (11:31 +0100)]
remove remaining occurrences AREG[1-9] and TCG_AREG[1-9]

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agolinux-user: Add the syscall id for pselect6 on ARM
Michael Casadevall [Fri, 26 Mar 2010 15:25:10 +0000 (15:25 +0000)]
linux-user: Add the syscall id for pselect6 on ARM

As this is now supported in newer linux kernels.

Signed-off-by: Michael Casadevall <mcasadevall@ubuntu.com>
Signed-off-by: Riku Voipio <riku.voipio@nokia.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agolinux-user: add inotify_init1 syscall support
Riku Voipio [Fri, 26 Mar 2010 15:25:11 +0000 (15:25 +0000)]
linux-user: add inotify_init1 syscall support

New syscall which gets actively used when you have a
fresh kernel.

Signed-off-by: Riku Voipio <riku.voipio@nokia.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotarget-arm: Fix handling of AL condition in IT instruction
Johan Bengtsson [Wed, 17 Mar 2010 12:56:07 +0000 (13:56 +0100)]
target-arm: Fix handling of AL condition in IT instruction

Do not try to insert a conditional jump over next instruction when the
condition code is AL as this will trigger an internal error.

Signed-off-by: Johan Bengtsson <teofrastius@gmail.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotcg-hppa: Fix 64-bit argument ordering
Richard Henderson [Sat, 20 Feb 2010 19:32:23 +0000 (11:32 -0800)]
tcg-hppa: Fix 64-bit argument ordering

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotcg-hppa: Fix const errors in hppa-dis.c
Richard Henderson [Sat, 20 Feb 2010 19:31:31 +0000 (11:31 -0800)]
tcg-hppa: Fix const errors in hppa-dis.c

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agoFix bsd-user broken by commit b5ec5ce0e39d6e7ea707d5604a5f6d567dfd2f48
Juergen Lock [Mon, 22 Mar 2010 18:12:43 +0000 (19:12 +0100)]
Fix bsd-user broken by commit b5ec5ce0e39d6e7ea707d5604a5f6d567dfd2f48

Signed-off-by: Juergen Lock <nox@jelal.kn-bremen.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoFix recent pxa270 serial breakage
Lars Munch [Tue, 23 Mar 2010 16:27:01 +0000 (17:27 +0100)]
Fix recent pxa270 serial breakage

This fixes a copy/paste bug introduced in commit
2d48377a8531de63ec1d0c4b9b1959dc4b78356c that pushed TARGET_WORDS_BIGENDIAN
dependency to board level.

Signed-off-by: Lars Munch <lars@segv.dk>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoqemu-error: Avoid build warning.
Edgar E. Iglesias [Tue, 23 Mar 2010 15:13:03 +0000 (16:13 +0100)]
qemu-error: Avoid build warning.

  CC    qemu-error.o
cc1: warnings being treated as errors
/home/edgar/src/c/qemu/git/qemu/qemu-error.c: In function 'error_print_loc':
/home/edgar/src/c/qemu/git/qemu/qemu-error.c:191: error: format not a string literal and no format arguments
make: *** [qemu-error.o] Error 1

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
14 years agopci_host: fix breakage
Aurelien Jarno [Tue, 23 Mar 2010 08:59:54 +0000 (09:59 +0100)]
pci_host: fix breakage

This has been broken by commit 952760bb7bce7fbfe0afcf04fee268745f297b87

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agoCompile virtio-pci only once
Blue Swirl [Mon, 22 Mar 2010 20:18:58 +0000 (20:18 +0000)]
Compile virtio-pci only once

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoCompile sound devices only once
Blue Swirl [Mon, 22 Mar 2010 20:18:40 +0000 (20:18 +0000)]
Compile sound devices only once

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoFix Sparc64 build
Blue Swirl [Sun, 21 Mar 2010 20:37:50 +0000 (20:37 +0000)]
Fix Sparc64 build

952760bb7bce7fbfe0afcf04fee268745f297b87 missed one change.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoCompile pci_host only once
Blue Swirl [Sun, 21 Mar 2010 19:47:15 +0000 (19:47 +0000)]
Compile pci_host only once

Convert pci_host_conf_register_mmio_noswap(x) to
pci_host_conf_register_mmio(x, 0).

Convert pci_host_conf_register_mmio(x) to
pci_host_conf_register_mmio(x, 1) for big endian hosts, all cases
happen to be BE.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoCompile pcie_host only once
Blue Swirl [Sun, 21 Mar 2010 19:47:14 +0000 (19:47 +0000)]
Compile pcie_host only once

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoCompile pci only once
Blue Swirl [Sun, 21 Mar 2010 19:47:13 +0000 (19:47 +0000)]
Compile pci only once

Move coalesced_mmio declarations to a more accessible location.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoCompile usb-ohci only once
Blue Swirl [Sun, 21 Mar 2010 19:47:12 +0000 (19:47 +0000)]
Compile usb-ohci only once

Push TARGET_WORDS_BIGENDIAN dependency to board level.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoCompile serial only once
Blue Swirl [Sun, 21 Mar 2010 19:47:11 +0000 (19:47 +0000)]
Compile serial only once

Push TARGET_WORDS_BIGENDIAN dependency to board level.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoCompile ne2000_isa only once
Blue Swirl [Sun, 21 Mar 2010 19:47:10 +0000 (19:47 +0000)]
Compile ne2000_isa only once

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoCompile isa_mmio only once
Blue Swirl [Sun, 21 Mar 2010 19:47:09 +0000 (19:47 +0000)]
Compile isa_mmio only once

Push TARGET_WORDS_BIGENDIAN dependency to board level.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoCompile most PCI network cards only once
Blue Swirl [Sun, 21 Mar 2010 19:47:08 +0000 (19:47 +0000)]
Compile most PCI network cards only once

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoCompile qemu-error only once
Blue Swirl [Sun, 21 Mar 2010 19:47:07 +0000 (19:47 +0000)]
Compile qemu-error only once

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoCompile async only once
Blue Swirl [Sun, 21 Mar 2010 19:47:07 +0000 (19:47 +0000)]
Compile async only once

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoCompile fdc only once
Blue Swirl [Sun, 21 Mar 2010 19:47:06 +0000 (19:47 +0000)]
Compile fdc only once

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoCompile most IDE devices only once
Blue Swirl [Sun, 21 Mar 2010 19:47:05 +0000 (19:47 +0000)]
Compile most IDE devices only once

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoCompile usb-uhci only once
Blue Swirl [Sun, 21 Mar 2010 19:47:04 +0000 (19:47 +0000)]
Compile usb-uhci only once

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoCompile vga-isa only once
Blue Swirl [Sun, 21 Mar 2010 19:47:03 +0000 (19:47 +0000)]
Compile vga-isa only once

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoCompile pcspk only once
Blue Swirl [Sun, 21 Mar 2010 19:47:02 +0000 (19:47 +0000)]
Compile pcspk only once

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoCompile i8254 only once
Blue Swirl [Sun, 21 Mar 2010 19:47:02 +0000 (19:47 +0000)]
Compile i8254 only once

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoCompile parallel only once
Blue Swirl [Sun, 21 Mar 2010 19:47:01 +0000 (19:47 +0000)]
Compile parallel only once

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoCompile vga-pci only once
Blue Swirl [Sun, 21 Mar 2010 19:47:00 +0000 (19:47 +0000)]
Compile vga-pci only once

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoMove x86 specific PC declarations to a separate file
Blue Swirl [Sun, 21 Mar 2010 19:46:26 +0000 (19:46 +0000)]
Move x86 specific PC declarations to a separate file

x86 definitions (especially CPUState uses) prevent many files from
being compiled within libhw.

Move x86 specific declarations (APIC stuff) to a separate file.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoRevert 'Fix build'
Blue Swirl [Sun, 21 Mar 2010 19:44:06 +0000 (19:44 +0000)]
Revert 'Fix build'

Partially revert 80a1ab598c6960e7a941e38c5d8638c532c585c3.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoRevert "Introduce a default qmp session"
Anthony Liguori [Sun, 21 Mar 2010 19:15:24 +0000 (14:15 -0500)]
Revert "Introduce a default qmp session"

This reverts commit 3290c4aac5b97bb1e3b2b28d94669f2c611ce84a.

Conflicts:

vl.c

14 years agoRevert "qmp: don't make -qmp disable the default monitor"
Anthony Liguori [Sun, 21 Mar 2010 19:14:38 +0000 (14:14 -0500)]
Revert "qmp: don't make -qmp disable the default monitor"

This reverts commit d49f626ed00cecc90fb1ff88da9bdf11e57094d1.

14 years agoRevert "tap: invoke downscript when we exit abnormally"
Anthony Liguori [Sun, 21 Mar 2010 19:13:34 +0000 (14:13 -0500)]
Revert "tap: invoke downscript when we exit abnormally"

This reverts commit 8af8ce4d6116e3d46ad298ca8fe50d3b515b1aac.

14 years agoRevert "Convert atexit users to exit_notifier"
Anthony Liguori [Sun, 21 Mar 2010 19:13:02 +0000 (14:13 -0500)]
Revert "Convert atexit users to exit_notifier"

This reverts commit d7234f4d7e373a708e1df9ab565a71b71b189025.

Conflicts:

hw/xen_machine_pv.c

This should have never been committed.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoRevert "Add exit notifiers"
Anthony Liguori [Sun, 21 Mar 2010 19:11:51 +0000 (14:11 -0500)]
Revert "Add exit notifiers"

This reverts commit 3b6304f706ef7eebc0b3b3f3a5093ec75448ee19.

This was mistakenly committed.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoFix a typo
Blue Swirl [Sun, 21 Mar 2010 12:30:46 +0000 (12:30 +0000)]
Fix a typo

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoCompile disassemblers only once
Blue Swirl [Sun, 21 Mar 2010 08:28:47 +0000 (08:28 +0000)]
Compile disassemblers only once

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agotcg/arm: don't save/restore r7 in prologue/epilogue
Aurelien Jarno [Sat, 20 Mar 2010 11:27:42 +0000 (12:27 +0100)]
tcg/arm: don't save/restore r7 in prologue/epilogue

There is no need to save r7, it is used to store the address
of the env structure and is not modified by GCC.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotcg/arm: fix load/store definitions for 32-bit targets
Aurelien Jarno [Sat, 20 Mar 2010 11:10:20 +0000 (12:10 +0100)]
tcg/arm: fix load/store definitions for 32-bit targets

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotcg: protect div2 in tcg/tcg-opc.h
Aurelien Jarno [Fri, 19 Mar 2010 22:15:32 +0000 (23:15 +0100)]
tcg: protect div2 in tcg/tcg-opc.h

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agoFix a typo which broke Xen build
Blue Swirl [Sat, 20 Mar 2010 08:55:06 +0000 (08:55 +0000)]
Fix a typo which broke Xen build

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoFix mingw32 build
Blue Swirl [Sat, 20 Mar 2010 08:26:27 +0000 (08:26 +0000)]
Fix mingw32 build

mkdir() only takes path argument on mingw32:

  CC    i386-softmmu/vl.o
/src/qemu/vl.c: In function 'qmp_add_default':
/src/qemu/vl.c:3763: error: too many arguments to function 'mkdir'
/src/qemu/vl.c:3769: error: too many arguments to function 'mkdir'

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoFix build
Blue Swirl [Sat, 20 Mar 2010 08:11:01 +0000 (08:11 +0000)]
Fix build

CC    curses.o
cc1: warnings being treated as errors
/src/qemu/curses.c: In function 'curses_display_init':
/src/qemu/curses.c:341: error: initialization from incompatible pointer type

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoIntroduce a default qmp session
Anthony Liguori [Wed, 17 Mar 2010 22:37:03 +0000 (17:37 -0500)]
Introduce a default qmp session

Basically, -qmp unix:%{home}/.qemu/qmp/%{uuid}.sock,server,nowait

%{uuid} will be -uuid if it's specified, otherwise, if libuuid is available,
we generate a uuid.  If it's not available, we don't create one.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoqmp: don't make -qmp disable the default monitor
Anthony Liguori [Wed, 17 Mar 2010 19:52:30 +0000 (14:52 -0500)]
qmp: don't make -qmp disable the default monitor

Instead, we introduce a default_qmp flag.  We don't use it yet, but will in the
next patch.

This has a user-visible impact as specifying just -qmp will now also show a
monitor on the 'vc'.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agotap: invoke downscript when we exit abnormally
Anthony Liguori [Wed, 17 Mar 2010 23:00:45 +0000 (18:00 -0500)]
tap: invoke downscript when we exit abnormally

Right now, downscript is not invoked reliably.  If you execute 'quit' from the
monitor, it won't be invoked.

This fixes that by converting tap to use an exit_notifier to execute the
downscript.  In this case, allowing an exit notifier to include state is
critically important for the conversion.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoConvert atexit users to exit_notifier
Anthony Liguori [Wed, 17 Mar 2010 22:59:26 +0000 (17:59 -0500)]
Convert atexit users to exit_notifier

All of these users have global state so we really don't see a benefit from
exit_notifier.  However, using exit_notifier means that there's one less
justification for having global state in the first place.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoAdd exit notifiers
Anthony Liguori [Wed, 17 Mar 2010 22:44:48 +0000 (17:44 -0500)]
Add exit notifiers

Like atexit() but with state

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agosdl: use mouse mode notifier
Anthony Liguori [Wed, 10 Mar 2010 15:42:58 +0000 (09:42 -0600)]
sdl: use mouse mode notifier

Today we poll the mouse mode whenever there is a mouse movement.  There is a
subtle usability problem with this though.

If we're in relative mode and grab is enabled, when we change to absolute mode,
we break grab.  This gives a user a seamless transition when the new pointer
is enabled.

But because we poll for mouse change, this grab break won't occur until the user
attempts to move the mouse.  By using notifiers, the grab break happens as soon
as possible.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoinput: make vnc use mouse mode notifiers
Anthony Liguori [Wed, 10 Mar 2010 15:38:29 +0000 (09:38 -0600)]
input: make vnc use mouse mode notifiers

When we switch to absolute mode, we send out a notification (if the client
supports it).  Today, we only send this notification when the client sends us
a mouse event and we're in the wrong mode.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoExpose whether a mouse is an absolute device via QMP and the human monitor.
Anthony Liguori [Wed, 10 Mar 2010 02:58:07 +0000 (20:58 -0600)]
Expose whether a mouse is an absolute device via QMP and the human monitor.

For QMP, we just add an attribute which is backwards compatible.  For the human
monitor, we add (absolute) to the end of the line.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoAdd notifier for mouse mode changes
Anthony Liguori [Tue, 9 Mar 2010 19:25:00 +0000 (13:25 -0600)]
Add notifier for mouse mode changes

Right now, DisplayState clients rely on polling the mouse mode to determine
when the device is changed to an absolute device.  Use a notification list to
add an explicit notification.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoAdd kbd_mouse_has_absolute()
Anthony Liguori [Tue, 9 Mar 2010 20:26:40 +0000 (14:26 -0600)]
Add kbd_mouse_has_absolute()

kbd_mouse_is_absolute tells us whether the current mouse handler is an absolute
device.  kbd_mouse_has_absolute tells us whether we have any device that is
capable of absolute input.

This lets us tell a user that they have configured an absolute device but that
the guest is not currently using it.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoRewrite mouse handlers to use QTAILQ and to have an activation function
Anthony Liguori [Wed, 10 Mar 2010 02:52:22 +0000 (20:52 -0600)]
Rewrite mouse handlers to use QTAILQ and to have an activation function

And convert usb-hid to use it (to avoid regression with bisection)

Right now, when we do info mice and we've added a usb tablet, we don't see it
until the guest starts using the tablet.  We implement this behavior in order
to provide a means to delay registration of a mouse handler since we treat
the last registered handler as the current handler.

This is a usability problem though as we would like to give the user feedback
that they've either 1) not added an absolute device 2) there is an absolute
device but the guest isn't using it 3) we have an absolute device and it's
active.

By using QTAILQ and having an explicit activation function that moves the
handler to the front of the queue, we can implement the same semantics as
before with respect to automatically switching to usb tablet while providing
the user with a whole lot more information.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoAdd support for generic notifier lists
Anthony Liguori [Tue, 9 Mar 2010 19:16:14 +0000 (13:16 -0600)]
Add support for generic notifier lists

Notifiers are data-less callbacks and a notifier list is a list of registered
notifiers that all are interested in a particular event.

We'll use this in a few patches to implement mouse change notification.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
---
v1 -> v2
 - Do not do memory allocations by placing list nodes in notifier

14 years agoRevert "usb-linux: remove unreachable default in switch statement"
Anthony Liguori [Wed, 17 Mar 2010 21:00:24 +0000 (16:00 -0500)]
Revert "usb-linux: remove unreachable default in switch statement"

This reverts commit 3c9c706c3b66d838942aba53c0d3fdcdf06c7423.

This breaks build (gcc 4.3.2):
    CC    usb-linux.o
 cc1: warnings being treated as errors
 /src/qemu/usb-linux.c: In function 'usb_linux_update_endp_table':
 /src/qemu/usb-linux.c:759: error: 'type' may be used uninitialized in
 this function

Reported-by: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoHandle deleted IOHandlers in a single buffer
Juan Quintela [Thu, 11 Mar 2010 16:55:41 +0000 (17:55 +0100)]
Handle deleted IOHandlers in a single buffer

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agobt: remove bt_host_read_poll()
Juan Quintela [Thu, 11 Mar 2010 16:55:40 +0000 (17:55 +0100)]
bt: remove bt_host_read_poll()

It allways returned true, that is the equivalent of not having the
callback.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agorename IOCanRWHandler to IOCanReadHandler
Juan Quintela [Thu, 11 Mar 2010 16:55:39 +0000 (17:55 +0100)]
rename IOCanRWHandler to IOCanReadHandler

It was always only used for reads

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoremove useless cast
Juan Quintela [Thu, 11 Mar 2010 16:55:38 +0000 (17:55 +0100)]
remove useless cast

values are already pointers, no need to cast them to void *

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoConvert io handlers to QLIST
Juan Quintela [Thu, 11 Mar 2010 16:55:37 +0000 (17:55 +0100)]
Convert io handlers to QLIST

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoCODING_STYLE: Reserve qemu_ prefix for library wrappers
Avi Kivity [Thu, 11 Mar 2010 14:48:43 +0000 (16:48 +0200)]
CODING_STYLE: Reserve qemu_ prefix for library wrappers

Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoFix OpenBSD linker warning
Blue Swirl [Thu, 18 Mar 2010 20:48:19 +0000 (20:48 +0000)]
Fix OpenBSD linker warning

qemu-option.o(.text+0x20f8): In function `qemu_opts_from_qdict_1':
/src/qemu/qemu-option.c:813: warning: strcpy() is almost always misused, please use strlcpy()

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoReplace assert(0) with abort() or cpu_abort()
Blue Swirl [Thu, 18 Mar 2010 18:41:57 +0000 (18:41 +0000)]
Replace assert(0) with abort() or cpu_abort()

When building with -DNDEBUG, assert(0) will not stop execution
so it must not be used for abnormal termination.

Use cpu_abort() when in CPU context, abort() otherwise.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoFix manpage errors
Blue Swirl [Thu, 18 Mar 2010 18:41:49 +0000 (18:41 +0000)]
Fix manpage errors

Split long unbreakable lines to smaller sections.

Spotted by Debian Lintian tool:
http://lintian.debian.org/full/pkg-qemu-devel@lists.alioth.debian.org.html#qemu

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agohw/usb-msd: fix some usb requests
Arnaud Patard (Rtp) [Wed, 10 Mar 2010 09:45:12 +0000 (10:45 +0100)]
hw/usb-msd: fix some usb requests

The usb-msd device emulation needs some small tweaks in the requests
emulations. For instance, the reset/maxlun requests are class/interface
specific so requests for them with the type class and recipient interface
bits sets have to be handled.

Signed-off-by: Arnaud Patard <arnaud.patard@rtp-net.org>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoscsi-disk: fix buffer overflow
Gerd Hoffmann [Wed, 10 Mar 2010 16:47:17 +0000 (17:47 +0100)]
scsi-disk: fix buffer overflow

In case s->version is shorter than 4 bytes we overflow the memcpy src
buffer.  Fix it by clearing the target buffer, then copy only the
amount of bytes we actually have.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agovnc: add no-lock-key-sync option
Gerd Hoffmann [Wed, 10 Mar 2010 16:12:02 +0000 (17:12 +0100)]
vnc: add no-lock-key-sync option

Add an option to disable the heuristics which try to keep
capslock and numlock state for guest and host in sync.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agomigration: unix migration should obey autostart are the other ones
Juan Quintela [Tue, 9 Mar 2010 23:10:36 +0000 (00:10 +0100)]
migration: unix migration should obey autostart are the other ones

This was the only incoming migration without autostart check

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agomigration: Clear fd also in error cases
Juan Quintela [Tue, 9 Mar 2010 23:10:35 +0000 (00:10 +0100)]
migration: Clear fd also in error cases

Not clearing the fd and closing the file makes qemu spin using 100%CPU
after incoming migration error.

See for instance bug:
https://bugzilla.redhat.com/show_bug.cgi?id=518032

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoread-only: Another minor cleanup
Naphtali Sprei [Thu, 11 Mar 2010 14:44:34 +0000 (16:44 +0200)]
read-only: Another minor cleanup

Don't rely on CDROM hint for read_only attribute

Signed-off-by: Naphtali Sprei <nsprei@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoread-only: minor cleanup
Naphtali Sprei [Sun, 14 Mar 2010 13:19:57 +0000 (15:19 +0200)]
read-only: minor cleanup

Really use read-only flags for opening the file when asked for read-only

Signed-off-by: Naphtali Sprei <nsprei@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agosplit out qemu-timer.c
Paolo Bonzini [Wed, 10 Mar 2010 10:38:55 +0000 (11:38 +0100)]
split out qemu-timer.c

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agodisentangle tcg and deadline calculation
Paolo Bonzini [Wed, 10 Mar 2010 10:38:54 +0000 (11:38 +0100)]
disentangle tcg and deadline calculation

Just tell main_loop_wait whether to be blocking or nonblocking, so that
there is no need to call qemu_cpus_have_work from the timer subsystem.
Instead, tcg_cpu_exec can say "we want the main loop not to block because
we have stuff to do".

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoplace together more #ifdef CONFIG_IOTHREAD blocks
Paolo Bonzini [Wed, 10 Mar 2010 10:38:53 +0000 (11:38 +0100)]
place together more #ifdef CONFIG_IOTHREAD blocks

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agomove vmstate registration of vmstate_timers earlier
Paolo Bonzini [Wed, 10 Mar 2010 10:38:52 +0000 (11:38 +0100)]
move vmstate registration of vmstate_timers earlier

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agonew function qemu_icount_delta
Paolo Bonzini [Wed, 10 Mar 2010 10:38:51 +0000 (11:38 +0100)]
new function qemu_icount_delta

Tweaking the rounding in qemu_next_deadline ensures that there's
no change whatsoever.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoadd qemu_alarm_pending
Paolo Bonzini [Wed, 10 Mar 2010 10:38:50 +0000 (11:38 +0100)]
add qemu_alarm_pending

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoadd qemu_icount_round
Paolo Bonzini [Wed, 10 Mar 2010 10:38:49 +0000 (11:38 +0100)]
add qemu_icount_round

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agocentralize handling of -icount
Paolo Bonzini [Wed, 10 Mar 2010 10:38:48 +0000 (11:38 +0100)]
centralize handling of -icount

A simple patch to place together all handling of -icount.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agointroduce and use qemu_clock_enable
Paolo Bonzini [Wed, 10 Mar 2010 10:38:47 +0000 (11:38 +0100)]
introduce and use qemu_clock_enable

By adding the possibility to turn on/off a clock, yet another
incestuous relationship between timers and CPUs can be disentangled.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agochange qemu_run_timers interface
Paolo Bonzini [Wed, 10 Mar 2010 10:38:46 +0000 (11:38 +0100)]
change qemu_run_timers interface

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoextract timer handling out of main_loop_wait
Paolo Bonzini [Wed, 10 Mar 2010 10:38:45 +0000 (11:38 +0100)]
extract timer handling out of main_loop_wait

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoremove qemu_rearm_alarm_timer from main loop
Paolo Bonzini [Wed, 10 Mar 2010 10:38:44 +0000 (11:38 +0100)]
remove qemu_rearm_alarm_timer from main loop

Make the timer subsystem register its own callback instead.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agotweak qemu_notify_event
Paolo Bonzini [Wed, 10 Mar 2010 10:38:43 +0000 (11:38 +0100)]
tweak qemu_notify_event

Instead of testing specially next_cpu in host_alarm_handler, just do
that in qemu_notify_event.  The idea is, if we are not running (or
not yet running) target CPU code, prepare things so that the execution
loop is exited asap; just make that clear.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agodo not use qemu_event_increment outside qemu_notify_event
Paolo Bonzini [Wed, 10 Mar 2010 10:38:42 +0000 (11:38 +0100)]
do not use qemu_event_increment outside qemu_notify_event

qemu_notify_event in the non-iothread case is only stopping the current
CPU.  However, if the CPU is idle and the main loop is in the select
call then a call to qemu_event_increment is needed too (as done in
host_alarm_handler).  Since in general one doesn't know whether the CPU
is executing or not, it is a safe bet to always do qemu_event_increment.

Another way to see it: after this patch qemu_event_increment is the
"common part" of qemu_notify_event for both the CONFIG_IOTHREAD and
!CONFIG_IOTHREAD cases, which makes sense.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agomore alarm timer cleanup
Paolo Bonzini [Wed, 10 Mar 2010 10:38:41 +0000 (11:38 +0100)]
more alarm timer cleanup

The timer_alarm_pending variable is related to the alarm timer but not
placed in the struct.  Also, in qemu_mod_timer the wrong flag was being
tested: the timer is rearmed in the alarm timer "bottom half", so the
right flag to test there is the "pending" flag.

Finally, I hoisted the NULL checks from alarm_has_dynticks to
host_alarm_handler.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoonly one flag is needed for alarm_timer
Paolo Bonzini [Wed, 10 Mar 2010 10:38:40 +0000 (11:38 +0100)]
only one flag is needed for alarm_timer

The ALARM_FLAG_DYNTICKS can be testing simply by checking if there is
a rearm function.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agofix error in win32_rearm_timer
Paolo Bonzini [Wed, 10 Mar 2010 10:38:39 +0000 (11:38 +0100)]
fix error in win32_rearm_timer

The TIME_ONESHOT and TIME_PERIODIC flags are mutually exclusive.
The code after the patch matches the flags used in win32_start_timer.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoavoid dubiously clever code in win32_start_timer
Paolo Bonzini [Wed, 10 Mar 2010 10:38:38 +0000 (11:38 +0100)]
avoid dubiously clever code in win32_start_timer

The code is initializing an unsigned int to UINT_MAX using "-1", so that
the following always-true comparison seems to be always-false at a
first look.  Since alarm timer initializations are never nested, it is
simpler to unconditionally store the result of timeGetDevCaps into
data->period.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoballoon: Do not save VM state wrt asynchronous virtio operations
Adam Litke [Tue, 9 Mar 2010 18:54:09 +0000 (12:54 -0600)]
balloon: Do not save VM state wrt asynchronous virtio operations

When working with the VM state (for loadvm/savevm and migration), it is not
valid to load and store pointers since the validity of those pointers cannot be
assured in the new qemu address space.  Therefore, virtio_balloon_save() and
virtio_balloon_load() must not handle the stats-related fields in struct
VirtIOBalloon.

If a memory stats request is in-flight at the time of a migration or savevm,
the request will not complete and should be resubmitted once migration or
loadvm completes.  Note that this extremely small race window can only be
triggered using QMP so it is not possible to hang the user monitor.

Signed-off-by: Adam Litke <agl@us.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoblock: add logical_block_size property
Christoph Hellwig [Thu, 4 Mar 2010 13:20:17 +0000 (14:20 +0100)]
block: add logical_block_size property

Add a logical block size attribute as various guest side tools only
increase the filesystem sector size based on it, not the advisory
physical block size.

For scsi we already have support for a different logical block size
in place for CDROMs that we can built upon.  Only my recent block
device characteristics VPD page needs some fixups.  Note that we
leave the logial block size for CDROMs hardcoded as the 2k value
is expected for it in general.

For virtio-blk we already have a feature flag claiming to support
a variable logical block size that was added for the s390 kuli
hypervisor.  Interestingly it does not actually change the units
in which the protocol works, which is still fixed at 512 bytes,
but only communicates a different minimum I/O granularity.  So
all we need to do in virtio is to add a trap for unaligned I/O
and round down the device size to the next multiple of the logical
block size.

IDE does not support any other logical block size than 512 bytes.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoAvoid crash on '-usbdevice <device>' without parameters
Jan Kiszka [Sun, 7 Mar 2010 11:17:08 +0000 (12:17 +0100)]
Avoid crash on '-usbdevice <device>' without parameters

Many usbdevice_init implementors assume params is non-NULL.

Signed-off-by: Jan Kiszka <jan.kiszka@web.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoFix SIGFPE for vnc display of width/height = 1
Chris Webb [Mon, 8 Mar 2010 14:34:49 +0000 (14:34 +0000)]
Fix SIGFPE for vnc display of width/height = 1

During boot, the screen gets resized to height 1 and a mouse click at this
point will cause a division by zero when calculating the absolute pointer
position from the pixel (x, y). Return a click in the middle of the screen
instead in this case.

Signed-off-by: Chris Webb <chris@arachsys.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agousb-linux: remove unreachable default in switch statement
Paul Bolle [Mon, 8 Mar 2010 12:58:35 +0000 (13:58 +0100)]
usb-linux: remove unreachable default in switch statement

Signed-off-by: Paul Bolle <pebolle@tiscali.nl>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agosdl: improve error message on fatal error
Bjørn Mork [Mon, 8 Mar 2010 12:07:14 +0000 (13:07 +0100)]
sdl: improve error message on fatal error

The SDL_SetVideoMode() error condition is easily triggered by a user by
simply configure a guest with a host unsupported display resolution
and attempting to enable fullscreen.  Since the error is fatal, adding
a bit of debugging help can't harm.

Sample output with this change:

 (qemu) Could not open SDL display (1280x1024x32): No video mode large enough for 1280x1024

The width x height might seem redundant as SDL also provides it in
SDL_GetError(), but I believe there are situations where it is
useful.  I.e. if there is some other SDL error.  Anyway, redundant
information in fatal error messages has never harmed a single gerbil.

Signed-off-by: Bjørn Mork <bjorn@mork.no>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoWrong error message in block_passwd command
Shahar Havivi [Fri, 5 Mar 2010 22:26:13 +0000 (00:26 +0200)]
Wrong error message in block_passwd command

Signed-off-by: Shahar Havivi <shaharh@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>