]> git.karo-electronics.de Git - karo-tx-linux.git/log
karo-tx-linux.git
7 years agopowerpc/xmon: Add 'dt' command to dump trace buffers
Michael Ellerman [Fri, 6 Nov 2015 02:21:17 +0000 (13:21 +1100)]
powerpc/xmon: Add 'dt' command to dump trace buffers

There is a nice interface for asking ftrace to dump all its tracing
buffers. The only down side for use in xmon is that it uses printk.
Depending on circumstances printk may not work when in xmon, but it also
may, so add a 'dt' command which dumps the ftrace buffers, and add a
note to the help to mentiont that it uses printk.

Calling this routine also disables tracing, which is problematic if you
return from xmon and expect the system to keep operating normally. So
after we do the dump turn tracing back on.

Both functions already have nop versions defined for when ftrace is not
enabled, so we don't need any extra #ifdefs.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
7 years agopowerpc/of_platform: Use builtin_platform_driver
Geliang Tang [Wed, 23 Nov 2016 14:58:56 +0000 (22:58 +0800)]
powerpc/of_platform: Use builtin_platform_driver

Use builtin_platform_driver() helper to simplify the code.

Signed-off-by: Geliang Tang <geliangtang@gmail.com>
Acked-by: Russell Currey <ruscur@russell.cc>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
7 years agocxl: drop duplicate header sched.h
Geliang Tang [Wed, 23 Nov 2016 15:27:38 +0000 (23:27 +0800)]
cxl: drop duplicate header sched.h

Drop duplicate header sched.h from native.c.

Signed-off-by: Geliang Tang <geliangtang@gmail.com>
Reviewed-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
7 years agopowerpc: Fix __cmpxchg() to take a volatile ptr again
Michael Ellerman [Thu, 24 Nov 2016 06:08:11 +0000 (17:08 +1100)]
powerpc: Fix __cmpxchg() to take a volatile ptr again

In commit d0563a1297e2 ("powerpc: Implement {cmp}xchg for u8 and u16")
we removed the volatile from __cmpxchg().

