sdk/emulator/qemu.git
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 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>
14 years agotarget-i386: Fix compiler warning
Stefan Weil [Thu, 1 Apr 2010 18:03:30 +0000 (20:03 +0200)]
target-i386: Fix compiler warning

With argument checking for cpu_fprintf, gcc throws this warning:

  CC    i386-softmmu/helper.o
cc1: warnings being treated as errors
/qemu/ar7/target-i386/helper.c: In function ‘cpu_x86_dump_seg_cache’:
/qemu/ar7/target-i386/helper.c:220: error: format not a string literal and no format arguments

The code is correct, but current gcc versions don't detect this.
Therefore 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 agoremove TARGET_* defines from translate-all.c
Paolo Bonzini [Wed, 31 Mar 2010 14:54:11 +0000 (16:54 +0200)]
remove TARGET_* defines from translate-all.c

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agoe1000: fix build on Ubuntu with _FORTIFY_SOURCE
Thomas Monjalon [Wed, 31 Mar 2010 09:22:51 +0000 (11:22 +0200)]
e1000: fix build on Ubuntu with _FORTIFY_SOURCE

There was a pointer cast warning on Ubuntu since _FORTIFY_SOURCE has been reenabled.

_FORTIFY_SOURCE had been disabled by 4a24470497360d8b77568b83008d0e9d6eb0787d
and reenabled by 849583050d5f6f782718be8cb50688978973fbea.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agosmc91c111: allow access to reserved register
Lars Munch [Mon, 29 Mar 2010 13:17:18 +0000 (15:17 +0200)]
smc91c111: allow access to reserved register

Some drivers seems to access the reserved register in bank 0 so allow and
ignore these accesses.

Signed-off-by: Lars Munch <lars@segv.dk>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agosmc91c111: mask register offset
Lars Munch [Mon, 29 Mar 2010 13:16:58 +0000 (15:16 +0200)]
smc91c111: mask register offset

this fixes the smc91c111 emulation which has been broken for gumstix and
mainstone and maybe others since the "MMIO callback interface changes"
8da3ff180974732fc4272cb4433fef85c1822961 was commited.

Signed-off-by: Lars Munch <lars@segv.dk>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agobaum: add destroy hook
Samuel Thibault [Sun, 28 Mar 2010 18:39:42 +0000 (20:39 +0200)]
baum: add destroy hook

Add a destroy hook for the baum character device, to properly close the BrlAPI
connection.

Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotarget-arm: fix neon vmon/vmvn with modified immediate
Juha Riihimäki [Fri, 26 Mar 2010 16:06:55 +0000 (16:06 +0000)]
target-arm: fix neon vmon/vmvn with modified immediate

Signed-Off-By: Riku Voipio <riku.voipio@nokia.com>
Signed-off-by: Juha Riihimäki <juha.riihimaki@nokia.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agofix function signature of qemu_chr_open_pty on !linux
Riku Voipio [Fri, 26 Mar 2010 16:06:35 +0000 (16:06 +0000)]
fix function signature of qemu_chr_open_pty on !linux

Signed-off-By: Riku Voipio <riku.voipio@nokia.com>
Signed-off-By: Juha Riihimäki <juha.riihimaki@nokia.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agoShrink tb_jmp_offset to two entries, the other two are never used.
Filip Navara [Fri, 26 Mar 2010 16:06:28 +0000 (16:06 +0000)]
Shrink tb_jmp_offset to two entries, the other two are never used.

Signed-Off-By: Riku Voipio <riku.voipio@nokia.com>
Signed-off-by: Filip Navara <filip.navara@gmail.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotcg-hppa: Don't try to calls to non-constant addresses.
Richard Henderson [Wed, 7 Apr 2010 23:24:35 +0000 (01:24 +0200)]
tcg-hppa: Don't try to calls to non-constant addresses.

PA-RISC uses procedure descriptors.  We'd need to emit a call to
the millicode routine $$dyncall.  However, this situation doesn't
actually arise, since we always have the descriptor available at
TCG code generation time.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotcg-hppa: Fix in/out register overlap in add2/sub2.
Richard Henderson [Wed, 7 Apr 2010 14:46:33 +0000 (16:46 +0200)]
tcg-hppa: Fix in/out register overlap in add2/sub2.

Handle the output log part overlapping the input high parts.
Also, improve sub2 to handle some constants the second input low part.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotcg-hppa: Finish the port.
Richard Henderson [Wed, 7 Apr 2010 11:56:43 +0000 (04:56 -0700)]
tcg-hppa: Finish the port.

