sdk/emulator/qemu.git
14 years agotcg/arm: add rotation ops
Aurelien Jarno [Fri, 9 Apr 2010 18:52:48 +0000 (20:52 +0200)]
tcg/arm: add rotation ops

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotcg/arm: use the blx instruction when possible
Aurelien Jarno [Fri, 9 Apr 2010 18:52:48 +0000 (20:52 +0200)]
tcg/arm: use the blx instruction when possible

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotcg/arm: sxtb and sxth are available starting with ARMv6
Aurelien Jarno [Fri, 9 Apr 2010 18:52:48 +0000 (20:52 +0200)]
tcg/arm: sxtb and sxth are available starting with ARMv6

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotcg/arm: add variables to define the allowed instructions set
Aurelien Jarno [Fri, 9 Apr 2010 18:52:48 +0000 (20:52 +0200)]
tcg/arm: add variables to define the allowed instructions set

Use a set of variables to define the allowed ARM instructions, depending
on the __ARM_ARCH_*__ GCC defines.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotcg/arm: align 64-bit arguments in function calls
Aurelien Jarno [Fri, 9 Apr 2010 18:52:48 +0000 (20:52 +0200)]
tcg/arm: align 64-bit arguments in function calls

As specified by the "Procedure Call Standard for the ARM Architecture".

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotcg/arm: replace integer values by registers enum
Aurelien Jarno [Fri, 9 Apr 2010 18:52:48 +0000 (20:52 +0200)]
tcg/arm: replace integer values by registers enum

The TCG ARM backends uses integer values to refer to both immediate
values and register number. This makes the code difficult to read.

