sdk/emulator/qemu.git
14 years agoeepro100: Replace variable name to fix a compiler warning
Stefan Weil [Tue, 2 Mar 2010 21:37:52 +0000 (22:37 +0100)]
eepro100: Replace variable name to fix a compiler warning

When compiling with -Wshadow, gcc gives a warning
which is fixed by renaming stat -> status.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
14 years agoeepro100: Use symbolic names for bits in EEPROM id
Stefan Weil [Tue, 2 Mar 2010 21:37:51 +0000 (22:37 +0100)]
eepro100: Use symbolic names for bits in EEPROM id

V2 - Use UPPER_CASE for enum values

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
14 years agoeepro100: Remove old unused code
Stefan Weil [Tue, 2 Mar 2010 21:37:50 +0000 (22:37 +0100)]
eepro100: Remove old unused code

This code is no longer needed.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
14 years agoeepro100: Use symbolic names and BIT macros in binary operations
Stefan Weil [Tue, 2 Mar 2010 21:37:49 +0000 (22:37 +0100)]
eepro100: Use symbolic names and BIT macros in binary operations

Instead of magic numbers like 0x8000, symbolic names are used
for the SCB command and status bits.

There are too many configuration bits to use symbolic names
there, too. Using the BIT macro is a little help when comparing
code and documentation.

For the same reason, some other constants were replaced by
the BITS macro.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
14 years agoeepro100: Add device descriptions
Stefan Weil [Tue, 2 Mar 2010 21:37:48 +0000 (22:37 +0100)]
eepro100: Add device descriptions

Add descriptions for all devices.
These descriptions are shown when users call
qemu -device ?

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
14 years agoeepro100: Update copyright notice
Stefan Weil [Tue, 2 Mar 2010 21:37:47 +0000 (22:37 +0100)]
eepro100: Update copyright notice

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
14 years agoeepro100: Add TODO list
Stefan Weil [Tue, 2 Mar 2010 21:37:46 +0000 (22:37 +0100)]
eepro100: Add TODO list

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
14 years agoeepro100: Support gpxe boot for all eepro100 devices
Stefan Weil [Tue, 2 Mar 2010 21:37:44 +0000 (22:37 +0100)]
eepro100: Support gpxe boot for all eepro100 devices

Only two boot ROM files are needed for all devices.

* Add these GPXE ROM files using new naming convention
  (as discussed on qemu-devel). Both files were created
  with http://rom-o-matic.net/, PCI vendor / device ids
  as in ROM filenames and option BANNER_TIMEOUT = 0.

* Remove old PXE ROM file for i82559er.
  It was replaced by gpxe-eepro100-80861209.rom.

* Update pc-bios/README (and sort entries).

Full support still needs additional eepro100 fixes.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
14 years agoeepro100: Fix PXE boot
Stefan Weil [Tue, 2 Mar 2010 21:37:43 +0000 (22:37 +0100)]
eepro100: Fix PXE boot

The phy handling was wrong for PXE, GPXE boot:
GPXE's eepro100 driver did not detect a valid link.

This is fixed here.

V2 - Use UPPER_CASE for enum values

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
14 years agoeepro100: Add missing SCB register names
Stefan Weil [Tue, 2 Mar 2010 21:37:42 +0000 (22:37 +0100)]
eepro100: Add missing SCB register names

Some system control block registers were addressed
using their offset value. Use symbolic names now
and clean the documentation.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
14 years agoeepro100: Fix compiler errors from debug messages
Stefan Weil [Tue, 2 Mar 2010 21:37:41 +0000 (22:37 +0100)]
eepro100: Fix compiler errors from debug messages

When debug output was enabled (by defining DEBUG_EEPRO100),
some debug messages resulted in a compiler error.

This is fixed here.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
14 years ago(curses) Use more descriptive values
Samuel Thibault [Sun, 28 Feb 2010 17:12:01 +0000 (18:12 +0100)]
(curses) Use more descriptive values

Hello,

