profile/ivi/kernel-adaptation-intel-automotive.git
13 years agopowerpc/83xx: Add shutdown request support to MCU handling on MPC8349 MITX
Fabio Baltieri [Mon, 15 Aug 2011 14:19:30 +0000 (16:19 +0200)]
powerpc/83xx: Add shutdown request support to MCU handling on MPC8349 MITX

This patch add support for calling ctrl_alt_del() when the power button is
pressed for more than about 2 seconds on some freescale MPC83xx evaluation
boards and reference design.

The code uses a kthread to poll the CTRL_BTN bit each second.

Also change Kconfig entry of the driver to bool, as device's gpio
registration is broken when loading as module.

Tested on an MPC8315E RDB board.

Signed-off-by: Fabio Baltieri <fabio.baltieri@gmail.com>
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
13 years agopowerpc/85xx: Make kexec to interate over online cpus
Matthew McClintock [Tue, 25 Oct 2011 22:54:04 +0000 (17:54 -0500)]
powerpc/85xx: Make kexec to interate over online cpus

This is not strictly required, because this iterates over logical
cpus and they are not (currently) discontigous. But, it's cleaner
code and more obvious what is going on

Signed-off-by: Matthew McClintock <msm@freescale.com>
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
13 years agopowerpc/fsl_booke: Fix comment in head_fsl_booke.S
Matthew McClintock [Tue, 25 Oct 2011 22:54:03 +0000 (17:54 -0500)]
powerpc/fsl_booke: Fix comment in head_fsl_booke.S

Fix typo in comments introduced by:

commit 6dece0eb69b2a28e18d104bc5d707f1cb673f5e0
Author: Scott Wood <scottwood@freescale.com>
Date:   Mon Jul 25 11:29:33 2011 +0000

    powerpc/32: Pass device tree address as u64 to machine_init

Signed-off-by: Matthew McClintock <msm@freescale.com>
cc: Scott Wood <scottwood@freescale.com>
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
13 years agopowerpc/85xx: issue 15 EOI after core reset for FSL CoreNet devices
Matthew McClintock [Wed, 26 Oct 2011 18:46:57 +0000 (13:46 -0500)]
powerpc/85xx: issue 15 EOI after core reset for FSL CoreNet devices

This is listed as a requirement for Freescale CoreNet based devices  (e.g
p4080ds with MPIC v4.x) after issuing a core reset to properly clear pending
interrupts.

Signed-off-by: Matthew McClintock <msm@freescale.com>
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
13 years agopowerpc/8xxx: Fix interrupt handling in MPC8xxx GPIO driver
Felix Radensky [Tue, 11 Oct 2011 08:24:21 +0000 (10:24 +0200)]
powerpc/8xxx: Fix interrupt handling in MPC8xxx GPIO driver

Interrupt handler in MPC8xxx GPIO driver is missing the call to PIC EOI
(end of interrupt) handler. As a result, at least on 85XX systems, GPIO
interrupt is delivered only once. This patch adds the missing EOI call.
Tested on custom P1022 board.

Signed-off-by: Felix Radensky <felix@embedded-sol.com>
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
13 years agopowerpc/85xx: Add 'fsl,pq3-gpio' compatiable for GPIO driver
Kumar Gala [Sat, 22 Oct 2011 21:20:42 +0000 (16:20 -0500)]
powerpc/85xx: Add 'fsl,pq3-gpio' compatiable for GPIO driver

Support MPC85xx platforms outside of MPC8572/MPC8536.  The
MPC8572/MPC8536 have an erratum that is worked around based on having
"fsl,mpc8572-gpio" in the compatiable list.  All other MPC85xx SoCs
don't require this workaround and thus utilize the 'fsl,pq3-gpio'
compatiable.

Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
13 years agopowerpc/86xx: Correct Gianfar support for GE boards
Martyn Welch [Thu, 3 Nov 2011 17:37:47 +0000 (17:37 +0000)]
powerpc/86xx: Correct Gianfar support for GE boards

The GE DTBs were not updated when the Gianfar driver was converted to an
of_platform_driver in commit b31a1d8b41513b96e9c7ec2f68c5734cef0b26a4. Update
the DTBs, adding the required TBI entries.

Signed-off-by: Martyn Welch <martyn.welch@ge.com>
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
13 years agopowerpc/cpm: Clear muram before it is in use.
Hongjun Chen [Fri, 26 Mar 2010 08:43:46 +0000 (16:43 +0800)]
powerpc/cpm: Clear muram before it is in use.

We need to ensure that MURAM is in a known and cleared out state before
using it as the bootloader could have utilized it from its own purposes
and left it in an unknown state.

If we don't clear it out we've seen issues with UCC ethernet:
* Multi ethernet interfaces can't work simultanously.
* Multi up/down Ethernet interfaces will halt these ports.
* UCC1 RGMII can't work when kernel boots from some hosts.

Signed-off-by: Kai.Jiang <Kai.Jiang@freescale.com>
Signed-off-by: Hongjun Chen <Hong-jun.Chen@freescale.com>
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
13 years agodrivers/virt: add ioctl for 32-bit compat on 64-bit to fsl-hv-manager
Mihai Caraman [Thu, 13 Oct 2011 15:05:21 +0000 (18:05 +0300)]
drivers/virt: add ioctl for 32-bit compat on 64-bit to fsl-hv-manager

Add ioctl to Freescale hypervisor management driver for 32-bit user-space
applications running on 64-bit guests.

Signed-off-by: Mihai Caraman <mihai.caraman@freescale.com>
Acked-by: Timur Tabi <timur@freescale.com>
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
13 years agopowerpc/fsl_msi: add support for "msi-address-64" property
Timur Tabi [Fri, 23 Sep 2011 17:41:35 +0000 (12:41 -0500)]
powerpc/fsl_msi: add support for "msi-address-64" property

Add support for the msi-address-64 property of a PCI node.  This property
specifies the PCI address of MSIIR (message signaled interrupt index
register).

