sdk/emulator/qemu.git
11 years agoPPC: Macio: Replace tabs with spaces
Alexander Graf [Sat, 29 Jun 2013 23:43:17 +0000 (01:43 +0200)]
PPC: Macio: Replace tabs with spaces

s/^I/        /g on the file.

Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agoPPC: g3beige: Move secondary IDE bus to mac-io
Alexander Graf [Mon, 24 Jun 2013 19:40:50 +0000 (21:40 +0200)]
PPC: g3beige: Move secondary IDE bus to mac-io

On a real G3 Beige the secondary IDE bus lives on the mac-io chip, not
on some random PCI device. Move it there to become more compatible.

While at it, also clean up the IDE channel connection logic.

Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agoPPC: Mac: Fix guest exported tbfreq values
Alexander Graf [Sat, 29 Jun 2013 15:34:58 +0000 (17:34 +0200)]
PPC: Mac: Fix guest exported tbfreq values

We can tell the guest the frequency of its time base through fwcfg.

However, we tell it a different value from the speed tb actually runs
at. Let's fix it and make the tbfreq initialization and the fwcfg exposure
use the same values.

Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agotarget-ppc: Add POWER8 v1.0 CPU model
Prerna Saxena [Thu, 4 Jul 2013 06:42:32 +0000 (12:12 +0530)]
target-ppc: Add POWER8 v1.0 CPU model

This patch adds CPU PVR definition for POWER8,
and enables QEMU to launch guests on POWER8 hardware.

Signed-off-by: Prerna Saxena <prerna@linux.vnet.ibm.com>
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Reviewed-by: Paul Mackerras <paulus@samba.org>
Reviewed-by: Andreas Farber <afaerber@suse.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agopseries: move interrupt controllers to hw/intc/
Alexey Kardashevskiy [Sat, 6 Jul 2013 13:53:58 +0000 (23:53 +1000)]
pseries: move interrupt controllers to hw/intc/

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agospapr: Respect -bios command line option for SLOF
Andreas Färber [Wed, 3 Jul 2013 19:26:50 +0000 (21:26 +0200)]
spapr: Respect -bios command line option for SLOF

Allow the user to override the firmware file name rather than always
using "slof.bin".

Reported-by: Dinar Valeev <k0da@opensuse.org>
Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agospapr: Use named enum for function remove_hpte
Stefan Weil [Mon, 24 Jun 2013 17:48:47 +0000 (19:48 +0200)]
spapr: Use named enum for function remove_hpte

The function returned a target_ulong which was made from unnamed enum
values. The target_ulong was then assigned to an int variable which
was used in a switch statement.

Using a named enum in both cases makes reviews easier.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agospapr: Fix compiler warnings for some versions of gcc
Stefan Weil [Sat, 29 Jun 2013 13:47:26 +0000 (15:47 +0200)]
spapr: Fix compiler warnings for some versions of gcc

i686-w64-mingw32-gcc (GCC) 4.6.3 from Debian wheezy reports these warnings:

hw/ppc/spapr_hcall.c:188:1: warning:
 control reaches end of non-void function [-Wreturn-type]

hw/ppc/spapr_pci.c:454:1: warning:
 control reaches end of non-void function [-Wreturn-type]

Both warnings are fixed by using g_assert_not_reached instead of assert.
A second line with assert(0) in spapr_pci.c which did not raise a compiler
warning was modified, too, because g_assert_not_reached documents the
purpose of that statement and is not removed in release builds.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agoe600 core for MPC86xx processors
Julio Guerra [Mon, 24 Jun 2013 21:15:54 +0000 (23:15 +0200)]
e600 core for MPC86xx processors

MPC86xx processors are based on the e600 core, which is not the case
in qemu where it is based on the 7400 processor.

This patch creates the e600 core and instantiates the MPC86xx
processors based on it. Therefore, adding the high BATs, the SPRG
4..7 registers, which are e600-specific [1], and a HW MMU model (as 7400).
This allows to define the MPC8610 processor too.

Tested with a kernel using the HW TLB misses.

[1] http://cache.freescale.com/files/32bit/doc/ref_manual/E600CORERM.pdf

Signed-off-by: Julio Guerra <guerr@julio.in>
Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agoMerge remote-tracking branch 'luiz/queue/qmp' into staging
Anthony Liguori [Wed, 10 Jul 2013 19:34:32 +0000 (14:34 -0500)]
Merge remote-tracking branch 'luiz/queue/qmp' into staging

# By Kevin Wolf (4) and others
# Via Luiz Capitulino
* luiz/queue/qmp:
  add timestamp to error_report()
  qapi-schema: Use existing type for drive-backup arguments
  qapi-schema: Use BlockdevSnapshot type for blockdev-snapshot-sync
  qapi.py: Allow top-level type reference for command definitions
  qapi.py: Avoid code duplication
  qemu-char: Fix ringbuf option size

Message-id: 1373478767-20965-1-git-send-email-lcapitulino@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoadd timestamp to error_report()
Seiji Aguchi [Thu, 4 Jul 2013 03:02:46 +0000 (23:02 -0400)]
add timestamp to error_report()

[Issue]
When we offer a customer support service and a problem happens
in a customer's system, we try to understand the problem by
comparing what the customer reports with message logs of the
customer's system.

In this case, we often need to know when the problem happens.

But, currently, there is no timestamp in qemu's error messages.
Therefore, we may not be able to understand the problem based on
error messages.

[Solution]
Add a timestamp to qemu's error message logged by
error_report() with g_time_val_to_iso8601().

Signed-off-by: Seiji Aguchi <seiji.aguchi@hds.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
11 years agoqapi-schema: Use existing type for drive-backup arguments
Kevin Wolf [Tue, 9 Jul 2013 08:05:35 +0000 (10:05 +0200)]
qapi-schema: Use existing type for drive-backup arguments

This removes duplicated definitions and documentation by reusing the
existing data type.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
11 years agoqapi-schema: Use BlockdevSnapshot type for blockdev-snapshot-sync
Kevin Wolf [Mon, 1 Jul 2013 14:31:52 +0000 (16:31 +0200)]
qapi-schema: Use BlockdevSnapshot type for blockdev-snapshot-sync

We don't have to duplicate the definition any more now that we may refer
to a type instead.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
11 years agoqapi.py: Allow top-level type reference for command definitions
Kevin Wolf [Mon, 1 Jul 2013 14:31:51 +0000 (16:31 +0200)]
qapi.py: Allow top-level type reference for command definitions

If 'data' for a command definition isn't a dict, but a string, it is
taken as a (struct) type name and the fields of this struct are directly
used as parameters.

This is useful for transactionable commands that can use the same type
definition for both the transaction action and the arguments of the
standalone command.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
11 years agoqapi.py: Avoid code duplication
Kevin Wolf [Mon, 1 Jul 2013 14:31:50 +0000 (16:31 +0200)]
qapi.py: Avoid code duplication

