sdk/emulator/qemu.git
13 years agotarget-mips: use new float*_unordered*() functions
Aurelien Jarno [Wed, 13 Apr 2011 22:49:29 +0000 (00:49 +0200)]
target-mips: use new float*_unordered*() functions

Use the new float*_unordered*() functions from softfloat instead of
redefining a private version.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agotarget-alpha: use new float64_unordered_quiet() function
Aurelien Jarno [Wed, 13 Apr 2011 22:49:29 +0000 (00:49 +0200)]
target-alpha: use new float64_unordered_quiet() function

Use float64_unordered_quiet() in helper_cmptun() instead of doing the
the comparison manually.

According to the "Alpha Compiler Writer's Guide", we should use the
_quiet version here, as CMPTUN and CMPTEQ should generate InvalidOp
for SNaNs but not for QNaNs.

Thanks to Peter Maydell <peter.maydell@linaro.org> and Richard
Henderson <rth@twiddle.net> for digging into the manuals.

Acked-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agosoftfloat-native: add float*_unordered_quiet() functions
Aurelien Jarno [Wed, 13 Apr 2011 22:49:29 +0000 (00:49 +0200)]
softfloat-native: add float*_unordered_quiet() functions

Add float*_unordered_quiet() functions to march the softfloat versions.
As FPU status is not tracked with softfloat-native, they don't differ
from the signaling version.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agosoftfloat: add float*_unordered_{,quiet}() functions
Aurelien Jarno [Wed, 13 Apr 2011 22:49:29 +0000 (00:49 +0200)]
softfloat: add float*_unordered_{,quiet}() functions

Add float*_unordered() functions to softfloat, matching the softfloat-native
ones. Also add float*_unordered_quiet() functions to match the others
comparison functions.

This allow target-i386/ops_sse.h to be compiled with softfloat.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agotarget-i386: add floatx_{add,mul,sub} and use them
Aurelien Jarno [Wed, 13 Apr 2011 22:49:29 +0000 (00:49 +0200)]
target-i386: add floatx_{add,mul,sub} and use them

Add floatx_{add,mul,sub} defines, and use them instead of using direct
C operations.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agotarget-i386: use float unions from cpu-all.h
Aurelien Jarno [Wed, 13 Apr 2011 22:49:29 +0000 (00:49 +0200)]
target-i386: use float unions from cpu-all.h

Use float unions from cpu-all.h instead of redefining new (wrong for arm)
ones in target-i386. This also allows building cpu-exec.o with softfloat.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agotarget-i386: use CPU_LDoubleU instead of a private union
Aurelien Jarno [Wed, 13 Apr 2011 22:49:29 +0000 (00:49 +0200)]
target-i386: use CPU_LDoubleU instead of a private union

Use CPU_LDoubleU in cpu_dump_state() instead of redefining a union for
doing the conversion.

Based on a patch from Laurent Vivier <laurent@vivier.eu>.

Cc: Laurent Vivier <laurent@vivier.eu>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agocpu-all.h: define CPU_LDoubleU
Aurelien Jarno [Wed, 13 Apr 2011 22:49:29 +0000 (00:49 +0200)]
cpu-all.h: define CPU_LDoubleU

Add a CPU_LDoubleU type, matching the floatx80 definition and the long
double type on x86 hosts.

Based on a patch from Laurent Vivier <laurent@vivier.eu>.

Cc: Laurent Vivier <laurent@vivier.eu>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agosoftfloat: use GCC builtins to count the leading zeros
Aurelien Jarno [Wed, 13 Apr 2011 22:49:29 +0000 (00:49 +0200)]
softfloat: use GCC builtins to count the leading zeros

Softfloat has its own implementation to count the leading zeros. However
a lot of architectures have either a dedicated instruction or an
optimized to do that. When using GCC >= 3.4, this patch uses GCC builtins
instead of the handcoded implementation.

Note that I amware that QEMU_GNUC_PREREQ is defined in osdep.h and that
clz32() and clz64() are defined in host-utils.h, but I think it is better
to keep the softfloat implementation self contained.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agousb: fix spelling errors in usb-linux.c
Brad Hards [Wed, 13 Apr 2011 09:45:33 +0000 (19:45 +1000)]
usb: fix spelling errors in usb-linux.c

Signed-off-by: Brad Hards <bradh@frogmouth.net>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
13 years agousb: initialise data element in Linux USB_DISCONNECT ioctl
Brad Hards [Wed, 13 Apr 2011 09:45:32 +0000 (19:45 +1000)]
usb: initialise data element in Linux USB_DISCONNECT ioctl

This isn't used, but leaving it empty causes valgrind noise.

Signed-off-by: Brad Hards <bradh@frogmouth.net>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
13 years agousb: trivial spelling fixes
Brad Hards [Wed, 13 Apr 2011 09:45:31 +0000 (19:45 +1000)]
usb: trivial spelling fixes

Signed-off-by: Brad Hards <bradh@frogmouth.net>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
13 years agoMakefile: Clean up after "make pdf"
Brad Hards [Wed, 13 Apr 2011 06:42:16 +0000 (16:42 +1000)]
Makefile: Clean up after "make pdf"

Signed-off-by: Brad Hards <bradh@frogmouth.net>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
13 years agoFix some typos in comments and documentation
Stefan Weil [Wed, 13 Apr 2011 20:45:22 +0000 (22:45 +0200)]
Fix some typos in comments and documentation

helpfull -> helpful
usefull -> useful
cotrol -> control

and a grammar fix.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
13 years agomigration: move some declarations to migration.h
Blue Swirl [Sun, 3 Apr 2011 08:23:19 +0000 (08:23 +0000)]
migration: move some declarations to migration.h

