]> git.proxmox.com Git - mirror_qemu.git/log
mirror_qemu.git
7 years agobus: simplify name handling
Marc-André Lureau [Fri, 15 Jul 2016 10:04:49 +0000 (12:04 +0200)]
bus: simplify name handling

Simplify a bit the code by using g_strdup_printf() and store it in a
non-const value so casting is no longer needed, and ownership is
clearer.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
7 years agoipmi: free extern timer
Marc-André Lureau [Fri, 15 Jul 2016 08:58:05 +0000 (10:58 +0200)]
ipmi: free extern timer

Free the timer allocated during instance init.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Corey Minyard <cminyard@mvista.com>
7 years agosd: free timer
Marc-André Lureau [Thu, 14 Jul 2016 16:03:49 +0000 (18:03 +0200)]
sd: free timer

Free the timer allocated in instance_init.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Andrew Baumann <Andrew.Baumann@microsoft.com>
7 years agopc: keep gsi reference
Marc-André Lureau [Thu, 14 Jul 2016 16:03:29 +0000 (18:03 +0200)]
pc: keep gsi reference

Further cleanup would need to call qemu_free_irq() at the appropriate
time, but for now this silences ASAN about direct leaks.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
7 years agopc: free i8259
Marc-André Lureau [Thu, 14 Jul 2016 12:27:17 +0000 (14:27 +0200)]
pc: free i8259

Simiarly to 2ba154cf4eb8636cdd3aa90f392ca9e77206ca39

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Marcel Apfelbaum <marcel@redhat.com>
7 years agotests: fix qom-test leaks
Marc-André Lureau [Thu, 14 Jul 2016 02:27:20 +0000 (04:27 +0200)]
tests: fix qom-test leaks

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
7 years agoacpi-build: fix array leak
Marc-André Lureau [Wed, 13 Jul 2016 10:56:01 +0000 (12:56 +0200)]
acpi-build: fix array leak

The free_ranges array is used as a temporary pointer array, the segment
should still be freed, however, it shouldn't free the elements themself.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Tested-by: Marcel Apfelbaum <marcel@redhat.com>
Reviewed-by: Marcel Apfelbaum <marcel@redhat.com>
7 years agomachine: use class base init generated name
Marc-André Lureau [Wed, 13 Jul 2016 10:45:50 +0000 (12:45 +0200)]
machine: use class base init generated name

machine_class_base_init() member name is allocated by
machine_class_base_init(), but not freed by
machine_class_finalize().  Simply freeing there doesn't work,
because DEFINE_PC_MACHINE() overwrites it with a literal string.

Fix DEFINE_PC_MACHINE() not to overwrite it, and add the missing
free to machine_class_finalize().

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
7 years agopc: don't leak a20_line
Marc-André Lureau [Wed, 13 Jul 2016 00:53:46 +0000 (02:53 +0200)]
pc: don't leak a20_line

The irqs array is no longer being used

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
7 years agopc: simplify passing qemu_irq
Marc-André Lureau [Fri, 15 Jul 2016 16:42:05 +0000 (18:42 +0200)]
pc: simplify passing qemu_irq

qemu_irq is already a pointer, no need to have an extra pointer level.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
7 years agoportio: keep references on portio
Marc-André Lureau [Wed, 13 Jul 2016 00:11:59 +0000 (02:11 +0200)]
portio: keep references on portio

The isa_register_portio_list() function allocates ioports
data/state. Let's keep the reference to this data on some owner.  This
isn't enough to fix leaks, but at least, ASAN stops complaining of
direct leaks. Further cleanup would require calling
portio_list_del/destroy().

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
7 years agotests: fix leak in test-string-input-visitor
Marc-André Lureau [Tue, 12 Jul 2016 14:08:47 +0000 (16:08 +0200)]
tests: fix leak in test-string-input-visitor

Free the list returned by visit_type_intList().

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
7 years agotests: fix check-qom-proplist leaks
Marc-André Lureau [Thu, 7 Jul 2016 19:49:41 +0000 (21:49 +0200)]
tests: fix check-qom-proplist leaks

Found thanks to ASAN.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
7 years agotests: fix check-qom-interface leaks
Marc-André Lureau [Thu, 7 Jul 2016 19:30:32 +0000 (21:30 +0200)]
tests: fix check-qom-interface leaks

Found thanks to ASAN.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
7 years agotests: fix test-iov leaks
Marc-André Lureau [Thu, 7 Jul 2016 19:00:05 +0000 (21:00 +0200)]
tests: fix test-iov leaks

Spotted thanks to ASAN.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
7 years agotests: fix test-vmstate leaks
Marc-André Lureau [Thu, 7 Jul 2016 18:48:06 +0000 (20:48 +0200)]
tests: fix test-vmstate leaks

Spotted thanks to ASAN.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
7 years agotests: fix test-cutils leaks
Marc-André Lureau [Thu, 7 Jul 2016 18:43:40 +0000 (20:43 +0200)]
tests: fix test-cutils leaks

Spotted thanks to ASAN.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
7 years agoqga: free remaining leaking state
Marc-André Lureau [Fri, 15 Jul 2016 15:52:52 +0000 (17:52 +0200)]
qga: free remaining leaking state

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
7 years agoqga: free the whole blacklist
Marc-André Lureau [Fri, 15 Jul 2016 16:17:41 +0000 (18:17 +0200)]
qga: free the whole blacklist

Free the config blacklist list, not just the elements. Do it so in the
more appropriate function config_free().

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
7 years agoglib-compat: add g_(s)list_free_full()
Marc-André Lureau [Fri, 5 Aug 2016 07:16:07 +0000 (11:16 +0400)]
glib-compat: add g_(s)list_free_full()

