OSDN Git Service

qmiga/qemu.git
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 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>
12 years agotarget-i386: QOM'ify CPU reset
Andreas Färber [Mon, 2 Apr 2012 22:16:24 +0000 (00:16 +0200)]
target-i386: QOM'ify CPU reset

Move code from cpu_state_reset() into QOM x86_cpu_reset(),
fixing style issues for FPU init.

Signed-off-by: Andreas Färber <afaerber@suse.de>
12 years agotarget-i386: QOM'ify CPU init
Andreas Färber [Mon, 2 Apr 2012 22:00:17 +0000 (00:00 +0200)]
target-i386: QOM'ify CPU init

Move code from cpu_x86_init() to new QOM x86_cpu_initfn().
Also move mce_init() to cpu.c since it's used nowhere else.

Signed-off-by: Andreas Färber <afaerber@suse.de>
12 years agotarget-i386: QOM'ify CPU
Andreas Färber [Mon, 2 Apr 2012 21:20:08 +0000 (23:20 +0200)]
target-i386: QOM'ify CPU

Embed CPUX86State as first member of X86CPU.
Distinguish between "x86_64-cpu" and "i386-cpu".
Drop cpu_x86_close() in favor of calling object_delete() directly.

For now let CPUClass::reset() call cpu_state_reset().

Signed-off-by: Andreas Färber <afaerber@suse.de>
12 years agotarget-i386: Rename cpuid.c
Andreas Färber [Mon, 2 Apr 2012 20:22:12 +0000 (22:22 +0200)]
target-i386: Rename cpuid.c

Name it cpu.c to align with other QOM'ified targets.

Signed-off-by: Andreas Färber <afaerber@suse.de>
12 years agoMerge commit 'ff71f2e8cacefae99179993204172bc65e4303df' into staging
Anthony Liguori [Tue, 10 Apr 2012 13:21:58 +0000 (08:21 -0500)]
Merge commit 'ff71f2e8cacefae99179993204172bc65e4303df' into staging

* commit 'ff71f2e8cacefae99179993204172bc65e4303df': (21 commits)
  rtl8139: do the network/host communication only in normal operating mode
  rtl8139: correctly check the opmode
  net: move compute_mcast_idx() to net.h
  rtl8139: support byte read to TxStatus registers
  rtl8139: remove unused marco
  rtl8139: limit transmission buffer size in c+ mode
  pci_regs: Add PCI_EXP_TYPE_PCIE_BRIDGE
  virtio-net: add DATA_VALID flag
  pci_bridge: upper 32 bit are long registers
  pci: fix bridge IO/BASE
  pcie: drop functionality moved to core
  pci: set memory type for memory behind the bridge
  pci: add standard bridge device
  slotid: add slot id capability
  shpc: standard hot plug controller
  pci_bridge: user-friendly default bus name
  pci: make another unused extern function static
  pci: don't export an internal function
  pci_regs: Fix value of PCI_EXP_TYPE_RC_EC.
  pci: Do not check if a bus exist in pci_parse_devaddr.
  ...

12 years agoMerge remote-tracking branch 'qmp/queue/qmp' into staging
Anthony Liguori [Tue, 10 Apr 2012 13:17:36 +0000 (08:17 -0500)]
Merge remote-tracking branch 'qmp/queue/qmp' into staging

* qmp/queue/qmp:
  qapi: convert device_del
  qdev: qdev_unplug(): use error_set()

12 years agoMerge remote-tracking branch 'kwolf/for-anthony' into staging
Anthony Liguori [Tue, 10 Apr 2012 13:16:12 +0000 (08:16 -0500)]
Merge remote-tracking branch 'kwolf/for-anthony' into staging

