sdk/emulator/qemu.git
8 years agoexplicitly include hw/qdev-core.h
Paolo Bonzini [Fri, 4 Dec 2015 10:10:27 +0000 (11:10 +0100)]
explicitly include hw/qdev-core.h

exec/cpu-all.h includes qom/cpu.h, which includes hw/qdev-core.h.
Explicit inclusion will keep things working when cpu.h will not be
included indirectly almost everywhere (either directly or through
qemu-common.h).

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agoexplicitly include qom/cpu.h
Paolo Bonzini [Fri, 4 Dec 2015 10:10:07 +0000 (11:10 +0100)]
explicitly include qom/cpu.h

exec/cpu-all.h includes qom/cpu.h.  Explicit inclusion
will keep things working when cpu.h will not be included
indirectly almost everywhere (either directly or through
qemu-common.h).

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agoarm: remove useless cpu.h inclusion
Paolo Bonzini [Mon, 25 Aug 2014 16:06:56 +0000 (18:06 +0200)]
arm: remove useless cpu.h inclusion

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agoppc: use PowerPCCPU instead of CPUPPCState
Paolo Bonzini [Tue, 15 Mar 2016 13:32:19 +0000 (14:32 +0100)]
ppc: use PowerPCCPU instead of CPUPPCState

This changes a cpu.h dependency for hw/ppc/ppc.h into a cpu-qom.h
dependency.  For it to compile we also need to clean up a few unused
definitions.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agomips: use MIPSCPU instead of CPUMIPSState
Paolo Bonzini [Tue, 15 Mar 2016 13:32:19 +0000 (14:32 +0100)]
mips: use MIPSCPU instead of CPUMIPSState

This changes a cpu.h dependency into a cpu-qom.h dependency.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agoalpha: include cpu-qom.h in files that require AlphaCPU
Paolo Bonzini [Tue, 15 Mar 2016 13:32:19 +0000 (14:32 +0100)]
alpha: include cpu-qom.h in files that require AlphaCPU

This will keep things working when cpu.h will not be included
indirectly almost everywhere (either directly or through
qemu-common.h).

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agosh4: include cpu-qom.h in files that require SuperHCPU
Paolo Bonzini [Tue, 15 Mar 2016 13:32:19 +0000 (14:32 +0100)]
sh4: include cpu-qom.h in files that require SuperHCPU

This will keep things working when cpu.h will not be included
indirectly almost everywhere (either directly or through
qemu-common.h).

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agom68k: include cpu-qom.h in files that require M68KCPU
Paolo Bonzini [Tue, 15 Mar 2016 13:32:19 +0000 (14:32 +0100)]
m68k: include cpu-qom.h in files that require M68KCPU

This will keep things working when cpu.h will not be included
indirectly almost everywhere (either directly or through
qemu-common.h).

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agoarm: include cpu-qom.h in files that require ARMCPU
Paolo Bonzini [Tue, 15 Mar 2016 13:32:02 +0000 (14:32 +0100)]
arm: include cpu-qom.h in files that require ARMCPU

This will keep things working when cpu.h will not be included
indirectly almost everywhere (either directly or through
qemu-common.h).

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agotarget-xtensa: make cpu-qom.h not target specific
Paolo Bonzini [Tue, 15 Mar 2016 12:49:25 +0000 (13:49 +0100)]
target-xtensa: make cpu-qom.h not target specific

Make XtensaCPU an opaque type within cpu-qom.h, and move all definitions
of private methods, as well as all type definitions that require knowledge
of the layout to cpu.h.  Conversely, move all definitions needed to
define a class to cpu-qom.h.  This helps making files independent of
NEED_CPU_H if they only need to pass around CPU pointers.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agotarget-unicore32: make cpu-qom.h not target specific
Paolo Bonzini [Tue, 15 Mar 2016 12:49:25 +0000 (13:49 +0100)]
target-unicore32: make cpu-qom.h not target specific

Make UniCore32CPU an opaque type within cpu-qom.h, and move all
definitions of private methods, as well as all type definitions that
require knowledge of the layout to cpu.h.  This helps making files
independent of NEED_CPU_H if they only need to pass around CPU pointers.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agotarget-tricore: make cpu-qom.h not target specific
Paolo Bonzini [Tue, 15 Mar 2016 12:49:25 +0000 (13:49 +0100)]
target-tricore: make cpu-qom.h not target specific

Make TriCoreCPU an opaque type within cpu-qom.h, and move all definitions
of private methods, as well as all type definitions that require knowledge
of the layout to cpu.h.  This helps making files independent of NEED_CPU_H
if they only need to pass around CPU pointers.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agotarget-sparc: make cpu-qom.h not target specific
Paolo Bonzini [Tue, 15 Mar 2016 12:49:25 +0000 (13:49 +0100)]
target-sparc: make cpu-qom.h not target specific

Make SPARCCPU an opaque type within cpu-qom.h, and move all definitions
of private methods, as well as all type definitions that require knowledge
of the layout to cpu.h.  This helps making files independent of NEED_CPU_H
if they only need to pass around CPU pointers.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agotarget-sh4: make cpu-qom.h not target specific
Paolo Bonzini [Tue, 15 Mar 2016 12:49:25 +0000 (13:49 +0100)]
target-sh4: make cpu-qom.h not target specific

Make SuperHCPU an opaque type within cpu-qom.h, and move all definitions
of private methods, as well as all type definitions that require knowledge
of the layout to cpu.h.  This helps making files independent of NEED_CPU_H
if they only need to pass around CPU pointers.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agotarget-s390x: make cpu-qom.h not target specific
Paolo Bonzini [Tue, 15 Mar 2016 12:49:25 +0000 (13:49 +0100)]
target-s390x: make cpu-qom.h not target specific

Make S390XCPU an opaque type within cpu-qom.h, and move all definitions
of private methods, as well as all type definitions that require knowledge
of the layout to cpu.h.  This helps making files independent of NEED_CPU_H
if they only need to pass around CPU pointers.

Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agotarget-ppc: make cpu-qom.h not target specific
Paolo Bonzini [Tue, 15 Mar 2016 12:49:25 +0000 (13:49 +0100)]
target-ppc: make cpu-qom.h not target specific

Make PowerPCCPU an opaque type within cpu-qom.h, and move all definitions
of private methods, as well as all type definitions that require knowledge
of the layout to cpu.h.  Conversely, move all definitions needed to define
a class to cpu-qom.h.  This helps making files independent of NEED_CPU_H
if they only need to pass around CPU pointers.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agotarget-ppc: do not make PowerPCCPUClass depend on target-specific symbols
Paolo Bonzini [Wed, 18 May 2016 11:24:27 +0000 (13:24 +0200)]
target-ppc: do not make PowerPCCPUClass depend on target-specific symbols

Just leave some members in even if they are unused on e.g.
32-bit PPC or user-mode emulation.  This avoids complications
when using PowerPCCPUClass in code that is compiled just
once (because it applies to both 32-bit and 64-bit PPC
for example) but still needs to peek at PPC-specific members.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agotarget-ppc: do not use target_ulong in cpu-qom.h
Paolo Bonzini [Tue, 15 Mar 2016 14:12:16 +0000 (15:12 +0100)]
target-ppc: do not use target_ulong in cpu-qom.h