The patch below replaces all (if I haven't miss any ;-) integer values
representing register number by TCG_REG_* enum values.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotcg/arm: remove store signed functions
Aurelien Jarno [Fri, 9 Apr 2010 18:52:48 +0000 (20:52 +0200)]
tcg/arm: remove store signed functions

Store signed functions doesn't make sense, and are not used. Remove
them.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotcg/arm: explicitely list clobbered/reserved regs
Aurelien Jarno [Fri, 9 Apr 2010 18:52:48 +0000 (20:52 +0200)]
tcg/arm: explicitely list clobbered/reserved regs

Instead of writing very compact code, declare all registers that are
clobbered or reserved one by one. This makes the code easier to read.

Also declare all the 16 registers to TCG, and mark pc as reserved.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotcg/arm: remove SAVE_LR code
Aurelien Jarno [Fri, 9 Apr 2010 18:52:48 +0000 (20:52 +0200)]
tcg/arm: remove SAVE_LR code

There is no need to save the LR register (r14) before a call to a
subroutine. According to the "Procedure Call Standard for the ARM
Architecture", it is the job of the callee to save this register.
Moreover, this register is already saved in the prologue/epilogue.

This patch removes the disabled SAVE_LR code, as there is no need to
reenable later.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agoCheck for invalid initrd file
M. Mohan Kumar [Mon, 12 Apr 2010 04:31:33 +0000 (10:01 +0530)]
Check for invalid initrd file

When qemu is invoked with an invalid initrd file, it crashes. Following
patch prints a error message and exits if an invalid initrd is
specified. Includes changes suggested by JV.

Signed-off-by: M. Mohan Kumar <mohan@in.ibm.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agoMonitor: Convert do_screen_dump() to QObject
Luiz Capitulino [Wed, 31 Mar 2010 18:21:49 +0000 (15:21 -0300)]
Monitor: Convert do_screen_dump() to QObject

Trivial, as it never fails, doesn't have output nor return
any data.

Note that it's also available under QMP, as kvm-autotest
needs this.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
14 years agoQMP: Improve RTC_CHANGE event description
Luiz Capitulino [Wed, 24 Mar 2010 20:24:37 +0000 (17:24 -0300)]
QMP: Improve RTC_CHANGE event description

Some people might think that this event is emitted whenever the
time changes, be more specific.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
14 years agovirtio-blk: Fix use after free in error case
Kevin Wolf [Wed, 31 Mar 2010 15:46:59 +0000 (17:46 +0200)]
virtio-blk: Fix use after free in error case

virtio_blk_req_complete frees the request, so we can't access it any more when
calling bdrv_mon_event. Use the pointer that was copied earlier.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
14 years agomonitor: Convert do_set_link() to QObject, QError
Markus Armbruster [Fri, 26 Mar 2010 08:07:11 +0000 (09:07 +0100)]
monitor: Convert do_set_link() to QObject, QError

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
14 years agomonitor: Use argument type 'b' for set_link
Markus Armbruster [Fri, 26 Mar 2010 08:07:10 +0000 (09:07 +0100)]
monitor: Use argument type 'b' for set_link

Second argument is now "on" or "off" instead of "up" or "down".

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
14 years agomonitor: New argument type 'b'
Markus Armbruster [Fri, 26 Mar 2010 08:07:09 +0000 (09:07 +0100)]
monitor: New argument type 'b'

This is a boolean value.  Human monitor accepts "on" or "off".
Consistent with option parsing (see parse_option_bool()).

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
14 years agomonitor: Rename argument type 'b' to 'f'
Markus Armbruster [Fri, 26 Mar 2010 08:07:08 +0000 (09:07 +0100)]
monitor: Rename argument type 'b' to 'f'

To make 'b' available for boolean argument.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
14 years agomonitor: New commands netdev_add, netdev_del
Markus Armbruster [Thu, 25 Mar 2010 16:22:40 +0000 (17:22 +0100)]
monitor: New commands netdev_add, netdev_del

Monitor commands to go with -netdev.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
14 years agoerror: New QERR_DEVICE_IN_USE
Markus Armbruster [Thu, 25 Mar 2010 16:22:39 +0000 (17:22 +0100)]
error: New QERR_DEVICE_IN_USE

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
14 years agoerror: Convert net_client_init() to QError
Markus Armbruster [Thu, 25 Mar 2010 16:22:38 +0000 (17:22 +0100)]
error: Convert net_client_init() to QError

The conversion is shallow: client type init() methods aren't
converted.  Converting them is a big job for relatively little
practical benefit, so leave it for later.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
14 years agoerror: Convert qemu_opts_validate() to QError
Markus Armbruster [Thu, 25 Mar 2010 16:22:37 +0000 (17:22 +0100)]
error: Convert qemu_opts_validate() to QError

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
14 years agoerror: Use QERR_INVALID_PARAMETER_VALUE instead of QERR_INVALID_PARAMETER
Markus Armbruster [Thu, 25 Mar 2010 16:22:36 +0000 (17:22 +0100)]
error: Use QERR_INVALID_PARAMETER_VALUE instead of QERR_INVALID_PARAMETER

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
14 years agoerror: Drop extra messages after qemu_opts_set() and qemu_opts_parse()
Markus Armbruster [Thu, 25 Mar 2010 16:22:35 +0000 (17:22 +0100)]
error: Drop extra messages after qemu_opts_set() and qemu_opts_parse()

Both functions report errors nicely enough now, no need for additional
messages.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
14 years agoerror: Convert qemu_opts_set() to QError
Markus Armbruster [Thu, 25 Mar 2010 16:22:34 +0000 (17:22 +0100)]
error: Convert qemu_opts_set() to QError

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
14 years agoerror: New QERR_INVALID_PARAMETER_VALUE
Markus Armbruster [Thu, 25 Mar 2010 16:22:33 +0000 (17:22 +0100)]
error: New QERR_INVALID_PARAMETER_VALUE

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
14 years agoerror: Convert qemu_opts_create() to QError
Markus Armbruster [Thu, 25 Mar 2010 16:22:32 +0000 (17:22 +0100)]
error: Convert qemu_opts_create() to QError

Fixes device_add to report duplicate ID properly in QMP, as
DuplicateId instead of UndefinedError.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
14 years agoerror: New QERR_DUPLICATE_ID
Markus Armbruster [Thu, 25 Mar 2010 16:22:31 +0000 (17:22 +0100)]
error: New QERR_DUPLICATE_ID

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
14 years agoerror: Put error definitions back in alphabetical order
Markus Armbruster [Thu, 25 Mar 2010 16:22:30 +0000 (17:22 +0100)]
error: Put error definitions back in alphabetical order

Add suitable comments to help keerp them in order.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
14 years agomonitor: convert do_device_del() to QObject, QError
Markus Armbruster [Mon, 22 Mar 2010 10:38:14 +0000 (11:38 +0100)]
monitor: convert do_device_del() to QObject, QError

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
14 years agoqdev: Convert qdev_unplug() to QError
Markus Armbruster [Mon, 22 Mar 2010 10:38:13 +0000 (11:38 +0100)]
qdev: Convert qdev_unplug() to QError

Note: our device unplug methods don't need conversion work, because
they can't currently fail.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
14 years agoAdd qerror message if the 'change' target filename can't be opened
Ryan Harper [Thu, 25 Mar 2010 14:32:58 +0000 (09:32 -0500)]
Add qerror message if the 'change' target filename can't be opened

Currently when using the change command to switch the file in the cd drive
the command doesn't complain if the file doesn't exit or can't be opened
and the drive keeps the existing image.  This patch adds a qerror_report
call to print a message out indicating the failure.  This error message
can be used to catch failures.

Current behavior:

QEMU 0.12.50 monitor - type 'help' for more information
(qemu) info block
ide0-hd0: type=hd removable=0 file=/dev/null ro=0 drv=host_device encrypted=0
ide1-cd0: type=cdrom removable=1 locked=0 [not inserted]
floppy0: type=floppy removable=1 locked=0 [not inserted]
sd0: type=floppy removable=1 locked=0 [not inserted]
(qemu) change ide1-cd0 /home/rharper/work/isos/Fedora-9-i386-DVD.iso
(qemu) info block
ide0-hd0: type=hd removable=0 file=/dev/null ro=0 drv=host_device encrypted=0
ide1-cd0: type=cdrom removable=1 locked=0
file=/home/rharper/work/isos/Fedora-9-i386-DVD.iso ro=0 drv=raw encrypted=0
floppy0: type=floppy removable=1 locked=0 [not inserted]
sd0: type=floppy removable=1 locked=0 [not inserted]
(qemu) change ide1-cd0 /tmp/non_existent_file.iso
(qemu) info block
ide0-hd0: type=hd removable=0 file=/dev/null ro=0 drv=host_device encrypted=0
ide1-cd0: type=cdrom removable=1 locked=0 [not inserted]
floppy0: type=floppy removable=1 locked=0 [not inserted]
sd0: type=floppy removable=1 locked=0 [not inserted]
(qemu)

With patch:
QEMU 0.12.50 monitor - type 'help' for more information
(qemu) change ide1-cd0 /tmp/non_existent_file.iso
Could not open '/tmp/non_existent_file.iso'
(qemu)

Signed-off-by: Ryan Harper <ryanh@us.ibm.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agoslirp: fix unused return value, spotted by clang
Blue Swirl [Sun, 18 Apr 2010 14:27:46 +0000 (14:27 +0000)]
slirp: fix unused return value, spotted by clang

Fix clang errors like:
  CC    slirp/cksum.o
/src/qemu/slirp/cksum.c:78:3: error: expression result unused [-Wunused-value]
                REDUCE;
/src/qemu/slirp/cksum.c:45:66: note: instantiated from:

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoi386-dis: Fix unused return value, spotted by clang
Blue Swirl [Sun, 18 Apr 2010 14:27:44 +0000 (14:27 +0000)]
i386-dis: Fix unused return value, spotted by clang

Fix clang erros like:
  CC    libdis/i386-dis.o
/src/qemu/i386-dis.c:3323:7: error: expression result unused [-Wunused-value]
      FETCH_DATA (the_info, codep + 1);
/src/qemu/i386-dis.c:285:6: note: instantiated from:
   ? 1 : fetch_data ((info), (addr)))

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoPPC: avoid function pointer type mismatch, spotted by clang
Blue Swirl [Sun, 18 Apr 2010 14:26:51 +0000 (14:26 +0000)]
PPC: avoid function pointer type mismatch, spotted by clang