Delete inline functions from tcg-target.h that don't need to be there,
move the others to tcg-target.c.  Add 'Z', 'I', 'J' constraints for
0, signed 11-bit, and signed 5-bit respectively.  Add GUEST_BASE support
similar to ppc64, with the value stored in a register.  Add missing
registers to reg_alloc_order.  Add support for 12-bit branch relocations.
Add functions for synthetic operations: addi, mtctl, dep, shd, vshd, ori,
andi, shifts, rotates, multiply, branches, setcond.  Split out TLB reads
from qemu_ld and qemu_st; fix argument loading for tlb external calls.
Generate the prologue.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotcg-hppa: Compute is_write in cpu_signal_handler.
Richard Henderson [Fri, 12 Mar 2010 14:58:08 +0000 (15:58 +0100)]
tcg-hppa: Compute is_write in cpu_signal_handler.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agoupdate bochs vbe interface
Gerd Hoffmann [Thu, 25 Mar 2010 10:38:52 +0000 (11:38 +0100)]
update bochs vbe interface

The bochs vbe interface got a new register a while back, which specifies
the linear framebuffer size in 64k units.  This patch adds support for
the new register to qemu.  With this patch applied vgabios 0.6c works
with qemu.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agoread-only: allow read-only CDROM with any interface
Naphtali Sprei [Tue, 23 Mar 2010 10:17:16 +0000 (12:17 +0200)]
read-only: allow read-only CDROM with any interface

Signed-off-by: Naphtali Sprei <nsprei@redhat.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agoReplace direct phys_ram_dirty access with wrapper functions.
Yoshiaki Tamura [Tue, 23 Mar 2010 07:39:53 +0000 (16:39 +0900)]
Replace direct phys_ram_dirty access with wrapper functions.

Replaces direct phys_ram_dirty access with wrapper functions to prevent
direct access to the phys_ram_dirty bitmap.

Signed-off-by: Yoshiaki Tamura <tamura.yoshiaki@lab.ntt.co.jp>
Signed-off-by: OHMURA Kei <ohmura.kei@lab.ntt.co.jp>
Reviewed-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agoIntroduce wrapper functions to access phys_ram_dirty.
Yoshiaki Tamura [Tue, 23 Mar 2010 07:39:52 +0000 (16:39 +0900)]
Introduce wrapper functions to access phys_ram_dirty.

Adds wrapper functions to prevent direct access to the phys_ram_dirty bitmap.

Signed-off-by: Yoshiaki Tamura <tamura.yoshiaki@lab.ntt.co.jp>
Signed-off-by: OHMURA Kei <ohmura.kei@lab.ntt.co.jp>
Reviewed-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotarget-arm: resource leak fixes for iwmmxt disassemble
Lars Munch [Mon, 15 Mar 2010 17:22:04 +0000 (18:22 +0100)]
target-arm: resource leak fixes for iwmmxt disassemble

This patch fixes few resource leaks in the iwmmxt disassemble.

Signed-off-by: Lars Munch <lars@segv.dk>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agolinux-user: switch default ppc64 CPU to 970fx from 970
Aurelien Jarno [Tue, 6 Apr 2010 10:21:05 +0000 (12:21 +0200)]
linux-user: switch default ppc64 CPU to 970fx from 970

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotcg/ia64: fix tlb addend read
Aurelien Jarno [Thu, 8 Apr 2010 09:10:48 +0000 (11:10 +0200)]
tcg/ia64: fix tlb addend read

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotcg/ppc64: Fix typo
malc [Tue, 6 Apr 2010 22:26:22 +0000 (02:26 +0400)]
tcg/ppc64: Fix typo

Signed-off-by: malc <av1474@comtv.ru>
14 years agofix 100% cpu utilization when cpu is stopped
Paolo Bonzini [Tue, 6 Apr 2010 22:11:09 +0000 (00:11 +0200)]
fix 100% cpu utilization when cpu is stopped

> Hello,
>
> d6f4ade (disentangle tcg and deadline calculation, 2010-03-10)
> introduces following regression(s):
>
> 100% cpu utilization when QEMU is invoked like:
> qemu -S -s ...
>
> ditto when gdb takes control over the session via gdb-stub
> (i.e. the breakpoint is hit or C-c is pressed inside gdb to
>   interrupt the attached qemu instance)