Bring the PowerPCCPUClass handle_mmu_fault method type into line with
the one in CPUClass.

Using vaddr also makes the cpu-qom.h file target independent.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agotarget-mips: make cpu-qom.h not target specific
Paolo Bonzini [Tue, 15 Mar 2016 12:49:25 +0000 (13:49 +0100)]
target-mips: make cpu-qom.h not target specific

Make MIPSCPU an opaque type within cpu-qom.h, and move all definitions of
private methods, as well as all type definitions that require knowledge
of the layout to cpu.h.  This helps making files independent of NEED_CPU_H
if they only need to pass around CPU pointers.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agotarget-microblaze: make cpu-qom.h not target specific
Paolo Bonzini [Tue, 15 Mar 2016 12:49:25 +0000 (13:49 +0100)]
target-microblaze: make cpu-qom.h not target specific

Make MicroBlazeCPU an opaque type within cpu-qom.h, and move all
definitions of private methods, as well as all type definitions that
require knowledge of the layout to cpu.h.  This helps making files
independent of NEED_CPU_H if they only need to pass around CPU pointers.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agotarget-m68k: make cpu-qom.h not target specific
Paolo Bonzini [Tue, 15 Mar 2016 12:49:25 +0000 (13:49 +0100)]
target-m68k: make cpu-qom.h not target specific

Make M68KCPU an opaque type within cpu-qom.h, and move all definitions of
private methods, as well as all type definitions that require knowledge
of the layout to cpu.h.  This helps making files independent of NEED_CPU_H
if they only need to pass around CPU pointers.

Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agotarget-lm32: make cpu-qom.h not target specific
Paolo Bonzini [Tue, 15 Mar 2016 12:49:25 +0000 (13:49 +0100)]
target-lm32: make cpu-qom.h not target specific

Make LM32CPU an opaque type within cpu-qom.h, and move all definitions of
private methods, as well as all type definitions that require knowledge
of the layout to cpu.h.  This helps making files independent of NEED_CPU_H
if they only need to pass around CPU pointers.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agotarget-i386: make cpu-qom.h not target specific
Paolo Bonzini [Tue, 15 Mar 2016 12:49:25 +0000 (13:49 +0100)]
target-i386: make cpu-qom.h not target specific

Make X86CPU an opaque type within cpu-qom.h, and move all definitions of
private methods, as well as all type definitions that require knowledge
of the layout to cpu.h.  This helps making files independent of NEED_CPU_H
if they only need to pass around CPU pointers.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agotarget-cris: make cpu-qom.h not target specific
Paolo Bonzini [Tue, 15 Mar 2016 12:49:25 +0000 (13:49 +0100)]
target-cris: make cpu-qom.h not target specific

Make CRISCPU an opaque type within cpu-qom.h, and move all definitions of
private methods, as well as all type definitions that require knowledge
of the layout to cpu.h.  This helps making files independent of NEED_CPU_H
if they only need to pass around CPU pointers.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agotarget-arm: make cpu-qom.h not target specific
Paolo Bonzini [Tue, 15 Mar 2016 12:49:25 +0000 (13:49 +0100)]
target-arm: make cpu-qom.h not target specific

Make ARMCPU an opaque type within cpu-qom.h, and move all definitions of
private methods, as well as all type definitions that require knowledge
of the layout to cpu.h.  This helps making files independent of NEED_CPU_H
if they only need to pass around CPU pointers.

Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agotarget-alpha: make cpu-qom.h not target specific
Paolo Bonzini [Tue, 15 Mar 2016 12:49:25 +0000 (13:49 +0100)]
target-alpha: make cpu-qom.h not target specific

Make AlphaCPU an opaque type within cpu-qom.h, and move all definitions
of private methods, as well as all type definitions that require knowledge
of the layout to cpu.h.  This helps making files independent of NEED_CPU_H
if they only need to pass around CPU pointers.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agocpu: make cpu-qom.h only include-able from cpu.h
Paolo Bonzini [Tue, 15 Sep 2015 14:00:56 +0000 (16:00 +0200)]
cpu: make cpu-qom.h only include-able from cpu.h

Make cpu-qom.h so that it is only included from cpu.h.  Then there
is no need for it to include cpu.h again.

Later we will make cpu-qom.h target independent and we will _want_
to include it from elsewhere, but for now reduce the number of cases
to handle.

Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agolog: do not use CONFIG_USER_ONLY
Paolo Bonzini [Fri, 4 Dec 2015 12:12:57 +0000 (13:12 +0100)]
log: do not use CONFIG_USER_ONLY

This decouples logging further from config-target.h

Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agoinclude: move CPU-related definitions out of qemu-common.h
Paolo Bonzini [Tue, 15 Mar 2016 15:47:38 +0000 (16:47 +0100)]
include: move CPU-related definitions out of qemu-common.h

Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agos390x: move .needed functions for subsections to machine.c
Paolo Bonzini [Wed, 18 May 2016 11:08:02 +0000 (13:08 +0200)]
s390x: move .needed functions for subsections to machine.c

These functions are only used when defining subsections, so move
them there.

Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agoscripts: add script to build QEMU and analyze inclusions
Paolo Bonzini [Thu, 31 Mar 2016 10:36:43 +0000 (12:36 +0200)]
scripts: add script to build QEMU and analyze inclusions

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
8 years agoMerge remote-tracking branch 'remotes/mjt/tags/pull-trivial-patches-2016-05-18' into...
Peter Maydell [Thu, 19 May 2016 08:27:28 +0000 (09:27 +0100)]
Merge remote-tracking branch 'remotes/mjt/tags/pull-trivial-patches-2016-05-18' into staging

trivial patches for 2016-05-18

# gpg: Signature made Wed 18 May 2016 13:04:43 BST using RSA key ID A4C3D7DB
# gpg: Good signature from "Michael Tokarev <mjt@tls.msk.ru>"
# gpg:                 aka "Michael Tokarev <mjt@corpit.ru>"
# gpg:                 aka "Michael Tokarev <mjt@debian.org>"

* remotes/mjt/tags/pull-trivial-patches-2016-05-18:
  Fix some typos found by codespell
  9p: drop unused declaration from coth.h
  smbios: fix typo
  accel: make configure_accelerator return void
  configure: Use uniform description for devel packages
  ipack: Update e-mail address
  util: fix comment typos
  qdict: fix unbounded stack warning for qdict_array_entries
  Fix typo in variable name (found and fixed by codespell)
  vl: fix comment about when parsing cpu definitions
  loader: fix potential memory leak
  remove comment for nonexistent structure member
  s390: remove misleading comment

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8 years agoFix some typos found by codespell
Stefan Weil [Wed, 23 Mar 2016 14:59:57 +0000 (15:59 +0100)]
Fix some typos found by codespell

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
8 years ago9p: drop unused declaration from coth.h
Greg Kurz [Tue, 3 May 2016 08:22:00 +0000 (10:22 +0200)]
9p: drop unused declaration from coth.h

