]> git.proxmox.com Git - mirror_qemu.git/log
mirror_qemu.git
12 years agonbd: consistently check for <0 or >=0
Paolo Bonzini [Wed, 7 Mar 2012 10:05:34 +0000 (11:05 +0100)]
nbd: consistently check for <0 or >=0

This prepares for the following patch, which changes -1 return values
to negative errno.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agonbd: consistently use ssize_t
Paolo Bonzini [Wed, 7 Mar 2012 10:25:01 +0000 (11:25 +0100)]
nbd: consistently use ssize_t

GCC (pedantically, but correctly) considers that a negative ssize_t may
become positive when casted to int.  This may cause uninitialized variable
warnings when a function returns such a negative ssize_t and is inlined.
Propagate ssize_t return types to avoid this.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agonbd: avoid out of bounds access to recv_coroutine array
Paolo Bonzini [Mon, 12 Mar 2012 14:23:13 +0000 (15:23 +0100)]
nbd: avoid out of bounds access to recv_coroutine array

This can happen with a buggy or malicious server.

Reported-by: Michael Tokarev <mjt@tls.msk.ru>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agoMerge branch 'w64' of git://qemu.weilnetz.de/qemu
Blue Swirl [Sun, 15 Apr 2012 19:56:06 +0000 (19:56 +0000)]
Merge branch 'w64' of git://qemu.weilnetz.de/qemu

* 'w64' of git://qemu.weilnetz.de/qemu:
  w64: Fix time conversion for some versions of MinGW-w64
  nbd: Fix compiler warning (w64)
  disas: Replace 'unsigned long' by 'uintptr_t'
  cpu-exec: Remove non-portable type cast and fix format string
  target-mips: Fix type cast for w64 (uintptr_t)
  w64: Fix type cast in os_host_main_loop_wait
  w64: Fix data types in softmmu*.h
  w64: Use uintptr_t in exec.c
  softmmu: Use uintptr_t for physaddr and rename it
  w64: Fix struct CPUTLBEntry
  w64: Fix definition of setjmp
  w32: Move defines for socket specific errors to qemu-os-win32.h
  w64: Use larger alignment for section with generated code
  w64: Fix data types in cpu-all.h, exec.c
  w64: Fix type casts used in some macros in cpu-all.h
  tcg/i386: Add support for w64 ABI
  tcg/i386: Use GDB JIT debugging interface only for hosts with ELF

12 years agotarget-alpha: QOM'ify CPU init
Andreas Färber [Fri, 6 Apr 2012 23:19:45 +0000 (01:19 +0200)]
target-alpha: QOM'ify CPU init

Move code from cpu_alpha_init() into a CPU initializer.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Richard Henderson <rth@twiddle.net>
12 years agotarget-alpha: QOM'ify CPU
Andreas Färber [Fri, 6 Apr 2012 17:46:48 +0000 (19:46 +0200)]
target-alpha: QOM'ify CPU

Embed CPUAlphaState as first member of AlphaCPU.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Richard Henderson <rth@twiddle.net>
12 years agow64: Fix time conversion for some versions of MinGW-w64
Stefan Weil [Thu, 12 Apr 2012 20:33:12 +0000 (22:33 +0200)]
w64: Fix time conversion for some versions of MinGW-w64

tb.time is a time value, but not necessarily of the same size as time_t:
while time_t is 64 bit for w64, tb.time still is 32 bit only.

Therefore we need en explicit conversion.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
12 years agonbd: Fix compiler warning (w64)
Stefan Weil [Thu, 12 Apr 2012 20:30:16 +0000 (22:30 +0200)]
nbd: Fix compiler warning (w64)

Portable printing of dev_offset (data type off_t) needs a type cast.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
12 years agodisas: Replace 'unsigned long' by 'uintptr_t'
Stefan Weil [Thu, 12 Apr 2012 13:44:35 +0000 (15:44 +0200)]
disas: Replace 'unsigned long' by 'uintptr_t'

This is needed for w64. It changes nothing for other hosts.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
12 years agocpu-exec: Remove non-portable type cast and fix format string
Stefan Weil [Thu, 12 Apr 2012 13:44:24 +0000 (15:44 +0200)]
cpu-exec: Remove non-portable type cast and fix format string

This change is needed for w64, but also changes the code for other hosts.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
12 years agotarget-mips: Fix type cast for w64 (uintptr_t)
Stefan Weil [Thu, 12 Apr 2012 13:43:09 +0000 (15:43 +0200)]
target-mips: Fix type cast for w64 (uintptr_t)

This changes nothing for other hosts.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
12 years agow64: Fix type cast in os_host_main_loop_wait
Stefan Weil [Thu, 12 Apr 2012 18:42:34 +0000 (20:42 +0200)]
w64: Fix type cast in os_host_main_loop_wait

Casting a pointer to an integer must use (DWORD_PTR) instead of (DWORD).
This also matches the definition of 'fd' (gint for w32, gint64 for w64).

Signed-off-by: Stefan Weil <sw@weilnetz.de>
12 years agow64: Fix data types in softmmu*.h
Stefan Weil [Thu, 12 Apr 2012 12:14:51 +0000 (14:14 +0200)]
w64: Fix data types in softmmu*.h

w64 requires uintptr_t.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
12 years agow64: Use uintptr_t in exec.c
Stefan Weil [Thu, 12 Apr 2012 13:42:19 +0000 (15:42 +0200)]
w64: Use uintptr_t in exec.c

Replace all type casts to 'long' or 'unsigned long' by 'intptr_t' or 'uintptr_t'.

For type casts which are only used to extract the lower bits of an address
or to modify those bits, signedness does not matter. There I always use 'uintptr_t'.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
12 years agosoftmmu: Use uintptr_t for physaddr and rename it
Stefan Weil [Sun, 15 Apr 2012 19:02:09 +0000 (21:02 +0200)]
softmmu: Use uintptr_t for physaddr and rename it

Variable physaddr is a host address which should be represented by
data type 'uintptr_t'.