The bug is that env->stopped is not really as comprehensive as it seems to
be (and cpu_has_work thinks); it is only valid with iothread basically,
and even then it is cleared by reset and it is not set when starting
qemu with -S.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Cc: malc <av1474@comtv.ru>
Signed-off-by: malc <av1474@comtv.ru>
14 years agotcg/ppc: Fix typo
malc [Mon, 5 Apr 2010 23:10:03 +0000 (03:10 +0400)]
tcg/ppc: Fix typo

Signed-off-by: malc <av1474@comtv.ru>
14 years agotcg/ppc: Implment bswap16/32
malc [Mon, 5 Apr 2010 22:53:11 +0000 (02:53 +0400)]
tcg/ppc: Implment bswap16/32

Signed-off-by: malc <av1474@comtv.ru>
14 years agoOHCI qdev conversion
Paul Brook [Mon, 5 Apr 2010 18:57:40 +0000 (19:57 +0100)]
OHCI qdev conversion

Convert remaining OHCI devices to QDEV interface.

Signed-off-by: Paul Brook <paul@codesourcery.com>
14 years agoFix arm-linux-user
Paul Brook [Mon, 5 Apr 2010 18:56:34 +0000 (19:56 +0100)]
Fix arm-linux-user

Only include hw/loader.h from target-arm/helper.c when building for
system emulation.

Signed-off-by: Paul Brook <paul@codesourcery.com>
14 years agoARMv7-M reset fixes
Paul Brook [Mon, 5 Apr 2010 18:34:51 +0000 (19:34 +0100)]
ARMv7-M reset fixes

Move ARMv7-M PC/SP initialization to the CPU reset routine.  Add a board
reset routine to call this.  Also load values directly from ROM as
images have not been copied yet.

Avoid clearing the NVIC pointer on cpu reset.

Signed-off-by: Paul Brook <paul@codesourcery.com>
14 years agotcg/mips: use seb/seh instructions on MIPS32R2
Aurelien Jarno [Mon, 5 Apr 2010 11:19:56 +0000 (13:19 +0200)]
tcg/mips: use seb/seh instructions on MIPS32R2

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotcg/mips: fix 64-bit linux-user on big endian MIPS
Aurelien Jarno [Mon, 5 Apr 2010 12:49:27 +0000 (14:49 +0200)]
tcg/mips: fix 64-bit linux-user on big endian MIPS

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotcg/ppc: Implement eqv, nand and nor
malc [Mon, 5 Apr 2010 12:08:47 +0000 (16:08 +0400)]
tcg/ppc: Implement eqv, nand and nor

Signed-off-by: malc <av1474@comtv.ru>
14 years agoSplit TLB addend and target_phys_addr_t
Paul Brook [Sun, 4 Apr 2010 23:28:53 +0000 (00:28 +0100)]
Split TLB addend and target_phys_addr_t

Historically the qemu tlb "addend" field was used for both RAM and IO accesses,
so needed to be able to hold both host addresses (unsigned long) and guest
physical addresses (target_phys_addr_t).  However since the introduction of
the iotlb field it has only been used for RAM accesses.

This means we can change the type of addend to unsigned long, and remove
associated hacks in the big-endian TCG backends.

We can also remove the host dependence from target_phys_addr_t.

Signed-off-by: Paul Brook <paul@codesourcery.com>
14 years agoUHCI spurious interrut fix
Paul Brook [Sun, 4 Apr 2010 20:48:31 +0000 (21:48 +0100)]
UHCI spurious interrut fix

Only raise an interrupt if the TD has actually completed.

Signed-off-by: Paul Brook <paul@codesourcery.com>
14 years agoRevert "Compile usb-ohci only once"
Paul Brook [Sun, 4 Apr 2010 20:18:26 +0000 (21:18 +0100)]
Revert "Compile usb-ohci only once"

This reverts commit f1698408f1dcb7548a21828a0b1e2b530fae3af3.

PCI is always little-endian. Having a user-visible "be" property is just
plain wrong.

14 years agotcg/ppc: Fix not_i32
malc [Sun, 4 Apr 2010 16:36:29 +0000 (20:36 +0400)]
tcg/ppc: Fix not_i32

Thanks to Alexander Graf for bug report and a good reproducible test
case.

Signed-off-by: malc <av1474@comtv.ru>
14 years agoMake cpu_get_real_ticks use mfspr
Alexander Graf [Sat, 3 Apr 2010 09:37:26 +0000 (11:37 +0200)]
Make cpu_get_real_ticks use mfspr

