qemu
15 years agoAdd --kerneldir configure argument
aliguori [Wed, 5 Nov 2008 16:28:56 +0000 (16:28 +0000)]
Add --kerneldir configure argument

This allows a user to override the default search path and also makes cross
compilation work a bit nicer wrt KVM detection.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5628 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoAdd KVM support to QEMU
aliguori [Wed, 5 Nov 2008 16:04:33 +0000 (16:04 +0000)]
Add KVM support to QEMU

This patch adds very basic KVM support.  KVM is a kernel module for Linux that
allows userspace programs to make use of hardware virtualization support.  It
current supports x86 hardware virtualization using Intel VT-x or AMD-V.  It
also supports IA64 VT-i, PPC 440, and S390.

This patch only implements the bare minimum support to get a guest booting.  It
has very little impact the rest of QEMU and attempts to integrate nicely with
the rest of QEMU.

Even though this implementation is basic, it is significantly faster than TCG.
Booting and shutting down a Linux guest:

w/TCG:  1:32.36 elapsed  84% CPU

w/KVM:  0:31.14 elapsed  59% CPU

Right now, KVM is disabled by default and must be explicitly enabled with
 -enable-kvm.  We can enable it by default later when we have had better
testing.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5627 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoSplit CPUID from op_helper
aliguori [Wed, 5 Nov 2008 15:34:06 +0000 (15:34 +0000)]
Split CPUID from op_helper

KVM needs to call CPUID from outside of the TCG code.  This patch
splits out the CPUID logic into a separate helper that both the op
helper and KVM can call.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5626 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoAdd additional CPU flag definitions
aliguori [Wed, 5 Nov 2008 15:28:47 +0000 (15:28 +0000)]
Add additional CPU flag definitions