In commit 3da34aae ("powerpc/fsl: Support unique MSI addresses per PCIe Root
Complex"), the msi_addr_hi/msi_addr_lo fields of struct fsl_msi were redefined
from an actual address to just an offset, but the fields were not renamed
accordingly.  These fields are replace with a single field, msiir_offset,
to reflect the new meaning.

Signed-off-by: Timur Tabi <timur@freescale.com>
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
13 years agopowerpc/85xx: Setup secondary cores PIR with hard SMP id
Kumar Gala [Thu, 13 Oct 2011 15:13:09 +0000 (10:13 -0500)]
powerpc/85xx: Setup secondary cores PIR with hard SMP id

Normally logical and hard cpu ID are the same, however in same cases like
on the P3060 they may differ.  Where the logical is 0..5, the hard id
goes 0,1,4..7.  This can causes issues for places we utilize PIR to index
into array like in debug exception handlers for finding the exception
stack.

Move to setting up PIR with hard_smp_processor_id fixes the issue.

Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
13 years agopowerpc/fsl-booke: Fix settlbcam for 64-bit
Becky Bruce [Wed, 12 Oct 2011 21:17:02 +0000 (16:17 -0500)]
powerpc/fsl-booke: Fix settlbcam for 64-bit

Currently, it does a cntlzd on the size and then subtracts it from
21.... this doesn't take into account the varying size of a "long".
Just use __ilog instead (and subtract the 10 we have to subtract
to get to the tsize encoding).

Also correct the comment about page sizes supported.

Signed-off-by: Becky Bruce <beckyb@kernel.crashing.org>
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
13 years agopowerpc/85xx: Adding DCSR node to dtsi device trees
Stephen George [Fri, 16 Sep 2011 15:36:34 +0000 (10:36 -0500)]
powerpc/85xx: Adding DCSR node to dtsi device trees

Adding new device tree binding file for the DCSR node.  Modifying device
tree dtsi files to add DCSR node for P2041, P3041, P4080, & P5020.

Signed-off-by: Stephen George <stephen.george@freescale.com>
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
13 years agopowerpc/85xx: clean up FPGA device tree nodes for Freecsale QorIQ boards
Timur Tabi [Thu, 15 Sep 2011 18:04:13 +0000 (13:04 -0500)]
powerpc/85xx: clean up FPGA device tree nodes for Freecsale QorIQ boards

Standarize and document the FPGA nodes used on Freescale QorIQ reference
boards.  There are different kinds of FPGAs used on the boards, but
only two are currently standard: "pixis", "ngpixis", and "qixis".  Although
there are minor differences among the boards that have one kind of FPGA, most
of the functionality is the same, so it makes sense to create common
compatibility strings.

We also need to update the P1022DS platform file, because the compatible
string for its PIXIS node has changed.  This means that older kernels are
not compatible with newer device trees.  This is not a real problem, however,
since that particular function doesn't work anyway.  When the DIU is active,
the PIXIS is in "indirect mode", and so cannot be accessed as a memory-mapped
device.

Signed-off-by: Timur Tabi <timur@freescale.com>
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
13 years agopowerpc/85xx: fix PHYS_64BIT selection for P1022DS
Anatolij Gustschin [Fri, 23 Sep 2011 19:32:50 +0000 (21:32 +0200)]
powerpc/85xx: fix PHYS_64BIT selection for P1022DS

Remove wrong CONFIG_ prefix in Kconfig file.

Signed-off-by: Anatolij Gustschin <agust@denx.de>
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
13 years agopowerpc/fsl-booke: Fix setup_initial_memory_limit to not blindly map
Kumar Gala [Fri, 16 Sep 2011 15:39:59 +0000 (10:39 -0500)]
powerpc/fsl-booke: Fix setup_initial_memory_limit to not blindly map

On FSL Book-E devices we support multiple large TLB sizes and so we can
get into situations in which the initial 1G TLB size is too big and
we're asked for a size that is not mappable by a single entry (like
512M).  The single entry is important because when we bring up secondary
cores they need to ensure any data structure they need to access (eg
PACA or stack) is always mapped.

So we really need to determine what size will actually be mapped by the
first TLB entry to ensure we limit early memory references to that
region.  We refactor the map_mem_in_cams() code to provider a helper
function that we can utilize to determine the size of the first TLB
entry while taking into account size and alignment constraints.

Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
13 years agopowerpc: respect mem= setting for early memory limit setup
Kumar Gala [Fri, 16 Sep 2011 15:39:58 +0000 (10:39 -0500)]
powerpc: respect mem= setting for early memory limit setup

For those MMUs that have some form of bolt'd linear mapping (TLB)
required its rare that one ever sets mem= smaller than the size of that
mapping.

However, on Book-E 64 parts the initial linear mapping is quite large
(1G) so its quite reasonable that mem= is set smaller than that.

We need to parse the command line for mem= limit and constrain the
amount of memory we map initially by it if need be.

Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
13 years agopowerpc: Update corenet64_smp_defconfig
Becky Bruce [Mon, 10 Oct 2011 20:50:47 +0000 (15:50 -0500)]
powerpc: Update corenet64_smp_defconfig

Updates from make savedefconfig.

Signed-off-by: Becky Bruce <beckyb@kernel.crashing.org>
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
13 years agopowerpc: Update mpc85xx/corenet 32-bit defconfigs
Becky Bruce [Mon, 10 Oct 2011 20:50:45 +0000 (15:50 -0500)]
powerpc: Update mpc85xx/corenet 32-bit defconfigs

Results from updates via make savedefconfig.

Signed-off-by: Becky Bruce <beckyb@kernel.crashing.org>
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
13 years agopowerpc/85xx: Fix support for enabling doorbells for IPIs
Matthew McClintock [Wed, 12 Oct 2011 00:06:42 +0000 (19:06 -0500)]
powerpc/85xx: Fix support for enabling doorbells for IPIs

Commit 765342526246c97600e5344c0949824d94bb51c3 made some small changes to
IPI, message_pass in smp_ops was initialized to NULL for other platforms
but not for 85xx which causes us to always use the mpic for IPI's even
if we support doorbells in HW.

Signed-off-by: Matthew McClintock <msm@freescale.com>
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
13 years agopowerpc: e500mc: Fix: use CONFIG_PPC_E500MC in idle_e500.S
Bharat Bhushan [Tue, 11 Oct 2011 05:56:08 +0000 (11:26 +0530)]
powerpc: e500mc: Fix: use CONFIG_PPC_E500MC in idle_e500.S

It is wrongly using undefined CONFIG_E500MC.

Signed-off-by: Bharat Bhushan <bharat.bhushan@freescale.com>
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
13 years agopowerpc/fsl_msi: fix support for multiple MSI ranges
Timur Tabi [Tue, 13 Sep 2011 21:17:00 +0000 (16:17 -0500)]
powerpc/fsl_msi: fix support for multiple MSI ranges

Commit 6820fead ("powerpc/fsl_msi: Handle msi-available-ranges better") added
support for multiple ranges in the msi-available-ranges property, but it
miscalculated the MSIR index when multiple ranges are used.

Signed-off-by: Timur Tabi <timur@freescale.com>
Acked-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
13 years agopowerpc/82xx: updates for mgcoge
Holger Brunck [Tue, 27 Sep 2011 07:44:50 +0000 (09:44 +0200)]
powerpc/82xx: updates for mgcoge

Add:
 - Setup dts node for USB
 - pin description and setup for SMC1 (serial interface)

Update and cleanup mgcoge_defconfig:
- enable: TIPC, UBIFS, USB_GADGET driver, SQUASHFS, HIGHRES timers
          POSIX_MQUEUE, EMBEDDED
- disable: EXT3, PPC_PMAC

Signed-off-by: Holger Brunck <holger.brunck@keymile.com>
Acked-by: Heiko Schocher <hs@denx.de>
cc: Kumar Gala <galak@kernel.crashing.org>
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
13 years agopowerpc/fsl-booke: Handle L1 D-cache parity error correctly on e500mc
Kumar Gala [Sat, 27 Aug 2011 11:14:23 +0000 (06:14 -0500)]
powerpc/fsl-booke: Handle L1 D-cache parity error correctly on e500mc

If the L1 D-Cache is in write shadow mode the HW will auto-recover the
error.  However we might still log the error and cause a machine check
(if L1CSR0[CPE] - Cache error checking enable).  We should only treat
the non-write shadow case as non-recoverable.

Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
13 years agopowerpc/math_emu/efp: Look for errata handler when type mismatches
Liu Yu [Mon, 5 Sep 2011 09:01:23 +0000 (17:01 +0800)]
powerpc/math_emu/efp: Look for errata handler when type mismatches

We already have cpu a005 errata handler when instruction cannot be
recognized.  Before we lookup the inst, there's type checking, and we also
need to handle it in errata handler when the type checking failed.

Signed-off-by: Liu Yu <yu.liu@freescale.com>
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
13 years agopowerpc/math_emu/efp: No need to round if the result is exact
Liu Yu [Mon, 5 Sep 2011 09:01:22 +0000 (17:01 +0800)]
powerpc/math_emu/efp: No need to round if the result is exact

Signed-off-by: Liu Yu <yu.liu@freescale.com>
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
13 years agopowerpc/math_emu/efp: Use pr_debug instead of printk
Liu Yu [Mon, 5 Sep 2011 09:01:21 +0000 (17:01 +0800)]
powerpc/math_emu/efp: Use pr_debug instead of printk