curses_keys.h is using obscure constant values while the curses.h header
provides fine defines, let's use the latter.

To be applied on top of my previous patch.

Samuel

Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>
14 years agoFix curses return key when using -k
Samuel Thibault [Sun, 28 Feb 2010 14:35:19 +0000 (15:35 +0100)]
Fix curses return key when using -k

Hello,

There is a small incoherency in curses_keys.h, which makes it fail to
emit \n when using e.g. -k fr: curses2keysym transforms \r and 0x157
into \n, but name2keysym binds \r with Return, not \n.  The patch below
fixes that.

Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>
14 years agotarget-mips: use setcond when possible
Aurelien Jarno [Mon, 8 Feb 2010 14:50:58 +0000 (15:50 +0100)]
target-mips: use setcond when possible

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotcg/arm: merge the two sets of #define for optional ops
Aurelien Jarno [Tue, 2 Mar 2010 22:10:31 +0000 (23:10 +0100)]
tcg/arm: merge the two sets of #define for optional ops

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotcg/arm: accept immediate arguments for brcond/setcond
Aurelien Jarno [Mon, 1 Mar 2010 21:33:50 +0000 (22:33 +0100)]
tcg/arm: accept immediate arguments for brcond/setcond

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>
14 years agoAdd a missing break
Andrzej Zaborowski [Tue, 2 Mar 2010 21:26:04 +0000 (22:26 +0100)]
Add a missing break

14 years agotcg/arm: implement setcond2
Aurelien Jarno [Mon, 1 Mar 2010 21:33:49 +0000 (22:33 +0100)]
tcg/arm: implement setcond2

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>
14 years agotcg/arm: implement setcond
Aurelien Jarno [Mon, 1 Mar 2010 21:33:48 +0000 (22:33 +0100)]
tcg/arm: implement setcond

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>
14 years agotcg/arm: fix div2/divu2
Aurelien Jarno [Tue, 2 Mar 2010 19:19:18 +0000 (20:19 +0100)]
tcg/arm: fix div2/divu2

When restoring register values, increase the stack register for skipped
values.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>
14 years agoAvoid tlb_set_page in userspace emulation
Paul Brook [Mon, 1 Mar 2010 03:31:14 +0000 (03:31 +0000)]
Avoid tlb_set_page in userspace emulation

tlb_set_page isn't meaningful for userspace emulation, so remove it.

Signed-off-by: Paul Brook <paul@codesourcery.com>
14 years agoMove subpage definitions
Paul Brook [Mon, 1 Mar 2010 03:31:14 +0000 (03:31 +0000)]
Move subpage definitions

Move definitions for subpage handling into !CONFIG_USER_ONLY code.

Signed-off-by: Paul Brook <paul@codesourcery.com>
14 years agoDisassembler symbol lookup fix
Paul Brook [Mon, 1 Mar 2010 03:55:48 +0000 (03:55 +0000)]
Disassembler symbol lookup fix

Fix function signature for userspace disassembler symbol lookup.

Signed-off-by: Paul Brook <paul@codesourcery.com>
14 years agoMove ioport.h out of cpu-all.h
Paul Brook [Mon, 1 Mar 2010 03:29:21 +0000 (03:29 +0000)]
Move ioport.h out of cpu-all.h

Only include ioport.h where it is actually needed.

Signed-off-by: Paul Brook <paul@codesourcery.com>
14 years agoRemove bogus cpu_physical_memory_rw
Paul Brook [Mon, 1 Mar 2010 00:08:59 +0000 (00:08 +0000)]
Remove bogus cpu_physical_memory_rw

Userspace doesn't have physical memory, so cpu_physical_memory_rw
makes no sense.  This is only used to implement cpu_memory_rw_debug, so
just implement that directly instead.

Signed-off-by: Paul Brook <paul@codesourcery.com>
14 years agoRemove l1_phys_map from userspace emulation
Paul Brook [Sun, 28 Feb 2010 23:55:53 +0000 (23:55 +0000)]
Remove l1_phys_map from userspace emulation