Commit "ebac1202c95a virtio-9p: use QEMU thread pool" dropped function
v9fs_init_worker_threads.

Signed-off-by: Greg Kurz <gkurz@linux.vnet.ibm.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
8 years agosmbios: fix typo
Cao jin [Tue, 29 Mar 2016 09:48:44 +0000 (17:48 +0800)]
smbios: fix typo

The spec says: "on paragraph (16-byte) boundaries"

Signed-off-by: Cao jin <caoj.fnst@cn.fujitsu.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
8 years agoaccel: make configure_accelerator return void
Wei Jiangang [Thu, 14 Apr 2016 03:58:02 +0000 (11:58 +0800)]
accel: make configure_accelerator return void

Return the negated value of accel_initialised is meaningless,
and the caller vl doesn't check it.

Signed-off-by: Wei Jiangang <weijg.fnst@cn.fujitsu.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
8 years agoconfigure: Use uniform description for devel packages
Stefan Weil [Fri, 8 Apr 2016 16:11:13 +0000 (18:11 +0200)]
configure: Use uniform description for devel packages

As all other devel packages are written in the form "name devel",
use this form for libcap devel and libattr devel, too.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
8 years agoipack: Update e-mail address
Alberto Garcia [Tue, 23 Feb 2016 08:44:25 +0000 (10:44 +0200)]
ipack: Update e-mail address

I'm not really using the old one anymore.

Signed-off-by: Alberto Garcia <berto@igalia.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
8 years agoutil: fix comment typos
Wei Jiangang [Mon, 14 Mar 2016 09:58:29 +0000 (17:58 +0800)]
util: fix comment typos

Signed-off-by: Wei Jiangang <weijg.fnst@cn.fujitsu.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
8 years agoqdict: fix unbounded stack warning for qdict_array_entries
Peter Xu [Tue, 22 Mar 2016 02:37:26 +0000 (10:37 +0800)]
qdict: fix unbounded stack warning for qdict_array_entries

Here we use one g_strdup_printf() to replace the two stack allocated
array, considering it's more convenient, safe, and as long as it's
called rarely only when quorum device opens. This will remove the
unbound stack warning when compiling with "-Wstack-usage=1000000".

Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
8 years agoFix typo in variable name (found and fixed by codespell)
Stefan Weil [Mon, 21 Mar 2016 18:21:26 +0000 (19:21 +0100)]
Fix typo in variable name (found and fixed by codespell)

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Reviewed-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
8 years agovl: fix comment about when parsing cpu definitions
Wei Jiangang [Wed, 16 Mar 2016 09:40:40 +0000 (17:40 +0800)]
vl: fix comment about when parsing cpu definitions

machine->init() was replaced with machine_class->init()
in 958db90cd54823c33345000c995453a8c9b7a005.

Signed-off-by: Wei Jiangang <weijg.fnst@cn.fujitsu.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
8 years agoloader: fix potential memory leak
Cao jin [Wed, 24 Feb 2016 09:12:47 +0000 (17:12 +0800)]
loader: fix potential memory leak

Signed-off-by: Cao jin <caoj.fnst@cn.fujitsu.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
8 years agoremove comment for nonexistent structure member
Cao jin [Thu, 18 Feb 2016 08:18:56 +0000 (16:18 +0800)]
remove comment for nonexistent structure member

Signed-off-by: Cao jin <caoj.fnst@cn.fujitsu.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
8 years agos390: remove misleading comment
Michael Tokarev [Tue, 16 Feb 2016 06:29:07 +0000 (09:29 +0300)]
s390: remove misleading comment

The comment talks about a non-ELF object while the
example gives ELF object.

Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
8 years agoMerge remote-tracking branch 'remotes/cohuck/tags/s390x-20160517' into staging
Peter Maydell [Tue, 17 May 2016 15:49:11 +0000 (16:49 +0100)]
Merge remote-tracking branch 'remotes/cohuck/tags/s390x-20160517' into staging

First batch of s390x patches for 2.7:
- The new machine for 2.7
- Make use of the runtime instrumentation support introduced in
  the kernel
- Enhance our ipl (boot) process: We can now start from devices
  in subchannel sets > 0 as well. As a bonus, the conversion to
  diag308 in the bios allows us to get rid of the gr7 hack.
- Xiaoqiang Zhao's SCLP qomification patches
- Several fixes in the s390x pci implementation

# gpg: Signature made Tue 17 May 2016 15:35:32 BST using RSA key ID C6F02FAF
# gpg: Good signature from "Cornelia Huck <huckc@linux.vnet.ibm.com>"
# gpg:                 aka "Cornelia Huck <cornelia.huck@de.ibm.com>"

* remotes/cohuck/tags/s390x-20160517:
  s390x/pci: remove whitespace
  s390x/pci: add length checking for pci sclp handlers
  s390x/pci: enhance mpcifc_service_call
  s390x/pci: fix s390_pci_sclp_deconfigure
  s390x/pci: introduce S390PCIBusDevice.iommu_enabled
  s390x/pci: export pci_dereg_ioat and pci_dereg_irqs
  s390x/pci: separate s390_pcihost_iommu_configure function
  s390x/pci: separate s390_sclp_configure function
  s390x/pci: fix reg_irqs()
  hw/char: QOM'ify sclpconsole.c
  hw/char: QOM'ify sclpconsole-lm.c
  s390x/ipl: Remove redundant usage of gr7
  s390-ccw.img: rebuild image
  pc-bios/s390-ccw: Get device address via diag 308/6
  s390x/ipl: Add ssid field to IplParameterBlock
  s390x/ipl: Provide ipl parameter block
  s390x/ipl: Add type and length checks for IplParameterBlock values
  s390x/ipl: Extend the IplParameterBlock struct
  s390x: enable runtime instrumentation
  s390x: add compat machine for 2.7

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8 years agos390x/pci: remove whitespace
Yi Min Zhao [Mon, 9 May 2016 10:26:44 +0000 (18:26 +0800)]
s390x/pci: remove whitespace

Fix indentation of PciCfgSccb struct.

Signed-off-by: Yi Min Zhao <zyimin@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
8 years agos390x/pci: add length checking for pci sclp handlers
Yi Min Zhao [Wed, 4 May 2016 07:56:53 +0000 (15:56 +0800)]
s390x/pci: add length checking for pci sclp handlers

The configure/deconfigure sclp commands need a SCCB with a length of
at least 16. Indicate in the response code if this is not fulfilled.

Signed-off-by: Yi Min Zhao <zyimin@linux.vnet.ibm.com>
Reviewed-by: Pierre Morel <pmorel@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
8 years agos390x/pci: enhance mpcifc_service_call
Yi Min Zhao [Thu, 28 Apr 2016 05:24:07 +0000 (13:24 +0800)]
s390x/pci: enhance mpcifc_service_call

Enhance error handling for mpcifc_service_call() to propagate errors
to guest by setting status codes or triggering program interrupts.

Signed-off-by: Yi Min Zhao <zyimin@linux.vnet.ibm.com>
Reviewed-by: Pierre Morel <pmorel@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
8 years agos390x/pci: fix s390_pci_sclp_deconfigure
Yi Min Zhao [Thu, 28 Apr 2016 05:22:51 +0000 (13:22 +0800)]
s390x/pci: fix s390_pci_sclp_deconfigure