* kwolf/for-anthony: (46 commits)
  qed: remove incoming live migration blocker
  qed: honor BDRV_O_INCOMING for incoming live migration
  migration: clear BDRV_O_INCOMING flags on end of incoming live migration
  qed: add bdrv_invalidate_cache to be called after incoming live migration
  blockdev: open images with BDRV_O_INCOMING on incoming live migration
  block: add a function to clear incoming live migration flags
  block: Add new BDRV_O_INCOMING flag to notice incoming live migration
  block stream: close unused files and update ->backing_hd
  qemu-iotests: Fix call syntax for qemu-io
  qemu-iotests: Fix call syntax for qemu-img
  qemu-iotests: Test unknown qcow2 header extensions
  qemu-iotests: qcow2.py
  sheepdog: fix send req helpers
  sheepdog: implement SD_OP_FLUSH_VDI operation
  block: bdrv_append() fixes
  qed: track dirty flag status
  qemu-img: add dirty flag status
  qed: image fragmentation statistics
  qemu-img: add image fragmentation statistics
  block: document job API
  ...

12 years agoMerge remote-tracking branch 'stefanha/trivial-patches' into staging
Anthony Liguori [Tue, 10 Apr 2012 13:10:41 +0000 (08:10 -0500)]
Merge remote-tracking branch 'stefanha/trivial-patches' into staging

* stefanha/trivial-patches:
  make: fix clean rule by removing build file in qom/
  configure: Link qga against UST tracing related libraries
  configure: Link QEMU against 'liburcu-bp'
  main-loop: make qemu_event_handle static
  block/curl: Replace usleep by g_usleep
  qtest: Add missing GCC_FMT_ATTR
  w32: Undefine error constants before their redefinition
  configure: fix mingw32 libs_qga typo

12 years agopetalogix_s3adsp1800: deleted bad FIXME comment
Peter A. G. Crosthwaite [Tue, 10 Apr 2012 04:05:52 +0000 (14:05 +1000)]
petalogix_s3adsp1800: deleted bad FIXME comment

This FIXME has already been actioned. Deleted comment.

Signed-off-by: Peter A. G. Crosthwaite <peter.crosthwaite@petalogix.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
12 years agoqapi: convert device_del
Luiz Capitulino [Thu, 29 Mar 2012 15:38:50 +0000 (12:38 -0300)]
qapi: convert device_del

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
12 years agoqdev: qdev_unplug(): use error_set()
Luiz Capitulino [Wed, 14 Mar 2012 20:37:38 +0000 (17:37 -0300)]
qdev: qdev_unplug(): use error_set()

It currently uses qerror_report(), but next commit will convert
the drive_del command to the QAPI and this requires using
error_set().

One particularity of qerror_report() is that it knows when it's
running on monitor context or command-line context and prints the
error message accordingly. error_set() doesn't do this, so we
have to be careful not to drop error messages.

qdev_unplug() has three kinds of usages:

 1. It's called when hot adding a device fails, to undo anything
    that has been done before hitting the error

 2. It's called by function monitor functions like device_del(),
    to unplug a device

 3. It's used by xen_platform.c in a way that doesn't _seem_ to
    be in monitor context

Only item 2 can print an error message to the user, this commit
maintains that.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
12 years agoMerge branch 'memory/core' of git://git.kernel.org/pub/scm/virt/kvm/qemu-kvm
Blue Swirl [Sun, 8 Apr 2012 18:00:42 +0000 (18:00 +0000)]
Merge branch 'memory/core' of git://git./virt/kvm/qemu-kvm

* 'memory/core' of git://git.kernel.org/pub/scm/virt/kvm/qemu-kvm:
  memory: check address space when a listener is registered
  memory: print aliased IO ranges in info mtree
  ioport: use INT64_MAX for IO ranges

12 years agoAdd QEMU_NORETURN to function cpu_io_recompile
Stefan Weil [Sat, 7 Apr 2012 15:58:34 +0000 (17:58 +0200)]
Add QEMU_NORETURN to function cpu_io_recompile

cpu_io_recompile terminates by calling either cpu_abort or
cpu_resume_from_signal which both never return.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoAdd QEMU_NORETURN to function cpu_resume_from_signal
Stefan Weil [Sat, 7 Apr 2012 15:58:33 +0000 (17:58 +0200)]
Add QEMU_NORETURN to function cpu_resume_from_signal