PowerPC CPUs have had two ways to read the time base for quite some time now.
They provide it using the mfspr instruction or - if a special bit is set in
that opcode - using mftb. For timekeeping we're currently using mftb.

While trying to get Qemu up and running on an e500v2 system, I stumbled over
the CPU not supporting mftbu. It just throws an illegal instruction trap.

So let's read the SPR values instead. All PPC CPUs should support them anyways.

I tested this patch on an e500v2 system where it makes qemu work and on my 970MP
system with 32-bit user space where everything still works with this patch
applied.

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: malc <av1474@comtv.ru>
14 years agosparc32: add IOMMU chipset doc links
Blue Swirl [Sat, 3 Apr 2010 07:40:47 +0000 (07:40 +0000)]
sparc32: add IOMMU chipset doc links

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agosparc32: rename iommu.c to sun4m_iommu.c to make room for other IOMMUs
Blue Swirl [Sat, 3 Apr 2010 07:35:50 +0000 (07:35 +0000)]
sparc32: rename iommu.c to sun4m_iommu.c to make room for other IOMMUs

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agosparc32: improve timer implementation
Blue Swirl [Sat, 3 Apr 2010 06:17:35 +0000 (06:17 +0000)]
sparc32: improve timer implementation

Timer with zero period (free-run) will never match.

Timer counting starts with tick value of 0x200, not from 0,
so the period must calculated from one tick less than the limit.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoFix build on mingw32
Anthony Liguori [Fri, 2 Apr 2010 15:26:30 +0000 (10:26 -0500)]
Fix build on mingw32

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agohw/r2d: add a USB keyboard
Aurelien Jarno [Fri, 2 Apr 2010 10:16:04 +0000 (12:16 +0200)]
hw/r2d: add a USB keyboard

The R2D board does not have a PS/2 port, and only support a keyboard on
the USB bus.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agousb-bus: fix no params
TeLeMan [Tue, 30 Mar 2010 01:33:24 +0000 (09:33 +0800)]
usb-bus: fix no params

After commit 702f3e0fb52c124c07f215426eeadb70a716643f, the params is
nerver NULL. It should check *params instead of params to determine
whether the params is empty.

Signed-off-by: TeLeMan <geleman@gmail.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agoUpdate PowerPC OpenBIOS image to r721
Aurelien Jarno [Fri, 2 Apr 2010 08:07:44 +0000 (10:07 +0200)]
Update PowerPC OpenBIOS image to r721

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agowin32: Fix compiler errors from u_int64_t
Stefan Weil [Thu, 1 Apr 2010 21:59:51 +0000 (16:59 -0500)]
win32: Fix compiler errors from u_int64_t

u_int64_t raises compiler error messages:

  CC    libhw32/virtio.o
/qemu/ar7/hw/virtio.c: In function ‘virtio_queue_get_avail_size’:
/qemu/ar7/hw/virtio.c:776: error: ‘u_int64_t’ undeclared (first use in this function)
/qemu/ar7/hw/virtio.c:776: error: (Each undeclared identifier is reported only once
/qemu/ar7/hw/virtio.c:776: error: for each function it appears in.)

Replacing u_int64_t by uint64_t helps.

Cc: Michael S. Tsirkin <mst@redhat.com>
Cc: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agotcg/TODO: remove setcond
Aurelien Jarno [Thu, 1 Apr 2010 20:00:41 +0000 (22:00 +0200)]
tcg/TODO: remove setcond

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agoFix compilation with missing inotify_init1
Stefan Weil [Sun, 28 Mar 2010 09:44:41 +0000 (11:44 +0200)]
Fix compilation with missing inotify_init1

Commit c05c7a7306a23a4b01d1606172b142c45caffc92
breaks cross compilation for mips (and other
compilations without CONFIG_INOTIFY1):