When deconfiguring a s390 pci device, we should deconfigure the
corresponding IOMMU memory region and the IRQs for the device.

Signed-off-by: Yi Min Zhao <zyimin@linux.vnet.ibm.com>
Reviewed-by: Pierre Morel <pmorel@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
8 years agos390x/pci: introduce S390PCIBusDevice.iommu_enabled
Yi Min Zhao [Wed, 4 May 2016 07:07:11 +0000 (15:07 +0800)]
s390x/pci: introduce S390PCIBusDevice.iommu_enabled

We introduce iommu_enabled field for S390PCIBusDevice struct to
track whether the iommu has been enabled for the device. This allows
us to stop temporarily changing ->configured while en/disabling the
iommu and to do conditional cleanup later.

Signed-off-by: Yi Min Zhao <zyimin@linux.vnet.ibm.com>
Reviewed-by: Pierre Morel <pmorel@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
8 years agos390x/pci: export pci_dereg_ioat and pci_dereg_irqs
Yi Min Zhao [Tue, 26 Apr 2016 06:50:16 +0000 (14:50 +0800)]
s390x/pci: export pci_dereg_ioat and pci_dereg_irqs

dereg_irqs and dereg_ioat are needed by external functions. Let's
rename and export both of them in s390-pci-inst.h.

Signed-off-by: Yi Min Zhao <zyimin@linux.vnet.ibm.com>
Reviewed-by: Pierre Morel <pmorel@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
8 years agos390x/pci: separate s390_pcihost_iommu_configure function
Yi Min Zhao [Wed, 4 May 2016 07:06:44 +0000 (15:06 +0800)]
s390x/pci: separate s390_pcihost_iommu_configure function

Split s390_pcihost_iommu_configure() into separate functions for
configuring and deconfiguring in order to make the code more readable.

Signed-off-by: Yi Min Zhao <zyimin@linux.vnet.ibm.com>
Reviewed-by: Pierre Morel <pmorel@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
8 years agos390x/pci: separate s390_sclp_configure function
Yi Min Zhao [Thu, 28 Apr 2016 04:33:53 +0000 (12:33 +0800)]
s390x/pci: separate s390_sclp_configure function

Split s390_sclp_configure() into separate functions for sclp
configuring and deconfiguring in order to make the code more readable.

Signed-off-by: Yi Min Zhao <zyimin@linux.vnet.ibm.com>
Reviewed-by: Pierre Morel <pmorel@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
8 years agos390x/pci: fix reg_irqs()
Yi Min Zhao [Tue, 26 Apr 2016 11:26:32 +0000 (19:26 +0800)]
s390x/pci: fix reg_irqs()

In reg_irqs(), present code assumes that map_indicator() always issues
successfully. Let's check it and return the error to caller in order to
inform guest.

Signed-off-by: Yi Min Zhao <zyimin@linux.vnet.ibm.com>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Reviewed-by: Pierre Morel <pmorel@linux.vnet.ibm.com>
Reviewed-by: Dong Jia Shi <bjsdjshi@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
8 years agohw/char: QOM'ify sclpconsole.c
xiaoqiang zhao [Tue, 29 Mar 2016 07:47:25 +0000 (15:47 +0800)]
hw/char: QOM'ify sclpconsole.c

Drop the DO_UPCAST macro

Signed-off-by: xiaoqiang zhao <zxq_yx_007@163.com>
Message-Id: <1459237645-17227-7-git-send-email-zxq_yx_007@163.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
8 years agohw/char: QOM'ify sclpconsole-lm.c
xiaoqiang zhao [Tue, 29 Mar 2016 07:47:24 +0000 (15:47 +0800)]
hw/char: QOM'ify sclpconsole-lm.c

Drop the DO_UPCAST macro

Signed-off-by: xiaoqiang zhao <zxq_yx_007@163.com>
Message-Id: <1459237645-17227-6-git-send-email-zxq_yx_007@163.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
8 years agos390x/ipl: Remove redundant usage of gr7
Alexander Yarygin [Tue, 22 Sep 2015 09:58:09 +0000 (12:58 +0300)]
s390x/ipl: Remove redundant usage of gr7

We don't need to pass device address for pc-bios using gr7 anymore as
the pcbios completely relies on diag308 now, so we can remove it from
qemu. devno, ssid and cssid are migrated but the value was never reused,
so we can safely ignore these fields and migrate 0.

Signed-off-by: Alexander Yarygin <yarygin@linux.vnet.ibm.com>
Reviewed-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
8 years agos390-ccw.img: rebuild image
Cornelia Huck [Mon, 25 Apr 2016 09:07:13 +0000 (11:07 +0200)]
s390-ccw.img: rebuild image

Contains the following change:

pc-bios/s390-ccw: Get device address via diag 308/6

Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
8 years agopc-bios/s390-ccw: Get device address via diag 308/6
Alexander Yarygin [Fri, 31 Jul 2015 14:04:51 +0000 (17:04 +0300)]
pc-bios/s390-ccw: Get device address via diag 308/6

To IPL from a device, pc-bios receives from qemu a device address via
general register 7. The better way to do it is to use diag308/6
instruction which returns so called
"IplParameterBlock". IplParameterBlock contains the device address for
IPL and additional parameters that can be used by pc-bios.

This patch allows pc-bios to get device address via diag308/6 and
doesn't use gr7 passed boot information anymore.

Signed-off-by: Alexander Yarygin <yarygin@linux.vnet.ibm.com>
Reviewed-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
8 years agos390x/ipl: Add ssid field to IplParameterBlock
Alexander Yarygin [Thu, 1 Oct 2015 17:21:33 +0000 (20:21 +0300)]
s390x/ipl: Add ssid field to IplParameterBlock

Add the ssid field to the ipl parameter block struct and fill it when
necessary so the guest can use it.

Signed-off-by: Alexander Yarygin <yarygin@linux.vnet.ibm.com>
Reviewed-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
8 years agos390x/ipl: Provide ipl parameter block
Alexander Yarygin [Tue, 21 Jul 2015 11:10:39 +0000 (14:10 +0300)]
s390x/ipl: Provide ipl parameter block

Right now we return the ipl parameter block only if the guest
specified one. Let's fill in the parameter block when bootindex
parameter is available and not booting from an external kernel.

Signed-off-by: Alexander Yarygin <yarygin@linux.vnet.ibm.com>
Reviewed-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
8 years agos390x/ipl: Add type and length checks for IplParameterBlock values
Alexander Yarygin [Mon, 10 Aug 2015 10:57:03 +0000 (13:57 +0300)]
s390x/ipl: Add type and length checks for IplParameterBlock values

We can check for valid type and lengths of the IplParameterBlock fields
when receiving the struct from the guest.

Length of the IplParameterBlock can be less than 4K. To play safe we can
read and write only required amount of data.

