]> git.proxmox.com Git - qemu.git/log
qemu.git
14 years agodeclare saved_env_reg as volatile
Paolo Bonzini [Tue, 23 Feb 2010 18:21:00 +0000 (19:21 +0100)]
declare saved_env_reg as volatile

This ensures that the compiler does not move it away from
the "env = env1;" assignment.  Fixes a miscompilation
on gcc 4.4, reported by Jay Foad.

Cc: <jay.foad@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agotarget-mips: fix ROTR and DROTR by zero
Nathan Froyd [Sat, 20 Feb 2010 18:24:07 +0000 (10:24 -0800)]
target-mips: fix ROTR and DROTR by zero

Signed-off-by: Nathan Froyd <froydnj@codesourcery.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotarget-mips: fix CpU exception for coprocessor 0
Nathan Froyd [Sat, 20 Feb 2010 18:19:09 +0000 (10:19 -0800)]
target-mips: fix CpU exception for coprocessor 0

When we signal a CpU exception for coprocessor 0, we should indicate
that it's for coprocessor 0 instead of coprocessor 1.

Signed-off-by: Nathan Froyd <froydnj@codesourcery.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotarget-mips: remove useless sign extension
Aurelien Jarno [Wed, 10 Feb 2010 17:19:36 +0000 (18:19 +0100)]
target-mips: remove useless sign extension

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agoFix qemu_eventfd compile when !CONFIG_EVENTFD
Avi Kivity [Tue, 23 Feb 2010 09:16:53 +0000 (10:16 +0100)]
Fix qemu_eventfd compile when !CONFIG_EVENTFD

Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoARM CP15 tls fix
Paul Brook [Tue, 23 Feb 2010 14:45:16 +0000 (14:45 +0000)]
ARM CP15 tls fix

Fix temporary handling in cp15 tls register load/store.

Signed-off-by: Paul Brook <paul@codesourcery.com>
14 years agoMerge remote branch 'qemu-kvm/uq/master' into staging
Anthony Liguori [Mon, 22 Feb 2010 22:16:22 +0000 (16:16 -0600)]
Merge remote branch 'qemu-kvm/uq/master' into staging

14 years agoAdd cpu model configuration support..
john cooper [Sat, 20 Feb 2010 17:14:59 +0000 (11:14 -0600)]
Add cpu model configuration support..

This is a reimplementation of prior versions which adds
the ability to define cpu models for contemporary processors.
The added models are likewise selected via -cpu <name>,
and are intended to displace the existing convention
of "-cpu qemu64" augmented with a series of feature flags.

A primary motivation was determination of a least common
denominator within a given processor class to simplify guest
migration.  It is still possible to modify an arbitrary model
via additional feature flags however the goal here was to
make doing so unnecessary in typical usage.  The other
consideration was providing models names reflective of
current processors.  Both AMD and Intel have reviewed the
models in terms of balancing generality of migration vs.
excessive feature downgrade relative to released silicon.

This version of the patch replaces the prior hard wired
definitions with a configuration file approach for new
models.  Existing models are thus far left as-is but may
easily be transitioned to (or may be overridden by) the
configuration file representation.

Proposed new model definitions are provided here for current
AMD and Intel processors.  Each model consists of a name
used to select it on the command line (-cpu <name>), and a
model_id which corresponds to a least common denominator
commercial instance of the processor class.

A table of names/model_ids may be queried via "-cpu ?model":

        :
    x86       Opteron_G3  AMD Opteron 23xx (Gen 3 Class Opteron)
    x86       Opteron_G2  AMD Opteron 22xx (Gen 2 Class Opteron)
    x86       Opteron_G1  AMD Opteron 240 (Gen 1 Class Opteron)
    x86          Nehalem  Intel Core i7 9xx (Nehalem Class Core i7)
    x86           Penryn  Intel Core 2 Duo P9xxx (Penryn Class Core 2)
    x86           Conroe  Intel Celeron_4x0 (Conroe/Merom Class Core 2)
        :

Also added is "-cpu ?dump" which exhaustively outputs all config
data for all defined models, and "-cpu ?cpuid" which enumerates
all qemu recognized CPUID feature flags.

The pseudo cpuid flag 'check' when added to the feature flag list
will warn when feature flags (either implicit in a cpu model or
explicit on the command line) would have otherwise been quietly
unavailable to a guest:

    # qemu-system-x86_64 ... -cpu Nehalem,check
    warning: host cpuid 0000_0001 lacks requested flag 'sse4.2|sse4_2' [0x00100000]
    warning: host cpuid 0000_0001 lacks requested flag 'popcnt' [0x00800000]

A similar 'enforce' pseudo flag exists which in addition
to the above causes qemu to error exit if requested flags are
unavailable.