Signed-off-by: Liu Yu <yu.liu@freescale.com>
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
13 years agopowerpc/85xx: Rename p2040_rdb.c to p2041_rdb.c
Mingkai Hu [Fri, 26 Aug 2011 10:45:03 +0000 (18:45 +0800)]
powerpc/85xx: Rename p2040_rdb.c to p2041_rdb.c

There's only p2041rdb board for official release, but the p2041 silicon
on the board can be converted to p2040 silicon without XAUI and L2 cache
function, then the board becomes p2040rdb board. so we use the file name
p2041_rdb.c to handle P2040RDB board and P2041RDB board which is also
consistent with the board name under U-Boot.

During the rename we make few other minor changes to the device tree:
* Move USB phy setting into p2041si.dtsi as its SoC not board defined
* Convert PCI clock-frequency to decimal to be more readable

Signed-off-by: Mingkai Hu <Mingkai.hu@freescale.com>
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
13 years agopowerpc/85xx: Rename PowerPC core nodes to match other e500mc based .dts
Kumar Gala [Wed, 31 Aug 2011 03:27:59 +0000 (22:27 -0500)]
powerpc/85xx: Rename PowerPC core nodes to match other e500mc based .dts

The P4080 silicon device tree was using PowerPC,4080 while the other
e500mc based SoCs used PowerPC,e500mc.  Use the core name to be
consistent going forward.

Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
13 years agopowerpc/mpc8349emitx: mark localbus as compatible with simple-bus
Dmitry Eremin-Solenikov [Tue, 19 Jul 2011 08:53:40 +0000 (12:53 +0400)]
powerpc/mpc8349emitx: mark localbus as compatible with simple-bus

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
13 years agopowerpc/85xx: sbc8560 - declare that localbus is compatbile with simple-bus
Dmitry Eremin-Solenikov [Tue, 19 Jul 2011 08:53:45 +0000 (12:53 +0400)]
powerpc/85xx: sbc8560 - declare that localbus is compatbile with simple-bus

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
13 years agopowerpc/85xx: ksi8560 - declare that localbus is compatbile with simple-bus
Dmitry Eremin-Solenikov [Tue, 19 Jul 2011 08:53:44 +0000 (12:53 +0400)]
powerpc/85xx: ksi8560 - declare that localbus is compatbile with simple-bus

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
13 years agopowerpc/85xx: sbc8560 - correct compilation if CONFIG_PHYS_ADDR_T_64BIT is set
Dmitry Eremin-Solenikov [Tue, 19 Jul 2011 08:53:43 +0000 (12:53 +0400)]
powerpc/85xx: sbc8560 - correct compilation if CONFIG_PHYS_ADDR_T_64BIT is set

If CONFIG_PHYS_ADDR_T_64BIT is set, compilation of sbc8560 fails with
the following error:

arch/powerpc/platforms/85xx/sbc8560.c: In function â€˜sbc8560_bdrstcr_init’:
arch/powerpc/platforms/85xx/sbc8560.c:286: error: format â€˜%x’ expects type â€˜unsigned int’, but argument 2 has type â€˜resource_size_t’

Fix that by using %pR format instead of just printing the start of
resource.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
13 years agopowerpc: Don't try OPAL takeover on old 970 blades
Benjamin Herrenschmidt [Wed, 28 Sep 2011 20:51:46 +0000 (20:51 +0000)]
powerpc: Don't try OPAL takeover on old 970 blades

The firmware on old 970 blades supports some kind of takeover called
"TNK takeover" which will crash if we try to probe for OPAL takeover,
so don't do it.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
13 years agopowerpc/perf_event: Fix Power6 L1 cache read & write event codes]
Carl E. Love [Wed, 28 Sep 2011 11:23:33 +0000 (11:23 +0000)]
powerpc/perf_event: Fix Power6 L1 cache read & write event codes]

The current L1 cache read event code 0x80082 only counts for thread 0. The
event code 0x280030 should be used to count events on thread 0 and 1. The
patch fixes the event code for the L1 cache read.

The current L1 cache write event code 0x80086 only counts for thread 0. The
event code 0x180032 should be used to count events on thread 0 and 1. The
patch fixes the event code for the L1 cache write.

FYI, the documentation lists three event codes for the L1 cache read event
and three event codes for the L1 cache write event.  The event description
for the event codes is as follows:

L1 cache read requests  0x80082  LSU 0 only
L1 cache read requests  0x8008A  LSU 1 only
L1 cache read requests  0x80030  LSU 1 or LSU 0, counter 2 only.

L1 cache store requests 0x80086  LSU 0 only
L1 cache store requests 0x8008E  LSU 1 only
L1 cache store requests 0x80032  LSU 0 or LSU 1, counter 1 only.

There can only be one request from either LSU 0 or 1 active at a time.

Signed-off-by: Carl Love <cel@us.ibm.com>
Acked-by: Paul Mackerras <paulus@samba.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
13 years agopowerpc/ptrace: Fix build with gcc 4.6
Benjamin Herrenschmidt [Mon, 26 Sep 2011 19:37:57 +0000 (19:37 +0000)]
powerpc/ptrace: Fix build with gcc 4.6

gcc (rightfully) complains that we are accessing beyond the
end of the fpr array (we do, to access the fpscr).

The only sane thing to do (whether anything in that code can be
called remotely sane is debatable) is to special case fpscr and
handle it as a separate statement.

I initially tried to do it it by making the array access conditional
to index < PT_FPSCR and using a 3rd else leg but for some reason gcc
was unable to understand it and still spewed the warning.

So I ended up with something a tad more intricated but it seems to
build on 32-bit and on 64-bit with and without VSX.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
13 years agopowerpc: Fix xmon for systems without MSR[RI]
Jimi Xenidis [Fri, 23 Sep 2011 05:40:46 +0000 (05:40 +0000)]
powerpc: Fix xmon for systems without MSR[RI]

Based on patch by David Gibson <dwg@au1.ibm.com>

xmon has a longstanding bug on systems which are SMP-capable but lack
the MSR[RI] bit.  In these cases, xmon invoked by IPI on secondary
CPUs will not properly keep quiet, but will print stuff, thereby
garbling the primary xmon's output.  This patch fixes it, by ignoring
the RI bit if the processor does not support it.

There's already a version of this for 4xx upstream, which we'll need
to extend to other RI-lacking CPUs at some point.  For now this adds
Book3e processors to the mix.

Signed-off-by: Jimi Xenidis <jimix@pobox.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
13 years agopowerpc/pci: Don't configure PCIe settings when PCI_PROBE_ONLY is set
Benjamin Herrenschmidt [Mon, 26 Sep 2011 04:22:39 +0000 (14:22 +1000)]
powerpc/pci: Don't configure PCIe settings when PCI_PROBE_ONLY is set

We don't want to configure PCI Express Max Payload Size or
Max Read Request Size on systems that set that flag. The
firmware will have done it for us, and under hypervisors such
as pHyp we don't even see the parent switches and bridges and
thus can make no assumption on what values are safe to use.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
13 years agopowerpc: Reserve iommu page 0
Thadeu Lima de Souza Cascardo [Tue, 20 Sep 2011 03:07:24 +0000 (03:07 +0000)]
powerpc: Reserve iommu page 0

Some devices have a dma-window that starts at the address 0. This allows
DMA addresses to be mapped to this address and returned to drivers as a
valid DMA address. Some drivers may not behave well in this case, since
the address 0 is considered an error or not allocated.