Move a few migration related declarations to migration.h.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agoMove CPU related functions to cpus.h
Blue Swirl [Sun, 27 Mar 2011 16:05:08 +0000 (16:05 +0000)]
Move CPU related functions to cpus.h

Move declarations of CPU related functions to cpus.h. Adjust the only user.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agoMove clock related functions to qemu-timer.h
Blue Swirl [Sun, 27 Mar 2011 15:45:39 +0000 (15:45 +0000)]
Move clock related functions to qemu-timer.h

Move declarations for clock related functions from sysemu.h to qemu-timer.h.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agoMove generic or OS function declarations to qemu-common.h
Blue Swirl [Sun, 27 Mar 2011 09:04:57 +0000 (09:04 +0000)]
Move generic or OS function declarations to qemu-common.h

Move generic or OS related function declarations and macro
TFR to qemu-common.h.

Move win32 include directives to qemu-os-win32.h. While moving,
also add #include <winsock2.h> to fix a recent mingw32
build breakage.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agoUse qemu-common.h or qemu-timer.h in place of sysemu.h
Blue Swirl [Sun, 27 Mar 2011 14:31:31 +0000 (14:31 +0000)]
Use qemu-common.h or qemu-timer.h in place of sysemu.h

In some cases qemu-common.h or qemu-timer.h can be used in place
of sysemu.h.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agoRemove unused sysemu.h include directives
Blue Swirl [Sun, 27 Mar 2011 14:12:29 +0000 (14:12 +0000)]
Remove unused sysemu.h include directives

Remove unused sysemu.h include directives to speed up build
with the following patches.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agojson-lexer: fix conflict with mingw32 ERROR definition
Blue Swirl [Sun, 27 Mar 2011 09:07:54 +0000 (09:07 +0000)]
json-lexer: fix conflict with mingw32 ERROR definition

The name ERROR is too generic, it conflicts with mingw32 ERROR definition.

Replace ERROR with IN_ERROR.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agosparc: Fix assertion caused by empty memory slot with 0 byte
Stefan Weil [Thu, 14 Apr 2011 17:19:00 +0000 (19:19 +0200)]
sparc: Fix assertion caused by empty memory slot with 0 byte

If the memory size given on the command line is equal to the
maximum size of memory defined by the hardware, there is no
"empty slot" after physical memory.

The following command

qemu-system-sparc -m 256