Configuration data for a cpu model resides in the target config
file which by default will be installed as:

    /usr/local/etc/qemu/target-<arch>.conf

The format of this file should be self explanatory given the
definitions for the above six models and essentially mimics
the structure of the static x86_def_t x86_defs.

Encoding of cpuid flags names now allows aliases for both the
configuration file and the command line which reconciles some
Intel/AMD/Linux/Qemu naming differences.

This patch was tested relative to qemu.git.

Signed-off-by: john cooper <john.cooper@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoadd close callback for tty-based char device
David Ahern [Thu, 11 Feb 2010 01:27:17 +0000 (18:27 -0700)]
add close callback for tty-based char device

v1 -> v2  coding style changes

Add a tty close callback. Right now if a guest device that is connected
to a tty-based chardev in the host is removed, the tty is not closed.
With this patch it is closed.

Example use case is connecting an emulated USB serial cable in the guest
to ttyS0 of the host using the monitor command:

usb_add serial::/dev/ttyS0

and then removing the device with:

usb_del serial::/dev/ttyS0

Signed-off-by: David Ahern <daahern@cisco.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoFix lost serial TX interrupts. Report receive overruns.
Justin T. Gibbs [Wed, 10 Feb 2010 21:35:54 +0000 (14:35 -0700)]
Fix lost serial TX interrupts. Report receive overruns.

o Implement receive overrun status.  The FreeBSD uart driver
   relies on this status in it's probe routine to determine the size
   of the FIFO supported.
 o As per the 16550 spec, do not overwrite the RX FIFO on an RX overrun.
 o Do not allow TX or RX FIFO overruns to increment the data valid count
   beyond the size of the FIFO.
 o For reads of the IIR register, only clear the "TX holding register
   emtpy interrupt" if the read reports this interrupt.  This is required
   by the specification and avoids losing TX interrupts when other,
   higher priority interrupts (usually RX) are reported first.

Signed-off-by: Justin T. Gibbs <gibbs@FreeBSD.org>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agotcg/ppc: Fix typo
malc [Mon, 22 Feb 2010 21:50:03 +0000 (00:50 +0300)]
tcg/ppc: Fix typo

Signed-off-by: malc <av1474@comtv.ru>
14 years agoapc_pci: simplify using rwhandler
Michael S. Tsirkin [Mon, 22 Feb 2010 10:38:25 +0000 (12:38 +0200)]
apc_pci: simplify using rwhandler

Use rwhandler to simplify apb_pci.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoapb_pci: minor cleanup
Michael S. Tsirkin [Mon, 22 Feb 2010 09:40:19 +0000 (11:40 +0200)]
apb_pci: minor cleanup

pci_data_write ignores high 8 bit in address,
so there seems to be no need to set them
in apb_pci.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoUpdate OpenBIOS images to r683
Blue Swirl [Mon, 22 Feb 2010 20:42:56 +0000 (20:42 +0000)]
Update OpenBIOS images to r683

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoFix arm-softmmu compile
Blue Swirl [Mon, 22 Feb 2010 20:42:51 +0000 (20:42 +0000)]
Fix arm-softmmu compile

cc1: warnings being treated as errors
/src/qemu/hw/pl181.c: In function 'pl181_fifo_run':
/src/qemu/hw/pl181.c:185: error: 'value' may be used uninitialized in this function

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agotcg/ppc64: Use C90 style comments
malc [Mon, 22 Feb 2010 18:56:35 +0000 (21:56 +0300)]
tcg/ppc64: Use C90 style comments

Signed-off-by: malc <av1474@comtv.ru>
14 years agotcg/ppc: Implement some of the optional ops
malc [Mon, 22 Feb 2010 18:50:01 +0000 (21:50 +0300)]
tcg/ppc: Implement some of the optional ops

Signed-off-by: malc <av1474@comtv.ru>
14 years agokvm-all.c: define smp_wmb and use it for coalesced mmio
Marcelo Tosatti [Mon, 22 Feb 2010 16:57:54 +0000 (13:57 -0300)]
kvm-all.c: define smp_wmb and use it for coalesced mmio

Acked-by: "Michael S. Tsirkin" <mst@redhat.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
14 years agotcg: fix build on 32-bit hppa, ppc and sparc hosts
Jay Foad [Mon, 22 Feb 2010 15:53:55 +0000 (15:53 +0000)]
tcg: fix build on 32-bit hppa, ppc and sparc hosts

The qemu_ld32s op is only defined if TCG_TARGET_REG_BITS == 64.

Signed-off-by: Jay Foad <jay.foad@gmail.com>
Signed-off-by: malc <av1474@comtv.ru>
14 years agoPL181 write fix
Paul Brook [Mon, 22 Feb 2010 15:33:59 +0000 (15:33 +0000)]
PL181 write fix