Some x86 CPU definitions that KVM needs

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5625 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoETRAX-FS: Make etraxfs_dmac_run local.
edgar_igl [Tue, 4 Nov 2008 20:29:29 +0000 (20:29 +0000)]
ETRAX-FS: Make etraxfs_dmac_run local.

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5624 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoSet default audio timer period to a sane value (otherwise qemu becomes unusable if...
malc [Tue, 4 Nov 2008 19:15:37 +0000 (19:15 +0000)]
Set default audio timer period to a sane value (otherwise qemu becomes unusable if -icount N is specified)

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5623 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agotarget-mips: use the new rotr/rotri instructions
aurel32 [Tue, 4 Nov 2008 19:13:47 +0000 (19:13 +0000)]
target-mips: use the new rotr/rotri instructions

Acked-by: Thiemo Seufer <ths@networkno.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5622 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoETRAX-FS: Fix DMA warnings.
edgar_igl [Tue, 4 Nov 2008 19:02:00 +0000 (19:02 +0000)]
ETRAX-FS: Fix DMA warnings.

Signed-off-by: Jan Kiszka <jan.kiszka@web.de>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5621 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoAdd safety net against potential infinite loop
malc [Tue, 4 Nov 2008 14:18:13 +0000 (14:18 +0000)]
Add safety net against potential infinite loop

cpu_interrupt might be called while translating the TB, but before it
is linked into a potentially infinite loop and becomes env->current_tb.

Currently this can (and does) cause huge problems only when using
dyntick clock, with other (periodic) clocks host_alarm_handler will
eventually be executed resulting in a call to cpu_interrupt which will
reset the recursion of running TB and the damage is "only" latency.

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5620 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoMention output overlaps.
pbrook [Tue, 4 Nov 2008 13:17:17 +0000 (13:17 +0000)]
Mention output overlaps.

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5619 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoFix ARM default NaN.
pbrook [Tue, 4 Nov 2008 12:33:21 +0000 (12:33 +0000)]
Fix ARM default NaN.

Signed-off-by: Paul Brook <paul@codesourcery.com>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5618 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agotc6393xb: non-accelerated FB support (Dmitry Baryshkov).
balrog [Tue, 4 Nov 2008 09:04:41 +0000 (09:04 +0000)]
tc6393xb: non-accelerated FB support (Dmitry Baryshkov).

Signed-off-by: Dmitry Baryshkov <dbaryshkov@gmail.com>
Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5617 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoTosa: dummy lcd support (Dmitry Baryshkov).
balrog [Tue, 4 Nov 2008 08:54:23 +0000 (08:54 +0000)]
Tosa: dummy lcd support (Dmitry Baryshkov).

Signed-off-by: Dmitry Baryshkov <dbaryshkov@gmail.com>
Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5616 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoscoop: GPRR reports the state of GPIO lines (Dmitry Baryshkov).
balrog [Tue, 4 Nov 2008 08:49:17 +0000 (08:49 +0000)]
scoop: GPRR reports the state of GPIO lines (Dmitry Baryshkov).

Signed-off-by: Dmitry Baryshkov <dbaryshkov@gmail.com>
Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5615 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoTosa: disable pxafb as it's not used on tosa (Dmitry Baryshkov).
balrog [Tue, 4 Nov 2008 08:47:06 +0000 (08:47 +0000)]
Tosa: disable pxafb as it's not used on tosa (Dmitry Baryshkov).

Signed-off-by: Dmitry Baryshkov <dbaryshkov@gmail.com>
Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5614 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoTosa: provide correct IRQ to tc6393xb init (Dmitry Baryshkov).
balrog [Tue, 4 Nov 2008 08:45:49 +0000 (08:45 +0000)]
Tosa: provide correct IRQ to tc6393xb init (Dmitry Baryshkov).

Signed-off-by: Dmitry Baryshkov <dbaryshkov@gmail.com>
Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5613 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoTosa: emulate LEDs (Dmitry Baryshkov).
balrog [Tue, 4 Nov 2008 08:43:54 +0000 (08:43 +0000)]
Tosa: emulate LEDs (Dmitry Baryshkov).

Signed-off-by: Dmitry Baryshkov <dbaryshkov@gmail.com>
Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5612 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agotc6393xb: initial support for nand control (Dmitry Baryshkov).
balrog [Tue, 4 Nov 2008 08:42:00 +0000 (08:42 +0000)]
tc6393xb: initial support for nand control (Dmitry Baryshkov).

Signed-off-by: Dmitry Baryshkov <dbaryshkov@gmail.com>
Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5611 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoVFP fnmsc negative zero fix.
pbrook [Mon, 3 Nov 2008 19:09:29 +0000 (19:09 +0000)]
VFP fnmsc negative zero fix.

Signed-off-by: Paul Brook <paul@codesourcery.com>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5610 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoFix rotri_i64 typo.
pbrook [Mon, 3 Nov 2008 13:30:50 +0000 (13:30 +0000)]
Fix rotri_i64 typo.

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5609 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agotarget-ppc: use the new rotr/rotri instructions
aurel32 [Mon, 3 Nov 2008 07:08:44 +0000 (07:08 +0000)]
target-ppc: use the new rotr/rotri instructions

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5608 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agotcg-ops.h: add rotl/rotli and rotr/rotri TCG instructions
aurel32 [Mon, 3 Nov 2008 07:08:36 +0000 (07:08 +0000)]
tcg-ops.h: add rotl/rotli and rotr/rotri TCG instructions

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5607 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agotcg-op.h: reorder _i64 instructions common to 32- and 64-bit targets
aurel32 [Mon, 3 Nov 2008 07:08:26 +0000 (07:08 +0000)]
tcg-op.h: reorder _i64 instructions common to 32- and 64-bit targets

Use the same order as the _i32 version (pure code move). Suggested by
Laurent Laurent Desnogues.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5606 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoFix RGBT 5:5:5 drawing on pxa2xx lcd (Lars Munch)
balrog [Mon, 3 Nov 2008 01:08:14 +0000 (01:08 +0000)]
Fix RGBT 5:5:5 drawing on pxa2xx lcd (Lars Munch)

This patch fixes the misinterpretaion of the transparency bit for
RGBT 5:5:5 mode on pxa2xx LCDC.

Signed-off-by: Lars Munch <lars@segv.dk>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5605 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoMore realistic max_cpus
blueswir1 [Sun, 2 Nov 2008 16:51:02 +0000 (16:51 +0000)]
More realistic max_cpus

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5604 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoFix loading of unstripped ELF PROM image
blueswir1 [Sun, 2 Nov 2008 14:44:35 +0000 (14:44 +0000)]
Fix loading of unstripped ELF PROM image

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5603 c046a42c-6fe2-441c-8c8c-71466251a162

15 years ago64-bit target subfi fix.
pbrook [Sun, 2 Nov 2008 13:26:16 +0000 (13:26 +0000)]
64-bit target subfi fix.

Signed-off-by: Paul Brook <paul@codesourcery.com>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5602 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoHalt the CPU using a qemu_irq
blueswir1 [Sun, 2 Nov 2008 10:51:05 +0000 (10:51 +0000)]
Halt the CPU using a qemu_irq

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5601 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agotarget-ppc: use the new subfi wrapper
aurel32 [Sun, 2 Nov 2008 08:23:14 +0000 (08:23 +0000)]
target-ppc: use the new subfi wrapper

(...and fix rldnm)

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5600 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agotcg-ops.h: add a subfi wrapper
aurel32 [Sun, 2 Nov 2008 08:23:04 +0000 (08:23 +0000)]
tcg-ops.h: add a subfi wrapper

Add a subfi (subtract from immediate) wrapper, useful for the PPC target.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5599 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agotcg-ops.h: _i64 TCG immediate instructions cleanup
aurel32 [Sun, 2 Nov 2008 08:22:54 +0000 (08:22 +0000)]
tcg-ops.h: _i64 TCG immediate instructions cleanup

Move addi_i64, muli_i64 and subi_i64 out of #if TCG_TARGET_REG_BITS
as both implementations are strictly identical. Use the same
optimisation (ie when imm == 0) for addi_i64 and subi_64 than the
32-bit version.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5598 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agotarget-ppc: simplify slw, srw, sld, srd
aurel32 [Sun, 2 Nov 2008 08:22:45 +0000 (08:22 +0000)]
target-ppc: simplify slw, srw, sld, srd

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5597 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agotarget-ppc: be more consistent with temp variables naming
aurel32 [Sun, 2 Nov 2008 08:22:34 +0000 (08:22 +0000)]
target-ppc: be more consistent with temp variables naming

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5596 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agotarget-ppc: fix srw on 64-bit targets
aurel32 [Sun, 2 Nov 2008 08:22:16 +0000 (08:22 +0000)]
target-ppc: fix srw on 64-bit targets

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5595 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoAvoid ld flag --warn-common on Solaris
blueswir1 [Sat, 1 Nov 2008 14:50:20 +0000 (14:50 +0000)]
Avoid ld flag --warn-common on Solaris

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5594 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoFix TCGv size mismatches
blueswir1 [Sat, 1 Nov 2008 13:44:52 +0000 (13:44 +0000)]
Fix TCGv size mismatches

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5593 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agotarget-ppc: optimize popcntb
aurel32 [Sat, 1 Nov 2008 00:54:33 +0000 (00:54 +0000)]
target-ppc: optimize popcntb

Suggested by Andrzej Zaborowski.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5592 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agotarget-ppc: convert 405 MAC instructions to TCG
aurel32 [Sat, 1 Nov 2008 00:54:23 +0000 (00:54 +0000)]
target-ppc: convert 405 MAC instructions to TCG

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5591 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agotarget-ppc: convert arithmetic functions to TCG
aurel32 [Sat, 1 Nov 2008 00:54:12 +0000 (00:54 +0000)]
target-ppc: convert arithmetic functions to TCG

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5590 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agotarget-ppc: xer access prototypes no more used & implemented
aurel32 [Sat, 1 Nov 2008 00:53:59 +0000 (00:53 +0000)]
target-ppc: xer access prototypes no more used & implemented

Revision 5500 of the qemu repository removed all code using
ppc_load_xer & ppc_store_xer as well as their implementation.

Another patch fixes it's usage in kvm-userspace for powerpc, but I think
that header can now be cleaned up, therefore this patch to qemu-devel.

Signed-off-by: Christian Ehrhardt <ehrhardt@linux.vnet.ibm.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5589 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agotarget-ppc: fix XER accesses on 64-bit targets
aurel32 [Sat, 1 Nov 2008 00:53:48 +0000 (00:53 +0000)]
target-ppc: fix XER accesses on 64-bit targets

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5588 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoCVE-2008-4539: fix a heap overflow in Cirrus emulation
aurel32 [Sat, 1 Nov 2008 00:53:39 +0000 (00:53 +0000)]
CVE-2008-4539: fix a heap overflow in Cirrus emulation

The code in hw/cirrus_vga.c has changed a lot between CVE-2007-1320 has
been announced and the patch has been applied. As a consequence it has
wrongly applied and QEMU is still vulnerable to this bug if using VNC.

(noticed by Jan Niehusmann)

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5587 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agotarget-cris: access to TCG variables through GET_TCGV()
aurel32 [Sat, 1 Nov 2008 00:53:30 +0000 (00:53 +0000)]
target-cris: access to TCG variables through GET_TCGV()

Fix build with DEBUG_TCGV enabled.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5586 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoMalta & OMAP: add a name to char devices
aurel32 [Sat, 1 Nov 2008 00:53:19 +0000 (00:53 +0000)]
Malta & OMAP: add a name to char devices

(fixes regression introduced by r5575)

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5585 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoqemu-char: include hw/baum.h
aurel32 [Sat, 1 Nov 2008 00:53:09 +0000 (00:53 +0000)]
qemu-char: include hw/baum.h

Fix a warning introduced in r5580 when brlapi is enabled.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5584 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoRemove dumb_refresh
aliguori [Fri, 31 Oct 2008 20:34:40 +0000 (20:34 +0000)]
Remove dumb_refresh

It is safe not to set dpy_refresh and that's used to indicate that the display
doesn't need updates.  This saves us two wakeups per second.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5583 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoRemove extraneous inline keyword.
aliguori [Fri, 31 Oct 2008 20:00:18 +0000 (20:00 +0000)]
Remove extraneous inline keyword.

Spotted by Blue Swirl.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5582 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoMove network redirection code out of vl.c and into net.c
aliguori [Fri, 31 Oct 2008 19:10:00 +0000 (19:10 +0000)]
Move network redirection code out of vl.c and into net.c

Mostly code motion.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5581 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoMove CharDriverState code out of vl.c
aliguori [Fri, 31 Oct 2008 18:49:55 +0000 (18:49 +0000)]
Move CharDriverState code out of vl.c

The motivating goal behind this is to allow other tools to use the CharDriver
code.  This patch is pure code motion except for the Makefile changes and the
copyright/header in qemu-char.c.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5580 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoMove some declarations around in the QEMU CharDriver code
aliguori [Fri, 31 Oct 2008 18:44:40 +0000 (18:44 +0000)]
Move some declarations around in the QEMU CharDriver code

The goal of this series is to move the CharDriverState code out of vl.c and
into its own file, qemu-char.c.  This patch moves around some declarations so
the next patch can be pure code motion.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5579 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoIncrease default IO timeout from 10ms to 5s
aliguori [Fri, 31 Oct 2008 18:40:25 +0000 (18:40 +0000)]
Increase default IO timeout from 10ms to 5s

With the recent changes to the main loop, we no longer have unconditional
polling.  This means we can now sleep in select() for much longer than we
previously did.  This patch increases our select() sleep time from 10ms to 5s
which is effectively unlimited since we're going to wake up sooner than that
in almost all circumstances.

With this patch, I see the number of wake-ups with an idle dynamic ticks guest
drop from 80 per second to about 15 times per second.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5578 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoMain loop fixes/cleanup
aliguori [Fri, 31 Oct 2008 18:07:17 +0000 (18:07 +0000)]
Main loop fixes/cleanup

Tidy up win32 main loop bits, allow timeout >= 1s, and force timeout to 0 if
there is a pending bottom half.

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5577 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoClarify qemu_bh_schedule_idle() usage
aliguori [Fri, 31 Oct 2008 17:42:00 +0000 (17:42 +0000)]
Clarify qemu_bh_schedule_idle() usage

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5576 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoImplement "info chardev" command. (Gerd Hoffmann)
aliguori [Fri, 31 Oct 2008 17:31:29 +0000 (17:31 +0000)]
Implement "info chardev" command. (Gerd Hoffmann)

This patch makes qemu keep track of the character devices in use and
implements a "info chardev" monitor command to print a list.

qemu_chr_open() sticks the devices into a linked list now.  It got a new
argument (label), so there is a name for each device.  It also assigns a
filename to each character device.  By default it just copyes the
filename passed in.  Individual drivers can fill in something else
though.  qemu_chr_open_pty() sets the filename to name of the pseudo tty
allocated.

Output looks like this:

  (qemu) info chardev
  monitor: filename=unix:/tmp/run.sh-26827/monitor,server,nowait
  serial0: filename=unix:/tmp/run.sh-26827/console,server
  serial1: filename=pty:/dev/pts/5
  parallel0: filename=vc:640x480

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5575 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agofix bdrv_aio_read API breakage in qcow2 (Andrea Arcangeli)
aliguori [Fri, 31 Oct 2008 17:28:00 +0000 (17:28 +0000)]
fix bdrv_aio_read API breakage in qcow2 (Andrea Arcangeli)

I noticed the qemu_aio_flush was doing nothing at all. And a flood of
cmd_writeb commands leading to a noop-invocation of qemu_aio_flush
were executed.

In short all 'memset;goto redo' places must be fixed to use the bh and
not to call the callback in the context of bdrv_aio_read or the
bdrv_aio_read model falls apart. Reading from qcow2 holes is possible
with phyisical readahead (kind of breada in linux buffer cache).

This is needed at least for scsi, ide is lucky (or it has been
band-aided against this API breakage by fixing the symptom and not the
real bug).

Same bug exists in qcow of course, can be fixed later as it's less
urgent.

Signed-off-by: Andrea Arcangeli <aarcange@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5574 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoMake DMA bottom-half driven (v2)
aliguori [Fri, 31 Oct 2008 17:25:56 +0000 (17:25 +0000)]
Make DMA bottom-half driven (v2)

The current DMA routines are driven by a call in main_loop_wait() after every
select.

This patch converts the DMA code to be driven by a constantly rescheduled
bottom half.  The advantage of using a scheduled bottom half is that we can
stop scheduling the bottom half when there no DMA channels are runnable.  This
means we can potentially detect this case and sleep longer in the main loop.

The only two architectures implementing DMA_run() are cris and i386.  For cris,
I converted it to a simple repeating bottom half.  I've only compile tested
this as cris does not seem to work on a 64-bit host.  It should be functionally
identical to the previous implementation so I expect it to work.

For x86, I've made sure to only fire the DMA bottom half if there is a DMA
channel that is runnable.  The effect of this is that unless you're using sb16
or a floppy disk, the DMA bottom half never fires.

You probably should test this malc.  My own benchmarks actually show slight
improvement by it's possible the change in timing could affect your demos.

Since v1, I've changed the code to use a BH instead of a timer.  cris at least
seems to depend on faster than 10ms polling.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5573 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoMake bottom halves more robust
aliguori [Fri, 31 Oct 2008 17:24:21 +0000 (17:24 +0000)]
Make bottom halves more robust

Bottom halves are supposed to not complete until the next iteration of the main
loop.  This is very important to ensure that guests can not cause stack
overflows in the block driver code.  Right now, if you attempt to schedule a
bottom half within a bottom half callback, you will enter an infinite loop.

This patch uses the same logic that we use for the IOHandler loop to make the
bottom half processing robust in list manipulation while in a callback.

This patch also introduces idle scheduling for bottom halves.  qemu_bh_poll()
returns an indication of whether any bottom halves were successfully executed.
qemu_aio_wait() uses this to immediately return if a bottom half was executed
instead of waiting for a completion notification.

qemu_bh_schedule_idle() works around this by not reporting the callback has
run in the qemu_bh_poll loop.  qemu_aio_wait() probably needs some refactoring
but that would require a larger code audit.  idle scheduling seems like a good
compromise.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5572 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoUse qemu_gettimeofday.
pbrook [Wed, 29 Oct 2008 14:37:18 +0000 (14:37 +0000)]
Use qemu_gettimeofday.

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5571 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoFix restore of older snapshots for target-i386 on big endian hosts
aliguori [Wed, 29 Oct 2008 14:16:31 +0000 (14:16 +0000)]
Fix restore of older snapshots for target-i386 on big endian hosts

A target_ulong may be 64-bit.  Passing it to a function expecting a 32-bit
pointer is wrong and unfortunately happens to work for x86.  It won't work on
big endian hosts though.  Change the code to work properly on all hosts.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5570 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoUse locally defined structure.
pbrook [Tue, 28 Oct 2008 18:22:59 +0000 (18:22 +0000)]
Use locally defined structure.

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5569 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoSun4c cleanups (Robert Reif)
blueswir1 [Tue, 28 Oct 2008 17:55:32 +0000 (17:55 +0000)]
Sun4c cleanups (Robert Reif)

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5568 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agofix off-by-one generating vmdk backing files (Avi Kivity)
aliguori [Tue, 28 Oct 2008 14:08:49 +0000 (14:08 +0000)]
fix off-by-one generating vmdk backing files (Avi Kivity)

Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5567 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoSet default max_cpus to one.
balrog [Tue, 28 Oct 2008 10:59:59 +0000 (10:59 +0000)]
Set default max_cpus to one.

Clean-up machine definitions.

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5566 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoFix return value printing for shmat (Lauro Ramos Venancio).
balrog [Tue, 28 Oct 2008 10:39:39 +0000 (10:39 +0000)]
Fix return value printing for shmat (Lauro Ramos Venancio).

The shmat syscall returns an address, so we must use the
print_syscall_ret_addr function.

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5565 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoRecvmsg must return the number of bytes received (Lauro Ramos Venancio).
balrog [Tue, 28 Oct 2008 10:26:29 +0000 (10:26 +0000)]
Recvmsg must return the number of bytes received (Lauro Ramos Venancio).

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5564 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agopage_check_range: fix wrap around test (Lauro Ramos Venancio).
balrog [Tue, 28 Oct 2008 10:24:11 +0000 (10:24 +0000)]
page_check_range: fix wrap around test (Lauro Ramos Venancio).

Move up the warp around test because line
'end = TARGET_PAGE_ALIGN(start+len);'
can interfere with it.

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5563 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoFix iovec for the case with invalid elements (Lauro Ramos Venancio).
balrog [Tue, 28 Oct 2008 10:21:03 +0000 (10:21 +0000)]
Fix iovec for the case with invalid elements (Lauro Ramos Venancio).

We must call the writev even if an iovec element is invalid. For
example, if the second element is invalid, the linux process the first
one.

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5562 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoUse the host exit syscall for exiting (Lauro Ramos Venancio).
balrog [Tue, 28 Oct 2008 10:18:28 +0000 (10:18 +0000)]
Use the host exit syscall for exiting (Lauro Ramos Venancio).

We can't call the libc _exit function because it calls the exit_group
host syscall. We must call directly the exit host syscall.

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5561 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoCRIS: Plug more temp leaks.
edgar_igl [Tue, 28 Oct 2008 00:13:15 +0000 (00:13 +0000)]
CRIS: Plug more temp leaks.

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5560 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoControl + i and [tab] share keycode in curses, simulate [tab].
balrog [Tue, 28 Oct 2008 00:11:06 +0000 (00:11 +0000)]
Control + i and [tab] share keycode in curses, simulate [tab].

Spotted by Blue Swirl.

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5559 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoFix cpuid ext_features value for Atom N270 (Blue Swirl).
balrog [Tue, 28 Oct 2008 00:03:28 +0000 (00:03 +0000)]
Fix cpuid ext_features value for Atom N270 (Blue Swirl).

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5558 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agotarget-ppc: use consistent names for variables
aurel32 [Mon, 27 Oct 2008 22:50:39 +0000 (22:50 +0000)]
target-ppc: use consistent names for variables

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5557 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agotarget-ppc: indentation fixes
aurel32 [Mon, 27 Oct 2008 22:50:31 +0000 (22:50 +0000)]
target-ppc: indentation fixes

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5556 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agotarget-ppc: convert rotation instructions to TCG
aurel32 [Mon, 27 Oct 2008 22:50:22 +0000 (22:50 +0000)]
target-ppc: convert rotation instructions to TCG

Also fix rlwimi and rldimi for corner cases.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5555 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoCRIS: Plug a few temp leaks.
edgar_igl [Mon, 27 Oct 2008 21:10:26 +0000 (21:10 +0000)]
CRIS: Plug a few temp leaks.

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5554 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoETRAX-FS: Process outgoing DMA channels until EOL.
edgar_igl [Mon, 27 Oct 2008 20:44:27 +0000 (20:44 +0000)]
ETRAX-FS: Process outgoing DMA channels until EOL.

For outgoing DMA channels, keep processing descriptors until hitting end
of list.

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5553 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoCRIS: Remove cpu_T.
edgar_igl [Mon, 27 Oct 2008 20:24:59 +0000 (20:24 +0000)]
CRIS: Remove cpu_T.

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5552 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoAnsify to please sparse
blueswir1 [Mon, 27 Oct 2008 19:49:12 +0000 (19:49 +0000)]
Ansify to please sparse

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5551 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoCRIS: Avoid more cpu_T usage.
edgar_igl [Mon, 27 Oct 2008 16:46:29 +0000 (16:46 +0000)]
CRIS: Avoid more cpu_T usage.

* Explicit operand passing to prep_alu_r.
* Avoid some more cpu_T[] usage.

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5550 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoMove sun4c to its own hwdef (Robert Reif)
blueswir1 [Mon, 27 Oct 2008 15:56:56 +0000 (15:56 +0000)]
Move sun4c to its own hwdef (Robert Reif)

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5549 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoCRIS: Avoid cpu_T[1] for move_r.
edgar_igl [Mon, 27 Oct 2008 13:55:28 +0000 (13:55 +0000)]
CRIS: Avoid cpu_T[1] for move_r.

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5548 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoCRIS: Avoid using cpu_T[0] for testing condition codes.
edgar_igl [Mon, 27 Oct 2008 13:52:44 +0000 (13:52 +0000)]
CRIS: Avoid using cpu_T[0] for testing condition codes.

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5547 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoCRIS: Add branch-free versions of abs, lsl, lsr and asr.
edgar_igl [Mon, 27 Oct 2008 12:39:30 +0000 (12:39 +0000)]
CRIS: Add branch-free versions of abs, lsl, lsr and asr.

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5546 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoCRIS: Correct tcg globals allocation for 64bit hosts.
edgar_igl [Sun, 26 Oct 2008 23:18:06 +0000 (23:18 +0000)]
CRIS: Correct tcg globals allocation for 64bit hosts.

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5545 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoPreliminary BSD user emulator support
blueswir1 [Sun, 26 Oct 2008 20:33:16 +0000 (20:33 +0000)]
Preliminary BSD user emulator support

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5544 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoUpdate from binutils 2.17
blueswir1 [Sun, 26 Oct 2008 19:13:20 +0000 (19:13 +0000)]
Update from binutils 2.17

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5543 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoDocument the binutils source files used in constructing sparc-dis.c
blueswir1 [Sun, 26 Oct 2008 19:10:38 +0000 (19:10 +0000)]
Document the binutils source files used in constructing sparc-dis.c

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5542 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoAdd "const"
blueswir1 [Sun, 26 Oct 2008 16:40:27 +0000 (16:40 +0000)]
Add "const"

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5541 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoFix inline use warnings from sparse
blueswir1 [Sun, 26 Oct 2008 15:26:09 +0000 (15:26 +0000)]
Fix inline use warnings from sparse

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5540 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoFix undeclared symbol warnings from sparse
blueswir1 [Sun, 26 Oct 2008 13:43:07 +0000 (13:43 +0000)]
Fix undeclared symbol warnings from sparse

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5539 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoFix incorrect use of pstrcpy (malc)
blueswir1 [Sun, 26 Oct 2008 10:22:11 +0000 (10:22 +0000)]
Fix incorrect use of pstrcpy (malc)

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5538 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoFix undefined pthread_sigmask warning on FreeBSD (Juergen Lock)
blueswir1 [Sun, 26 Oct 2008 09:54:50 +0000 (09:54 +0000)]
Fix undefined pthread_sigmask warning on FreeBSD (Juergen Lock)

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5537 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoChange freeing method because the allocation function was changed in r5532
blueswir1 [Sat, 25 Oct 2008 13:48:59 +0000 (13:48 +0000)]
Change freeing method because the allocation function was changed in r5532

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5536 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoSilence warnings about unused variables
blueswir1 [Sat, 25 Oct 2008 11:47:20 +0000 (11:47 +0000)]
Silence warnings about unused variables

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5535 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoSuppress a GCC warning about unused function
blueswir1 [Sat, 25 Oct 2008 11:26:41 +0000 (11:26 +0000)]
Suppress a GCC warning about unused function

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5534 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoFix GCC 4 signedness warning
blueswir1 [Sat, 25 Oct 2008 11:25:48 +0000 (11:25 +0000)]
Fix GCC 4 signedness warning

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5533 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoReplace uses of strndup (a GNU extension) with Qemu pstrdup
blueswir1 [Sat, 25 Oct 2008 11:23:27 +0000 (11:23 +0000)]
Replace uses of strndup (a GNU extension) with Qemu pstrdup

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5532 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoReplace uses of strncpy (a GNU extension) with Qemu pstrcpy
blueswir1 [Sat, 25 Oct 2008 11:21:28 +0000 (11:21 +0000)]
Replace uses of strncpy (a GNU extension) with Qemu pstrcpy

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5531 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoFix undefined pthread_sigmask warning on OpenBSD
blueswir1 [Sat, 25 Oct 2008 11:19:14 +0000 (11:19 +0000)]
Fix undefined pthread_sigmask warning on OpenBSD

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5530 c046a42c-6fe2-441c-8c8c-71466251a162

15 years agoUse snprintf to please OpenBSD linker
blueswir1 [Sat, 25 Oct 2008 11:18:12 +0000 (11:18 +0000)]
Use snprintf to please OpenBSD linker

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5529 c046a42c-6fe2-441c-8c8c-71466251a162