This is leading to warnings such as:

  drivers/gpu/drm/drm_lock.c: In function ‘drm_lock_take’:
  arch/powerpc/include/asm/cmpxchg.h:484:37: warning: passing argument 1
  of ‘__cmpxchg’ discards ‘volatile’ qualifier from pointer target
     (__typeof__(*(ptr))) __cmpxchg((ptr), (unsigned long)_o_,   \

There doesn't seem to be consensus across architectures whether the
argument is volatile or not, so at least for now put the volatile back.

Fixes: d0563a1297e2 ("powerpc: Implement {cmp}xchg for u8 and u16")
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
7 years agoMerge branch 'topic/ppc-kvm' into next
Michael Ellerman [Thu, 24 Nov 2016 11:14:52 +0000 (22:14 +1100)]
Merge branch 'topic/ppc-kvm' into next

Merge the topic branch we're sharing with the kvm-ppc tree.

7 years agocxl: Fix coccinelle warnings
Andrew Donnellan [Tue, 22 Nov 2016 10:13:27 +0000 (21:13 +1100)]
cxl: Fix coccinelle warnings

Fix the following coccinelle warnings:

  drivers/misc/cxl/debugfs.c:46:0-23: WARNING: fops_io_x64 should be
      defined with DEFINE_DEBUGFS_ATTRIBUTE
  drivers/misc/cxl/guest.c:890:5-26: WARNING: Comparison to bool
  drivers/misc/cxl/irq.c:107:3-23: WARNING: Assignment of bool to 0/1
  drivers/misc/cxl/native.c:57:2-3: Unneeded semicolon
  drivers/misc/cxl/native.c:170:2-3: Unneeded semicolon

Signed-off-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
Acked-by: Frederic Barrat <fbarrat@linux.vnet.ibm.com>
Reviewed-by: Matthew R. Ochs <mrochs@linux.vnet.ibm.com>
Acked-by: Ian Munsie <imunsie@au1.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
7 years agopowerpc/32: Change the stack protector canary value per task
Christophe Leroy [Tue, 22 Nov 2016 10:49:32 +0000 (11:49 +0100)]
powerpc/32: Change the stack protector canary value per task

Partially copied from commit df0698be14c66 ("ARM: stack protector:
change the canary value per task")

A new random value for the canary is stored in the task struct whenever
a new task is forked.  This is meant to allow for different canary values
per task.  On powerpc, GCC expects the canary value to be found in a global
variable called __stack_chk_guard.  So this variable has to be updated
with the value stored in the task struct whenever a task switch occurs.

Because the variable GCC expects is global, this cannot work on SMP
unfortunately.  So, on SMP, the same initial canary value is kept
throughout, making this feature a bit less effective although it is still
useful.

Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
7 years agopowerpc: Initial stack protector (-fstack-protector) support
Christophe Leroy [Tue, 22 Nov 2016 10:49:30 +0000 (11:49 +0100)]
powerpc: Initial stack protector (-fstack-protector) support

Partialy copied from commit c743f38013aef ("ARM: initial stack protector
(-fstack-protector) support")

This is the very basic stuff without the changing canary upon
task switch yet.  Just the Kconfig option and a constant canary
value initialized at boot time.

Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
7 years agopowerpc: Implement {cmp}xchg for u8 and u16
Pan Xinhui [Wed, 27 Apr 2016 09:16:45 +0000 (17:16 +0800)]
powerpc: Implement {cmp}xchg for u8 and u16

Implement xchg{u8,u16}{local,relaxed}, and
cmpxchg{u8,u16}{,local,acquire,relaxed}.

It works on all ppc.

remove volatile of first parameter in __cmpxchg_local and __cmpxchg

Suggested-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Pan Xinhui <xinhui.pan@linux.vnet.ibm.com>
Acked-by: Boqun Feng <boqun.feng@gmail.com>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
7 years agopowerpc/pseries/ibmebus: Remove legacy suspend/resume support
Lars-Peter Clausen [Sat, 19 Nov 2016 13:42:14 +0000 (14:42 +0100)]
powerpc/pseries/ibmebus: Remove legacy suspend/resume support

There are no ibmebus driver that make use of legacy suspend/resume. This
patch removes the support for it from ibmebus framework, new ibmebus
driver (as unlikely as they are) wanting to use suspend/resume should
use dev_pm_ops.

Since there aren't any special bus specific things to do during
suspend/resume and since the PM core will automatically fallback
directly to using the device's PM ops if no bus PM ops are specified
there is no need to have any special ibmebus PM ops at all.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
7 years agopowerpc/kprobes: Invoke handlers directly
Naveen N. Rao [Mon, 21 Nov 2016 17:06:41 +0000 (22:36 +0530)]
powerpc/kprobes: Invoke handlers directly

Invoke the kprobe handlers directly rather than through notify_die(), to
reduce path taken for handling kprobes. Similar to commit 6f6343f53d13
("kprobes/x86: Call exception handlers directly from do_int3/do_debug").

While at it, rename post_kprobe_handler() to kprobe_post_handler() for
more uniform naming.

Reported-by: Masami Hiramatsu <mhiramat@kernel.org>
Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
7 years agopowerpc: Remove extraneous header from asm-prototypes.h
Naveen N. Rao [Mon, 21 Nov 2016 17:06:40 +0000 (22:36 +0530)]
powerpc: Remove extraneous header from asm-prototypes.h

Commit 03465f899bda ("powerpc: Use kprobe blacklist for exception
handlers") removed __kprobes annotation from some of the prototypes,
but left the kprobes header include directive unchanged. Remove it as it
is no longer needed.

Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
7 years agopowerpc/powernv: Define and set POWER9 HFSCR doorbell bit
Michael Neuling [Tue, 22 Nov 2016 23:44:09 +0000 (10:44 +1100)]
powerpc/powernv: Define and set POWER9 HFSCR doorbell bit

Define and set the POWER9 HFSCR doorbell bit so that guests can use
msgsndp.

ISA 3.0 calls this MSGP, so name it accordingly in the code.

Signed-off-by: Michael Neuling <mikey@neuling.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
7 years agopowerpc/reg: Add definition for LPCR_PECE_HVEE
Michael Ellerman [Tue, 22 Nov 2016 03:50:39 +0000 (14:50 +1100)]
powerpc/reg: Add definition for LPCR_PECE_HVEE

ISA 3.0 defines a new PECE (Power-saving mode Exit Cause Enable) field
in the LPCR (Logical Partitioning Control Register), called
LPCR_PECE_HVEE (Hypervisor Virtualization Exit Enable).

KVM code will need to know about this bit, so add a definition for it.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
7 years agopowerpc/64: Define new ISA v3.00 logical PVR value and PCR register value
Suraj Jitindar Singh [Mon, 21 Nov 2016 05:02:35 +0000 (16:02 +1100)]
powerpc/64: Define new ISA v3.00 logical PVR value and PCR register value

ISA 3.00 adds the logical PVR value 0x0f000005, so add a definition for
this.

Define PCR_ARCH_207 to reflect ISA 2.07 compatibility mode in the processor
compatibility register (PCR).

[paulus@ozlabs.org - moved dummy PCR_ARCH_300 value into next patch]

Signed-off-by: Suraj Jitindar Singh <sjitindarsingh@gmail.com>
Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
7 years agopowerpc/powernv: Define real-mode versions of OPAL XICS accessors
Paul Mackerras [Mon, 21 Nov 2016 05:01:36 +0000 (16:01 +1100)]
powerpc/powernv: Define real-mode versions of OPAL XICS accessors

This defines real-mode versions of opal_int_get_xirr(), opal_int_eoi()
and opal_int_set_mfrr(), for use by KVM real-mode code.

It also exports opal_int_set_mfrr() so that the modular part of KVM
can use it to send IPIs.

Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
7 years agopowerpc/64: Provide functions for accessing POWER9 partition table
Paul Mackerras [Mon, 21 Nov 2016 05:00:58 +0000 (16:00 +1100)]
powerpc/64: Provide functions for accessing POWER9 partition table

POWER9 requires the host to set up a partition table, which is a
table in memory indexed by logical partition ID (LPID) which
contains the pointers to page tables and process tables for the
host and each guest.

This factors out the initialization of the partition table into
a single function.  This code was previously duplicated between
hash_utils_64.c and pgtable-radix.c.

This provides a function for setting a partition table entry,
which is used in early MMU initialization, and will be used by
KVM whenever a guest is created.  This function includes a tlbie
instruction which will flush all TLB entries for the LPID and
all caches of the partition table entry for the LPID, across the
system.

This also moves a call to memblock_set_current_limit(), which was
in radix_init_partition_table(), but has nothing to do with the
partition table.  By analogy with the similar code for hash, the
call gets moved to near the end of radix__early_init_mmu().  It
now gets called when running as a guest, whereas previously it
would only be called if the kernel is running as the host.

Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
7 years agopowerpc/mm/coproc: Handle bad address on coproc slb fault
Aneesh Kumar K.V [Tue, 15 Nov 2016 15:06:06 +0000 (20:36 +0530)]
powerpc/mm/coproc: Handle bad address on coproc slb fault

VSID 0 is bad address. Don't create slb entries on coproc fault for
bad address

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Reviewed-by: Balbir Singh <bsingharora@gmail.com>
Reviewed-by: Ian Munsie <imunsie@au1.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
7 years agopowerpc/eeh: Refactor EEH PE reset functions
Russell Currey [Thu, 17 Nov 2016 05:07:47 +0000 (16:07 +1100)]
powerpc/eeh: Refactor EEH PE reset functions

eeh_pe_reset and eeh_reset_pe are two different functions in the same
file which do mostly the same thing.  Not only is this confusing, but
potentially causes disrepancies in functionality, notably eeh_reset_pe
as it does not check return values for failure.

Refactor this into the following:

 - eeh_pe_reset(): stays as is, performs a single operation, exported
 - eeh_pe_reset_full(): new, full reset process that calls eeh_pe_reset()
 - eeh_reset_pe(): removed and replaced by eeh_pe_reset_full()
 - eeh_reset_pe_once(): removed

Signed-off-by: Russell Currey <ruscur@russell.cc>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
7 years agopowerpc/pci: Always print PHB and PE numbers as hexadecimal
Russell Currey [Wed, 16 Nov 2016 03:02:15 +0000 (14:02 +1100)]
powerpc/pci: Always print PHB and PE numbers as hexadecimal

PHB, PE (and by association MVE) numbers are printed as a mix of decimal
and hexadecimal throughout the kernel.  This can be misleading, so make
them all hexadecimal.

Standardising on hex instead of dec because:

 - PHB numbers are presented in hex in sysfs/debugfs (and lspci, etc)
 - PE numbers are presented as hex in sysfs and parsed in hex in debugfs

The only place I think this could cause confusing are the messages during
boot, i.e.

pci 000a:01     : [PE# 000] Secondary bus 1 associated with PE#0

which can be a quick way to check PE numbers.  pe_level_printk() will
only print two characters instead of three, so the above would be

pci 000a:01     : [PE# 00] Secondary bus 1 associated with PE#0

which gives a hint it's in hex.

Signed-off-by: Russell Currey <ruscur@russell.cc>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
7 years agopowerpc/powernv: Don't warn on PE init if unfreeze is unsupported
Russell Currey [Wed, 16 Nov 2016 01:12:26 +0000 (12:12 +1100)]
powerpc/powernv: Don't warn on PE init if unfreeze is unsupported

Whenever a PE is initialised in powernv, opal_pci_eeh_freeze_clear() is
called.  This is to remove any existing freeze, and has no negative side
effects if the PE is already in an unfrozen state.  On PHB backends that
don't support this operation and return OPAL_UNSUPPORTED, this creates a
scary and misleading warning message.

Skip the warning message on init if OPAL_UNSUPPORTED is returned.

As far as I'm aware, this currently only affects NPUs.

Fixes: 313483d ("powerpc/powernv: Unfreeze PE on allocation")
Signed-off-by: Russell Currey <ruscur@russell.cc>
Acked-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
Reviewed-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
7 years agopowerpc/64: Add some more SPRs and SPR bits for POWER9
Paul Mackerras [Mon, 21 Nov 2016 05:00:23 +0000 (16:00 +1100)]
powerpc/64: Add some more SPRs and SPR bits for POWER9

These definitions will be needed by KVM.

Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
7 years agopowerpc/64: Used named initialisers for ibm_pa_features
Michael Ellerman [Fri, 28 Oct 2016 06:39:53 +0000 (17:39 +1100)]
powerpc/64: Used named initialisers for ibm_pa_features

The ibm_pa_features array consists of structures that describe which bit
and byte in the ibm,pa-features property toggles one or more flags in
either the CPU, MMU, or user visible feature flags.

Each one consists of 7 values, which are all unsigned long, int or char,
meaning the compiler gives us no warning if we assign the wrong values
to the wrong elements. In fact we have had a bug here in the past, where
we were setting incorrect bits, see commit 6997e57d693b ("powerpc:
scan_features() updates incorrect bits for REAL_LE").

So switch to using named initialisers for the structure elements, to
reduce the likelihood of future bugs, and hopefully improve readability
also.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Reviewed-by: Balbir Singh <bsingharora@gmail.com>
7 years agopowerpc/configs: Turn on PPC crypto implementations in the server defconfigs
Michael Ellerman [Wed, 2 Nov 2016 10:06:17 +0000 (21:06 +1100)]
powerpc/configs: Turn on PPC crypto implementations in the server defconfigs

These are the PPC optimised versions of various crypto algorithms, so we
should turn them on by default to get test coverage.

Suggested-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
7 years agopowerpc/pseries: Disable IBMEBUS on little endian builds
Michael Ellerman [Tue, 15 Nov 2016 03:47:44 +0000 (14:47 +1100)]
powerpc/pseries: Disable IBMEBUS on little endian builds

The IBMEBUS code supports the GX bus found on Power7 and earlier CPUs.
On Power8 it has been replaced, and so we have no need for it.

We don't actually have a config symbol for Power8 vs Power7 etc., but
we only support booting little endian on Power8 or later, so use that as
a reasonable approximation.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
7 years agopowerpc/pseries: Move ibmebus.c into platforms pseries
Michael Ellerman [Tue, 15 Nov 2016 03:47:43 +0000 (14:47 +1100)]
powerpc/pseries: Move ibmebus.c into platforms pseries

ibmebus.c is pseries only code, so move it in there.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
7 years agopowerpc/pseries: Move vio.c into platforms pseries
Michael Ellerman [Tue, 15 Nov 2016 03:47:42 +0000 (14:47 +1100)]
powerpc/pseries: Move vio.c into platforms pseries

vio.c is pseries only code, so move it in there.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
7 years agocxl: Fix coredump generation when cxl_get_fd() is used
Frederic Barrat [Fri, 18 Nov 2016 12:00:31 +0000 (23:00 +1100)]
cxl: Fix coredump generation when cxl_get_fd() is used

If a process dumps core while owning a cxl file descriptor obtained
from an AFU driver (e.g. cxlflash) through the cxl_get_fd() API, the
following error occurs:

  [  868.027591] Unable to handle kernel paging request for data at address ...
  [  868.027778] Faulting instruction address: 0xc00000000035edb0
  cpu 0x8c: Vector: 300 (Data Access) at [c000003c688275e0]
      pc: c00000000035edb0: elf_core_dump+0xd60/0x1300
      lr: c00000000035ed80: elf_core_dump+0xd30/0x1300
      sp: c000003c68827860
     msr: 9000000100009033
     dar: c
  dsisr: 40000000
   current = 0xc000003c68780000
   paca    = 0xc000000001b73200   softe: 0        irq_happened: 0x01
      pid   = 46725, comm = hxesurelock
  enter ? for help
  [c000003c68827a60c00000000036948c do_coredump+0xcec/0x11e0
  [c000003c68827c20c0000000000ce9e0 get_signal+0x540/0x7b0
  [c000003c68827d10c000000000017354 do_signal+0x54/0x2b0
  [c000003c68827e00c00000000001777c do_notify_resume+0xbc/0xd0
  [c000003c68827e30c000000000009838 ret_from_except_lite+0x64/0x68
  --- Exception: 300 (Data Access) at 00003fff98ad2918

The root cause is that the address_space structure for the file
doesn't define a 'host' member.

When cxl allocates a file descriptor, it's using the anonymous inode
to back the file, but allocates a private address_space for each
context. The private address_space allows to track memory allocation
for each context. cxl doesn't define the 'host' member of the address
space, i.e. the inode. We don't want to define it as the anonymous
inode, since there's no longer a 1-to-1 relation between address_space
and inode.

To fix it, instead of using the anonymous inode, we introduce a simple
pseudo filesystem so that cxl can allocate its own inodes. So we now
have one inode for each file and address_space. The pseudo filesystem
is only mounted on the first allocation of a file descriptor by
cxl_get_fd().

Tested with cxlflash.

Signed-off-by: Frederic Barrat <fbarrat@linux.vnet.ibm.com>
Reviewed-by: Matthew R. Ochs <mrochs@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
7 years agocxl: Do adapter fence check before handling afu interrupt
Vaibhav Jain [Wed, 16 Nov 2016 14:09:33 +0000 (19:39 +0530)]
cxl: Do adapter fence check before handling afu interrupt

If an afu interrupt is in flight when an eeh error is triggered the
control still reaches the function native_irq_multiplexed and the
PE-Handle read from the CXL_PSL_PEHandle_An register is 0xffff. The
function then erroneously assumes that the interrupt belonged to a
detached context and generates a warning with full stack dump in the
kernel log complaining:

"Unable to demultiplex CXL PSL IRQ for PE 65535 DSISR ffffffff DAR
ffffffff. (Possible AFU HW issue - was a term/remove acked with
outstanding transactions"

To fix this the patch adds new code to the function
native_irq_multiplexed function to compares the read value of register
CXL_PSL_PEHandle_An to ~0ULL. If true then logs a warning message
saying that the interrupt is being ignored and returns IRQ_HANDLED from
the irq handler.

Reviewed-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
Acked-by: Frederic Barrat <fbarrat@linux.vnet.ibm.com>
Acked-by: Ian Munsie <imunsie@au1.ibm.com>
Signed-off-by: Vaibhav Jain <vaibhav@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
7 years agocxl: Fix error handling in _cxl_pci_associate_default_context()
Christophe Jaillet [Sun, 30 Oct 2016 21:40:47 +0000 (22:40 +0100)]
cxl: Fix error handling in _cxl_pci_associate_default_context()

'cxl_dev_context_init()' returns an error pointer in case of error, not
NULL. So test it with IS_ERR.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Reviewed-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
Acked-by: Frederic Barrat <fbarrat@linux.vnet.ibm.com>
Acked-by: Ian Munsie <imunsie@au1.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
7 years agocxl: Fix error handling in _cxl_cx4_setup_msi_irqs()
Christophe Jaillet [Sun, 30 Oct 2016 21:34:51 +0000 (22:34 +0100)]
cxl: Fix error handling in _cxl_cx4_setup_msi_irqs()

'cxl_dev_context_init()' returns an error pointer in case of error, not
NULL. So test it with IS_ERR.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Reviewed-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
Acked-by: Frederic Barrat <fbarrat@linux.vnet.ibm.com>
Acked-by: Ian Munsie <imunsie@au1.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
7 years agocxl: Fix memory allocation failure test
Christophe Jaillet [Sun, 30 Oct 2016 19:35:57 +0000 (20:35 +0100)]
cxl: Fix memory allocation failure test

'cxl_context_alloc()' does not return an error pointer. It is just a
shortcut for a call to 'kzalloc' with 'sizeof(struct cxl_context)' as the
size parameter.

So its return value should be compared with NULL.
While fixing it, simplify a bit the code.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Reviewed-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
Acked-by: Frederic Barrat <fbarrat@linux.vnet.ibm.com>
Acked-by: Ian Munsie <imunsie@au1.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
7 years agopowerpc: Fix second nested oops hang
Nicholas Piggin [Tue, 8 Nov 2016 12:14:45 +0000 (23:14 +1100)]
powerpc: Fix second nested oops hang

When ending an oops, don't clear die_owner unless the nest count
went to zero. This prevents a second nested oops from hanging forever
on the die_lock.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
7 years agopowerpc: Fix graceful debugger recovery
Nicholas Piggin [Tue, 8 Nov 2016 12:14:44 +0000 (23:14 +1100)]
powerpc: Fix graceful debugger recovery

When exiting xmon with 'x' (exit and recover), oops_begin bails
out immediately, but die then calls __die() and oops_end(), which
cause a lot of bad things to happen.

If the debugger was attached then went to graceful recovery, exit
from die() immediately.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
7 years agopowerpc: Add option to use thin archives
Nicholas Piggin [Wed, 19 Oct 2016 03:15:59 +0000 (14:15 +1100)]
powerpc: Add option to use thin archives

Add an option to use thin archives to build the kernel.
Thin archives are explained in commit a5967db9af51 ("kbuild: allow
architectures to use thin archives instead of ld -r").

This is a gradual way to introduce the option to testers.

Some change to the way we invoke ar is required so it can be used
by scripts/link-vmlinux.sh.

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
[mpe: Make it an explicit option not dependant on COMPILE_TEST]
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
7 years agopowerpc/lib: Fix randconfig build failure in sstep.c
Michael Ellerman [Fri, 18 Nov 2016 00:51:14 +0000 (11:51 +1100)]
powerpc/lib: Fix randconfig build failure in sstep.c

Under some configs we need to explicitly include cpu_has_feature.h,
otherwise we fail with:

  arch/powerpc/lib/sstep.c:1992:7: error: implicit declaration of function 'cpu_has_feature'

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
7 years agopowerpc/pseries: Correct possible read beyond dlpar sysfs buffer
Nathan Fontenot [Thu, 17 Nov 2016 16:38:10 +0000 (11:38 -0500)]
powerpc/pseries: Correct possible read beyond dlpar sysfs buffer

The pasrsing of data written to the dlpar file in sysfs does not correctly
account for the possibility of reading past the end of the buffer. The code
assumes that all pieces of the command witten to the sysfs file are present
in the form "<resource> <action> <id_type> <id>".

Correct this by updating the buffer parsing code to make a local copy and
use the strsep() and sysfs_streq() routines to parse the buffer. This patch
also separates the parsing code into subroutines for each piece of the
command.

Signed-off-by: Nathan Fontenot <nfont@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
7 years agopowerpc/mce: Remove unused but set variable
Tobias Klauser [Thu, 17 Nov 2016 16:19:21 +0000 (17:19 +0100)]
powerpc/mce: Remove unused but set variable

Remove the unused but set variable srr1 in save_mce_event() to
fix the following GCC warning when building with 'W=1':

  arch/powerpc/kernel/mce.c:75:11: warning: variable 'srr1' set but not used

It has never been used.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
7 years agopowerpc: Fix old style declaration GCC warnings
Tobias Klauser [Thu, 17 Nov 2016 16:20:24 +0000 (17:20 +0100)]
powerpc: Fix old style declaration GCC warnings

Fix two [-Wold-style-declaration] GCC warnings by moving the inline
keyword before the return type.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
7 years agopowerpc/64: get rid of MIN_HUGEPTE_SHIFT
Christophe Leroy [Wed, 21 Sep 2016 14:49:27 +0000 (16:49 +0200)]
powerpc/64: get rid of MIN_HUGEPTE_SHIFT

MIN_HUGEPTE_SHIFT hasn't been used since commit d1837cba5d5d5
("powerpc/mm: Cleanup initialization of hugepages on powerpc")

Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
7 years agopowerpc/mm: Correct process and partition table max size
Suraj Jitindar Singh [Wed, 9 Nov 2016 05:36:33 +0000 (16:36 +1100)]
powerpc/mm: Correct process and partition table max size

Version 3.00 of the ISA states that the PATS (partition table size) field
of the PTCR (partition table control register) and the PRTS (process table
size) field of the partition table entry must both be less than or equal
to 24. However the actual size of the partition and process tables is equal
to 2 to the power of 12 plus the PATS and PRTS fields, respectively. This
means that the max allowable size of each of these tables is 2^36 or 64GB
for both.

Thus when checking the size shift for each we should be checking for values
of greater than 36 instead of the current check for shifts larger than 24
and 23.

Fixes: 2bfd65e45e877fb5704730244da67c748d28a1b8
Signed-off-by: Suraj Jitindar Singh <sjitindarsingh@gmail.com>
Reviewed-by: Balbir Singh <bsingharora@gmail.com>
Reviewed-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
7 years agoselftests/powerpc: Add ptrace tests for TM SPR registers
Anshuman Khandual [Fri, 30 Sep 2016 02:33:02 +0000 (10:33 +0800)]
selftests/powerpc: Add ptrace tests for TM SPR registers

This patch adds ptrace interface test for TM SPR registers. This
also adds ptrace interface based helper functions related to TM
SPR registers access.

Signed-off-by: Anshuman Khandual <khandual@linux.vnet.ibm.com>
Signed-off-by: Simon Guo <wei.guo.simon@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
7 years agoselftests/powerpc: Add ptrace tests for VSX, VMX registers in suspended TM
Anshuman Khandual [Fri, 30 Sep 2016 02:33:01 +0000 (10:33 +0800)]
selftests/powerpc: Add ptrace tests for VSX, VMX registers in suspended TM

This patch adds ptrace interface test for VSX, VMX registers
inside suspended TM context.

Signed-off-by: Anshuman Khandual <khandual@linux.vnet.ibm.com>
Signed-off-by: Simon Guo <wei.guo.simon@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
7 years agoselftests/powerpc: Add ptrace tests for VSX, VMX registers in TM
Anshuman Khandual [Fri, 30 Sep 2016 02:33:00 +0000 (10:33 +0800)]
selftests/powerpc: Add ptrace tests for VSX, VMX registers in TM

This patch adds ptrace interface test for VSX, VMX registers
inside TM context. This also adds ptrace interface based helper
functions related to chckpointed VSX, VMX registers access.

Signed-off-by: Anshuman Khandual <khandual@linux.vnet.ibm.com>
Signed-off-by: Simon Guo <wei.guo.simon@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
7 years agoselftests/powerpc: Add ptrace tests for VSX, VMX registers
Anshuman Khandual [Fri, 30 Sep 2016 02:32:59 +0000 (10:32 +0800)]
selftests/powerpc: Add ptrace tests for VSX, VMX registers

This patch adds ptrace interface test for VSX, VMX registers.
This also adds ptrace interface based helper functions related
to VSX, VMX registers access. This also adds some assembly
helper functions related to VSX and VMX registers.

Signed-off-by: Anshuman Khandual <khandual@linux.vnet.ibm.com>
Signed-off-by: Simon Guo <wei.guo.simon@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
7 years agoselftests/powerpc: Add ptrace tests for TAR, PPR, DSCR in suspended TM
Anshuman Khandual [Fri, 30 Sep 2016 02:32:58 +0000 (10:32 +0800)]
selftests/powerpc: Add ptrace tests for TAR, PPR, DSCR in suspended TM

This patch adds ptrace interface test for TAR, PPR, DSCR
registers inside suspended TM context.

Signed-off-by: Anshuman Khandual <khandual@linux.vnet.ibm.com>
Signed-off-by: Simon Guo <wei.guo.simon@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
7 years agoselftests/powerpc: Add ptrace tests for TAR, PPR, DSCR in TM
Anshuman Khandual [Fri, 30 Sep 2016 02:32:57 +0000 (10:32 +0800)]
selftests/powerpc: Add ptrace tests for TAR, PPR, DSCR in TM

This patch adds ptrace interface test for TAR, PPR, DSCR
registers inside TM context. This also adds ptrace
interface based helper functions related to checkpointed
TAR, PPR, DSCR register access.

Signed-off-by: Anshuman Khandual <khandual@linux.vnet.ibm.com>
Signed-off-by: Simon Guo <wei.guo.simon@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
7 years agoselftests/powerpc: Add ptrace tests for TAR, PPR, DSCR registers
Anshuman Khandual [Fri, 30 Sep 2016 02:32:56 +0000 (10:32 +0800)]
selftests/powerpc: Add ptrace tests for TAR, PPR, DSCR registers

This patch adds ptrace interface test for TAR, PPR, DSCR
registers. This also adds ptrace interface based helper
functions related to TAR, PPR, DSCR register access.

Signed-off-by: Anshuman Khandual <khandual@linux.vnet.ibm.com>
Signed-off-by: Simon Guo <wei.guo.simon@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
7 years agoselftests/powerpc: Add ptrace tests for GPR/FPR registers in suspended TM
Anshuman Khandual [Fri, 30 Sep 2016 02:32:55 +0000 (10:32 +0800)]
selftests/powerpc: Add ptrace tests for GPR/FPR registers in suspended TM

This patch adds ptrace interface test for GPR/FPR registers
inside suspended TM context.

Signed-off-by: Anshuman Khandual <khandual@linux.vnet.ibm.com>
Signed-off-by: Simon Guo <wei.guo.simon@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
7 years agoselftests/powerpc: Add ptrace tests for GPR/FPR registers in TM
Anshuman Khandual [Fri, 30 Sep 2016 02:32:54 +0000 (10:32 +0800)]
selftests/powerpc: Add ptrace tests for GPR/FPR registers in TM

This patch adds ptrace interface test for GPR/FPR registers
inside TM context. This adds ptrace interface based helper
functions related to checkpointed GPR/FPR access.

Signed-off-by: Anshuman Khandual <khandual@linux.vnet.ibm.com>
Signed-off-by: Simon Guo <wei.guo.simon@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
7 years agoselftests/powerpc: Add ptrace tests for GPR/FPR registers
Anshuman Khandual [Fri, 30 Sep 2016 02:32:52 +0000 (10:32 +0800)]
selftests/powerpc: Add ptrace tests for GPR/FPR registers

This patch adds ptrace interface test for GPR/FPR registers.
This adds ptrace interface based helper functions related to
GPR/FPR access and some assembly helper functions related to
GPR/FPR registers.

Signed-off-by: Anshuman Khandual <khandual@linux.vnet.ibm.com>
Signed-off-by: Simon Guo <wei.guo.simon@gmail.com>
[mpe: Add #defines for the new note types when headers don't define them]
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
7 years agoselftests/powerpc: Move shared headers into new include dir
Simon Guo [Fri, 30 Sep 2016 02:32:51 +0000 (10:32 +0800)]
selftests/powerpc: Move shared headers into new include dir

There are some functions, especially register related, which can
be shared across multiple selftests/powerpc test directories.

This patch creates a new include directory to store those shared
files, so that the file layout becomes more neat.

Signed-off-by: Simon Guo <wei.guo.simon@gmail.com>
[mpe: Reworked to move the headers only]
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
7 years agoselftests/powerpc: Add more SPR numbers, TM & VMX instructions to 'reg.h'/'instructio...
Anshuman Khandual [Fri, 30 Sep 2016 02:32:50 +0000 (10:32 +0800)]
selftests/powerpc: Add more SPR numbers, TM & VMX instructions to 'reg.h'/'instructions.h'

This patch adds SPR number for TAR, PPR, DSCR special
purpose registers. It also adds TM, VSX, VMX related
instructions which will then be used by patches later
in the series.

Now that the new DSCR register definitions (SPRN_DSCR_PRIV and
SPRN_DSCR) are defined outside this directory, use them instead.

Signed-off-by: Anshuman Khandual <khandual@linux.vnet.ibm.com>
Signed-off-by: Simon Guo <wei.guo.simon@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
7 years agopowerpc/mm: Dump hash table
Rashmica Gupta [Fri, 27 May 2016 05:49:00 +0000 (15:49 +1000)]
powerpc/mm: Dump hash table

Useful to be able to dump the kernel hash page table to check
which pages are hashed along with their sizes and other details.

Add a debugfs file to check the hash page table. If radix is enabled
(and so there is no hash page table) then this file doesn't exist. To
use this the PPC_PTDUMP config option must be selected.

Signed-off-by: Rashmica Gupta <rashmicy@gmail.com>
[mpe: Fix build with SPARSEMEM_VMEMMAP=n & PSERIES=n]
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
7 years agopowerpc/mm: Dump linux pagetables
Rashmica Gupta [Fri, 27 May 2016 05:48:59 +0000 (15:48 +1000)]
powerpc/mm: Dump linux pagetables

Useful to be able to dump the kernels page tables to check permissions
and memory types - derived from arm64's implementation.

Add a debugfs file to check the page tables. To use this the PPC_PTDUMP
config option must be selected.

Signed-off-by: Rashmica Gupta <rashmicy@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
7 years agopowerpc/pseries: Move CMO code from plapr_wrappers.h to platforms/pseries
Michael Ellerman [Mon, 14 Nov 2016 05:28:10 +0000 (16:28 +1100)]
powerpc/pseries: Move CMO code from plapr_wrappers.h to platforms/pseries

Currently there's some CMO (Cooperative Memory Overcommit) code, in
plpar_wrappers.h. Some of it is #ifdef CONFIG_PSERIES and some of it
isn't. The end result being if a file includes plpar_wrappers.h it won't
build with CONFIG_PSERIES=n.

Fix it by moving the CMO code into platforms/pseries. The two hcall
wrappers can just be moved into their only caller, cmm.c, and the
accessors can go in pseries.h.

Note we need the accessors because cmm.c can be built as a module, so
there needs to be a split between the built-in code vs the module, and
that's achieved by using those accessors.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
7 years agopowerpc/mm: Fix typo in radix encodings print
Balbir Singh [Sat, 5 Nov 2016 04:24:22 +0000 (15:24 +1100)]
powerpc/mm: Fix typo in radix encodings print

Rename "sift" to "shift".

Signed-off-by: Balbir Singh <bsingharora@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
7 years agopowerpc/64: Simplify adaptation to new ISA v3.00 HPTE format
Paul Mackerras [Fri, 11 Nov 2016 05:55:03 +0000 (16:55 +1100)]
powerpc/64: Simplify adaptation to new ISA v3.00 HPTE format

This changes the way that we support the new ISA v3.00 HPTE format.
Instead of adapting everything that uses HPTE values to handle either
the old format or the new format, depending on which CPU we are on,
we now convert explicitly between old and new formats if necessary
in the low-level routines that actually access HPTEs in memory.
This limits the amount of code that needs to know about the new
format and makes the conversions explicit.  This is OK because the
old format contains all the information that is in the new format.

This also fixes operation under a hypervisor, because the H_ENTER
hypercall (and other hypercalls that deal with HPTEs) will continue
to require the HPTE value to be supplied in the old format.  At
present the kernel will not boot in HPT mode on POWER9 under a
hypervisor.

This fixes and partially reverts commit 50de596de8be
("powerpc/mm/hash: Add support for Power9 Hash", 2016-04-29).

Fixes: 50de596de8be ("powerpc/mm/hash: Add support for Power9 Hash")
Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
Reviewed-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
7 years agopowerpc: convert storcenter_defconfig to use libata PATA drivers
Bartlomiej Zolnierkiewicz [Wed, 3 Feb 2016 15:50:30 +0000 (16:50 +0100)]
powerpc: convert storcenter_defconfig to use libata PATA drivers

IDE subsystem has been deprecated since 2009 and the majority
(if not all) of Linux distributions have switched to use
libata for ATA support exclusively.  However there are still
some users (mostly old or/and embedded non-x86 systems) that
have not converted from using IDE subsystem to libata PATA
drivers.  This doesn't seem to be good thing in the long-term
for Linux as while there is less and less PATA systems left
in use:

* testing efforts are divided between two subsystems

* having duplicate drivers for same hardware confuses users

This patch converts storcenter_defconfig to use libata PATA
drivers.

Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
7 years agopowerpc: convert pseries_defconfig to use libata PATA drivers
Bartlomiej Zolnierkiewicz [Wed, 3 Feb 2016 15:50:29 +0000 (16:50 +0100)]
powerpc: convert pseries_defconfig to use libata PATA drivers

IDE subsystem has been deprecated since 2009 and the majority
(if not all) of Linux distributions have switched to use
libata for ATA support exclusively.  However there are still
some users (mostly old or/and embedded non-x86 systems) that
have not converted from using IDE subsystem to libata PATA
drivers.  This doesn't seem to be good thing in the long-term
for Linux as while there is less and less PATA systems left
in use:

* testing efforts are divided between two subsystems

* having duplicate drivers for same hardware confuses users

This patch converts pseries_defconfig to use libata PATA
drivers.

Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
7 years agopowerpc: convert ppc6xx_defconfig to use libata PATA drivers
Bartlomiej Zolnierkiewicz [Wed, 3 Feb 2016 15:50:27 +0000 (16:50 +0100)]
powerpc: convert ppc6xx_defconfig to use libata PATA drivers

IDE subsystem has been deprecated since 2009 and the majority
(if not all) of Linux distributions have switched to use
libata for ATA support exclusively.  However there are still
some users (mostly old or/and embedded non-x86 systems) that
have not converted from using IDE subsystem to libata PATA
drivers.  This doesn't seem to be good thing in the long-term
for Linux as while there is less and less PATA systems left
in use:

* testing efforts are divided between two subsystems

* having duplicate drivers for same hardware confuses users

This patch converts ppc6xx_defconfig to use libata PATA
drivers.

Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
7 years agopowerpc: convert ppc64e_defconfig to use libata PATA drivers
Bartlomiej Zolnierkiewicz [Wed, 3 Feb 2016 15:50:26 +0000 (16:50 +0100)]
powerpc: convert ppc64e_defconfig to use libata PATA drivers

IDE subsystem has been deprecated since 2009 and the majority
(if not all) of Linux distributions have switched to use
libata for ATA support exclusively.  However there are still
some users (mostly old or/and embedded non-x86 systems) that
have not converted from using IDE subsystem to libata PATA
drivers.  This doesn't seem to be good thing in the long-term
for Linux as while there is less and less PATA systems left
in use:

* testing efforts are divided between two subsystems

* having duplicate drivers for same hardware confuses users

This patch converts ppc64e_defconfig to use libata PATA
drivers.

Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
7 years agopowerpc: convert ppc64_defconfig to use libata PATA drivers
Bartlomiej Zolnierkiewicz [Wed, 3 Feb 2016 15:50:25 +0000 (16:50 +0100)]
powerpc: convert ppc64_defconfig to use libata PATA drivers

IDE subsystem has been deprecated since 2009 and the majority
(if not all) of Linux distributions have switched to use
libata for ATA support exclusively.  However there are still
some users (mostly old or/and embedded non-x86 systems) that
have not converted from using IDE subsystem to libata PATA
drivers.  This doesn't seem to be good thing in the long-term
for Linux as while there is less and less PATA systems left
in use:

* testing efforts are divided between two subsystems

* having duplicate drivers for same hardware confuses users

This patch converts ppc64_defconfig to use libata PATA
drivers.

Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
7 years agopowerpc: convert pmac32_defconfig to use libata PATA drivers
Bartlomiej Zolnierkiewicz [Wed, 3 Feb 2016 15:50:24 +0000 (16:50 +0100)]
powerpc: convert pmac32_defconfig to use libata PATA drivers

IDE subsystem has been deprecated since 2009 and the majority
(if not all) of Linux distributions have switched to use
libata for ATA support exclusively.  However there are still
some users (mostly old or/and embedded non-x86 systems) that
have not converted from using IDE subsystem to libata PATA
drivers.  This doesn't seem to be good thing in the long-term
for Linux as while there is less and less PATA systems left
in use:

* testing efforts are divided between two subsystems

* having duplicate drivers for same hardware confuses users

This patch converts pmac32_defconfig to use libata PATA
drivers.

Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
7 years agopowerpc: disable IDE subsystem in pasemi_defconfig
Bartlomiej Zolnierkiewicz [Wed, 3 Feb 2016 15:50:23 +0000 (16:50 +0100)]
powerpc: disable IDE subsystem in pasemi_defconfig

This patch disables deprecated IDE subsystem in pasemi_defconfig
(no IDE host drivers are selected in this config so there is no valid
reason to enable IDE subsystem itself).

Cc: Olof Johansson <olof@lixom.net>
Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
7 years agopowerpc: convert maple_defconfig to use libata PATA drivers
Bartlomiej Zolnierkiewicz [Wed, 3 Feb 2016 15:50:22 +0000 (16:50 +0100)]
powerpc: convert maple_defconfig to use libata PATA drivers

IDE subsystem has been deprecated since 2009 and the majority
(if not all) of Linux distributions have switched to use
libata for ATA support exclusively.  However there are still
some users (mostly old or/and embedded non-x86 systems) that
have not converted from using IDE subsystem to libata PATA
drivers.  This doesn't seem to be good thing in the long-term
for Linux as while there is less and less PATA systems left
in use:

* testing efforts are divided between two subsystems

* having duplicate drivers for same hardware confuses users

This patch converts maple_defconfig to use libata PATA
drivers.

Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
7 years agopowerpc: convert g5_defconfig to use libata PATA drivers
Bartlomiej Zolnierkiewicz [Wed, 3 Feb 2016 15:50:21 +0000 (16:50 +0100)]
powerpc: convert g5_defconfig to use libata PATA drivers

IDE subsystem has been deprecated since 2009 and the majority
(if not all) of Linux distributions have switched to use
libata for ATA support exclusively.  However there are still
some users (mostly old or/and embedded non-x86 systems) that
have not converted from using IDE subsystem to libata PATA
drivers.  This doesn't seem to be good thing in the long-term
for Linux as while there is less and less PATA systems left
in use:

* testing efforts are divided between two subsystems

* having duplicate drivers for same hardware confuses users

This patch converts g5_defconfig to use libata PATA drivers.

Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
7 years agopowerpc: convert chrp32_defconfig to use libata PATA drivers
Bartlomiej Zolnierkiewicz [Wed, 3 Feb 2016 15:50:20 +0000 (16:50 +0100)]
powerpc: convert chrp32_defconfig to use libata PATA drivers

IDE subsystem has been deprecated since 2009 and the majority
(if not all) of Linux distributions have switched to use
libata for ATA support exclusively.  However there are still
some users (mostly old or/and embedded non-x86 systems) that
have not converted from using IDE subsystem to libata PATA
drivers.  This doesn't seem to be good thing in the long-term
for Linux as while there is less and less PATA systems left
in use:

* testing efforts are divided between two subsystems

* having duplicate drivers for same hardware confuses users

This patch converts chrp32_defconfig to use libata PATA
drivers.

Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
7 years agopowerpc: convert cell_defconfig to use libata PATA drivers
Bartlomiej Zolnierkiewicz [Wed, 3 Feb 2016 15:50:19 +0000 (16:50 +0100)]
powerpc: convert cell_defconfig to use libata PATA drivers

IDE subsystem has been deprecated since 2009 and the majority
(if not all) of Linux distributions have switched to use
libata for ATA support exclusively.  However there are still
some users (mostly old or/and embedded non-x86 systems) that
have not converted from using IDE subsystem to libata PATA
drivers.  This doesn't seem to be good thing in the long-term
for Linux as while there is less and less PATA systems left
in use:

* testing efforts are divided between two subsystems

* having duplicate drivers for same hardware confuses users

This patch converts cell_defconfig to use libata PATA drivers.

Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
7 years agopowerpc: convert amigaone_defconfig to use libata PATA drivers
Bartlomiej Zolnierkiewicz [Wed, 3 Feb 2016 15:50:18 +0000 (16:50 +0100)]
powerpc: convert amigaone_defconfig to use libata PATA drivers

IDE subsystem has been deprecated since 2009 and the majority
(if not all) of Linux distributions have switched to use
libata for ATA support exclusively.  However there are still
some users (mostly old or/and embedded non-x86 systems) that
have not converted from using IDE subsystem to libata PATA
drivers.  This doesn't seem to be good thing in the long-term
for Linux as while there is less and less PATA systems left
in use:

* testing efforts are divided between two subsystems

* having duplicate drivers for same hardware confuses users

This patch converts amigaone_defconfig to use libata PATA
drivers.

Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
7 years agoselftests/powerpc: Return false instead of -1 in require_paranoia_below()
Peter Senna Tschudin [Wed, 9 Nov 2016 08:55:04 +0000 (09:55 +0100)]
selftests/powerpc: Return false instead of -1 in require_paranoia_below()

Returning a negative value for a boolean function seem to have the
undesired effect of returning true. require_paranoia_below() is a
boolean function, but the variable used to store the return value is an
integer, receiving -1 or 0. This patch converts rc to bool, replaces -1
by false, and 0 by true.

mpe: This wasn't exhibiting in practice because the common case, where
we do the comparison of the desired level vs the current value, was
being compiled into a computation based on the result of the comparison,
ie. it wasn't using the default -1 value at all. However that was just
luck and the code is still wrong.

Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com>
Signed-off-by: Andrew Shadura <andrew.shadura@collabora.co.uk>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
7 years agopowerpc/pci/rpadlpar: Fix device reference leaks
Johan Hovold [Tue, 1 Nov 2016 15:26:03 +0000 (16:26 +0100)]
powerpc/pci/rpadlpar: Fix device reference leaks

Make sure to drop any device reference taken by vio_find_node() when
adding and removing virtual I/O slots.

Fixes: 5eeb8c63a38f ("[PATCH] PCI Hotplug: rpaphp: Move VIO registration")
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
7 years agopowerpc/vio: Clarify vio_find_node() reference counting
Johan Hovold [Tue, 1 Nov 2016 15:26:02 +0000 (16:26 +0100)]
powerpc/vio: Clarify vio_find_node() reference counting

Add comment clarifying that vio_find_node() takes a reference to the
embedded struct device which needs to be dropped after use.

Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
7 years agopowerpc/ibmebus: Fix further device reference leaks
Johan Hovold [Tue, 1 Nov 2016 15:26:01 +0000 (16:26 +0100)]
powerpc/ibmebus: Fix further device reference leaks

Make sure to drop any reference taken by bus_find_device() when creating
devices during init and driver registration.

Fixes: 55347cc9962f ("[POWERPC] ibmebus: Add device creation and bus probing based on of_device")
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
7 years agopowerpc/ibmebus: Fix device reference leaks in sysfs interface
Johan Hovold [Tue, 1 Nov 2016 15:26:00 +0000 (16:26 +0100)]
powerpc/ibmebus: Fix device reference leaks in sysfs interface

Make sure to drop any reference taken by bus_find_device() in the sysfs
callbacks that are used to create and destroy devices based on
device-tree entries.

Fixes: 6bccf755ff53 ("[POWERPC] ibmebus: dynamic addition/removal of adapters, some code cleanup")
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
7 years agopowerpc/powernv: Simplify searching for compatible device nodes
Jack Miller [Thu, 11 Aug 2016 00:32:40 +0000 (19:32 -0500)]
powerpc/powernv: Simplify searching for compatible device nodes

This condenses the opal node searching into a single function that finds
all compatible nodes, instead of just searching the ibm,opal children,
for ipmi, flash, and prd similar to how opal-i2c nodes are found.

Signed-off-by: Jack Miller <jack@codezen.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
7 years agopowerpc: Revert Load Monitor Register Support
Michael Neuling [Mon, 31 Oct 2016 02:19:39 +0000 (13:19 +1100)]
powerpc: Revert Load Monitor Register Support

Load monitored is no longer supported on POWER9 so let's remove the
code.

This reverts commit bd3ea317fddf ("powerpc: Load Monitor Register
Support").

Signed-off-by: Michael Neuling <mikey@neuling.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
7 years agoselftests/powerpc: Revert Load Monitor Register Tests
Michael Neuling [Mon, 31 Oct 2016 02:19:38 +0000 (13:19 +1100)]
selftests/powerpc: Revert Load Monitor Register Tests

Load monitored won't be supported in POWER9, so PPC_FEATURE2_ARCH_3_00
(in HWCAP2) will no longer imply Load monitor support.

These Load monitored tests are enabled by PPC_FEATURE2_ARCH_3_00 so
they are now bogus and need to be removed.

This reverts commit 16c19a2e9833 ("selftests/powerpc: Load Monitor
Register Tests").

Signed-off-by: Michael Neuling <mikey@neuling.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
7 years agopowerpc/configs: Drop REISERFS from pseries & powernv
Michael Ellerman [Thu, 3 Nov 2016 07:12:16 +0000 (18:12 +1100)]
powerpc/configs: Drop REISERFS from pseries & powernv

No one uses reiserfs much these days, or is likely to in future. So drop
it from pseries and powernv defconfigs to save time and space. It's
still enabled in ppc64_defconfig so we get some build coverage.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
7 years agomacintosh: Remove dependency on IDE_GD_ATA if ADB_PMU_LED_DISK is selected
Elimar Riesebieter [Sun, 18 Sep 2016 11:08:45 +0000 (13:08 +0200)]
macintosh: Remove dependency on IDE_GD_ATA if ADB_PMU_LED_DISK is selected

We can use the front led of powerbooks/ibooks to visualize disk activity
without the deprecated IDE_GD_ATA.

Signed-off-by: Elimar Riesebieter <riesebie@lxtec.de>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
7 years agopowerpc/hash64: Be more careful when generating tlbiel
Balbir Singh [Wed, 28 Sep 2016 07:25:52 +0000 (17:25 +1000)]
powerpc/hash64: Be more careful when generating tlbiel

In ISA v2.05, the tlbiel instruction takes two arguments, RB and L:

tlbiel RB,L

+---------+---------+----+---------+---------+---------+----+
|    31   |    /    | L  |    /    |    RB   |   274   | /  |
| 31 - 26 | 25 - 22 | 21 | 20 - 16 | 15 - 11 |  10 - 1 | 0  |
+---------+---------+----+---------+---------+---------+----+

In ISA v2.06 tlbiel takes only one argument, RB:

tlbiel RB

+---------+---------+---------+---------+---------+----+
|    31   |    /    |    /    |    RB   |   274   | /  |
| 31 - 26 | 25 - 21 | 20 - 16 | 15 - 11 |  10 - 1 | 0  |
+---------+---------+---------+---------+---------+----+

And in ISA v3.00 tlbiel takes five arguments:

tlbiel RB,RS,RIC,PRS,R

+---------+---------+----+---------+----+----+---------+---------+----+
|    31   |    RS   | /  |   RIC   |PRS | R  |    RB   |   274   | /  |
| 31 - 26 | 25 - 21 | 20 | 19 - 18 | 17 | 16 | 15 - 11 |  10 - 1 | 0  |
+---------+---------+----+---------+----+----+---------+---------+----+

However the assembler also accepts "tlbiel RB", and generates
"tlbiel RB,r0,0,0,0".

As you can see above the L field from the v2.05 encoding overlaps with the
reserved field of the v2.06 encoding, and the low bit of the RS field of the
v3.00 encoding.

Currently in __tlbiel() we generate two tlbiel instructions manually using hex
constants. In the first case, for MMU_PAGE_4K, we generate "tlbiel RB,0", which
is safe in all cases, because the L bit is zero.

However in the default case we generate "tlbiel RB,1", therefore setting bit 21
to 1.

This is not an actual bug on v2.06 processors, because the CPU ignores the value
of the reserved field. However software is supposed to encode the reserved
fields as zero to enable forward compatibility.

On v3.00 processors setting bit 21 to 1 and no other bits of RS, means we are
using r1 for the value of RS.

Although it's not obvious, the code sets the IS field (bits 10-11) to 0 (by
omission), and L=1, in the va value, which is passed as RB. We also pass R=0 in
the instruction.

The combination of IS=0, L=1 and R=0 means the value of RS is not used, so even
on ISA v3.00 there is no actual bug.

We should still fix it, as setting a reserved bit on v2.06 is naughty, and we
are only avoiding a bug on v3.00 by accident rather than design. Use
ASM_FTR_IFSET() to generate the single argument form on ISA v2.06 and later, and
the two argument form on pre v2.06.

Although there may be very old toolchains which don't understand tlbiel, we have
other code in the tree which has been using tlbiel for over five years, and no
one has reported any build failures, so just let the assembler generate the
instructions.

Signed-off-by: Balbir Singh <bsingharora@gmail.com>
[mpe: Rewrite change log, use IFSET instead of IFCLR]
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
7 years agopowerpc/book3s64: Always build for power4 or later
Michael Ellerman [Thu, 20 Oct 2016 05:00:14 +0000 (16:00 +1100)]
powerpc/book3s64: Always build for power4 or later

When we're not compiling for a specific CPU, ie. none of the
CONFIG_POWERx_CPU options are set, and CONFIG_GENERIC_CPU *is* set, we
currently don't pass any -mcpu option to the compiler. This means the
compiler builds for a "generic" Power CPU.

But back in 2014 we dropped support for pre power4 CPUs in commit
468a33028edd ("powerpc: Drop support for pre-POWER4 cpus").

Given that, there's no point in building the kernel to run on pre power4
cpus. So update the flags we pass to the compiler when
CONFIG_GENERIC_CPU is set, to specify -mcpu=power4.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
7 years agopowerpc/64: Add an option to force run-at-load to test relocation
Nicholas Piggin [Fri, 14 Oct 2016 07:31:33 +0000 (18:31 +1100)]
powerpc/64: Add an option to force run-at-load to test relocation

This adds a config option that can help exercise the case when
the kernel is not running at PAGE_OFFSET.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Reviewed-by: Balbir Singh <bsingharora@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
7 years agopowerpc/pseries: Use H_CLEAR_HPT to clear MMU hash table during kexec
Anton Blanchard [Sat, 1 Oct 2016 10:41:56 +0000 (20:41 +1000)]
powerpc/pseries: Use H_CLEAR_HPT to clear MMU hash table during kexec

An hcall was recently added that does exactly what we need during kexec
- it clears the entire MMU hash table, ignoring any VRMA mappings.

Try it and fall back to the old method if we get a failure.

On a POWER8 box with 5TB of memory, this reduces the time it takes to
kexec a new kernel from from 4 minutes to 1 minute.

Signed-off-by: Anton Blanchard <anton@samba.org>
Tested-by: Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com>
[mpe: Split into separate functions and tweak function naming]
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
7 years agoi2c_powermac: shut up lockdep warning
Denis Kirjanov [Wed, 21 Sep 2016 11:34:58 +0000 (14:34 +0300)]
i2c_powermac: shut up lockdep warning

That's unclear why lockdep shows the following warning but adding a
lockdep class to struct pmac_i2c_bus solves it

[   20.507795] ======================================================
[   20.507796] [ INFO: possible circular locking dependency detected ]
[   20.507800] 4.8.0-rc7-00037-gd2ffb01 #21 Not tainted
[   20.507801] -------------------------------------------------------
[   20.507803] swapper/0/1 is trying to acquire lock:
[   20.507818]  (&bus->mutex){+.+.+.}, at: [<c000000000052830>] .pmac_i2c_open+0x30/0x100
[   20.507819]
[   20.507819] but task is already holding lock:
[   20.507829]  (&policy->rwsem){+.+.+.}, at: [<c00000000068adcc>] .cpufreq_online+0x1ac/0x9d0
[   20.507830]
[   20.507830] which lock already depends on the new lock.
[   20.507830]
[   20.507832]
[   20.507832] the existing dependency chain (in reverse order) is:
[   20.507837]
[   20.507837] -> #4 (&policy->rwsem){+.+.+.}:
[   20.507844]        [<c00000000082385c>] .down_write+0x6c/0x110
[   20.507849]        [<c00000000068adcc>] .cpufreq_online+0x1ac/0x9d0
[   20.507855]        [<c0000000004d76d8>] .subsys_interface_register+0xb8/0x110
[   20.507860]        [<c000000000689bb0>] .cpufreq_register_driver+0x1d0/0x250
[   20.507866]        [<c000000000b4f8f4>] .g5_cpufreq_init+0x9cc/0xa28
[   20.507872]        [<c00000000000a98c>] .do_one_initcall+0x5c/0x1d0
[   20.507878]        [<c000000000b0f86c>] .kernel_init_freeable+0x1ac/0x28c
[   20.507883]        [<c00000000000b3bc>] .kernel_init+0x1c/0x140
[   20.507887]        [<c0000000000098f4>] .ret_from_kernel_thread+0x58/0x64
[   20.507894]
[   20.507894] -> #3 (subsys mutex#2){+.+.+.}:
[   20.507899]        [<c000000000820448>] .mutex_lock_nested+0xa8/0x590
[   20.507903]        [<c0000000004d7f24>] .bus_probe_device+0x44/0xe0
[   20.507907]        [<c0000000004d5208>] .device_add+0x508/0x730
[   20.507911]        [<c0000000004dd528>] .register_cpu+0x118/0x190
[   20.507916]        [<c000000000b14450>] .topology_init+0x148/0x248
[   20.507921]        [<c00000000000a98c>] .do_one_initcall+0x5c/0x1d0
[   20.507925]        [<c000000000b0f86c>] .kernel_init_freeable+0x1ac/0x28c
[   20.507929]        [<c00000000000b3bc>] .kernel_init+0x1c/0x140
[   20.507934]        [<c0000000000098f4>] .ret_from_kernel_thread+0x58/0x64
[   20.507939]
[   20.507939] -> #2 (cpu_add_remove_lock){+.+.+.}:
[   20.507944]        [<c000000000820448>] .mutex_lock_nested+0xa8/0x590
[   20.507950]        [<c000000000087a9c>] .register_cpu_notifier+0x2c/0x70
[   20.507955]        [<c000000000b267e0>] .spawn_ksoftirqd+0x18/0x4c
[   20.507959]        [<c00000000000a98c>] .do_one_initcall+0x5c/0x1d0
[   20.507964]        [<c000000000b0f770>] .kernel_init_freeable+0xb0/0x28c
[   20.507968]        [<c00000000000b3bc>] .kernel_init+0x1c/0x140
[   20.507972]        [<c0000000000098f4>] .ret_from_kernel_thread+0x58/0x64
[   20.507978]
[   20.507978] -> #1 (&host->mutex){+.+.+.}:
[   20.507982]        [<c000000000820448>] .mutex_lock_nested+0xa8/0x590
[   20.507987]        [<c0000000000527e8>] .kw_i2c_open+0x18/0x30
[   20.507991]        [<c000000000052894>] .pmac_i2c_open+0x94/0x100
[   20.507995]        [<c000000000b220a0>] .smp_core99_probe+0x260/0x410
[   20.507999]        [<c000000000b185bc>] .smp_prepare_cpus+0x280/0x2ac
[   20.508003]        [<c000000000b0f748>] .kernel_init_freeable+0x88/0x28c
[   20.508008]        [<c00000000000b3bc>] .kernel_init+0x1c/0x140
[   20.508012]        [<c0000000000098f4>] .ret_from_kernel_thread+0x58/0x64
[   20.508018]
[   20.508018] -> #0 (&bus->mutex){+.+.+.}:
[   20.508023]        [<c0000000000ed5b4>] .lock_acquire+0x84/0x100
[   20.508027]        [<c000000000820448>] .mutex_lock_nested+0xa8/0x590
[   20.508032]        [<c000000000052830>] .pmac_i2c_open+0x30/0x100
[   20.508037]        [<c000000000052e14>] .pmac_i2c_do_begin+0x34/0x120
[   20.508040]        [<c000000000056bc0>] .pmf_call_one+0x50/0xd0
[   20.508045]        [<c00000000068ff1c>] .g5_pfunc_switch_volt+0x2c/0xc0
[   20.508050]        [<c00000000068fecc>] .g5_pfunc_switch_freq+0x1cc/0x1f0
[   20.508054]        [<c00000000068fc2c>] .g5_cpufreq_target+0x2c/0x40
[   20.508058]        [<c0000000006873ec>] .__cpufreq_driver_target+0x23c/0x840
[   20.508062]        [<c00000000068c798>] .cpufreq_gov_performance_limits+0x18/0x30
[   20.508067]        [<c00000000068915c>] .cpufreq_start_governor+0xac/0x100
[   20.508071]        [<c00000000068a788>] .cpufreq_set_policy+0x208/0x260
[   20.508076]        [<c00000000068abdc>] .cpufreq_init_policy+0x6c/0xb0
[   20.508081]        [<c00000000068ae70>] .cpufreq_online+0x250/0x9d0
[   20.508085]        [<c0000000004d76d8>] .subsys_interface_register+0xb8/0x110
[   20.508090]        [<c000000000689bb0>] .cpufreq_register_driver+0x1d0/0x250
[   20.508094]        [<c000000000b4f8f4>] .g5_cpufreq_init+0x9cc/0xa28
[   20.508099]        [<c00000000000a98c>] .do_one_initcall+0x5c/0x1d0
[   20.508103]        [<c000000000b0f86c>] .kernel_init_freeable+0x1ac/0x28c
[   20.508107]        [<c00000000000b3bc>] .kernel_init+0x1c/0x140
[   20.508112]        [<c0000000000098f4>] .ret_from_kernel_thread+0x58/0x64
[   20.508113]
[   20.508113] other info that might help us debug this:
[   20.508113]
[   20.508121] Chain exists of:
[   20.508121]   &bus->mutex --> subsys mutex#2 --> &policy->rwsem
[   20.508121]
[   20.508123]  Possible unsafe locking scenario:
[   20.508123]
[   20.508124]        CPU0                    CPU1
[   20.508125]        ----                    ----
[   20.508128]   lock(&policy->rwsem);
[   20.508132]                                lock(subsys mutex#2);
[   20.508135]                                lock(&policy->rwsem);
[   20.508138]   lock(&bus->mutex);
[   20.508139]
[   20.508139]  *** DEADLOCK ***
[   20.508139]
[   20.508141] 3 locks held by swapper/0/1:
[   20.508150]  #0:  (cpu_hotplug.lock){++++++}, at: [<c000000000087838>] .get_online_cpus+0x48/0xc0
[   20.508159]  #1:  (subsys mutex#2){+.+.+.}, at: [<c0000000004d7670>] .subsys_interface_register+0x50/0x110
[   20.508168]  #2:  (&policy->rwsem){+.+.+.}, at: [<c00000000068adcc>] .cpufreq_online+0x1ac/0x9d0
[   20.508169]
[   20.508169] stack backtrace:
[   20.508173] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.8.0-rc7-00037-gd2ffb01 #21
[   20.508175] Call Trace:
[   20.508180] [c0000000790c2b90] [c00000000082cc70] .dump_stack+0xe0/0x14c (unreliable)
[   20.508184] [c0000000790c2c20] [c000000000828c88] .print_circular_bug+0x350/0x388
[   20.508188] [c0000000790c2cd0] [c0000000000ecb0c] .__lock_acquire+0x196c/0x1d30
[   20.508192] [c0000000790c2e50] [c0000000000ed5b4] .lock_acquire+0x84/0x100
[   20.508196] [c0000000790c2f20] [c000000000820448] .mutex_lock_nested+0xa8/0x590
[   20.508201] [c0000000790c3030] [c000000000052830] .pmac_i2c_open+0x30/0x100
[   20.508206] [c0000000790c30c0] [c000000000052e14] .pmac_i2c_do_begin+0x34/0x120
[   20.508209] [c0000000790c3150] [c000000000056bc0] .pmf_call_one+0x50/0xd0
[   20.508213] [c0000000790c31e0] [c00000000068ff1c] .g5_pfunc_switch_volt+0x2c/0xc0
[   20.508217] [c0000000790c3250] [c00000000068fecc] .g5_pfunc_switch_freq+0x1cc/0x1f0
[   20.508221] [c0000000790c3320] [c00000000068fc2c] .g5_cpufreq_target+0x2c/0x40
[   20.508226] [c0000000790c3390] [c0000000006873ec] .__cpufreq_driver_target+0x23c/0x840
[   20.508230] [c0000000790c3440] [c00000000068c798] .cpufreq_gov_performance_limits+0x18/0x30
[   20.508235] [c0000000790c34b0] [c00000000068915c] .cpufreq_start_governor+0xac/0x100
[   20.508239] [c0000000790c3530] [c00000000068a788] .cpufreq_set_policy+0x208/0x260
[   20.508244] [c0000000790c35d0] [c00000000068abdc] .cpufreq_init_policy+0x6c/0xb0
[   20.508249] [c0000000790c3940] [c00000000068ae70] .cpufreq_online+0x250/0x9d0
[   20.508253] [c0000000790c3a30] [c0000000004d76d8] .subsys_interface_register+0xb8/0x110
[   20.508258] [c0000000790c3ad0] [c000000000689bb0] .cpufreq_register_driver+0x1d0/0x250
[   20.508262] [c0000000790c3b60] [c000000000b4f8f4] .g5_cpufreq_init+0x9cc/0xa28
[   20.508267] [c0000000790c3c20] [c00000000000a98c] .do_one_initcall+0x5c/0x1d0
[   20.508271] [c0000000790c3d00] [c000000000b0f86c] .kernel_init_freeable+0x1ac/0x28c
[   20.508276] [c0000000790c3db0] [c00000000000b3bc] .kernel_init+0x1c/0x140
[   20.508280] [c0000000790c3e30] [c0000000000098f4] .ret_from_kernel_thread+0x58/0x64

Signed-off-by: Denis Kirjanov <kda@linux-powerpc.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
7 years agopowerpc: Make _ASM_NOKPROBE_SYMBOL a noop when KPROBES not defined
Nicholas Piggin [Thu, 13 Oct 2016 02:07:14 +0000 (13:07 +1100)]
powerpc: Make _ASM_NOKPROBE_SYMBOL a noop when KPROBES not defined

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
7 years agopowerpc: Build-time sort the exception table
Nicholas Piggin [Thu, 13 Oct 2016 05:42:55 +0000 (16:42 +1100)]
powerpc: Build-time sort the exception table

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
7 years agopowerpc: Add support for relative exception tables
Nicholas Piggin [Fri, 14 Oct 2016 05:47:31 +0000 (16:47 +1100)]
powerpc: Add support for relative exception tables

This halves the exception table size on 64-bit builds, and it allows
build-time sorting of exception tables to work on relocated kernels.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
[mpe: Minor asm fixups and bits to keep the selftests working]
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
7 years agopowerpc: EX_TABLE macro for exception tables
Nicholas Piggin [Thu, 13 Oct 2016 05:42:53 +0000 (16:42 +1100)]
powerpc: EX_TABLE macro for exception tables

This macro is taken from s390, and allows more flexibility in
changing exception table format.

mpe: Put it in ppc_asm.h and only define one version using
stringinfy_in_c(). Add some empty definitions and headers to keep the
selftests happy.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
7 years agoselftests/powerpc: Fail load_unaligned_zeropad on miscompare
Michael Ellerman [Tue, 1 Nov 2016 04:01:18 +0000 (15:01 +1100)]
selftests/powerpc: Fail load_unaligned_zeropad on miscompare

If the result returned by load_unaligned_zeropad() doesn't match what we
expect we should fail the test!

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
7 years agoselftests/powerpc: Abort load_unaligned_zeropad on unhandled SEGV
Michael Ellerman [Tue, 1 Nov 2016 04:01:07 +0000 (15:01 +1100)]
selftests/powerpc: Abort load_unaligned_zeropad on unhandled SEGV

If the load unaligned zeropad test takes a SEGV which can't be handled,
we increment segv_error, print the offending NIP and then return without
taking any further action. In almost all cases this means we'll just
take the SEGV again, and loop eternally spamming the console.

Instead just abort(), it's a fatal error in the test. The test harness
will notice that the child died and print a nice message for us.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
7 years agopowerpc/module: Add support for R_PPC64_REL32 relocations
Michael Ellerman [Wed, 26 Oct 2016 03:51:12 +0000 (14:51 +1100)]
powerpc/module: Add support for R_PPC64_REL32 relocations

We haven't seen these before, but the soon to be merged relative
exception tables support causes them to be generated.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
7 years agopowerpc/asm: Allow including ppc_asm.h in asm files
Michael Ellerman [Fri, 14 Oct 2016 04:58:28 +0000 (15:58 +1100)]
powerpc/asm: Allow including ppc_asm.h in asm files

There's no reason to #error if we include ppc_asm.h in asm files, the
ifdef already prevents any problems.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
7 years agopowerpc/64s: Reduce exception alignment
Nicholas Piggin [Thu, 13 Oct 2016 03:43:52 +0000 (14:43 +1100)]
powerpc/64s: Reduce exception alignment

Exception handlers are aligned to 128 bytes (L1 cache) on 64s, which is
overkill. It can reduce the icache footprint of any individual exception
path. However taken as a whole, the expansion in icache footprint seems
likely to be counter-productive and cause more total misses.

Create IFETCH_ALIGN_SHIFT/BYTES, which should give optimal ifetch
alignment with much more reasonable alignment. This saves 1792 bytes
from head_64.o text with an allmodconfig build.

Other subarchitectures should define appropriate IFETCH_ALIGN_SHIFT
values if this becomes more widely used.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
7 years agopowerpc: Remove suspect CONFIG_PPC_BOOK3E #ifdefs in nohash/64/pgtable.h
Rui Teng [Thu, 25 Aug 2016 06:31:10 +0000 (14:31 +0800)]
powerpc: Remove suspect CONFIG_PPC_BOOK3E #ifdefs in nohash/64/pgtable.h

There are three #ifdef CONFIG_PPC_BOOK3E sections in nohash/64/pgtable.h.
And there should be no configurations possible which use nohash/64/pgtable.h
but don't also enable CONFIG_PPC_BOOK3E.

Suggested-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Rui Teng <rui.teng@linux.vnet.ibm.com>
Reviewed-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
7 years agoselftests/powerpc: Add Anton's null_syscall benchmark to the selftests
Anton Blanchard [Tue, 27 Sep 2016 14:10:16 +0000 (22:10 +0800)]
selftests/powerpc: Add Anton's null_syscall benchmark to the selftests

Pull in a version of Anton's null_syscall benchmark:
  http://ozlabs.org/~anton/junkcode/null_syscall.c

Suggested-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Anton Blanchard <anton@au.ibm.com>
Signed-off-by: Rui Teng <rui.teng@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
7 years agoLinux 4.9-rc5 v4.9-rc5
Linus Torvalds [Sun, 13 Nov 2016 18:32:32 +0000 (10:32 -0800)]
Linux 4.9-rc5

7 years agoMerge tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm
Linus Torvalds [Sun, 13 Nov 2016 18:28:53 +0000 (10:28 -0800)]
Merge tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm

Pull KVM fixes from Paolo Bonzini:
 "ARM fixes.  There are a couple pending x86 patches but they'll have to
  wait for next week"

* tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm:
  KVM: arm/arm64: vgic: Kick VCPUs when queueing already pending IRQs
  KVM: arm/arm64: vgic: Prevent access to invalid SPIs
  arm/arm64: KVM: Perform local TLB invalidation when multiplexing vcpus on a single CPU

7 years agoMerge branch 'media-fixes' (patches from Mauro)
Linus Torvalds [Sun, 13 Nov 2016 18:26:05 +0000 (10:26 -0800)]
Merge branch 'media-fixes' (patches from Mauro)

Merge media fixes from Mauro Carvalho Chehab:
 "This contains two patches fixing problems with my patch series meant
  to make USB drivers to work again after the DMA on stack changes.

  The last patch on this series is actually not related to DMA on stack.
  It solves a longstanding bug affecting module unload, causing
  module_put() to be called twice. It was reported by the user who
  reported and tested the issues with the gp8psk driver with the DMA
  fixup patches. As we're late at -rc cycle, maybe you prefer to not
  apply it right now. If this is the case, I'll add to the pile of
  patches for 4.10.

  Exceptionally this time, I'm sending the patches via e-mail, because
  I'm on another trip, and won't be able to use the usual procedure
  until Monday. Also, it is only three patches, and you followed already
  the discussions about the first one"

* emailed patches from Mauro Carvalho Chehab <mchehab@osg.samsung.com>:
  gp8psk: Fix DVB frontend attach
  gp8psk: fix gp8psk_usb_in_op() logic
  dvb-usb: move data_mutex to struct dvb_usb_device

7 years agoMerge tag 'char-misc-4.9-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh...
Linus Torvalds [Sun, 13 Nov 2016 18:24:08 +0000 (10:24 -0800)]
Merge tag 'char-misc-4.9-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc

Pull char/misc fixes from Greg KH:
 "Here are three small driver fixes for some reported issues for
  4.9-rc5.

  One for the hyper-v subsystem, fixing up a naming issue that showed up
  in 4.9-rc1, one mei driver fix, and one fix for parallel ports,
  resolving a reported regression.

  All have been in linux-next with no reported issues"

* tag 'char-misc-4.9-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc:
  ppdev: fix double-free of pp->pdev->name
  vmbus: make sysfs names consistent with PCI
  mei: bus: fix received data size check in NFC fixup