The PL181 data transfer loop incorrectly terminates after the last FIFO
word is popped, discarding the last 3 bytes of data on a write transfer.

Signed-off-by: Paul Brook <paul@codesourcery.com>
14 years agokvm: remove pre-entry exit_request check with iothread enabled
Marcelo Tosatti [Wed, 17 Feb 2010 22:14:43 +0000 (20:14 -0200)]
kvm: remove pre-entry exit_request check with iothread enabled

With SIG_IPI blocked vcpu loop exit notification happens via -EAGAIN
from KVM_RUN.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
14 years agokvm: consume internal signal with sigtimedwait
Marcelo Tosatti [Wed, 17 Feb 2010 22:14:42 +0000 (20:14 -0200)]
kvm: consume internal signal with sigtimedwait

Change the way the internal qemu signal, used for communication between
iothread and vcpus, is handled.

Block and consume it with sigtimedwait on the outer vcpu loop, which
allows more precise timing control.

Change from standard signal (SIGUSR1) to real-time one, so multiple
signals are not collapsed.

Set the signal number on KVM's in-kernel allowed sigmask.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
14 years agokvm specific wait_io_event
Marcelo Tosatti [Wed, 17 Feb 2010 22:14:41 +0000 (20:14 -0200)]
kvm specific wait_io_event

In KVM mode the global mutex is released when vcpus are executing,
which means acquiring the fairness mutex is not required.

Also for KVM there is one thread per vcpu, so tcg_has_work is meaningless.

Add a new qemu_wait_io_event_common function to hold common code
between TCG/KVM.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
14 years agoblock SIGCHLD in vcpu thread(s)
Marcelo Tosatti [Wed, 17 Feb 2010 22:14:40 +0000 (20:14 -0200)]
block SIGCHLD in vcpu thread(s)

Otherwise a vcpu thread can run the sigchild handler causing
waitpid() from iothread to fail.

Signed-off-by: Marcelo Tosatti <mtosa...@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
14 years agoAllow const QemuOptDesc
Blue Swirl [Sun, 21 Feb 2010 16:01:30 +0000 (16:01 +0000)]
Allow const QemuOptDesc

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agokvm: Kill CR3_CACHE feature references
Jes Sorensen [Fri, 19 Feb 2010 06:43:24 +0000 (07:43 +0100)]
kvm: Kill CR3_CACHE feature references

Remove all references to KVM_CR3_CACHE as it was never implemented.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
14 years agokvm: Fix eflags corruption in kvm mode
Jan Kiszka [Fri, 19 Feb 2010 17:21:20 +0000 (18:21 +0100)]
kvm: Fix eflags corruption in kvm mode

This should explain a lot of the weird breakages of upstream KVM we've
seen recently (actually we should have seen it much earlier):

Stop translating eflags into TCG format when in kvm mode as we never
translate it back and rather sync this broken state into the kernel.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
14 years agocris: Add CRISv10 gdbstub support.
Edgar E. Iglesias [Sat, 20 Feb 2010 18:51:56 +0000 (19:51 +0100)]
cris: Add CRISv10 gdbstub support.

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
14 years agocris: Mask interrupts on dslots for CRISv10.
Edgar E. Iglesias [Sat, 20 Feb 2010 18:17:29 +0000 (19:17 +0100)]
cris: Mask interrupts on dslots for CRISv10.

CRISv10 cores (unlike v32) do not take any interrupts while delayed
jumps are pending (delay slots).

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
14 years agomicroblaze: Improve brk emulation.
Edgar E. Iglesias [Sat, 20 Feb 2010 13:04:01 +0000 (14:04 +0100)]
microblaze: Improve brk emulation.

brk insns while in user mode raise priv insn exceptions.
This commit makes gdbserver work on linux guests.

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@petalogix.com>
14 years agomicroblaze: Dont segfault when singlestepping first insn.
Edgar E. Iglesias [Sat, 20 Feb 2010 13:03:14 +0000 (14:03 +0100)]
microblaze: Dont segfault when singlestepping first insn.

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@petalogix.com>
14 years agotarget-sparc: fix --enable-debug build
Jay Foad [Sat, 20 Feb 2010 10:45:23 +0000 (10:45 +0000)]
target-sparc: fix --enable-debug build

Use 32-bit arithmetic for the address offset calculation to fix a
build failure on 32-bit hosts.

Signed-off-by: Jay Foad <jay.foad@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agotcg: fix assertion with --enable-debug
Jay Foad [Sat, 20 Feb 2010 10:08:33 +0000 (10:08 +0000)]
tcg: fix assertion with --enable-debug

On 32-bit hosts op_qemu_ld32s is unused. Remove it to fix the
following assertion failure:

qemu-alpha: tcg/tcg.c:1055:
tcg_add_target_add_op_defs: Assertion `tcg_op_defs[op].used' failed.

Signed-off-by: Jay Foad <jay.foad@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoDon't compile rwhandler.c for user targets
Blue Swirl [Sat, 20 Feb 2010 09:27:38 +0000 (09:27 +0000)]
Don't compile rwhandler.c for user targets

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agotcg: Add comments for all optional instructions not implemented.
Richard Henderson [Thu, 18 Feb 2010 22:44:39 +0000 (14:44 -0800)]
tcg: Add comments for all optional instructions not implemented.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agotcg-sparc: Implement ORC.
Richard Henderson [Tue, 16 Feb 2010 22:23:39 +0000 (14:23 -0800)]
tcg-sparc: Implement ORC.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agotcg-sparc: Implement ANDC.
Richard Henderson [Tue, 16 Feb 2010 22:21:19 +0000 (14:21 -0800)]
tcg-sparc: Implement ANDC.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agotcg: Optional target implementation of ORC.
Richard Henderson [Tue, 16 Feb 2010 22:15:28 +0000 (14:15 -0800)]
tcg: Optional target implementation of ORC.

Previously ORC was always implemented by tcg-op.h with
an explicit NOT opcode.  Allow a target implementation.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agotcg: Optional target implementation of ANDC.
Richard Henderson [Tue, 16 Feb 2010 22:10:13 +0000 (14:10 -0800)]
tcg: Optional target implementation of ANDC.

Previously ANDC was always implemented by tcg-op.h with
an explicit NOT opcode.  Allow a target implementation.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agotcg-sparc: Implement not.
Richard Henderson [Tue, 16 Feb 2010 22:02:04 +0000 (14:02 -0800)]
tcg-sparc: Implement not.

The fallback implementation of "ret = arg1 ^ -1" isn't ideal
because of the extra tcg op to load the minus one.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agotcg-sparc: Implement neg.
Richard Henderson [Tue, 16 Feb 2010 21:55:15 +0000 (13:55 -0800)]
tcg-sparc: Implement neg.

The fallback implementation of "ret = 0 - arg1" isn't ideal,
first because of the extra tcg op to load the zero, and second
because we fail to handle zero as %g0 for arg1 of the sub.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoFix warning on mingw32
Blue Swirl [Sat, 20 Feb 2010 08:29:17 +0000 (08:29 +0000)]
Fix warning on mingw32

/src/qemu/hw/ide/core.c: In function 'ide_drive_pre_save':
/src/qemu/hw/ide/core.c:2740: warning: comparison is always false due to limited range of data type

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoFix warning on OpenBSD
Blue Swirl [Sat, 20 Feb 2010 08:20:18 +0000 (08:20 +0000)]
Fix warning on OpenBSD

/src/qemu/net.c: In function `net_check_clients':
/src/qemu/net.c:1287: warning: `has_nic' might be used uninitialized in this function
/src/qemu/net.c:1287: warning: `has_host_dev' might be used uninitialized in this function

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agotcg/ppc: Consistently use calling convention selection macros
malc [Fri, 19 Feb 2010 22:47:35 +0000 (01:47 +0300)]
tcg/ppc: Consistently use calling convention selection macros

Signed-off-by: malc <av1474@comtv.ru>
14 years agoUse ppc host calling convention definitions to set TCG_TARGET_CALL_{ALIGN_ARGS,STACK_...
Juergen Lock [Fri, 19 Feb 2010 18:30:07 +0000 (19:30 +0100)]
Use ppc host calling convention definitions to set TCG_TARGET_CALL_{ALIGN_ARGS,STACK_OFFSET}.

New version after malc's comments.  (This avoids having to do
  #if defined __linux__ || defined __FreeBSD__ || defined __FreeBSD_kernel__
for the third case.)

Submitted by: Andreas Tobler <andreast@fgznet.ch>  (original version)

Signed-off-by: Juergen Lock <nox@jelal.kn-bremen.de>
Signed-off-by: malc <av1474@comtv.ru>
14 years agoAdd FreeBSD/ppc host ucontext definitions.
Juergen Lock [Fri, 19 Feb 2010 18:29:25 +0000 (19:29 +0100)]
Add FreeBSD/ppc host ucontext definitions.

Submitted by: Andreas Tobler <andreast@fgznet.ch>

Signed-off-by: Juergen Lock <nox@jelal.kn-bremen.de>
Signed-off-by: malc <av1474@comtv.ru>
14 years agoAdd FreeBSD/ppc host ppc_init_cacheline_sizes() implementation.
Juergen Lock [Fri, 19 Feb 2010 18:28:23 +0000 (19:28 +0100)]
Add FreeBSD/ppc host ppc_init_cacheline_sizes() implementation.