The code that interprets the read JSON expression and appends types to
the respective global variables was duplicated. We can avoid that by
splitting off the part that reads from the file.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
11 years agoqemu-char: Fix ringbuf option size
Markus Armbruster [Thu, 27 Jun 2013 14:22:07 +0000 (16:22 +0200)]
qemu-char: Fix ringbuf option size

Any attempt to use it trips an "opt->desc->type == QEMU_OPT_NUMBER"
assertion.  Broken in commit 1da48c65.

Cc: qemu-stable@nongnu.org
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
11 years agoMerge remote-tracking branch 'afaerber/tags/qom-cpu-for-anthony' into staging
Anthony Liguori [Wed, 10 Jul 2013 15:54:16 +0000 (10:54 -0500)]
Merge remote-tracking branch 'afaerber/tags/qom-cpu-for-anthony' into staging

QOM CPUState refactorings

* Fix for OpenRISCCPU subclasses
* Fix for gdbstub CPU selection
* Move linux-user CPU functions into new header
* CPUState part 10 refactoring: first_cpu, next_cpu, cpu_single_env et al.
* Fix some targets to consistently inline TCG code generation
* Centrally log CPU reset

# gpg: Signature made Wed 10 Jul 2013 07:52:39 AM CDT using RSA key ID 3E7E013F
# gpg: Can't check signature: public key not found

# By Andreas Färber (41) and others
# Via Andreas Färber
* afaerber/tags/qom-cpu-for-anthony: (43 commits)
  cpu: Move reset logging to CPUState
  target-ppc: Change LOG_MMU_STATE() argument to CPUState
  target-i386: Change LOG_PCALL_STATE() argument to CPUState
  log: Change log_cpu_state[_mask]() argument to CPUState
  target-i386: Change do_smm_enter() argument to X86CPU
  target-i386: Change do_interrupt_all() argument to X86CPU
  target-xtensa: Change gen_intermediate_code_internal() arg to XtensaCPU
  target-unicore32: Change gen_intermediate_code_internal() signature
  target-sparc: Change gen_intermediate_code_internal() argument to SPARCCPU
  target-sh4: Change gen_intermediate_code_internal() argument to SuperHCPU
  target-s390x: Change gen_intermediate_code_internal() argument to S390CPU
  target-ppc: Change gen_intermediate_code_internal() argument to PowerPCCPU
  target-mips: Change gen_intermediate_code_internal() argument to MIPSCPU
  target-microblaze: Change gen_intermediate_code_internal() argument types
  target-m68k: Change gen_intermediate_code_internal() argument to M68kCPU
  target-lm32: Change gen_intermediate_code_internal() argument to LM32CPU
  target-i386: Change gen_intermediate_code_internal() argument to X86CPU
  target-cris: Change gen_intermediate_code_internal() argument to CRISCPU
  target-arm: Change gen_intermediate_code_internal() argument to ARMCPU
  target-alpha: Change gen_intermediate_code_internal() argument to AlphaCPU
  ...

11 years agoMerge remote-tracking branch 'riku/linux-user-for-upstream' into staging
Anthony Liguori [Wed, 10 Jul 2013 15:54:09 +0000 (10:54 -0500)]
Merge remote-tracking branch 'riku/linux-user-for-upstream' into staging

# By Andreas Schwab (2) and others
# Via Riku Voipio
* riku/linux-user-for-upstream:
  linux-user: Do not ignore mmap failure from host
  linux-user: improve target_to_host_sock_type conversion
  user-exec.c: Set is_write correctly in the ARM cpu_signal_handler()
  linux-user: Fix sys_utimensat (would not compile on old glibc)
  linux-user: fix signal number range check
  linux-user: add SIOCADDRT/SIOCDELRT support
  linux-user: handle /proc/$$ like /proc/self

Message-id: cover.1373051589.git.riku.voipio@linaro.org
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoMerge remote-tracking branch 'rth/tcg-next' into staging
Anthony Liguori [Wed, 10 Jul 2013 15:53:55 +0000 (10:53 -0500)]
Merge remote-tracking branch 'rth/tcg-next' into staging

# By Richard Henderson
# Via Richard Henderson
* rth/tcg-next:
  tcg-arm: Implement tcg_register_jit
  tcg-i386: Use QEMU_BUILD_BUG_ON instead of assert for frame size
  tcg: Move the CIE and FDE header definitions to common code
  tcg: Fix high_pc fields in .debug_info
  tcg-arm: Use AT_PLATFORM to detect the host ISA
  tcg-arm: Simplify logic in detecting the ARM ISA in use
  tcg-arm: Rename use_armv5_instructions to use_armvt5_instructions
  tcg-arm: Make use of conditional availability of opcodes for divide
  tcg: Simplify logic using TCG_OPF_NOT_PRESENT
  tcg: Allow non-constant control macros
  tcg-ppc64: Don't implement rem
  tcg-ppc: Don't implement rem
  tcg-arm: Don't implement rem
  tcg: Split rem requirement from div requirement
  tcg: Add myself to general TCG maintainership

Message-id: 1373379515-28596-1-git-send-email-rth@twiddle.net
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoqom: Fix class cast of NULL classes
Peter Crosthwaite [Tue, 18 Jun 2013 09:18:59 +0000 (19:18 +1000)]
qom: Fix class cast of NULL classes

Its clear from the implementation that class casting is supposed to work
with a NULL class argument. Guard all dereferences of the class argument
against NULL accordingly.

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Message-id: 94cd5ba46b74eea289a7e582635820c1c54e66fa.1371546907.git.peter.crosthwaite@xilinx.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agocpu: Move reset logging to CPUState
Andreas Färber [Sun, 16 Jun 2013 05:49:48 +0000 (07:49 +0200)]
cpu: Move reset logging to CPUState

x86 was using additional CPU_DUMP_* flags, so make that configurable in
CPUClass::reset_dump_flags.

This adds reset logging for alpha, unicore32 and xtensa.

Acked-by: Michael Walle <michael@walle.cc> (for lm32)
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Andreas Färber <afaerber@suse.de>
11 years agotarget-ppc: Change LOG_MMU_STATE() argument to CPUState
Andreas Färber [Tue, 2 Jul 2013 22:52:23 +0000 (00:52 +0200)]
target-ppc: Change LOG_MMU_STATE() argument to CPUState

Choose CPUState rather than PowerPCCPU since doing a CPU() cast on the
macro argument would hide type mismatches.

Signed-off-by: Andreas Färber <afaerber@suse.de>
11 years agotarget-i386: Change LOG_PCALL_STATE() argument to CPUState
Andreas Färber [Tue, 2 Jul 2013 23:07:10 +0000 (01:07 +0200)]
target-i386: Change LOG_PCALL_STATE() argument to CPUState