make[1]: Entering directory `/qemu/bin/mips'
  CC    i386-linux-user/syscall.o
cc1: warnings being treated as errors
/qemu/linux-user/syscall.c: In function ‘do_syscall’:
/qemu/linux-user/syscall.c:7067: error: implicit declaration of function ‘sys_inotify_init1’

Cc: Riku Voipio <riku.voipio@nokia.com>
Cc: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agoS390: Tell user why VM creation failed
Alexander Graf [Thu, 1 Apr 2010 16:42:37 +0000 (18:42 +0200)]
S390: Tell user why VM creation failed

The KVM kernel module on S390 refuses to create a VM when the switch_amode
kernel parameter is not used.

Since that is not exactly obvious, let's give the user a nice warning.

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agoS390: Add stub for cpu_get_phys_page_debug
Alexander Graf [Thu, 1 Apr 2010 16:42:36 +0000 (18:42 +0200)]
S390: Add stub for cpu_get_phys_page_debug

We don't implement any virtual memory in the S390 target so far, so let's
add a stub for this now mandatory function.

Fixes building of S390 target.

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotcg: initial ia64 support
Aurelien Jarno [Mon, 29 Mar 2010 00:12:51 +0000 (02:12 +0200)]
tcg: initial ia64 support

A few words about design choices:
* On IA64, instructions should be grouped by bundle, and dependencies
  between instructions declared. A first version of this code tried to
  schedule instructions automatically, but was very complex and too
  invasive for the current common TCG code (ops not ending at
  instruction boundaries, code retranslation breaking already generated
  code, etc.)  It was also not very efficient, as dependencies between
  TCG ops is not available.
  Instead the option taken by the current implementation does not try
  to fill the bundle by scheduling instructions, but by providing ops
  not available as an ia64 instruction, and by offering 22-bit constant
  loading for most of the instructions. With both options the bundle are
  filled at approximately the same level.

* Up to 128 registers can be affected to a function on IA64, but TCG
  limits this number to 64, which is actually more than enough. The
  register affectation is the following:
  - r0: used to map a constant argument with value 0
  - r1: global pointer
  - r2, r3: internal use
  - r4 to r6: not used to avoid saving them
  - r7: env structure
  - r8 to r11: free for TCG (call clobbered)
  - r12: stack pointer
  - r13: thread pointer
  - r14 to r31: free for TCG (call clobbered)
  - r32: reserved (return address)
  - r33: reserved (PFS)
  - r33 to r63: free for TCG

* The IA64 architecture has only 64-bit registers and no 32-bit
  instructions (the only exception being cmp4). Therefore 64-bit
  registers and instructions are used for 32-bit ops. The adopted
  strategy is the same as the ABI, that is the higher 32 bits are
  undefined. Most ops (and, or, add, shl, etc.) can directly use
  the 64-bit registers, while some others have to sign-extend (sar,
  div, etc.) or zero-extend (shr, divu, etc.) the register first.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotcg: align static_code_gen_buffer to CODE_GEN_ALIGN
Aurelien Jarno [Mon, 29 Mar 2010 00:12:51 +0000 (02:12 +0200)]
tcg: align static_code_gen_buffer to CODE_GEN_ALIGN

On ia64, the default memory alignement is not enough for a code
alignement. To fix that, force static_code_gen_buffer alignment
to CODE_GEN_ALIGN.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agoia64 disas support
Aurelien Jarno [Mon, 29 Mar 2010 00:12:51 +0000 (02:12 +0200)]
ia64 disas support

Taken from binutils SVN, using last GPLv2 version.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agolinux-user: fix page_unprotect when host page size > target page size
Aurelien Jarno [Mon, 29 Mar 2010 00:12:51 +0000 (02:12 +0200)]
linux-user: fix page_unprotect when host page size > target page size

When the host page size is bigger that the target one, unprotecting a
page should:
- mark all the target pages corresponding to the host page as writable
- invalidate all tb corresponding to the host page (and not the target
  page)

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agolinux-user/ia64: workaround ia64 strangenesses
Aurelien Jarno [Mon, 29 Mar 2010 00:12:51 +0000 (02:12 +0200)]
linux-user/ia64: workaround ia64 strangenesses

ia64 has some strangenesses that need to be workaround:
- it has a __clone2() syscall instead of the using clone() one, with
  different arguments, and which is not declared in the usual headers.
- ucontext.uc_sigmask is declared with type long int, while it is
  actually of type sigset_t.
- uc_mcontext, uc_sigmask, uc_stack, uc_link are declared using #define,
  which clashes with the target_ucontext fields. Change their names to
  tuc_*, as already done for some target architectures.

14 years agovirtio-net: vhost net support
Michael S. Tsirkin [Wed, 17 Mar 2010 11:08:42 +0000 (13:08 +0200)]
virtio-net: vhost net support

This connects virtio-net to vhost net backend.
The code is structured in a way analogous to what we have with vnet
header capability in tap.

We start/stop backend on driver start/stop as
well as on save and vm start (for migration).

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agotap: add API to retrieve vhost net header
Michael S. Tsirkin [Wed, 17 Mar 2010 11:08:38 +0000 (13:08 +0200)]
tap: add API to retrieve vhost net header

will be used by virtio-net for vhost net support

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>