New version after malc's comments.  (Added error handling.)

Submitted by: Andreas Tobler <andreast@fgznet.ch>

Signed-off-by: Juergen Lock <nox@jelal.kn-bremen.de>
Signed-off-by: malc <av1474@comtv.ru>
14 years agoqemu-img: Fix error message
Kevin Wolf [Wed, 17 Feb 2010 11:33:17 +0000 (12:33 +0100)]
qemu-img: Fix error message

When qemu-img can't open the new backing file for a rebase, it prints an error
message which contains the file name of the old backing file. This is wrong,
obviously.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoqemu-img: Fix segfault during rebase
Kevin Wolf [Wed, 17 Feb 2010 11:32:59 +0000 (12:32 +0100)]
qemu-img: Fix segfault during rebase

This fixes a possible read beyond the end of the temporary buffers used for
comparing data in the old and the new backing file.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoqcow2: Fix access after end of array
Kevin Wolf [Tue, 16 Feb 2010 14:54:49 +0000 (15:54 +0100)]
qcow2: Fix access after end of array

If a write requests crosses a L2 table boundary and all clusters until the
end of the L2 table are usable for the request, we must not look at the next
L2 entry because we already have arrived at the end of the array.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoqdev: Free opts on failed do_device_add
Kevin Wolf [Tue, 16 Feb 2010 12:12:38 +0000 (13:12 +0100)]
qdev: Free opts on failed do_device_add

If the device can't be created, don't leak the QemuOpts and release the id of
the device that should have been added by the failed device_add.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoQEMU e820 reservation patch
Jes Sorensen [Mon, 15 Feb 2010 17:33:46 +0000 (18:33 +0100)]
QEMU e820 reservation patch

Hi,

Kevin and I have agreed on the approach for this one now. So here is
the latest version of the patch for QEMU, submitting e820 reservation
entries via fw_cfg.

Cheers,
Jes

Use qemu-cfg to provide the BIOS with an optional table of e820 entries.

Notify the BIOS of the location of the TSS+EPT range to by reserving
it via the e820 table.

This matches a corresponding patch for Seabios, however older versions
of Seabios will default to the hardcoded address range and stay
compatible with current QEMU.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoide save/restore pio/atapi cmd transfer fields and io buffer
Marcelo Tosatti [Thu, 11 Feb 2010 20:19:44 +0000 (18:19 -0200)]
ide save/restore pio/atapi cmd transfer fields and io buffer

Save/restore information necessary to continue in progress PIO/ATAPI CMD
transfers.

This includes the IO buffer.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agovirtio-serial: pci: Allow MSI to be disabled
Amit Shah [Fri, 12 Feb 2010 13:22:38 +0000 (18:52 +0530)]
virtio-serial: pci: Allow MSI to be disabled

Michael noted we don't allow disabling of MSI for the virtio-serial-pci
device. Fix that.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
CC: "Michael S. Tsirkin" <mst@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agovirtio-serial: don't set MULTIPORT for 1 port dev
Michael S. Tsirkin [Mon, 15 Feb 2010 15:13:56 +0000 (20:43 +0530)]
virtio-serial: don't set MULTIPORT for 1 port dev

Since commit 98b19252cf1bd97c54bc4613f3537c5ec0aae263, all
serial devices declare MULTIPORT feature.
To allow 0.12 compatibility, we should clear this when
max_nr_ports is 1.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agopc: Add backward compatibility options for virtio-serial
Amit Shah [Mon, 15 Feb 2010 15:13:55 +0000 (20:43 +0530)]
pc: Add backward compatibility options for virtio-serial

virtio-serial-pci can support multiple ports in the current development
version that will become 0.13. Add compatibility options for the 0.12
and 0.11 pc machine types.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agopc: Bump up pc version to 0.13 and add a 0.12 compat version
Amit Shah [Mon, 15 Feb 2010 15:13:54 +0000 (20:43 +0530)]
pc: Bump up pc version to 0.13 and add a 0.12 compat version

The version 0.13 will be the new default and compatibility options will
be added to the 0.12 version.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoUSB HID does not support Set_Idle
Kevin O'Connor [Sat, 13 Feb 2010 23:32:17 +0000 (18:32 -0500)]
USB HID does not support Set_Idle

I found that the QEMU USB keyboard support does not work properly with
the Set_Idle command.  Once a non-zero value is given to Set_Idle,
then the keyboard reports an event on every poll - not based on the
time issued in the Set_Idle command.

I changed the code (see patch below) and it works for me.  I'm not
that familiar with the qemu internals, so I'm not sure if this is the
best way to implement this feature.

-Kevin

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoblock: more read-only changes, related to backing files
Naphtali Sprei [Sun, 14 Feb 2010 11:39:18 +0000 (13:39 +0200)]
block: more read-only changes, related to backing files