cpu_resume_from_signal terminates by calling longjmp.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoReplace Qemu by QEMU in comments
Stefan Weil [Sat, 7 Apr 2012 07:23:39 +0000 (09:23 +0200)]
Replace Qemu by QEMU in comments

The official spelling is QEMU.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Reviewed-by: Andreas Färber <afaerber@suse.de>
[blauwirbel@gmail.com: fixed comment style in hw/sun4m.c]
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoReplace Qemu by QEMU in w32 installation path (prefix)
Stefan Weil [Sat, 7 Apr 2012 07:23:38 +0000 (09:23 +0200)]
Replace Qemu by QEMU in w32 installation path (prefix)

The official spelling is QEMU.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoReplace Qemu by QEMU in internal documentation
Stefan Weil [Sat, 7 Apr 2012 07:23:37 +0000 (09:23 +0200)]
Replace Qemu by QEMU in internal documentation

The official spelling is QEMU.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoReplace Qemu by QEMU in user visible documentation
Stefan Weil [Sat, 7 Apr 2012 07:23:36 +0000 (09:23 +0200)]
Replace Qemu by QEMU in user visible documentation

The official spelling is QEMU.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoremove useless comments in dma
Wanpeng Li [Fri, 6 Apr 2012 07:52:09 +0000 (15:52 +0800)]
remove useless comments in dma

This comment is useless, just removes it and makes the codes clear.

Signed-off-by: Wanpeng Li <liwp@linux.vnet.ibm.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agotci: Support targets with CONFIG_TCG_PASS_AREG0 (fix broken build)
Stefan Weil [Sat, 7 Apr 2012 09:48:39 +0000 (11:48 +0200)]
tci: Support targets with CONFIG_TCG_PASS_AREG0 (fix broken build)

Builds with --enable-tcg-interpreter failed because more and more
targets (currently alpha and sparc) replaced the global env in AREG0
by function parameters.

Convert the TCG interpreter to use the new helper functions and add
defines for those targets which still use AREG0.

Cc: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoMerge branch 'linux-user-for-upstream' of git://git.linaro.org/people/rikuvoipio...
Blue Swirl [Sat, 7 Apr 2012 11:45:25 +0000 (11:45 +0000)]
Merge branch 'linux-user-for-upstream' of git://git.linaro.org/people/rikuvoipio/qemu

* 'linux-user-for-upstream' of git://git.linaro.org/people/rikuvoipio/qemu:
  Userspace ARM BE8 support
  elf.h: Update EF_ARM_ constants to newer ABI versions
  arm-linux-user: fix elfload.c's AT_HWCAP to reflect cpu features.
  linux-user/arm/syscall_nr.h: Add syscall number for ppoll
  linux-user: Add support for prctl PR_GET_NAME and PR_SET_NAME
  linux-user/syscall.c: Fix indentation in prctl handling
  linux-user: reserve 4GB of vmem for 32-on-64
  linux-user: resolve reserved_va vma downwards
  linux-user: take RESERVED_VA into account for g2h_valid()
  linux-user: fix fallocate
  linux-user: Add ioctl for BLKBSZGET
  linux-user: add BLKSSZGET ioctl wrapper
  linux-user: fix BLK ioctl arguments
  linux-user: add struct old_dev_t compat
  linux-user: implement device mapper ioctls
  linux-user: target_argv is placed on ts->bprm->argv and can't be freed()
  linux-user: improve fake /proc/self/stat making `ps` not segfault.

12 years agow64: Fix data type of tb_next and other variables used for host addresses
Stefan Weil [Fri, 6 Apr 2012 20:26:15 +0000 (22:26 +0200)]
w64: Fix data type of tb_next and other variables used for host addresses

QEMU host addresses must use uintptr_t to be portable for hosts with
an unusual size of long (w64).

tb_jmp_offset is an uint16_t value, therefore the local variable offset
in function tb_set_jmp_target was changed from unsigned long to uint16_t.

The type cast to long in function tb_add_jump now also uses uintptr_t.
For the bit operation used here, the signedness of the type cast does
not matter.