Since log_cpu_state_mask() argument was changed to CPUState,
CPUArchState is no longer needed.

Choose CPUState rather than X86CPU to not hide type mismatches with CPU().

Signed-off-by: Andreas Färber <afaerber@suse.de>
11 years agolog: Change log_cpu_state[_mask]() argument to CPUState
Andreas Färber [Sun, 16 Jun 2013 05:28:50 +0000 (07:28 +0200)]
log: Change log_cpu_state[_mask]() argument to CPUState

Since commit 878096eeb278a8ac1ccd6667af73e026f29b4cf5 (cpu: Turn
cpu_dump_{state,statistics}() into CPUState hooks) CPUArchState is no
longer needed.

Add documentation and make the functions available through qemu/log.h
outside NEED_CPU_H to allow use in qom/cpu.c. Moving them to qom/cpu.h
was not yet possible due to convoluted include paths, so that some
devices grow an implicit and unneeded dependency on qom/cpu.h for now.

Acked-by: Michael Walle <michael@walle.cc> (for lm32)
Reviewed-by: Richard Henderson <rth@twiddle.net>
[AF: Simplified mb_cpu_do_interrupt() and do_interrupt_all() changes]
Signed-off-by: Andreas Färber <afaerber@suse.de>
11 years agotarget-i386: Change do_smm_enter() argument to X86CPU
Andreas Färber [Wed, 3 Jul 2013 00:45:17 +0000 (02:45 +0200)]
target-i386: Change do_smm_enter() argument to X86CPU

Prepares for log_cpu_state_mask() changing argument to CPUState.

Signed-off-by: Andreas Färber <afaerber@suse.de>
11 years agotarget-i386: Change do_interrupt_all() argument to X86CPU
Andreas Färber [Wed, 3 Jul 2013 00:00:09 +0000 (02:00 +0200)]
target-i386: Change do_interrupt_all() argument to X86CPU

Prepares for log_cpu_state() changing argument to CPUState.

Signed-off-by: Andreas Färber <afaerber@suse.de>
11 years agotarget-xtensa: Change gen_intermediate_code_internal() arg to XtensaCPU
Andreas Färber [Fri, 21 Jun 2013 20:33:01 +0000 (22:33 +0200)]
target-xtensa: Change gen_intermediate_code_internal() arg to XtensaCPU

Also use bool type while at it.

Prepares for moving singlestep_enabled field to CPUState.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Andreas Färber <afaerber@suse.de>
11 years agotarget-unicore32: Change gen_intermediate_code_internal() signature
Andreas Färber [Fri, 21 Jun 2013 20:29:57 +0000 (22:29 +0200)]
target-unicore32: Change gen_intermediate_code_internal() signature

Use UniCore32CPU and bool.

Prepares for moving singlestep_enabled field to CPUState.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Andreas Färber <afaerber@suse.de>
11 years agotarget-sparc: Change gen_intermediate_code_internal() argument to SPARCCPU
Andreas Färber [Fri, 21 Jun 2013 20:27:28 +0000 (22:27 +0200)]
target-sparc: Change gen_intermediate_code_internal() argument to SPARCCPU

Also use bool type while at it.

Prepares for moving singlestep_enabled field to CPUState.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Andreas Färber <afaerber@suse.de>
11 years agotarget-sh4: Change gen_intermediate_code_internal() argument to SuperHCPU
Andreas Färber [Fri, 21 Jun 2013 20:24:41 +0000 (22:24 +0200)]
target-sh4: Change gen_intermediate_code_internal() argument to SuperHCPU

Also use bool type while at it.

Prepares for moving singlestep_enabled field to CPUState.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Andreas Färber <afaerber@suse.de>
11 years agotarget-s390x: Change gen_intermediate_code_internal() argument to S390CPU
Andreas Färber [Fri, 21 Jun 2013 20:22:09 +0000 (22:22 +0200)]
target-s390x: Change gen_intermediate_code_internal() argument to S390CPU

Also use bool type while at it.

Prepares for moving singlestep_enabled field to CPUState.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Andreas Färber <afaerber@suse.de>
11 years agotarget-ppc: Change gen_intermediate_code_internal() argument to PowerPCCPU
Andreas Färber [Fri, 21 Jun 2013 20:19:32 +0000 (22:19 +0200)]
target-ppc: Change gen_intermediate_code_internal() argument to PowerPCCPU

Also use bool type while at it.

Prepares for moving singlestep_enabled field to CPUState.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Andreas Färber <afaerber@suse.de>
11 years agotarget-mips: Change gen_intermediate_code_internal() argument to MIPSCPU
Andreas Färber [Fri, 21 Jun 2013 20:17:17 +0000 (22:17 +0200)]
target-mips: Change gen_intermediate_code_internal() argument to MIPSCPU

Also use bool type while at it.

Prepares for moving singlestep_enabled field to CPUState.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Andreas Färber <afaerber@suse.de>
11 years agotarget-microblaze: Change gen_intermediate_code_internal() argument types
Andreas Färber [Fri, 21 Jun 2013 20:14:44 +0000 (22:14 +0200)]
target-microblaze: Change gen_intermediate_code_internal() argument types

Use MicroBlazeCPU and bool.

Prepares for changing log_cpu_state() argument to CPUState and for
moving singlestep_enabled field to CPUState.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Andreas Färber <afaerber@suse.de>
11 years agotarget-m68k: Change gen_intermediate_code_internal() argument to M68kCPU
Andreas Färber [Fri, 21 Jun 2013 20:11:36 +0000 (22:11 +0200)]
target-m68k: Change gen_intermediate_code_internal() argument to M68kCPU

Also use bool type while at it.

Prepares for moving singlestep_enabled field to CPUState.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Andreas Färber <afaerber@suse.de>
11 years agotarget-lm32: Change gen_intermediate_code_internal() argument to LM32CPU
Andreas Färber [Fri, 21 Jun 2013 20:09:30 +0000 (22:09 +0200)]
target-lm32: Change gen_intermediate_code_internal() argument to LM32CPU

Also use bool type while at it.

Prepares for moving singlestep_enabled field to CPUState.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Andreas Färber <afaerber@suse.de>
11 years agotarget-i386: Change gen_intermediate_code_internal() argument to X86CPU
Andreas Färber [Fri, 21 Jun 2013 20:09:01 +0000 (22:09 +0200)]
target-i386: Change gen_intermediate_code_internal() argument to X86CPU

Also use bool type while at it.

Prepares for moving singlestep_enabled field to CPUState.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Andreas Färber <afaerber@suse.de>
11 years agotarget-cris: Change gen_intermediate_code_internal() argument to CRISCPU
Andreas Färber [Fri, 21 Jun 2013 20:04:49 +0000 (22:04 +0200)]
target-cris: Change gen_intermediate_code_internal() argument to CRISCPU

Also use bool type while at it.