The solution to avoid this kind of error from happening is reserve the
page addressed as 0 so it cannot be allocated for a DMA mapping.

Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
13 years agopowerpc: Fix hugetlb with CONFIG_PPC_MM_SLICES=y
Paul Mackerras [Tue, 20 Sep 2011 19:58:10 +0000 (19:58 +0000)]
powerpc: Fix hugetlb with CONFIG_PPC_MM_SLICES=y

Commit 41151e77a4 ("powerpc: Hugetlb for BookE") added some
#ifdef CONFIG_MM_SLICES conditionals to hugetlb_get_unmapped_area()
and vma_mmu_pagesize().  Unfortunately this is not the correct config
symbol; it should be CONFIG_PPC_MM_SLICES.  The result is that
attempting to use hugetlbfs on 64-bit Power server processors results
in an infinite stack recursion between get_unmapped_area() and
hugetlb_get_unmapped_area().

This fixes it by changing the #ifdef to use CONFIG_PPC_MM_SLICES
in those functions and also in book3e_hugetlb_preload().

Signed-off-by: Paul Mackerras <paulus@samba.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
13 years agopowerpc: update 512x-defconfig
Wolfram Sang [Wed, 21 Sep 2011 10:49:21 +0000 (12:49 +0200)]
powerpc: update 512x-defconfig

Activate all MPC512x related boards. Also enable GPIO-driver, SPI driver
and at25 to test SPI. Enable DEVTMPFS. Bump to 3.1-rc6.

Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Anatolij Gustschin <agust@denx.de>
13 years agogpio: move mpc8xxx/512x gpio driver to drivers/gpio
Wolfram Sang [Wed, 21 Sep 2011 10:49:20 +0000 (12:49 +0200)]
gpio: move mpc8xxx/512x gpio driver to drivers/gpio

Move the driver to the place where it is expected to be nowadays. Also
rename its CONFIG-name to match the rest and adapt the defconfigs.
Finally, move selection of REQUIRE_GPIOLIB or WANTS_OPTIONAL_GPIOLIB to
the platforms, because this option is per-platform and not per-driver.

Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Grant Likely <grant.likely@secretlab.ca>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Acked-by: Grant Likely <grant.likely@secretlab.ca>
Signed-off-by: Anatolij Gustschin <agust@denx.de>
13 years agopowerpc/5200: enable audio in the defconfig
Timur Tabi [Thu, 1 Sep 2011 22:31:22 +0000 (17:31 -0500)]
powerpc/5200: enable audio in the defconfig

Audio support for the MPC5200 exists, so enable it by default.

Signed-off-by: Timur Tabi <timur@freescale.com>
Acked-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: Anatolij Gustschin <agust@denx.de>
13 years agopowerpc/5200: dts: digsy_mtc.dts: enable both MSCAN nodes
Anatolij Gustschin [Thu, 7 Jul 2011 12:49:50 +0000 (14:49 +0200)]
powerpc/5200: dts: digsy_mtc.dts: enable both MSCAN nodes

We use both MSCAN controllers on this board, so do not disable
them in the device tree.

Signed-off-by: Anatolij Gustschin <agust@denx.de>
13 years agopowerpc/5200: dts: digsy_mtc.dts: add timer0 and timer1 gpio properties
Anatolij Gustschin [Mon, 6 Jun 2011 22:27:05 +0000 (00:27 +0200)]
powerpc/5200: dts: digsy_mtc.dts: add timer0 and timer1 gpio properties

timer0 and timer1 pins are used as simple GPIO on this board.
Add gpio-controller and #gpio-cells properties to timer nodes
so that we can control gpio lines using available MPC52xx
GPT driver.

Signed-off-by: Anatolij Gustschin <agust@denx.de>
13 years agopowerpc/5200: dts: digsy_mtc.dts: update to add can, pci, serial and spi
Anatolij Gustschin [Mon, 16 May 2011 16:02:44 +0000 (18:02 +0200)]
powerpc/5200: dts: digsy_mtc.dts: update to add can, pci, serial and spi

Add new nodes to describe more hardware the board is
equipped with:
 - two can nodes for SJA1000 on localbus
 - pci node to support Coral-PA graphics controller
 - serial node for SC28L92 DUART on localbus
 - spi node for MSP430 device

Also correct i2c eeprom node name.

Signed-off-by: Heiko Schocher <hs@denx.de>
Signed-off-by: Anatolij Gustschin <agust@denx.de>
13 years agopowerpc/5200: mpc5200b.dtsi: add spi node address- and size-cells properties
Anatolij Gustschin [Mon, 16 May 2011 16:02:43 +0000 (18:02 +0200)]
powerpc/5200: mpc5200b.dtsi: add spi node address- and size-cells properties

Both, #address-cells and #size-cells properties are required
for spi bus node, so add them.

Signed-off-by: Anatolij Gustschin <agust@denx.de>
13 years agoperf events, powerpc: Add POWER7 stalled-cycles-frontend/backend events
Anshuman Khandual [Thu, 8 Sep 2011 21:12:06 +0000 (21:12 +0000)]
perf events, powerpc: Add POWER7 stalled-cycles-frontend/backend events

perf events, powerpc: Add POWER7 stalled-cycles-frontend/backend events

Extent the POWER7 PMU driver with definitions for generic front-end and back-end
stall events.

As explained in Ingo's original comment(8f62242246351b5a4bc0c1f00c0c7003edea128a
), the exact definitions of the stall events are very much processor specific as

different things mean different in their respective instruction pipeline. These
two Power7 raw events are the closest approximation to the concept detailed in
Ingo's comment.

[PERF_COUNT_HW_STALLED_CYCLES_FRONTEND] = 0x100f8, /* GCT_NOSLOT_CYC */
It means cycles when the Global Completion Table has no slots from this thread

[PERF_COUNT_HW_STALLED_CYCLES_BACKEND] = 0x4000a,  /* CMPLU_STALL */
It means no groups completed and GCT not empty for this thread

Signed-off-by: Anshuman Khandual <khandual@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
13 years agopowerpc/powernv: Handle PCI-X/PCIe reset delay
Benjamin Herrenschmidt [Mon, 19 Sep 2011 17:45:07 +0000 (17:45 +0000)]
powerpc/powernv: Handle PCI-X/PCIe reset delay

The firmware doesn't wait after lifting the PCI reset. However it does
timestamp it in the device tree. We use that to ensure we wait long
enough (3s is our current arbitrary setting) from that timestamp to
actually probing the bus.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
13 years agopowerpc/powernv: Implement MSI support for p5ioc2 PCIe
Benjamin Herrenschmidt [Mon, 19 Sep 2011 17:45:06 +0000 (17:45 +0000)]
powerpc/powernv: Implement MSI support for p5ioc2 PCIe

This implements support for MSIs on p5ioc2 PHBs. We only support
MSIs on the PCIe PHBs, not the PCI-X ones as the later hasn't been
properly verified in HW.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
13 years agopowerpc/powernv: Add support for p5ioc2 PCI-X and PCIe
Benjamin Herrenschmidt [Mon, 19 Sep 2011 17:45:05 +0000 (17:45 +0000)]
powerpc/powernv: Add support for p5ioc2 PCI-X and PCIe

This adds support for PCI-X and PCIe on the p5ioc2 IO hub using
OPAL. This includes allocating & setting up TCE tables and config
space access routines.

This also supports fallbacks via RTAS when OPAL is absent, using
legacy TCE format pre-allocated via the device-tree (BML style)

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
13 years agopowerpc/powernv: Machine check and other system interrupts
Benjamin Herrenschmidt [Mon, 19 Sep 2011 17:45:04 +0000 (17:45 +0000)]
powerpc/powernv: Machine check and other system interrupts