This is needed for w64 and changes nothing for other hosts.

v2:
Rename physaddr -> hostaddr (suggested by Blue Swirl).

Signed-off-by: Stefan Weil <sw@weilnetz.de>
12 years agow64: Fix struct CPUTLBEntry
Stefan Weil [Thu, 12 Apr 2012 18:29:36 +0000 (20:29 +0200)]
w64: Fix struct CPUTLBEntry

For w64, some entries need 'uintptr_t' instead of 'unsigned long'.

For other host systems, both data types are identical, so nothing changes.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
12 years agow64: Fix definition of setjmp
Stefan Weil [Thu, 12 Apr 2012 19:13:28 +0000 (21:13 +0200)]
w64: Fix definition of setjmp

The default definition of setjmp which is implemented in MinGW-w64
cannot be used with programs like QEMU which call longjmp from
code without structured exception handling (SEH).

This code therefore disables stack unwinding.

We could also implement SEH for QEMU's generated JIT code, but
that is much more difficult. Stack unwinding would also cost
execution time.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
12 years agow32: Move defines for socket specific errors to qemu-os-win32.h
Stefan Weil [Thu, 12 Apr 2012 19:13:15 +0000 (21:13 +0200)]
w32: Move defines for socket specific errors to qemu-os-win32.h

As those defines are only used for w32,
they should be in the header file for w32.

All files which include slirp.h or qemu_socket.h also
include qemu-os-win32.h.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
12 years agow64: Use larger alignment for section with generated code
Stefan Weil [Wed, 4 Apr 2012 05:45:21 +0000 (07:45 +0200)]
w64: Use larger alignment for section with generated code

