kernel/kernel-generic.git
12 years agoMerge branch 'kexec' into next
Benjamin Herrenschmidt [Fri, 16 Dec 2011 00:09:21 +0000 (11:09 +1100)]
Merge branch 'kexec' into next

12 years agoMerge branch 'ps3' into next
Benjamin Herrenschmidt [Fri, 16 Dec 2011 00:09:15 +0000 (11:09 +1100)]
Merge branch 'ps3' into next

12 years agoMerge branch 'cpuidle' into next
Benjamin Herrenschmidt [Fri, 16 Dec 2011 00:09:11 +0000 (11:09 +1100)]
Merge branch 'cpuidle' into next

12 years agopowerpc: Enable squashfs as a module
Anton Blanchard [Wed, 30 Nov 2011 00:38:20 +0000 (00:38 +0000)]
powerpc: Enable squashfs as a module

Most distros use it so we may as well enable it and get regular compile
testing.

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
12 years agopowerpc/nvram: Add spinlock to oops_to_nvram to prevent oops in compression code.
Anton Blanchard [Wed, 30 Nov 2011 15:46:45 +0000 (15:46 +0000)]
powerpc/nvram: Add spinlock to oops_to_nvram to prevent oops in compression code.

When issuing a system reset we almost always oops in the oops_to_nvram
code because multiple CPUs are using the deflate work area. Add a
spinlock to protect it.

To play it safe I'm using trylock to avoid locking up if the NVRAM
code oopses. This means we might miss multiple CPUs oopsing at exactly
the same time but I think it's best to play it safe for now. Once we
are happy with the reliability we can change it to a full spinlock.

Signed-off-by: Anton Blanchard <anton@samba.org>
Acked-by: Jim Keniston <jkenisto@us.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
12 years agopmac_zilog: Fix unexpected irq
Finn Thain [Tue, 6 Dec 2011 17:49:36 +0000 (17:49 +0000)]
pmac_zilog: Fix unexpected irq

On most 68k Macs the SCC IRQ is an autovector interrupt and cannot be
masked. This can be a problem when pmac_zilog starts up.

For example, the serial debugging code in arch/m68k/kernel/head.S may be
used beforehand. It disables the SCC interrupts at the chip but doesn't
ack them. Then when a pmac_zilog port is used, the machine locks up with
"unexpected interrupt".

This can happen in pmz_shutdown() since the irq is freed before the
channel interrupts are disabled.

Fix this by clearing interrupt enable bits before the handler is
uninstalled. Also move the interrupt control bit flipping into a separate
pmz_interrupt_control() routine. Replace all instances of these operations
with calls to this routine. Omit the zssync() calls that seem to serve no
purpose.

Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
Acked-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
12 years agopowerpc: Provide a way for KVM to indicate that NV GPR values are lost
Paul Mackerras [Mon, 5 Dec 2011 19:47:26 +0000 (19:47 +0000)]
powerpc: Provide a way for KVM to indicate that NV GPR values are lost

This fixes a problem where a CPU thread coming out of nap mode can
think it has valid values in the nonvolatile GPRs (r14 - r31) as saved
away in power7_idle, but in fact the values have been trashed because
the thread was used for KVM in the mean time.  The result is that the
thread crashes because code that called power7_idle (e.g.,
pnv_smp_cpu_kill_self()) goes to use values in registers that have
been trashed.

The bit field in SRR1 that tells whether state was lost only reflects
the most recent nap, which may not have been the nap instruction in
power7_idle.  So we need an extra PACA field to indicate that state
has been lost even if SRR1 indicates that the most recent nap didn't
lose state.  We clear this field when saving the state in power7_idle,
we set it to a non-zero value when we use the thread for KVM, and we
test it in power7_wakeup_noloss.

Signed-off-by: Paul Mackerras <paulus@samba.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
12 years agopowerpc/powernv: Fix problems in onlining CPUs
Paul Mackerras [Mon, 5 Dec 2011 19:35:32 +0000 (19:35 +0000)]
powerpc/powernv: Fix problems in onlining CPUs

At present, on the powernv platform, if you off-line a CPU that was
online, and then try to on-line it again, the kernel generates a
warning message "OPAL Error -1 starting CPU n".  Furthermore, if the
CPU is a secondary thread that was used by KVM while it was off-line,
the CPU fails to come online.

The first problem is fixed by only calling OPAL to start the CPU the
first time it is on-lined, as indicated by the cpu_start field of its
PACA being zero.  The second problem is fixed by restoring the
cpu_start field to 1 instead of 0 when using the CPU within KVM.

Signed-off-by: Paul Mackerras <paulus@samba.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
12 years agopowerpc/pseries: Increase minimum RMO size from 64MB to 256MB
Anton Blanchard [Sun, 4 Dec 2011 13:13:58 +0000 (13:13 +0000)]
powerpc/pseries: Increase minimum RMO size from 64MB to 256MB

The minimum RMO size field in ibm,client-architecture is currently
ignored, but a future firmware version will rectify that. Since we
always get at least 128MB of RMO right now, asking for 64MB is
likely to result in boot failures.

We should bump it to at least 128MB, but considering all the boot
issues we have on 128MB RMO boxes and all new machines have virtual
RMO, we may as well set our minimum to 256MB.

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
12 years agopowerpc: Punch a hole in /dev/mem for librtas
sukadev@linux.vnet.ibm.com [Fri, 2 Dec 2011 12:26:23 +0000 (12:26 +0000)]
powerpc: Punch a hole in /dev/mem for librtas

With CONFIG_STRICT_DEVMEM=y, user space cannot read any part of /dev/mem.
Since this breaks librtas, punch a hole in /dev/mem to allow access to the
rmo_buffer that librtas needs.

Anton Blanchard reported the problem and helped with the fix.