Some remaining unsigned long values are either only used for ARM assembler
code or will be fixed in a later patch for PPC.

v2:
Fix signature of tb_find_pc in exec.c, too (hint from Blue Swirl, thanks).
There remain lots of other long / unsigned long in exec.c which must be
replaced by uintptr_t. This will be done in a separate patch. Here
only one of these type casts is fixed.

v3:
Also fix signature of page_unprotect.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agosoftfloat: roundAndPackInt{32, 64}: Don't assume int32 is 32 bits
Peter Maydell [Thu, 5 Apr 2012 18:12:35 +0000 (19:12 +0100)]
softfloat: roundAndPackInt{32, 64}: Don't assume int32 is 32 bits

Fix code in roundAndPackInt32 that assumed that int32 was only
32 bits, by simply using int32_t instead. Fix the parallel bug
in roundAndPackInt64 as well, although that one is only theoretical
since it's unlikely that int64 will ever be more than 64 bits.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agosoftfloat: float*_to_int32_round_to_zero: don't assume int32 is 32 bits
Peter Maydell [Thu, 5 Apr 2012 18:12:34 +0000 (19:12 +0100)]
softfloat: float*_to_int32_round_to_zero: don't assume int32 is 32 bits

Code in the float64_to_int32_round_to_zero() function was assuming
that int32 would not be wider than 32 bits; this meant it might
not correctly detect the overflow case. We take the simple approach
of using int32_t. Also fix equivalent issues in the functions
for other float sizes.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoconfigure: require glib 2.12, 2.20 for mingw32
Paolo Bonzini [Thu, 5 Apr 2012 11:01:54 +0000 (13:01 +0200)]
configure: require glib 2.12, 2.20 for mingw32

These are pretty sane requirements to move forward with glib usage.
2.12 is the version found in RHEL/CentOS 5, and 2.20 is the
first version to support g_poll.  Without g_poll, we cannot
integrate well with the glib main loop.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agomain-loop: integrate glib sources for w32
Paolo Bonzini [Tue, 20 Mar 2012 09:49:21 +0000 (10:49 +0100)]
main-loop: integrate glib sources for w32

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agomain-loop: replace WaitForMultipleObjects with g_poll
Paolo Bonzini [Tue, 20 Mar 2012 09:49:20 +0000 (10:49 +0100)]
main-loop: replace WaitForMultipleObjects with g_poll

On w32, glib implements g_poll using WaitForMultipleObjects
or MsgWaitForMultipleObjects.  This means that we can simplify
our code by switching to g_poll, and at the same time prepare for
adding back glib sources.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agomain-loop: interrupt wait when data arrives on a socket
Paolo Bonzini [Tue, 20 Mar 2012 09:49:19 +0000 (10:49 +0100)]
main-loop: interrupt wait when data arrives on a socket

Right now, the main loop is not interrupted when data arrives on a
socket.  To fix this, register each socket to interrupt the main loop
with WSAEventSelect.  This does not replace select, it only communicates
a change in socket state that requires a select call.

Since the interrupt fires only once per recv call, or only once
after a send call returns EWOULDBLOCK we can activate it on all events
unconditionally.  If QEMU is momentarily uninterested on some condition,
the main loop will not busy wait.  Instead, it may get one extra wakeup,
but then it will ignore the condition until progress occurs and/or
qemu_set_fd_handler is called to set a callback.  At this point the
condition will be tested via select and the callback will be invoked
even if it is still disabled on the event.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agomain-loop: disable fd_set-based glib integration under w32
Paolo Bonzini [Tue, 20 Mar 2012 09:49:18 +0000 (10:49 +0100)]
main-loop: disable fd_set-based glib integration under w32

Using select with glib pollfds is wrong under w32.  Restrict
the code to the POSIX case.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agomain loop: use msec-based timeout in glib_select_fill
Paolo Bonzini [Tue, 20 Mar 2012 09:49:17 +0000 (10:49 +0100)]
main loop: use msec-based timeout in glib_select_fill