Prepares for moving singlestep_enabled field to CPUState.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Andreas Färber <afaerber@suse.de>
11 years agotarget-arm: Change gen_intermediate_code_internal() argument to ARMCPU
Andreas Färber [Fri, 21 Jun 2013 19:57:04 +0000 (21:57 +0200)]
target-arm: Change gen_intermediate_code_internal() argument to ARMCPU

Also use bool type while at it.

Prepares for moving singlestep_enabled field to CPUState.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Andreas Färber <afaerber@suse.de>
11 years agotarget-alpha: Change gen_intermediate_code_internal() argument to AlphaCPU
Andreas Färber [Fri, 21 Jun 2013 20:01:20 +0000 (22:01 +0200)]
target-alpha: Change gen_intermediate_code_internal() argument to AlphaCPU

Also use bool argument while at it.

Prepares for moving singlestep_enabled field to CPUState.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Andreas Färber <afaerber@suse.de>
11 years agotarget-xtensa: gen_intermediate_code_internal() should be inlined
Andreas Färber [Tue, 2 Jul 2013 18:05:21 +0000 (20:05 +0200)]
target-xtensa: gen_intermediate_code_internal() should be inlined

Cc: qemu-stable@nongnu.org
Reported-by: Richard Henderson <rth@twiddle.net>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Andreas Färber <afaerber@suse.de>
11 years agotarget-moxie: gen_intermediate_code_internal() should be inlined
Andreas Färber [Tue, 2 Jul 2013 18:04:28 +0000 (20:04 +0200)]
target-moxie: gen_intermediate_code_internal() should be inlined

Cc: qemu-stable@nongnu.org
Reported-by: Richard Henderson <rth@twiddle.net>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Andreas Färber <afaerber@suse.de>
11 years agotarget-microblaze: gen_intermediate_code_internal() should be inlined
Andreas Färber [Tue, 2 Jul 2013 18:03:00 +0000 (20:03 +0200)]
target-microblaze: gen_intermediate_code_internal() should be inlined

Cc: qemu-stable@nongnu.org
Reported-by: Richard Henderson <rth@twiddle.net>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Andreas Färber <afaerber@suse.de>
11 years agotarget-lm32: gen_intermediate_code_internal() should be inlined
Andreas Färber [Tue, 2 Jul 2013 17:35:02 +0000 (19:35 +0200)]
target-lm32: gen_intermediate_code_internal() should be inlined

Cc: qemu-stable@nongnu.org
Reported-by: Richard Henderson <rth@twiddle.net>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Acked-by: Michael Walle <michael@walle.cc>
Signed-off-by: Andreas Färber <afaerber@suse.de>
11 years agotarget-cris: gen_intermediate_code_internal() should be inlined
Andreas Färber [Tue, 2 Jul 2013 17:30:14 +0000 (19:30 +0200)]
target-cris: gen_intermediate_code_internal() should be inlined

Cc: qemu-stable@nongnu.org
Reported-by: Richard Henderson <rth@twiddle.net>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Andreas Färber <afaerber@suse.de>
11 years agotarget-i386: Don't overuse CPUArchState
Andreas Färber [Wed, 26 Jun 2013 15:51:27 +0000 (17:51 +0200)]
target-i386: Don't overuse CPUArchState

Use CPUX86State instead in dump support code.

Signed-off-by: Andreas Färber <afaerber@suse.de>
11 years agotarget-s390x: Change handle_{hypercall,diag}() argument to S390CPU
Andreas Färber [Fri, 21 Jun 2013 15:17:00 +0000 (17:17 +0200)]
target-s390x: Change handle_{hypercall,diag}() argument to S390CPU

This allows to get rid of the last remaining ENV_GET_CPU() in
target-s390x/ by using CPU() cast directly on the argument.

Cc: Jason J. Herne <jjherne@us.ibm.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
11 years agotarget-s390x: Don't overuse ENV_GET_CPU()
Andreas Färber [Fri, 21 Jun 2013 15:04:45 +0000 (17:04 +0200)]
target-s390x: Don't overuse ENV_GET_CPU()

Commit 3474b679486caa8f6448bae974e131370f360c13 (Utilize selective
runtime reg sync for hot code paths) introduced two uses of
ENV_GET_CPU() inside target-s390x/ KVM code. In one case we can use a
direct CPU() cast instead.

Cc: Jason J. Herne <jjherne@us.ibm.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
11 years agotarget-ppc: Don't overuse ENV_GET_CPU()
Andreas Färber [Fri, 21 Jun 2013 15:00:04 +0000 (17:00 +0200)]
target-ppc: Don't overuse ENV_GET_CPU()

Commit b632a148b677b773ff155f9de840b37a653567b9 (target-ppc: QOM method
dispatch for MMU fault handling) introduced a use of ENV_GET_CPU()
inside target-ppc/ code. Use ppc_env_get_cpu() instead.

Purely cosmetic, non-functional change to aid in locating and removing
ENV_GET_CPU() usages.

Signed-off-by: Andreas Färber <afaerber@suse.de>
11 years agotimer/arm_mptimer: Build arm_mptimer only once
Andreas Färber [Sun, 16 Jun 2013 15:10:28 +0000 (17:10 +0200)]
timer/arm_mptimer: Build arm_mptimer only once

Since current_cpu is CPUState it no longer depends on CPUARMState.

Signed-off-by: Andreas Färber <afaerber@suse.de>
11 years agointc/openpic: Build openpic only once
Andreas Färber [Sun, 16 Jun 2013 15:04:21 +0000 (17:04 +0200)]
intc/openpic: Build openpic only once

Since current_cpu is CPUState it no longer depends on CPUPPCState.

Move ppce500_set_mpic_proxy() to a new hw/ppc/ppc_e500.h because
hw/ppc/ppc.h is too heavily using CPUPPCState and PowerPCCPU.

Signed-off-by: Andreas Färber <afaerber@suse.de>
11 years agointc/arm_gic: Build arm_gic only once
Andreas Färber [Sun, 16 Jun 2013 14:42:03 +0000 (16:42 +0200)]
intc/arm_gic: Build arm_gic only once

Since current_cpu is CPUState it no longer needs CPUArchState.

Signed-off-by: Andreas Färber <afaerber@suse.de>
11 years agobsd-user: Change thread_env to CPUState
Andreas Färber [Sun, 9 Jun 2013 17:51:23 +0000 (19:51 +0200)]
bsd-user: Change thread_env to CPUState

Signed-off-by: Andreas Färber <afaerber@suse.de>
11 years agolinux-user: Change thread_env to CPUState
Andreas Färber [Sun, 9 Jun 2013 17:47:04 +0000 (19:47 +0200)]
linux-user: Change thread_env to CPUState