Userspace emulation doesn't have a physical address space, so
l1_phys_map makes no sense. This code is never actually used, so don't
try and build it.

Signed-off-by: Paul Brook <paul@codesourcery.com>
14 years agoFix userspace breakpoint invalidation
Paul Brook [Sun, 28 Feb 2010 23:47:45 +0000 (23:47 +0000)]
Fix userspace breakpoint invalidation

Remove bogus virtual->physical address translation in
breakpoint_invalidate for userspace emulation.

Signed-off-by: Paul Brook <paul@codesourcery.com>
14 years agotarget-arm: neon vshll instruction fix
Juha Riihimäki [Fri, 5 Feb 2010 15:52:29 +0000 (15:52 +0000)]
target-arm: neon vshll instruction fix

implementation only widened the 32bit source vector elements into a
64bit destination vector but forgot to perform the actual shifting
operation.

Signed-off-by: Juha Riihimäki <juha.riihimaki@nokia.com>
Signed-off-by: Riku Voipio <riku.voipio@nokia.com>
Acked-by: Laurent Desnogues <laurent.desnogues@gmail.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotarget-arm: neon - fix VRADDHN/VRSUBHN vs VADDHN/VSUBHN
Riku Voipio [Fri, 5 Feb 2010 15:52:28 +0000 (15:52 +0000)]
target-arm: neon - fix VRADDHN/VRSUBHN vs VADDHN/VSUBHN

The rounding/truncating options were inverted. truncating
was done when rounding was meant and vice verse.

Signed-off-by: Riku Voipio <riku.voipio@nokia.com>
Acked-by: Laurent Desnogues <laurent.desnogues@gmail.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotarget-i386: fix crash on x86 32bit linux host with hw breakpoint exceptions
Jason Wessel [Tue, 26 Jan 2010 22:29:50 +0000 (16:29 -0600)]
target-i386: fix crash on x86 32bit linux host with hw breakpoint exceptions

If you make use of hw breakpoints on a 32bit x86 linux host, qemu
will segmentation fault when processing the exception.

The problem is that the value of env is stored in $ebp in the op_helper
raise_exception() function, and it can have the wrong value when
calling it from non generated code.

It is possible to work around the problem by restoring the value of
env before calling raise_exception() using a new helper function that
takes (CPUState *) as one of the arguments.

Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agoalpha-linux-user: Implement signals.
Richard Henderson [Mon, 28 Dec 2009 02:30:03 +0000 (18:30 -0800)]
alpha-linux-user: Implement signals.

Move userland PALcode handling into linux-user main loop so that
we can send signals from there.  This also makes alpha_palcode.c
system-level only, so don't build it for userland.  Add defines
for GENTRAP PALcall mapping to signals.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotarget-alpha: Implement IEEE FP qualifiers.
Richard Henderson [Mon, 4 Jan 2010 22:27:23 +0000 (14:27 -0800)]
target-alpha: Implement IEEE FP qualifiers.

IEEE FP instructions are split up so that the rounding mode
coming from the instruction and exceptions (both masking and
delivery) are handled external to the base FP operation.
FP exceptions are properly raised for non-finite inputs to
instructions that do not indicate software completion.

A shortcut is applied if CONFIG_SOFTFLOAT_INLINE is defined
at the top of translate.c: data is loaded and stored into
FP_STATUS directly instead of using the functional interface
defined by "softfloat.h".

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotarget-ppc: don't print invalid opcode messages on the console
Aurelien Jarno [Sun, 28 Feb 2010 15:04:09 +0000 (16:04 +0100)]
target-ppc: don't print invalid opcode messages on the console

Invalid opcode messages can be perfectly normal, for example if this
code is never executed. Don't print an error message on the console,
but keep the message in the log for debugging purposes.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agoRevert "target-ppc: stop translation after a trap instruction"
Aurelien Jarno [Sun, 28 Feb 2010 15:02:28 +0000 (16:02 +0100)]
Revert "target-ppc: stop translation after a trap instruction"