The timeval-based timeout is not needed until we actually invoke select,
so compute it only then.  Also group the two calls that modify the
timeout, glib_select_fill and os_host_main_loop_wait.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agotarget-sparc: QOM'ify CPU
Andreas Färber [Wed, 4 Apr 2012 23:29:40 +0000 (01:29 +0200)]
target-sparc: QOM'ify CPU

Embed CPUSPARCState as first member of SPARCCPU.
Drop cpu_sparc_close() in favor of object_delete() and a finalizer.
Let cpu_state_reset() call cpu_reset().

Make TYPE_SPARC_CPU non-abstract for now.
Distinguish between "sparc-cpu" and "sparc64-cpu".

Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agotarget-sparc: Rename cpu_init.c
Andreas Färber [Wed, 4 Apr 2012 23:29:39 +0000 (01:29 +0200)]
target-sparc: Rename cpu_init.c

Align QOM'ified targets, with a view to simplify Makefile.target.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoUserspace ARM BE8 support
Paul Brook [Fri, 30 Mar 2012 17:02:50 +0000 (18:02 +0100)]
Userspace ARM BE8 support

Add support for ARM BE8 userspace binaries.
i.e. big-endian data and little-endian code.
In principle LE8 mode is also possible, but AFAIK has never actually
been implemented/used.

System emulation doesn't have any useable big-endian board models,
but should in principle work once you fix that.
Dynamic endianness switching requires messing with data accesses,
preferably with TCG cooperation, and is orthogonal to BE8 support.

Signed-off-by: Paul Brook <paul@codesourcery.com>
[PMM: various changes, mostly as per my suggestions in code review:
 * rebase
 * use EF_ defines rather than hardcoded constants
 * make bswap_code a bool for future VMSTATE macro compatibility
 * update comment in cpu.h about TB flags bit field usage
 * factor out load-code-and-swap into arm_ld*_code functions and
   get_user_code* macros
 * fix stray trailing space at end of line
 * added braces in disas.c to satisfy checkpatch
]
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
12 years agoelf.h: Update EF_ARM_ constants to newer ABI versions
Peter Maydell [Fri, 30 Mar 2012 17:02:49 +0000 (18:02 +0100)]
elf.h: Update EF_ARM_ constants to newer ABI versions

Update the EF_ARM_* constants (for the ELF header e_flags field)
to include the newer flags specified for later versions of the ABI.
(This set of constants is from include/elf/arm.h from binutils-2.17
and so licensed under GPL-v2-or-later.)

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
12 years agoarm-linux-user: fix elfload.c's AT_HWCAP to reflect cpu features.
Benoit Canet [Wed, 9 Nov 2011 03:37:23 +0000 (03:37 +0000)]
arm-linux-user: fix elfload.c's AT_HWCAP to reflect cpu features.

The cpu capabilities passed by the elf loader in AT_HWCAP where
a constant.
Make AT_HWCAP reflect the emulated cpu features in order to give
correct clues to eglibc.

Riku Voipio: fixed to apply to current head

Fix :  [Bug 887516] [NEW] VFP support reported for the PXA270

Signed-off-by: Benoit Canet <benoit.canet@gmail.com>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
12 years agolinux-user/arm/syscall_nr.h: Add syscall number for ppoll
Peter Maydell [Fri, 16 Mar 2012 17:16:36 +0000 (17:16 +0000)]
linux-user/arm/syscall_nr.h: Add syscall number for ppoll