Open backing file read-only where possible
Upgrade backing file to read-write during commit, back to read-only after commit
  If upgrade fail, back to read-only. If also fail, "disconnect" the drive.

Signed-off-by: Naphtali Sprei <nsprei@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agomingw32: Enable C99/POSIX format strings
Stefan Weil [Fri, 12 Feb 2010 10:02:08 +0000 (11:02 +0100)]
mingw32: Enable C99/POSIX format strings

Starting with mingw32-runtime 3.15, C99/POSIX
format strings (%zu, %lld, ...) are supported
by defining __USE_MINGW_ANSI_STDIO=1.

As QEMU uses such format strings, unconditionally
define this macro. It won't hurt on older revisions
of mingw32-runtime.

Tested with manually installed mingw32-runtime 3.15
on debian (cross compiled + wine).

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoFix hanging user monitor when using balloon command
Adam Litke [Fri, 12 Feb 2010 20:55:56 +0000 (14:55 -0600)]
Fix hanging user monitor when using balloon command

Arghh... Adding missing S-O-B

Hi Anthony.  I wonder if there was a problem when importing my async
command handler patchset.  Since the 'balloon' command completes
immediately, it must call the completion callback before returning.
That call was missing but is added by the patch below.

Signed-off-by: Adam Litke <agl@us.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoMonitor: Report more than one error in handlers
Luiz Capitulino [Thu, 11 Feb 2010 01:50:07 +0000 (23:50 -0200)]
Monitor: Report more than one error in handlers

Handlers can generate only one error in a call, we let the
programmer know if they brake this rule and clients will only
get the first generated error.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoMonitor: Debug stray prints the right way
Luiz Capitulino [Thu, 11 Feb 2010 01:50:06 +0000 (23:50 -0200)]
Monitor: Debug stray prints the right way

QObject Monitor handlers should not call any Monitor print
function: they should only build objects, printing is done
by common code.

Current QMP code will ignore such calls, as we can't send
garbage to clients, additionally it will also emit an
undefined error on the assumption that print calls usually
report errors.

However, the right way to deal with this is to rely on a
return code. This has been fixed by other commit already.

Now, this commit drops the error from monitor_vprintf() and
adds a better debugging mechanism for those 'stray' prints:
we count them if debug is enabled and let the developer know
if a QObject handler is trying to print anything.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoMonitor: Audit handler return
Luiz Capitulino [Thu, 11 Feb 2010 01:50:05 +0000 (23:50 -0200)]
Monitor: Audit handler return

This commit verifies the following two rules specified by
Markus Armbruster:

1. If the handler returns failure, it must have passed an error.

   If it didn't, it's broken. Report an internal error to the client,
   and report the bug to the programmer.

2. If the handler returns success, it must not have passed an error.

   If it did, it's broken. Report the error to the client, and report
   the bug to the programmer.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoMonitor: Drop the print disabling mechanism
Luiz Capitulino [Thu, 11 Feb 2010 01:50:04 +0000 (23:50 -0200)]
Monitor: Drop the print disabling mechanism

We can ignore calls to monitor_vprintf() in QMP mode and use
monitor_puts() directly in monitor_json_emitter().

This allows us to drop this ugly hack.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoMonitor: Debugging support
Luiz Capitulino [Thu, 11 Feb 2010 01:50:03 +0000 (23:50 -0200)]
Monitor: Debugging support

Add configure options (--enable-debug-mon and --disable-debug-mon)
plus the MON_DEBUG() macro.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoMonitor: Rename cmd_new_ret()
Luiz Capitulino [Thu, 11 Feb 2010 01:50:02 +0000 (23:50 -0200)]
Monitor: Rename cmd_new_ret()

Now that all handlers are converted to cmd_new_ret(), we can rename
it back to cmd_new(). But now it returns a value.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoMonitor: Convert do_change() to cmd_new_ret()
Luiz Capitulino [Thu, 11 Feb 2010 01:50:01 +0000 (23:50 -0200)]
Monitor: Convert do_change() to cmd_new_ret()

Not that trivial as the call chain also has to be modified.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoMonitor: Convert do_info() to cmd_new_ret()
Luiz Capitulino [Thu, 11 Feb 2010 01:50:00 +0000 (23:50 -0200)]
Monitor: Convert do_info() to cmd_new_ret()