Signed-off-by: Alexander Yarygin <yarygin@linux.vnet.ibm.com>
Reviewed-by: David Hildenband <dahi@linux.vnet.ibm.com>
Acked-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
8 years agos390x/ipl: Extend the IplParameterBlock struct
Alexander Yarygin [Mon, 13 Jul 2015 12:04:36 +0000 (15:04 +0300)]
s390x/ipl: Extend the IplParameterBlock struct

The IplParameterBlock struct currently has only 200 bytes filled, but it
can be up to 4K.

This patch converts the struct to union with a fully populated struct
inside it and second struct with old values.

For compatibility reasons we disable migration of the extended iplb
field for pre-2.7 machines. Also a guest still can read/write only the
first 200 bytes of IPLB for now.

Signed-off-by: Alexander Yarygin <yarygin@linux.vnet.ibm.com>
Reviewed-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Acked-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
8 years agos390x: enable runtime instrumentation
Fan Zhang [Wed, 9 Mar 2016 12:11:17 +0000 (13:11 +0100)]
s390x: enable runtime instrumentation

Introduce run-time-instrumentation support when running under kvm for
virtio-ccw 2.7 machine and make sure older machines can not enable it.

The new ri_allowed field in the s390MachineClass serves as an indicator
whether the feature can be used by the machine and should therefore be
activated if available.

riccb_needed() is used to check whether riccb is needed or not in live
migration.

Signed-off-by: Fan Zhang <zhangfan@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
8 years agos390x: add compat machine for 2.7
Cornelia Huck [Mon, 25 Apr 2016 08:37:23 +0000 (10:37 +0200)]
s390x: add compat machine for 2.7

Also add some of the option cascading we were missing.

Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
8 years agoMerge remote-tracking branch 'remotes/stefanha/tags/tracing-pull-request' into staging
Peter Maydell [Tue, 17 May 2016 13:07:25 +0000 (14:07 +0100)]
Merge remote-tracking branch 'remotes/stefanha/tags/tracing-pull-request' into staging

# gpg: Signature made Tue 17 May 2016 14:06:54 BST using RSA key ID 81AB73C8
# gpg: Good signature from "Stefan Hajnoczi <stefanha@redhat.com>"
# gpg:                 aka "Stefan Hajnoczi <stefanha@gmail.com>"

* remotes/stefanha/tags/tracing-pull-request:
  hw/intc/arm_gic: add tracepoints

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8 years agoMerge remote-tracking branch 'remotes/stefanha/tags/block-pull-request' into staging
Peter Maydell [Tue, 17 May 2016 09:35:50 +0000 (10:35 +0100)]
Merge remote-tracking branch 'remotes/stefanha/tags/block-pull-request' into staging

# gpg: Signature made Tue 17 May 2016 01:19:39 BST using RSA key ID 81AB73C8
# gpg: Good signature from "Stefan Hajnoczi <stefanha@redhat.com>"
# gpg:                 aka "Stefan Hajnoczi <stefanha@gmail.com>"

* remotes/stefanha/tags/block-pull-request:
  rfifolock: no need to get thread identifier when nesting

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8 years agoMerge remote-tracking branch 'remotes/thibault/tags/samuel-thibault' into staging
Peter Maydell [Tue, 17 May 2016 08:16:00 +0000 (09:16 +0100)]
Merge remote-tracking branch 'remotes/thibault/tags/samuel-thibault' into staging

slirp updates

# gpg: Signature made Mon 16 May 2016 20:22:36 BST using RSA key ID FB6B2F1D
# gpg: Good signature from "Samuel Thibault <samuel.thibault@gnu.org>"
# gpg:                 aka "Samuel Thibault <sthibault@debian.org>"
# gpg:                 aka "Samuel Thibault <samuel.thibault@inria.fr>"
# gpg:                 aka "Samuel Thibault <samuel.thibault@labri.fr>"
# gpg:                 aka "Samuel Thibault <samuel.thibault@ens-lyon.org>"
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: 900C B024 B679 31D4 0F82  304B D017 8C76 7D06 9EE6
#      Subkey fingerprint: F632 74CD C630 0873 CB3D  29D9 E3E5 1CE8 FB6B 2F1D

* remotes/thibault/tags/samuel-thibault:
  slirp: Clean up osdep.h related header inclusions
  slirp: Remove some unused code from slirp.h
  slirp: Remove obsolete backward-compatibility cruft
  slirp: Clean up slirp_config.h

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8 years agohw/intc/arm_gic: add tracepoints
Hollis Blanchard [Thu, 21 Apr 2016 15:24:41 +0000 (08:24 -0700)]
hw/intc/arm_gic: add tracepoints

These are obviously critical to understanding interrupt delivery:
gic_enable_irq
gic_disable_irq
gic_set_irq (inbound irq from device models)
gic_update_set_irq (outbound irq to CPU)
gic_acknowledge_irq

The only one that I think might raise eyebrows is gic_update_bestirq, but I've
(sadly) debugged problems that ended up being caused by unexpected priorities.
Knowing that the GIC has an irq ready, but doesn't deliver to the CPU due to
priority, has also proven important.

Signed-off-by: Hollis Blanchard <hollis_blanchard@mentor.com>
Message-id: 1461252281-22399-1-git-send-email-hollis_blanchard@mentor.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
8 years agorfifolock: no need to get thread identifier when nesting
Changlong Xie [Tue, 10 May 2016 09:59:08 +0000 (17:59 +0800)]
rfifolock: no need to get thread identifier when nesting

Signed-off-by: Changlong Xie <xiecl.fnst@cn.fujitsu.com>
Reviewed-by: Denis V. Lunev <den@openvz.org>
Message-id: 1462874348-32396-1-git-send-email-xiecl.fnst@cn.fujitsu.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
8 years agoslirp: Clean up osdep.h related header inclusions
Thomas Huth [Fri, 13 May 2016 07:04:32 +0000 (09:04 +0200)]
slirp: Clean up osdep.h related header inclusions

qemu/osdep.h is included in some headers twice - one time
should be sufficient.
Also remove the inclusion of time.h since that is already
done by osdep.h, too (this makes scripts/clean-includes
happy again).

Signed-off-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
8 years agoslirp: Remove some unused code from slirp.h
Thomas Huth [Fri, 13 May 2016 07:04:31 +0000 (09:04 +0200)]
slirp: Remove some unused code from slirp.h

These hunks are apparently not used anymore, so let's delete them.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
8 years agoslirp: Remove obsolete backward-compatibility cruft
Thomas Huth [Fri, 13 May 2016 07:04:30 +0000 (09:04 +0200)]
slirp: Remove obsolete backward-compatibility cruft

The slirp code does not use index() and gethostid() anymore,
so these parts can be removed without problems.
memmove() and strerror() should be available on each of the
supported platforms nowadays, too, so these wrappers are also
not needed anymore.
And we certainly also do not support Ultrix anymore, so no
need to keep the code for this platform anymore.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
8 years agoslirp: Clean up slirp_config.h
Thomas Huth [Fri, 13 May 2016 07:04:29 +0000 (09:04 +0200)]
slirp: Clean up slirp_config.h