The list of ARM syscall numbers was missing the entry for ppoll,
which meant we were accidentally not providing it. (This wasn't
causing any practical issues beyond warnings about unimplemented
syscalls, because glibc will fall back to another code path if the
syscall isn't present.)

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
12 years agolinux-user: Add support for prctl PR_GET_NAME and PR_SET_NAME
Peter Maydell [Fri, 3 Feb 2012 14:48:03 +0000 (14:48 +0000)]
linux-user: Add support for prctl PR_GET_NAME and PR_SET_NAME

Add support for the prctl options PR_GET_NAME and PR_SET_NAME,
which take or return a name in a 16 byte buffer pointed to by arg2.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
12 years agolinux-user/syscall.c: Fix indentation in prctl handling
Peter Maydell [Fri, 3 Feb 2012 14:48:03 +0000 (14:48 +0000)]
linux-user/syscall.c: Fix indentation in prctl handling

Clean up the odd indentation of this switch statement before
we double its size by adding new cases to it.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
12 years agolinux-user: reserve 4GB of vmem for 32-on-64
Alexander Graf [Tue, 13 Dec 2011 23:33:28 +0000 (00:33 +0100)]
linux-user: reserve 4GB of vmem for 32-on-64

When running 32-on-64 bit guests, we should always reserve as much
virtual memory as we possibly can for the guest process, so it can
never overlap with QEMU address space.

Fortunately we already have the infrastructure for that. All that's
missing is some sane default value to also make use of it!

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
12 years agolinux-user: resolve reserved_va vma downwards
Peter Maydell [Thu, 8 Mar 2012 14:40:33 +0000 (14:40 +0000)]
linux-user: resolve reserved_va vma downwards

After consulting with Paul Brook, we concluded that it's best to search
the VMA space downwards, so that we don't even get the chance to conflict
with the brk range.

This patch resolves a bunch of allocation conflicts when using -R.

Signed-off-by: Alexander Graf <agraf@suse.de>
[minor changes to get it to apply -- PMM]

Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
12 years agolinux-user: take RESERVED_VA into account for g2h_valid()
Alexander Graf [Thu, 2 Feb 2012 02:14:18 +0000 (03:14 +0100)]
linux-user: take RESERVED_VA into account for g2h_valid()

When running with -R (RESERVED_VA > 0) all guest virtual addresses
are within the [0..RESERVED_VA] range. Reflect this with g2h_valid()
too so we can safely check for boundaries of our guest address space.

This is required to have the /proc/self/maps code not show maps that
aren't accessible from the guest process's point of view.

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
12 years agolinux-user: fix fallocate
Alexander Graf [Mon, 6 Feb 2012 20:37:07 +0000 (21:37 +0100)]
linux-user: fix fallocate

Fallocate gets off_t parameters passed in, so we should also read them out
accordingly.

Signed-off-by: Alexander Graf <agraf@suse.de>
---

v1 -> v2:

  - unbreak 64-bit guests

Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
12 years agolinux-user: Add ioctl for BLKBSZGET
Alexander Graf [Thu, 2 Feb 2012 01:22:34 +0000 (02:22 +0100)]
linux-user: Add ioctl for BLKBSZGET

This patch adds the ioctl wrapper definition for BLKBSZGET.

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
12 years agolinux-user: add BLKSSZGET ioctl wrapper
Alexander Graf [Tue, 31 Jan 2012 19:11:37 +0000 (20:11 +0100)]
linux-user: add BLKSSZGET ioctl wrapper

This patch adds an ioctl definition for BLKSSZGET.

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
12 years agolinux-user: fix BLK ioctl arguments
Alexander Graf [Tue, 31 Jan 2012 19:10:20 +0000 (20:10 +0100)]
linux-user: fix BLK ioctl arguments

Some BLK ioctls passed sizeof(x) into a macro that already did sizeof() on
the passed in argument, rendering the size information inside the ioctl be
the size of the host default integer type.

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
12 years agolinux-user: add struct old_dev_t compat
Alexander Graf [Tue, 31 Jan 2012 18:44:41 +0000 (19:44 +0100)]
linux-user: add struct old_dev_t compat

The compat LOOP_SET_STATUS ioctl uses struct old_dev_t in its passed
struct. That variable type is vastly different between different
architectures. Implement wrapping around it so we can use it.

This fixes running arm kpartx on an x86_64 host for me.

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
12 years agolinux-user: implement device mapper ioctls
Alexander Graf [Tue, 31 Jan 2012 17:42:06 +0000 (18:42 +0100)]
linux-user: implement device mapper ioctls

This patch implements all ioctls currently implemented by device mapper,
enabling us to run dmsetup and kpartx inside of linux-user.

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>