This reverts commit 6454e7be1b2504533f7ffb190d54ebe2993cb434.

14 years agoaudio/alsa: Handle SND_PCM_STATE_SETUP in alsa_poll_handler
malc [Sun, 28 Feb 2010 15:34:21 +0000 (18:34 +0300)]
audio/alsa: Handle SND_PCM_STATE_SETUP in alsa_poll_handler

Signed-off-by: malc <av1474@comtv.ru>
14 years agoaudio/alsa: Spelling typo (paramters)
Vagrant Cascadian [Fri, 26 Feb 2010 21:39:46 +0000 (13:39 -0800)]
audio/alsa: Spelling typo (paramters)

Trivial patch to fix the spelling of "parameters".

Signed-off-by: malc <av1474@comtv.ru>
14 years agotarget-ppc: stop translation after a trap instruction
Aurelien Jarno [Sun, 28 Feb 2010 13:11:06 +0000 (14:11 +0100)]
target-ppc: stop translation after a trap instruction

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agoqemu-char.c: drop debug printfs from qemu_chr_parse_compat
Jan Kiszka [Mon, 18 Jan 2010 11:15:01 +0000 (12:15 +0100)]
qemu-char.c: drop debug printfs from qemu_chr_parse_compat

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agopowerpc/e500: adjust fdt and ramdisk loading addr
Liu Yu [Tue, 2 Feb 2010 08:49:03 +0000 (16:49 +0800)]
powerpc/e500: adjust fdt and ramdisk loading addr

Since kernel uimage is getting bigger,
old fixed loading bases will result in regions overlap.

Add pad for fdt and ramdisk, so that they won't overlap with uimage.

Signed-off-by: Liu Yu <yu.liu@freescale.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agopowerpc: fix compilation with CONFIG_FDT undefined
Aurelien Jarno [Sat, 27 Feb 2010 18:47:22 +0000 (19:47 +0100)]
powerpc: fix compilation with CONFIG_FDT undefined

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agopowerpc/booke: move fdt loading to rom infrastructure
Liu Yu [Tue, 2 Feb 2010 08:49:02 +0000 (16:49 +0800)]
powerpc/booke: move fdt loading to rom infrastructure

It's convinent to use rom to checking overlap, to reset etc.
And uImage and ramdisk loading has already moved to it.

Also, after we add fdt to rom, free it.

Signed-off-by: Liu Yu <yu.liu@freescale.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotarget-ppc: add synchronize register for booke init
Liu Yu [Wed, 27 Jan 2010 06:14:09 +0000 (14:14 +0800)]
target-ppc: add synchronize register for booke init

So that the following registers init could be flushed back to kvm.

Signed-off-by: Liu Yu <yu.liu@freescale.com>
Acked-by: Hollis Blanchard <hollis@penguinppc.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotarget-sh4: Fix gdb read/write register
takasi-y@ops.dti.ne.jp [Wed, 17 Feb 2010 15:53:29 +0000 (00:53 +0900)]
target-sh4: Fix gdb read/write register

cpu_gdb_read_register(): Fix n={8...15} case.
cpu_gdb_write_register(): Fix n={8...15} case and runaway "case:".

Signed-off-by: Takashi YOSHII <takasi-y@ops.dti.ne.jp>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotarget-ppc: fix SPE evsplat* instructions
Nathan Froyd [Tue, 23 Feb 2010 20:21:31 +0000 (12:21 -0800)]
target-ppc: fix SPE evsplat* instructions

The shifts in the gen_evsplat* functions were expecting rA to be masked,
not extracted, and so used the wrong shift amounts to sign-extend or pad
with zeroes.

Signed-off-by: Nathan Froyd <froydnj@codesourcery.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotarget-ppc: fix SPE evcmp* instructions
Nathan Froyd [Tue, 23 Feb 2010 19:55:14 +0000 (11:55 -0800)]
target-ppc: fix SPE evcmp* instructions