There are a lot of unused #defines / #undefs in slirp_config.h,
which are apparently left-overs from the very early slirp code.
Since there is no more code that uses them, let's simply remove
them from our version of slirp.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
8 years agoMerge remote-tracking branch 'remotes/kraxel/tags/pull-ui-20160513-1' into staging
Peter Maydell [Fri, 13 May 2016 12:39:38 +0000 (13:39 +0100)]
Merge remote-tracking branch 'remotes/kraxel/tags/pull-ui-20160513-1' into staging

gtk/sdl build tweaks
fix gtk 3.20 warnings
gtk clipboard support
spice-gl monitor config support
fix coverity warnings

# gpg: Signature made Fri 13 May 2016 13:30:39 BST using RSA key ID D3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>"
# gpg:                 aka "Gerd Hoffmann <gerd@kraxel.org>"
# gpg:                 aka "Gerd Hoffmann (private) <kraxel@gmail.com>"

* remotes/kraxel/tags/pull-ui-20160513-1:
  gtk: don't leak the GtkBorder with VTE 0.36
  gtk: update grab code for gtk 3.20
  spice: fix coverity complains
  egl-helpers: fix possible resource leak
  Changed malloc to g_malloc, free to g_free in ui/shader.c
  spice/gl: add & use qemu_spice_gl_monitor_config
  ui/gtk: copy to clipboard support
  ui: gtk: Fix some deprecation warnings
  ui: gtk: Fix a runtime warning on vte >= 0.37
  configure: support vte-2.91
  configure: report SDL version
  configure: report GTK version
  configure: add echo_version helper
  configure: error on unknown --with-sdlabi value
  configure: build SDL if only SDL2 available
  ui: sdl2: Release grab before opening console window
  ui: gtk: fix crash when terminal inner-border is NULL

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8 years agoMerge remote-tracking branch 'remotes/lalrae/tags/mips-20160513' into staging
Peter Maydell [Fri, 13 May 2016 10:50:42 +0000 (11:50 +0100)]
Merge remote-tracking branch 'remotes/lalrae/tags/mips-20160513' into staging

MIPS patches 2016-05-13

Changes:
* fix zeroing CP0.WatchLo registers in soft reset
* QOMify Jazz led

# gpg: Signature made Fri 13 May 2016 11:04:04 BST using RSA key ID 0B29DA6B
# gpg: Good signature from "Leon Alrae <leon.alrae@imgtec.com>"

* remotes/lalrae/tags/mips-20160513:
  hw/display: QOM'ify jazz_led.c
  target-mips: fix call to memset in soft reset code

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8 years agogtk: don't leak the GtkBorder with VTE 0.36
Alberto Garcia [Fri, 13 May 2016 08:20:54 +0000 (11:20 +0300)]
gtk: don't leak the GtkBorder with VTE 0.36

When gtk_widget_style_get() is used to get the "inner-border" style
property, it returns a copy of the GtkBorder which must be freed by
the caller.

This patch also fixes a warning about the unused 'padding' structure
with VTE 0.36.

Signed-off-by: Alberto Garcia <berto@igalia.com>
Message-id: 1463127654-5171-1-git-send-email-berto@igalia.com
Cc: Cole Robinson <crobinso@redhat.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
[ kraxel: adapted to changes in ui patch queue ]

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
8 years agoMerge remote-tracking branch 'remotes/rth/tags/pull-tcg-20160512' into staging
Peter Maydell [Fri, 13 May 2016 09:42:40 +0000 (10:42 +0100)]
Merge remote-tracking branch 'remotes/rth/tags/pull-tcg-20160512' into staging

queued 2.7 patches

# gpg: Signature made Fri 13 May 2016 01:08:20 BST using RSA key ID 4DD0279B
# gpg: Good signature from "Richard Henderson <rth7680@gmail.com>"
# gpg:                 aka "Richard Henderson <rth@redhat.com>"
# gpg:                 aka "Richard Henderson <rth@twiddle.net>"

* remotes/rth/tags/pull-tcg-20160512: (39 commits)
  cpu-exec: Clean up 'interrupt_request' reloading in cpu_handle_interrupt()
  cpu-exec: Remove unused 'x86_cpu' and 'env' from cpu_exec()
  cpu-exec: Move TB execution stuff out of cpu_exec()
  cpu-exec: Move interrupt handling out of cpu_exec()
  cpu-exec: Move exception handling out of cpu_exec()
  cpu-exec: Move halt handling out of cpu_exec()
  cpu-exec: Remove relic orphaned comment
  tcg: Remove needless CPUState::current_tb
  cpu-exec: Move TB chaining into tb_find_fast()
  tcg: Rework tb_invalidated_flag
  tcg: Clean up from 'next_tb'
  cpu-exec: elide more icount code if CONFIG_USER_ONLY
  tcg: reorganize tb_find_physical loop
  tcg: code_bitmap and code_write_count are not used by user-mode emulation
  tcg: Allow goto_tb to any target PC in user mode
  tcg: Clean up direct block chaining safety checks
  tcg: Clean up tb_jmp_unlink()
  tcg: Extract removing of jumps to TB from tb_phys_invalidate()
  tcg: Rename tb_jmp_remove() to tb_remove_from_jmp_list()
  tcg: Clarify thread safety check in tb_add_jump()
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8 years agohw/display: QOM'ify jazz_led.c
xiaoqiang.zhao [Thu, 5 May 2016 03:04:46 +0000 (11:04 +0800)]
hw/display: QOM'ify jazz_led.c

* Drop the old SysBus init function and use instance_init
* Move graphic_console_init into realize stage

Signed-off-by: xiaoqiang zhao <zxq_yx_007@163.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Leon Alrae <leon.alrae@imgtec.com>
8 years agocpu-exec: Clean up 'interrupt_request' reloading in cpu_handle_interrupt()
Sergey Fedorov [Thu, 12 May 2016 16:52:17 +0000 (19:52 +0300)]
cpu-exec: Clean up 'interrupt_request' reloading in cpu_handle_interrupt()

Suggested-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Sergey Fedorov <serge.fdrv@gmail.com>
Signed-off-by: Sergey Fedorov <sergey.fedorov@linaro.org>
Message-Id: <1463071937-26607-1-git-send-email-sergey.fedorov@linaro.org>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
8 years agocpu-exec: Remove unused 'x86_cpu' and 'env' from cpu_exec()
Sergey Fedorov [Wed, 11 May 2016 10:21:51 +0000 (13:21 +0300)]
cpu-exec: Remove unused 'x86_cpu' and 'env' from cpu_exec()

Signed-off-by: Sergey Fedorov <serge.fdrv@gmail.com>
Signed-off-by: Sergey Fedorov <sergey.fedorov@linaro.org>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Message-Id: <1462962111-32237-6-git-send-email-sergey.fedorov@linaro.org>
Signed-off-by: Richard Henderson <rth@twiddle.net>
8 years agocpu-exec: Move TB execution stuff out of cpu_exec()
Sergey Fedorov [Wed, 11 May 2016 10:21:50 +0000 (13:21 +0300)]
cpu-exec: Move TB execution stuff out of cpu_exec()

Simplify cpu_exec() by extracting TB execution code outside of
cpu_exec() into a new static inline function cpu_loop_exec_tb().