OPAL can handle various interrupt for us such as Machine Checks (it
performs all sorts of recovery tasks and passes back control to us with
informations about the error), Hardware Management Interrupts and Softpatch
interrupts.

This wires up the mechanisms and prints out specific informations returned
by HAL when a machine check occurs.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
13 years agopowerpc/powernv: Register and handle OPAL interrupts
Benjamin Herrenschmidt [Mon, 19 Sep 2011 17:45:03 +0000 (17:45 +0000)]
powerpc/powernv: Register and handle OPAL interrupts

We do the minimum which is to "pass" interrupts to HAL, which
makes the console smoother and will allow us to implement
interrupt based completion and console.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
13 years agopowerpc/powernv: Add OPAL ICS backend
Benjamin Herrenschmidt [Mon, 19 Sep 2011 17:45:02 +0000 (17:45 +0000)]
powerpc/powernv: Add OPAL ICS backend

OPAL handles HW access to the various ICS or equivalent chips
for us (with the exception of p5ioc2 based HEA which uses a

different backend) similarily to what RTAS does on pSeries.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
13 years agopowerpc/powernv: Add RTC and NVRAM support plus RTAS fallbacks
Benjamin Herrenschmidt [Mon, 19 Sep 2011 17:45:01 +0000 (17:45 +0000)]
powerpc/powernv: Add RTC and NVRAM support plus RTAS fallbacks

Implements OPAL RTC and NVRAM support and wire all that up to
the powernv platform.

We use RTAS for RTC as a fallback if available. Using RTAS for nvram
is not supported yet, pending some rework/cleanup and generalization
of the pSeries & CHRP code. We also use RTAS fallbacks for power off
and reboot

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
13 years agopowerpc/powernv: Hookup reboot and poweroff functions
Benjamin Herrenschmidt [Mon, 19 Sep 2011 18:28:03 +0000 (18:28 +0000)]
powerpc/powernv: Hookup reboot and poweroff functions

This calls the respective HAL functions, and spin on hal_poll_event()
to ensure the HAL has a chance to communicate with the FSP to trigger
the reboot or shutdown operation

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
13 years agopowerpc/powernv: Support for OPAL console
Benjamin Herrenschmidt [Mon, 19 Sep 2011 17:44:59 +0000 (17:44 +0000)]
powerpc/powernv: Support for OPAL console

This adds a udbg and an hvc console backend for supporting a console
using the OPAL console interfaces.

On OPAL v1 we have hvc0 mapped to whatever console the system was
configured for (network or hvsi serial port) via the service
processor.

On OPAL v2 we have hvcN mapped to the Nth console provided by OPAL
which generally corresponds to:

hvc0 : network console (raw protocol)
hvc1 : serial port S1 (hvsi)
hvc2 : serial port S2 (hvsi)

Note: At this point, early debug console only works with OPAL v1
and shouldn't be enabled in a normal kernel.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
13 years agopowerpc/powernv: Add support for instanciating OPAL v2 from Open Firmware
Benjamin Herrenschmidt [Mon, 19 Sep 2011 18:28:01 +0000 (18:28 +0000)]
powerpc/powernv: Add support for instanciating OPAL v2 from Open Firmware

OPAL v2 is instantiated in a way similar to RTAS using Open Firmware
client interface calls, and the resulting address and entry point are
put in the device-tree

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
13 years agopowerpc/powernv: Basic support for OPAL
Benjamin Herrenschmidt [Mon, 19 Sep 2011 17:44:57 +0000 (17:44 +0000)]
powerpc/powernv: Basic support for OPAL

Add definition of OPAL interfaces along with  the wrappers to call
into OPAL runtime and the early device-tree parsing hook to locate
the OPAL runtime firmware.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
13 years agopowerpc/powernv: Get kernel command line accross OPAL takeover
Benjamin Herrenschmidt [Mon, 19 Sep 2011 17:44:56 +0000 (17:44 +0000)]
powerpc/powernv: Get kernel command line accross OPAL takeover

We stash it in boot_command_line which isn't in BSS and so won't
be overwritten. We then use that as a default cmd_line before
we walk the device-tree.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
13 years agopowerpc/powernv: Add OPAL takeover from PowerVM
Benjamin Herrenschmidt [Mon, 19 Sep 2011 18:27:58 +0000 (18:27 +0000)]
powerpc/powernv: Add OPAL takeover from PowerVM

On machines supporting the OPAL firmware version 1, the system
is initially booted under pHyp. We then use a special hypercall
to verify if OPAL is available and if it is, we then trigger
a "takeover" which disables pHyp and loads the OPAL runtime
firmware, giving control to the kernel in hypervisor mode.

This patch add the necessary code to detect that the OPAL takeover
capability is present when running under PowerVM (aka pHyp) and
perform said takeover to get hypervisor control of the processor.

To perform the takeover, we must first use RTAS (within Open
Firmware runtime environment) to start all processors & threads,
in order to give control to OPAL on all of them. We then call
the takeover hypercall on everybody, OPAL will re-enter the kernel
main entry point passing it a flat device-tree.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
13 years agopowerpc/powernv: Add CPU hotplug support
Benjamin Herrenschmidt [Mon, 19 Sep 2011 17:44:54 +0000 (17:44 +0000)]
powerpc/powernv: Add CPU hotplug support

Unplugged CPU go into NAP mode in a loop until woken up

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
13 years agoof: Change logic to overwrite cmd_line with CONFIG_CMDLINE
Benjamin Herrenschmidt [Mon, 19 Sep 2011 18:50:15 +0000 (18:50 +0000)]
of: Change logic to overwrite cmd_line with CONFIG_CMDLINE

We used to overwrite with CONFIG_CMDLINE if we found a chosen
node but failed to get bootargs out of it or they were empty,
unless CONFIG_CMDLINE_FORCE is set.

Instead change that to overwrite if "data" is non empty after
the bootargs check. It allows arch code to have other mechanisms
to retrieve the command line prior to parsing the device-tree.

Note: CONFIG_CMDLINE_FORCE case should ideally be handled elsewhere
as it won't work as it-is if the device-tree has no /chosen node

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
CC: devicetree-discuss@lists-ozlabs.org
CC: Grant Likely <grant.likely@secretlab.ca>
Acked-by: Grant Likely <grant.likely@secretlab.ca>
13 years agopowerpc: Add skeleton PowerNV platform
Benjamin Herrenschmidt [Mon, 19 Sep 2011 17:44:52 +0000 (17:44 +0000)]
powerpc: Add skeleton PowerNV platform

This adds a skeletton for the new Power "Non Virtualized"
platform which will be used by machines supporting running
without an hypervisor, for example in order to run KVM.

These machines will be using a new firmware called OPAL
for which the support will be provided by later patches.

The PowerNV platform is intended to be also usable under
the BML environment used internally for early CPU bringup
which is why the code also supports using RTAS instead of
OPAL in various places.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
13 years agopowerpc/powernv: Don't clobber r9 in relative_toc()
Benjamin Herrenschmidt [Mon, 19 Sep 2011 17:44:51 +0000 (17:44 +0000)]
powerpc/powernv: Don't clobber r9 in relative_toc()

With OPAL, r8 and r9 will be used to pass the OPAL base and entry
for debugging purposes (those informations are also in the
device-tree). We don't want to clobber those registers that
early.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
13 years agopowerpc/pci: Call pcie_bus_configure_settings()
Benjamin Herrenschmidt [Mon, 19 Sep 2011 17:44:50 +0000 (17:44 +0000)]
powerpc/pci: Call pcie_bus_configure_settings()

This new function is used to properly setup the PCI Express Max Payload Size
(and in some circumstances Max Read Request Size).