The CRF_{CH,CL,CH_OR_CL,CH_AND_CL} constants were all off by one bit
position.  Because of this, the SPE evcmp* family of instructions would
store values in the result condition register that were also off by one
bit position.

Fixed by using the CRF_{LT,GT,EQ,SO} constants for the shift amounts.

Signed-off-by: Nathan Froyd <froydnj@codesourcery.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agoarm host: Fix linker warning (m68k targets)
Stefan Weil [Tue, 23 Feb 2010 21:32:23 +0000 (22:32 +0100)]
arm host: Fix linker warning (m68k targets)

Compilation of m68k-softmmu or m68k-linux-user on arm host
(or cross compilation for arm) results in a linker warning:

  LINK  m68k-softmmu/qemu-system-m68k
m68k-dis.o: warning: definition of `floatformat_ieee_single_little' overriding common
arm-dis.o: warning: common is here
/usr/lib/gcc/arm-linux-gnueabi/4.3.2/../../../../arm-linux-gnueabi/bin/ld: Warning: size of symbol `floatformat_ieee_single_little' changed from 4 in arm-dis.o to 48 in m68k-dis.o

floatformat_ieee_single_little is declared in arm-dis.c and m68k-dis.c,
and both declarations don't match, so this is an error.

The symbol is not needed in arm-dis.c, so I removed it there.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agoFix 'make install' from non-srcdir build
Amit Shah [Fri, 26 Feb 2010 08:30:28 +0000 (14:00 +0530)]
Fix 'make install' from non-srcdir build

Commit b5ec5ce0 broke 'make install' from non source-dir build. Fix.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agoFix to 'gdb detach' stub
Daniel Gutson [Fri, 26 Feb 2010 17:13:50 +0000 (14:13 -0300)]
Fix to 'gdb detach' stub

With this patch, 'gdb detach' correctly resumes the inferior execution
after detaching the debugger.
The bug was caused by qemu asking gdb to execute a syscall (isatty)
after the detach, and then waiting (forever) for the reply. I fixed this
by properly setting gdb_syscall_mode appropriately in the 'detach'
packet handling, so subsequent syscalls are solved by qemu rather than gdb.

Signed-off-by: Daniel Gutson <dgutson@codesourcery.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agoFix qemu -net user,hostfwd= example
Aurelien Jarno [Sat, 27 Feb 2010 09:50:32 +0000 (10:50 +0100)]
Fix qemu -net user,hostfwd= example

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotcg/ppc: Fix right rotation
malc [Fri, 26 Feb 2010 22:59:47 +0000 (01:59 +0300)]
tcg/ppc: Fix right rotation

Signed-off-by: malc <av1474@comtv.ru>
14 years agotarget-sparc: fix --enable-debug build for 64 bit host
Stefan Weil [Thu, 25 Feb 2010 18:05:41 +0000 (19:05 +0100)]
target-sparc: fix --enable-debug build for 64 bit host

b551ec04ca45d1925417dd2ec7c1b7f115c84f1d fixed
the compilation for 32 bit hosts, but introduced
a new error for 64 bit hosts:

tcg_temp_new_ptr needs a matching tcg_temp_free_ptr.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoFix -usbdevice crash
Paul Brook [Thu, 25 Feb 2010 13:29:06 +0000 (13:29 +0000)]
Fix -usbdevice crash

If -usbdevice is used on a machine with no USB busses, usb_create
will fail and return NULL.  Patch below handles this failure gracefully
rather than crashing when we try to init the device.

Signed-off-by: Paul Brook <paul@codesourcery.com>
14 years agoARM defconfig fix
Paul Brook [Tue, 23 Feb 2010 23:31:53 +0000 (23:31 +0000)]
ARM defconfig fix

Tix typo in default-configs/arm-softmmu.mak

Signed-off-by: Paul Brook <paul@codesourcery.com>
14 years agotarget-alpha: Mark helper_excp as NORETURN.
Richard Henderson [Mon, 4 Jan 2010 19:25:22 +0000 (11:25 -0800)]
target-alpha: Mark helper_excp as NORETURN.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotarget-alpha: Clean up arithmetic traps.
Richard Henderson [Mon, 4 Jan 2010 19:24:04 +0000 (11:24 -0800)]
target-alpha: Clean up arithmetic traps.

