firefly-linux-kernel-4.4.55.git
11 years agopowerpc/powernv: Add PE to its own PELTV
Gavin Shan [Mon, 4 Nov 2013 08:32:46 +0000 (16:32 +0800)]
powerpc/powernv: Add PE to its own PELTV

We need add PE to its own PELTV. Otherwise, the errors originated
from the PE might contribute to other PEs. In the result, we can't
clear up the error successfully even we're checking and clearing
errors during access to PCI config space.

Cc: stable@vger.kernel.org
Reported-by: kalshett@in.ibm.com
Signed-off-by: Gavin Shan <shangw@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
11 years agopowerpc/powernv: Add support for indirect XSCOM via debugfs
Benjamin Herrenschmidt [Thu, 10 Oct 2013 08:19:15 +0000 (19:19 +1100)]
powerpc/powernv: Add support for indirect XSCOM via debugfs

Indirect XSCOM addresses normally have the top bit set (of the 64-bit
address). This doesn't work via the normal debugfs interface, so we use
a different encoding, which we need to convert before calling OPAL.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
11 years agopowerpc/scom: Improve debugfs interface
Benjamin Herrenschmidt [Mon, 4 Nov 2013 02:20:35 +0000 (13:20 +1100)]
powerpc/scom: Improve debugfs interface

The current debugfs interface to scom is essentially unused
and racy. It uses two different files "address" and "data"
to perform accesses which is at best impractical for anything
but manual use by a developer.

This replaces it with an "access" file which represent the entire
scom address space which can be lseek/read/writen too.

This file only supports accesses that are 8 bytes aligned and
multiple of 8 bytes in size. The offset is logically the SCOM
address multiplied by 8.

Since nothing in userspace exploits that file at the moment, the ABI
change is a no-brainer.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
11 years agopowerpc/scom: Enable 64-bit addresses
Benjamin Herrenschmidt [Thu, 10 Oct 2013 08:18:02 +0000 (19:18 +1100)]
powerpc/scom: Enable 64-bit addresses

On P8, XSCOM addresses has a special "indirect" form that
requires more than 32-bits, so let's use u64 everywhere in
the code instead of u32.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
11 years agopowerpc/boot: Properly handle the base "of" boot wrapper
Benjamin Herrenschmidt [Mon, 4 Nov 2013 23:09:11 +0000 (10:09 +1100)]
powerpc/boot: Properly handle the base "of" boot wrapper

The wrapper script needs an explicit rule for the "of" boot
wrapper (generic wrapper, similar to pseries). Before
0c9fa29149d3726e14262aeb0c8461a948cc9d56 it was hanlded
implicitly by the statement:

platformo=$object/"$platform".o

But now that epapr.o needs to be added, that doesn't work
and an explicit rule must be added.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
11 years agoMerge remote-tracking branch 'agust/next' into next
Benjamin Herrenschmidt [Mon, 4 Nov 2013 02:23:47 +0000 (13:23 +1100)]
Merge remote-tracking branch 'agust/next' into next

Fixes for build issues when LPB FIFO driver is configured as
a module, removal of #ifdefs in mpc512x DIU platform code and
a revert of recent changes to mpc52xx PIC driver. Wolfram
provided a better fix for PIC driver build issue popping up
when older gcc-4.3.5 is used.

11 years agopowerpc/bpf: Support MOD operation
Vladimir Murzin [Sat, 28 Sep 2013 08:22:01 +0000 (10:22 +0200)]
powerpc/bpf: Support MOD operation

commit b6069a9570 (filter: add MOD operation) added generic
support for modulus operation in BPF.

This patch brings JIT support for PPC64

Signed-off-by: Vladimir Murzin <murzin.v@gmail.com>
Acked-by: Matt Evans <matt@ozlabs.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
11 years agopowerpc/bpf: Fix DIVWU instruction opcode
Vladimir Murzin [Sat, 28 Sep 2013 08:22:00 +0000 (10:22 +0200)]
powerpc/bpf: Fix DIVWU instruction opcode

Currently DIVWU stands for *signed* divw opcode:

7d 2a 4b 96  divwu   r9,r10,r9
7d 2a 4b d6  divw    r9,r10,r9

Use the *unsigned* divw opcode for DIVWU.

Suggested-by: Vassili Karpov <av1474@comtv.ru>
Reviewed-by: Vassili Karpov <av1474@comtv.ru>
Signed-off-by: Vladimir Murzin <murzin.v@gmail.com>
Acked-by: Matt Evans <matt@ozlabs.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
11 years agoof: Move definition of of_find_next_cache_node into common code.
Sudeep KarkadaNagesha [Wed, 18 Sep 2013 10:53:05 +0000 (11:53 +0100)]
of: Move definition of of_find_next_cache_node into common code.

Since the definition of_find_next_cache_node is architecture independent,
the existing definition in powerpc can be moved to driver/of/base.c

Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Grant Likely <grant.likely@linaro.org>
Cc: Rob Herring <rob.herring@calxeda.com>
Signed-off-by: Sudeep KarkadaNagesha <sudeep.karkadanagesha@arm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
11 years agopowerpc: Remove big endianness assumption in of_find_next_cache_node
Sudeep KarkadaNagesha [Wed, 18 Sep 2013 10:53:04 +0000 (11:53 +0100)]
powerpc: Remove big endianness assumption in of_find_next_cache_node

Currently big endianness of the device tree data is assumed in
of_find_next_cache_node for 'handle' when calling of_find_node_by_phandle.

In preparation to move this function to common code, this patch fixes
the endianness using 'be32_to_cpup'

Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Grant Likely <grant.likely@linaro.org>
Cc: Rob Herring <rob.herring@calxeda.com>
Signed-off-by: Sudeep KarkadaNagesha <sudeep.karkadanagesha@arm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
11 years agopowerpc/tm: Remove interrupt disable in __switch_to()
Michael Neuling [Wed, 2 Oct 2013 07:15:14 +0000 (17:15 +1000)]
powerpc/tm: Remove interrupt disable in __switch_to()