Some systems will not operate properly if these aren't set correctly and
the firmware doesn't always do it.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
13 years agopowerpc/smp: More generic support for "soft hotplug"
Benjamin Herrenschmidt [Mon, 19 Sep 2011 17:44:49 +0000 (17:44 +0000)]
powerpc/smp: More generic support for "soft hotplug"

This adds more generic support for doing CPU hotplug with a simple
idle loop and no actual reset of the processors. The generic
smp_generic_kick_cpu() does the hotplug bringup trick if the PACA
shows that the CPU has already been started at boot and we provide
an accessor for the CPU state.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
13 years agopowerpc/udbg: Fix Kconfig entry for avoiding 44x early debug with KVM
Benjamin Herrenschmidt [Mon, 19 Sep 2011 17:44:48 +0000 (17:44 +0000)]
powerpc/udbg: Fix Kconfig entry for avoiding 44x early debug with KVM

It was preventing the global early debug selection whenever KVM was enabled
instead of only preventing the 440 specific one.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
13 years agohvcs: Ensure page aligned partner info buffer
Brian King [Tue, 13 Sep 2011 11:22:51 +0000 (11:22 +0000)]
hvcs: Ensure page aligned partner info buffer

The Power platform requires the partner info buffer to be page aligned
otherwise it will fail the partner info hcall with H_PARAMETER. Switch
from using kmalloc to allocate this buffer to __get_free_page to ensure
page alignment.

Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
13 years agopowerpc: Fix deadlock in icswx code
Anton Blanchard [Wed, 14 Sep 2011 09:43:15 +0000 (09:43 +0000)]
powerpc: Fix deadlock in icswx code

The icswx code introduced an A-B B-A deadlock:

     CPU0                    CPU1
     ----                    ----
lock(&anon_vma->mutex);
                             lock(&mm->mmap_sem);
                             lock(&anon_vma->mutex);
lock(&mm->mmap_sem);

Instead of using the mmap_sem to keep mm_users constant, take the
page table spinlock.

Signed-off-by: Anton Blanchard <anton@samba.org>
Cc: <stable@kernel.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
13 years agopowerpc: Fix oops when echoing bad values to /sys/devices/system/memory/probe
Anton Blanchard [Wed, 10 Aug 2011 20:44:24 +0000 (20:44 +0000)]
powerpc: Fix oops when echoing bad values to /sys/devices/system/memory/probe

If we echo an address the hypervisor doesn't like to
/sys/devices/system/memory/probe we oops the box:

# echo 0x10000000000 > /sys/devices/system/memory/probe

kernel BUG at arch/powerpc/mm/hash_utils_64.c:541!

The backtrace is:

create_section_mapping
arch_add_memory
add_memory
memory_probe_store
sysdev_class_store
sysfs_write_file
vfs_write
SyS_write

In create_section_mapping we BUG if htab_bolt_mapping returned
an error. A better approach is to return an error which will
propagate back to userspace.

Rerunning the test with this patch applied:

# echo 0x10000000000 > /sys/devices/system/memory/probe
-bash: echo: write error: Invalid argument

Signed-off-by: Anton Blanchard <anton@samba.org>
Cc: stable@kernel.org
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
13 years agopowerpc: Coding style cleanups
Anton Blanchard [Wed, 10 Aug 2011 20:44:23 +0000 (20:44 +0000)]
powerpc: Coding style cleanups

While converting code to use for_each_node_by_type I noticed a
number of coding style issues.

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
13 years agopowerpc: Use for_each_node_by_type instead of open coding it
Anton Blanchard [Wed, 10 Aug 2011 20:44:22 +0000 (20:44 +0000)]
powerpc: Use for_each_node_by_type instead of open coding it

Use for_each_node_by_type instead of open coding it.

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
13 years agopowerpc/numa: Remove double of_node_put in hot_add_node_scn_to_nid
Anton Blanchard [Wed, 10 Aug 2011 20:44:21 +0000 (20:44 +0000)]
powerpc/numa: Remove double of_node_put in hot_add_node_scn_to_nid

During memory hotplug testing, I got the following warning:

ERROR: Bad of_node_put() on /memory@0

of_node_release
kref_put
of_node_put
of_find_node_by_type
hot_add_node_scn_to_nid
hot_add_scn_to_nid
memory_add_physaddr_to_nid
...

of_find_node_by_type() loop does the of_node_put for us so we only
need the handle the case where we terminate the loop early.

As suggested by Stephen Rothwell we can do the of_node_put
unconditionally outside of the loop since of_node_put handles a
NULL argument fine.

Signed-off-by: Anton Blanchard <anton@samba.org>
Cc: stable@kernel.org
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
13 years agopowerpc/numa: Remove duplicate RECLAIM_DISTANCE definition
Anton Blanchard [Sun, 24 Jul 2011 16:33:16 +0000 (16:33 +0000)]
powerpc/numa: Remove duplicate RECLAIM_DISTANCE definition

We have two identical definitions of RECLAIM_DISTANCE, looks like
the patch got applied twice. Remove one.

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
13 years agopowerpc/numa: Disable NEWIDLE balancing at node level
Anton Blanchard [Sun, 24 Jul 2011 16:33:15 +0000 (16:33 +0000)]
powerpc/numa: Disable NEWIDLE balancing at node level

On big POWER7 boxes we see large amounts of CPU time in system
processes like workqueue and watchdog kernel threads.

We currently rebalance the entire machine each time a task goes
idle and this is very expensive on large machines. Disable newidle
balancing at the node level and rely on the scheduler tick to
rebalance across nodes.

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
13 years agopowerpc/numa: Increase SD_NODES_PER_DOMAIN to 32.
Anton Blanchard [Sun, 24 Jul 2011 16:33:14 +0000 (16:33 +0000)]
powerpc/numa: Increase SD_NODES_PER_DOMAIN to 32.

The largest POWER7 boxes have 32 nodes. SD_NODES_PER_DOMAIN groups
nodes into chunks of 16 and adds a global balancing domain
(SD_ALLNODES) above it.

If we bump SD_NODES_PER_DOMAIN to 32, then we avoid this extra
level of balancing on our largest boxes.

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
13 years agosched: Allow SD_NODES_PER_DOMAIN to be overridden
Anton Blanchard [Sun, 24 Jul 2011 16:33:13 +0000 (16:33 +0000)]
sched: Allow SD_NODES_PER_DOMAIN to be overridden

We want to override the default value of SD_NODES_PER_DOMAIN on ppc64,
so move it into linux/topology.h.

Signed-off-by: Anton Blanchard <anton@samba.org>
Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
13 years agopowerpc/numa: Enable SD_WAKE_AFFINE in node definition
Anton Blanchard [Sun, 24 Jul 2011 16:33:12 +0000 (16:33 +0000)]
powerpc/numa: Enable SD_WAKE_AFFINE in node definition

When chasing a performance issue on ppc64, I noticed tasks
communicating via a pipe would often end up on different nodes.

It turns out SD_WAKE_AFFINE is not set in our node defition. Commit
9fcd18c9e63e (sched: re-tune balancing) enabled SD_WAKE_AFFINE
in the node definition for x86 and we need a similar change for
ppc64.

I used lmbench lat_ctx and perf bench pipe to verify this fix. Each
benchmark was run 10 times and the average taken.

lmbench lat_ctx:

before:  66565 ops/sec
after:  204700 ops/sec

3.1x faster

perf bench pipe:

before: 5.6570 usecs
after:  1.3470 usecs

4.2x faster

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
13 years agoMerge remote-tracking branch 'origin/master' into next
Benjamin Herrenschmidt [Tue, 20 Sep 2011 03:51:04 +0000 (13:51 +1000)]
Merge remote-tracking branch 'origin/master' into next