Replace the EXCP_ARITH_OVERFLOW placeholder with the complete
set of bits from the EXC_SUM IPR.  Use them in the existing
places where we raise arithmetic exceptions.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotarget-alpha: Reduce internal processor registers for user-mode.
Richard Henderson [Mon, 4 Jan 2010 19:19:14 +0000 (11:19 -0800)]
target-alpha: Reduce internal processor registers for user-mode.

The existing set of IPRs is totally irrelevant to user-mode emulation.
Indeed, they most are irrelevant to implementing kernel-mode emulation,
and would only be relevant to PAL-mode emulation, which I suspect that
no one will ever attempt.

Reducing the set of processor registers reduces the size of the CPU state.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotarget-alpha: Split up FPCR value into separate fields.
Richard Henderson [Thu, 31 Dec 2009 20:41:07 +0000 (12:41 -0800)]
target-alpha: Split up FPCR value into separate fields.

The fpcr_exc_status, fpcr_exc_mask, and fpcr_dyn_round fields
are stored in <softfloat.h> format for convenience during
regular execution.

Revert the addition of float_exception_mask to float_status,
added in ba0e276db4b51bd2255a5d5ff8902c70d32ade40.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotarget-alpha: Fix gdb access to fpcr and unique.
Richard Henderson [Thu, 31 Dec 2009 19:54:01 +0000 (11:54 -0800)]
target-alpha: Fix gdb access to fpcr and unique.

cpu_gdb_read/write_register need to access the fpcr via the
cpu_alpha_load/store_fpcr functions.

The unique register is number 66 in the gdb remote protocol.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agoFix OpenBSD linker warning
Blue Swirl [Tue, 23 Feb 2010 22:01:36 +0000 (22:01 +0000)]
Fix OpenBSD linker warning