Fixes clang errors:
  CC    ppc-softmmu/translate.o
/src/qemu/target-ppc/translate.c:3748:13: error: comparison of distinct pointer types ('void (*)(void *, int, int)' and 'void *')
        if (likely(read_cb != SPR_NOACCESS)) {
/src/qemu/target-ppc/translate.c:3748:28: note: instantiated from:
        if (likely(read_cb != SPR_NOACCESS)) {
/src/qemu/target-ppc/translate.c:3903:13: error: comparison of distinct pointer types ('void (*)(void *, int, int)' and 'void *')
        if (likely(write_cb != SPR_NOACCESS)) {
/src/qemu/target-ppc/translate.c:3903:29: note: instantiated from:
        if (likely(write_cb != SPR_NOACCESS)) {

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agokvm: avoid collision with dprintf macro in stdio.h, spotted by clang
Blue Swirl [Sun, 18 Apr 2010 14:22:14 +0000 (14:22 +0000)]
kvm: avoid collision with dprintf macro in stdio.h, spotted by clang

Fixes clang errors:
  CC    i386-softmmu/kvm.o
/src/qemu/target-i386/kvm.c:40:9: error: 'dprintf' macro redefined
In file included from /src/qemu/target-i386/kvm.c:21:
In file included from /src/qemu/qemu-common.h:27:
In file included from /usr/include/stdio.h:910:
/usr/include/bits/stdio2.h:189:12: note: previous definition is here
  CC    i386-softmmu/kvm-all.o
/src/qemu/kvm-all.c:39:9: error: 'dprintf' macro redefined
In file included from /src/qemu/kvm-all.c:23:
In file included from /src/qemu/qemu-common.h:27:
In file included from /usr/include/stdio.h:910:
/usr/include/bits/stdio2.h:189:12: note: previous definition is here

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoFix harmless if statements with empty body, spotted by clang
Blue Swirl [Sun, 18 Apr 2010 14:22:14 +0000 (14:22 +0000)]
Fix harmless if statements with empty body, spotted by clang

These clang errors are harmless but worth fixing:
  CC    ppc-softmmu/usb-ohci.o
/src/qemu/hw/usb-ohci.c:1104:59: error: if statement has empty body [-Wempty-body]
                          ohci->ctrl_head, ohci->ctrl_cur);
/src/qemu/hw/usb-ohci.c:1371:57: error: if statement has empty body [-Wempty-body]
        DPRINTF("usb-ohci: port %d: SUSPEND\n", portnum);
  CC    sparc64-softmmu/translate.o
/src/qemu/target-sparc/translate.c:3173:37: error: if statement has empty body [-Wempty-body]
                                    ; // XXX

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agosparc32 use empty_slot for missing RAM v1
Artyom Tarasenko [Sat, 17 Apr 2010 22:34:03 +0000 (00:34 +0200)]
sparc32 use empty_slot for missing RAM v1

use empty_slot device for the RAM which is not installed

Models without ECC don't trap when missing ram is accessed.

v0->v1 compile only once and fix indentation

Signed-off-by: Artyom Tarasenko <atar4qemu@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agocreate empty_slot device
Artyom Tarasenko [Fri, 16 Apr 2010 23:10:04 +0000 (01:10 +0200)]
create empty_slot device

The empty_slot device emulates known to a bus but not connected devices.

Signed-off-by: Artyom Tarasenko <atar4qemu@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoFix harmless if statements with empty body, spotted by clang
Blue Swirl [Sun, 18 Apr 2010 08:45:03 +0000 (08:45 +0000)]
Fix harmless if statements with empty body, spotted by clang

These clang errors are harmless but worth fixing:
  CC    libhw64/fdc.o
/src/qemu/hw/fdc.c:998:74: error: if statement has empty body [-Wempty-body]
        FLOPPY_DPRINTF("Floppy digital input register: 0x%02x\n", retval);
  CC    libhw64/cuda.o
/src/qemu/hw/cuda.c:320:66: error: if statement has empty body [-Wempty-body]
        CUDA_DPRINTF("read: reg=0x%x val=%02x\n", (int)addr, val);

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agotcg/ppc: Remove redundant comparison from brcond2
malc [Sun, 18 Apr 2010 04:46:29 +0000 (08:46 +0400)]
tcg/ppc: Remove redundant comparison from brcond2

Signed-off-by: malc <av1474@comtv.ru>
14 years agoFix --enable-profiler compilation.
Richard Henderson [Sat, 17 Apr 2010 16:25:10 +0000 (16:25 +0000)]
Fix --enable-profiler compilation.

There's a header file inclusion ordering problem between cpu-all.h
and qemu-timer.h, such that cpu_get_real_ticks is not defined when
we attempt to use it in profile_getclock.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agotarget-sparc: Free instruction temporaries.
Richard Henderson [Sat, 17 Apr 2010 16:25:08 +0000 (16:25 +0000)]
target-sparc: Free instruction temporaries.

Rather than creating new temporaries for constants, use the
ones created in disas_sparc_insn.  Remember the temps created
there so that they can be freed at the end of the function.

Profile data collected by TCG while booting sparc-test kernel:

-avg temps/TB    70.61 max=421
+avg temps/TB    62.75 max=66

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agotarget-sparc: Fix TARGET_{PHYS,VIRT}_ADDR_SPACE_BITS.
Richard Henderson [Sat, 17 Apr 2010 16:25:06 +0000 (16:25 +0000)]
target-sparc: Fix TARGET_{PHYS,VIRT}_ADDR_SPACE_BITS.

The 32 and 64-bit definitions were swapped in the ifdef.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoSparc: fix PC/NPC during FPU traps
Blue Swirl [Sat, 17 Apr 2010 16:25:04 +0000 (16:25 +0000)]
Sparc: fix PC/NPC during FPU traps

All FPU instructions can trap, so save PC/NPC state before
executing them.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agotcg: Add missing static qualifier
malc [Sat, 17 Apr 2010 03:59:26 +0000 (07:59 +0400)]
tcg: Add missing static qualifier

Build breaks otherwise when USE_LIVENESS_ANALYSIS is not defined.

Signed-off-by: malc <av1474@comtv.ru>
14 years agotcg/ppc: Fix signed versions of brcond2
malc [Sat, 17 Apr 2010 03:58:08 +0000 (07:58 +0400)]
tcg/ppc: Fix signed versions of brcond2

Thanks to: Alexander Graff, Thomas Gleixner and Andreas Faerber.

Signed-off-by: malc <av1474@comtv.ru>
14 years agoFix format strings
Arnaud Lacombe [Wed, 14 Apr 2010 01:25:25 +0000 (21:25 -0400)]
Fix format strings

This fix the following build failure:

  CC    libdis-user/microblaze-dis.o
cc1: warnings being treated as errors
microblaze-dis.c: In function 'print_insn_microblaze':
microblaze-dis.c:829: warning: format '%04x' expects type 'unsigned int',
but argument 4 has type 'long unsigned int'
microblaze-dis.c:962: warning: format '%04x' expects type 'unsigned int',
but argument 4 has type 'long unsigned int'

Reported-at: http://www.monstr.eu/wiki/doku.php?id=log:2010-04-13_12_10_00

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
14 years agoMerge remote branch 'mst/for_anthony' into staging
Anthony Liguori [Wed, 14 Apr 2010 01:59:12 +0000 (20:59 -0500)]
Merge remote branch 'mst/for_anthony' into staging

14 years agosparc: Fix compiler warning (fprintf format string)
Stefan Weil [Fri, 9 Apr 2010 20:49:53 +0000 (22:49 +0200)]
sparc: Fix compiler warning (fprintf format string)

When argument checking is enabled, gcc throws this error:

error: format not a string literal and no format arguments

The patch rewrites the statement to satisfy the compiler.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agosh4: Fix compiler warning (fprintf format string)
Stefan Weil [Fri, 9 Apr 2010 20:49:52 +0000 (22:49 +0200)]
sh4: Fix compiler warning (fprintf format string)

When argument checking is enabled, gcc throws this error:

error: format not a string literal and no format arguments

The patch rewrites the statement to satisfy the compiler.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agom68k: Fix compiler warning (fprintf format string)
Stefan Weil [Fri, 9 Apr 2010 20:49:51 +0000 (22:49 +0200)]
m68k: Fix compiler warning (fprintf format string)

When argument checking is enabled, gcc throws this error:

error: format not a string literal and no format arguments

The patch rewrites the statement to satisfy the compiler.
It also removes a type cast which is not needed.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agoarm: Fix compiler warning (fprintf format string)
Stefan Weil [Fri, 9 Apr 2010 20:49:50 +0000 (22:49 +0200)]
arm: Fix compiler warning (fprintf format string)

When argument checking is enabled, gcc throws this error:

error: format not a string literal and no format arguments

The patch rewrites the statement to satisfy the compiler.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotcp/mips: Change TCG_AREG0 (fp -> s0)
Stefan Weil [Fri, 9 Apr 2010 15:28:40 +0000 (17:28 +0200)]
tcp/mips: Change TCG_AREG0 (fp -> s0)

Register fp (frame pointer) is a bad choice for compilations
without optimisation, because the compiler makes heavy use
of this register (so the resulting code crashes).

Register s0 had been used for TCG_AREG1 in earlier releases,
but was no longer used and is now free for TCG_AREG0.

The resulting code works for compilations without
optimisation (tested with qemu mips in qemu mips
on x86 host).

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agoUse correct cflags for kvm-kmod when cross compiling
Stefan Weil [Sun, 11 Apr 2010 17:01:01 +0000 (19:01 +0200)]
Use correct cflags for kvm-kmod when cross compiling

Using $pkgconfig instead of pkg-config will use
${cross_prefix}pkg-config if that is available.

This fix is needed for cross compilations without
modified PATH. Without the fix, PATH must be modified
to find the cross pkg-config before the native
pkg-config.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agolinux-user: do_shmdt(): Fix page_set_flags's 2nd arg.
takasi-y@ops.dti.ne.jp [Sat, 10 Apr 2010 17:09:57 +0000 (02:09 +0900)]
linux-user: do_shmdt(): Fix page_set_flags's 2nd arg.

2nd arg of page_set_flags() should be start+size, but size.

Signed-off-by: Takashi YOSHII <takasi-y@ops.dti.ne.jp>
Acked-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agovhost.c: include <linux/vhost.h> last
Marcelo Tosatti [Thu, 8 Apr 2010 20:49:50 +0000 (17:49 -0300)]
vhost.c: include <linux/vhost.h> last

So the userspace headers define KERNEL_STRICT_NAMES and there's no
conflict on type definition for older kernels.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agovhost-net: disable mergeable buffers
Michael S. Tsirkin [Sun, 4 Apr 2010 14:36:55 +0000 (17:36 +0300)]
vhost-net: disable mergeable buffers

vhost in current kernels doesn't support mergeable buffers.
Disable this feature if vhost is enabled, until such
support is implemented.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agovhost: fix features ack
David L Stevens [Wed, 31 Mar 2010 18:20:31 +0000 (21:20 +0300)]
vhost: fix features ack

vhost driver in qemu didn't ack features, and this happens
to work because we don't really require any features. However,
it's better not to rely on this. This patch passes features to
vhost as guest acks them.

Signed-off-by: David L Stevens <dlstevens@us.ibm.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agosh_pci: fix memory and I/O access
Aurelien Jarno [Sun, 11 Apr 2010 21:59:39 +0000 (23:59 +0200)]
sh_pci: fix memory and I/O access

Since commit 8da3ff180974732fc4272cb4433fef85c1822961 ("MMIO callback
interface changes"), the addresses passed to the I/O functions are an
offset to the start of the area. As a consequence, there is no need to
correct the address using the value of IOBR. This make possible the use
of the default MMIO functions. Moreover the addresses are now remaped
when the value if IOBR change.

The memory area corresponds to the devices behing the PCI bus, it should
not be mapped by the PCI controller. Remove the corresponding code.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agor2d: always enable IDE and flash
Aurelien Jarno [Sun, 11 Apr 2010 20:27:23 +0000 (22:27 +0200)]
r2d: always enable IDE and flash

IDE and flash are part of the R2D board, and can't be removed. Emulate
them even if there is no hard-drive plugged to the IDE or if the flash
content is empty.

14 years agoFix build when configured with --enable-io-thread
Blue Swirl [Mon, 12 Apr 2010 17:19:06 +0000 (17:19 +0000)]
Fix build when configured with --enable-io-thread

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoCleanup dead code
Jun Koi [Fri, 9 Apr 2010 10:27:13 +0000 (19:27 +0900)]
Cleanup dead code

This patch removes some dead code in exec.c

Signed-off-by: Jun Koi <junkoi2004@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoSparc: fix exceptions in delay slot
Blue Swirl [Sun, 11 Apr 2010 19:47:49 +0000 (19:47 +0000)]
Sparc: fix exceptions in delay slot

Fix a case where an exception happens with the
instruction in the delay slot.

Recovery of branch condition in the exception handling
code was not converted to TCG. Because the condition
was bogus, wrong NPC could be selected from the two
candidates.

A nice bug report with a test case can be found in:
https://bugs.launchpad.net/qemu/+bug/551814

Fix based on patch by Fabrice Bellard.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agohw/r2d: add initrd support
Aurelien Jarno [Sun, 11 Apr 2010 17:20:32 +0000 (19:20 +0200)]
hw/r2d: add initrd support

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agovhost.c: include <linux/vhost.h> last
Marcelo Tosatti [Thu, 8 Apr 2010 20:49:50 +0000 (17:49 -0300)]
vhost.c: include <linux/vhost.h> last

So the userspace headers define KERNEL_STRICT_NAMES and there's no
conflict on type definition for older kernels.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
14 years agovhost-net: disable mergeable buffers
Michael S. Tsirkin [Sun, 4 Apr 2010 14:36:55 +0000 (17:36 +0300)]
vhost-net: disable mergeable buffers

vhost in current kernels doesn't support mergeable buffers.
Disable this feature if vhost is enabled, until such
support is implemented.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
14 years agovhost: fix features ack
David L Stevens [Wed, 31 Mar 2010 18:20:31 +0000 (21:20 +0300)]
vhost: fix features ack

vhost driver in qemu didn't ack features, and this happens
to work because we don't really require any features. However,
it's better not to rely on this. This patch passes features to
vhost as guest acks them.

Signed-off-by: David L Stevens <dlstevens@us.ibm.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
14 years agoeepro100: convert to new capability API
Michael S. Tsirkin [Wed, 7 Apr 2010 07:55:47 +0000 (10:55 +0300)]
eepro100: convert to new capability API

Using new pci_add_capability_at_offset makes
eepro100 code cleaner.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Stefan Weil <weil@mail.berlios.de>
14 years agopci: add API to add capability at a known offset
Michael S. Tsirkin [Tue, 6 Apr 2010 13:05:46 +0000 (16:05 +0300)]
pci: add API to add capability at a known offset

Unlike virtio, device emulations need to add pci capabilities
at known offsets to match real hardware. Make this possible
by adding an appropriate API.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
14 years agohw/r2d: add flash memory
Aurelien Jarno [Sun, 11 Apr 2010 01:58:19 +0000 (03:58 +0200)]
hw/r2d: add flash memory

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agoRevert "Avoid page_set_flags() assert in qemu-user host page protection code"
Aurelien Jarno [Sat, 10 Apr 2010 15:20:36 +0000 (17:20 +0200)]
Revert "Avoid page_set_flags() assert in qemu-user host page protection code"

This reverts commit 01c0bef1625d8e5d6d5c6abaf413214d667615ad.

(breaks build on 32-bit hosts)

14 years agotcg/README: improve description of bswap*
Aurelien Jarno [Sat, 10 Apr 2010 01:36:21 +0000 (03:36 +0200)]
tcg/README: improve description of bswap*

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotarget-alpha: Use non-inverted arguments to gen_{f}cmov.
Richard Henderson [Tue, 16 Mar 2010 21:44:44 +0000 (14:44 -0700)]
target-alpha: Use non-inverted arguments to gen_{f}cmov.

The inverted conditions as argument to the function looks wrong
at a glance inside translate_one.  Since we have an easy function
to produce the inversion now, use it.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotarget-alpha: Use setcond for int comparisons.
Richard Henderson [Tue, 16 Mar 2010 20:04:34 +0000 (13:04 -0700)]
target-alpha: Use setcond for int comparisons.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotarget-alpha: Implement cvtql inline.
Richard Henderson [Fri, 19 Mar 2010 22:55:40 +0000 (15:55 -0700)]
target-alpha: Implement cvtql inline.

It's a simple mask and shift sequence.
Also, fix a typo in the actual masks used.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotarget-alpha: Add flags markups to helpers.h.
Richard Henderson [Fri, 12 Mar 2010 18:31:49 +0000 (10:31 -0800)]
target-alpha: Add flags markups to helpers.h.

Almost all alpha helpers are at least TCG_CALL_CONST
and a fair few are also TCG_CALL_PURE.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agoraw-posix: don't assign bs->read_only
Christoph Hellwig [Wed, 7 Apr 2010 11:58:06 +0000 (13:58 +0200)]
raw-posix: don't assign bs->read_only

bdrv_open already takes care of this for us.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Acked-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agoboot: remove unused boot_devices_bitmap variable
Eduardo Habkost [Tue, 6 Apr 2010 22:22:08 +0000 (19:22 -0300)]
boot: remove unused boot_devices_bitmap variable

In addition to removing the variable, this also renames the parse_bootdevices()
function to validate_bootdevices(), as we don't need its return value anymore.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Acked-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agonet: remove broken net_set_boot_mask() boot device validation
Eduardo Habkost [Tue, 6 Apr 2010 22:22:07 +0000 (19:22 -0300)]
net: remove broken net_set_boot_mask() boot device validation

There are many problems with net_set_boot_mask():

1) It is broken when using the device model instead of "-net nic". Example:
   $ qemu-system-x86_64 -device rtl8139,vlan=0,id=net0,mac=52:54:00:82:41:fd,bus=pci.0,addr=0x4 -net user,vlan=0,name=hostnet0 -vnc 0.0.0.0:0 -boot n
   Cannot boot from non-existent NIC
   $
2) The mask was previously used to set which boot ROMs were supposed to be
   loaded, but this was changed long time ago. Now all ROM images are loaded,
   and SeaBIOS takes care of jumping to the right boot entry point depending on
   the boot settings.
3) Interpretation and validation of the boot parameter letters is done on
   the machine type code. Examples: PC accepts only a,b,c,d,n as valid boot
   device letters. mac99 accepts only a,b,c,d,e,f.

As a side-effect of this change, qemu-kvm won't abort anymore if using "-boot n"
on a machine with no network devices. Checking if the requested boot device is
valid is now a task for the BIOS or the machine-type code.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Acked-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agonet: remove NICInfo.bootable field
Eduardo Habkost [Tue, 6 Apr 2010 22:22:06 +0000 (19:22 -0300)]
net: remove NICInfo.bootable field

It is just set by net_set_boot_mask() and never used. The logic for rom loading
changed a lot since this field was introduced. It is not needed anymore.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Acked-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agoqcow2: Remove request from in-flight list after error
Kevin Wolf [Tue, 6 Apr 2010 13:30:14 +0000 (15:30 +0200)]
qcow2: Remove request from in-flight list after error

If we complete a request with a failure we need to remove it from the list of
requests that are in flight. If we don't do it, the next time the same AIOCB is
used for a cluster allocation it will create a loop in the list and qemu will
hang in an endless loop.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agoqcow2: Don't ignore immediate read/write failures
Kevin Wolf [Tue, 6 Apr 2010 13:30:09 +0000 (15:30 +0200)]
qcow2: Don't ignore immediate read/write failures

Returning -EIO is far from optimal, but at least it's an error code.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agoblock: Fix multiwrite memory leak in error case
Kevin Wolf [Tue, 6 Apr 2010 16:24:07 +0000 (18:24 +0200)]
block: Fix multiwrite memory leak in error case

Previously multiwrite_user_cb was never called if a request in the multiwrite
batch failed right away because it did set mcb->error immediately. Make it look
more like a normal callback to fix this.

Reported-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agoblock: Fix error code in multiwrite for immediate failures
Kevin Wolf [Tue, 6 Apr 2010 16:24:06 +0000 (18:24 +0200)]
block: Fix error code in multiwrite for immediate failures

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agoblock: Fix multiwrite error handling
Kevin Wolf [Thu, 1 Apr 2010 20:48:44 +0000 (22:48 +0200)]
block: Fix multiwrite error handling

When two requests of the same multiwrite batch fail, the callback of all
requests in that batch were called twice. This could have any kind of nasty
effects, in my case it lead to use after free and eventually a segfault.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agoImplement virtio reset
Alexander Graf [Thu, 1 Apr 2010 16:42:40 +0000 (18:42 +0200)]
Implement virtio reset

The guest may issue a RESET command for virtio. So far we didn't bother
to implement it, but with my new bootloader we actually need it for Linux
to get back to a safe state.

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agoAlways notify consumers of char devices if they're open
Alexander Graf [Thu, 1 Apr 2010 16:42:39 +0000 (18:42 +0200)]
Always notify consumers of char devices if they're open

When using virtio-console on s390, the input doesn't work.

The root of the problem is rather simple. What happens is the following:

 1) create character device for stdio
 2) char device is done creating, sends OPENED event
 3) virtio-console adds handlers
 4) no event comes because the char device is open already
 5) virtio-console doesn't accept input because it didn't
    receive an OPENED event