Signed-off-by: Andreas Färber <afaerber@suse.de>
11 years agocpu: Make first_cpu and next_cpu CPUState
Andreas Färber [Wed, 29 May 2013 20:29:20 +0000 (22:29 +0200)]
cpu: Make first_cpu and next_cpu CPUState

Move next_cpu from CPU_COMMON to CPUState.
Move first_cpu variable to qom/cpu.h.

gdbstub needs to use CPUState::env_ptr for now.
cpu_copy() no longer needs to save and restore cpu_next.

Acked-by: Paolo Bonzini <pbonzini@redhat.com>
[AF: Rebased, simplified cpu_copy()]
Signed-off-by: Andreas Färber <afaerber@suse.de>
11 years agolinux-user: Clean up do_syscall() Coding Style for TARGET_NR_exit
Andreas Färber [Mon, 24 Jun 2013 21:53:10 +0000 (23:53 +0200)]
linux-user: Clean up do_syscall() Coding Style for TARGET_NR_exit

In particular fix 6-/10-char indentation.

Signed-off-by: Andreas Färber <afaerber@suse.de>
11 years agokvm: Change kvm_remove_all_breakpoints() argument to CPUState
Andreas Färber [Mon, 27 May 2013 12:40:48 +0000 (14:40 +0200)]
kvm: Change kvm_remove_all_breakpoints() argument to CPUState

Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Andreas Färber <afaerber@suse.de>
11 years agocpu: Replace cpu_single_env with CPUState current_cpu
Andreas Färber [Mon, 27 May 2013 03:17:50 +0000 (05:17 +0200)]
cpu: Replace cpu_single_env with CPUState current_cpu

Move it to qom/cpu.h.

Signed-off-by: Andreas Färber <afaerber@suse.de>
11 years agokvm: Free current_cpu identifier
Andreas Färber [Wed, 19 Jun 2013 15:37:31 +0000 (17:37 +0200)]
kvm: Free current_cpu identifier

Since CPU loops are done as last step in kvm_{insert,remove}_breakpoint()
and kvm_remove_all_breakpoints(), we do not need to distinguish between
invoking CPU and iterated CPUs and can thereby free the identifier for
use as a global variable.

Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
11 years agocpu: Drop unnecessary dynamic casts in *_env_get_cpu()
Andreas Färber [Fri, 10 May 2013 14:34:06 +0000 (16:34 +0200)]
cpu: Drop unnecessary dynamic casts in *_env_get_cpu()

A transition from CPUFooState to FooCPU can be considered safe,
just like FooCPU::env access in the opposite direction.
The only benefit of the FOO_CPU() casts would be protection against
bogus CPUFooState pointers, but then surrounding code would likely
break, too.

This should slightly improve interrupt etc. performance when going from
CPUFooState to FooCPU.
For any additional CPU() casts see 3556c233d931ad5ffa46a35cb25cfc057732ebb8
(qom: allow turning cast debugging off).

Reported-by: Anthony Liguori <aliguori@us.ibm.com>
Acked-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Andreas Färber <afaerber@suse.de>
11 years agolinux-user: Move cpu_clone_regs() and cpu_set_tls() into linux-user
Peter Maydell [Fri, 28 Jun 2013 13:22:32 +0000 (14:22 +0100)]
linux-user: Move cpu_clone_regs() and cpu_set_tls() into linux-user

The functions cpu_clone_regs() and cpu_set_tls() are not purely CPU
related -- they are specific to the TLS ABI for a a particular OS.
Move them into the linux-user/ tree where they belong.

target-lm32 had entirely unused implementations, since it has no
linux-user target; just drop them.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Acked-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Andreas Färber <afaerber@suse.de>
11 years agoRevert "gdbstub: Simplify find_cpu()"
Andreas Färber [Tue, 9 Jul 2013 18:50:52 +0000 (20:50 +0200)]
Revert "gdbstub: Simplify find_cpu()"

This reverts commit c52a6b67c1d7c6fc9fb2e3ba988d7b978e1487d3, which
replaced cpu_index() with cpu_index field, leading to deviation from
thread ID for NTPL and off-by-one otherwise.

Reported-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
11 years agovl: Tighten parsing of -machine option phandle_start
Markus Armbruster [Thu, 4 Jul 2013 13:09:23 +0000 (15:09 +0200)]
vl: Tighten parsing of -machine option phandle_start

Make it QEMU_OPT_NUMBER, so it gets parsed by generic code, which
actually bothers to check for errors, rather than its user, which
doesn't.

Cc: Alexander Graf <agraf@suse.de>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Acked-by: Alexander Graf <agraf@suse.de>
Message-id: 1372943363-24081-8-git-send-email-armbru@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoSimplify -machine option queries with qemu_get_machine_opts()
Markus Armbruster [Thu, 4 Jul 2013 13:09:22 +0000 (15:09 +0200)]
Simplify -machine option queries with qemu_get_machine_opts()

The previous two commits fixed bugs in -machine option queries.  I
can't find fault with the remaining queries, but let's use
qemu_get_machine_opts() everywhere, for consistency, simplicity and
robustness.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-id: 1372943363-24081-7-git-send-email-armbru@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agomicroblaze: Fix latent bug with default DTB lookup
Markus Armbruster [Thu, 4 Jul 2013 13:09:21 +0000 (15:09 +0200)]
microblaze: Fix latent bug with default DTB lookup

microblaze_load_kernel() fails to call
qemu_find_file(QEMU_FILE_TYPE_BIOS, dtb_filename) when no -machine
options are given.  This can't normally happen, because -machine
option kernel is mandatory for this target.  Fix it anyway, by using
qemu_get_machine_opts().

Cc: Peter Crosthwaite <peter.crosthwaite@petalogix.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-id: 1372943363-24081-6-git-send-email-armbru@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoFix -machine options accel, kernel_irqchip, kvm_shadow_mem
Markus Armbruster [Thu, 4 Jul 2013 13:09:20 +0000 (15:09 +0200)]
Fix -machine options accel, kernel_irqchip, kvm_shadow_mem

Multiple -machine options with the same ID are merged.  All but the
one without an ID are to be silently ignored.

In most places, we query these options with a null ID.  This is
correct.

In some places, we instead query whatever options come first in the
list.  This is wrong.  When the -machine processed first happens to
have an ID, options are taken from that ID, and the ones specified
without ID are silently ignored.