Those functions are only available since glib 2.28.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
7 years agotests: fix test-qga leaks
Marc-André Lureau [Fri, 15 Jul 2016 16:00:18 +0000 (18:00 +0200)]
tests: fix test-qga leaks

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
7 years agoMerge remote-tracking branch 'remotes/dgibson/tags/ppc-for-2.8-20160907' into staging
Peter Maydell [Thu, 8 Sep 2016 10:28:11 +0000 (11:28 +0100)]
Merge remote-tracking branch 'remotes/dgibson/tags/ppc-for-2.8-20160907' into staging

ppc patch queue for 2016-Sep-7

This is my first pull request for the newly opened qemu-2.8 tree.  It
contains a heap of things that were too late for 2.7 and have been
queued for a while.  In particular:
    * A number of preliminary patches for the powernv machine type
        * A substantial cleanup of exception handling which will be
          necessary to support running a TCG with hypervisor
          facilities
    * A start on support for POWER9
        * Some TCG implementations for new POWER9 instructions
        * Some TCG and related cleanups in preparation for POWER9
    * Some assorted TCG optimizations
    * An implementation of the H_CHANGE_LOGICAL_LAN_MAC hypercall
      which allows the MAC address to be changed on the PAPR virtual
      NIC.
    * Add some extra test cases for several machines (this isn't
      strictly in the ppc code, but is most value to ppc)

NOTE: This pull request supersedes ppc-for-2.8-20160906, which had
some problems.  Changes:
  * Dropped BenH's lmw/stmw speedups, which break for
    qemu-system-ppc64 on BE hosts
  * A small fix to Thomas' serial output test to avoid a warning on
    the isapc machine type.
  * Some trivial checkpatch fixes

Note that some of the patches in this series still have large numbers
of checkpatch warnings.  This is because they're moving existing code
that predates most of the checkpatch style conventions.

# gpg: Signature made Wed 07 Sep 2016 07:09:27 BST
# gpg:                using RSA key 0x6C38CACA20D9B392
# gpg: Good signature from "David Gibson <david@gibson.dropbear.id.au>"
# gpg:                 aka "David Gibson (Red Hat) <dgibson@redhat.com>"
# gpg:                 aka "David Gibson (ozlabs.org) <dgibson@ozlabs.org>"
# gpg:                 aka "David Gibson (kernel.org) <dwg@kernel.org>"
# Primary key fingerprint: 75F4 6586 AE61 A66C C44E  87DC 6C38 CACA 20D9 B392

* remotes/dgibson/tags/ppc-for-2.8-20160907: (64 commits)
  tests: Check serial output of firmware boot of some machines
  tests: Resort check-qtest entries in Makefile.include
  spapr: implement H_CHANGE_LOGICAL_LAN_MAC h_call
  ppc: Improve a few more helper flags
  ppc: Improve the exception helpers flags
  ppc: Improve flags for helpers loading/writing the time facilities
  ppc: Don't generate dead code on unconditional branches
  ppc: Stop dumping state on all exceptions in linux-user
  ppc: Fix catching some segfaults in user mode
  ppc: Fix macio ESCC legacy mapping
  hw/ppc: add a ppc_create_page_sizes_prop() helper routine
  hw/ppc: use error_report instead of fprintf
  ppc: Rename #include'd .c files to .inc.c
  target-ppc: add extswsli[.] instruction
  target-ppc: add vsrv instruction
  target-ppc: add vslv instruction
  target-ppc: add vcmpnez[b,h,w][.] instructions
  target-ppc: add vabsdu[b,h,w] instructions
  target-ppc: add dtstsfi[q] instructions
  target-ppc: implement branch-less divd[o][.]
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7 years agotests/hd-geo-test: Don't pass NULL to unlink()
Peter Maydell [Fri, 5 Aug 2016 10:03:12 +0000 (11:03 +0100)]
tests/hd-geo-test: Don't pass NULL to unlink()

The unlink() function doesn't accept a NULL pointer, so
don't pass it one. Spotted by the clang sanitizer.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: John Snow <jsnow@redhat.com>
Message-id: 1470391392-28274-1-git-send-email-peter.maydell@linaro.org

7 years agotests: Check serial output of firmware boot of some machines
Thomas Huth [Sat, 3 Sep 2016 09:57:51 +0000 (11:57 +0200)]
tests: Check serial output of firmware boot of some machines

Some of the machines that we have got a firmware image for write
some output to the serial console while booting up. We can use
this output to make sure that the machine is basically working,
so this adds a test that checks the output of these machines
for some well-known "magic" strings.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
7 years agotests: Resort check-qtest entries in Makefile.include
Thomas Huth [Sat, 3 Sep 2016 09:57:50 +0000 (11:57 +0200)]
tests: Resort check-qtest entries in Makefile.include

The rather random list of check-qtest-xxx entries caused some
confusion in the past, where to use "=" and where to use "+="
(see commits 0ccac16f59462b8e2b9afbc1 and 1f5c1cfbaec0792cd2e5da
for example).
Sorting the check-qtest-xxx entries by architecure instead and
using some empty lines inbetween should help to ease this
situation a little bit, so that it is hopefully now obvious
that new tests should be added with "+=" instead of "=".
While we are at it, this patch also comments out two of the
"gcov-files-..." lines since the corresponding m48t59-test is
disabled for sparc and sparc64, too.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
7 years agospapr: implement H_CHANGE_LOGICAL_LAN_MAC h_call
Laurent Vivier [Thu, 1 Sep 2016 08:10:49 +0000 (10:10 +0200)]
spapr: implement H_CHANGE_LOGICAL_LAN_MAC h_call

Since kernel v4.0, linux uses H_CHANGE_LOGICAL_LAN_MAC to change lively
the MAC address of an ibmveth interface.

As QEMU doesn't implement this h_call, we can't change anymore the
MAC address of an spapr-vlan interface.