Signed-off-by: Sergey Fedorov <serge.fdrv@gmail.com>
Signed-off-by: Sergey Fedorov <sergey.fedorov@linaro.org>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Message-Id: <1462962111-32237-5-git-send-email-sergey.fedorov@linaro.org>
Signed-off-by: Richard Henderson <rth@twiddle.net>
8 years agocpu-exec: Move interrupt handling out of cpu_exec()
Sergey Fedorov [Wed, 11 May 2016 10:21:49 +0000 (13:21 +0300)]
cpu-exec: Move interrupt handling out of cpu_exec()

Simplify cpu_exec() by extracting interrupt handling code outside of
cpu_exec() into a new static inline function cpu_handle_interrupt().

Signed-off-by: Sergey Fedorov <serge.fdrv@gmail.com>
Signed-off-by: Sergey Fedorov <sergey.fedorov@linaro.org>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Message-Id: <1462962111-32237-4-git-send-email-sergey.fedorov@linaro.org>
Signed-off-by: Richard Henderson <rth@twiddle.net>
8 years agocpu-exec: Move exception handling out of cpu_exec()
Sergey Fedorov [Wed, 11 May 2016 10:21:48 +0000 (13:21 +0300)]
cpu-exec: Move exception handling out of cpu_exec()

Simplify cpu_exec() by extracting exception handling code out of
cpu_exec() into a new static inline function cpu_handle_exception().
Also make cpu_handle_debug_exception() inline as it is used only once.

Signed-off-by: Sergey Fedorov <serge.fdrv@gmail.com>
Signed-off-by: Sergey Fedorov <sergey.fedorov@linaro.org>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Message-Id: <1462962111-32237-3-git-send-email-sergey.fedorov@linaro.org>
Signed-off-by: Richard Henderson <rth@twiddle.net>
8 years agocpu-exec: Move halt handling out of cpu_exec()
Sergey Fedorov [Wed, 11 May 2016 10:21:47 +0000 (13:21 +0300)]
cpu-exec: Move halt handling out of cpu_exec()

Simplify cpu_exec() by extracting CPU halt state handling code out of
cpu_exec() into a new static inline function cpu_handle_halt().

Signed-off-by: Sergey Fedorov <serge.fdrv@gmail.com>
Signed-off-by: Sergey Fedorov <sergey.fedorov@linaro.org>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Message-Id: <1462962111-32237-2-git-send-email-sergey.fedorov@linaro.org>
Signed-off-by: Richard Henderson <rth@twiddle.net>
8 years agocpu-exec: Remove relic orphaned comment
Sergey Fedorov [Tue, 3 May 2016 14:34:10 +0000 (17:34 +0300)]
cpu-exec: Remove relic orphaned comment