Example:

    $ upstream-qemu -nodefaults -S -display none -monitor stdio -machine id=foo -machine accel=kvm,usb=on
    $ upstream-qemu -nodefaults -S -display none -monitor stdio -machine id=foo,accel=kvm,usb=on -machine accel=xen
    $ upstream-qemu -nodefaults -S -display none -monitor stdio -machine accel=xen -machine id=foo,accel=kvm,usb=on

    $ qemu-system-x86_64 -nodefaults -S -display none -monitor stdio -machine accel=kvm,usb=on
    QEMU 1.5.50 monitor - type 'help' for more information
    (qemu) info kvm
    kvm support: enabled
    (qemu) info usb
    (qemu) q
    $ qemu-system-x86_64 -nodefaults -S -display none -monitor stdio -machine id=foo -machine accel=kvm,usb=on
    QEMU 1.5.50 monitor - type 'help' for more information
    (qemu) info kvm
    kvm support: disabled
    (qemu) info usb
    (qemu) q
    $ qemu-system-x86_64 -nodefaults -S -display none -monitor stdio -machine id=foo,accel=kvm,usb=on -machine accel=xen
    QEMU 1.5.50 monitor - type 'help' for more information
    (qemu) info kvm
    kvm support: enabled
    (qemu) info usb
    USB support not enabled
    (qemu) q
    $ qemu-system-x86_64 -nodefaults -S -display none -monitor stdio -machine accel=xen -machine id=foo,accel=kvm,usb=on
    xc: error: Could not obtain handle on privileged command interface (2 = No such file or directory): Internal error
    xen be core: can't open xen interface
    failed to initialize Xen: Operation not permitted

Option usb is queried correctly, and the one without an ID wins,
regardless of option order.

Option accel is queried incorrectly, and which one wins depends on
option order and ID.

Affected options are accel (and its sugared forms -enable-kvm and
-no-kvm), kernel_irqchip, kvm_shadow_mem.

Additionally, option kernel_irqchip is normally on by default, except
it's off when no -machine options are given.  Bug can't bite, because
kernel_irqchip is used only when KVM is enabled, KVM is off by
default, and enabling always creates -machine options.  Downstreams
that enable KVM by default do get bitten, though.

Use qemu_get_machine_opts() to fix these bugs.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-id: 1372943363-24081-5-git-send-email-armbru@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agovl: New qemu_get_machine_opts()
Markus Armbruster [Thu, 4 Jul 2013 13:09:19 +0000 (15:09 +0200)]
vl: New qemu_get_machine_opts()

To be used in the next few commits to fix or clean up queries of
"machine" options (-machine and its sugared forms).

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-id: 1372943363-24081-4-git-send-email-armbru@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoqemu-option: Fix qemu_opts_set_defaults() for corner cases
Markus Armbruster [Thu, 4 Jul 2013 13:09:18 +0000 (15:09 +0200)]
qemu-option: Fix qemu_opts_set_defaults() for corner cases

Commit 4f6dd9a changed the initialization of opts in opts_parse() to
this:

    if (defaults) {
        if (!id && !QTAILQ_EMPTY(&list->head)) {
            opts = qemu_opts_find(list, NULL);
        } else {
            opts = qemu_opts_create(list, id, 0);
        }
    } else {
        opts = qemu_opts_create(list, id, 1);
    }

Same as before for !defaults.

If defaults is true, and params has no ID, and options exist, we use
the first assignment.  It sets opts to null if all options have an ID.
opts_parse() then returns null.  qemu_opts_set_defaults() asserts the
value is non-null.  It's the only caller that passes true for
defaults.