Signed-off-by: Laurent Vivier <lvivier@redhat.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
7 years agoppc: Improve a few more helper flags
Benjamin Herrenschmidt [Sun, 31 Jul 2016 05:13:12 +0000 (15:13 +1000)]
ppc: Improve a few more helper flags

Mostly turn "store" type of helpers into TCG_CALL_NO_WG because
they can take exceptions. Also fixup_thrm doesn't read nor write
the tracked environment.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
7 years agoppc: Improve the exception helpers flags
Benjamin Herrenschmidt [Sun, 31 Jul 2016 05:13:11 +0000 (15:13 +1000)]
ppc: Improve the exception helpers flags

They generate exceptions, but they don't update the environment

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
7 years agoppc: Improve flags for helpers loading/writing the time facilities
Benjamin Herrenschmidt [Sun, 31 Jul 2016 05:13:10 +0000 (15:13 +1000)]
ppc: Improve flags for helpers loading/writing the time facilities

Those helpers never load from or store to the TCG tracked environment,
not do they generate synchronous exceptions (they might generate an
asynchronous interrupt but that's not an issue here).

So we can make them all use TCG_CALL_NO_RWG

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
7 years agoppc: Don't generate dead code on unconditional branches
Benjamin Herrenschmidt [Sun, 31 Jul 2016 05:13:09 +0000 (15:13 +1000)]
ppc: Don't generate dead code on unconditional branches

We are always generating the "else" case of the condition even when
generating an unconditional branch that will never hit it.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
7 years agoppc: Stop dumping state on all exceptions in linux-user
Benjamin Herrenschmidt [Wed, 3 Aug 2016 11:44:08 +0000 (21:44 +1000)]
ppc: Stop dumping state on all exceptions in linux-user

Other archs don't do it, some programs catch signals just fine
and those dumps just clutter the output. Keep the dumps for cases
that aren't supposed to happen such as unknown codes.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
7 years agoppc: Fix catching some segfaults in user mode
Benjamin Herrenschmidt [Wed, 3 Aug 2016 07:55:23 +0000 (17:55 +1000)]
ppc: Fix catching some segfaults in user mode

The usermode "translate" code generates an error code value that
has the "is_write" bit set, which causes our switch/case to miss
and display "Invalid segfault errno" and a spurrious second state
dump. Fix it.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
7 years agoppc: Fix macio ESCC legacy mapping
Benjamin Herrenschmidt [Tue, 2 Aug 2016 09:22:43 +0000 (19:22 +1000)]
ppc: Fix macio ESCC legacy mapping

The current mapping, while correct for the base ports (which is all the
driver uses these days), is wrong for the extended registers.

I suspect the bugs come from incorrect tables in the CHRP IO Ref document,
I have verified the new values here match Apple's MacTech.pdf.

Note: Nothing that I know of actually uses these registers so it's not a
huge deal, but this patch has the added advantage of adding comments to
document what the registers are.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
7 years agohw/ppc: add a ppc_create_page_sizes_prop() helper routine
Cédric Le Goater [Tue, 2 Aug 2016 17:38:01 +0000 (19:38 +0200)]
hw/ppc: add a ppc_create_page_sizes_prop() helper routine

The exact same routine will be used in PowerNV.

Signed-off-by: Cédric Le Goater <clg@kaod.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
7 years agohw/ppc: use error_report instead of fprintf
Cédric Le Goater [Tue, 2 Aug 2016 17:38:00 +0000 (19:38 +0200)]
hw/ppc: use error_report instead of fprintf

Signed-off-by: Cédric Le Goater <clg@kaod.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
7 years agoppc: Rename #include'd .c files to .inc.c
Benjamin Herrenschmidt [Mon, 1 Aug 2016 10:17:42 +0000 (20:17 +1000)]
ppc: Rename #include'd .c files to .inc.c

Also while at it, group the #include statements in translate.c

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
7 years agotarget-ppc: add extswsli[.] instruction
Nikunj A Dadhania [Thu, 28 Jul 2016 18:14:18 +0000 (23:44 +0530)]
target-ppc: add extswsli[.] instruction

extswsli : Extend Sign Word & Shift Left Immediate

Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
7 years agotarget-ppc: add vsrv instruction
Vivek Andrew Sha [Thu, 28 Jul 2016 18:14:17 +0000 (23:44 +0530)]
target-ppc: add vsrv instruction

Adds Vector Shift Right Variable instruction.

Signed-off-by: Vivek Andrew Sha <vivekandrewsha@gmail.com>
[ reverse the order of computation to avoid temporary array ]
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
7 years agotarget-ppc: add vslv instruction
Vivek Andrew Sha [Thu, 28 Jul 2016 18:14:16 +0000 (23:44 +0530)]
target-ppc: add vslv instruction

vslv: Vector Shift Left Variable

Signed-off-by: Vivek Andrew Sha <vivekandrewsha@gmail.com>
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
7 years agotarget-ppc: add vcmpnez[b,h,w][.] instructions
Swapnil Bokade [Thu, 28 Jul 2016 18:14:15 +0000 (23:44 +0530)]
target-ppc: add vcmpnez[b,h,w][.] instructions

Adds following instructions:

vcmpnezb[.]: Vector Compare Not Equal or Zero Byte
vcmpnezh[.]: Vector Compare Not Equal or Zero Halfword
vcmpnezw[.]: Vector Compare Not Equal or Zero Word

Signed-off-by: Swapnil Bokade <bokadeswapnil@gmail.com>
[ collapse switch case ]
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
7 years agotarget-ppc: add vabsdu[b,h,w] instructions
Sandipan Das [Thu, 28 Jul 2016 18:14:14 +0000 (23:44 +0530)]
target-ppc: add vabsdu[b,h,w] instructions

Adds following instructions:

vabsdub: Vector Absolute Difference Unsigned Byte
vabsduh: Vector Absolute Difference Unsigned Halfword
vabsduw: Vector Absolute Difference Unsigned Word

Signed-off-by: Sandipan Das <sandipandas1990@gmail.com>
[ use ISA300 define. Drop etype ]
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
7 years agotarget-ppc: add dtstsfi[q] instructions
Sandipan Das [Thu, 28 Jul 2016 18:14:13 +0000 (23:44 +0530)]
target-ppc: add dtstsfi[q] instructions

DFP Test Significance Immediate [Quad]

Signed-off-by: Sandipan Das <sandipandas1990@gmail.com>
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
7 years agotarget-ppc: implement branch-less divd[o][.]
Nikunj A Dadhania [Thu, 28 Jul 2016 18:14:12 +0000 (23:44 +0530)]
target-ppc: implement branch-less divd[o][.]

Similar to divw, implement branch-less divd.

Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
7 years agotarget-ppc: implement branch-less divw[o][.]
Nikunj A Dadhania [Thu, 28 Jul 2016 18:14:11 +0000 (23:44 +0530)]
target-ppc: implement branch-less divw[o][.]

While implementing modulo instructions figured out that the
implementation uses many branches. Change the logic to achieve the
branch-less code. Undefined value is set to dividend in case of invalid
input.

Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
7 years agoppc: load/store multiple and string insns don't do LE
Benjamin Herrenschmidt [Wed, 27 Jul 2016 06:56:48 +0000 (16:56 +1000)]
ppc: load/store multiple and string insns don't do LE

Just generate an alignment interrupt

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
7 years agoppc: Use a helper to generate "LE unsupported" alignment interrupts
Benjamin Herrenschmidt [Wed, 27 Jul 2016 06:56:47 +0000 (16:56 +1000)]
ppc: Use a helper to generate "LE unsupported" alignment interrupts

Some operations aren't allowed in LE mode, use a helper rather than
open coding the exception generation.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
7 years agoppc: Don't set access_type on all load/stores on hash64
Benjamin Herrenschmidt [Wed, 27 Jul 2016 06:56:46 +0000 (16:56 +1000)]
ppc: Don't set access_type on all load/stores on hash64

We don't use it so let's not generate the updates.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
7 years agoppc: Fix CFAR updates
Benjamin Herrenschmidt [Wed, 27 Jul 2016 06:56:44 +0000 (16:56 +1000)]
ppc: Fix CFAR updates

We were one instruction off

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
7 years agoppc: Speed up dcbz
Benjamin Herrenschmidt [Wed, 27 Jul 2016 06:56:43 +0000 (16:56 +1000)]
ppc: Speed up dcbz

Use tlb_vaddr_to_host to do a fast path single translate for
the whole cache line. Also make the reservation check match
the entire range.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
7 years agoppc: Handle unconditional (always/never) traps at translation time
Benjamin Herrenschmidt [Wed, 27 Jul 2016 06:56:42 +0000 (16:56 +1000)]
ppc: Handle unconditional (always/never) traps at translation time

We don't need to call a helper for trap always and trap never
which are used by Linux under some circumstances.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
--

v2. Don't generate the helper call when trapping always
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
7 years agoppc: Make alignment exceptions suck less
Benjamin Herrenschmidt [Wed, 27 Jul 2016 06:56:41 +0000 (16:56 +1000)]
ppc: Make alignment exceptions suck less

The current alignment exception generation tries to load the opcode
to put in DSISR from a context where a cpu_ldl_code() is really not
a good idea. It might fault and longjmp out and that's not something
we want happening here.

Instead, pass the releavant opcode bits via the error_code.

There are a couple of cases of alignment interrupts that won't set
anything, the ones coming from access to direct store segments, but
that doesn't happen in practice, nobody used direct store segments
and they are gone from newer chips.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
7 years agoppc: Don't update NIP in dcbz and lscbx
Benjamin Herrenschmidt [Wed, 27 Jul 2016 06:56:40 +0000 (16:56 +1000)]
ppc: Don't update NIP in dcbz and lscbx

Instead, pass GETPC() result to the corresponding helpers.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
7 years agoppc: Don't update NIP if not taking alignment exceptions
Benjamin Herrenschmidt [Wed, 27 Jul 2016 06:56:39 +0000 (16:56 +1000)]
ppc: Don't update NIP if not taking alignment exceptions

Move the NIP update to after the conditional branch so that we
don't do it if we aren't going to take the alignment exception

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
7 years agoppc: Don't update NIP on conditional trap instructions
Benjamin Herrenschmidt [Wed, 27 Jul 2016 06:56:38 +0000 (16:56 +1000)]
ppc: Don't update NIP on conditional trap instructions

This is no longer necessary as the helpers will properly retrieve
the return address when needed.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
7 years agoppc: Don't update NIP BookE 2.06 tlbwe
Benjamin Herrenschmidt [Wed, 27 Jul 2016 06:56:37 +0000 (16:56 +1000)]
ppc: Don't update NIP BookE 2.06 tlbwe

This is no longer necessary as the helpers will properly retrieve
the return address when needed.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
7 years agoppc: Don't update NIP in facility unavailable interrupts
Benjamin Herrenschmidt [Wed, 27 Jul 2016 06:56:36 +0000 (16:56 +1000)]
ppc: Don't update NIP in facility unavailable interrupts

This is no longer necessary as the helpers will properly retrieve
the return address when needed. Also remove gen_update_current_nip()
which didn't seem to make much sense to me.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
7 years agoppc: Don't update NIP in DCR access routines
Benjamin Herrenschmidt [Wed, 27 Jul 2016 06:56:35 +0000 (16:56 +1000)]
ppc: Don't update NIP in DCR access routines

This is no longer necessary as the helpers will properly retrieve
the return address when needed

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
7 years agoppc: Fix source NIP on SLB related interrupts
Benjamin Herrenschmidt [Wed, 27 Jul 2016 06:56:34 +0000 (16:56 +1000)]
ppc: Fix source NIP on SLB related interrupts

We need to pass it to the raise helper since we don't update it
before the calls.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
7 years agoppc: Make tlb_fill() use new exception helper
Benjamin Herrenschmidt [Wed, 27 Jul 2016 06:56:32 +0000 (16:56 +1000)]
ppc: Make tlb_fill() use new exception helper

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
7 years agoppc: Don't update NIP in lmw/stmw/icbi
Benjamin Herrenschmidt [Wed, 27 Jul 2016 06:56:31 +0000 (16:56 +1000)]
ppc: Don't update NIP in lmw/stmw/icbi

Instead, pass GETPC() result to the corresponding helpers.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
7 years agoppc: Don't update NIP in lswi/lswx/stswi/stswx
Benjamin Herrenschmidt [Wed, 27 Jul 2016 06:56:30 +0000 (16:56 +1000)]
ppc: Don't update NIP in lswi/lswx/stswi/stswx

Instead, pass GETPC() result to the corresponding helpers. This
requires a bit of fiddling to get the PC (hopefully) right in
the case where we generate a program check, though the hacks there
are temporary, a subsequent patch will clean this all up by always
having the nip already set to the right instruction when taking
the fault.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
[dwg: Fix trivial checkpatch warning]
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
7 years agoppc: FP exceptions are always precise
Benjamin Herrenschmidt [Wed, 27 Jul 2016 06:56:29 +0000 (16:56 +1000)]
ppc: FP exceptions are always precise

We don't implement imprecise FP exceptions and using store_current
which sets SRR1 to the *previous* instruction never makes sense
for these. So let's be truthful and make them precise, which is
allowed by the architecture.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
7 years agoppc: Don't update the NIP in floating point generated code
Benjamin Herrenschmidt [Wed, 27 Jul 2016 06:56:28 +0000 (16:56 +1000)]
ppc: Don't update the NIP in floating point generated code

This is no longer necessary as the helpers will properly retrieve
the return address.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
7 years agoppc: Make float_check_status() pass the return address
Benjamin Herrenschmidt [Wed, 27 Jul 2016 06:56:27 +0000 (16:56 +1000)]
ppc: Make float_check_status() pass the return address

Instead of relying on NIP having been updated already.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
[dwg: Fold in fix to mark function always_inline]
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
7 years agoppc: Make float_invalid_op_excp() pass the return address
Benjamin Herrenschmidt [Wed, 27 Jul 2016 06:56:26 +0000 (16:56 +1000)]
ppc: Make float_invalid_op_excp() pass the return address

Instead of relying on NIP having been updated already

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
7 years agoppc: Rename fload_invalid_op_excp to float_invalid_op_excp
Benjamin Herrenschmidt [Wed, 27 Jul 2016 06:56:25 +0000 (16:56 +1000)]
ppc: Rename fload_invalid_op_excp to float_invalid_op_excp

No other change

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
7 years agoppc: Move VSX ops out of translate.c
Benjamin Herrenschmidt [Wed, 27 Jul 2016 06:56:24 +0000 (16:56 +1000)]
ppc: Move VSX ops out of translate.c

Makes things a bit more manageable

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
7 years agoppc: Move VMX ops out of translate.c
Benjamin Herrenschmidt [Wed, 27 Jul 2016 06:56:23 +0000 (16:56 +1000)]
ppc: Move VMX ops out of translate.c

Makes things a bit more manageable

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
7 years agoppc: Move DFP ops out of translate.c
Benjamin Herrenschmidt [Wed, 27 Jul 2016 06:56:22 +0000 (16:56 +1000)]
ppc: Move DFP ops out of translate.c

Makes things a bit more manageable

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
7 years agoppc: Move embedded spe ops out of translate.c
Benjamin Herrenschmidt [Wed, 27 Jul 2016 06:56:21 +0000 (16:56 +1000)]
ppc: Move embedded spe ops out of translate.c

Makes things a bit more manageable

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
7 years agoppc: Move classic fp ops out of translate.c
Benjamin Herrenschmidt [Wed, 27 Jul 2016 06:56:20 +0000 (16:56 +1000)]
ppc: Move classic fp ops out of translate.c

Makes things a bit more manageable

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
7 years agoppc: Provide basic raise_exception_* functions
Benjamin Herrenschmidt [Wed, 27 Jul 2016 06:56:19 +0000 (16:56 +1000)]
ppc: Provide basic raise_exception_* functions

Instead of using the same helpers called from translate.c, let's have
a bunch of functions that take the various argument combinations,
especially the retaddr which will be needed in subsequent patches,
and leave the helpers to be just that, helpers for translate.c

We don't yet convert all users, we'll go through them in subsequent
patches.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
--

v2. Fix raise_exception_ra() to properly pass raddr
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
7 years agotarget-ppc: introduce opc4 for Expanded Opcode
Nikunj A Dadhania [Tue, 26 Jul 2016 11:58:38 +0000 (17:28 +0530)]
target-ppc: introduce opc4 for Expanded Opcode

ISA 3.0 has introduced EO - Expanded Opcode. Introduce third level
indirect opcode table and corresponding parsing routines.

EO (11:12) Expanded opcode field
Formats: XX1

EO (11:15) Expanded opcode field
Formats: VX, X, XX2

Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
[dwg: Trivial checkpatch fixup]
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
7 years agotarget-ppc: add maddhd and maddhdu instruction
Nikunj A Dadhania [Tue, 26 Jul 2016 11:58:37 +0000 (17:28 +0530)]
target-ppc: add maddhd and maddhdu instruction

maddhd: Multiply-Add High Doubleword
maddhdu: Multiply-Add High Doubleword Unsigned

Above two instruction are dual form and differ by 1 bit
(31st bit)

Multiplies two 64-bit registers (RA * RB), adds third register(RC) to
the result(quadword) and returns the higher dword in the target
register(RT).

Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
7 years agotarget-ppc: add maddld instruction
Nikunj A Dadhania [Tue, 26 Jul 2016 11:58:36 +0000 (17:28 +0530)]
target-ppc: add maddld instruction

maddld: Multiply-Add Low Doubleword

Multiplies two 64-bit registers (RA * RB), adds third register(RC) to
the result(quadword) and returns the lower dword in the target
register(RT).

Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
7 years agotarget-ppc: add setb instruction
Vivek Andrew Sha [Tue, 26 Jul 2016 11:58:35 +0000 (17:28 +0530)]
target-ppc: add setb instruction

The CR number is provided in the opcode as - BFA (11:13)

Returns:
  -1 if bit 0 of CR field is set
   1 if bit 1 of CR field is set
   0 otherwise.

Signed-off-by: Vivek Andrew Sha <vivekandrewsha@gmail.com>
[ reworded commit, used 32bit ops as crf is 32bits ]
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
7 years agotarget-ppc: add cmpeqb instruction
Nikunj A Dadhania [Tue, 26 Jul 2016 11:58:34 +0000 (17:28 +0530)]
target-ppc: add cmpeqb instruction

Search a byte in the stream of 8bytes provided in the register

Suggested-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
7 years agotarget-ppc: add cnttzw[.] instruction
Nikunj A Dadhania [Tue, 26 Jul 2016 11:58:33 +0000 (17:28 +0530)]
target-ppc: add cnttzw[.] instruction

Add ISA3.0: Count trailing zeros word instruction.

Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
7 years agotarget-ppc: add cnttzd[.] instruction
Sandipan Das [Tue, 26 Jul 2016 11:58:32 +0000 (17:28 +0530)]
target-ppc: add cnttzd[.] instruction

Add ISA3.0 Count trailing zeros double word

Signed-off-by: Sandipan Das <sandipandas1990@gmail.com>
[ added ISA300 flag ]
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
7 years agotarget-ppc: add modulo dword operations
Nikunj A Dadhania [Tue, 26 Jul 2016 11:58:29 +0000 (17:28 +0530)]
target-ppc: add modulo dword operations

Adding following instructions for ISA3.0 support

modud: Modulo Unsigned Dword
modsd: Modulo Signed Dword

Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
Reviewed-by: Richard Henderson <rth@twiddle.net
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
7 years agotarget-ppc: add modulo word operations
Nikunj A Dadhania [Tue, 26 Jul 2016 11:58:28 +0000 (17:28 +0530)]
target-ppc: add modulo word operations

Adding following instructions:

moduw: Modulo Unsigned Word
modsw: Modulo Signed Word

Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
7 years agotarget-ppc: add cmprb instruction
Nikunj A Dadhania [Tue, 26 Jul 2016 11:58:27 +0000 (17:28 +0530)]
target-ppc: add cmprb instruction

ISA 3.0 Compare Ranged Byte instruction useful for
isupper/islower/isaplha kind of operation.

Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
7 years agotarget-ppc: adding addpcis instruction
Nikunj A Dadhania [Tue, 26 Jul 2016 11:58:26 +0000 (17:28 +0530)]
target-ppc: adding addpcis instruction

ISA 3.0 instruction for adding immediate value shifted with next
instruction address and return the result in the target register.

Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
7 years agotarget-ppc: Introduce POWER ISA 3.0 flag
Nikunj A Dadhania [Tue, 26 Jul 2016 11:58:25 +0000 (17:28 +0530)]
target-ppc: Introduce POWER ISA 3.0 flag

This flag will be used for POWER9 instructions.

Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
7 years agotarget-ppc: Introduce Power9 family
Aneesh Kumar K.V [Tue, 26 Jul 2016 11:58:24 +0000 (17:28 +0530)]
target-ppc: Introduce Power9 family

The patch adds CPU PVR definition for POWER9 and enables QEMU to launch
guests/linux-user in TCG mode.

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
[ Added POWER9 alias, POWER9 SPAPR core and dropped MMU defines ]
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
[dwg: Dropped sPAPR core type again for now]
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
7 years agohw/ppc: include fdt helper routine in a common file
Cédric Le Goater [Mon, 25 Jul 2016 14:24:41 +0000 (16:24 +0200)]
hw/ppc: include fdt helper routine in a common file

spapr_pci would also be a good candidate but the macro _FDT is
slightly different. It returns and does not exit.

Signed-off-by: Cédric Le Goater <clg@kaod.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
7 years agoxics_kvm: drop extra checking of kernel_xics_fd
Greg Kurz [Thu, 21 Jul 2016 07:15:50 +0000 (09:15 +0200)]
xics_kvm: drop extra checking of kernel_xics_fd

We abort a few lines above if kernel_xics_fd == -1.

This is only code cleanup.

Signed-off-by: Greg Kurz <groug@kaod.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
7 years agoMerge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20160906-1' into...
Peter Maydell [Tue, 6 Sep 2016 19:03:58 +0000 (20:03 +0100)]
Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20160906-1' into staging

target-arm queue:
 * fix incorrect LPAE bit in FSR for alignment faults
 * ACPI: fix the AML ID format for CPU devices to work for
   large numbers of CPUs
 * ast2400: add memory controller device model
 * m25p80: fix the vmstate structure name (migration break)

# gpg: Signature made Tue 06 Sep 2016 20:02:28 BST
# gpg:                using RSA key 0x3C2525ED14360CDE
# gpg: Good signature from "Peter Maydell <peter.maydell@linaro.org>"
# gpg:                 aka "Peter Maydell <pmaydell@gmail.com>"
# gpg:                 aka "Peter Maydell <pmaydell@chiark.greenend.org.uk>"
# Primary key fingerprint: E1A5 C593 CD41 9DE2 8E83  15CF 3C25 25ED 1436 0CDE

* remotes/pmaydell/tags/pull-target-arm-20160906-1:
  block: m25p80: Fix vmstate structure name
  ARM: ACPI: fix the AML ID format for CPU devices
  target-arm: Fix lpae bit in FSR on an alignment fault
  ast2400: add a memory controller device model

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7 years agoblock: m25p80: Fix vmstate structure name
Marcin Krzeminski [Tue, 6 Sep 2016 18:52:18 +0000 (19:52 +0100)]
block: m25p80: Fix vmstate structure name

Correct bad name of the vmstate structure. Since this breaks
compatibility also update vmstate version back to 0 and make
all fields independent of the VMState version.

Signed-off-by: Marcin Krzeminski <marcin.krzeminski@nokia.com>
Acked-by: Alistair Francis <alistair.francis@xilinx.com>
Message-id: 1473146346-27337-1-git-send-email-marcin.krzeminski@nokia.com
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7 years agoARM: ACPI: fix the AML ID format for CPU devices
Wei Huang [Tue, 6 Sep 2016 18:52:17 +0000 (19:52 +0100)]
ARM: ACPI: fix the AML ID format for CPU devices

Current QEMU will stall guest VM booting under ACPI mode when vcpu count
is >= 12. Analyzing the booting log, it turns out that DSDT table can't
be loaded correctly due to "Invalid character(s) in name (0x62303043),
repaired: [C00*]". This is because existing QEMU uses a lower case AML
ID for CPU devices (e.g. C000, C001, ..., C00a, C00b). The ACPI code
inside guest VM detects this lower case character as an invalid character
(see acpi_ut_valid_acpi_char() in drivers/acpi/acpica/utstring.c file)
and converts it to "*". This causes duplicated IDs (i.e. "C00a" ==>"C00*"
and "C00b" ==> "C00*"). So ACPI refuses to load the table.

This patch fixes the problem by changing the format with a upper case
character. It matches the CPU ID formats used in other parts of QEMU
code.

Reported-by: Eric Auger <eric.auger@redhat.com>
Signed-off-by: Wei Huang <wei@redhat.com>
Reviewed-by: Shannon Zhao <shannon.zhao@linaro.org>
Reviewed-by: Eric Auger <eric.auger@redhat.com>
Tested-by: Eric Auger <eric.auger@redhat.com>
Message-id: 1472852809-23042-1-git-send-email-wei@redhat.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7 years agotarget-arm: Fix lpae bit in FSR on an alignment fault
Sergey Sorokin [Tue, 6 Sep 2016 18:52:17 +0000 (19:52 +0100)]
target-arm: Fix lpae bit in FSR on an alignment fault

If an alignment fault occurred and target EL is using AArch32,
then DFSR/IFSR bit LPAE[9] must be set correctly.

Signed-off-by: Sergey Sorokin <afarallax@yandex.ru>
Message-id: 1471283293-169850-1-git-send-email-afarallax@yandex.ru
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7 years agoast2400: add a memory controller device model
Cédric Le Goater [Tue, 6 Sep 2016 18:52:17 +0000 (19:52 +0100)]
ast2400: add a memory controller device model

The uboot in the previous release of the SDK was using a hardcoded
value for memory size. This is not true anymore, the value is now
retrieved from the memory controller.

Below is a model for this device, only supporting unlock and
configuration. Without it, we endup running a guest with 64MB, which
is a bit low nowdays. It uses a 'silicon-rev' property and ram_size to
build a default value. Some bits should be linked to SCU strapping
registers but it seems a bit complex to add for the current need.

The model is ready for the AST2500 SOC.

Signed-off-by: Cédric Le Goater <clg@kaod.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7 years agoMerge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging
Peter Maydell [Tue, 6 Sep 2016 16:18:17 +0000 (17:18 +0100)]
Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging

Block layer patches

# gpg: Signature made Tue 06 Sep 2016 11:38:01 BST
# gpg:                using RSA key 0x7F09B272C88F2FD6
# gpg: Good signature from "Kevin Wolf <kwolf@redhat.com>"
# Primary key fingerprint: DC3D EB15 9A9A F95D 3D74  56FE 7F09 B272 C88F 2FD6

* remotes/kevin/tags/for-upstream: (36 commits)
  block: Allow node name for 'qemu-io' HMP command
  qemu-iotests: Log QMP traffic in debug mode
  block jobs: Improve error message for missing job ID
  coroutine: Assert that no locks are held on termination
  coroutine: Let CoMutex remember who holds it
  qcow2: fix iovec size at qcow2_co_pwritev_compressed
  test-coroutine: Fix coroutine pool corruption
  qemu-iotests: add vmdk for test backup compression in 055
  qemu-iotests: test backup compression in 055
  blockdev-backup: added support for data compression
  drive-backup: added support for data compression
  block: simplify blockdev-backup
  block: simplify drive-backup
  block/io: turn on dirty_bitmaps for the compressed writes
  block: remove BlockDriver.bdrv_write_compressed
  qcow: cleanup qcow_co_pwritev_compressed to avoid the recursion
  qcow: add qcow_co_pwritev_compressed
  vmdk: add vmdk_co_pwritev_compressed
  qcow2: cleanup qcow2_co_pwritev_compressed to avoid the recursion
  qcow2: add qcow2_co_pwritev_compressed
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7 years agoMerge remote-tracking branch 'remotes/cohuck/tags/s390x-20160906-v2' into staging
Peter Maydell [Tue, 6 Sep 2016 15:17:19 +0000 (16:17 +0100)]
Merge remote-tracking branch 'remotes/cohuck/tags/s390x-20160906-v2' into staging

First (big) chunk of s390x updates:
- cpumodel support for s390x
- various fixes and improvements

# gpg: Signature made Tue 06 Sep 2016 16:09:53 BST
# gpg:                using RSA key 0xDECF6B93C6F02FAF
# gpg: Good signature from "Cornelia Huck <huckc@linux.vnet.ibm.com>"
# gpg:                 aka "Cornelia Huck <cornelia.huck@de.ibm.com>"
# Primary key fingerprint: C3D0 D66D C362 4FF6 A8C0  18CE DECF 6B93 C6F0 2FAF

* remotes/cohuck/tags/s390x-20160906-v2: (38 commits)
  s390x/cpumodel: implement QMP interface "query-cpu-model-baseline"
  s390x/cpumodel: implement QMP interface "query-cpu-model-comparison"
  s390x/cpumodel: implement QMP interface "query-cpu-model-expansion"
  qmp: add QMP interface "query-cpu-model-baseline"
  qmp: add QMP interface "query-cpu-model-comparison"
  qmp: add QMP interface "query-cpu-model-expansion"
  s390x/kvm: don't enable key wrapping if msa3 is disabled
  s390x/kvm: let the CPU model control CMM(A)
  s390x/kvm: disable host model for problematic compat machines
  s390x/kvm: implement CPU model support
  s390x/kvm: allow runtime-instrumentation for "none" machine
  s390x/sclp: propagate hmfai
  s390x/sclp: propagate the mha via sclp
  s390x/sclp: propagate the ibc val (lowest and unblocked ibc)
  s390x/sclp: indicate sclp features
  s390x/sclp: introduce sclp feature blocks
  s390x/sclp: factor out preparation of cpu entries
  s390x/cpumodel: check and apply the CPU model
  s390x/cpumodel: let the CPU model handle feature checks
  s390x/cpumodel: expose features and feature groups as properties
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7 years agos390x/cpumodel: implement QMP interface "query-cpu-model-baseline"
David Hildenbrand [Mon, 5 Sep 2016 08:52:44 +0000 (10:52 +0200)]
s390x/cpumodel: implement QMP interface "query-cpu-model-baseline"

Let's implement that interface by reusing our conversion code and
lookup code for CPU definitions.

In order to find a compatible CPU model, we first detect the maximum
possible CPU generation and then try to find a maximum model, satisfying
all base features (not exceeding the maximum generation).

Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Message-Id: <20160905085244.99980-31-dahi@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
7 years agos390x/cpumodel: implement QMP interface "query-cpu-model-comparison"
David Hildenbrand [Mon, 5 Sep 2016 08:52:43 +0000 (10:52 +0200)]
s390x/cpumodel: implement QMP interface "query-cpu-model-comparison"

Let's implement that interface by reusing our convertion code implemented
for expansion.

We use CPU generations and CPU features to calculate the result. This
means, that a zEC12 cannot simply be converted into a z13 by stripping
of features. This is required, as other magic values (e.g. maximum
address sizes) belong to a CPU generation and cannot simply be
emulated by an older generation.

Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Message-Id: <20160905085244.99980-30-dahi@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
7 years agos390x/cpumodel: implement QMP interface "query-cpu-model-expansion"
David Hildenbrand [Mon, 5 Sep 2016 08:52:42 +0000 (10:52 +0200)]
s390x/cpumodel: implement QMP interface "query-cpu-model-expansion"

In order to expand CPU models, we create temporary cpus that handle the
feature/group parsing. Only CPU feature properties are expanded.

When converting the data structure back, we always fall back to the
static base CPU model, which is by definition migration-safe.

Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Message-Id: <20160905085244.99980-29-dahi@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
7 years agoqmp: add QMP interface "query-cpu-model-baseline"
David Hildenbrand [Mon, 5 Sep 2016 08:52:41 +0000 (10:52 +0200)]
qmp: add QMP interface "query-cpu-model-baseline"

Let's provide a standardized interface to baseline two CPU models, to
create a third, compatible one. This is especially helpful when two
CPU models are not identical, but a CPU model is required that is
guaranteed to run under both configurations, where the original models run.

"query-cpu-model-baseline" takes two CPU models and returns a third,
compatible model. The result will always be a static CPU model.

Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Message-Id: <20160905085244.99980-28-dahi@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
7 years agoqmp: add QMP interface "query-cpu-model-comparison"
David Hildenbrand [Mon, 5 Sep 2016 08:52:40 +0000 (10:52 +0200)]
qmp: add QMP interface "query-cpu-model-comparison"

Let's provide a standardized interface to compare two CPU models.
"query-cpu-model-compare" takes two models and returns  how they compare
in a specific configuration.

The result will give guarantees about runnability. E.g. if a CPU model A
is a subset of CPU model B, model A is guaranteed to run in configurations
where model B runs, but not the other way around (might or might not run).

Usually, CPU features or CPU generations are used to calculate the result.
If a model is not guaranteed to run in a certain environment (e.g.
incompatible), a  compatible one can be created by "baselining" both models
(follow up patch).

Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Message-Id: <20160905085244.99980-27-dahi@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
7 years agoqmp: add QMP interface "query-cpu-model-expansion"
David Hildenbrand [Mon, 5 Sep 2016 08:52:39 +0000 (10:52 +0200)]
qmp: add QMP interface "query-cpu-model-expansion"

Let's provide a standardized interface to expand CPU models. This interface
can be used by tooling to get details about a specific CPU model in a
certain configuration, e.g. about the "host" model.

To take care of all architectures, two detail levels for an expansion
are introduced. Certain architectures might not support all detail levels.
While "full" will expand and indicate all relevant properties/features
of a CPU model, "static" expands to a static base CPU model, that will
never change between QEMU versions and therefore have the same features
when used under different compatibility machines.

Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Message-Id: <20160905085244.99980-26-dahi@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>