This comment should have been deleted by commit 0ac087f1f3ae ("removed
unused code") but somehow it is still here. There's no point to keep it.

Signed-off-by: Sergey Fedorov <serge.fdrv@gmail.com>
Signed-off-by: Sergey Fedorov <sergey.fedorov@linaro.org>
Message-Id: <1462286050-21778-1-git-send-email-sergey.fedorov@linaro.org>
Signed-off-by: Richard Henderson <rth@twiddle.net>
8 years agotcg: Remove needless CPUState::current_tb
Sergey Fedorov [Tue, 3 May 2016 11:04:22 +0000 (14:04 +0300)]
tcg: Remove needless CPUState::current_tb

This field was used for telling cpu_interrupt() to unlink a chain of TBs
being executed when it worked that way. Now, cpu_interrupt() don't do
this anymore. So we don't need this field anymore.

Signed-off-by: Sergey Fedorov <serge.fdrv@gmail.com>
Signed-off-by: Sergey Fedorov <sergey.fedorov@linaro.org>
Message-Id: <1462273462-14036-1-git-send-email-sergey.fedorov@linaro.org>
Signed-off-by: Richard Henderson <rth@twiddle.net>
8 years agocpu-exec: Move TB chaining into tb_find_fast()
Sergey Fedorov [Mon, 25 Apr 2016 15:17:30 +0000 (18:17 +0300)]
cpu-exec: Move TB chaining into tb_find_fast()

Move tb_add_jump() call and surrounding code from cpu_exec() into
tb_find_fast(). That simplifies cpu_exec() a little by hiding the direct
chaining optimization details into tb_find_fast(). It also allows to
move tb_lock()/tb_unlock() pair into tb_find_fast(), putting it closer
to tb_find_slow() which also manipulates the lock.

Suggested-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Sergey Fedorov <serge.fdrv@gmail.com>
Signed-off-by: Sergey Fedorov <sergey.fedorov@linaro.org>
Signed-off-by: Richard Henderson <rth@twiddle.net>
[rth: Fixed rebase typo in nochain test.]

8 years agotcg: Rework tb_invalidated_flag
Sergey Fedorov [Wed, 13 Apr 2016 19:40:18 +0000 (22:40 +0300)]
tcg: Rework tb_invalidated_flag

'tb_invalidated_flag' was meant to catch two events:
 * some TB has been invalidated by tb_phys_invalidate();
 * the whole translation buffer has been flushed by tb_flush().

Then it was checked:
 * in cpu_exec() to ensure that the last executed TB can be safely
   linked to directly call the next one;
 * in cpu_exec_nocache() to decide if the original TB should be provided
   for further possible invalidation along with the temporarily
   generated TB.

It is always safe to patch an invalidated TB since it is not going to be
used anyway. It is also safe to call tb_phys_invalidate() for an already
invalidated TB. Thus, setting this flag in tb_phys_invalidate() is
simply unnecessary. Moreover, it can prevent from pretty proper linking
of TBs, if any arbitrary TB has been invalidated. So just don't touch it
in tb_phys_invalidate().

If this flag is only used to catch whether tb_flush() has been called
then rename it to 'tb_flushed'. Declare it as 'bool' and stick to using
only 'true' and 'false' to set its value. Also, instead of setting it in
tb_gen_code(), just after tb_flush() has been called, do it right inside
of tb_flush().

In cpu_exec(), this flag is used to track if tb_flush() has been called
and have made 'next_tb' (a reference to the last executed TB) invalid
for linking it to directly call the next TB. tb_flush() can be called
during the CPU execution loop from tb_gen_code(), during TB execution or
by another thread while 'tb_lock' is released. Catch for translation
buffer flush reliably by resetting this flag once before first TB lookup
and each time we find it set before trying to add a direct jump. Don't
touch in in tb_find_physical().

Each vCPU has its own execution loop in multithreaded mode and thus
should have its own copy of the flag to be able to reset it with its own
'next_tb' and don't affect any other vCPU execution thread. So make this
flag per-vCPU and move it to CPUState.

In cpu_exec_nocache(), we only need to check if tb_flush() has been
called from tb_gen_code() called by cpu_exec_nocache() itself. To do
this reliably, preserve the old value of the flag, reset it before
calling tb_gen_code(), check afterwards, and combine the saved value
back to the flag.

This patch is based on the patch "tcg: move tb_invalidated_flag to
CPUState" from Paolo Bonzini <pbonzini@redhat.com>.

Signed-off-by: Sergey Fedorov <serge.fdrv@gmail.com>
Signed-off-by: Sergey Fedorov <sergey.fedorov@linaro.org>
Signed-off-by: Richard Henderson <rth@twiddle.net>
8 years agotcg: Clean up from 'next_tb'
Sergey Fedorov [Thu, 21 Apr 2016 12:58:23 +0000 (15:58 +0300)]
tcg: Clean up from 'next_tb'

The value returned from tcg_qemu_tb_exec() is the value passed to the
corresponding tcg_gen_exit_tb() at translation time of the last TB
attempted to execute. It is a little confusing to store it in a variable
named 'next_tb'. In fact, it is a combination of 4-byte aligned pointer
and additional information in its two least significant bits. Break it
down right away into two variables named 'last_tb' and 'tb_exit' which
are a pointer to the last TB attempted to execute and the TB exit
reason, correspondingly. This simplifies the code and improves its
readability.

Correct a misleading documentation comment for tcg_qemu_tb_exec() and
fix logging in cpu_tb_exec(). Also rename a misleading 'next_tb' in
another couple of places.

Signed-off-by: Sergey Fedorov <serge.fdrv@gmail.com>
Signed-off-by: Sergey Fedorov <sergey.fedorov@linaro.org>
Signed-off-by: Richard Henderson <rth@twiddle.net>
8 years agocpu-exec: elide more icount code if CONFIG_USER_ONLY
Paolo Bonzini [Tue, 11 Aug 2015 09:05:12 +0000 (11:05 +0200)]
cpu-exec: elide more icount code if CONFIG_USER_ONLY

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
[Alex Bennée: #ifndef replay code to match elided functions]
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Sergey Fedorov <sergey.fedorov@linaro.org>
Signed-off-by: Richard Henderson <rth@twiddle.net>
8 years agotcg: reorganize tb_find_physical loop
Alex Bennée [Tue, 22 Mar 2016 14:59:20 +0000 (14:59 +0000)]
tcg: reorganize tb_find_physical loop

Put some comments and improve code structure. This should help reading
the code.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
[Sergey Fedorov: provide commit message; bring back resetting of
tb_invalidated_flag]
Signed-off-by: Sergey Fedorov <sergey.fedorov@linaro.org>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
8 years agotcg: code_bitmap and code_write_count are not used by user-mode emulation
Paolo Bonzini [Tue, 11 Aug 2015 10:42:55 +0000 (12:42 +0200)]
tcg: code_bitmap and code_write_count are not used by user-mode emulation

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
[Sergey Fedorov: eliminate the field entirely in user-mode]
Signed-off-by: Sergey Fedorov <sergey.fedorov@linaro.org>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
[rth: merged followup fixup]
Message-Id: <1462982777-4513-1-git-send-email-sergey.fedorov@linaro.org>
Signed-off-by: Richard Henderson <rth@twiddle.net>
8 years agotcg: Allow goto_tb to any target PC in user mode
Sergey Fedorov [Fri, 8 Apr 2016 22:00:23 +0000 (01:00 +0300)]
tcg: Allow goto_tb to any target PC in user mode

In user mode, there's only a static address translation, TBs are always
invalidated properly and direct jumps are reset when mapping change.
Thus the destination address is always valid for direct jumps and
there's no need to restrict it to the pages the TB resides in.

Signed-off-by: Sergey Fedorov <serge.fdrv@gmail.com>
Signed-off-by: Sergey Fedorov <sergey.fedorov@linaro.org>
Cc: Riku Voipio <riku.voipio@iki.fi>
Cc: Blue Swirl <blauwirbel@gmail.com>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Richard Henderson <rth@twiddle.net>
8 years agotcg: Clean up direct block chaining safety checks
Sergey Fedorov [Fri, 8 Apr 2016 16:48:12 +0000 (19:48 +0300)]
tcg: Clean up direct block chaining safety checks

We don't take care of direct jumps when address mapping changes. Thus we
must be sure to generate direct jumps so that they always keep valid
even if address mapping changes. Luckily, we can only allow to execute a
TB if it was generated from the pages which match with current mapping.

Document tcg_gen_goto_tb() declaration and note the reason for
destination PC limitations.

Some targets with variable length instructions allow TB to straddle a
page boundary. However, we make sure that both of TB pages match the
current address mapping when looking up TBs. So it is safe to do direct
jumps into the both pages. Correct the checks for some of those targets.

Given that, we can safely patch a TB which spans two pages. Remove the
unnecessary check in cpu_exec() and allow such TBs to be patched.

Signed-off-by: Sergey Fedorov <serge.fdrv@gmail.com>
Signed-off-by: Sergey Fedorov <sergey.fedorov@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Richard Henderson <rth@twiddle.net>
8 years agotcg: Clean up tb_jmp_unlink()
Sergey Fedorov [Wed, 23 Mar 2016 18:47:33 +0000 (21:47 +0300)]
tcg: Clean up tb_jmp_unlink()

Unify the code of this function with tb_jmp_remove_from_list(). Making
these functions similar improves their readability. Also this could be a
step towards making this function thread-safe.

Signed-off-by: Sergey Fedorov <serge.fdrv@gmail.com>
Signed-off-by: Sergey Fedorov <sergey.fedorov@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Richard Henderson <rth@twiddle.net>
8 years agotcg: Extract removing of jumps to TB from tb_phys_invalidate()
Sergey Fedorov [Wed, 23 Mar 2016 15:36:31 +0000 (18:36 +0300)]
tcg: Extract removing of jumps to TB from tb_phys_invalidate()

Move the code for removing jumps to a TB out of tb_phys_invalidate() to
a separate static inline function tb_jmp_unlink(). This simplifies
tb_phys_invalidate() and improves code structure.

Signed-off-by: Sergey Fedorov <serge.fdrv@gmail.com>
Signed-off-by: Sergey Fedorov <sergey.fedorov@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Richard Henderson <rth@twiddle.net>
8 years agotcg: Rename tb_jmp_remove() to tb_remove_from_jmp_list()
Sergey Fedorov [Wed, 23 Mar 2016 15:30:16 +0000 (18:30 +0300)]
tcg: Rename tb_jmp_remove() to tb_remove_from_jmp_list()

tb_jmp_remove() was only used to remove the TB from a list of all TBs
jumping to the same TB which is n-th jump destination of the given TB.
Put a comment briefly describing the function behavior and rename it to
better reflect its purpose.

Signed-off-by: Sergey Fedorov <serge.fdrv@gmail.com>
Signed-off-by: Sergey Fedorov <sergey.fedorov@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Richard Henderson <rth@twiddle.net>
8 years agotcg: Clarify thread safety check in tb_add_jump()
Sergey Fedorov [Wed, 20 Apr 2016 20:15:09 +0000 (23:15 +0300)]
tcg: Clarify thread safety check in tb_add_jump()

The check is to make sure that another thread hasn't already done the
same while we were outside of tb_lock. Mention this in a comment.

Signed-off-by: Sergey Fedorov <serge.fdrv@gmail.com>
Signed-off-by: Sergey Fedorov <sergey.fedorov@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Richard Henderson <rth@twiddle.net>