(Merge in order to get the PCIe mps/mrss code fixes)

13 years agoMerge branch 'irq-fixes-for-linus' of git://tesla.tglx.de/git/linux-2.6-tip
Linus Torvalds [Tue, 20 Sep 2011 00:23:41 +0000 (17:23 -0700)]
Merge branch 'irq-fixes-for-linus' of git://tesla.tglx.de/git/linux-2.6-tip

* 'irq-fixes-for-linus' of git://tesla.tglx.de/git/linux-2.6-tip:
  x86, iommu: Mark DMAR IRQ as non-threaded
  genirq: Make irq_shutdown() symmetric vs. irq_startup again

13 years agoMerge branch 'for-linus' of git://github.com/chrismason/linux
Linus Torvalds [Tue, 20 Sep 2011 00:17:32 +0000 (17:17 -0700)]
Merge branch 'for-linus' of git://github.com/chrismason/linux

* 'for-linus' of git://github.com/chrismason/linux:
  Btrfs: only clear the need lookup flag after the dentry is setup
  BTRFS: Fix lseek return value for error
  Btrfs: don't change inode flag of the dest clone file
  Btrfs: don't make a file partly checksummed through file clone
  Btrfs: fix pages truncation in btrfs_ioctl_clone()
  btrfs: fix d_off in the first dirent

13 years agoUSB: xHCI: prevent infinite loop when processing MSE event
Andiry Xu [Mon, 19 Sep 2011 23:05:12 +0000 (16:05 -0700)]
USB: xHCI: prevent infinite loop when processing MSE event

When a xHC host is unable to handle isochronous transfer in the
interval, it reports a Missed Service Error event and skips some tds.

Currently xhci driver handles MSE event in the following ways:

1. When encounter a MSE event, set ep->skip flag, update event ring
   dequeue pointer and return.

2. When encounter the next event on this ep, the driver will run the
   do-while loop, fetch td from ep's td_list to find the td
   corresponding to this event.  All tds missed are marked as short
   transfer(-EXDEV).

The do-while loop will end in two ways:

1. If the td pointed by the event trb is found;

2. If the ep ring's td_list is empty.

However, if a buggy HW reports some unpredicted event (for example, an
overrun event following a MSE event while the ep ring is actually not
empty), the driver will never find the td, and it will loop until the
td_list is empty.

Unfortunately, the spinlock is dropped when give back a urb in the
do-while loop.  During the spinlock released period, the class driver
may still submit urbs and add tds to the td_list.  This may cause
disaster, since the td_list will never be empty and the loop never ends,
and the system hangs.

To fix this, count the number of TDs on the ep ring before skipping TDs,
and quit the loop when skipped that number of tds.  This guarantees the
do-while loop will end after certain number of cycles, and driver will
not be trapped in an infinite loop.

Signed-off-by: Andiry Xu <andiry.xu@amd.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoUSB: xhci: Set change bit when warm reset change is set.
Greg KH [Mon, 19 Sep 2011 23:05:11 +0000 (16:05 -0700)]
USB: xhci: Set change bit when warm reset change is set.

Sometimes, when a USB 3.0 device is disconnected, the Intel Panther
Point xHCI host controller will report a link state change with the
state set to "SS.Inactive".  This causes the xHCI host controller to
issue a warm port reset, which doesn't finish before the USB core times
out while waiting for it to complete.

When the warm port reset does complete, and the xHC gives back a port
status change event, the xHCI driver kicks khubd.  However, it fails to
set the bit indicating there is a change event for that port because the
logic in xhci-hub.c doesn't check for the warm port reset bit.

After that, the warm port status change bit is never cleared by the USB
core, and the xHC stops reporting port status change bits.  (The xHCI
spec says it shouldn't report more port events until all change bits are
cleared.) This means any port changes when a new device is connected
will never be reported, and the port will seem "dead" until the xHCI
driver is unloaded and reloaded, or the computer is rebooted.  Fix this
by making the xHCI driver set the port change bit when a warm port reset
change bit is set.

A better solution would be to make the USB core handle warm port reset
in differently, merging the current code with the standard port reset
code that does an incremental backoff on the timeout, and tries to
complete the port reset two more times before giving up.  That more
complicated fix will be merged next window, and this fix will be
backported to stable.

This should be backported to kernels as old as 3.0, since that was the
first kernel with commit a11496ebf375 ("xHCI: warm reset support").

Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Cc: stable@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agostaging: fix comedi build when ISA_DMA_API is enabled but COMEDI_PCI is not enabled
Randy Dunlap [Mon, 19 Sep 2011 23:05:10 +0000 (16:05 -0700)]
staging: fix comedi build when ISA_DMA_API is enabled but COMEDI_PCI is not enabled

Fix build when CONFIG_ISA_DMA_API is enabled but
CONFIG_COMEDI_PCI[_DRIVERS] is not enabled.

Fixes these build errors:

  drivers/staging/comedi/drivers/ni_labpc.c: In function 'labpc_ai_cmd':
  drivers/staging/comedi/drivers/ni_labpc.c:1351: error: implicit declaration of function 'labpc_suggest_transfer_size'
  drivers/staging/comedi/drivers/ni_labpc.c: At top level:
  drivers/staging/comedi/drivers/ni_labpc.c:1802: error: conflicting types for 'labpc_suggest_transfer_size'
  drivers/staging/comedi/drivers/ni_labpc.c:1351: note: previous implicit declaration of 'labpc_suggest_transfer_size' was here

Signed-off-by: Randy Dunlap <rdunlap@xenotime.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoMake taskstats round statistics down to nearest 1k bytes/events
Linus Torvalds [Tue, 20 Sep 2011 00:10:57 +0000 (17:10 -0700)]
Make taskstats round statistics down to nearest 1k bytes/events

Even with just the interface limited to admin, there really is little to
reason to give byte-per-byte counts for taskstats.  So round it down to
something less intrusive.

Acked-by: Balbir Singh <bsingharora@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoMake TASKSTATS require root access
Linus Torvalds [Tue, 20 Sep 2011 00:04:37 +0000 (17:04 -0700)]
Make TASKSTATS require root access

Ok, this isn't optimal, since it means that 'iotop' needs admin
capabilities, and we may have to work on this some more.  But at the
same time it is very much not acceptable to let anybody just read
anybody elses IO statistics quite at this level.

Use of the GENL_ADMIN_PERM suggested by Johannes Berg as an alternative
to checking the capabilities by hand.

Reported-by: Vasiliy Kulikov <segoon@openwall.com>
Cc: Johannes Berg <johannes.berg@intel.com>
Acked-by: Balbir Singh <bsingharora@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agopowerpc/ps3: Add gelic udbg driver
Hector Martin [Wed, 31 Aug 2011 06:32:26 +0000 (06:32 +0000)]
powerpc/ps3: Add gelic udbg driver

Add a new udbg driver for the PS3 gelic Ehthernet device.

This driver shares only a few stucture and constant definitions with the
gelic Ethernet device driver, so is implemented as a stand-alone driver
with no dependencies on the gelic Ethernet device driver.

Signed-off-by: Hector Martin <hector@marcansoft.com>
Signed-off-by: Andre Heider <a.heider@gmail.com>
Signed-off-by: Geoff Levand <geoff@infradead.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
13 years agopowerpc/eeh: Fix /proc/ppc64/eeh creation
Thadeu Lima de Souza Cascardo [Fri, 26 Aug 2011 10:36:31 +0000 (10:36 +0000)]
powerpc/eeh: Fix /proc/ppc64/eeh creation