The MinGW-w64 compiler allows __attribute__((aligned (32)).

Signed-off-by: Stefan Weil <sw@weilnetz.de>
12 years agow64: Fix data types in cpu-all.h, exec.c
Stefan Weil [Fri, 16 Mar 2012 19:23:49 +0000 (20:23 +0100)]
w64: Fix data types in cpu-all.h, exec.c

w64 needs uintptr_t instead of unsigned long.
For other hosts, nothing changes.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
12 years agow64: Fix type casts used in some macros in cpu-all.h
Stefan Weil [Sun, 15 Apr 2012 13:18:29 +0000 (15:18 +0200)]
w64: Fix type casts used in some macros in cpu-all.h

Instead of type casts to long, w64 needs type casts to intptr_t.
For other hosts, this changes nothing.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
12 years agotcg/i386: Add support for w64 ABI
Stefan Weil [Thu, 12 Apr 2012 18:46:32 +0000 (20:46 +0200)]
tcg/i386: Add support for w64 ABI

w64 uses the registers rcx, rdx, r8 and r9 for function arguments,
so it needs a different declaration of tcg_target_call_iarg_regs.

rax, rcx, rdx, r8, r9, r10 and r11 may be changed by function calls.

rbx, rbp, rdi, rsi, r12, r13, r14 and r15 remain unchanged by function calls.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Stefan Weil <sw@weilnetz.de>
12 years agotcg/i386: Use GDB JIT debugging interface only for hosts with ELF
Stefan Weil [Fri, 6 Apr 2012 06:06:41 +0000 (08:06 +0200)]
tcg/i386: Use GDB JIT debugging interface only for hosts with ELF

Not all i386 / x86_64 hosts use ELF.
Ask the compiler whether ELF is used.

On w64, gdb crashes when ELF_HOST_MACHINE is defined.

Cc: Blue Swirl <blauwirbel@gmail.com>
Acked-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Stefan Weil <sw@weilnetz.de>
12 years agoMerge branch 'ppc-for-upstream' of git://repo.or.cz/qemu/agraf
Blue Swirl [Sun, 15 Apr 2012 18:39:55 +0000 (18:39 +0000)]
Merge branch 'ppc-for-upstream' of git://repo.or.cz/qemu/agraf

* 'ppc-for-upstream' of git://repo.or.cz/qemu/agraf:
  pseries: Fix reset of VIO network device
  pseries: Reset vscsi properly
  pseries: Correctly use the device model reset hooks
  pseries: Remove old hcalls hook stub
  pseries: Remove old debug leftovers from spapr_vscsi
  pseries: Fix RTAS based config access
  target-ppc/machine.c: Drop unnecessary ifdefs
  target-ppc: Init dcache and icache size for e500 user mode
  target-ppc: Fix type casts for w64 (uintptr_t)
  target-ppc: QOM'ify CPU reset
  target-ppc: Start QOM'ifying CPU init
  target-ppc: QOM'ify CPU
  target-ppc: Add hooks for handling tcg and kvm limitations
  target-ppc: Drop cpu_ppc_close()
  pseries: Consolidate hack for RTAS display-character usage
  pseries: Remove unused fields from VIOsPAPRBus structure
  pseries: Implement RTAS system-reboot call
  pseries: Fix bug with reset of VIO CRQs
  pseries: Clean up hcall_dprintf() debugging messages
  PPC: Fix TLB invalidation bug within the PPC interrupt handler.

12 years agopseries: Fix reset of VIO network device
David Gibson [Thu, 12 Apr 2012 02:44:15 +0000 (12:44 +1000)]
pseries: Fix reset of VIO network device

Currently, the PAPR VIO network device does not have a reset handler.  This
means that after a hard reset, H_REGISTER_LOGICAL_LAN will return an error
when the new guest boot attempts to initialize the device.

This patch corrects this, adding a suitable reset hook.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Andreas Färber <afaerber@suse.de>
12 years agopseries: Reset vscsi properly
David Gibson [Thu, 12 Apr 2012 02:44:14 +0000 (12:44 +1000)]
pseries: Reset vscsi properly

Currently the PAPR vscsi implementation does not properly clear its table
of request tags when the system is reset.  This patch adds a reset hook
to do so.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Andreas Färber <afaerber@suse.de>
12 years agopseries: Correctly use the device model reset hooks
David Gibson [Thu, 12 Apr 2012 02:44:13 +0000 (12:44 +1000)]
pseries: Correctly use the device model reset hooks

Recently we added code to properly clean away VIO CRQs on reset  However,
this directly uses qemu_register, rather than the existing device model
reset callbacks.  This patch cleans this up by adding proper use of the
reset hook to the VIO bus model.  The existing CRQ reset code is converted
to the new method.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Andreas Färber <afaerber@suse.de>
12 years agopseries: Remove old hcalls hook stub
David Gibson [Thu, 12 Apr 2012 02:44:12 +0000 (12:44 +1000)]
pseries: Remove old hcalls hook stub

Some time ago we removed all use of the 'hcalls' callback in the pseries
VIO code, which was used to workaround an ordering problem which has since
been solved properly.  However, the function pointer for the hook remains.
This patch cleans it away.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Andreas Färber <afaerber@suse.de>
12 years agopseries: Remove old debug leftovers from spapr_vscsi
David Gibson [Thu, 12 Apr 2012 02:44:11 +0000 (12:44 +1000)]
pseries: Remove old debug leftovers from spapr_vscsi

The PAPR VSCSI emulation contains a few lines of code which were once used
for debug but now do nothing at all.  This patch removes them.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Andreas Färber <afaerber@suse.de>
12 years agopseries: Fix RTAS based config access
David Gibson [Mon, 2 Apr 2012 04:17:35 +0000 (14:17 +1000)]
pseries: Fix RTAS based config access

On the pseries platform, access to PCI config space is via RTAS calls(
which go to the hypervisor) rather than MMIO.  This means we don't use
the same code path as nearly everyone else which goes through pci_host.c
and we're missing some of the parameter checking along the way.

We do have some parameter checking in the RTAS calls, but it's not enough.
It checks for overruns, but does not check for unaligned accesses,
oversized accesses (which means the guest could trigger an assertion
failure from pci_host_config_{read,write}_common().  Worse it doesn't do
the basic checking for the number of RTAS arguments and results before
accessing them.

This patch fixes these bugs.

Cc: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
[AF: Fix typos spotted by mst]
Signed-off-by: Andreas Färber <afaerber@suse.de>
12 years agotarget-xtensa: add license to core-fsf.c
Max Filippov [Sun, 15 Apr 2012 15:12:18 +0000 (19:12 +0400)]
target-xtensa: add license to core-fsf.c

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agotarget-xtensa: add license to core-dc232b.c
Max Filippov [Sun, 15 Apr 2012 15:12:17 +0000 (19:12 +0400)]
target-xtensa: add license to core-dc232b.c

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agotarget-xtensa: add dc233c core
Max Filippov [Sun, 15 Apr 2012 15:12:16 +0000 (19:12 +0400)]
target-xtensa: add dc233c core

This is Diamond 233L Standard Core Rev.C (LE), implemented through
linux/gdb overlay.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agolinux-user: Fix exit syscall with QOM CPU
Andreas Färber [Sun, 15 Apr 2012 16:51:01 +0000 (18:51 +0200)]
linux-user: Fix exit syscall with QOM CPU

For QOM'ified CPUs we cannot g_free() CPUArchState, we must
object_delete() the object it is embedded into.

Fixes LP#982321 (invalid free() while executing pacman with qemu-arm).

Reported-by: Serge Schneider <serge@xecdesign.com>
Reported-by: Russell Keith Davis <russell@russelldavis.org>
Signed-off-by: Andreas Färber <afaerber@suse.de>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Tested-by: Serge Schneider <serge@xecdesign.com>
Tested-by: Russell Keith Davis <russell@russelldavis.org>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agotarget-ppc/machine.c: Drop unnecessary ifdefs
Juan Quintela [Mon, 19 Mar 2012 22:57:36 +0000 (23:57 +0100)]
target-ppc/machine.c: Drop unnecessary ifdefs

machine.c is only compiled for softmmu targets, so checks for
!defined(CONFIG_USER_ONLY) are unnecessary and can be dropped.

Signed-off-by: Juan Quintela <quintela@redhat.com>
[AF: Use more verbose commit message suggested by PMM]
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Andreas Färber <afaerber@suse.de>
12 years agotarget-ppc: Init dcache and icache size for e500 user mode
Meador Inge [Tue, 10 Apr 2012 20:04:23 +0000 (15:04 -0500)]
target-ppc: Init dcache and icache size for e500 user mode

commit f7aa558396dd0f6b7a2b22c05cb503c655854102 pulled the dcache and icache
line size initialization inside of a '#if !defined(CONFIG_USER_ONLY)' block.
This is not correct because instructions like 'dcbz' need the dcache size
initialized even for user mode.

Signed-off-by: Meador Inge <meadori@codesourcery.com>
Cc: Varun Sethi <Varun.Sethi@freescale.com>
[AF: Simplify #ifdefs by using cache line size 32 for *-user as before]
Suggested-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
12 years agotarget-ppc: Fix type casts for w64 (uintptr_t)
Stefan Weil [Sun, 15 Apr 2012 14:13:48 +0000 (16:13 +0200)]
target-ppc: Fix type casts for w64 (uintptr_t)

This changes nothing for other hosts.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Andreas Färber <afaerber@suse.de>
12 years agotarget-ppc: QOM'ify CPU reset
Andreas Färber [Fri, 6 Apr 2012 13:35:34 +0000 (15:35 +0200)]
target-ppc: QOM'ify CPU reset

Move code from cpu_state_reset() into ppc_cpu_reset().
Reorder #include of helper_regs.h to use it in translate_init.c.

Adjust whitespace and add braces.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
12 years agotarget-ppc: Start QOM'ifying CPU init
Andreas Färber [Fri, 6 Apr 2012 13:09:01 +0000 (15:09 +0200)]
target-ppc: Start QOM'ifying CPU init

Move code not dependent on ppc_def_t from cpu_ppc_init() into an initfn.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
12 years agotarget-ppc: QOM'ify CPU
Andreas Färber [Fri, 6 Apr 2012 12:39:03 +0000 (14:39 +0200)]
target-ppc: QOM'ify CPU

Embed CPUPPCState as first member of PowerPCCPU.
Distinguish between "powerpc-cpu", "powerpc64-cpu" and
"embedded-powerpc-cpu".

Let CPUClass::reset() call cpu_state_reset() for now.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
12 years agotarget-ppc: Add hooks for handling tcg and kvm limitations
David Gibson [Wed, 4 Apr 2012 05:02:05 +0000 (15:02 +1000)]
target-ppc: Add hooks for handling tcg and kvm limitations

On target-ppc, our table of CPU types and features encodes the features as
found on the hardware, regardless of whether these features are actually
usable under TCG or KVM.  We already have cases where the information from
the cpu table must be fixed up to account for limitations in the emulation
method we're using.  e.g. TCG does not support the DFP and VSX instructions
and KVM needs different numbering of the CPUs in order to tell it the
correct thread to core mappings.

This patch cleans up these hacks to handle emulation limitations by
consolidating them into a pair of functions specifically for the purpose.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
[AF: Style and typo fixes, rename new functions and drop ppc_def_t arg]
Signed-off-by: Andreas Färber <afaerber@suse.de>
12 years agotarget-ppc: Drop cpu_ppc_close()
Andreas Färber [Fri, 6 Apr 2012 12:42:59 +0000 (14:42 +0200)]
target-ppc: Drop cpu_ppc_close()

It is unused, so avoid QOM'ifying it unneededly.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
12 years agopseries: Consolidate hack for RTAS display-character usage
David Gibson [Wed, 4 Apr 2012 05:02:07 +0000 (15:02 +1000)]
pseries: Consolidate hack for RTAS display-character usage

Currently the pseries machine contains not one but two somewhat ugly hacks
to allow printing of early debug messages before the guest has properly
read the device tree.

First, we special case H_PUT_TERM_CHAR so that a vtermno of 0 (usually
invalid) will look for a suitable vty and use that.  This supports Linux's
early debug code which will use H_PUT_TERM_CHAR with vtermno==0 before
reading the device tree.  Second, we support the RTAS display-character call.
This takes no vtermno so we assume the address of the default first VTY.

This patch makes things more consistent by folding the second hack into the
first.  Now, display-character uses the existing vty_lookup() function to
do the same search for a suitable VTY.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Andreas Färber <afaerber@suse.de>
12 years agopseries: Remove unused fields from VIOsPAPRBus structure
David Gibson [Wed, 4 Apr 2012 05:02:06 +0000 (15:02 +1000)]
pseries: Remove unused fields from VIOsPAPRBus structure

The VIOsPAPRBus structure, used on the pseries machine contains some old
fields which are no longer used anywhere.  This patch removes them.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Andreas Färber <afaerber@suse.de>
12 years agopseries: Implement RTAS system-reboot call
David Gibson [Wed, 28 Mar 2012 21:39:47 +0000 (08:39 +1100)]
pseries: Implement RTAS system-reboot call

This patch adds the PAPR defined RTAS system-reboot call to the pseries
machine emulation, providing the guest with a way to trigger a reboot.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Andreas Färber <afaerber@suse.de>
12 years agopseries: Fix bug with reset of VIO CRQs
David Gibson [Wed, 28 Mar 2012 21:39:46 +0000 (08:39 +1100)]
pseries: Fix bug with reset of VIO CRQs

PAPR specifies a Command Response Queue (CRQ) mechanism used for virtual
IO, which we implement.  However, we don't correctly clean up registered
CRQs when we reset the system.

This patch adds a reset handler to fix this bug.  While we're at it, add
in some of the extra debug messages that were used to track the problem
down.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
[AF: Updated hcall_dprintf()s to not duplicate the function name]
Signed-off-by: Andreas Färber <afaerber@suse.de>
12 years agopseries: Clean up hcall_dprintf() debugging messages
David Gibson [Wed, 28 Mar 2012 21:39:45 +0000 (08:39 +1100)]
pseries: Clean up hcall_dprintf() debugging messages

The pseries machine code has a number of debug messages for debugging PAPR
hypercalls, dependent on DEBUG_SPAPR_HCALLS.  This patch cleans these
messages up a bit, by adding __func__ to the hcall_dprintf() macro and
simplifying up a number of the individual messages accordingly.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Andreas Färber <afaerber@suse.de>
12 years agoPPC: Fix TLB invalidation bug within the PPC interrupt handler.
Mark Cave-Ayland [Tue, 27 Mar 2012 15:41:55 +0000 (16:41 +0100)]
PPC: Fix TLB invalidation bug within the PPC interrupt handler.

Commit 41557447d30eeb944e42069513df13585f5e6c7f also introduced a subtle TLB
flush bug. By applying a mask to the interrupt MSR which cleared the IR/DR
bits at the start of the interrupt handler, the logic towards the end of the
handler to force a TLB flush if either one of these bits were set would never
be triggered.

This patch simply changes the IR/DR bit check in the TLB flush logic to use
the original MSR value (albeit with some interrupt-specific bits cleared) so
that the IR/DR bits are preserved at the point where the check takes place.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Andreas Färber <afaerber@suse.de>
12 years agopcspk: initialize PC speaker if compiled in
Hervé Poussineau [Sat, 14 Apr 2012 20:51:33 +0000 (22:51 +0200)]
pcspk: initialize PC speaker if compiled in

PC speaker has been moved to target-independant code in 71093711589dafcb920dc3bc9bb811eaf8b14101,
so do not depend of target to include it or not.

Cc: malc <av1474@comtv.ru>
Cc: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Herv? Poussineau <hpoussin@reactos.org>
Signed-off-by: malc <av1474@comtv.ru>
12 years agotests: remove .SECONDARY special target
Paolo Bonzini [Sat, 31 Mar 2012 10:50:21 +0000 (12:50 +0200)]
tests: remove .SECONDARY special target

The special target should not be needed anymore, and caused (perhaps
due to a Make bug) a failure with "make -j2".  In any case, the
main makefile is a better place for such special targets rather
than an included makefile.

Reported-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Tested-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agotarget-xtensa: add test for IBREAK invalidation
Max Filippov [Mon, 9 Apr 2012 22:48:20 +0000 (02:48 +0400)]
target-xtensa: add test for IBREAK invalidation

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agotarget-xtensa: add tests for LBEG/LEND invalidation
Max Filippov [Mon, 9 Apr 2012 22:48:19 +0000 (02:48 +0400)]
target-xtensa: add tests for LBEG/LEND invalidation

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agotarget-xtensa: fix tb invalidation for IBREAK and LOOP
Max Filippov [Mon, 9 Apr 2012 22:48:18 +0000 (02:48 +0400)]
target-xtensa: fix tb invalidation for IBREAK and LOOP

Instruction breakpoint/zero overhead loop handling code is built into
TBs pointed to by IBREAKA/LEND SRs. When these or related SRs get
changed TBs at virtual addresses corresponding to their old and their
new values must be invalidated.

Virtual address range is passed to the tb_invalidate_phys_page_range,
which is incorrect in system emulation mode.

To fix it use guest TLB/MMU to translate virtual address to physical
address.

However the guest may not have virtual-to-physical mapping at the moment
of IBREAKA/LEND change, thus this fix is not 100% accurate.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoexec: provide tb_invalidate_phys_addr function
Max Filippov [Mon, 9 Apr 2012 22:48:17 +0000 (02:48 +0400)]
exec: provide tb_invalidate_phys_addr function

Allow TB invalidation by its physical address, extract implementation
from the breakpoint_invalidate function.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoUse uintptr_t for various op related functions
Blue Swirl [Mon, 9 Apr 2012 14:20:20 +0000 (14:20 +0000)]
Use uintptr_t for various op related functions

Use uintptr_t instead of void * or unsigned long in
several op related functions, env->mem_io_pc and
GETPC() macro.

Reviewed-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agocoroutine-gthread.c: Avoid threading APIs deprecated in GLib 2.31
Peter Maydell [Sat, 3 Mar 2012 04:52:56 +0000 (04:52 +0000)]
coroutine-gthread.c: Avoid threading APIs deprecated in GLib 2.31

The GLib threading APIs were revamped in GLib 2.31 and a number
of the old interfaces were deprecated, which means they provoke
compilation warnings (errors if -Werror) now. Add support for the
new interfaces while retaining the old ones so we can still compile
on older versions of GLib too.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoMerge branch 'xtensa' of git://jcmvbkbc.spb.ru/dumb/qemu-xtensa
Blue Swirl [Sat, 14 Apr 2012 10:56:04 +0000 (10:56 +0000)]
Merge branch 'xtensa' of git://jcmvbkbc.spb.ru/dumb/qemu-xtensa

* 'xtensa' of git://jcmvbkbc.spb.ru/dumb/qemu-xtensa:
  target-xtensa: Start QOM'ifying CPU init
  target-xtensa: QOM'ify CPU reset
  target-xtensa: QOM'ify CPU
  target-xtensa: improve unit tests debugging
  target-xtensa: Move helpers.h to helper.h

12 years agoMerge branch 'arm-devs.for-upstream' of git://git.linaro.org/people/pmaydell/qemu-arm
Blue Swirl [Sat, 14 Apr 2012 10:55:00 +0000 (10:55 +0000)]
Merge branch 'arm-devs.for-upstream' of git://git.linaro.org/people/pmaydell/qemu-arm

* 'arm-devs.for-upstream' of git://git.linaro.org/people/pmaydell/qemu-arm:
  hw/arm_gic: Remove stray hardcoded tab
  hw/arm_gic: gic_set_pending_private() is NVIC only
  hw/arm_gic: Use NVIC instead of LEGACY_INCLUDED_GIC define
  hw/arm_gic: Make gic_reset a sysbus reset function
  hw/arm11mpcore: Convert to using sysbus GIC device
  hw/exynos4210_gic: Convert to using sysbus GIC
  hw/realview_gic: switch to sysbus GIC
  hw/a9mpcore: Switch to using sysbus GIC
  hw/a15mpcore: switch to using sysbus GIC
  hw/arm_gic: Make the GIC its own sysbus device
  hw/arm_gic: Expose PPI inputs as gpio inputs
  hw/arm_gic: Move gic_get_current_cpu into arm_gic.c
  hw/arm_gic: Move NCPU definition to arm_gic.c
  hw/exynos4210_combiner.c: Drop excessive read/write access check.
  ARM: Exynos4210: Drop gic_cpu_write() after initialization.
  Fix bit test in Exynos4210 UART emulation to use & instead of &&

12 years agotarget-xtensa: Start QOM'ifying CPU init
Andreas Färber [Wed, 11 Apr 2012 16:24:50 +0000 (18:24 +0200)]
target-xtensa: Start QOM'ifying CPU init

Move XtensaConfig-independent code from cpu_xtensa_init() into a
QOM initfn, as a start.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
12 years agotarget-xtensa: QOM'ify CPU reset
Andreas Färber [Wed, 11 Apr 2012 16:24:49 +0000 (18:24 +0200)]
target-xtensa: QOM'ify CPU reset

Move code from cpu_state_reset() into QOM xtensa_cpu_reset().
To avoid moving reset_mmu() and dependencies, make it non-static.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
12 years agotarget-xtensa: QOM'ify CPU
Andreas Färber [Wed, 11 Apr 2012 16:24:48 +0000 (18:24 +0200)]
target-xtensa: QOM'ify CPU

Embed CPUXtensaState as first member of XtensaCPU.
Let CPUClass::reset() call cpu_state_reset() for now.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
12 years agotarget-xtensa: improve unit tests debugging
Max Filippov [Thu, 15 Mar 2012 21:24:57 +0000 (01:24 +0400)]
target-xtensa: improve unit tests debugging

- add testcase announcement;
- add global symbols for individual tests;
- add host-debug-* makefile target.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
12 years agotarget-xtensa: Move helpers.h to helper.h
Lluís Vilanova [Mon, 13 Feb 2012 15:33:58 +0000 (16:33 +0100)]
target-xtensa: Move helpers.h to helper.h

Provides a file naming scheme consistent with other targets.

Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
12 years agoMerge remote-tracking branch 'stefanha/trivial-patches' into staging
Anthony Liguori [Fri, 13 Apr 2012 13:04:43 +0000 (08:04 -0500)]
Merge remote-tracking branch 'stefanha/trivial-patches' into staging

* stefanha/trivial-patches:
  configure: Insist on a Python 2, not Python 3
  bsd-user: fix compile failure
  ps2: avoid repeated header file includes
  make: Always set LC_ALL=C for makeinfo
  configure: Fix wrong preprocessor statement
  configure: Remove useless uses of ARCH_CFLAGS

12 years agoMerge remote-tracking branch 'qemu-kvm/uq/master' into staging
Anthony Liguori [Fri, 13 Apr 2012 13:04:31 +0000 (08:04 -0500)]
Merge remote-tracking branch 'qemu-kvm/uq/master' into staging

* qemu-kvm/uq/master:
  kvmclock: guest stop notification
  kvm: update linux headers
  kvm: set gsi_bits and max_gsi correctly
  kvm: Drop unused kvm_pit_in_kernel
  kvm: allow arbitrarily sized mmio ioeventfd
  kvm: Drop redundant kvm_enabled from cpu_thread_is_idle
  kvm: add flightrecorder script

12 years agoMerge remote-tracking branch 'afaerber/qom-cpu-lm32.v3' into staging
Anthony Liguori [Fri, 13 Apr 2012 13:04:13 +0000 (08:04 -0500)]
Merge remote-tracking branch 'afaerber/qom-cpu-lm32.v3' into staging

* afaerber/qom-cpu-lm32.v3:
  target-lm32: QOM'ify CPU reset
  target-lm32: QOM'ify CPU init
  target-lm32: QOM'ify CPU

12 years agohw/arm_gic: Remove stray hardcoded tab
Peter Maydell [Fri, 13 Apr 2012 11:39:09 +0000 (11:39 +0000)]
hw/arm_gic: Remove stray hardcoded tab

Remove the single instance of a hardcoded tab from hw/arm_gic.c.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12 years agohw/arm_gic: gic_set_pending_private() is NVIC only
Peter Maydell [Fri, 13 Apr 2012 11:39:09 +0000 (11:39 +0000)]
hw/arm_gic: gic_set_pending_private() is NVIC only

The function gic_set_pending_private() is now used by the NVIC
only (for the GIC we now set PPI interrupts via gpio lines and
gic_set_irq()). So make it #ifdef NVIC and remove the 'attribute
unused' annotation.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12 years agohw/arm_gic: Use NVIC instead of LEGACY_INCLUDED_GIC define
Peter Maydell [Fri, 13 Apr 2012 11:39:09 +0000 (11:39 +0000)]
hw/arm_gic: Use NVIC instead of LEGACY_INCLUDED_GIC define

Now all the A profile cores have been switched to use the standalone
sysbus GIC, the only remaining code which #includes arm_gic.c is
the v7M NVIC. The coupling is much closer here so it's not so
easily disentangled. For now, add a comment about how arm_gic.c
is compiled, and assume that the NVIC always includes arm_gic.c
and the non-NVIC GIC is always compiled standalone.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12 years agohw/arm_gic: Make gic_reset a sysbus reset function
Peter Maydell [Fri, 13 Apr 2012 11:39:09 +0000 (11:39 +0000)]
hw/arm_gic: Make gic_reset a sysbus reset function

Make gic_reset a sysbus reset function, so we actually
reset the GIC on system reset rather than only at init.
For the NVIC this requires us also to implement reset
of the SysTick.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12 years agohw/arm11mpcore: Convert to using sysbus GIC device
Peter Maydell [Fri, 13 Apr 2012 11:39:08 +0000 (11:39 +0000)]
hw/arm11mpcore: Convert to using sysbus GIC device

Convert arm11mpcore to using the standalone sysbus GIC device.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12 years agohw/exynos4210_gic: Convert to using sysbus GIC
Peter Maydell [Fri, 13 Apr 2012 11:39:08 +0000 (11:39 +0000)]
hw/exynos4210_gic: Convert to using sysbus GIC

Convert the Exynos GIC code to use the standalone sysbus
GIC device.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Evgeny Voevodin <e.voevodin@samsung.com>
12 years agohw/realview_gic: switch to sysbus GIC
Peter Maydell [Fri, 13 Apr 2012 11:39:08 +0000 (11:39 +0000)]
hw/realview_gic: switch to sysbus GIC

Switch the realview_gic device to the standalone sysbus GIC.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12 years agohw/a9mpcore: Switch to using sysbus GIC
Peter Maydell [Fri, 13 Apr 2012 11:39:08 +0000 (11:39 +0000)]
hw/a9mpcore: Switch to using sysbus GIC

Switch the a9mpcore to using the sysbus GIC device rather
than having the a9mp private memory region device subclass
the GIC.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12 years agohw/a15mpcore: switch to using sysbus GIC
Peter Maydell [Fri, 13 Apr 2012 11:39:07 +0000 (11:39 +0000)]
hw/a15mpcore: switch to using sysbus GIC

Switch the a15mpcore private peripheral region to using
the standalone sysbus GIC device.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12 years agohw/arm_gic: Make the GIC its own sysbus device
Peter Maydell [Fri, 13 Apr 2012 11:39:07 +0000 (11:39 +0000)]
hw/arm_gic: Make the GIC its own sysbus device

Compile arm_gic.c as a standalone C file to produce a self contained
sysbus GIC device. Support the legacy usage by #include of the .c file
by making those users #define LEGACY_INCLUDED_GIC, so we can convert
them one by one.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Evgeny Voevodin <e.voevodin@samsung.com>
12 years agohw/arm_gic: Expose PPI inputs as gpio inputs
Peter Maydell [Fri, 13 Apr 2012 11:39:07 +0000 (11:39 +0000)]
hw/arm_gic: Expose PPI inputs as gpio inputs

Expose the Private Peripheral Interrupt inputs as GPIO inputs.
The layout of the GPIO array is thus:
  [0..N-1] SPIs
  [N..N+31] PPIs for CPU 0
  [N+32..N+63] PPIs for CPU 1
  ...

Treating PPIs as being another kind of input line is in line with the
GIC architecture specification, where they are clearly described that
way. The 11MPCore TRM is a bit more ambiguous, but there is no practical
difference between "set PPI X as pending" and "0->1 transition on a
PPI input line configured as edge triggered", and PPIs are always
edge triggered, so this change won't affect behaviour.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12 years agohw/arm_gic: Move gic_get_current_cpu into arm_gic.c
Peter Maydell [Fri, 13 Apr 2012 11:39:07 +0000 (11:39 +0000)]
hw/arm_gic: Move gic_get_current_cpu into arm_gic.c

Move the gic_get_current_cpu() function into arm_gic.c.
There are only two implementations: (1) "get the index
of the currently executing CPU", used by all multicore
GICs, and (2) "always 0", used by all GICs instantiated
with a single CPU interface (the Realview board GIC and
the v7M NVIC). So we can move this into the main GIC
source file.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Evgeny Voevodin <e.voevodin@samsung.com>
12 years agohw/arm_gic: Move NCPU definition to arm_gic.c
Peter Maydell [Fri, 13 Apr 2012 11:39:07 +0000 (11:39 +0000)]
hw/arm_gic: Move NCPU definition to arm_gic.c

Move the NCPU definition to arm_gic.c: the maximum number
of CPU interfaces is defined by the GIC architecture specification
to be 8, so we don't need to have this #define in each of the
sources files which currently includes arm_gic.c.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Evgeny Voevodin <e.voevodin@samsung.com>
12 years agohw/exynos4210_combiner.c: Drop excessive read/write access check.
Evgeny Voevodin [Fri, 13 Apr 2012 11:39:06 +0000 (11:39 +0000)]
hw/exynos4210_combiner.c: Drop excessive read/write access check.

Access to reserved area at offset higher than 0x3c is allowed in
External Combiner. Samsung Galaxy Kernel implements this. So, drop
excessive checks in read/write functions.

Signed-off-by: Evgeny Voevodin <e.voevodin@samsung.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12 years agoARM: Exynos4210: Drop gic_cpu_write() after initialization.
Evgeny Voevodin [Fri, 13 Apr 2012 11:39:06 +0000 (11:39 +0000)]
ARM: Exynos4210: Drop gic_cpu_write() after initialization.

Remove gic_cpu_write() call after initialization that was emulating
functionality of earliest SOC bootloader which enables external
GIC CPU1 interface. Instead introduce Exynos4210-specific secondary
CPU bootloader, which enables both Internal and External GIC CPU1
interfaces.

Signed-off-by: Evgeny Voevodin <e.voevodin@samsung.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12 years agoFix bit test in Exynos4210 UART emulation to use & instead of &&
Daniel P. Berrange [Fri, 13 Apr 2012 11:39:06 +0000 (11:39 +0000)]
Fix bit test in Exynos4210 UART emulation to use & instead of &&

* hw/exynos4210_uart.c: s/&&/&/

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12 years agoconfigure: Insist on a Python 2, not Python 3
Peter Maydell [Thu, 12 Apr 2012 18:09:52 +0000 (19:09 +0100)]
configure: Insist on a Python 2, not Python 3

Our Python scripts require Python 2 and will fail on Python 3, eg:
  File "/home/petmay01/linaro/qemu-from-laptop/qemu/scripts/qapi-commands.py", line 378
      except getopt.GetoptError, err:
                               ^
  SyntaxError: invalid syntax

Add a check to configure that Python is not a Python 3, so we can
fail with a comprehensible error rather than an obscure one.

Reported-by: Boris Matti <swiftos@lavabit.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
12 years agobsd-user: fix compile failure
Peter Maydell [Thu, 12 Apr 2012 11:43:41 +0000 (12:43 +0100)]
bsd-user: fix compile failure

bsd-user doesn't actually support reserving a memory area for the
guest address space, but we need to at least define the reserved_va
global so that cpu-all.h's RESERVED_VA macro will work correctly.

This fixes a compilation error introduced in commit 39879bb
which added a use of RESERVED_VA to h2g_valid().

Reported-by: Brad Smith <brad@comstyle.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
12 years agokvmclock: guest stop notification
Eric B Munson [Sat, 7 Apr 2012 00:47:47 +0000 (06:17 +0530)]
kvmclock: guest stop notification

Often when a guest is stopped from the qemu console, it will report spurious
soft lockup warnings on resume.  There are kernel patches being discussed that
will give the host the ability to tell the guest that it is being stopped and
should ignore the soft lockup warning that generates.  This patch uses the qemu
Notifier system to tell the guest it is about to be stopped.

Signed-off-by: Eric B Munson <emunson@mgebm.net>
Signed-off-by: Raghavendra K T <raghavendra.kt@linux.vnet.ibm.com>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
12 years agokvm: update linux headers
Marcelo Tosatti [Thu, 12 Apr 2012 03:43:27 +0000 (00:43 -0300)]
kvm: update linux headers

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
12 years agokvm: set gsi_bits and max_gsi correctly
Jason Baron [Wed, 28 Mar 2012 18:18:05 +0000 (14:18 -0400)]
kvm: set gsi_bits and max_gsi correctly

The current kvm_init_irq_routing() doesn't set up the used_gsi_bitmap
correctly, and as a consequence pins max_gsi to 32 when it really
should be 1024. I ran into this limitation while testing pci
passthrough, where I consistently got an -ENOSPC return from
kvm_get_irq_route_gsi() called from assigned_dev_update_msix_mmio().

Signed-off-by: Jason Baron <jbaron@redhat.com>
Acked-by: Alex Williamson <alex.williamson@redhat.com>
Acked-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
12 years agokvm: Drop unused kvm_pit_in_kernel
Jan Kiszka [Wed, 21 Mar 2012 23:00:48 +0000 (00:00 +0100)]
kvm: Drop unused kvm_pit_in_kernel

This is now implied by kvm_irqchip_in_kernel.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
12 years agokvm: allow arbitrarily sized mmio ioeventfd
Michael S. Tsirkin [Tue, 20 Mar 2012 12:31:38 +0000 (14:31 +0200)]
kvm: allow arbitrarily sized mmio ioeventfd

We use a 2 byte ioeventfd for virtio memory,
add support for this.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Amos Kong <akong@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
12 years agokvm: Drop redundant kvm_enabled from cpu_thread_is_idle
Jan Kiszka [Wed, 21 Mar 2012 12:36:22 +0000 (13:36 +0100)]
kvm: Drop redundant kvm_enabled from cpu_thread_is_idle

This is now implied by kvm_irqchip_in_kernel.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
12 years agokvm: add flightrecorder script
Stefan Hajnoczi [Fri, 9 Mar 2012 14:13:40 +0000 (14:13 +0000)]
kvm: add flightrecorder script

The kvm kernel module includes a number of trace events which can be
useful when debugging system behavior.  Even on production systems these
trace events can be used to observe guest behavior and identify the
source of problems.

The kvm_flightrecorder script is a command-line wrapper for the
/sys/kernel/debug/tracing interface.  Kernel symbols do not need to be
installed.

This script captures a fixed-size buffer of KVM trace events.  Recent
events overwrite the oldest events when the buffer size is exceeded and
it is possible to leave KVM tracing enabled for any period of time with
just a fixed-size buffer.  If the buffer is large enough this script is
a useful tool for collecting detailed information after an issue occurs
with a guest.  Hence the name "flight recorder".

The script can also be used in 'tail' mode to simply view KVM trace
events as they occur.  This is handy for development and to ensure that
the guest is indeed running.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
12 years agops2: avoid repeated header file includes
Wanpeng Li [Wed, 11 Apr 2012 01:02:21 +0000 (09:02 +0800)]
ps2: avoid repeated header file includes

Signed-off-by: Wanpeng Li <liwp@linux.vnet.ibm.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
12 years agomake: Always set LC_ALL=C for makeinfo
Stefan Weil [Tue, 27 Mar 2012 17:15:27 +0000 (19:15 +0200)]
make: Always set LC_ALL=C for makeinfo

Otherwise the generated file qemu-doc.html will contain "Anhang"
instead of "Appendix" with a German locale (de_DE.UTF-8).

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
12 years agoconfigure: Fix wrong preprocessor statement
Stefan Weil [Fri, 6 Apr 2012 19:33:20 +0000 (21:33 +0200)]
configure: Fix wrong preprocessor statement

#abort is not a preprocessor statement. It aborts, but the preprocessor
statement #error is more common to abort a compilation.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
12 years agoconfigure: Remove useless uses of ARCH_CFLAGS
Peter Maydell [Wed, 4 Apr 2012 16:03:15 +0000 (17:03 +0100)]
configure: Remove useless uses of ARCH_CFLAGS

Remove some useless uses of ARCH_CFLAGS -- this variable was never set
so will always be empty. The uses were accidental: in commit 0c439cbf8
Juan Quintela removed ARCH_CFLAGS in favour of CFLAGS (which in turn
became QEMU_CFLAGS). However in commit be17dc90 a use of it was
reintroduced (apparently accidentally) by Michael S. Tsirkin, and then
I subsequently cut-n-pasted that into a number of other configure
feature tests.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
12 years agotarget-microblaze: added PetaLogix copyright
Peter A. G. Crosthwaite [Thu, 12 Apr 2012 04:30:30 +0000 (14:30 +1000)]
target-microblaze: added PetaLogix copyright

Microblaze cpu development has been driven and funded by PetaLogix. Added (c)
PetaLogix line accordingly.

Signed-off-by: Peter A. G. Crosthwaite <peter.crosthwaite@petalogix.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
12 years agotarget-lm32: QOM'ify CPU reset
Andreas Färber [Tue, 10 Apr 2012 23:37:45 +0000 (01:37 +0200)]
target-lm32: QOM'ify CPU reset

Move code from cpu_state_reset() into QOM lm32_cpu_reset().

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Michael Walle <michael@walle.cc>
12 years agotarget-lm32: QOM'ify CPU init
Andreas Färber [Tue, 10 Apr 2012 23:33:33 +0000 (01:33 +0200)]
target-lm32: QOM'ify CPU init

Move code from cpu_lm32_init() to an initfn; call cpu_reset()
instead of cpu_state_reset().

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Michael Walle <michael@walle.cc>
12 years agotarget-lm32: QOM'ify CPU
Andreas Färber [Tue, 10 Apr 2012 23:22:08 +0000 (01:22 +0200)]
target-lm32: QOM'ify CPU

Embed CPULM32State as first member of QOM LM32CPU.
Let CPUClass::reset() call cpu_state_reset() for now.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Michael Walle <michael@walle.cc>
12 years agortl8139: do not assume TxStatus[] and TxAddr[] are adjacent
Stefan Hajnoczi [Wed, 11 Apr 2012 11:01:44 +0000 (12:01 +0100)]
rtl8139: do not assume TxStatus[] and TxAddr[] are adjacent

Commit afe0a595356192d5f79703cf6462fcc112df007c ("rtl8139: support byte
read to TxStatus registers") reused rtl8139_TxStatus_read() for reading
TxAddr registers.  It relies on the fact that TxStatus[] and TxAddr[]
are adjacent.

This causes a gcc warning because the compiler can detect that array
access is out-of-bounds:

  hw/rtl8139.c:2501:27: error: array subscript is above array bounds [-Werror=array-bounds]

This patch refactors the function so that we don't rely on out-of-bounds
accesses.

Cc: Jason Wang <jasonwang@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>