We currently turn IRQs off in __switch_to(0 but this is unnecessary as it's
already disabled in the caller.

This removes the IRQ disable but adds a check to make sure it is really off
in case this changes in future.

Signed-off-by: Michael Neuling <mikey@neuling.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
11 years agopowerpc: word-at-a-time optimization for 64-bit Little Endian
Philippe Bergheaud [Thu, 26 Sep 2013 06:30:09 +0000 (08:30 +0200)]
powerpc: word-at-a-time optimization for 64-bit Little Endian

This is an optimization for the PowerPC in 64-bit
little-endian. Bit counting is used in find_zero(), instead
of the multiply and shift.

It is modelled after Alan Modra's PowerPC LE strlen patch
http://sourceware.org/ml/libc-alpha/2013-08/msg00097.html.

Signed-off-by: Philippe Bergheaud <felix@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
11 years agopowerpc/bpf: BPF JIT compiler for 64-bit Little Endian
Philippe Bergheaud [Tue, 24 Sep 2013 12:13:35 +0000 (14:13 +0200)]
powerpc/bpf: BPF JIT compiler for 64-bit Little Endian

This enables the Berkeley Packet Filter JIT compiler
for the PowerPC running in 64bit Little Endian.

Signed-off-by: Philippe Bergheaud <felix@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
11 years agopowerpc: Only save/restore SDR1 if in hypervisor mode
Dan Streetman [Wed, 30 Oct 2013 02:25:14 +0000 (22:25 -0400)]
powerpc: Only save/restore SDR1 if in hypervisor mode

Currently, when not in hypervisor mode the kernel
Oopses during suspend or hibernation when accessing
the SDR1 register, because it is only available
in hypervisor mode.  Access to it needs to be
protected in BEGIN/END_FW_FTR_SECTION.

Signed-off-by: Dan Streetman <ddstreet@ieee.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Reported-by: Jimmy Pan <jipan@redhat.com>
Tested-by: Jimmy Pan <jipan@redhat.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
11 years agopowerpc/pmu: Fix ADB_PMU_LED_IDE dependencies
Christian Kujau [Wed, 30 Oct 2013 04:25:43 +0000 (21:25 -0700)]
powerpc/pmu: Fix ADB_PMU_LED_IDE dependencies

for quite some time the following is printed (twice) after doing
"make oldconfig":

[...]
scripts/kconfig/conf --oldconfig Kconfig
warning: (ADB_PMU_LED_IDE) selects LEDS_TRIGGER_IDE_DISK which has unmet direct dependencies (NEW_LEDS && IDE_GD_ATA && LEDS_TRIGGERS)
warning: (ADB_PMU_LED_IDE) selects LEDS_TRIGGER_IDE_DISK which has unmet direct dependencies (NEW_LEDS && IDE_GD_ATA && LEDS_TRIGGERS)

The following patch causes ADB_PMU_LED to depend on IDE_GD_ATA, so that
the options above are only available when IDE_GD_ATA is actually selected
and thus eliminates the warning.

Signed-off-by: Christian Kujau <lists@nerdbynature.de>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
11 years agopowerpc/nvram: Fix endian issue when using the partition length
Cedric Le Goater [Wed, 30 Oct 2013 13:47:08 +0000 (14:47 +0100)]
powerpc/nvram: Fix endian issue when using the partition length

When reading partitions, the length has to be translated from
big endian to the endian order of the host. Similarly, when writing
partitions, the length needs to be in big endian order.

The userspace tool 'nvram' needs a similar fix as it is reading
and writing partitions through /dev/nram :

    http://sourceforge.net/p/powerpc-utils/mailman/message/31571277/

Signed-off-by: Cedric Le Goater <clg@fr.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
11 years agopowerpc/nvram: Fix endian issue when reading the NVRAM size
Cedric Le Goater [Wed, 30 Oct 2013 13:47:07 +0000 (14:47 +0100)]
powerpc/nvram: Fix endian issue when reading the NVRAM size

Signed-off-by: Cedric Le Goater <clg@fr.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
11 years agopowerpc/nvram: Scan partitions only once
Cedric Le Goater [Wed, 30 Oct 2013 13:47:06 +0000 (14:47 +0100)]
powerpc/nvram: Scan partitions only once

nvram_scan_partitions() is called twice when initializing the "lnx,oops-log"
partition and the "ibm,rtas-log" partition. This fills the partition list
with duplicate entries. This patch moves the partition scan in the init
routine pseries_nvram_init_log_partitions() which is called only once.

Signed-off-by: Cedric Le Goater <clg@fr.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
11 years agopowerpc/mpc512x: remove unnecessary #if
Brian Norris [Fri, 11 Oct 2013 17:37:38 +0000 (10:37 -0700)]
powerpc/mpc512x: remove unnecessary #if

Several functions are only ever referenced locally, so make them static.
Of those functions, many of them are protected by an #if. However, the
code which can compile fine in either case.

Now that (1) the unneeded code is marked 'static' and (2) the code is
only used under a C 'if (IS_ENABLED(CONFIG_FB_FSL_DIU))', the compiler
can automatically remove the unneeded code, and we don't need the #if or
the empty stub functions.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Anatolij Gustschin <agust@denx.de>
11 years agopowerpc/52xx: fix build breakage for MPC5200 LPBFIFO module
Anatolij Gustschin [Wed, 16 Oct 2013 11:11:27 +0000 (13:11 +0200)]
powerpc/52xx: fix build breakage for MPC5200 LPBFIFO module

The MPC5200 LPBFIFO driver requires the bestcomm module to be
enabled, otherwise building will fail. Fix it.

Cc: <stable@vger.kernel.org> # 3.10+
Reported-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Anatolij Gustschin <agust@denx.de>
11 years agoKind of revert "powerpc: 52xx: provide a default in mpc52xx_irqhost_map()"
Wolfram Sang [Fri, 4 Oct 2013 15:37:09 +0000 (17:37 +0200)]
Kind of revert "powerpc: 52xx: provide a default in mpc52xx_irqhost_map()"

This more or less reverts commit 6391f697d4892a6f233501beea553e13f7745a23.
Instead of adding an unneeded 'default', mark the variable to prevent
the false positive 'uninitialized var'. The other change (fixing the
printout) needs revert, too. We want to know WHICH critical irq failed,
not which level it had.

Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: Anatolij Gustschin <agust@denx.de>
Acked-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Anatolij Gustschin <agust@denx.de>
11 years agopowerpc/mpc512x: silence build warning upon disabled DIU
Gerhard Sittig [Fri, 27 Sep 2013 15:28:38 +0000 (17:28 +0200)]
powerpc/mpc512x: silence build warning upon disabled DIU

a disabled Kconfig option results in a reference to a not implemented
routine when the IS_ENABLED() macro is used for both conditional
implementation of the routine as well as a C language source code test
at the call site -- the "if (0) func();" construct only gets eliminated
later by the optimizer, while the compiler already has emitted its
warning about "func()" being undeclared

provide an empty implementation for the mpc512x_setup_diu() and
mpc512x_init_diu() routines in case of the disabled option, to avoid the
compiler warning which is considered fatal and breaks compilation

the bug appeared with commit 2abbbb63c90ab55ca3f054772c2e5ba7df810c48
"powerpc/mpc512x: move common code to shared.c file", how to reproduce:

  make mpc512x_defconfig
  echo CONFIG_FB_FSL_DIU=n >> .config && make olddefconfig
  make

    CC      arch/powerpc/platforms/512x/mpc512x_shared.o
  .../arch/powerpc/platforms/512x/mpc512x_shared.c: In function 'mpc512x_init_early':
  .../arch/powerpc/platforms/512x/mpc512x_shared.c:456:3: error: implicit declaration of function 'mpc512x_init_diu' [-Werror=implicit-function-declaration]
  .../arch/powerpc/platforms/512x/mpc512x_shared.c: In function 'mpc512x_setup_arch':
  .../arch/powerpc/platforms/512x/mpc512x_shared.c:469:3: error: implicit declaration of function 'mpc512x_setup_diu' [-Werror=implicit-function-declaration]
  cc1: all warnings being treated as errors
  make[4]: *** [arch/powerpc/platforms/512x/mpc512x_shared.o] Error 1

Signed-off-by: Gerhard Sittig <gsi@denx.de>
CC: <stable@vger.kernel.org> # v3.11
Signed-off-by: Anatolij Gustschin <agust@denx.de>
11 years agopowerpc/powernv: Code update interface
Vasant Hegde [Thu, 24 Oct 2013 10:34:58 +0000 (16:04 +0530)]
powerpc/powernv: Code update interface

Code update interface for powernv platform. This provides
sysfs interface to pass new image, validate, update and
commit images.

This patch includes:
  - Below OPAL APIs for code update
    - opal_validate_flash()
    - opal_manage_flash()
    - opal_update_flash()

  - Create below sysfs files under /sys/firmware/opal
    - image : Interface to pass new FW image
    - validate_flash : Validate candidate image
    - manage_flash : Commit/Reject operations
    - update_flash : Flash new candidate image

Updating Image:
  "update_flash" is an interface to indicate flash new FW.
It just passes image SG list to FW. Actual flashing is done
during system reboot time.

Note:
  - SG entry format:
    I have kept version number to keep this list similar to what
    PAPR is defined.

Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
11 years agopowerpc/powernv: Create opal sysfs directory
Vasant Hegde [Tue, 27 Aug 2013 09:39:52 +0000 (15:09 +0530)]
powerpc/powernv: Create opal sysfs directory

Create /sys/firmware/opal directory. We wil use this
interface to fetch opal error logs, firmware update, etc.

Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
11 years agopowerpc: Add VMX optimised xor for RAID5
Anton Blanchard [Mon, 14 Oct 2013 10:03:58 +0000 (21:03 +1100)]
powerpc: Add VMX optimised xor for RAID5

Add a VMX optimised xor, used primarily for RAID5. On a POWER7 blade
this is a decent win:

   32regs    : 17932.800 MB/sec
   altivec   : 19724.800 MB/sec

The bigger gain is when the same test is run in SMT4 mode, as it
would if there was a lot of work going on:

   8regs     :  8377.600 MB/sec
   altivec   : 15801.600 MB/sec

I tested this against an array created without the patch, and also
verified it worked as expected on a little endian kernel.

[ Fix !CONFIG_ALTIVEC build -- BenH ]

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
11 years agopowerpc/kexec: kexec_sequence() is in misc_64.S
Geert Uytterhoeven [Mon, 14 Oct 2013 07:40:16 +0000 (09:40 +0200)]
powerpc/kexec: kexec_sequence() is in misc_64.S

Correct reference to the location of the kexec_sequence() assembly helper.
There never was a kexec_stub.S in mainline.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
11 years agopowerpc: Use 32 bit loads and stores when operating on condition register values
Anton Blanchard [Tue, 15 Oct 2013 03:36:31 +0000 (14:36 +1100)]
powerpc: Use 32 bit loads and stores when operating on condition register values

The condition register (CR) is a 32 bit quantity so we should use
32 bit loads and stores.

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
11 years agopowerpc: Enable virtio on ppc64 and pseries configs
Anton Blanchard [Tue, 22 Oct 2013 00:46:15 +0000 (11:46 +1100)]
powerpc: Enable virtio on ppc64 and pseries configs

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
11 years agopowerpc: Enable multipath modules on ppc64 and pseries
Anton Blanchard [Tue, 22 Oct 2013 00:45:31 +0000 (11:45 +1100)]
powerpc: Enable multipath modules on ppc64 and pseries

Enable a few modules required to boot on a POWER multipath
box.

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
11 years agopowerpc: sync ppc64, ppc64e and pseries configs
Anton Blanchard [Tue, 22 Oct 2013 00:44:50 +0000 (11:44 +1100)]
powerpc: sync ppc64, ppc64e and pseries configs

Run savedefconfig over the ppc64, ppc64e and pseries config

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
11 years agopowerpc: Use -mcpu=power7 on ppc64 little endian builds
Anton Blanchard [Tue, 22 Oct 2013 00:05:25 +0000 (11:05 +1100)]
powerpc: Use -mcpu=power7 on ppc64 little endian builds

Using -mcpu=power7 allows gcc to use a number of new instructions
including 64 bit byte reversed loads.

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
11 years agopowerpc/pseries: Fix dedicated processor partition detection
Anton Blanchard [Sat, 19 Oct 2013 23:26:20 +0000 (10:26 +1100)]
powerpc/pseries: Fix dedicated processor partition detection

commit f13c13a00512 (powerpc: Stop using non-architected shared_proc
field in lppaca) fixed a potential issue with shared/dedicated
partition detection. The old method of detection relied on an
unarchitected field (shared_proc), and this patch switched
to using something architected (a non zero yield_count).

Unfortunately the assertion in the Linux header that yield_count
is only non zero on shared processor partitions is not true. It
turns out dedicated processor partitions can increment yield_count
and as such we falsely detect dedicated partitions as shared.

Fix the comment, and switch back to using the old method.

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
11 years agopowerpc: Fix Unaligned LE Floating Point Loads and Stores
Tom Musta [Fri, 18 Oct 2013 19:44:17 +0000 (14:44 -0500)]
powerpc: Fix Unaligned LE Floating Point Loads and Stores

This patch addresses unaligned single precision floating point loads
and stores in the single-step code.  The old implementation
improperly treated an 8 byte structure as an array of two 4 byte
words, which is a classic little endian bug.

Signed-off-by: Tom Musta <tmusta@gmail.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
11 years agopowerpc: Fix Unaligned Loads and Stores
Tom Musta [Fri, 18 Oct 2013 19:42:08 +0000 (14:42 -0500)]
powerpc: Fix Unaligned Loads and Stores

This patch modifies the unaligned access routines of the sstep.c
module so that it properly reverses the bytes of storage operands
in the little endian kernel kernel.   This is implemented by
breaking an unaligned little endian access into a combination of
single byte accesses plus an overal byte reversal operation.

Signed-off-by: Tom Musta <tmusta@gmail.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
11 years agopowerpc: Enable Little Endian Alignment Handler for Float Pair Instructions
Tom Musta [Fri, 18 Oct 2013 17:08:22 +0000 (12:08 -0500)]
powerpc: Enable Little Endian Alignment Handler for Float Pair Instructions

This patch enables alignment handling for the load/store floating point
pair instructions (lfdp, lfdpx, stfdp, stfdpx).  The handler routine
is properly coded and only needs to be enabled.

Signed-off-by: Tom Musta <tmusta@gmail.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
11 years agopowerpc: Fix Handler of Unaligned Load/Store Strings
Tom Musta [Fri, 18 Oct 2013 17:07:10 +0000 (12:07 -0500)]
powerpc: Fix Handler of Unaligned Load/Store Strings

The alignment handler is incorrect for unaligned string instructions
in little endian mode.  These instructions access data as arrays of
bytes and thus are endian neutral.  However, the routine also handles
the load/store multiple instructions, which are NOT endian neutral.

This patch toggles the byte swapping flag for the string instructions
in little endian builds.  This effectively disables the byte swapping
logic.

Signed-off-by: Tom Musta <tmusta@gmail.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
11 years agopowerpc/pseries: Fix endian issues in pseries iommu code
Anton Blanchard [Thu, 17 Oct 2013 12:21:15 +0000 (23:21 +1100)]
powerpc/pseries: Fix endian issues in pseries iommu code

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
11 years agopowerpc: Fix little endian issue in OF PCI scan
Anton Blanchard [Thu, 17 Oct 2013 12:19:43 +0000 (23:19 +1100)]
powerpc: Fix little endian issue in OF PCI scan

This issue was causing the QEMU emulated USB device to fail dring
PCI probe.

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
11 years agopowerpc/vio: use strcpy in modalias_show
Prarit Bhargava [Thu, 17 Oct 2013 12:00:11 +0000 (08:00 -0400)]
powerpc/vio: use strcpy in modalias_show

Commit e82b89a6f19bae73fb064d1b3dd91fcefbb478f4 used strcat instead of
strcpy which can result in an overflow of newlines on the buffer.

Signed-off-by: Prarit Bhargava
Cc: benh@kernel.crashing.org
Cc: ben@decadent.org.uk
Cc: stable@vger.kernel.org
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
11 years agopowerpc: Fix 64K page size support for PPC44x
Alistair Popple [Thu, 17 Oct 2013 06:08:28 +0000 (17:08 +1100)]
powerpc: Fix 64K page size support for PPC44x

PPC44x supports page sizes other than 4K however when 64K page sizes
are selected compilation fails. This is due to a change in the
definition of pgtable_t introduced by the following patch:

commit 5c1f6ee9a31cbdac90bbb8ae1ba4475031ac74b4
Author: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
powerpc: Reduce PTE table memory wastage

The above patch only implements the new layout for PPC64 so it doesn't
compile for PPC32 with a 64K page size. Ideally we should implement
the same layout for PPC32 however for the meantime this patch reverts
the definition of pgtable_t for PPC32.

Signed-off-by: Alistair Popple <alistair@popple.id.au>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
11 years agopowerpc: FA_DUMP depends on KEXEC
Michael Ellerman [Mon, 28 Oct 2013 04:00:35 +0000 (15:00 +1100)]
powerpc: FA_DUMP depends on KEXEC

If you try and build the FA_DUMP code with CONFIG_KEXEC=n, you see
errors such as the following:

arch/powerpc/kernel/fadump.c
  408:2: error: 'crashing_cpu' undeclared (first use in this function)
  410:2: error: implicit declaration of function 'crash_save_vmcoreinfo'
  513:22: error: storage size of 'prstatus' isn't known
  520:2: error: implicit declaration of function 'elf_core_copy_kernel_regs'
  521:36: error: 'KEXEC_CORE_NOTE_NAME' undeclared (first use in this function)
  624:49: error: 'note_buf_t' undeclared (first use in this function)
  872:2: error: implicit declaration of function 'paddr_vmcoreinfo_note'
  874:18: error: 'vmcoreinfo_max_size' undeclared (first use in this function)

This is because although FA_DUMP doesn't use kexec as the actual reboot
mechanism, it does use parts of the kexec code to assemble/disassemble
the crash image.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
11 years agopowerpc: Fix a typo in comments of va to pa conversion
Vaishnavi Bhat [Sun, 27 Oct 2013 06:17:19 +0000 (11:47 +0530)]
powerpc: Fix a typo in comments of va to pa conversion

This patch fixes typo in comments virtual to physical
address conversion.

Signed-off-by: Vaishnavi Bhat <vaishnavi@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
11 years agopowerpc: Move local setup.h declarations to arch includes
Robert Jennings [Mon, 28 Oct 2013 14:20:51 +0000 (09:20 -0500)]
powerpc: Move local setup.h declarations to arch includes

Move the few declarations from arch/powerpc/kernel/setup.h
into arch/powerpc/include/asm/setup.h.  This resolves a
sparse warning for arch/powerpc/mm/numa.c which defines
do_init_bootmem() but can't include the setup.h header
in the prior path.

Resolves:
arch/powerpc/mm/numa.c:998:13:
        warning: symbol 'do_init_bootmem' was not declared.
                 Should it be static?

Signed-off-by: Robert C Jennings <rcj@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
11 years agopowerpc: Fix warnings for arch/powerpc/mm/numa.c
Robert Jennings [Mon, 28 Oct 2013 14:20:50 +0000 (09:20 -0500)]
powerpc: Fix warnings for arch/powerpc/mm/numa.c

Simple fixes for sparse warnings in this file.

Resolves:
arch/powerpc/mm/numa.c:198:24:
        warning: Using plain integer as NULL pointer

arch/powerpc/mm/numa.c:1157:5:
       warning: symbol 'hot_add_node_scn_to_nid' was not declared.
                Should it be static?

arch/powerpc/mm/numa.c:1238:28:
       warning: Using plain integer as NULL pointer

arch/powerpc/mm/numa.c:1538:6:
       warning: symbol 'topology_schedule_update' was not declared.
                Should it be static?

Signed-off-by: Robert C Jennings <rcj@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
11 years agopowerpc/boot: Don't change link address for OF-based platforms
Paul Mackerras [Tue, 29 Oct 2013 05:21:26 +0000 (16:21 +1100)]
powerpc/boot: Don't change link address for OF-based platforms

Commit c55aef0e5bc6 ("powerpc/boot: Change the load address for the
wrapper to fit the kernel") adjusts the wrapper address unnecessarily
for platforms that use arch/powerpc/boot/of.c, since the code there
allocates space for the kernel wherever it can find it and doesn't
necessarily load the kernel at address 0.  Changing the link address
is actually harmful since it can cause the zImage to overlap with
Open Firmware and thus fail to boot.

To fix this, we set make_space to n for all of the platforms that
use of.o.

Signed-off-by: Paul Mackerras <paulus@samba.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
11 years agopowerpc: Add includes to fix powernv/rng.c build
Stephen Rothwell [Mon, 28 Oct 2013 08:34:41 +0000 (19:34 +1100)]
powerpc: Add includes to fix powernv/rng.c build

Caused by commit a4da0d50b2a0 ("powerpc: Implement
arch_get_random_long/int() for powernv") from the powerpc tree
interacting with commit b5b4bb3f6a11 ("of: only include prom.h on sparc")
from the dt-rh tree.

I added this merge fix patch (which will need to be sent to Linus when
these two trees get merged, or could be applied now to the powerpc tree):

[ Also add linux/smp.h to get cpu_to_chip_id -- BenH ]

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Acked-by: Rob Herring <rob.herring@calxeda.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
11 years agoMerge remote-tracking branch 'scott/next' into next
Benjamin Herrenschmidt [Tue, 29 Oct 2013 23:26:23 +0000 (10:26 +1100)]
Merge remote-tracking branch 'scott/next' into next

Highlights include corenet board file consolidation, the ability to run
userspaces with lwsync on e500v1/v2, some cleanup patches that other KVM
patches will build on, support for stripped-down e6500 emulation targets,
and some fixes of minor longstanding issues.

11 years agoMerge branch 'for-kvm' into next
Benjamin Herrenschmidt [Tue, 29 Oct 2013 22:47:01 +0000 (09:47 +1100)]
Merge branch 'for-kvm' into next

Add Paul's fix for 32-bit register corruption in the new FP code

11 years agopowerpc: Fix PPC_EMULATED_STATS build break with sync patch
Scott Wood [Tue, 29 Oct 2013 03:07:59 +0000 (22:07 -0500)]
powerpc: Fix PPC_EMULATED_STATS build break with sync patch

Commit 9863c28a2af90a56c088f5f6288d7f6d2c923c14 ("powerpc: Emulate sync
instruction variants") introduced a build breakage with
CONFIG_PPC_EMULATED_STATS enabled.

Signed-off-by: Scott Wood <scottwood@freescale.com>
Cc: Kumar Gala <galak@kernel.org>
Cc: James Yang <James.Yang@freescale.com>
---

11 years agopowerpc/6xx: CONFIG_MCU_MPC8349EMITX cannot be a module
Christian Kujau [Mon, 28 Oct 2013 12:51:36 +0000 (05:51 -0700)]
powerpc/6xx: CONFIG_MCU_MPC8349EMITX cannot be a module

During "make ppc6xx_defconfig" the following happens:

  HOSTCC  scripts/basic/fixdep
  GEN     /usr/local/src/tmp/lnx/Makefile
  HOSTCC  scripts/kconfig/conf.o
  HOSTCC  scripts/kconfig/zconf.tab.o
  HOSTLD  scripts/kconfig/conf
arch/powerpc/configs/ppc6xx_defconfig:74:warning: symbol value 'm' invalid for MCU_MPC8349EMITX

Setting CONFIG_MCU_MPC8349EMITX=y in ppc6xx_defconfig makes the warning
go away. This too has been reported by Geert Uytterhoeven a long time ago:
https://lkml.org/lkml/2011/11/13/11  - I only came across this because I
needed a "clean" defconfig for this Powerbook G5.

Signed-off-by: Christian Kujau <lists@nerdbynature.de>
[scottwood@freescale.com: cleaned up commit message slightly]
Signed-off-by: Scott Wood <scottwood@freescale.com>
11 years agopowerpc/mv643xx_eth: fix return check in mv64x60_eth_register_shared_pdev()
Wei Yongjun [Fri, 25 Oct 2013 09:30:24 +0000 (17:30 +0800)]
powerpc/mv643xx_eth: fix return check in mv64x60_eth_register_shared_pdev()

In case of error, the function platform_device_register_simple() returns
RR_PTR() and never returns NULL. The NULL test in the return value check
should be replaced with IS_ERR().

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Scott Wood <scottwood@freescale.com>
11 years agopowerpc/p1010rdb: add P1010RDB-PB platform support
Zhao Qiang [Mon, 14 Oct 2013 06:46:13 +0000 (14:46 +0800)]
powerpc/p1010rdb: add P1010RDB-PB platform support

The P1010RDB-PB is similar to P1010RDB(P1010RDB-PA).
So, P1010RDB-PB use the same platform file as P1010RDB.
Then Add support for P1010RDB-PB platform.

Signed-off-by: Zhao Qiang <B45475@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
11 years agoarch/powerpc/platforms/83xx: Remove obsolete cleanup for clientdata
Wolfram Sang [Sun, 13 Oct 2013 16:05:38 +0000 (18:05 +0200)]
arch/powerpc/platforms/83xx: Remove obsolete cleanup for clientdata

A few new i2c-drivers came into the kernel which clear the clientdata-pointer
on exit or error. This is obsolete meanwhile, the core will do it.

Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Signed-off-by: Scott Wood <scottwood@freescale.com>
11 years agopowerpc/6xx: add missing iounmap() on error in hlwd_pic_init()
Wei Yongjun [Sat, 12 Oct 2013 07:13:19 +0000 (15:13 +0800)]
powerpc/6xx: add missing iounmap() on error in hlwd_pic_init()

Add the missing iounmap() before return from hlwd_pic_init()
in the error handling case.

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Scott Wood <scottwood@freescale.com>
11 years agopowerpc/8xx: Fixing memory init issue with CONFIG_PIN_TLB
LEROY Christophe [Fri, 11 Oct 2013 12:56:40 +0000 (14:56 +0200)]
powerpc/8xx: Fixing memory init issue with CONFIG_PIN_TLB

Activating CONFIG_PIN_TLB allows access to the 24 first Mbytes of
memory at bootup instead of 8.  It is needed for "big" kernels for
instance when activating CONFIG_LOCKDEP_SUPPORT.  This needs to be
taken into account in init_32 too, otherwise memory allocation soon
fails after startup.

Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
Acked-by: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>
Signed-off-by: Scott Wood <scottwood@freescale.com>
11 years agopowerpc/8xx: Fixing issue with CONFIG_PIN_TLB
LEROY Christophe [Tue, 24 Sep 2013 08:18:39 +0000 (10:18 +0200)]
powerpc/8xx: Fixing issue with CONFIG_PIN_TLB

Activating CONFIG_PIN_TLB is supposed to pin the IMMR and the first
three 8Mbytes pages.  But the setting of MD_CTR to a pinnable entry was
missing before the pinning of the third 8Mb page.  As the index is
decremented module 28 (MD_RSV4D is set) after every DTLB update, the
third 8Mbytes page was not pinned.

Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
Signed-off-by: Scott Wood <scottwood@freescale.com>
11 years agopowerpc/85xx: use one kernel option for all the CoreNet_Generic boards
Kevin Hao [Thu, 26 Sep 2013 01:42:28 +0000 (09:42 +0800)]
powerpc/85xx: use one kernel option for all the CoreNet_Generic boards

Currently all these boards use the same machine struct and also select
the same kernel options, so it seems a bit of redundant to keep one
separate kernel option for each board. Also update the defconfigs
according to this change.

Signed-off-by: Kevin Hao <haokexin@gmail.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
11 years agopowerpc/85xx: rename the corenet_ds.c to corenet_generic.c
Kevin Hao [Thu, 26 Sep 2013 01:42:27 +0000 (09:42 +0800)]
powerpc/85xx: rename the corenet_ds.c to corenet_generic.c

This file is also used by some RDB and QDS boards. So the name seems
not so accurate. Rename it to corenet_generic.c. Also update the
function names in this file according to the change.

Signed-off-by: Kevin Hao <haokexin@gmail.com>
11 years agopowerpc/85xx: introduce corenet_generic machine
Kevin Hao [Thu, 26 Sep 2013 01:42:26 +0000 (09:42 +0800)]
powerpc/85xx: introduce corenet_generic machine

In the current kernel, the board files for p2041rdb, p3041ds, p4080ds,
p5020ds, p5040ds, t4240qds and b4qds are almost the same except the
machine name. So this introduces a cornet_generic machine to support
all these boards to avoid the code duplication.

With these changes the file corenet_ds.h becomes useless. Just delete
it.

Signed-off-by: Kevin Hao <haokexin@gmail.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
11 years agopowerpc/dts/c293pcie: Add range field for IFC NAND
Prabhakar Kushwaha [Tue, 24 Sep 2013 10:50:32 +0000 (16:20 +0530)]
powerpc/dts/c293pcie: Add range field for IFC NAND

C290PCIe has NAND flash present on IFC Chip Select(CS) 1.

So Add "ranges" field for NAND flash on CS1.

Signed-off-by: Prabhakar Kushwaha <prabhakar@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
11 years agopowerpc/b4860emu: Add device tree file for b4860emu
York Sun [Mon, 16 Sep 2013 23:38:07 +0000 (16:38 -0700)]
powerpc/b4860emu: Add device tree file for b4860emu

B4860EMU is a emualtor target with minimum peripherals. It is based on
B4860QDS and trimmed down most peripherals due to either not modeled or
lack of board level connections. The main purpose of this minimum dts is
to speed up booting on emulator.

Signed-off-by: York Sun <yorksun@freescale.com>
[scottwood@freescale.com: whitespace fix]
Signed-off-by: Scott Wood <scottwood@freescale.com>
11 years agopowerpc/t4240emu: Add device tree file for t4240emu
York Sun [Mon, 16 Sep 2013 23:38:06 +0000 (16:38 -0700)]
powerpc/t4240emu: Add device tree file for t4240emu

T4240EMU is an emulator target with minimum peripherals. It is based on
T4240QDS and trimmed down most peripherals due to either not modeled or
lack of board level connections. The main purpose of this minimum dts is
to speed up booting on emulator.

Signed-off-by: York Sun <yorksun@freescale.com>
[scottwood@freescale.com: whitespace fixes]
Signed-off-by: Scott Wood <scottwood@freescale.com>
11 years agopowerpc/b4qds: enable coreint
Scott Wood [Wed, 11 Sep 2013 23:36:52 +0000 (18:36 -0500)]
powerpc/b4qds: enable coreint

Commit 9837b43c5f3514e5d28f65f1513f4dc6759d2810 ("powerpc/85xx: enable
coreint for all the 64bit boards") removed the ifdef that avoided
coreint on 64-bit, but it missed b4_qds.c.

Signed-off-by: Scott Wood <scottwood@freescale.com>
Cc: Kevin Hao <haokexin@gmail.com>
Cc: Shaveta Leekha <shaveta@freescale.com>
11 years agopowerpc/8xx: Revert commit e0908085fc2391c85b85fb814ae1df377c8e0dcb
LEROY Christophe [Wed, 11 Sep 2013 16:44:44 +0000 (18:44 +0200)]
powerpc/8xx: Revert commit e0908085fc2391c85b85fb814ae1df377c8e0dcb

The commit e0908085fc2391c85b85fb814ae1df377c8e0dcb ("powerpc/8xx: Fix
regression introduced by cache coherency rewrite") is not needed
anymore.  The issue was because dcbst wrongly sets the store bit when
causing a DTLB error, but this is now fixed by commit
0a2ab51ffb8dfdf51402dcfb446629648c96bc78 ("powerpc/8xx: Fixup DAR from
buggy dcbX instructions.") which handles the buggy dcbx instructions on
data page faults on the 8xx.

Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
[scottwood@freescale.com: fix commit message]
Signed-off-by: Scott Wood <scottwood@freescale.com>
11 years agopowerpc: Add I2C bus multiplexer node for B4 and T4240QDS
Hongtao Jia [Mon, 9 Sep 2013 10:03:33 +0000 (18:03 +0800)]
powerpc: Add I2C bus multiplexer node for B4 and T4240QDS

In both B4 and T4240QDS platform PCA9547 I2C bus multiplexer is used.
The sub-nodes are also reorganized according to right I2C topology.

Signed-off-by: Jia Hongtao <hongtao.jia@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
11 years agopowerpc/fsl/defconfig: enable CONFIG_AT803X_PHY
Shengzhou Liu [Tue, 3 Sep 2013 08:28:26 +0000 (16:28 +0800)]
powerpc/fsl/defconfig: enable CONFIG_AT803X_PHY

Enable CONFIG_AT803X_PHY to support AR8030/8033/8035 PHY.

Signed-off-by: Shengzhou Liu <Shengzhou.Liu@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
11 years agopowerpc/dts: Correct sdhci quirk for bsc9131
Haijun.Zhang [Mon, 2 Sep 2013 10:37:02 +0000 (18:37 +0800)]
powerpc/dts: Correct sdhci quirk for bsc9131

We use property "sdhci,auto-cmd12" instead of "fsl,sdhci-auto-cmd12"
to distinguish if the sdhc host has quirk SDHCI_QUIRK_MULTIBLOCK_READ_ACMD12.

Signed-off-by: Haijun Zhang <Haijun.Zhang@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
11 years agopowerpc/eSDCH: Specify voltage for T4240QDS
Haijun.Zhang [Thu, 29 Aug 2013 03:31:28 +0000 (11:31 +0800)]
powerpc/eSDCH: Specify voltage for T4240QDS

Freescale T4240QDS reference board has extra voltage shifters added
to allow 3.3V operation, so add 3.3v voltage support for T4240QDS.
1.8v and 3.3v is recommand for eMMC and SDHC card.

Signed-off-by: Haijun Zhang <haijun.zhang@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
11 years agopowerpc/mpc8xx: Clearer Oops message for Software Emulation Exception
LEROY Christophe [Wed, 28 Aug 2013 14:19:17 +0000 (16:19 +0200)]
powerpc/mpc8xx: Clearer Oops message for Software Emulation Exception

This patch modifies the Oops message in case of Software Emulation Exception.
The existing message is quite confusing because it refers to FPU Emulation
while most often the issue is due to either a non supported instruction
(not necessarily FPU related) or a stale instruction due to HW issues.
The new message tries to be more generic in order to make the user understand
that the Oops is due to something wrong with an instruction, not necessarily
due to an FPU instruction.

Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
Signed-off-by: Scott Wood <scottwood@freescale.com>
11 years agopowerpc: Set the NOTE type for SPE regset
Suzuki Poulose [Tue, 27 Aug 2013 07:52:14 +0000 (13:22 +0530)]
powerpc: Set the NOTE type for SPE regset

The regset defintion for SPE doesn't have the core_note_type
set, which prevents it from being dumped. Add the note type
NT_PPC_SPE for SPE regset.

Signed-off-by: Suzuki K Poulose <suzuki@in.ibm.com>
Cc: Roland McGrath <roland@hack.frob.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
11 years agopowerpc/e500v2: Include Power ISA properties
Lijun Pan [Thu, 24 Oct 2013 21:03:25 +0000 (16:03 -0500)]
powerpc/e500v2: Include Power ISA properties

bsc9131 device tree does not have these properties.

Signed-off-by: Lijun Pan <Lijun.Pan@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
11 years agopowerpc/e6500: Include Power ISA properties
Lijun Pan [Thu, 24 Oct 2013 21:11:13 +0000 (16:11 -0500)]
powerpc/e6500: Include Power ISA properties

b4420 and b4860 device trees do not have these properties.

Signed-off-by: Lijun Pan <Lijun.Pan@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
11 years agopowerpc/pci: Change the DECLARE_PCI_FIXUP_{HEADER => EARLY} macro of pci quirk
Chunhe Lan [Fri, 2 Aug 2013 08:46:25 +0000 (16:46 +0800)]
powerpc/pci: Change the DECLARE_PCI_FIXUP_{HEADER => EARLY} macro of pci quirk

Freescale platform has class code = 0x0b2000, when it boots. This makes
kernel PCI bus code to setup these devices resulting into the following
notice information when trying to enable them:

pci 0000:00:00.0: ignoring class 0x0b2000 (doesn't match header type 01)

The above information is outputted by judging value of dev->class before
pci_setup_device() function, and the DECLARE_PCI_FIXUP_HEADER quirk runs
after pci_setup_device() function. But the DECLARE_PCI_FIXUP_EARLY quirk
runs before judging value of dev->class and pci_setup_device() function.
So we use the DECLARE_PCI_FIXUP_EARLY macro to fix this issue.

Signed-off-by: Chunhe Lan <Chunhe.Lan@freescale.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Bjorn Helgaas <bhelgaas@google.com>
Cc: Paul Mackerras <paulus@samba.org>
Signed-off-by: Scott Wood <scottwood@freescale.com>
11 years agopowerpc/dts: fix sRIO error interrupt for b4860
Minghuan Lian [Wed, 31 Jul 2013 02:59:07 +0000 (10:59 +0800)]
powerpc/dts: fix sRIO error interrupt for b4860

For B4 platform, MPIC EISR register is in reversed bitmap order,
instead of "Error interrupt source 0-31. Bit 0 represents SRC0."
the correct ordering is "Error interrupt source 0-31. Bit 0
represents SRC31." This patch is to fix sRIO EISR bit value
of error interrupt in dts node.

Signed-off-by: Minghuan Lian <Minghuan.Lian@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
11 years agopowerpc: Don't corrupt user registers on 32-bit
Paul Mackerras [Wed, 23 Oct 2013 08:40:02 +0000 (09:40 +0100)]
powerpc: Don't corrupt user registers on 32-bit

Commit de79f7b9f6 ("powerpc: Put FP/VSX and VR state into structures")
modified load_up_fpu() and load_up_altivec() in such a way that they
now use r7 and r8.  Unfortunately, the callers of these functions on
32-bit machines then return to userspace via fast_exception_return,
which doesn't restore all of the volatile GPRs, but only r1, r3 -- r6
and r9 -- r12.  This was causing userspace segfaults and other
userspace misbehaviour on 32-bit machines.

This fixes the problem by changing the register usage of load_up_fpu()
and load_up_altivec() to avoid using r7 and r8 and instead use r6 and
r10.  This also adds comments to those functions saying which registers
may be used.

Signed-off-by: Paul Mackerras <paulus@samba.org>
Tested-by: Scott Wood <scottwood@freescale.com> (on e500mc, so no altivec)
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
11 years agopowerpc/booke: clear DBCR0_BT in user_disable_single_step()
James Yang [Fri, 5 Jul 2013 19:49:43 +0000 (14:49 -0500)]
powerpc/booke: clear DBCR0_BT in user_disable_single_step()

BookE version of user_disable_single_step() clears DBCR0_IC for the
instruction completion debug, but did not also clear DBCR0_BT for the
branch taken exception.  This behavior was lost by the 2/2010 patch.

Signed-off-by: James Yang <James.Yang@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
11 years agopowerpc: export debug registers save function for KVM
Bharat Bhushan [Thu, 4 Jul 2013 06:57:44 +0000 (12:27 +0530)]
powerpc: export debug registers save function for KVM

KVM need this function when switching from vcpu to user-space
thread. My subsequent patch will use this function.

Signed-off-by: Bharat Bhushan <bharat.bhushan@freescale.com>
Acked-by: Michael Neuling <mikey@neuling.org>
Signed-off-by: Scott Wood <scottwood@freescale.com>
11 years agopowerpc: move debug registers in a structure
Bharat Bhushan [Thu, 4 Jul 2013 06:15:46 +0000 (11:45 +0530)]
powerpc: move debug registers in a structure

This way we can use same data type struct with KVM and
also help in using other debug related function.

Signed-off-by: Bharat Bhushan <bharat.bhushan@freescale.com>
Acked-by: Michael Neuling <mikey@neuling.org>
[scottwood@freescale.com: removed obvious debug_reg comment]
Signed-off-by: Scott Wood <scottwood@freescale.com>
11 years agopowerpc: remove unnecessary line continuations
Bharat Bhushan [Thu, 4 Jul 2013 06:15:45 +0000 (11:45 +0530)]
powerpc: remove unnecessary line continuations

Signed-off-by: Bharat Bhushan <bharat.bhushan@freescale.com>
Acked-by: Michael Neuling <mikey@neuling.org>
Signed-off-by: Scott Wood <scottwood@freescale.com>
11 years agopowerpc/kgdb: use DEFINE_PER_CPU to allocate kgdb's thread_info
Tiejun Chen [Thu, 20 Jun 2013 10:28:29 +0000 (18:28 +0800)]
powerpc/kgdb: use DEFINE_PER_CPU to allocate kgdb's thread_info

Use DEFINE_PER_CPU to allocate thread_info statically instead of kmalloc().
This can avoid introducing more memory check codes.

Signed-off-by: Tiejun Chen <tiejun.chen@windriver.com>
[scottwood@freescale.com: wrapped long line]
Signed-off-by: Scott Wood <scottwood@freescale.com>
11 years agopowerpc: Emulate sync instruction variants
James Yang [Wed, 3 Jul 2013 21:26:47 +0000 (16:26 -0500)]
powerpc: Emulate sync instruction variants

Reserved fields of the sync instruction have been used for other
instructions (e.g. lwsync).  On processors that do not support variants
of the sync instruction, emulate it by executing a sync to subsume the
effect of the intended instruction.

Signed-off-by: James Yang <James.Yang@freescale.com>
[scottwood@freescale.com: whitespace and subject line fix]
Signed-off-by: Scott Wood <scottwood@freescale.com>
11 years agopowerpc/fsl-booke: Use common defines for SPE/FP interrupts numbers
Mihai Caraman [Mon, 1 Jul 2013 15:35:31 +0000 (18:35 +0300)]
powerpc/fsl-booke: Use common defines for SPE/FP interrupts numbers

On Book3E some SPE/FP/AltiVec interrupts share the same number. Use
common defines to indentify these numbers.

Signed-off-by: Mihai Caraman <mihai.caraman@freescale.com>
[scottwood@freescale.com: fixed space-before-tab]
Signed-off-by: Scott Wood <scottwood@freescale.com>
11 years agopowerpc/booke64: Use common defines for AltiVec interrupts numbers
Mihai Caraman [Mon, 1 Jul 2013 15:35:30 +0000 (18:35 +0300)]
powerpc/booke64: Use common defines for AltiVec interrupts numbers

On Book3E some SPE/FP/AltiVec interrupts share the same number. Use
common defines to indentify these numbers.

Signed-off-by: Mihai Caraman <mihai.caraman@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
11 years agopowerpc: remove dependency on MV64360
Paul Bolle [Wed, 15 May 2013 09:21:01 +0000 (11:21 +0200)]
powerpc: remove dependency on MV64360

The Kconfig entry that allows to "Distribute interrupts on all CPUs by
default" has a (negative) dependency on MV64360. But that Kconfig symbol
was removed in v2.6.27, which means that this dependency has evaluated
to true ever since. It can be removed too.

Signed-off-by: Paul Bolle <pebolle@tiscali.nl>
Signed-off-by: Scott Wood <scottwood@freescale.com>
11 years agoMerge branch 'for-kvm' into next
Benjamin Herrenschmidt [Fri, 11 Oct 2013 07:23:53 +0000 (18:23 +1100)]
Merge branch 'for-kvm' into next

Topic branch for commits that the KVM tree might want to pull
in separately.

Hand merged a few files due to conflicts with the LE stuff

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
11 years agopowerpc: Provide for giveup_fpu/altivec to save state in alternate location
Paul Mackerras [Tue, 10 Sep 2013 10:21:10 +0000 (20:21 +1000)]
powerpc: Provide for giveup_fpu/altivec to save state in alternate location

This provides a facility which is intended for use by KVM, where the
contents of the FP/VSX and VMX (Altivec) registers can be saved away
to somewhere other than the thread_struct when kernel code wants to
use floating point or VMX instructions.  This is done by providing a
pointer in the thread_struct to indicate where the state should be
saved to.  The giveup_fpu() and giveup_altivec() functions test these
pointers and save state to the indicated location if they are non-NULL.
Note that the MSR_FP/VEC bits in task->thread.regs->msr are still used
to indicate whether the CPU register state is live, even when an
alternate save location is being used.

This also provides load_fp_state() and load_vr_state() functions, which
load up FP/VSX and VMX state from memory into the CPU registers, and
corresponding store_fp_state() and store_vr_state() functions, which
store FP/VSX and VMX state into memory from the CPU registers.

Signed-off-by: Paul Mackerras <paulus@samba.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
11 years agopowerpc: Put FP/VSX and VR state into structures
Paul Mackerras [Tue, 10 Sep 2013 10:20:42 +0000 (20:20 +1000)]
powerpc: Put FP/VSX and VR state into structures

This creates new 'thread_fp_state' and 'thread_vr_state' structures
to store FP/VSX state (including FPSCR) and Altivec/VSX state
(including VSCR), and uses them in the thread_struct.  In the
thread_fp_state, the FPRs and VSRs are represented as u64 rather
than double, since we rarely perform floating-point computations
on the values, and this will enable the structures to be used
in KVM code as well.  Similarly FPSCR is now a u64 rather than
a structure of two 32-bit values.

This takes the offsets out of the macros such as SAVE_32FPRS,
REST_32FPRS, etc.  This enables the same macros to be used for normal
and transactional state, enabling us to delete the transactional
versions of the macros.   This also removes the unused do_load_up_fpu
and do_load_up_altivec, which were in fact buggy since they didn't
create large enough stack frames to account for the fact that
load_up_fpu and load_up_altivec are not designed to be called from C
and assume that their caller's stack frame is an interrupt frame.

Signed-off-by: Paul Mackerras <paulus@samba.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
11 years agopowerpc: add real mode support for dma operations on powernv
Alexey Kardashevskiy [Wed, 28 Aug 2013 08:37:43 +0000 (18:37 +1000)]
powerpc: add real mode support for dma operations on powernv

The existing TCE machine calls (tce_build and tce_free) only support
virtual mode as they call __raw_writeq for TCE invalidation what
fails in real mode.

This introduces tce_build_rm and tce_free_rm real mode versions
which do mostly the same but use "Store Doubleword Caching Inhibited
Indexed" instruction for TCE invalidation.

This new feature is going to be utilized by real mode support of VFIO.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
11 years agopowerpc: Prepare to support kernel handling of IOMMU map/unmap
Alexey Kardashevskiy [Wed, 28 Aug 2013 08:37:42 +0000 (18:37 +1000)]
powerpc: Prepare to support kernel handling of IOMMU map/unmap

The current VFIO-on-POWER implementation supports only user mode
driven mapping, i.e. QEMU is sending requests to map/unmap pages.
However this approach is really slow, so we want to move that to KVM.
Since H_PUT_TCE can be extremely performance sensitive (especially with
network adapters where each packet needs to be mapped/unmapped) we chose
to implement that as a "fast" hypercall directly in "real
mode" (processor still in the guest context but MMU off).

To be able to do that, we need to provide some facilities to
access the struct page count within that real mode environment as things
like the sparsemem vmemmap mappings aren't accessible.

This adds an API function realmode_pfn_to_page() to get page struct when
MMU is off.

This adds to MM a new function put_page_unless_one() which drops a page
if counter is bigger than 1. It is going to be used when MMU is off
(for example, real mode on PPC64) and we want to make sure that page
release will not happen in real mode as it may crash the kernel in
a horrible way.

CONFIG_SPARSEMEM_VMEMMAP and CONFIG_FLATMEM are supported.

Cc: linux-mm@kvack.org
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: Paul Mackerras <paulus@samba.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
11 years agohashtable: add hash_for_each_possible_rcu_notrace()
Alexey Kardashevskiy [Wed, 28 Aug 2013 08:37:39 +0000 (18:37 +1000)]
hashtable: add hash_for_each_possible_rcu_notrace()

This adds hash_for_each_possible_rcu_notrace() which is basically
a notrace clone of hash_for_each_possible_rcu() which cannot be
used in real mode due to its tracing/debugging capability.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
11 years agopowerpc/eeh: Reorder output messages
Gavin Shan [Fri, 6 Sep 2013 01:00:05 +0000 (09:00 +0800)]
powerpc/eeh: Reorder output messages

We already had some output messages from EEH core. Occasionally,
we can see the output messages from EEH core before the stack
dump. That's not what we expected. The patch fixes that and shows
the stack dump prior to output messages from EEH core.

Signed-off-by: Gavin Shan <shangw@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
11 years agopowerpc/eeh: Output PHB3 diag-data
Gavin Shan [Fri, 6 Sep 2013 01:00:04 +0000 (09:00 +0800)]
powerpc/eeh: Output PHB3 diag-data

The patch adds function ioda_eeh_phb3_phb_diag() to dump PHB3
PHB diag-data. That's called while detecting informative errors
or frozen PE on the specific PHB.

Signed-off-by: Gavin Shan <shangw@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
11 years agopowerpc/powernv: Double size of log blob
Gavin Shan [Fri, 6 Sep 2013 01:00:03 +0000 (09:00 +0800)]
powerpc/powernv: Double size of log blob

Each PHB instance (struct pnv_phb) has its corresponding log blob,
which is used to hold the retrieved error log from firmware. The
current size of that (4096) isn't enough for PHB3 case and the patch
makes that double to 8192.

Signed-off-by: Gavin Shan <shangw@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
11 years agopowerpc/eeh: Output error number
Gavin Shan [Fri, 6 Sep 2013 01:00:02 +0000 (09:00 +0800)]
powerpc/eeh: Output error number

The patch prints the error number while failing to retrieve error
log from firmware. It's helpful for debugging.

Signed-off-by: Gavin Shan <shangw@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
11 years agopowerpc/powernv: Support inbound error injection
Gavin Shan [Fri, 6 Sep 2013 01:00:01 +0000 (09:00 +0800)]
powerpc/powernv: Support inbound error injection

For now, we only support outbound error injection. Actually, the
hardware supports injecting inbound errors as well. The patch enables
to inject inbound errors.

Signed-off-by: Gavin Shan <shangw@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
11 years agopowerpc/powernv: Enable EEH for PHB3
Gavin Shan [Fri, 6 Sep 2013 01:00:00 +0000 (09:00 +0800)]
powerpc/powernv: Enable EEH for PHB3

The EEH isn't enabled for PHB3 and the patch intends to enable it.

Signed-off-by: Gavin Shan <shangw@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
11 years agopowerpc/scom: Use "devspec" rather than "path" in debugfs entries
Benjamin Herrenschmidt [Thu, 29 Aug 2013 07:25:35 +0000 (17:25 +1000)]
powerpc/scom: Use "devspec" rather than "path" in debugfs entries

This is the traditional name for device-tree path, used in sysfs,
do the same for the XSCOM debugfs files.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
11 years agopowerpc/scom: CONFIG_SCOM_DEBUGFS should depend on CONFIG_DEBUG_FS
Benjamin Herrenschmidt [Thu, 29 Aug 2013 06:58:12 +0000 (16:58 +1000)]
powerpc/scom: CONFIG_SCOM_DEBUGFS should depend on CONFIG_DEBUG_FS

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
11 years agopowerpc/powernv: Add scom support under OPALv3
Benjamin Herrenschmidt [Thu, 29 Aug 2013 06:57:33 +0000 (16:57 +1000)]
powerpc/powernv: Add scom support under OPALv3

OPAL v3 provides interfaces to access the chips XSCOM, expose
this via the existing scom infrastructure.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
11 years agopowerpc/scom: Create debugfs files using ibm,chip-id if available
Benjamin Herrenschmidt [Thu, 29 Aug 2013 06:56:59 +0000 (16:56 +1000)]
powerpc/scom: Create debugfs files using ibm,chip-id if available

When creating the debugfs scom files, use "ibm,chip-id" as the scom%d
index rather than a simple made up number when possible.

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