Since commit 188917e183cf9ad0374b571006d0fc6d48a7f447, /proc/ppc64 is a
symlink to /proc/powerpc/. That means that creating /proc/ppc64/eeh will
end up with a unaccessible file, that is not listed under /proc/powerpc/
and, then, not listed under /proc/ppc64/.

Creating /proc/powerpc/eeh fixes that problem and maintain the
compatibility intended with the ppc64 symlink.

Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: <stable@kernel.org> [3.x]
13 years agopowerpc/xics: Add __init to marker icp_native_init()
Arnaud Lacombe [Thu, 25 Aug 2011 06:07:13 +0000 (06:07 +0000)]
powerpc/xics: Add __init to marker icp_native_init()

This should fix the following warning:

 LD      arch/powerpc/sysdev/xics/built-in.o
WARNING: arch/powerpc/sysdev/xics/built-in.o(.text+0x1310): Section mismatch in
reference from the function .icp_native_init() to the function
.init.text:.icp_native_init_one_node()
The function .icp_native_init() references
the function __init .icp_native_init_one_node().
This is often because .icp_native_init lacks a __init
annotation or the annotation of .icp_native_init_one_node is wrong.

icp_native_init() is only referenced in `arch/powerpc/sysdev/xics/xics-common.c'
by xics_init() which is itself marked with __init.

= not built-tested =

Reported-by: Timur Tabi <timur@freescale.com>
Signed-off-by: Arnaud Lacombe <lacombar@gmail.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
13 years agopowerpc/pseries: Avoid spurious error during hotplug CPU add
Anton Blanchard [Sun, 14 Aug 2011 14:30:30 +0000 (14:30 +0000)]
powerpc/pseries: Avoid spurious error during hotplug CPU add

During hotplug CPU add we get the following error:

Unexpected Error (0) returned from configure-connector

ibm,configure-connector returns 0 for configuration complete, so
catch this and avoid the error.

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: <stable@kernel.org>
13 years agopowerpc/mm: Fix the call trace when resumed from hibernation
Tang Yuantian [Tue, 16 Aug 2011 19:51:33 +0000 (19:51 +0000)]
powerpc/mm: Fix the call trace when resumed from hibernation

In SMP mode, the kernel would produce call trace when resumed
from hibernation. The reason is when the function destroy_context
is called to drop the resuming mm context, the mm->context.active
is 1 which is wrong and should be zero.
We pass the current->active_mm as previous mm context to function
switch_mmu_context to decrease the context.active by 1.

In UP mode, there is no effect.

Signed-off-by: Tang Yuantian <b29983@freescale.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
13 years agopowerpc/4xx/pci: Add __init annotations for *init_port_hw() functions.
Tony Breeds [Wed, 10 Aug 2011 20:16:54 +0000 (20:16 +0000)]
powerpc/4xx/pci: Add __init annotations for *init_port_hw() functions.

The various port_init_hw methods of ppc4xx_pciex_hwops should have been
marked __init and when I added ppc4xx_pciex_port_reset_sdr(), which is
__init.  This added many section mismatch warnings like:

WARNING: arch/powerpc/sysdev/built-in.o(.text+0x5c68): Section mismatch in reference from the function ppc440spe_pciex_init_port_hw() to the function .init.text:ppc4xx_pciex_port_reset_sdr()
The function ppc440spe_pciex_init_port_hw() references
the function __init ppc4xx_pciex_port_reset_sdr().
This is often because ppc440spe_pciex_init_port_hw lacks a __init
annotation or the annotation of ppc4xx_pciex_port_reset_sdr is wrong.

Trivial patch to silence those warnings.

Reported-By: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Tony Breeds <tony@bakeyournoodle.com>
Yours Tony
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
13 years agopowerpc/wsp: Add MSI support for PCI on PowerEN
Michael Ellerman [Mon, 8 Aug 2011 12:30:55 +0000 (12:30 +0000)]
powerpc/wsp: Add MSI support for PCI on PowerEN

Based on a patch by Michael Ellerman <michael@ellerman.id.au>

Patch was simply forward ported upstream.

Jimi Xenidis <jimix@pobox.com>

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
13 years agopowerpc/wsp: Add PCIe Root support to PowerEN/WSP
Benjamin Herrenschmidt [Mon, 8 Aug 2011 12:30:54 +0000 (12:30 +0000)]
powerpc/wsp: Add PCIe Root support to PowerEN/WSP

Based on a patch by Benjamin Herrenschmidt <benh@kernel.crashing.org>

Modernized and slightly modified to not record erros into the nvram
log since we do not have that device driver just yet.

Jimi Xenidis <jimix@pobox.com>

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
13 years agopowerpc/wsp: Fix Wire Speed Processor platform configs
Jimi Xenidis [Mon, 8 Aug 2011 11:33:16 +0000 (11:33 +0000)]
powerpc/wsp: Fix Wire Speed Processor platform configs

Some config selections were applied to the platform (reference board)
when they actuall apply to the chip.

Signed-off-by: Jimi Xenidis <jimix@pobox.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
13 years agopseries/iommu: Add missing kfree
Julia Lawall [Mon, 8 Aug 2011 01:18:00 +0000 (01:18 +0000)]
pseries/iommu: Add missing kfree

At this point, window has not been stored anywhere, so it has to be freed
before leaving the function.

A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)

// <smpl>
@exists@
local idexpression x;
statement S,S1;
expression E;
identifier fl;
expression *ptr != NULL;
@@

x = \(kmalloc\|kzalloc\|kcalloc\)(...);
...
if (x == NULL) S
<... when != x
     when != if (...) { <+...kfree(x)...+> }
     when any
     when != true x == NULL
x->fl
...>
(
if (x == NULL) S1
|
if (...) { ... when != x
               when forall
(
 return \(0\|<+...x...+>\|ptr\);
|
* return ...;
)
}
)
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Acked-by: Nishanth Aravamudan <nacc@us.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
13 years agopowerpc/32: Pass device tree address as u64 to machine_init
Scott Wood [Mon, 25 Jul 2011 11:29:33 +0000 (11:29 +0000)]
powerpc/32: Pass device tree address as u64 to machine_init

u64 is used rather than phys_addr_t to keep things simple, as
this is called from assembly code.

Update callers to pass a 64-bit address in r3/r4.  Other unused
register assignments that were once parameters to machine_init
are dropped.

For FSL BookE, look up the physical address of the device tree from the
effective address passed in r3 by the loader.  This is required for
situations where memory does not start at zero (due to AMP or IOMMU-less
virtualization), and thus the IMA doesn't start at zero, and thus the
device tree effective address does not equal the physical address.

Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
13 years agopowerpc/nvram: Add compression to fit more oops output into NVRAM
Jim Keniston [Mon, 25 Jul 2011 07:54:50 +0000 (07:54 +0000)]
powerpc/nvram: Add compression to fit more oops output into NVRAM

Capture more than twice as much text from the printk buffer, and
compress it to fit it in the lnx,oops-log NVRAM partition.  You
can view the compressed text using the new (as of July 20) --unzip
option of the nvram command in the powerpc-utils package.

[BenH: Added select of ZLIB_DEFLATE]

Signed-off-by: Jim Keniston <jkenisto@us.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
13 years agopowerpc: Fix build dependencies for epapr.c which needs libfdt.h
Matthew McClintock [Tue, 19 Jul 2011 06:22:44 +0000 (06:22 +0000)]
powerpc: Fix build dependencies for epapr.c which needs libfdt.h

Currently, the build can (very rarely) fail to build because libfdt.h has
not been created or is in the process of being copied.

Signed-off-by: Matthew McClintock <msm@freescale.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>