To make that sure virtio-console gets notified that the character device
is open even when it's been open from the beginning, this patch introduces
a variable that keeps track of the opened state. If the device is open when
the event handlers get installed, we just notify the handler.

This fixes input with virtio-console on s390.

Signed-off-by: Alexander Graf <agraf@suse.de>
Acked-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agoAvoid page_set_flags() assert in qemu-user host page protection code
Juergen Lock [Wed, 31 Mar 2010 21:00:36 +0000 (23:00 +0200)]
Avoid page_set_flags() assert in qemu-user host page protection code

V2 that uses endaddr = end-of-guest-address-space if !h2g_valid(endaddr)
after I found out that indeed works; and also disables the FreeBSD 6.x
/compat/linux/proc/self/maps fallback because it can return partial lines
if (at least I think that's the reason) the mappings change between
subsequent read() calls.

Signed-off-by: Juergen Lock <nox@jelal.kn-bremen.de>
Acked-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agoRemove magic numbers for VNC message IDs from code
Daniel P. Berrange [Wed, 31 Mar 2010 17:20:43 +0000 (18:20 +0100)]
Remove magic numbers for VNC message IDs from code

The code processing incoming & sending outgoing messages from/to
clients used embedded magic numbers for all message IDs. This
made the code a little hard to follow. Add constants in the vnc.h
header file for all message IDs and use them in the code

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotarget-mips: Fix format specifiers for fpu_fprintf
Stefan Weil [Thu, 1 Apr 2010 21:05:14 +0000 (23:05 +0200)]
target-mips: Fix format specifiers for fpu_fprintf

In the previous patch which introduced fprintf_function to
allow parameter checking by gcc some compiler warnings
remained unfixed.

These warnings are fixed here.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agolsi: fix segfault in lsi_command_complete
Gerd Hoffmann [Mon, 29 Mar 2010 13:42:57 +0000 (15:42 +0200)]
lsi: fix segfault in lsi_command_complete

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agomove balloon handling to balloon.c
Paolo Bonzini [Thu, 1 Apr 2010 17:57:12 +0000 (19:57 +0200)]
move balloon handling to balloon.c

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agomove around definitions in kvm.h that do not require CPUState
Paolo Bonzini [Thu, 1 Apr 2010 17:57:11 +0000 (19:57 +0200)]
move around definitions in kvm.h that do not require CPUState

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agomove targphys.h and hw/poison.h inclusion to cpu-common.h
Paolo Bonzini [Thu, 1 Apr 2010 17:57:10 +0000 (19:57 +0200)]
move targphys.h and hw/poison.h inclusion to cpu-common.h

With more files from outside the hw/ directory being placed into
libhw, avoid the need to include hw/hw.h for the sake of targ_phys_addr_t.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agomove two variable declarations out of vl.c
Paolo Bonzini [Thu, 1 Apr 2010 17:57:09 +0000 (19:57 +0200)]
move two variable declarations out of vl.c

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agomove socket_init to qemu-sockets.c
Paolo Bonzini [Thu, 1 Apr 2010 17:57:08 +0000 (19:57 +0200)]
move socket_init to qemu-sockets.c

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agoMake virtio-pci building conditional again
Alexander Graf [Tue, 6 Apr 2010 10:11:43 +0000 (12:11 +0200)]
Make virtio-pci building conditional again

Commit b305b9d7d6990e492966ffb1fdf619482adeb7e2 made building of virtio-pci
conditional and not enabled on S390x, because it collides with the S390 bus.

Commit 087431d1d1bf4e785edfa89e8cd05fcdac558dc3 accidentially reverted that
behavior, breaking S390x again.

So here's a follow-up patch disabling building of virtio-pci on S390x again.

This unbreaks the S390x target.

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotarget-mips: Fix one more format specifier for cpu_fprintf
Stefan Weil [Fri, 2 Apr 2010 21:19:48 +0000 (23:19 +0200)]
target-mips: Fix one more format specifier for cpu_fprintf

env->bcond must be printed using TARGET_FMT_ld.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotarget-i386: Fix variable in (disabled) debugging code
Adam Lackorzynski [Thu, 1 Apr 2010 21:46:20 +0000 (23:46 +0200)]
target-i386: Fix variable in (disabled) debugging code

Signed-off-by: Adam Lackorzynski <adam@os.inf.tu-dresden.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agoDebugcon: Fix debugging printf
Adam Lackorzynski [Thu, 1 Apr 2010 21:45:25 +0000 (23:45 +0200)]
Debugcon: Fix debugging printf

Signed-off-by: Adam Lackorzynski <adam@os.inf.tu-dresden.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>