A quick test for this patch:

       # cat /proc/rtas/rmo_buffer
       000000000f190000 10000

       # python -c "print 0x000000000f190000 / 0x10000"
       3865

       # dd if=/dev/mem of=/tmp/foo count=1 bs=64k skip=3865
       1+0 records in
       1+0 records out
       65536 bytes (66 kB) copied, 0.000205235 s, 319 MB/s

       # dd if=/dev/mem of=/tmp/foo
       dd: reading `/dev/mem': Operation not permitted
       0+0 records in
       0+0 records out
       0 bytes (0 B) copied, 0.00022519 s, 0.0 kB/s

Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
12 years agopowerpc: Add support for OpenBlockS 600
Benjamin Herrenschmidt [Thu, 1 Dec 2011 19:35:08 +0000 (19:35 +0000)]
powerpc: Add support for OpenBlockS 600

So I've had one of these for a while and it looks like the vendor never
bothered submitting the support upstream.

This adds it using ppc40x_simple and provides a device-tree.

There are some changes to the boot wrapper because the way u-boot works
on this thing, it seems to expect a multipart image with the kernel,
initrd and dtb in it.

The USB support is missing as it needs the yet unmerged driver for
the DWC OTG part and the GPIOs may need further definition in the dts.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
12 years agopowerpc/ps3: Update ps3_defconfig
Geoff Levand [Tue, 29 Nov 2011 15:38:50 +0000 (15:38 +0000)]
powerpc/ps3: Update ps3_defconfig

Refresh ps3_defconfig to latest kernel sources and
change the options:

  CONFIG_PPP=m to CONFIG_PPP=n.
  CONFIG_NAMESPACES=y to CONFIG_NAMESPACES=n
  CONFIG_NUMA=y to CONFIG_NUMA=n

Signed-off-by: Geoff Levand <geoff@infradead.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
12 years agopowerpc/ps3: Add __init to ps3_smp_probe
Geoff Levand [Tue, 29 Nov 2011 15:38:50 +0000 (15:38 +0000)]
powerpc/ps3: Add __init to ps3_smp_probe

Add an __init annotation to the ps3_smp_probe() routine.
Fixes build warnings like these when
CONFIG_DEBUG_SECTION_MISMATCH=y:

 WARNING: Section mismatch in reference from the function .ps3_smp_probe()

Signed-off-by: Geoff Levand <geoff@infradead.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
12 years agopowerpc/ps3: Fix PS3 repository build warnings
Geoff Levand [Thu, 1 Dec 2011 08:58:58 +0000 (08:58 +0000)]
powerpc/ps3: Fix PS3 repository build warnings

Fix some PS3 repository.c build warnings when DEBUG is
defined. Also change most pr_debug calls to pr_devel calls.

Fixes warnings like these:

  format '%lx' expects type 'long unsigned int', but argument 7 has type 'u64'

Signed-off-by: Geoff Levand <geoff@infradead.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
12 years agopowerpc/ps3: Fix hcall lv1_read_repository_node
Geoff Levand [Tue, 29 Nov 2011 15:38:50 +0000 (15:38 +0000)]
powerpc/ps3: Fix hcall lv1_read_repository_node

The lv1 hcall #91 should be named lv1_read_repository_node, and
not lv1_get_repository_node_value.  Adjust the lv1 hcall table
and all calls.

Signed-off-by: Geoff Levand <geoff@infradead.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
12 years agopowerpc/ps3: Fix hcall lv1_get_version_info
Geoff Levand [Tue, 29 Nov 2011 15:38:50 +0000 (15:38 +0000)]
powerpc/ps3: Fix hcall lv1_get_version_info

The lv1_get_version_info hcall takes 2, not 1 output
arguments.  Adjust the lv1 hcall table and all calls.

Usage:

  int lv1_get_version_info(u64 *version_number, u64 *vendor_id)

Signed-off-by: Geoff Levand <geoff@infradead.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
12 years agopowerpc/ps3: Fix hcall lv1_get_virtual_address_space_id_of_ppe
Geoff Levand [Tue, 29 Nov 2011 15:38:49 +0000 (15:38 +0000)]
powerpc/ps3: Fix hcall lv1_get_virtual_address_space_id_of_ppe

The lv1_get_virtual_address_space_id_of_ppe hcall takes 0, not 1 input
arguments.  Adjust the lv1 hcall table and all calls.

Signed-off-by: Geoff Levand <geoff@infradead.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
12 years agopowerpc/ps3: Fix hcall lv1_net_stop_rx_dma
Geoff Levand [Tue, 29 Nov 2011 15:38:49 +0000 (15:38 +0000)]
powerpc/ps3: Fix hcall lv1_net_stop_rx_dma

The lv1_net_stop_tx_dma and net_stop_rx_dma hcalls take 2, not 3 input
arguments.  Adjust the lv1 hcall table and all calls.

Signed-off-by: Geoff Levand <geoff@infradead.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
12 years agopowerpc/ps3: Interrupt code cleanup
Geoff Levand [Tue, 29 Nov 2011 15:38:49 +0000 (15:38 +0000)]
powerpc/ps3: Interrupt code cleanup

General code cleanup for PS3 interrupt.c:

 o Fill out comments for structure members.
 o Move variables ipi_debug_brk_mask and lock from struct ps3_bmp to
   struct ps3_private.
 o Fix pr_debug build errors when DEBUG is defined.
 o Convert bit operation to set_bit().
 o Convert DBG macro from pr_debug to pr_devel
 o Add new macro FAIL to replace pr_debug calls

Signed-off-by: Geoff Levand <geoff@infradead.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
12 years agopowerpc/kdump: Only save CPU state first time through the secondary CPU capture code
Anton Blanchard [Wed, 30 Nov 2011 00:23:17 +0000 (00:23 +0000)]
powerpc/kdump: Only save CPU state first time through the secondary CPU capture code

We might enter the secondary CPU capture code twice, eg if we have to
unstick some CPUs with a system reset. In this case we don't want to
overwrite the state on CPUs that had made it into the capture code OK,
so use the cpus_state_saved cpumask for that and make it local to
crash_ipi_callback.

For controlling progress now use atomic_t cpus_in_crash to count how
many CPUs have made it into the kdump code, and time_to_dump to tell
everyone it's time to dump.

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
12 years agopowerpc/kdump: Delay before sending IPI on a system reset
Anton Blanchard [Wed, 30 Nov 2011 00:23:16 +0000 (00:23 +0000)]
powerpc/kdump: Delay before sending IPI on a system reset

If we enter the kdump code via system reset, wait a bit before
sending the IPI to capture all secondary CPUs. Without it we race
with the hypervisor that is issuing the system reset to each CPU.
If the IPI gets there first the system reset oops output then shows
the register state of the IPI handler which is not what we want.

I took the opportunity to add defines for all the various delays
we have. There's no need for cpu_relax when we are doing an mdelay,
so remove them too.

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
12 years agopowerpc/xics: Reset the CPPR if H_EOI fails
Anton Blanchard [Wed, 30 Nov 2011 00:23:15 +0000 (00:23 +0000)]
powerpc/xics: Reset the CPPR if H_EOI fails

I have an intermittent kdump fail where the hypervisor fails an H_EOI.
As a result our CPPR is never reset to 0xff and we no longer accept
interrupts.

This patch calls icp_hv_set_cppr to reset the CPPR if H_EOI fails,
fixing the kdump fail.

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
12 years agopowerpc: Reduce pseries panic timeout from 180s to 10s
Anton Blanchard [Wed, 30 Nov 2011 00:23:14 +0000 (00:23 +0000)]
powerpc: Reduce pseries panic timeout from 180s to 10s

We've had a 180 second panic timeout on ppc64 for as long as I
can remember. This patch reduces it to 10 seconds on pseries for a few
reasons:

- Almost all pseries machines have a hypervisor console so panic
  output will be available in a scrollback buffer.

- The 180 seconds impacts our availability, users (other than
  kernel hackers) just want the box to come back around so it
  can continue its work.

- I spend a lot of my life staring at the 180 second panic timeout.
  Many pseries machines take minutes to power cycle, so it's quicker
  to sit through the 180 seconds than it is to power cycle.

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
12 years agopowerpc: Rework die()
Anton Blanchard [Wed, 30 Nov 2011 00:23:13 +0000 (00:23 +0000)]
powerpc: Rework die()

Our die() code was based off a very old x86 version. Update it to
mirror the current x86 code.

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
12 years agopowerpc: Cleanup crash/kexec code
Anton Blanchard [Wed, 30 Nov 2011 00:23:12 +0000 (00:23 +0000)]
powerpc: Cleanup crash/kexec code

Remove some unnecessary defines and fix some spelling mistakes.

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
12 years agopowerpc/kdump: Use setjmp/longjmp to handle kdump and system reset recursion
Anton Blanchard [Wed, 30 Nov 2011 00:23:11 +0000 (00:23 +0000)]
powerpc/kdump: Use setjmp/longjmp to handle kdump and system reset recursion

We can handle recursion caused by system reset by reusing the crash
shutdown fault handler.

Since we don't have an OS triggerable NMI, if all CPUs don't make it
into kdump then we tell the user to issue a system reset. However if
we have a panic timeout set we cannot wait forever and must continue
the kdump.

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
12 years agopowerpc: Remove broken and complicated kdump system reset code
Anton Blanchard [Wed, 30 Nov 2011 00:23:10 +0000 (00:23 +0000)]
powerpc: Remove broken and complicated kdump system reset code

We have a lot of complicated logic that handles possible recursion between
kdump and a system reset exception. We can solve this in a much simpler
way using the same setjmp/longjmp tricks xmon does.

As a first step, this patch removes the old system reset code.

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
12 years agopowerpc: Give us time to get all oopses out before panicking
Anton Blanchard [Wed, 30 Nov 2011 00:23:09 +0000 (00:23 +0000)]
powerpc: Give us time to get all oopses out before panicking

I've been seeing truncated output when people send system reset info
to me. We should see a backtrace for every CPU, but the panic() code
takes the box down before they all make it out to the console. The
panic code runs unlocked so we also see corrupted console output.

If we are going to panic, then delay 1 second before calling into the
panic code. Move oops_exit inside the die lock and put a newline
between oopses for clarity.

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
12 years agopowerpc/cpuidle: Handle power_save=off
Deepthi Dharwar [Wed, 30 Nov 2011 02:47:03 +0000 (02:47 +0000)]
powerpc/cpuidle: Handle power_save=off

This patch makes pseries_idle_driver not to be registered when
power_save=off kernel boot option is specified. The
cpuidle_disable variable used here is similar to
its usage on x86. If cpuidle_disable is set then
sysfs entries for cpuidle framework are not created
and the required drivers are not loaded.

Signed-off-by: Deepthi Dharwar <deepthi@linux.vnet.ibm.com>
Signed-off-by: Trinabh Gupta <g.trinabh@gmail.com>
Signed-off-by: Arun R Bharadwaj <arun.r.bharadwaj@gmail.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
12 years agopowerpc/cpuidle: Enable cpuidle and directly call cpuidle_idle_call() for pSeries
Deepthi Dharwar [Wed, 30 Nov 2011 02:46:55 +0000 (02:46 +0000)]
powerpc/cpuidle: Enable cpuidle and directly call cpuidle_idle_call() for pSeries

This patch enables cpuidle for pSeries and pSeries_idle is
directly called from the idle loop. As a result of pSeries_idle, cpuidle
driver registered with cpuidle subsystem comes into action. On
failure of loading of the driver or cpuidle framework default idle
is executed as part of the function. This patch
also removes the routines pseries_shared_idle_sleep and
pseries_dedicated_idle_sleep as they are now implemented as part of
pseries_idle cpuidle driver.

Signed-off-by: Deepthi Dharwar <deepthi@linux.vnet.ibm.com>
Signed-off-by: Trinabh Gupta <g.trinabh@gmail.com>
Signed-off-by: Arun R Bharadwaj <arun.r.bharadwaj@gmail.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
12 years agopowerpc/cpuidle: cpuidle driver for pSeries
Deepthi Dharwar [Wed, 30 Nov 2011 02:46:42 +0000 (02:46 +0000)]
powerpc/cpuidle: cpuidle driver for pSeries

This patch implements a back-end cpuidle driver for pSeries
based on pseries_dedicated_idle_loop and pseries_shared_idle_loop
routines.  The driver is built only if CONFIG_CPU_IDLE is set. This
cpuidle driver uses global registration of idle states and
not per-cpu.

Signed-off-by: Deepthi Dharwar <deepthi@linux.vnet.ibm.com>
Signed-off-by: Trinabh Gupta <g.trinabh@gmail.com>
Signed-off-by: Arun R Bharadwaj <arun.r.bharadwaj@gmail.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
12 years agopowerpc/cpuidle: Add cpu_idle_wait() to allow switching of idle routines
Deepthi Dharwar [Wed, 30 Nov 2011 02:46:31 +0000 (02:46 +0000)]
powerpc/cpuidle: Add cpu_idle_wait() to allow switching of idle routines

This patch provides cpu_idle_wait() routine for the powerpc
platform which is required by the cpuidle subsystem. This
routine is required to change the idle handler on SMP systems.
The equivalent routine for x86 is in arch/x86/kernel/process.c
but the powerpc implementation is different.

cpuidle_disable variable is to enable/disable cpuidle
framework if power_save option is set during the boot
time.

Signed-off-by: Deepthi Dharwar <deepthi@linux.vnet.ibm.com>
Signed-off-by: Trinabh Gupta <g.trinabh@gmail.com>
Signed-off-by: Arun R Bharadwaj <arun.r.bharadwaj@gmail.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
12 years agoMerge branch 'booke-hugetlb' into next
Benjamin Herrenschmidt [Thu, 8 Dec 2011 02:20:34 +0000 (13:20 +1100)]
Merge branch 'booke-hugetlb' into next

12 years agoMerge branch 'mpic' into next
Benjamin Herrenschmidt [Wed, 7 Dec 2011 07:22:47 +0000 (18:22 +1100)]
Merge branch 'mpic' into next

12 years agopowerpc/pci: Make pci_read_irq_line() static
Benjamin Herrenschmidt [Tue, 29 Nov 2011 20:16:25 +0000 (20:16 +0000)]
powerpc/pci: Make pci_read_irq_line() static

It's only used inside the same file where it's defined. There's
also no point exporting it anymore.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
12 years agopowerpc/powernv: Workaround OFW issues in prom_init.c
Benjamin Herrenschmidt [Tue, 29 Nov 2011 18:22:56 +0000 (18:22 +0000)]
powerpc/powernv: Workaround OFW issues in prom_init.c

Open Firmware on OPAL machines seems to have issues if we close
stdin and/or we try to print things after calling "quiesce" so
we avoid doing both.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
12 years agopowerpc/powernv: Display diag data on p7ioc EEH errors
Benjamin Herrenschmidt [Tue, 29 Nov 2011 18:22:53 +0000 (18:22 +0000)]
powerpc/powernv: Display diag data on p7ioc EEH errors

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
12 years agopowerpc/powernv: Update OPAL interfaces
Benjamin Herrenschmidt [Tue, 29 Nov 2011 18:22:50 +0000 (18:22 +0000)]
powerpc/powernv: Update OPAL interfaces

This adds some more interfaces for OPAL v2

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
12 years agopowerpc: Define/use HUGETLB_NEED_PRELOAD insead of complicated #if
Becky Bruce [Tue, 29 Nov 2011 15:10:39 +0000 (15:10 +0000)]
powerpc: Define/use HUGETLB_NEED_PRELOAD insead of complicated #if

Define HUGETLB_NEED_PRELOAD in mmu-book3e.h for CONFIG_PPC64 instead
of having a much more complicated #if block.  This is easier to read
and maintain.

Signed-off-by: Becky Bruce <beckyb@kernel.crashing.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
12 years agopowerpc/book3e: Change hugetlb preload to take vma argument
Becky Bruce [Mon, 28 Nov 2011 14:43:33 +0000 (14:43 +0000)]
powerpc/book3e: Change hugetlb preload to take vma argument

This avoids an extra find_vma() and is less error-prone.

Signed-off-by: Becky Bruce <beckyb@kernel.crashing.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
12 years agopowerpc: Enable hugetlb by default for corenet64 platforms
Becky Bruce [Mon, 10 Oct 2011 10:50:48 +0000 (10:50 +0000)]
powerpc: Enable hugetlb by default for corenet64 platforms

Signed-off-by: Becky Bruce <beckyb@kernel.crashing.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
12 years agopowerpc: Enable Hugetlb by default for 32-bit 85xx/corenet
Becky Bruce [Mon, 10 Oct 2011 10:50:46 +0000 (10:50 +0000)]
powerpc: Enable Hugetlb by default for 32-bit 85xx/corenet

Signed-off-by: Becky Bruce <beckyb@kernel.crashing.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
12 years agopowerpc: Kconfig updates for FSL BookE HUGETLB 64-bit
Becky Bruce [Mon, 10 Oct 2011 10:50:44 +0000 (10:50 +0000)]
powerpc: Kconfig updates for FSL BookE HUGETLB 64-bit

Allow hugetlb to be enabled on 64b FSL_BOOK3E.  No platforms enable
it by default yet.

Signed-off-by: Becky Bruce <beckyb@kernel.crashing.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
12 years agopowerpc: Add gpages reservation code for 64-bit FSL BOOKE
Becky Bruce [Mon, 10 Oct 2011 10:50:43 +0000 (10:50 +0000)]
powerpc: Add gpages reservation code for 64-bit FSL BOOKE

For 64-bit FSL_BOOKE implementations, gigantic pages need to be
reserved at boot time by the memblock code based on the command line.
This adds the call that handles the reservation, and fixes some code
comments.

It also removes the previous pr_err when reserve_hugetlb_gpages
is called on a system without hugetlb enabled - the way the code is
structured, the call is unconditional and the resulting error message
spurious and confusing.

Signed-off-by: Becky Bruce <beckyb@kernel.crashing.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
12 years agopowerpc: Add hugepage support to 64-bit tablewalk code for FSL_BOOK3E
Becky Bruce [Mon, 10 Oct 2011 10:50:42 +0000 (10:50 +0000)]
powerpc: Add hugepage support to 64-bit tablewalk code for FSL_BOOK3E

Before hugetlb, at each level of the table, we test for
!0 to determine if we have a valid table entry.  With hugetlb, this
compare becomes:
        < 0 is a normal entry
        0 is an invalid entry
        > 0 is huge

This works because the hugepage code pulls the top bit off the entry
(which for non-huge entries always has the top bit set) as an
indicator that we have a hugepage.

Signed-off-by: Becky Bruce <beckyb@kernel.crashing.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
12 years agopowerpc: Whitespace/comment changes to tlb_low_64e.S
Becky Bruce [Mon, 10 Oct 2011 10:50:41 +0000 (10:50 +0000)]
powerpc: Whitespace/comment changes to tlb_low_64e.S

I happened to comment this code while I was digging through it;
we might as well commit that.  I also made some whitespace
changes - the existing code had a lot of unnecessary newlines
that I found annoying when I was working on my tiny laptop.

No functional changes.

Signed-off-by: Becky Bruce <beckyb@kernel.crashing.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
12 years agopowerpc: hugetlb: modify include usage for FSL BookE code
Becky Bruce [Mon, 10 Oct 2011 10:50:40 +0000 (10:50 +0000)]
powerpc: hugetlb: modify include usage for FSL BookE code

The original 32-bit hugetlb implementation used PPC64 vs PPC32 to
determine which code path to take.  However, the final hugetlb
implementation for 64-bit FSL ended up shared with the FSL
32-bit code so the actual check needs to be FSL_BOOK3E vs
everything else.  This patch changes the include protections to
reflect this.

There are also a couple of related comment fixes.

Signed-off-by: Becky Bruce <beckyb@kernel.crashing.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
12 years agopowerpc: Update hugetlb huge_pte_alloc and tablewalk code for FSL BOOKE
Becky Bruce [Mon, 10 Oct 2011 10:50:39 +0000 (10:50 +0000)]
powerpc: Update hugetlb huge_pte_alloc and tablewalk code for FSL BOOKE

This updates the hugetlb page table code to handle 64-bit FSL_BOOKE.
The previous 32-bit work counted on the inner levels of the page table
collapsing.

Signed-off-by: Becky Bruce <beckyb@kernel.crashing.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
12 years agopowerpc: Fix booke hugetlb preload code for PPC_MM_SLICES and 64-bit
Becky Bruce [Mon, 10 Oct 2011 10:50:38 +0000 (10:50 +0000)]
powerpc: Fix booke hugetlb preload code for PPC_MM_SLICES and 64-bit

This patch does 2 things: It corrects the code that determines the
size to write into MAS1 for the PPC_MM_SLICES case (this originally
came from David Gibson and I had incorrectly altered it), and it
changes the methodolody used to calculate the size for !PPC_MM_SLICES
to work for 64-bit as well as 32-bit.

Signed-off-by: Becky Bruce <beckyb@kernel.crashing.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
12 years agopowerpc: hugetlb: fix huge_ptep_set_access_flags return value
Becky Bruce [Mon, 10 Oct 2011 10:50:37 +0000 (10:50 +0000)]
powerpc: hugetlb: fix huge_ptep_set_access_flags return value

There was an unconditional return of "1" in the original code
from David Gibson, and I dropped it because it wasn't needed
for FSL BOOKE 32-bit.  However, not all systems (including 64-bit
FSL BOOKE) do loading of the hpte from the fault handler asm
and depend on this function returning 1, which causes a call
to update_mmu_cache() that writes an entry into the tlb.

Signed-off-by: Becky Bruce <beckyb@kernel.crashing.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
12 years agopowerpc: Only define HAVE_ARCH_HUGETLB_UNMAPPED_AREA if PPC_MM_SLICES
Becky Bruce [Mon, 10 Oct 2011 10:50:36 +0000 (10:50 +0000)]
powerpc: Only define HAVE_ARCH_HUGETLB_UNMAPPED_AREA if PPC_MM_SLICES

If we don't have slices, we should be able to use the generic
hugetlb_get_unmapped_area() code

Signed-off-by: Becky Bruce <beckyb@kernel.crashing.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
12 years agopowerpc/mpic: Add in-core support for cascaded MPICs
Kyle Moffett [Fri, 2 Dec 2011 06:28:07 +0000 (06:28 +0000)]
powerpc/mpic: Add in-core support for cascaded MPICs

The Cell and PowerMac platforms use virtually identical cascaded-IRQ
setup code, so just merge it into the core.  Ideally this code would
trigger automatically when an MPIC device-node specifies an "interrupts"
property, perhaps even enabling MPIC_SECONDARY along the way.

Unfortunately, Benjamin Herrenschmidt has had bad experiences in the
past with the quality of Apple PowerMac device-trees, so to be safe we
will only try to parse out an IRQ if the MPIC_SECONDARY flag is set by
the caller.

Signed-off-by: Kyle Moffett <Kyle.D.Moffett@boeing.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
12 years agopowerpc/mpic: Cache the device-tree node in "struct mpic"
Kyle Moffett [Fri, 2 Dec 2011 06:28:06 +0000 (06:28 +0000)]
powerpc/mpic: Cache the device-tree node in "struct mpic"

Store the node pointer in the MPIC during initialization so that all of
the later operational code can just reuse the cached pointer.

Signed-off-by: Kyle Moffett <Kyle.D.Moffett@boeing.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
12 years agopowerpc/mpic: Put "pic-no-reset" test back into the MPIC code
Kyle Moffett [Fri, 2 Dec 2011 06:28:05 +0000 (06:28 +0000)]
powerpc/mpic: Put "pic-no-reset" test back into the MPIC code

There's not really any reason to have this one-liner in a separate
static inline function, given that all the other similar tests are
already in the alloc_mpic() code.

Signed-off-by: Kyle Moffett <Kyle.D.Moffett@boeing.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
12 years agopowerpc/mpic: Don't open-code dcr_resource_start
Kyle Moffett [Fri, 2 Dec 2011 06:28:04 +0000 (06:28 +0000)]
powerpc/mpic: Don't open-code dcr_resource_start

Don't open-code the OpenFirmware "dcr-reg" property lookup trying to map
DCR resources.  This makes the code a bit easier to read.

Signed-off-by: Kyle Moffett <Kyle.D.Moffett@boeing.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
12 years agopowerpc/mpic: Invert the meaning of MPIC_PRIMARY
Kyle Moffett [Fri, 2 Dec 2011 06:28:03 +0000 (06:28 +0000)]
powerpc/mpic: Invert the meaning of MPIC_PRIMARY

It turns out that there are only 2 in-tree platforms which use MPICs
which are not "primary":  IBM Cell and PowerMac.  To reduce the
complexity of the typical board setup code, invert the MPIC_PRIMARY bit
into MPIC_SECONDARY.

Signed-off-by: Kyle Moffett <Kyle.D.Moffett@boeing.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
12 years agopowerpc/mpic: Search for open-pic device-tree node if NULL
Kyle Moffett [Fri, 2 Dec 2011 06:28:02 +0000 (06:28 +0000)]
powerpc/mpic: Search for open-pic device-tree node if NULL

Almost all PowerPC platforms use a standard "open-pic" device node so
the mpic_alloc() function now accepts NULL for the device-node.  This
will cause it to perform a default search with of_find_matching_node().

Signed-off-by: Kyle Moffett <Kyle.D.Moffett@boeing.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
12 years agopowerpc/mpic: Save computed phys_addr for board-specific code
Kyle Moffett [Fri, 2 Dec 2011 06:28:01 +0000 (06:28 +0000)]
powerpc/mpic: Save computed phys_addr for board-specific code

The MPIC code can already perform an automatic OF address translation
step as part of mpic_alloc(), but several boards need to use that base
address when they perform mpic_assign_isu().

The easiest solution is to save the computed physical address into the
"struct mpic" for later use by the board code.

Signed-off-by: Kyle Moffett <Kyle.D.Moffett@boeing.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
12 years agopowerpc/mpic: Assume a device-node was passed in mpic_alloc()
Kyle Moffett [Fri, 2 Dec 2011 06:28:00 +0000 (06:28 +0000)]
powerpc/mpic: Assume a device-node was passed in mpic_alloc()

All of the existing callers of mpic_alloc() pass in a non-NULL
device-node pointer, so the checks for a NULL device-node may be
removed.

Signed-off-by: Kyle Moffett <Kyle.D.Moffett@boeing.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
12 years agopowerpc: Consolidate mpic_alloc() OF address translation
Kyle Moffett [Fri, 2 Dec 2011 06:27:59 +0000 (06:27 +0000)]
powerpc: Consolidate mpic_alloc() OF address translation

Instead of using the open-coded "reg" property lookup and address
translation in mpic_alloc(), directly call of_address_to_resource().
This includes various workarounds for special cases which the naive
of_address_translate() does not.

Afterwards it is possible to remove the copiously copy-pasted calls to
of_address_translate() from the 85xx/86xx/powermac platforms.

Signed-off-by: Kyle Moffett <Kyle.D.Moffett@boeing.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Grant Likely <grant.likely@secretlab.ca>
Cc: Kumar Gala <galak@kernel.crashing.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
12 years agopowerpc/85xx: Move mpc85xx_smp_init() decl to a new "smp.h"
Kyle Moffett [Fri, 2 Dec 2011 06:27:58 +0000 (06:27 +0000)]
powerpc/85xx: Move mpc85xx_smp_init() decl to a new "smp.h"

This removes a bunch of "extern" declarations and CONFIG_SMP ifdefs.

Signed-off-by: Kyle Moffett <Kyle.D.Moffett@boeing.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Kumar Gala <galak@kernel.crashing.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
12 years agopowerpc+sparc64/mm: Remove hack in mmap randomize layout
Dan McGee [Mon, 17 Oct 2011 13:05:23 +0000 (13:05 +0000)]
powerpc+sparc64/mm: Remove hack in mmap randomize layout

Since commit 8a0a9bd4db63bc45e301, this comment in mmap_rnd() does not
hold true as the value returned by get_random_int() will in fact be

different every single call. Remove the comment and simplify the code
back to its original desired form.

This reverts commit a5adc91a4b44b5d1 which is no longer necessary and
also fixes the sparc code that copied this same adjustment.

Signed-off-by: Dan McGee <dpmcgee@gmail.com>
Acked-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
12 years agopowerpc/xics: Harden xics hypervisor backend
Anton Blanchard [Thu, 24 Nov 2011 19:39:36 +0000 (19:39 +0000)]
powerpc/xics: Harden xics hypervisor backend

During kdump stress testing I sometimes see the kdump kernel panic
with:

  Interrupt 0x306 (real) is invalid, disabling it.
  Kernel panic - not syncing: bad return code EOI - rc = -4, value=ff000306

Instead of panicing print the error message, dump the stack the first
time it happens and continue on. Add some more information to the
debug messages as well.

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
12 years agopowerpc: Decode correct MSR bits in oops output
Anton Blanchard [Thu, 24 Nov 2011 19:35:57 +0000 (19:35 +0000)]
powerpc: Decode correct MSR bits in oops output

On a 64bit book3s machine I have an oops from a system reset that
claims the book3e CE bit was set:

MSR: 8000000000021032 <ME,CE,IR,DR>  CR: 24004082  XER: 00000010

On a book3s machine system reset sets IBM bit 46 and 47 depending on
the power saving mode. Separate the definitions by type and for
completeness add the rest of the bits in.

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
12 years agoarch/powerpc: Remove duplicate/redundant Altivec entries
Matthew McClintock [Tue, 7 Sep 2010 08:56:55 +0000 (08:56 +0000)]
arch/powerpc: Remove duplicate/redundant Altivec entries

In lieu of having multiple similiar lines, we can just have one
generic cpu-as line for CONFIG_ALTIVEC

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
12 years agopowerpc/maple: Enable access to HT Host-Bridge on Maple
Dmitry Eremin-Solenikov [Wed, 29 Jun 2011 04:17:40 +0000 (04:17 +0000)]
powerpc/maple: Enable access to HT Host-Bridge on Maple

CPC925/CPC945 use special window to access host bridge functionality of
u3-ht. Provide a way to access this device.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
12 years agopowerpc: Implement CONFIG_STRICT_DEVMEM
sukadev@linux.vnet.ibm.com [Tue, 30 Aug 2011 09:19:17 +0000 (09:19 +0000)]
powerpc: Implement CONFIG_STRICT_DEVMEM

As described in the help text in the patch, this token restricts general
access to /dev/mem as a way of increasing the security. Specifically, access
to exclusive IOMEM and kernel RAM is denied unless CONFIG_STRICT_DEVMEM is
set to 'n'.

Implement the 'devmem_is_allowed()' interface for Powerpc. It will be
called from range_is_allowed() when userpsace attempts to access /dev/mem.

This patch is based on an earlier patch from Steve Best and with input from
Paul Mackerras and Scott Wood.

[BenH] Fixed a typo or two and removed the generic change which should
       be submitted as a separate patch

Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
12 years agoMerge remote-tracking branch 'kumar/next' into next
Benjamin Herrenschmidt [Fri, 25 Nov 2011 04:25:39 +0000 (15:25 +1100)]
Merge remote-tracking branch 'kumar/next' into next

12 years agopowerpc/mpic: Remove extra semicolon.
Justin P. Mattock [Mon, 21 Nov 2011 06:43:26 +0000 (06:43 +0000)]
powerpc/mpic: Remove extra semicolon.

The patch below removes an extra semicolon.

Signed-off-by: Justin P. Mattock <justinmattock@gmail.com>
CC: linuxppc-dev@lists.ozlabs.org
CC: Paul Mackerras <paulus@samba.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
12 years agopowerpc: Export PIR data through sysfs
Ananth N Mavinakayanahalli [Thu, 10 Nov 2011 19:58:53 +0000 (19:58 +0000)]
powerpc: Export PIR data through sysfs

On Fri, Nov 11, 2011 at 10:17:55AM +0530, Ananth N Mavinakayanahalli wrote:
> >
> > At this rate we're going to end up with no bits left for CPU features
> > way too quickly... Especially for something we only care about once at
> > boot time.
> >
> > Wouldn't CPU_FTR_PPCAS_ARCH_V2 be a good enough test ?
>
> /me checks Cell manuals... yes, that test would be good enough. I will
> cook up a patch to use this.

Here it is...

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
12 years agopowerpc/powernv: PCI support for p7IOC under OPAL v2
Benjamin Herrenschmidt [Tue, 15 Nov 2011 17:29:08 +0000 (17:29 +0000)]
powerpc/powernv: PCI support for p7IOC under OPAL v2

This adds support for p7IOC (and possibly other IODA v1 IO Hubs)
using OPAL v2 interfaces.

We completely take over resource assignment and assign them using an
algorithm that hands out device BARs in a way that makes them fit in
individual segments of the M32 window of the bridge, which enables us
to assign individual PEs to devices and functions.

The current implementation gives out a PE per functions on PCIe, and a
PE for the entire bridge for PCIe to PCI-X bridges.

This can be adjusted / fine tuned later.

We also setup DMA resources (32-bit only for now) and MSIs (both 32-bit
and 64-bit MSI are supported).

The DMA allocation tries to divide the available 256M segments of the
32-bit DMA address space "fairly" among PEs. This is done using a
"weight" heuristic which assigns less value to things like OHCI USB
controllers than, for example SCSI RAID controllers. This algorithm
will probably want some fine tuning for specific devices or device
types.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
12 years agopowerpc/powernv: Fixup p7ioc PCIe root complex class code
Benjamin Herrenschmidt [Sun, 6 Nov 2011 18:56:00 +0000 (18:56 +0000)]
powerpc/powernv: Fixup p7ioc PCIe root complex class code

It advertises "host bridge" instead of "PCI to PCI bridge" which confuses
the Linux probe code.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
12 years agopowerpc/powernv: Add TCE SW invalidation support
Benjamin Herrenschmidt [Sun, 6 Nov 2011 18:55:59 +0000 (18:55 +0000)]
powerpc/powernv: Add TCE SW invalidation support

This is used for newer IO Hubs such as p7IOC.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
12 years agopowerpc/pci: Change how re-assigning resouces work
Benjamin Herrenschmidt [Sun, 6 Nov 2011 18:55:58 +0000 (18:55 +0000)]
powerpc/pci: Change how re-assigning resouces work

When PCI_REASSIGN_ALL_RSRC is set, we used to clear all bus resources
at the beginning of survey and re-allocate them later.

This changes it so instead, during early fixup, we mark all resources
as IORESOURCE_UNSET and move them down to be 0-based.

Later, if bus resources are still unset at the beginning of the survey,
then we clear them.

This shouldn't impact the re-assignment case on 4xx, but will enable
us to have the platform do some custom resource assignment before the
survey, by clearing individual resources IORESOURCE_UNSET bit.

Also limits the clutter in the kernel log from fixup when re-assigning
since we don't care about the offset applied to the BAR values in this
case.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
12 years agopowerpc/pci: Add a platform hook after probe and before resource survey
Benjamin Herrenschmidt [Sun, 6 Nov 2011 18:55:57 +0000 (18:55 +0000)]
powerpc/pci: Add a platform hook after probe and before resource survey

Some platforms need to perform resource allocation using a custom algorithm
due to HW constraints, or may want to tweak things globally below a host
bridge. For example OPAL support for IODA will need to perform a
resource allocation pass that applies IODA specific segmentation
constraints to MMIO which cannot be done simply using the kernel generic
resource management code.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
12 years agopowerpc: Add pgprot_cached_noncoherent()
Geoff Thorpe [Thu, 27 Oct 2011 02:58:45 +0000 (02:58 +0000)]
powerpc: Add pgprot_cached_noncoherent()

This adds a pgprot combination required by some cache-enabled IO device
mappings, such as Freescale datapath (QMan and BMan) portals.

Signed-off-by: Geoff Thorpe <geoff@geoffthorpe.net>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
12 years agopowerpc: Allow irq threading
Thomas Gleixner [Wed, 5 Oct 2011 02:30:51 +0000 (02:30 +0000)]
powerpc: Allow irq threading

All interrupts which must be non threaded are marked
IRQF_NO_THREAD. So it's safe to allow force threaded handlers.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
12 years agopowerpc: Mark IPI interrupts IRQF_NO_THREAD
Thomas Gleixner [Wed, 5 Oct 2011 02:30:50 +0000 (02:30 +0000)]
powerpc: Mark IPI interrupts IRQF_NO_THREAD

IPI handlers cannot be threaded. Remove the obsolete IRQF_DISABLED
flag (see commit e58aa3d2) while at it.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
12 years agopowerpc/wsp: Mark opb cascade handler IRQF_NO_THREAD
Thomas Gleixner [Wed, 5 Oct 2011 02:30:50 +0000 (02:30 +0000)]
powerpc/wsp: Mark opb cascade handler IRQF_NO_THREAD

Cascade handlers must run in hard interrupt context.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
12 years agopowerpc/85xx: Mark cascade irq IRQF_NO_THREAD
Thomas Gleixner [Wed, 5 Oct 2011 02:30:49 +0000 (02:30 +0000)]
powerpc/85xx: Mark cascade irq IRQF_NO_THREAD

Cascade interrupt must run in hard interrupt context.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
12 years agopowerpc/pseries: Cancel RTAS event scan before firmware flash
Ravi K. Nittala [Mon, 3 Oct 2011 21:49:53 +0000 (21:49 +0000)]
powerpc/pseries: Cancel RTAS event scan before firmware flash

The RTAS firmware flash update is conducted using an RTAS call that is
serialized by lock_rtas() which uses spin_lock. While the flash is in
progress, rtasd performs scan for any RTAS events that are generated by
the system. rtasd keeps scanning for the RTAS events generated on the
machine. This is performed via workqueue mechanism. The rtas_event_scan()
also uses an RTAS call to scan the events, eventually trying to acquire
the spin_lock before issuing the request.

The flash update takes a while to complete and during this time, any other
RTAS call has to wait. In this case, rtas_event_scan() waits for a long time
on the spin_lock resulting in a soft lockup.

Fix: Just before the flash update is performed, the queued rtas_event_scan()
work item is cancelled from the work queue so that there is no other RTAS
call issued while the flash is in progress. After the flash completes, the
system reboots and the rtas_event_scan() is rescheduled.

Signed-off-by: Suzuki Poulose <suzuki@in.ibm.com>
Signed-off-by: Ravi Nittala <ravi.nittala@in.ibm.com>
Reported-by: Divya Vikas <divya.vikas@in.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
12 years agopowerpc/book3e: Add Chroma as a new WSP/PowerEN platform.
Jimi Xenidis [Fri, 30 Sep 2011 04:26:13 +0000 (04:26 +0000)]
powerpc/book3e: Add Chroma as a new WSP/PowerEN platform.

This patch add the Chroma platform to WSP/PowerEN, which is a PCIe
card (a defconfig is included).

The card includes an H8 service processor that is used to manage the
card.  The H8 is connected over the second serial UART on the PowerEN
chip so this patch includes a simple 16550 driver to enable
communication, mostly for "power off" and "rebooting".

This patch also includes a, WSP specific, "halt" method that will shut
of all A2 cores but still leave power on at the chip level.  This is
desirable, especially if you wish to interrogate the chip with a
hardware probe after the halt.

Signed-off-by: Jimi Xenidis <jimix@pobox.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
12 years agopowerpc/xmon: Fix #if typo for systems without MSR[RI]
Jimi Xenidis [Thu, 29 Sep 2011 12:05:28 +0000 (12:05 +0000)]
powerpc/xmon: Fix #if typo for systems without MSR[RI]

Sorry, there was a typo in the #if

signed-off-by: Jimi Xenidis <jimix@pobox.com>

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
12 years agopowerpc/xmon: Fix the 'u' command description
Jimi Xenidis [Thu, 29 Sep 2011 11:25:10 +0000 (11:25 +0000)]
powerpc/xmon: Fix the 'u' command description

The 'u' command will print the TLB on book3e parts and the SLB on
Book3s parts, but the help system doesn't say that correctly.

Signed-off-by: Jimi Xenidis <jimix@pobox.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
12 years agopowerpc/icswx: Simple ACOP fault handler
Jimi Xenidis [Thu, 29 Sep 2011 10:55:14 +0000 (10:55 +0000)]
powerpc/icswx: Simple ACOP fault handler

This patch adds a fault handler that responds to illegal Coprocessor
types.  Currently all CTs are treated and illegal.  There are two ways
to report the fault back to the application.  If the application used
the record form ("icswx.") then the architected "reject" is emulated.
If the application did not used the record form ("icswx") then it is
selectable by config whether the failure is silent (as architected) or
a SIGILL is generated.

In all cases pr_warn() is used to log the bad CT.

Signed-off-by: Jimi Xenidis <jimix@pobox.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
12 years agopowerpc/book3e: Add ICSWX/ACOP support to Book3e cores like A2
Jimi Xenidis [Thu, 29 Sep 2011 10:55:13 +0000 (10:55 +0000)]
powerpc/book3e: Add ICSWX/ACOP support to Book3e cores like A2

ICSWX is also used by the A2 processor to access coprocessors,
although not all "chips" that contain A2s have coprocessors.

Signed-off-by: Jimi Xenidis <jimix@pobox.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
12 years agopowerpc: Split ICSWX ACOP and PID processing
Jimi Xenidis [Thu, 29 Sep 2011 10:55:12 +0000 (10:55 +0000)]
powerpc: Split ICSWX ACOP and PID processing

Some processors, like embedded, that already have a PID register that
is managed by the system.  This patch separates the ACOP and PID
processing into separate files so that the ACOP code can be shared.

Signed-off-by: Jimi Xenidis <jimix@pobox.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
12 years agoperf/powerpc: Fix build for PowerPC with uclibc toolchains
Florian Fainelli [Tue, 23 Aug 2011 02:20:08 +0000 (02:20 +0000)]
perf/powerpc: Fix build for PowerPC with uclibc toolchains

libio.h is not provided by uClibc, in order to be able to test the
definition of __UCLIBC__ we need to include stdlib.h, which also
includes stddef.h, providing the definition of 'NULL'.

Signed-off-by: Florian Fainelli <florian@openwrt.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
12 years agopowerpc/powermac: Add missing of_node_put
Julia Lawall [Sun, 21 Aug 2011 06:10:01 +0000 (06:10 +0000)]
powerpc/powermac: Add missing of_node_put

np is initialized to the result of calling a function that calls
of_node_get, so of_node_put should be called before the pointer is dropped.

The semantic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
expression e,e1,e2;
@@

* e = \(of_find_node_by_type\|of_find_node_by_name\)(...)
  ... when != of_node_put(e)
      when != true e == NULL
      when != e2 = e
  e = e1
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
12 years agopowerpc/cell/iommu: Add missing of_node_put
Julia Lawall [Sun, 21 Aug 2011 06:10:00 +0000 (06:10 +0000)]
powerpc/cell/iommu: Add missing of_node_put

np is initialized to the result of calling a function that calls
of_node_get, so of_node_put should be called before the pointer is dropped.

The semantic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
expression e,e1,e2;
@@

* e = \(of_find_node_by_type\|of_find_node_by_name\)(...)
  ... when != of_node_put(e)
      when != true e == NULL
      when != e2 = e
  e = e1
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
12 years agopowerpc/pseries: Software invalidatation of TCEs
Milton Miller [Wed, 29 Jun 2011 20:58:33 +0000 (20:58 +0000)]
powerpc/pseries: Software invalidatation of TCEs

Some pseries IOMMUs cache TCEs but don't snoop when the TCEs are changed
in memory, hence we need manually invalidate in software.

This adds code to do the invalidate.  It keys off a device tree property
to say where the to do the MMIO for the invalidate and some information
on what the format of the invalidate including some magic routing info.

it_busno get overloaded with this magic routing info and it_index with
the MMIO address for the invalidate command.

This then gets hooked into the building and freeing of TCEs.

This is only useful on bare metal pseries.  pHyp takes care of this when
virtualised.

Based on patch from Milton with cleanups from Mikey.

Signed-off-by: Milton Miller <miltonm@bga.com>
Signed-off-by: Michael Neuling <mikey@neuling.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
12 years agopowerpc/time: Optimise decrementer_check_overflow
Anton Blanchard [Wed, 23 Nov 2011 20:07:22 +0000 (20:07 +0000)]
powerpc/time: Optimise decrementer_check_overflow

decrementer_check_overflow is called from arch_local_irq_restore so
we want to make it as light weight as possible. As such, turn
decrementer_check_overflow into an inline function.

To avoid a circular mess of includes, separate out the two components
of struct decrementer_clock and keep the struct clock_event_device
part local to time.c.

The fast path improves from:

arch_local_irq_restore
     0:       mflr    r0
     4:       std     r0,16(r1)
     8:       stdu    r1,-112(r1)
     c:       stb     r3,578(r13)
    10:       cmpdi   cr7,r3,0
    14:       beq-    cr7,24 <.arch_local_irq_restore+0x24>
...
    24:       addi    r1,r1,112
    28:       ld      r0,16(r1)
    2c:       mtlr    r0
    30:       blr

to:

arch_local_irq_restore
    0:       std     r30,-16(r1)
    4:       ld      r30,0(r2)
    8:       stb     r3,578(r13)
    c:       cmpdi   cr7,r3,0
   10:       beq-    cr7,6c <.arch_local_irq_restore+0x6c>
...
   6c:       ld      r30,-16(r1)
   70:       blr

Unfortunately we still setup a local TOC (due to -mminimal-toc). Yet
another sign we should be moving to -mcmodel=medium.

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
12 years agopowerpc/time: Fix some style issues
Anton Blanchard [Wed, 23 Nov 2011 20:07:21 +0000 (20:07 +0000)]
powerpc/time: Fix some style issues

Fix some formatting issues and use the DECREMENTER_MAX
define instead of 0x7fffffff.

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
12 years agopowerpc/time: Remove unnecessary sanity check of decrementer expiration
Anton Blanchard [Wed, 23 Nov 2011 20:07:20 +0000 (20:07 +0000)]
powerpc/time: Remove unnecessary sanity check of decrementer expiration

The clockevents code uses max_delta_ns to avoid calling a
clockevent with too large a value.

Remove the redundant version of this in the timer_interrupt
code.

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
12 years agopowerpc/time: Use clocksource_register_hz
Anton Blanchard [Wed, 23 Nov 2011 20:07:19 +0000 (20:07 +0000)]
powerpc/time: Use clocksource_register_hz

Use clocksource_register_hz which calculates the shift/mult
factors for us. Also remove the shift = 22 assumption in
vsyscall_update - thanks to Paul Mackerras and John Stultz for
catching that.

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
12 years agopowerpc/time: Use clockevents_calc_mult_shift
Anton Blanchard [Wed, 23 Nov 2011 20:07:18 +0000 (20:07 +0000)]
powerpc/time: Use clockevents_calc_mult_shift

We can use clockevents_calc_mult_shift instead of doing all
the work ourselves.

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
12 years agopowerpc/time: Handle wrapping of decrementer
Anton Blanchard [Wed, 23 Nov 2011 20:07:17 +0000 (20:07 +0000)]
powerpc/time: Handle wrapping of decrementer

When re-enabling interrupts we have code to handle edge sensitive
decrementers by resetting the decrementer to 1 whenever it is negative.
If interrupts were disabled long enough that the decrementer wrapped to
positive we do nothing. This means interrupts can be delayed for a long
time until it finally goes negative again.

While we hope interrupts are never be disabled long enough for the
decrementer to go positive, we have a very good test team that can
drive any kernel into the ground. The softlockup data we get back
from these fails could be seconds in the future, completely missing
the cause of the lockup.

We already keep track of the timebase of the next event so use that
to work out if we should trigger a decrementer exception.

Signed-off-by: Anton Blanchard <anton@samba.org>
Cc: stable@kernel.org
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
12 years agodrivers/serial/ucc_uart.c: Add missing call to init UCC UART port timeout
Chuck Meade [Fri, 18 Jun 2010 13:22:26 +0000 (09:22 -0400)]
drivers/serial/ucc_uart.c: Add missing call to init UCC UART port timeout

The UCC UART driver is missing a call to uart_update_timeout().
Without this call, attempting to close the port after outputting large
amounts of data (i.e. using tty and uart buffering) results in long
timeouts before the port will actually be shut down.

For example, cat a large file to a UCC UART port.  With the current
driver, the port will stay open for 30 seconds after the last byte
of data is output.  But with this patch, the port is closed as
expected, just after the data has been output (tx fifos empty).

Signed-off-by: Chuck Meade <chuck@ThePTRGroup.com>
Acked-by: Timur Tabi <timur@freescale.com>
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
12 years agopowerpc/fsl_msi: add support for the fsl, msi property in PCI nodes
Timur Tabi [Mon, 31 Oct 2011 22:06:35 +0000 (17:06 -0500)]
powerpc/fsl_msi: add support for the fsl, msi property in PCI nodes

On Freescale parts with multiple MSI controllers, the controllers are
combined into one "pool" of interrupts.  Whenever a device requests an MSI
interrupt, the next available interrupt from the pool is selected,
regardless of which MSI controller the interrupt is from.  This works
because each PCI bus has an ATMU to all of CCSR, so any PCI device can
access any MSI interrupt register.

The fsl,msi property is used to specify that a given PCI bus should only
use a specific MSI device.  This is necessary, for example, with the
Freescale hypervisor, because the MSI devices are assigned to specific
partitions.

Ideally, we'd like to be able to assign MSI devices to PCI busses within
the MSI or PCI layers.  However, there does not appear to be a mechanism
to do that.  Whenever the MSI layer wants to allocate an MSI interrupt to
a PCI device, it just calls arch_setup_msi_irqs().  It would be nice if we
could register an MSI device with a specific PCI bus.

So instead we remember the phandles of each MSI device, and we use that to
limit our search for an available interrupt.  Whenever we are asked to
allocate a new interrupt for a PCI device, we check the fsl,msi property
of the PCI bus for that device.  If it exists, then as we are looping over
all MSI devices, we skip the ones that don't have a matching phandle.

Signed-off-by: Timur Tabi <timur@freescale.com>
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
12 years agopowerpc/85xx: Renamed mpc85xx_common.c to common.c
Kumar Gala [Thu, 24 Nov 2011 07:07:08 +0000 (01:07 -0600)]
powerpc/85xx: Renamed mpc85xx_common.c to common.c

The file name is already scoped by the directory its in.

Signed-off-by: Kumar Gala <galak@kernel.crashing.org>