raised an assertion:
exec.c:2614: cpu_register_physical_memory_offset: Assertion `size' failed

This can be fixed either at the caller side (don't call empty_slot_init)
or in empty_slot_init (do nothing) when size == 0. The second solution
was choosen here because it is more robust.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
13 years agoqemu_next_deadline should not consider host-time timers
Paolo Bonzini [Wed, 13 Apr 2011 08:03:46 +0000 (10:03 +0200)]
qemu_next_deadline should not consider host-time timers

It is purely for icount-based virtual timers.  And now that we got the
code right, rename the function to clarify the intended scope.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Tested-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
13 years agoRevert wrong fixes for -icount in the iothread case
Paolo Bonzini [Wed, 13 Apr 2011 08:03:45 +0000 (10:03 +0200)]
Revert wrong fixes for -icount in the iothread case

This reverts commits 225d02cd and c9f7383c.  While some parts of
the latter could be saved, I preferred a smooth, complete revert.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Tested-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
13 years agoenable vm_clock to "warp" in the iothread+icount case
Paolo Bonzini [Wed, 13 Apr 2011 08:03:44 +0000 (10:03 +0200)]
enable vm_clock to "warp" in the iothread+icount case

The previous patch however is not enough, because if the virtual CPU
goes to sleep waiting for a future timer interrupt to wake it up, qemu
deadlocks.  The timer interrupt never comes because time is driven by
icount, but the vCPU doesn't run any insns.

You could say that VCPUs should never go to sleep in icount
mode if there is a pending vm_clock timer; rather time should
just warp to the next vm_clock event with no sleep ever taking place.
Even better, you can sleep for some time related to the
time left until the next event, to avoid that the warps are too visible
externally; for example, you could be sending network packets continously
instead of every 100ms.

This is what this patch implements.  qemu_clock_warp is called: 1)
whenever a vm_clock timer is adjusted, to ensure the warp_timer is
synchronized; 2) at strategic points in the CPU thread, to make sure
the insn counter is synchronized before the CPU starts running.
In any case, the warp_timer is disabled while the CPU is running,
because the insn counter will then be making progress on its own.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Tested-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
13 years agoreally fix -icount in the iothread case
Paolo Bonzini [Wed, 13 Apr 2011 08:03:43 +0000 (10:03 +0200)]
really fix -icount in the iothread case

The correct fix for -icount is to consider the biggest difference
between iothread and non-iothread modes.  In the traditional model,
CPUs run _before_ the iothread calls select (or WaitForMultipleObjects
for Win32).  In the iothread model, CPUs run while the iothread
isn't holding the mutex, i.e. _during_ those same calls.

So, the iothread should always block as long as possible to let
the CPUs run smoothly---the timeout might as well be infinite---and
either the OS or the CPU thread itself will let the iothread know
when something happens.  At this point, the iothread wakes up and
interrupts the CPU.

This is exactly the approach that this patch takes: when cpu_exec_all
returns in -icount mode, and it is because a vm_clock deadline has
been met, it wakes up the iothread to process the timers.  This is
really the "bulk" of fixing icount.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Tested-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
13 years agotests/test-mmap.c: Check mmap() return value before using it
Peter Maydell [Thu, 14 Apr 2011 13:11:56 +0000 (14:11 +0100)]
tests/test-mmap.c: Check mmap() return value before using it

Correct the position of a "stop if MAP_FAILED" check in the mmap()
tests, so that if mmap() does fail we print a failure message
rather than segfaulting inside memcpy().

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
13 years agotarget-arm: Don't overflow when calculating value for signed VABAL
Peter Maydell [Mon, 11 Apr 2011 15:32:08 +0000 (16:32 +0100)]
target-arm: Don't overflow when calculating value for signed VABAL

In the VABAL instruction we take the absolute difference of two
values of size x and store it in a result of size 2x. This means
we have to be careful to calculate the absolute difference using
a wide enough type that we don't accidentally overflow.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agoRevert SeaBIOS change due to overzealous commit -a
Anthony Liguori [Wed, 13 Apr 2011 13:16:53 +0000 (08:16 -0500)]
Revert SeaBIOS change due to overzealous commit -a

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agolm32: fix build breakage due to uninitialized variable 'r'
Anthony Liguori [Wed, 13 Apr 2011 12:41:19 +0000 (07:41 -0500)]
lm32: fix build breakage due to uninitialized variable 'r'

gcc 4.5.2 correctly complains that r is potentially uninitialized in this
function.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agovpc.c: Use get_option_parameter() does the search
Mitnick Lyu [Wed, 13 Apr 2011 09:30:54 +0000 (17:30 +0800)]
vpc.c: Use get_option_parameter() does the search

Use get_option_parameter() to instead of duplicating the loop, and
use BDRV_SECTOR_SIZE to instead of 512

Signed-off-by: Mitnick Lyu <mitnick.lyu@gmail.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoatapi: GESN: implement 'media' subcommand
Amit Shah [Tue, 12 Apr 2011 16:06:07 +0000 (21:36 +0530)]
atapi: GESN: implement 'media' subcommand

Implement the 'media' sub-command of the GET_EVENT_STATUS_NOTIFICATION
command.  This helps us report tray open, tray closed, no media, media
present states to the guest.

Newer Linux kernels (2.6.38+) rely on this command to revalidate discs
after media change.

This patch also sends out tray open/closed status to the guest driver
when requested e.g. via the CDROM_DRIVE_STATUS ioctl (thanks Markus).
Without such notification, the guest and qemu's tray open/close status
was frequently out of sync, causing installers like Anaconda detecting
no disc instead of tray open, confusing them terribly.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Acked-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoatapi: GESN: Standardise event response handling for future additions
Amit Shah [Tue, 12 Apr 2011 16:06:06 +0000 (21:36 +0530)]
atapi: GESN: Standardise event response handling for future additions

Handle GET_EVENT_STATUS_NOTIFICATION's No Event Available response in a
generic way so that future additions to the code to handle other
response types is easier.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Acked-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoatapi: GESN: Use structs for commonly-used field types
Amit Shah [Tue, 12 Apr 2011 16:06:05 +0000 (21:36 +0530)]
atapi: GESN: Use structs for commonly-used field types

Instead of using magic numbers, use structs that are more descriptive of
the fields being used.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Acked-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoatapi: Move GET_EVENT_STATUS_NOTIFICATION command handling to its own function
Amit Shah [Tue, 12 Apr 2011 16:06:04 +0000 (21:36 +0530)]
atapi: Move GET_EVENT_STATUS_NOTIFICATION command handling to its own function

This makes the code more readable.

Also, there's a block like:

if () {
  ...
} else {
  ...
}

Split that into

if () {
  ...
  return;
}
...

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Acked-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoatapi: Allow GET_EVENT_STATUS_NOTIFICATION after media change
Amit Shah [Tue, 12 Apr 2011 16:06:03 +0000 (21:36 +0530)]
atapi: Allow GET_EVENT_STATUS_NOTIFICATION after media change

After a media change, the only commands allowed from the guest were
REQUEST_SENSE and INQUIRY.  The guest may also issue
GET_EVENT_STATUS_NOTIFICATION commands to get media
changed notification.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Acked-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoatapi: Report correct errors on guest eject request
Amit Shah [Sat, 9 Apr 2011 10:24:39 +0000 (15:54 +0530)]
atapi: Report correct errors on guest eject request

Table 629 of the MMC-5 spec mentions two different error conditions when
a CDROM eject is requested: a) while a disc is inserted and b) while a
disc is not inserted.

Ensure we return the appropriate error for the present condition of the
drive and disc status.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoatapi: Drives can be locked without media present
Amit Shah [Sat, 9 Apr 2011 10:24:38 +0000 (15:54 +0530)]
atapi: Drives can be locked without media present

Drivers are free to lock drives without any media present.  Such a
condition should not result in an error condition.

See Table 341 in MMC-5 spec for details.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoqed: Add support for zero clusters
Anthony Liguori [Fri, 17 Dec 2010 15:58:22 +0000 (15:58 +0000)]
qed: Add support for zero clusters

Zero clusters are similar to unallocated clusters except instead of reading
their value from a backing file when one is available, the cluster is always
read as zero.

This implements read support only.  At this stage, QED will never write a
zero cluster.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agodocs: Describe zero data clusters in QED specification
Stefan Hajnoczi [Fri, 17 Dec 2010 15:58:21 +0000 (15:58 +0000)]
docs: Describe zero data clusters in QED specification

Zero data clusters are a space-efficient way of storing zeroed regions
of the image.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agotarget-arm: Detect tininess before rounding for FP operations
Peter Maydell [Tue, 12 Apr 2011 12:56:41 +0000 (13:56 +0100)]
target-arm: Detect tininess before rounding for FP operations

The ARM architecture mandates that we detect tininess before rounding,
so set the softfloat fp_status up appropriately.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agosoftfloat: Add setter function for tininess detection mode
Peter Maydell [Tue, 12 Apr 2011 12:56:40 +0000 (13:56 +0100)]
softfloat: Add setter function for tininess detection mode

Add a setter function for the underflow tininess detection mode,
in line with the similar functions for other parts of the float status
structure.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agotarget-arm: Handle UNDEF cases for VDUP (scalar)
Juha Riihimäki [Mon, 11 Apr 2011 15:26:23 +0000 (16:26 +0100)]
target-arm: Handle UNDEF cases for VDUP (scalar)

Handle the UNDEF cases for VDUP(scalar):
 imm4 == x000
 Q == 1 && Vd<0> == 1

Signed-off-by: Juha Riihimäki <juha.riihimaki@nokia.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agotarget-arm: Treat UNPREDICTABLE VTBL, VTBX case as UNDEF
Peter Maydell [Mon, 11 Apr 2011 15:26:22 +0000 (16:26 +0100)]
target-arm: Treat UNPREDICTABLE VTBL, VTBX case as UNDEF

Catch the UNPREDICTABLE case for Neon VTBL,VTBX, and UNDEF it
rather than allowing the helper function to index off the end
of the register file.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agotarget-arm: Handle UNDEF cases for Neon 2 register misc forms
Peter Maydell [Mon, 11 Apr 2011 15:26:21 +0000 (16:26 +0100)]
target-arm: Handle UNDEF cases for Neon 2 register misc forms

Add missing UNDEF checks for Neon "two register miscellaneous" forms:
 * all instructions except VMOVN,VQMOVN must UNDEF
   if Q==1 && (Vd<0> == 1 || Vm<0> == 1)
 * VMOVN,VQMOVN,VCVT.F16.F32 UNDEF if Q == 1 || Vm<0> == 1
 * VSHLL,VCVT.F32.F16 UNDEF if Q == 1 || Vd<0> == 1
(The only other UNDEF case is VZIP,VUZP if Q == 0 && size == 10,
which we already handle.)

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agotarget-arm: Simplify checking of size field in Neon 2reg-misc forms
Peter Maydell [Mon, 11 Apr 2011 15:26:20 +0000 (16:26 +0100)]
target-arm: Simplify checking of size field in Neon 2reg-misc forms

Many of the Neon "2 register misc" instruction forms require invalid
size fields to cause the instruction to UNDEF. Pull this information
out into an array; this simplifies the code and also means we can do
the check early and avoid the problem of leaking TCG temporaries in
the illegal_op case.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agotarget-arm: Handle UNDEF cases for VEXT
Peter Maydell [Mon, 11 Apr 2011 15:26:19 +0000 (16:26 +0100)]
target-arm: Handle UNDEF cases for VEXT

VEXT must UNDEF if Q == 1 && (Vd<0> == 1 || Vr<0> == 1 || Vm<0> == 1)

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agotarget-arm: Handle UNDEF cases for Neon 2 regs + scalar forms
Peter Maydell [Mon, 11 Apr 2011 15:26:18 +0000 (16:26 +0100)]
target-arm: Handle UNDEF cases for Neon 2 regs + scalar forms

Add missing checks for cases which must UNDEF in the Neon "2 registers and
a scalar" data processing instruction space.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agotarget-arm: Handle UNDEF cases for Neon 3-regs-different-widths
Peter Maydell [Mon, 11 Apr 2011 15:26:17 +0000 (16:26 +0100)]
target-arm: Handle UNDEF cases for Neon 3-regs-different-widths

Add missing UNDEF checks for instructions in the Neon "3 registers of
different widths" data processing space.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agotarget-arm: Handle UNDEF cases for Neon invalid modified-immediates
Peter Maydell [Mon, 11 Apr 2011 15:26:16 +0000 (16:26 +0100)]
target-arm: Handle UNDEF cases for Neon invalid modified-immediates

For Neon "one register and a modified immediate value" forms, the
combination op=1 cmode=1111 is unallocated and should UNDEF.
All instructions of this form also UNDEF if Q == 1 and Vd<0> == 1.
We also add a comment on the only UNPREDICTABLE in this space.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agotarget-arm: Collapse VSRI case into VSHL, VSLI
Peter Maydell [Mon, 11 Apr 2011 15:26:15 +0000 (16:26 +0100)]
target-arm: Collapse VSRI case into VSHL, VSLI

Collapse some switch cases for VSRI into those for VSHL, VSLI,
since the bodies are the same. (This is not completely obvious
for the size < 3 case, but since for VSRI we know U=1 the
GEN_NEON_INTEGER_OP() expansion is equivalent to the open-coded
VSHL/VSLI case.)

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agotarget-arm: Handle UNDEF cases for Neon "2 regs and shift" insns
Peter Maydell [Mon, 11 Apr 2011 15:26:14 +0000 (16:26 +0100)]
target-arm: Handle UNDEF cases for Neon "2 regs and shift" insns

Correctly handle all the UNDEF cases for Neon instructions of the
"2 registers and shift" form, and make sure that we check for these
cases early enough not to leak TCG temporaries.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agotarget-arm: Simplify three-register pairwise code
Juha Riihimäki [Mon, 11 Apr 2011 15:26:13 +0000 (16:26 +0100)]
target-arm: Simplify three-register pairwise code

Since we know that the case of (pairwise && q) has been caught
earlier, we can simplify the register setup code for each pass
in the three-register-same-size Neon loop.

Signed-off-by: Juha Riihimäki <juha.riihimaki@nokia.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agotarget-arm: Handle UNDEF cases for Neon 3-regs-same insns
Peter Maydell [Mon, 11 Apr 2011 15:26:12 +0000 (16:26 +0100)]
target-arm: Handle UNDEF cases for Neon 3-regs-same insns

Correct the handling of UNDEF cases for the NEON "3 registers same
size" forms, by adding missing checks and rationalising some others
so they are done early enough to avoid leaking TCG temporaries.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agotarget-arm: Use lookup table for size check on Neon 3-reg-same insns
Peter Maydell [Mon, 11 Apr 2011 15:26:11 +0000 (16:26 +0100)]
target-arm: Use lookup table for size check on Neon 3-reg-same insns

Simplify the checks for invalid size values for the Neon "three registers
of the same size" instruction forms (and add them where they were missing)
by using a lookup table.

This includes adding symbolic constants for the op values in this space,
since we now use them in multiple places.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agofix acpi regression
Wen Congyang [Tue, 12 Apr 2011 09:27:44 +0000 (17:27 +0800)]
fix acpi regression

This bug is introduced by commit 23910d3f.

Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agoReplace cpu_physical_memory_rw were possible
Stefan Weil [Sun, 10 Apr 2011 16:23:39 +0000 (18:23 +0200)]
Replace cpu_physical_memory_rw were possible

Using cpu_physical_memory_read, cpu_physical_memory_write and ldub_phys
improves readability and allows removing some type casts.

lduw_phys and ldl_phys were not used because both require aligned
addresses. Therefore it is not possible to simply replace existing
calls by one of these functions.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agomonitor: Remove some type casts which are no longer needed
Stefan Weil [Sat, 26 Mar 2011 20:11:05 +0000 (21:11 +0100)]
monitor: Remove some type casts which are no longer needed

All other type casts in calls of cpu_physical_memory_read are
used by hardware emulations and will be fixed by separate patches.

Cc: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agoexec: Remove a type cast which is no longer needed
Stefan Weil [Sat, 26 Mar 2011 20:06:56 +0000 (21:06 +0100)]
exec: Remove a type cast which is no longer needed

All other type casts in calls of cpu_physical_memory_write are
used by hardware emulations and will be fixed by separate patches.

Cc: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agocpu-common: Modify cpu_physical_memory_read and cpu_physical_memory_write
Stefan Weil [Sun, 10 Apr 2011 15:28:56 +0000 (17:28 +0200)]
cpu-common: Modify cpu_physical_memory_read and cpu_physical_memory_write

A lot of calls don't operate on bytes but on words or on structured data.
So instead of a pointer to uint8_t, a void pointer is the better choice.

This allows removing many type casts.

(Some very early implementations of memcpy used char pointers
which were replaced by void pointers for the same reason).

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agoconfigure: disable opengl per default
Michael Walle [Sat, 9 Apr 2011 21:13:20 +0000 (23:13 +0200)]
configure: disable opengl per default

There is a bug in nvidia's binary GPU driver, which causes a segmentation
fault if linked to libGL.

Signed-off-by: Michael Walle <michael@walle.cc>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agotarget-ppc: remove #ifdef FLOAT128
Aurelien Jarno [Sun, 10 Apr 2011 19:09:12 +0000 (21:09 +0200)]
target-ppc: remove #ifdef FLOAT128

Now that PPC defaults to softfloat which always provides float128
support, there is no need to keep two version of the code, depending if
float128 support is available or not. Suggested by Peter Maydell.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agotarget-sh4: get rid of CPU_{Float,Double}U
Aurelien Jarno [Sun, 10 Apr 2011 19:09:12 +0000 (21:09 +0200)]
target-sh4: get rid of CPU_{Float,Double}U

SH4 is always using softfloat, so it's possible to have helpers directly
taking float32 or float64 value. This allow to get rid of conversions
through CPU_{Float,Double}U.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agounicore32: necessary modifications for other files to support unicore32
Guan Xuetao [Tue, 12 Apr 2011 08:27:03 +0000 (16:27 +0800)]
unicore32: necessary modifications for other files to support unicore32

Signed-off-by: Guan Xuetao <gxt@mprc.pku.edu.cn>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agounicore32: add necessry headers in linux-user/unicore32 for unicore32 support
Guan Xuetao [Tue, 12 Apr 2011 08:26:27 +0000 (16:26 +0800)]
unicore32: add necessry headers in linux-user/unicore32 for unicore32 support

Signed-off-by: Guan Xuetao <gxt@mprc.pku.edu.cn>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agounicore32: add target-unicore32 directory for unicore32-linux-user support
Guan Xuetao [Tue, 12 Apr 2011 08:25:59 +0000 (16:25 +0800)]
unicore32: add target-unicore32 directory for unicore32-linux-user support

Signed-off-by: Guan Xuetao <gxt@mprc.pku.edu.cn>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agomicroblaze: Add partial decoding of stream insns
Edgar E. Iglesias [Mon, 11 Apr 2011 22:48:33 +0000 (00:48 +0200)]
microblaze: Add partial decoding of stream insns

Based on a patch from: Alejandro Cabrera <aldaya@gmail.com>

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
13 years agomicroblaze: Add stream-insn related constants
Edgar E. Iglesias [Mon, 11 Apr 2011 22:42:28 +0000 (00:42 +0200)]
microblaze: Add stream-insn related constants

Based on a patch from: Alejandro Cabrera <aldaya@gmail.com>

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
13 years agomicroblaze: Correct ec mask in debug print
Edgar E. Iglesias [Mon, 11 Apr 2011 21:57:07 +0000 (23:57 +0200)]
microblaze: Correct ec mask in debug print

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
13 years agomicroblaze: Add constant for exception-code mask
Edgar E. Iglesias [Mon, 11 Apr 2011 21:55:42 +0000 (23:55 +0200)]
microblaze: Add constant for exception-code mask

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
13 years agomicroblaze: Correct MMU_ZONES mask
Alejandro Cabrera [Mon, 11 Apr 2011 21:07:58 +0000 (23:07 +0200)]
microblaze: Correct MMU_ZONES mask

Signed-off-by: Alejandro Cabrera <aldaya@gmail.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
13 years agoppc: remove a write-only variable
Blue Swirl [Sat, 9 Apr 2011 14:25:25 +0000 (14:25 +0000)]
ppc: remove a write-only variable

Remove a write-only variable, spotted by GCC 4.6.0:
/src/qemu/hw/ppc.c: In function 'power7_set_irq':
/src/qemu/hw/ppc.c:255:9: error: variable 'cur_level' set but not used [-Werror=unused-but-set-variable]

Acked-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agos390x: fix virtio feature bitmap
Alexander Graf [Mon, 4 Apr 2011 14:32:10 +0000 (16:32 +0200)]
s390x: fix virtio feature bitmap

The feature bitmap in the s390 virtio machine is little endian. To
address for that, we need to bswap the values after reading them out.

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agos390x: set alignment for long to 8
Alexander Graf [Mon, 4 Apr 2011 14:32:11 +0000 (16:32 +0200)]
s390x: set alignment for long to 8

The alignment for longs on s390x is 8. That's the only place where it differs
from the default alignments found in configure already. The example alignment
program from Laurent printed the following on a real s390x:

  alignof(short) 2
  alignof(int) 4
  alignof(long) 8
  alignof(long long) 8

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agomusicpal: Fix registration of MMIO-less sysbus devices
Jan Kiszka [Sun, 10 Apr 2011 07:35:42 +0000 (09:35 +0200)]
musicpal: Fix registration of MMIO-less sysbus devices

The proper way to signal that a sysbus devices need no MMIO region is to
pass -1 to sysbus_create_simple.

Signed-off-by: Jan Kiszka <jan.kiszka@web.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agoacpi, acpi_piix: factor out GPE logic
Isaku Yamahata [Fri, 25 Mar 2011 10:54:41 +0000 (19:54 +0900)]
acpi, acpi_piix: factor out GPE logic

factor out ACPI GPE logic. Later it will be used by ICH9 ACPI.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agoarm: basic support for ARMv4/ARMv4T emulation
Dmitry Eremin-Solenikov [Mon, 4 Apr 2011 13:38:44 +0000 (17:38 +0400)]
arm: basic support for ARMv4/ARMv4T emulation

Currently target-arm/ assumes at least ARMv5 core. Add support for
handling also ARMv4/ARMv4T. This changes the following instructions:

BX(v4T and later)

BKPT, BLX, CDP2, CLZ, LDC2, LDRD, MCRR, MCRR2, MRRC, MCRR, MRC2, MRRC,
MRRC2, PLD QADD, QDADD, QDSUB, QSUB, STRD, SMLAxy, SMLALxy, SMLAWxy,
SMULxy, SMULWxy, STC2 (v5 and later)

All instructions that are "v5TE and later" are also bound to just v5, as
that's how it was before.

This patch doesn _not_ include disabling of cp15 access and base-updated
data abort model (that will be required to emulate chips based on a
ARM7TDMI), because:
* no ARM7TDMI chips are currently emulated (or planned)
* those features aren't strictly necessary for my purposes (SA-1 core
  emulation).

All v5 models are handled as they are v5T. Internally we still have a
check if the model is a v5(T) or v5TE, but as all emulated cores are
v5TE, those two cases are simply aliased (for now).

Patch is heavily based on patch by Filip Navara <filip.navara@gmail.com>
which in turn is based on work by Ulrich Hecht <uli@suse.de> and Vincent
Sanders <vince@kyllikki.org>.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agoFix conversions from pointer to tcg_target_long
Stefan Weil [Sat, 2 Apr 2011 11:36:31 +0000 (13:36 +0200)]
Fix conversions from pointer to tcg_target_long

tcg_gen_exit_tb takes a parameter of type tcg_target_long,
so the type casts of pointer to long should be replaced by
type casts of pointer to tcg_target_long (suggested by Blue Swirl).

These changes are needed for build environments where
sizeof(long) != sizeof(void *), especially for w64.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agovnc: tight: Fix crash after 2GB of output
Michael Tokarev [Mon, 21 Mar 2011 08:34:35 +0000 (09:34 +0100)]
vnc: tight: Fix crash after 2GB of output

fix 2Gb integer overflow in in VNC tight and zlib encodings

As found by Roland Dreier <roland@purestorage.com> (excellent
catch!), when amount of VNC compressed data produced by zlib
and sent to client exceeds 2Gb, integer overflow occurs because
currently, we calculate amount of data produced at each step by
comparing saved total_out with new total_out, and total_out is
something which grows without bounds.  Compare it with previous
avail_out instead of total_out, and leave total_out alone.

The same code is used in vnc-enc-tight.c and vnc-enc-zlib.c,
so fix both cases.

There, there's no actual need to save previous_out value, since
capacity-offset (which is how that value is calculated) stays
the same so it can be recalculated again after call to deflate(),
but whole thing becomes less readable this way.

Reported-by: Roland Dreier <roland@purestorage.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Signed-off-by: Corentin Chary <corentin.chary@gmail.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agosmbus_eeprom: consolidate smbus eeprom creation oc pc_piix, mips_mapta, mips_fulong
Isaku Yamahata [Tue, 5 Apr 2011 02:07:06 +0000 (11:07 +0900)]
smbus_eeprom: consolidate smbus eeprom creation oc pc_piix, mips_mapta, mips_fulong

consolidate smbus initialization for pc_piix, mips_malta and mips_fulong.

Cc: Aurelien Jarno <aurelien@aurel32.net>
Cc: Huacai Chen <zltjiangshi@gmail.com>
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agolan9118: Ignore write to MAC_VLAN1 register
Atsushi Nemoto [Tue, 5 Apr 2011 14:34:04 +0000 (23:34 +0900)]
lan9118: Ignore write to MAC_VLAN1 register

On Mon, 4 Apr 2011 20:15:30 +0200, Aurelien Jarno <aurelien@aurel32.net> wrote:
> Is it really safe ignoring write to this register? If yes, it's probably
> a good idea to explain why in a comment. In any case, if supporting this
> register is easy to do, it would be the best option.

I think it is safe.  Please see an updated comment below.

And though implementing this register might be possible, I suppose it
is not worth to supporting FrameTooLong detection, for now at least.

Thank you for comments.

>8---------------------------------------------------------------------
From: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Date: Tue, 5 Apr 2011 23:12:07 +0900
Subject: [PATCH] lan9118: Ignore write to MAC_VLAN1 register

Since linux 2.6.38, smsc911x driver writes to VLAN1 registger.
Since this register only affects FrameTooLong detection, ignoring
write to this register should be safe.

Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agoacpi, acpi_piix, vt82c686: factor out PM1_CNT logic
Isaku Yamahata [Fri, 25 Mar 2011 10:54:40 +0000 (19:54 +0900)]
acpi, acpi_piix, vt82c686: factor out PM1_CNT logic

factor out ACPI PM1_CNT logic. This will be used by ich9 acpi.

Cc: Blue Swirl <blauwirbel@gmail.com>
Cc: Huacai Chen <zltjiangshi@gmail.com>
Cc: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agoacpi, acpi_piix, vt82c686: factor out PM1a EVT logic
Isaku Yamahata [Fri, 25 Mar 2011 10:54:39 +0000 (19:54 +0900)]
acpi, acpi_piix, vt82c686: factor out PM1a EVT logic

factor out ACPI PM1a EVT logic.
Later this will be used by ich9 acpi.

Cc: Blue Swirl <blauwirbel@gmail.com>
Cc: Huacai Chen <zltjiangshi@gmail.com>
Cc: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agoacpi, acpi_piix, vt82c686: factor out PM_TMR logic
Isaku Yamahata [Fri, 25 Mar 2011 10:54:38 +0000 (19:54 +0900)]
acpi, acpi_piix, vt82c686: factor out PM_TMR logic

factor out PM_TMR logic. Later This will be used by ich9 acpi.
Also fixes the same bug in vt82c686.c that was fixed by the following
commits.

> commit 055479feab63607b8042bb8ebb2e0523f17cbc4e
> Author: aliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162>
> Date:   Wed Jan 21 16:31:20 2009 +0000
>
>     Always return latest pmsts instead of the old one (Xiantao Zhang)
>
>     It may lead to the issue when booting windows guests with acpi=1
>     if return the old pmsts.
>
>     Signed-off-by: Xiantao Zhang <xiantao.zhang@intel.com>
>     Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

Cc: Blue Swirl <blauwirbel@gmail.com>
Cc: Huacai Chen <zltjiangshi@gmail.com>
Cc: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agohw/pflash_cfi02: Fix lazy reset of ROMD mode
Jordan Justen [Sun, 3 Apr 2011 20:16:26 +0000 (13:16 -0700)]
hw/pflash_cfi02: Fix lazy reset of ROMD mode

When checking pfl->rom_mode for when to lazily reenter ROMD mode,
the value was check was the opposite of what it should have been.
This prevent the part from returning to ROMD mode after a write
was made to the CFI rom region.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agoconfigure: avoid basename usage message
Scott Wood [Fri, 8 Apr 2011 19:15:50 +0000 (14:15 -0500)]
configure: avoid basename usage message

basename prints a missing-argument error when sdlconfig is empty
and we're cross-compiling.

Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
13 years agompc85xx_pci_map_irq: change "unknow" to "unknown"
Scott Wood [Fri, 8 Apr 2011 22:06:37 +0000 (17:06 -0500)]
mpc85xx_pci_map_irq: change "unknow" to "unknown"

Signed-off-by: Scott Wood <scottwood@freescale.com>
Acked-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
13 years agoevent: trivial coding style fixes
Brad Hards [Sat, 9 Apr 2011 02:11:36 +0000 (12:11 +1000)]
event: trivial coding style fixes

Signed-off-by: Brad Hards <bradh@frogmouth.net>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
13 years agomultiboot: Quote filename in error message
Adam Lackorzynski [Fri, 8 Apr 2011 06:48:42 +0000 (08:48 +0200)]
multiboot: Quote filename in error message

Quote filename in error message to spot possible whitespace character in
the filename and make error message more meaningful.

Signed-off-by: Adam Lackorzynski <adam@os.inf.tu-dresden.de>
Acked-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
13 years agoppce500_mpc8544ds: Fix compile with --enable-debug and --disable-kvm
David Gibson [Fri, 8 Apr 2011 10:08:25 +0000 (20:08 +1000)]
ppce500_mpc8544ds: Fix compile with --enable-debug and --disable-kvm

When configured with --enable-debug, we compile without optimization.
This means that the function mpc8544_copy_soc_cell() in ppce500_mpc8544ds.c
is not optimized out, even though it is never called without kvm.  That in
turn causes a link failure, because it calls the function
kvmppc_read_host_property() which is in kvm_ppc.o and therefore not
included in a --disable-kvm build.

This patch fixes the problem by providing a dummy stub for
kvmppc_read_host_property() in kvm_ppc.h when !CONFIG_KVM.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
13 years agoUse existing helper function to implement popcntd instruction
David Gibson [Tue, 5 Apr 2011 05:12:11 +0000 (15:12 +1000)]
Use existing helper function to implement popcntd instruction

The recent patches adding partial support for POWER7 cpu emulation included
implementing the popcntd instruction.  The support for this was open coded,
but host-utils.h already included a function implementing an equivalent
population count function, which uses a gcc builtin (which can use special
host instructions) if available.

This patch makes the popcntd implementation use the existing, potentially
faster, implementation.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
13 years agoDelay creation of pseries device tree until reset
David Gibson [Tue, 5 Apr 2011 05:12:10 +0000 (15:12 +1000)]
Delay creation of pseries device tree until reset

At present, the 'pseries' machine creates a flattened device tree in the
machine->init function to pass to either the guest kernel or to firmware.

However, the machine->init function runs before processing of -device
command line options, which means that the device tree so created will
be (incorrectly) missing devices specified that way.

Supplying a correct device tree is, in any case, part of the required
platform entry conditions.  Therefore, this patch moves the creation and
loading of the device tree from machine->init to a reset callback.  The
setup of entry point address and initial register state moves with it,
which leads to a slight cleanup.

This is not, alas, quite enough to make a fully working reset for pseries.
For that we would need to reload the firmware images, which on this
machine are loaded into RAM.  It's a step in the right direction, though.

Signed-off-by: David Gibson <dwg@au1.ibm.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
13 years agopseries: Abolish envs array
David Gibson [Tue, 5 Apr 2011 05:12:09 +0000 (15:12 +1000)]
pseries: Abolish envs array

Currently the pseries machine init code builds up an array, envs, of
CPUState pointers for all the cpus in the system.  This is kind of
pointless, given the generic code already has a perfectly good linked list
of the cpus.

In addition, there are a number of places which assume that the cpu's
cpu_index field is equal to its index in this array.  This is true in
practice, because cpu_index values are just assigned sequentially, but
it's conceptually incorrect and may not always be true.

Therefore, this patch abolishes the envs array, and explicitly uses the
generic cpu linked list and cpu_index values throughout.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
13 years agospapr_vscsi: Set uninitialized variable
Stefan Weil [Sun, 3 Apr 2011 16:21:24 +0000 (18:21 +0200)]
spapr_vscsi: Set uninitialized variable

cppcheck reports this error:

hw/spapr_vscsi.c:274: error: Uninitialized variable: rc

If llen == 0, rc was indeed used without being initialized.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
13 years agoDon't call cpu_synchronize_state() from machine init.
Scott Wood [Mon, 4 Oct 2010 11:15:58 +0000 (11:15 +0000)]
Don't call cpu_synchronize_state() from machine init.

This will deadlock when the I/O thread is used, since the
CPU thread is blocked waiting for qemu_system_ready.

The synchronization is unnecessary since this is before
cpu_synchronize_all_post_init().

Signed-off-by: Scott Wood <scottwood@freescale.com>
Acked-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
13 years agoMerge remote branch 'kwolf/for-anthony' into staging
Anthony Liguori [Thu, 7 Apr 2011 14:56:09 +0000 (09:56 -0500)]
Merge remote branch 'kwolf/for-anthony' into staging

13 years agovirtio-blk: fail unaligned requests
Christoph Hellwig [Wed, 6 Apr 2011 18:28:34 +0000 (20:28 +0200)]
virtio-blk: fail unaligned requests

Like all block drivers virtio-blk should not allow small than block size
granularity access.  But given that the protocol specifies a
byte unit length field we currently accept such requests, which cause
qemu to abort() in lower layers.  Add checks to the main read and
write handlers to catch them early.

Reported-by: Conor Murphy <conor_murphy_virt@hotmail.com>
Tested-by: Conor Murphy <conor_murphy_virt@hotmail.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agovirtio-balloon: fixed endianness bug in the config space
Alexey Kardashevskiy [Thu, 7 Apr 2011 03:02:04 +0000 (13:02 +1000)]
virtio-balloon: fixed endianness bug in the config space

The specification for the virtio balloon device requres that the values
in the config space be encoded little-endian.  This differs from most
virtio things, where guest-native endian is the norm.

Currently, the qemu virtio-balloon code correctly makes the conversion
on get_config(), but doesn't on set_config for the 'actual' field.  The
kernel driver, on the other hand, correctly converts when setting the
actual field, but does not convert when reading the config space.  The
upshot is that virtio-balloon will only work correctly if both host and
guest are LE, making all the conversions nops.

This patch corrects the qemu side, correctly doing host-native <-> LE
conversions when accessing the config space.  This won't break any setups
that aren't already broken, and fixes the case of BE host, LE guest.
Fixing the BE guest case will require kernel fixes as well.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
13 years agovirtio-9p: fixed LE-to-host conversion bug when QEMU is called from guest
Alexey Kardashevskiy [Thu, 7 Apr 2011 03:02:03 +0000 (13:02 +1000)]
virtio-9p: fixed LE-to-host conversion bug when QEMU is called from guest

The 9p code already contains an attempt at the necessary endian
conversions, but it's broken.

The code which does conversion from host to guest does it correctly
and this code was copied to the function which does guest to host
conversion.  However the copied code hasn't been correctly updated, so
it first endian converts some garbage on the stack and then overwrites
it with a field from incoming packet without conversion.

The patch fixes the mistakes.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
13 years agospapr_llan: Fix warning when compiled with -dDEBUG
Alexey Kardashevskiy [Thu, 7 Apr 2011 03:02:02 +0000 (13:02 +1000)]
spapr_llan: Fix warning when compiled with -dDEBUG

Compiling with the DEBUG macro causes leaves hw/spapr_llan.c with an
unused variable, which is treated as an error in the qemu build.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>