Note that this function only fails in QMP, in the user Monitor
it prints the help text instead.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoMonitor: Convert do_physical_memory_save() to cmd_new_ret()
Luiz Capitulino [Thu, 11 Feb 2010 01:49:59 +0000 (23:49 -0200)]
Monitor: Convert do_physical_memory_save() to cmd_new_ret()

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoMonitor: Convert do_memory_save() to cmd_new_ret()
Luiz Capitulino [Thu, 11 Feb 2010 01:49:58 +0000 (23:49 -0200)]
Monitor: Convert do_memory_save() to cmd_new_ret()

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoMonitor: Convert do_migrate() to cmd_new_ret()
Luiz Capitulino [Thu, 11 Feb 2010 01:49:57 +0000 (23:49 -0200)]
Monitor: Convert do_migrate() to cmd_new_ret()

While there I'm also dropping a unneeded else clause (the last
one in the function).

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoMonitor: Convert pci_device_hot_remove() to cmd_new_ret()
Luiz Capitulino [Thu, 11 Feb 2010 01:49:56 +0000 (23:49 -0200)]
Monitor: Convert pci_device_hot_remove() to cmd_new_ret()

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoMonitor: Convert pci_device_hot_add() to cmd_new_ret()
Luiz Capitulino [Thu, 11 Feb 2010 01:49:55 +0000 (23:49 -0200)]
Monitor: Convert pci_device_hot_add() to cmd_new_ret()

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoMonitor: Convert do_closefd() to cmd_new_ret()
Luiz Capitulino [Thu, 11 Feb 2010 01:49:54 +0000 (23:49 -0200)]
Monitor: Convert do_closefd() to cmd_new_ret()

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoMonitor: Convert do_getfd() to cmd_new_ret()
Luiz Capitulino [Thu, 11 Feb 2010 01:49:53 +0000 (23:49 -0200)]
Monitor: Convert do_getfd() to cmd_new_ret()

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoMonitor: Convert do_block_set_passwd() to cmd_new_ret()
Luiz Capitulino [Thu, 11 Feb 2010 01:49:52 +0000 (23:49 -0200)]
Monitor: Convert do_block_set_passwd() to cmd_new_ret()

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoMonitor: Convert do_cpu_set() to cmd_new_ret()
Luiz Capitulino [Thu, 11 Feb 2010 01:49:51 +0000 (23:49 -0200)]
Monitor: Convert do_cpu_set() to cmd_new_ret()

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoMonitor: Convert do_eject() to cmd_new_ret()
Luiz Capitulino [Thu, 11 Feb 2010 01:49:50 +0000 (23:49 -0200)]
Monitor: Convert do_eject() to cmd_new_ret()

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoMonitor: Convert do_cont() to cmd_new_ret()
Luiz Capitulino [Thu, 11 Feb 2010 01:49:49 +0000 (23:49 -0200)]
Monitor: Convert do_cont() to cmd_new_ret()

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoMonitor: Convert simple handlers to cmd_new_ret()
Luiz Capitulino [Thu, 11 Feb 2010 01:49:48 +0000 (23:49 -0200)]
Monitor: Convert simple handlers to cmd_new_ret()

The following handlers always succeed and hence can be converted
to cmd_new_ret() in the same commit.

- do_stop()
- do_quit()
- do_system_reset()
- do_system_powerdown()
- do_migrate_cancel()
- do_qmp_capabilities()
- do_migrate_set_speed()
- do_migrate_set_downtime()

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoMonitor: Introduce cmd_new_ret()
Luiz Capitulino [Thu, 11 Feb 2010 01:49:47 +0000 (23:49 -0200)]
Monitor: Introduce cmd_new_ret()

In order to implement the new error handling and debugging
mechanism for command handlers, we need to change the cmd_new()
callback to return a value.

This commit introduces cmd_new_ret(), which returns a value and
will be used only temporarily to handle the transition from
cmd_new().

That is, as soon as all command handlers are ported to cmd_new_ret(),
it will be renamed back to cmd_new() and the new error handling
and debugging mechanism will be added on top of it.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agomove default allocator to console.c
Paolo Bonzini [Wed, 10 Feb 2010 23:29:57 +0000 (00:29 +0100)]
move default allocator to console.c

Moving stuff in console.c to avoid the need for prototypes makes
this patch a bit bigger, but there's no change in the code.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoremove knowledge of defaultallocator_free_displaysurface from sdl.c
Paolo Bonzini [Wed, 10 Feb 2010 23:29:56 +0000 (00:29 +0100)]
remove knowledge of defaultallocator_free_displaysurface from sdl.c

Let register_displayallocator hand over the old width/height to the new
allocator.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agouse lazy initialization for display_state
Paolo Bonzini [Wed, 10 Feb 2010 23:29:55 +0000 (00:29 +0100)]
use lazy initialization for display_state

Ensure initialization of a dumb display, if needed, by making
all accesses go through get_displaystate.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoMerge remote branch 'mst/for_anthony' into staging
Anthony Liguori [Fri, 19 Feb 2010 19:02:10 +0000 (13:02 -0600)]
Merge remote branch 'mst/for_anthony' into staging