To reproduce, try "-M xenpv -machine id=foo" (yes, "id=foo" is silly,
but it shouldn't crash).

I believe the function attempts to do the following:

    If options don't yet exist, create new options
    Else, if defaults, modify the existing options
    Else, if list->merge_lists, modify the existing options
    Else, fail

A straightforward call of qemu_opts_create() does exactly that.

Cc: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-id: 1372943363-24081-3-git-send-email-armbru@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoqemu-option: Fix qemu_opts_find() for null id arguments
Markus Armbruster [Thu, 4 Jul 2013 13:09:17 +0000 (15:09 +0200)]
qemu-option: Fix qemu_opts_find() for null id arguments

Crashes when the first list member has an ID.  Admittedly nonsensical
reproducer:

$ qemu-system-x86_64 -nodefaults -machine id=foo -machine ""

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1372943363-24081-2-git-send-email-armbru@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoexec: Remove unused global variable phys_ram_fd
Stefan Weil [Fri, 5 Jul 2013 17:07:16 +0000 (19:07 +0200)]
exec: Remove unused global variable phys_ram_fd

It seems to be unused since several years (commit
be995c27640a82c7056b6f53d02ec823570114e5 in 2006).

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Message-id: 1373044036-14443-1-git-send-email-sw@weilnetz.de
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agohw/9pfs: Fix memory leak in error path
M. Mohan Kumar [Thu, 4 Jul 2013 09:21:18 +0000 (14:51 +0530)]
hw/9pfs: Fix memory leak in error path

Fix few more memory leaks in virtio-9p-device.c detected using valgrind.

Signed-off-by: M. Mohan Kumar <mohan@in.ibm.com>
Message-id: 1372929678-14341-1-git-send-email-mohan@in.ibm.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agofsdev: Fix potential memory leak
Stefan Weil [Sun, 16 Jun 2013 10:02:40 +0000 (12:02 +0200)]
fsdev: Fix potential memory leak

This leak was reported by cppcheck.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Reviewed-by: M. Mohan Kumar <mohan@in.ibm.com>
Message-id: 1371376960-18192-1-git-send-email-sw@weilnetz.de
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoExtend support of SMBUS(module pm_smbus.c) HST_STS register.
MRatnikov [Sun, 7 Jul 2013 21:03:02 +0000 (01:03 +0400)]
Extend support of SMBUS(module pm_smbus.c) HST_STS register.

Previous realization doesn't consider flags in the status register.
Add DS and INTR bits of HST_STS register set after transaction execution.
Update bits resetting in HST_STS register. Update error processing:
if DEV_ERR bit set transaction isn't execution.

Signed-off-by: MRatnikov <m.o.ratnikov@gmail.com>
Message-id: 1373230982-9190-1-git-send-email-m.o.ratnikov@gmail.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agotrap signals for "-serial mon:stdio"
Paolo Bonzini [Wed, 3 Jul 2013 16:29:45 +0000 (20:29 +0400)]
trap signals for "-serial mon:stdio"

With mon:stdio you can exit the VM by switching to the monitor and
sending the "quit" command.  It is then useful to pass Ctrl-C to the
VM instead of exiting.

This in turn lets us stop tying the default signal handling behavior
to -nographic, removing gratuitous differences between "-display none"
and "-nographic".

This patch changes behavior for "-display none -serial mon:stdio", as
expected, but not for "-display none -serial stdio".

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1372868986-25988-1-git-send-email-mjt@msgid.tls.msk.ru
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoconfigure: Simplify alternate .text segment
Richard Henderson [Sat, 22 Jun 2013 02:10:16 +0000 (19:10 -0700)]
configure: Simplify alternate .text segment

For bsd-user and linux-user emulation modes QEMU needs to be linked at an
alternate .text segment address, so that it's out of the way of the guest
executable.  Instead of including modified linker scripts for each arch,
just set the address with -Ttext-segment if supported, or by using sed to
edit the default linker script.

Cc: Ed Maste <emaste@freebsd.org>
Signed-off-by: Richard Henderson <rth@twiddle.net>
Acked-by: Ed Maste <emaste@freebsd.org>
Signed-off-by: Ed Maste <emaste@freebsd.org>
Message-id: 1371867016-7660-1-git-send-email-rth@twiddle.net
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agotarget-openrisc: Fix typename in openrisc_cpu_class_by_name()
Dongxue Zhang [Tue, 2 Jul 2013 09:11:55 +0000 (17:11 +0800)]
target-openrisc: Fix typename in openrisc_cpu_class_by_name()

Commit 478032a93d908e59085c1ac56f10979942e7dc4f (target-openrisc:
Rename CPU subtypes) suffixed CPU sub-types with "-or32-cpu" but forgot
to update openrisc_cpu_class_by_name(), so that it was still looking for
the types without suffix.

Make target-openrisc running OK by adding the suffix to the model name.

This means it is no longer possible to use -cpu or1200-or32-cpu or
-cpu any-or32-cpu though.

Cc: qemu-stable@nongnu.org
Signed-off-by: Dongxue Zhang <elta.era@gmail.com>
Tested-by: Jia Liu <proljc@gmail.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
11 years agotcg-arm: Implement tcg_register_jit
Richard Henderson [Wed, 5 Jun 2013 14:55:33 +0000 (07:55 -0700)]
tcg-arm: Implement tcg_register_jit

Allows unwinding past the code_gen_buffer.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <rth@twiddle.net>
11 years agotcg-i386: Use QEMU_BUILD_BUG_ON instead of assert for frame size
Richard Henderson [Wed, 5 Jun 2013 14:56:29 +0000 (07:56 -0700)]
tcg-i386: Use QEMU_BUILD_BUG_ON instead of assert for frame size

We can check the condition at compile time, rather than run time.

Reviewed-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Richard Henderson <rth@twiddle.net>
11 years agotcg: Move the CIE and FDE header definitions to common code
Richard Henderson [Wed, 5 Jun 2013 14:39:57 +0000 (07:39 -0700)]
tcg: Move the CIE and FDE header definitions to common code

These will necessarily be the same layout for all hosts.  This limits
the amount of boilerplate required to implement jit debug for a host.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <rth@twiddle.net>
11 years agotcg: Fix high_pc fields in .debug_info
Richard Henderson [Fri, 24 May 2013 21:16:14 +0000 (14:16 -0700)]
tcg: Fix high_pc fields in .debug_info

I don't think the debugger actually looks at this for anything,
using the correct .debug_frame contents, but might as well get
it all correct.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <rth@twiddle.net>
11 years agotcg-arm: Use AT_PLATFORM to detect the host ISA
Richard Henderson [Thu, 6 Jun 2013 17:46:35 +0000 (10:46 -0700)]
tcg-arm: Use AT_PLATFORM to detect the host ISA

With this we can generate armv7 insns even when the OS compiles for a
lower common denominator.  The macros are arranged so that when we do
compile for a given ISA, all of the runtime checks for that ISA are
optimized away.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <rth@twiddle.net>
11 years agotcg-arm: Simplify logic in detecting the ARM ISA in use
Richard Henderson [Thu, 6 Jun 2013 17:21:37 +0000 (10:21 -0700)]
tcg-arm: Simplify logic in detecting the ARM ISA in use

GCC 4.8 defines a handy __ARM_ARCH symbol that we can use, which
will make us nicely forward compatible with ARMv8 AArch32.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <rth@twiddle.net>
11 years agotcg-arm: Rename use_armv5_instructions to use_armvt5_instructions
Richard Henderson [Thu, 4 Jul 2013 18:20:26 +0000 (11:20 -0700)]
tcg-arm: Rename use_armv5_instructions to use_armvt5_instructions

As it really controls the availability of a thumb interworking
instruction on armv5t.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <rth@twiddle.net>
11 years agotcg-arm: Make use of conditional availability of opcodes for divide
Richard Henderson [Thu, 2 May 2013 11:18:38 +0000 (12:18 +0100)]
tcg-arm: Make use of conditional availability of opcodes for divide

We can now detect and use divide instructions at runtime, rather than
having to restrict their availability to compile-time.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <rth@twiddle.net>
11 years agotcg: Simplify logic using TCG_OPF_NOT_PRESENT
Richard Henderson [Thu, 2 May 2013 10:57:40 +0000 (11:57 +0100)]
tcg: Simplify logic using TCG_OPF_NOT_PRESENT

Expand the definition of "not present" to include "should not be present".
This means we can simplify the logic surrounding the generic tcg opcodes
for which the host backend ought not be providing definitions.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <rth@twiddle.net>
11 years agotcg: Allow non-constant control macros
Richard Henderson [Thu, 2 May 2013 10:35:08 +0000 (11:35 +0100)]
tcg: Allow non-constant control macros

This allows TCG_TARGET_HAS_* to be a variable rather than a constant,
which allows easier support for differing ISA levels for the host.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <rth@twiddle.net>
11 years agotcg-ppc64: Don't implement rem
Richard Henderson [Tue, 12 Mar 2013 06:24:55 +0000 (23:24 -0700)]
tcg-ppc64: Don't implement rem

Reviewed-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Richard Henderson <rth@twiddle.net>
11 years agotcg-ppc: Don't implement rem
Richard Henderson [Tue, 12 Mar 2013 06:24:15 +0000 (23:24 -0700)]
tcg-ppc: Don't implement rem

Reviewed-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Richard Henderson <rth@twiddle.net>
11 years agotcg-arm: Don't implement rem
Richard Henderson [Tue, 12 Mar 2013 06:13:30 +0000 (23:13 -0700)]
tcg-arm: Don't implement rem

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <rth@twiddle.net>
11 years agotcg: Split rem requirement from div requirement
Richard Henderson [Tue, 12 Mar 2013 05:41:47 +0000 (22:41 -0700)]
tcg: Split rem requirement from div requirement

There are several hosts with only a "div" insn.  Remainder is computed
manually from the quotient and inputs.  We can do this generically.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <rth@twiddle.net>
11 years agotcg: Add myself to general TCG maintainership
Richard Henderson [Wed, 3 Jul 2013 18:09:03 +0000 (11:09 -0700)]
tcg: Add myself to general TCG maintainership

Acked-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <rth@twiddle.net>
11 years agoMerge remote-tracking branch 'mst/tags/for_anthony' into staging
Anthony Liguori [Mon, 8 Jul 2013 13:00:23 +0000 (08:00 -0500)]
Merge remote-tracking branch 'mst/tags/for_anthony' into staging

pci,misc enhancements

This includes some pci enhancements:

Better support for systems with multiple PCI root buses
FW cfg interface for more robust pci programming in BIOS
Minor fixes/cleanups for fw cfg and cross-version migration -
    because of dependencies with other patches

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
# gpg: Signature made Sun 07 Jul 2013 03:11:18 PM CDT using RSA key ID D28D5469
# gpg: Can't check signature: public key not found

# By David Gibson (10) and others
# Via Michael S. Tsirkin
* mst/tags/for_anthony:
  pci: Fold host_buses list into PCIHostState functionality
  pci: Remove domain from PCIHostBus
  pci: Simpler implementation of primary PCI bus
  pci: Add root bus parameter to pci_nic_init()
  pci: Add root bus argument to pci_get_bus_devfn()
  pci: Replace pci_find_domain() with more general pci_root_bus_path()
  pci: Use helper to find device's root bus in pci_find_domain()
  pci: Abolish pci_find_root_bus()
  pci: Move pci_read_devaddr to pci-hotplug-old.c
  pci: Cleanup configuration for pci-hotplug.c
  pvpanic: fix fwcfg for big endian hosts
  pvpanic: initialization cleanup
  MAINTAINERS: s/Marcelo/Paolo/
  e1000: cleanup process_tx_desc
  pc_piix: cleanup init compat handling
  pc: pass PCI hole ranges to Guests
  pci: store PCI hole ranges in guestinfo structure
  range: add Range structure

Message-id: 1373228271-31223-1-git-send-email-mst@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agopci: Fold host_buses list into PCIHostState functionality
David Gibson [Thu, 6 Jun 2013 08:48:54 +0000 (18:48 +1000)]
pci: Fold host_buses list into PCIHostState functionality

The host_buses list is an odd structure - a list of pointers to PCI root
buses existing in parallel to the normal qdev tree structure.  This patch
removes it, instead putting the link pointers into the PCIHostState
structure, which have a 1:1 relationship to PCIHostBus structures anyway.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
11 years agopci: Remove domain from PCIHostBus
David Gibson [Thu, 6 Jun 2013 08:48:53 +0000 (18:48 +1000)]
pci: Remove domain from PCIHostBus

There are now no users of the domain field of PCIHostBus, so remove it
from the structure, and as a parameter from the pci_host_bus_register()
function which sets it.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
11 years agopci: Simpler implementation of primary PCI bus
David Gibson [Thu, 6 Jun 2013 08:48:52 +0000 (18:48 +1000)]
pci: Simpler implementation of primary PCI bus

Currently pci_find_primary_bus() searches the list of root buses for one
with domain 0.  But since host buses are always registered with domain 0,
this just amounts to finding the only PCI host bus.  The only remaining
users of pci_find_primary_bus() are in pci-hotplug-old.c, which implements
the old style pci_add/pci_del commands.

Therefore, this patch redefines pci_find_primary_bus() to find the only
PCI root bus, returning an error if there are multiple roots.  The callers
in pci-hotplug-old.c are updated correspondingly, to produce sensible
error messages.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
11 years agopci: Add root bus parameter to pci_nic_init()
David Gibson [Thu, 6 Jun 2013 08:48:51 +0000 (18:48 +1000)]
pci: Add root bus parameter to pci_nic_init()

At present, pci_nic_init() and pci_nic_init_nofail() assume that they will
only create a NIC under the primary PCI root.  As we add support for
multiple PCI roots, that may no longer be the case.  This patch adds a root
bus parameter to pci_nic_init() (and updates callers accordingly) to allow
the machine init code using it to specify the right PCI root for NICs
created by old-style -net nic parameters.  NICs created new-style, with
-device can of course be put anywhere.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
11 years agopci: Add root bus argument to pci_get_bus_devfn()
David Gibson [Thu, 6 Jun 2013 08:48:50 +0000 (18:48 +1000)]
pci: Add root bus argument to pci_get_bus_devfn()

pci_get_bus_devfn() interprets a full PCI address string to give a PCIBus *
and device/function number within that bus.  Currently it assumes it is
working on an address under the primary PCI root bus.  This patch extends
it to allow the caller to specify a root bus.  This might seem a little odd
since the supplied address can (theoretically) include a PCI domain number.
However, attempting to use a non-zero domain number there is currently an
error, so that shouldn't really cause problems.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
11 years agopci: Replace pci_find_domain() with more general pci_root_bus_path()
David Gibson [Thu, 6 Jun 2013 08:48:49 +0000 (18:48 +1000)]
pci: Replace pci_find_domain() with more general pci_root_bus_path()

pci_find_domain() is used in a number of places where we want an id for a
whole PCI domain (i.e. the subtree under a PCI root bus).  The trouble is
that many platforms may support multiple independent host bridges with no
hardware supplied notion of domain number.

This patch, therefore, replaces calls to pci_find_domain() with calls to
a new pci_root_bus_path() returning a string.  The new call is implemented
in terms of a new callback in the host bridge class, so it can be defined
in some way that's well defined for the platform.  When no callback is
available we fall back on the qbus name.

Most current uses of pci_find_domain() are for error or informational
messages, so the change in identifiers should be harmless.  The exception
is pci_get_dev_path(), whose results form part of migration streams.  To
maintain compatibility with old migration streams, the PIIX PCI host is
altered to always supply "0000" for this path, which matches the old domain
number (since the code didn't actually support domains other than 0).

For the pseries (spapr) PCI bridge we use a different platform-unique
identifier (pseries machines can routinely have dozens of PCI host
bridges).  Theoretically that breaks migration streams, but given that we
don't yet have migration support for pseries, it doesn't matter.

Any other machines that have working migration support including PCI
devices will need to be updated to maintain migration stream compatibility.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
11 years agopci: Use helper to find device's root bus in pci_find_domain()
David Gibson [Thu, 6 Jun 2013 08:48:48 +0000 (18:48 +1000)]
pci: Use helper to find device's root bus in pci_find_domain()

Currently pci_find_domain() performs two functions - it locates the PCI
root bus above the given bus, then looks up that root bus's domain number.
This patch adds a helper function to perform the first task, finding the
root bus for a given PCI device.  This is then used in pci_find_domain().
This changes pci_find_domain()'s signature slightly, taking a PCIDevice
instead of a PCIBus - since all callers passed something of the form
dev->bus, this simplifies things slightly.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
11 years agopci: Abolish pci_find_root_bus()
David Gibson [Thu, 6 Jun 2013 08:48:47 +0000 (18:48 +1000)]
pci: Abolish pci_find_root_bus()

pci_find_root_bus() takes a domain parameter.  Currently PCI root buses
with domain other than 0 can't be created, so this is more or less a long
winded way of retrieving the main PCI root bus.  Numbered domains don't
actually properly cover the (non x86) possibilities for multiple PCI root
buses, so this patch for now enforces the domain == 0 restriction in other
places to replace pci_find_root_bus() with an explicit
pci_find_primary_bus().

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>