helper.o(.text+0x11e0): In function `listflags':
/src/qemu/target-i386/helper.c:661: warning: sprintf() is often misused, please use snprintf()

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoFix i386-bsd-user build
Blue Swirl [Tue, 23 Feb 2010 21:46:32 +0000 (21:46 +0000)]
Fix i386-bsd-user build

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoFix mingw32 build
Blue Swirl [Tue, 23 Feb 2010 21:46:28 +0000 (21:46 +0000)]
Fix mingw32 build

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoSimplify qemu_realloc()
Markus Armbruster [Mon, 14 Dec 2009 09:48:05 +0000 (10:48 +0100)]
Simplify qemu_realloc()

No functional change.  Bonus: looks just like qemu_malloc() now.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agopc-bios: update to latest Seabios
Anthony Liguori [Tue, 23 Feb 2010 19:35:12 +0000 (13:35 -0600)]
pc-bios: update to latest Seabios

 - 0360e8e Seabios e820 reservation portion v3
 - 7149fc8 Initial support for booting from USB drives.
 - 3c160dd Introduce helper functions for finding USB end-points.
 - 9571439 USB UHCI cleanups.
 - a4bd919 Minor - arrange struct drive_s to clarify field roles.
 - dac46b1 Fix off by one error in strtcpy.
 - d2d1de0 Don't require a valid physical cylinders/heads/spt for logical mapping.
 - 76977b2 Move common "command data block" functions to new file blockcmd.c.
 - d7e998f Dynamically allocate each drive_g with malloc_fseg().
 - 525be69 Add *.pyc to .gitignore.
 - 7d70025 Add common "block command" definitions and update cdrom code.
 - 68caaa7 Optimize ntohl() code.
 - 42157c8 Minor - sort ATA CMD definitions.
 - 54671c1 Initial support for USB hubs.
 - 7852331 Minor - increase debug level of some USB debug statements.
 - ba94a68 Don't leave USB UHCI ports disabled for extended time during reset.
 - 49a0aa6 Don't parallelize USB OHCI root port reset.
 - cfdc13f Introduce standard warnings for allocation failures and timeouts.
 - 8bbc79c Add symbolic definitions for USB delays.
 - 991eaff Support USB interrupt schedules on OHCI and UHCI.
 - 59c7574 Add some ASSERT32FLAT() to help compiler eliminate dead code.
 - e1920be seabios: acpi: fix memory leak in build_srat().
 - 84a4d4b Support USB keyboard auto-repeat.
 - bf7f1f3 mptable: Pull cpuid_signature/features setting out of loop.
 - 6f702dd Rework disabling of ps2 port irqs.
 - 2d3f0f5 Go back to using 0xf0000000 for PCI memory start.
 - 41c0957 Read APIC version from APIC instead of using a hard-coded value.
 - 7a98fd0 Work around bochs floppy issue with wait_irq().
 - 4d07902 Add CONFIG_ATA_DMA option; default to off for now.
 - 3012af1 Fix PkgLength calculation for the SSDT.
 - 92a5742 Add explicit Program Headers to linker scripts.
 - 6fc91b2 Prep version for next release.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agofix 'i' format handling in memory dump
Gleb Natapov [Sun, 21 Feb 2010 14:23:20 +0000 (16:23 +0200)]
fix 'i' format handling in memory dump

It was broken by 09b9418c6d0. (!env && !is_physical) != (!is_physical)
when env is true.

Signed-off-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agorewrote timer implementation for rtl8139.
Frediano Ziglio [Sat, 20 Feb 2010 17:50:27 +0000 (18:50 +0100)]
rewrote timer implementation for rtl8139.

Add a QEMU timer only when needed (timeout status not set, timeout
irq wanted and timer set).

This patch is required for Darwin. Patch has been tested under
FreeBSD, Darwin and Linux.

Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoqcow2: Fix image creation regression
Kevin Wolf [Tue, 23 Feb 2010 15:06:20 +0000 (16:06 +0100)]
qcow2: Fix image creation regression

When checking for errors, commit db89119d compares with the wrong values,
failing image creation even when there was no error. Additionally, if an
error has occured, we can't preallocate the image (it's likely broken).

This unbreaks test 023 of qemu-iotests.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoqcow2: More checks for qemu-img check
Kevin Wolf [Tue, 23 Feb 2010 15:40:54 +0000 (16:40 +0100)]
qcow2: More checks for qemu-img check

Implement some more refcount block related checks

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoqcow2: Rewrite alloc_refcount_block/grow_refcount_table
Kevin Wolf [Tue, 23 Feb 2010 15:40:53 +0000 (16:40 +0100)]
qcow2: Rewrite alloc_refcount_block/grow_refcount_table

The current implementation of alloc_refcount_block and grow_refcount_table has
fundamental problems regarding error handling. There are some places where an
I/O error means that the image is going to be corrupted. I have found that the
only way to fix this is to completely rewrite the thing.

In detail, the problem is that the refcount blocks itself are allocated using
alloc_refcount_noref (to avoid endless recursion when updating the refcount of
the new refcount block, which migh access just the same refcount block but its
allocation is not yet completed...). Only at the end of the refcount allocation
the refcount of the refcount block is increased. If an error happens in
between, the refcount block is in use, but has a refcount of zero and will
likely be overwritten later.

The new approach is explained in comments in the code. The trick is basically
to let new refcount blocks describe their own refcount, so their refcount will
be automatically changed when they are hooked up in the refcount table.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoqcow2: Factor next_refcount_table_size out
Kevin Wolf [Tue, 23 Feb 2010 15:40:52 +0000 (16:40 +0100)]
qcow2: Factor next_refcount_table_size out

When the refcount table grows, it doesn't only grow by one entry but reserves
some space for future refcount blocks. The algorithm to calculate the number of
entries stays the same with the fixes, so factor it out before replacing the
rest.

As Juan suggested take the opportunity to simplify the code a bit.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
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>