14 years agonet: Monitor command set_link finds only VLAN clients, fix
Markus Armbruster [Thu, 11 Feb 2010 13:45:02 +0000 (14:45 +0100)]
net: Monitor command set_link finds only VLAN clients, fix

Clients not associated with a VLAN exist since commit d80b9fc6.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agonet: info network shows only VLAN clients, fix
Markus Armbruster [Thu, 11 Feb 2010 13:45:01 +0000 (14:45 +0100)]
net: info network shows only VLAN clients, fix

Clients not associated with a VLAN exist since commit d80b9fc6.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agonet: net_check_clients() checks only VLAN clients, fix
Markus Armbruster [Thu, 11 Feb 2010 13:45:00 +0000 (14:45 +0100)]
net: net_check_clients() checks only VLAN clients, fix

Clients not associated with a VLAN exist since commit d80b9fc6.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agonet: Fix bogus "Warning: vlan 0 with no nics" with -device
Markus Armbruster [Thu, 11 Feb 2010 13:44:59 +0000 (14:44 +0100)]
net: Fix bogus "Warning: vlan 0 with no nics" with -device

net_check_clients() prints this when an VLAN has host devices, but no
guest devices.  It uses VLANState members nb_guest_devs and
nb_host_devs to keep track of these devices.  However, -device does
not update nb_guest_devs, only net_init_nic() does that, for -net nic.

Check the VLAN clients directly, and remove the counters.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agonet: net_check_clients() runs too early to see -device, fix
Markus Armbruster [Thu, 11 Feb 2010 13:44:58 +0000 (14:44 +0100)]
net: net_check_clients() runs too early to see -device, fix

Call it right after -device devices get created.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agonet: Remove unused net_client_uninit()
Markus Armbruster [Thu, 11 Feb 2010 13:44:57 +0000 (14:44 +0100)]
net: Remove unused net_client_uninit()

Unused since commit 9ad4531e.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoFix strace or FUTEX_PRIVATE_FLAG
Paul Brook [Fri, 19 Feb 2010 16:04:51 +0000 (16:04 +0000)]
Fix strace or FUTEX_PRIVATE_FLAG

FUTEX_PRIVATE_FLAG is a bit orred with an existing futex op,
not a distinct value.

Signed-off-by: Paul Brook <paul@codesourcery.com>
14 years agotarget-arm: support thumb exception handlers
Rabin Vincent [Sun, 14 Feb 2010 18:32:36 +0000 (00:02 +0530)]
target-arm: support thumb exception handlers

When handling an exception, switch to the correct mode based on the
Thumb Exception (TE) bit in the SCTLR.

Signed-off-by: Rabin Vincent <rabin@rab.in>
14 years agotarget-arm: implement Thumb-2 exception return
Rabin Vincent [Sun, 14 Feb 2010 18:32:35 +0000 (00:02 +0530)]
target-arm: implement Thumb-2 exception return

Support the "subs pc, lr" Thumb-2 exception return instruction.

Signed-off-by: Rabin Vincent <rabin@rab.in>
Signed-off-by: Paul Brook <paul@codesourcery.com>
14 years agotarget-arm: fix thumb CPS
Rabin Vincent [Sun, 14 Feb 2010 18:32:34 +0000 (00:02 +0530)]
target-arm: fix thumb CPS

The Thumb CPS currently does not work correctly: CPSID touches more bits
than the instruction wants to, and CPSIE does nothing.  Fix it by
passing the correct mask (the "affect" bits) and value.

Signed-off-by: Rabin Vincent <rabin@rab.in>
14 years agoget rid of hostregs_helper.h
Paolo Bonzini [Thu, 18 Feb 2010 20:25:23 +0000 (21:25 +0100)]
get rid of hostregs_helper.h

Since b567b38 (target-arm: remove T0 and T1, 2009-10-16) the only global
register that is used is AREG0, so the complexity of hostregs_helper.h
is unused.  Use regular assignments and a compiler optimization barrier.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoremove dead m68k definitions
Paolo Bonzini [Thu, 18 Feb 2010 20:25:22 +0000 (21:25 +0100)]
remove dead m68k definitions

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agotcg: Add consistency checks for op definitions
Stefan Weil [Mon, 15 Feb 2010 16:17:21 +0000 (17:17 +0100)]
tcg: Add consistency checks for op definitions

When compiled with CONFIG_DEBUG_TCG, this code looks
for missing, duplicate and wrong entries in the
op definitions.

Errors will raise an assertion at program start
(all checks are done in the initial phase).

The current code contains such errors, at least for
i386 guest on i386 host.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agouse eventfd for iothread
Paolo Bonzini [Wed, 10 Feb 2010 23:23:46 +0000 (00:23 +0100)]
use eventfd for iothread

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>