pandora-kernel.git
9 years agopowerpc/perf/hv-24x7: Add missing put_cpu_var()
Sukadev Bhattiprolu [Tue, 17 Feb 2015 19:14:36 +0000 (14:14 -0500)]
powerpc/perf/hv-24x7: Add missing put_cpu_var()

Add missing put_cpu_var() for 24x7 requests. This went missing in
commit f34b6c7 (3.18-rc3).

Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
9 years agopowerpc/perf/hv-24x7: Break up single_24x7_request
Sukadev Bhattiprolu [Tue, 31 Mar 2015 01:53:47 +0000 (18:53 -0700)]
powerpc/perf/hv-24x7: Break up single_24x7_request

Break up the function single_24x7_request() into smaller functions.
This would later enable us to "prepare" a multi-event request
buffer and then submit a single hcall for several events.

Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
9 years agopowerpc/perf/hv-24x7: Define update_event_count()
Sukadev Bhattiprolu [Tue, 31 Mar 2015 01:53:46 +0000 (18:53 -0700)]
powerpc/perf/hv-24x7: Define update_event_count()

Move the code to update an event count into a new function,
update_event_count().

Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
9 years agopowerpc/perf/hv-24x7: Whitespace cleanup
Sukadev Bhattiprolu [Tue, 31 Mar 2015 01:53:45 +0000 (18:53 -0700)]
powerpc/perf/hv-24x7: Whitespace cleanup

Fix minor whitespace damages.

Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
9 years agopowerpc/perf/hv-24x7: Define add_event_to_24x7_request()
Sukadev Bhattiprolu [Tue, 31 Mar 2015 01:53:44 +0000 (18:53 -0700)]
powerpc/perf/hv-24x7: Define add_event_to_24x7_request()

Move code that maps a perf_event to a 24x7 request buffer into a
separate function, add_event_to_24x7_request().

Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
9 years agopowerpc/perf/hv-24x7: Rename hv_24x7_event_update
Sukadev Bhattiprolu [Tue, 31 Mar 2015 01:53:43 +0000 (18:53 -0700)]
powerpc/perf/hv-24x7: Rename hv_24x7_event_update

For consistency with the pmu operation ->read() and with other
pmus, rename hv_24x7_event_update() to hv_24x7_event_read().

Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
9 years agopowerpc/perf/hv-24x7: Move debug prints to separate function
Sukadev Bhattiprolu [Tue, 31 Mar 2015 01:53:42 +0000 (18:53 -0700)]
powerpc/perf/hv-24x7: Move debug prints to separate function

To simplify/cleanup code, move the rather long printk() to a separate
function.

Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
9 years agopowerpc/perf/hv-24x7: Drop event_24x7_request()
Sukadev Bhattiprolu [Tue, 31 Mar 2015 01:53:41 +0000 (18:53 -0700)]
powerpc/perf/hv-24x7: Drop event_24x7_request()

The function event_24x7_request() is essentially a wrapper to the
function single_24x7_request() and can be dropped to simplify code.

Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
9 years agopowerpc/perf/hv-24x7: Use pr_devel() to log message
Sukadev Bhattiprolu [Tue, 31 Mar 2015 01:53:40 +0000 (18:53 -0700)]
powerpc/perf/hv-24x7: Use pr_devel() to log message

Use pr_devel_ratelimited() to log error message when the 24x7 HCALL
fails. Since users specify events by their sysfs name, the HCALL should
succeed. Any errors reported by the HCALL would be of interest to the
developer, rather than the user/administrator.

Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
9 years agopowerpc/perf/hv-24x7: Remove unnecessary parameter
Sukadev Bhattiprolu [Tue, 31 Mar 2015 01:53:39 +0000 (18:53 -0700)]
powerpc/perf/hv-24x7: Remove unnecessary parameter

Remove the 'success_expected' parameter and log the message unconditionally.

Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
9 years agopowerpc/perf/hv-24x7: Modify definition of request and result buffers
Sukadev Bhattiprolu [Tue, 31 Mar 2015 01:53:38 +0000 (18:53 -0700)]
powerpc/perf/hv-24x7: Modify definition of request and result buffers

The parameters to the 24x7 HCALL have variable number of elements in them.
Set the minimum number of such elements to 1 rather than 0 and eliminate
the temporary structures.

This would enable us to submit multiple counter requests and process
multiple results from a single HCALL (in a follow on patch).

Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
9 years agopowerpc/powernv: Add interfaces for flash device access
Cyril Bur [Wed, 1 Apr 2015 06:05:30 +0000 (14:05 +0800)]
powerpc/powernv: Add interfaces for flash device access

This change adds the OPAL interface definitions to allow Linux to read,
write and erase from system flash devices. We register platform devices
for the flash devices exported by firmware.

We clash with the existing opal_flash_init function, which is really for
the FSP flash update functionality, so we rename that initcall to
opal_flash_update_init().

A future change will add an mtd driver that uses this interface.

Changes from Joel Stanley and Jeremy Kerr.

Signed-off-by: Cyril Bur <cyrilbur@gmail.com>
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Joel Stanley <joel@jms.id.au>
Acked-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
9 years agopowerpc/tm: Correct minor documentation typos
Sam bobroff [Fri, 10 Apr 2015 04:16:50 +0000 (14:16 +1000)]
powerpc/tm: Correct minor documentation typos

Signed-off-by: Sam Bobroff <sam.bobroff@au1.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
9 years agoselftests/powerpc: Add transactional syscall test
Sam bobroff [Fri, 10 Apr 2015 04:16:49 +0000 (14:16 +1000)]
selftests/powerpc: Add transactional syscall test

Check that a syscall made during an active transaction will fail with
the correct failure code and that one made during a suspended
transaction will succeed.

Signed-off-by: Sam Bobroff <sam.bobroff@au1.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
9 years agoselftests/powerpc: Move get_auxv_entry() to harness.c
Sam bobroff [Fri, 10 Apr 2015 04:16:48 +0000 (14:16 +1000)]
selftests/powerpc: Move get_auxv_entry() to harness.c

Move get_auxv_entry() from pmu/lib.c up to harness.c in order to make
it available to other tests.

Signed-off-by: Sam Bobroff <sam.bobroff@au1.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
9 years agopowerpc/tm: Abort syscalls in active transactions
Sam bobroff [Fri, 10 Apr 2015 04:16:47 +0000 (14:16 +1000)]
powerpc/tm: Abort syscalls in active transactions

This patch changes the syscall handler to doom (tabort) active
transactions when a syscall is made and return immediately without
performing the syscall.

Currently, the system call instruction automatically suspends an
active transaction which causes side effects to persist when an active
transaction fails.

This does change the kernel's behaviour, but in a way that was
documented as unsupported. It doesn't reduce functionality because
syscalls will still be performed after tsuspend. It also provides a
consistent interface and makes the behaviour of user code
substantially the same across powerpc and platforms that do not
support suspended transactions (e.g. x86 and s390).

Performance measurements using
http://ozlabs.org/~anton/junkcode/null_syscall.c
indicate the cost of a system call increases by about 0.5%.

Signed-off-by: Sam Bobroff <sam.bobroff@au1.ibm.com>
Acked-By: Michael Neuling <mikey@neuling.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
9 years agopowerpc: dart_iommu: Remove check for controller_ops == NULL case
Daniel Axtens [Tue, 31 Mar 2015 05:00:57 +0000 (16:00 +1100)]
powerpc: dart_iommu: Remove check for controller_ops == NULL case

Now that we have ported the calls to iommu_init_early_dart to always
supply a pci_controller_ops struct, we can safely drop the check.

Signed-off-by: Daniel Axtens <dja@axtens.net>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
9 years agopowerpc: Remove shims for pci_controller_ops operations
Daniel Axtens [Tue, 31 Mar 2015 05:00:56 +0000 (16:00 +1100)]
powerpc: Remove shims for pci_controller_ops operations

Remove shims, patch callsites to use pci_controller_ops
versions instead.

Also move back the probe mode defines, as explained in the patch
for pci_probe_mode.

Signed-off-by: Daniel Axtens <dja@axtens.net>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
9 years agopowerpc/cell: Move controller ops from ppc_md to controller_ops
Daniel Axtens [Tue, 31 Mar 2015 05:00:55 +0000 (16:00 +1100)]
powerpc/cell: Move controller ops from ppc_md to controller_ops

This moves the Cell platform to use the pci_controller_ops
structure rather than ppc_md for PCI controller operations.

Signed-off-by: Daniel Axtens <dja@axtens.net>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
9 years agopowerpc: fsl_pci, swiotlb: Move controller ops from ppc_md to controller_ops
Daniel Axtens [Fri, 10 Apr 2015 03:15:47 +0000 (13:15 +1000)]
powerpc: fsl_pci, swiotlb: Move controller ops from ppc_md to controller_ops

Move the installation of DMA operations out of swiotlb's subsys
initcall, and into the generic PCI controller operations struct.

These ops are installed conditionally, based on the ppc_swiotlb_enable
global. The global can be set in two places:
 - swiotlb_detect_4g, which is always called at the arch initcall level
 - setup_pci_atmu, which is called as part of the fsl_add_bridge and
fsl_pci_syscore_do_resume.

fsl_pci_syscore_do_resume is called late enough that any changes as a
result of that call will have no effect.

As such, if we test the global and set the operations as part of
fsl_add_bridge, after the call to setup_pci_atmu, we can be confident
that it will cover all the PCI implementations affected by the changes
to dma-swiotlb.c.

Signed-off-by: Daniel Axtens <dja@axtens.net>
Acked-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
9 years agopowerpc/maple: Move controller ops from ppc_md to controller_ops
Daniel Axtens [Tue, 31 Mar 2015 05:00:53 +0000 (16:00 +1100)]
powerpc/maple: Move controller ops from ppc_md to controller_ops

This moves the Maple platform to use the pci_controller_ops
structure rather than ppc_md for PCI controller operations.

Signed-off-by: Daniel Axtens <dja@axtens.net>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
9 years agopowerpc/pasemi: Move controller ops from ppc_md to controller_ops
Daniel Axtens [Tue, 31 Mar 2015 05:00:52 +0000 (16:00 +1100)]
powerpc/pasemi: Move controller ops from ppc_md to controller_ops

This moves the PaSemi platform to use the pci_controller_ops
structure rather than ppc_md for PCI controller operations.

Signed-off-by: Daniel Axtens <dja@axtens.net>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
9 years agopowerpc/powernv: Move controller ops from ppc_md to controller_ops
Daniel Axtens [Tue, 31 Mar 2015 05:00:51 +0000 (16:00 +1100)]
powerpc/powernv: Move controller ops from ppc_md to controller_ops

This moves the PowerNV platform to use the pci_controller_ops
structure rather than ppc_md for PCI controller operations.

Signed-off-by: Daniel Axtens <dja@axtens.net>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
9 years agopowerpc/pseries: Move controller ops from ppc_md to controller_ops
Daniel Axtens [Tue, 31 Mar 2015 05:00:50 +0000 (16:00 +1100)]
powerpc/pseries: Move controller ops from ppc_md to controller_ops

This moves the pSeries platform to use the pci_controller_ops structure,
rather than ppc_md for PCI controller operations.

Signed-off-by: Daniel Axtens <dja@axtens.net>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
9 years agopowerpc/powermac: Move controller ops from ppc_md to controller_ops
Daniel Axtens [Tue, 31 Mar 2015 05:00:49 +0000 (16:00 +1100)]
powerpc/powermac: Move controller ops from ppc_md to controller_ops

This moves the Power Mac platform to use the pci_controller_ops
structure rather than ppc_md for PCI controller operations.

Signed-off-by: Daniel Axtens <dja@axtens.net>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
9 years agopowerpc: dart_iommu: optionally populate controller_ops on init
Daniel Axtens [Tue, 31 Mar 2015 05:00:48 +0000 (16:00 +1100)]
powerpc: dart_iommu: optionally populate controller_ops on init

If a pci_controller_ops struct is provided to iommu_init_early_dart,
populate that with the DMA setup ops, rather than ppc_md. If NULL is
provided, populate ppc_md as before.

This also patches the call sites for Maple and Power Mac to pass
NULL, so existing behaviour is preserved.

The benefit of making this optional is that it means we don't have
to change dart, Maple and Power Mac over to the controller_ops
system in one fell swoop.

Signed-off-by: Daniel Axtens <dja@axtens.net>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
9 years agopowerpc: Create pci_controller_ops.reset_secondary_bus and shim
Daniel Axtens [Tue, 31 Mar 2015 05:00:47 +0000 (16:00 +1100)]
powerpc: Create pci_controller_ops.reset_secondary_bus and shim

Add pci_controller_ops.reset_secondary_bus,
shadowing ppc_md.pcibios_reset_secondary_bus.
Add a shim, and changes the callsites to use the shim.

Use pcibios_reset_secondary_bus_shim, as both
pcibios_reset_secondary_bus and pci_reset_secondary_bus
are already taken.

Signed-off-by: Daniel Axtens <dja@axtens.net>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
9 years agopowerpc: Create pci_controller_ops.window_alignment and shim
Daniel Axtens [Tue, 31 Mar 2015 05:00:46 +0000 (16:00 +1100)]
powerpc: Create pci_controller_ops.window_alignment and shim

Add pci_controller_ops.window_alignment,
shadowing ppc_md.pcibios_window_alignment.
Add a shim, and changes the callsites to use the shim.

Here, we use pci_window_alignment, as pcibios_window_alignment is
already taken.

Signed-off-by: Daniel Axtens <dja@axtens.net>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
9 years agopowerpc: Create pci_controller_ops.enable_device_hook and shim
Daniel Axtens [Tue, 31 Mar 2015 05:00:45 +0000 (16:00 +1100)]
powerpc: Create pci_controller_ops.enable_device_hook and shim

Add pci_controller_ops.enable_device_hook,
shadowing ppc_md.pcibios_enable_device_hook.
Add a shim, and changes the callsites to use the shim.

Signed-off-by: Daniel Axtens <dja@axtens.net>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
9 years agopowerpc: Create pci_controller_ops.probe_mode and shim
Daniel Axtens [Tue, 31 Mar 2015 05:00:44 +0000 (16:00 +1100)]
powerpc: Create pci_controller_ops.probe_mode and shim

Add pci_controller_ops.probe_mode, shadowing ppc_md.pci_probe_mode.
Add a shim, and changes the callsites to use the shim.

We also need to move the probe mode defines to pci-bridge.h from pci.h.
They are required by the shim in order to return a sensible default.
Previously, the were defined in pci.h, but pci.h includes pci-bridge.h
before the relevant #defines. This means the definitions are absent
if pci.h is included before pci-bridge.h. This occurs in some drivers.
So, move the definitons now, and move them back when we remove the shim.

Anything that wants the defines would have had to include pci.h, and
since pci.h includes pci-bridge.h, nothing will lose access to the
defines.

Signed-off-by: Daniel Axtens <dja@axtens.net>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
9 years agopowerpc: Create pci_controller_ops.dma_bus_setup and shim
Daniel Axtens [Tue, 31 Mar 2015 05:00:43 +0000 (16:00 +1100)]
powerpc: Create pci_controller_ops.dma_bus_setup and shim

Add pci_controller_ops.dma_bus_setup, shadowing ppc_md.pci_dma_bus_setup.
Add a shim, and changes the callsites to use the shim.

Signed-off-by: Daniel Axtens <dja@axtens.net>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
9 years agopowerpc: Create pci_controller_ops.dma_dev_setup and shim
Daniel Axtens [Tue, 31 Mar 2015 05:00:42 +0000 (16:00 +1100)]
powerpc: Create pci_controller_ops.dma_dev_setup and shim

Introduces the pci_controller_ops structure.
Add pci_controller_ops.dma_dev_setup, shadowing ppc_md.pci_dma_dev_setup.
Add a shim, and change the callsites to use the shim.

Signed-off-by: Daniel Axtens <dja@axtens.net>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
9 years agopowerpc: pcibios_enable_device_hook: return bool rather than int
Daniel Axtens [Tue, 31 Mar 2015 05:00:41 +0000 (16:00 +1100)]
powerpc: pcibios_enable_device_hook: return bool rather than int

pcibios_enable_device_hook returned an int. Every implementation
returned either -EINVAL or 0. The return value wasn't propagated by
the caller: any non-zero return value caused pcibios_enable_device
to return -EINVAL itself. Therefore, make the hook return a bool.

Signed-off-by: Daniel Axtens <dja@axtens.net>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
9 years agopowerpc/powermac: move pmac_pci_probe_mode from setup.c to pci.c
Daniel Axtens [Tue, 31 Mar 2015 05:00:40 +0000 (16:00 +1100)]
powerpc/powermac: move pmac_pci_probe_mode from setup.c to pci.c

Signed-off-by: Daniel Axtens <dja@axtens.net>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
9 years agopowerpc: move find_and_init_phbs() to pSeries specific code
Daniel Axtens [Tue, 31 Mar 2015 05:00:39 +0000 (16:00 +1100)]
powerpc: move find_and_init_phbs() to pSeries specific code

Previously, find_and_init_phbs() was used in both PowerNV and pSeries
setup. However, since RTAS support has been dropped from PowerNV, we
can move it into a platform-specific file.

Signed-off-by: Daniel Axtens <dja@axtens.net>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
9 years agopowerpc: Drop return value of smp_ops->probe()
Michael Ellerman [Sat, 4 Apr 2015 08:28:50 +0000 (19:28 +1100)]
powerpc: Drop return value of smp_ops->probe()

smp_ops->probe() is currently supposed to return the number of cpus in
the system.

The last actual usage of the value was removed in May 2007 in e147ec8f1808
"[POWERPC] Simplify smp_space_timers". We still passed the value around
until June 2010 when even that was finally removed in c1aa687d499a
"powerpc: Clean up obsolete code relating to decrementer and timebase".

So drop that requirement, probe() now returns void, and update all
implementations.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
9 years agopowerpc/cell: Fix cell iommu after it_page_shift changes
Michael Ellerman [Fri, 3 Apr 2015 03:11:54 +0000 (14:11 +1100)]
powerpc/cell: Fix cell iommu after it_page_shift changes

The patch to add it_page_shift incorrectly changed the increment of
uaddr to use it_page_shift, rather then (1 << it_page_shift).

This broke booting on at least some Cell blades, as the iommu was
basically non-functional.

Fixes: 3a553170d35d ("powerpc/iommu: Add it_page_shift field to determine iommu page size")
Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
9 years agopowerpc/cell: Fix crash in iic_setup_cpu() after per_cpu changes
Michael Ellerman [Fri, 3 Apr 2015 03:11:53 +0000 (14:11 +1100)]
powerpc/cell: Fix crash in iic_setup_cpu() after per_cpu changes

The conversion from __get_cpu_var() to this_cpu_ptr() in iic_setup_cpu()
is wrong. It causes an oops at boot.

We need the per-cpu address of struct cpu_iic, not cpu_iic.regs->prio.

Sparse noticed this, because we pass a non-iomem pointer to out_be64(),
but we obviously don't check the sparse results often enough.

Fixes: 69111bac42f5 ("powerpc: Replace __get_cpu_var uses")
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
9 years agopowerpc: Reword the "returning from prom_init" message
Michael Ellerman [Mon, 30 Mar 2015 06:38:09 +0000 (17:38 +1100)]
powerpc: Reword the "returning from prom_init" message

We get way too many bug reports that say "the kernel is hung in
prom_init", which stems from the fact that the last piece of output
people see is "returning from prom_init".

The kernel is almost never hung in prom_init(), it's just that it's
crashed somewhere after prom_init() but prior to the console coming up.

The existing message should give a clue to that, ie. "returning from"
indicates that prom_init() has finished, but it doesn't seem to work.
Let's try something different.

This prints:

  Quiescing Open Firmware ...
  Booting Linux via __start() ...

Which hopefully makes it clear that prom_init() is not the problem, and
although __start() probably isn't either, it's at least the right place
to begin looking.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Wistfully-Acked-by: Jeremy Kerr <jk@ozlabs.org>
9 years agopowerpc: Replace mem_init_done with slab_is_available()
Michael Ellerman [Mon, 30 Mar 2015 03:10:37 +0000 (14:10 +1100)]
powerpc: Replace mem_init_done with slab_is_available()

We have a powerpc specific global called mem_init_done which is "set on
boot once kmalloc can be called".

But that's not *quite* true. We set it at the bottom of mem_init(), and
rely on the fact that mm_init() calls kmem_cache_init() immediately
after that, and nothing is running in parallel.

So replace it with the generic and 100% correct slab_is_available().

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
9 years agopowerpc: Fix compile errors with STRICT_MM_TYPECHECKS enabled
Michael Ellerman [Wed, 25 Mar 2015 09:11:57 +0000 (20:11 +1100)]
powerpc: Fix compile errors with STRICT_MM_TYPECHECKS enabled

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
[mpe: Fix the 32-bit code also]
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
9 years agopowerpc/mm: Change setbat() to take a pgprot_t rather than flags
Michael Ellerman [Wed, 25 Mar 2015 09:11:55 +0000 (20:11 +1100)]
powerpc/mm: Change setbat() to take a pgprot_t rather than flags

The callers of setbat() are actually passing a pgprot_t for the flags
parameter. This doesn't matter unless STRICT_MM_TYPECHECKS is enabled.
So we can turn that on without breaking the build, change setbat() to
take a pgprot_t and have it convert it to an unsigned long internally.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
9 years agopowerpc/mm: Remove duplicate declaration of setbat()
Michael Ellerman [Wed, 25 Mar 2015 09:11:54 +0000 (20:11 +1100)]
powerpc/mm: Remove duplicate declaration of setbat()

This is already declared in mmu_decl.h, so we don't need a second
version in the C file.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
9 years agopowerpc: Remove the celleb support
Michael Ellerman [Thu, 19 Mar 2015 04:15:20 +0000 (15:15 +1100)]
powerpc: Remove the celleb support

The celleb code has seen no actual development for ~7 years.

We (maintainers) have no access to test hardware, and it is highly
likely the code has bit-rotted.

As far as we're aware the hardware was never widely available, and is
certainly no longer available, and no one on the list has shown any
interest in it over the years.

So remove it. If anyone has one and cares please speak up.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Acked-by: Jeremy Kerr <jk@ozlabs.org>
9 years agopowerpc/powernv: Remove powernv RTAS support
Michael Ellerman [Thu, 12 Mar 2015 06:27:11 +0000 (17:27 +1100)]
powerpc/powernv: Remove powernv RTAS support

The powernv code has some conditional support for running on bare metal
machines that have no OPAL firmware, but provide RTAS.

No released machines ever supported that, and even in the lab it was
just a transitional hack in the days when OPAL was still being
developed.

So remove the code.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Acked-by: Stewart Smith <stewart@linux.vnet.ibm.com>
9 years agoMerge branch 'next-remove-ldst' of git://git.kernel.org/pub/scm/linux/kernel/git...
Michael Ellerman [Tue, 7 Apr 2015 03:25:14 +0000 (13:25 +1000)]
Merge branch 'next-remove-ldst' of git://git./linux/kernel/git/benh/powerpc into next

9 years agoMerge branch 'next-eeh' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc...
Michael Ellerman [Tue, 7 Apr 2015 03:24:55 +0000 (13:24 +1000)]
Merge branch 'next-eeh' of git://git./linux/kernel/git/benh/powerpc into next

9 years agoMerge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/scottwood/linux...
Michael Ellerman [Tue, 7 Apr 2015 03:07:42 +0000 (13:07 +1000)]
Merge branch 'next' of git://git./linux/kernel/git/scottwood/linux into next

Freescale updates from Scott:

"Highlights include BMan device tree nodes, an MSI erratum workaround, a
couple minor performance improvements, config updates, and misc
fixes/cleanup."

9 years agopowerpc/corenet: enable CONFIG_I2C_MUX and CONFIG_I2C_MUX_PCA954x
Shengzhou Liu [Fri, 27 Mar 2015 10:45:35 +0000 (18:45 +0800)]
powerpc/corenet: enable CONFIG_I2C_MUX and CONFIG_I2C_MUX_PCA954x

By default we enable CONFIG_I2C_MUX and CONFIG_I2C_MUX_PCA954x,
which are needed on T2080QDS, T4240QDS, B4860QDS, etc.

Signed-off-by: Shengzhou Liu <Shengzhou.Liu@freescale.com>
[scottwood@freescale.com: fixed subject line]
Signed-off-by: Scott Wood <scottwood@freescale.com>
9 years agopowerpc/t2080qds: fix rtc interrupt
Shengzhou Liu [Fri, 27 Mar 2015 10:49:17 +0000 (18:49 +0800)]
powerpc/t2080qds: fix rtc interrupt

RTC interrupt uses IRQ11 on T2080QDS.

Signed-off-by: Shengzhou Liu <Shengzhou.Liu@freescale.com>
[scottwood@freescale.com: fix subject line]
Signed-off-by: Scott Wood <scottwood@freescale.com>
9 years agopowerpc/mpic: Remove WHOAMI readback after EOI
Bogdan Purcareata [Tue, 24 Mar 2015 10:43:43 +0000 (10:43 +0000)]
powerpc/mpic: Remove WHOAMI readback after EOI

After previous discussions regarding the subject [1][2], there's no clear
explanation or reason why the call was needed in the first place. The sensible
argument is some sort of synchronization between the CPU and the MPIC, which
hasn't been pointed out precisely and is no longer required (at least on BookE
platforms).

The benefit of this change is saving a MMIO trap per interrupt when running in a
KVM guest.

[1] https://patchwork.ozlabs.org/patch/429098/
[2] https://patchwork.ozlabs.org/patch/433557/

Signed-off-by: Bogdan Purcareata <bogdan.purcareata@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
9 years agopowerpc/mpc85xx: call k(un)map_atomic rather than k(un)map
Yanjiang Jin [Mon, 2 Mar 2015 08:35:35 +0000 (16:35 +0800)]
powerpc/mpc85xx: call k(un)map_atomic rather than k(un)map

The k(un)map function may be called in atomic context in the
function map_and_flush(), so use k(un)map_atomic to replace it,
else we would get the below warning during kdump:

BUG: sleeping function called from invalid context at include/linux/highmem.h:58
in_atomic(): 1, irqs_disabled(): 1, pid: 736, name: sh
INFO: lockdep is turned off.
irq event stamp: 0
hardirqs last  enabled at (0): [<          (null)>]           (null)
hardirqs last disabled at (0): [<c000000000066d1c>] .copy_process.part.44+0x50c/0x1360
softirqs last  enabled at (0): [<c000000000066d1c>] .copy_process.part.44+0x50c/0x1360
softirqs last disabled at (0): [<          (null)>]           (null)
CPU: 1 PID: 736 Comm: sh Tainted: G      D W    3.10.62-ltsi-WR6.0.0.0_standard #2
Call Trace:
[c0000000f47cf120] [c00000000000b150] .show_stack+0x170/0x290 (unreliable)
[c0000000f47cf210] [c000000000b71334] .dump_stack+0x28/0x3c
[c0000000f47cf280] [c0000000000bb5d8] .__might_sleep+0x1a8/0x270
[c0000000f47cf310] [c0000000000440cc] .map_and_flush+0x4c/0xc0
[c0000000f47cf390] [c0000000000441cc] .mpc85xx_smp_machine_kexec+0x8c/0xec0
[c0000000f47cf420] [c00000000002ae00] .machine_kexec+0x60/0x90
[c0000000f47cf4b0] [c00000000010957c] .crash_kexec+0x8c/0x100
[c0000000f47cf6a0] [c000000000015df8] .die+0x348/0x450
[c0000000f47cf740] [c00000000002f3a0] .bad_page_fault+0xe0/0x130
[c0000000f47cf7c0] [c00000000001f3e4] storage_fault_common+0x40/0x44

Signed-off-by: Yanjiang Jin <yanjiang.jin@windriver.com>
[scottwood@freescale.com: fix subject line]
Signed-off-by: Scott Wood <scottwood@freescale.com>
9 years agopowerpc: don't export static symbol
Julia Lawall [Wed, 11 Mar 2015 16:56:24 +0000 (17:56 +0100)]
powerpc: don't export static symbol

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

// <smpl>
@r@
type T;
identifier f;
@@

static T f (...) { ... }

@@
identifier r.f;
declarer name EXPORT_SYMBOL;
@@

-EXPORT_SYMBOL(f);
// </smpl>

Furthermore, the function is never used, so its definition is dropped as
well.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Scott Wood <scottwood@freescale.com>
9 years agopowerpc: book3e_64: fix the align size for paca_struct
Kevin Hao [Tue, 10 Mar 2015 12:41:31 +0000 (20:41 +0800)]
powerpc: book3e_64: fix the align size for paca_struct

All the cache line size of the current book3e 64bit SoCs are 64 bytes.
So we should use this size to align the member of paca_struct.
This only change the paca_struct's members which are private to book3e
CPUs, and should not have any effect to book3s ones. With this, we save
192 bytes. Also change it to __aligned(size) since it is preferred over
__attribute__((aligned(size))).

Before:
/* size: 1920, cachelines: 30, members: 46 */
/* sum members: 1667, holes: 6, sum holes: 141 */
/* padding: 112 */

After:
/* size: 1728, cachelines: 27, members: 46 */
/* sum members: 1667, holes: 4, sum holes: 13 */
/* padding: 48 */

Signed-off-by: Kevin Hao <haokexin@gmail.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
9 years agopowerpc/fsl-booke: Add T4080 SVR value
Madalin Bucur [Tue, 10 Mar 2015 13:19:42 +0000 (15:19 +0200)]
powerpc/fsl-booke: Add T4080 SVR value

Signed-off-by: Madalin Bucur <madalin.bucur@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
9 years agopowerpc32/chrp: fix section mismatch warning
LEROY Christophe [Mon, 8 Dec 2014 14:16:44 +0000 (15:16 +0100)]
powerpc32/chrp: fix section mismatch warning

This patch fixes a section mismatch warning

WARNING: vmlinux.o(.text+0x213b6): Section mismatch in reference from the function chrp_init_early() to the variable .init.data:boot_command_line
The function chrp_init_early() references
the variable __initdata boot_command_line.
This is often because chrp_init_early lacks a __initdata
annotation or the annotation of boot_command_line is wrong.

Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
9 years agopowerpc/powernv: handle OPAL_SUCCESS return in opal_sensor_read
Cédric Le Goater [Mon, 30 Mar 2015 10:06:10 +0000 (12:06 +0200)]
powerpc/powernv: handle OPAL_SUCCESS return in opal_sensor_read

Currently, when a sensor value is read, the kernel calls OPAL, which in
turn builds a message for the FSP, and waits for a message back.

The new device tree for OPAL sensors [1] adds new sensors that can be
read synchronously (core temperatures for instance) and that don't need
to wait for a response.

This patch modifies the opal call to accept an OPAL_SUCCESS return value
and cover the case above.

[1] https://lists.ozlabs.org/pipermail/skiboot/2015-March/000639.html

Signed-off-by: Cédric Le Goater <clg@fr.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
9 years agopowerpc/powernv: convert codes returned by OPAL calls
Cédric Le Goater [Mon, 30 Mar 2015 10:06:09 +0000 (12:06 +0200)]
powerpc/powernv: convert codes returned by OPAL calls

OPAL has its own list of return codes. The patch provides a translation
of such codes in errnos for the opal_sensor_read call, and possibly
others if needed.

Signed-off-by: Cédric Le Goater <clg@fr.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
9 years agopowerpc: Use bool function return values of true/false not 1/0
Joe Perches [Mon, 30 Mar 2015 23:46:04 +0000 (16:46 -0700)]
powerpc: Use bool function return values of true/false not 1/0

Use the normal return values for bool functions

Signed-off-by: Joe Perches <joe@perches.com>
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
9 years agopowerpc/powernv: Don't map M64 segments using M32DT
Gavin Shan [Fri, 27 Mar 2015 00:29:00 +0000 (11:29 +1100)]
powerpc/powernv: Don't map M64 segments using M32DT

If M64 has been supported, the prefetchable 64-bits memory resources
shouldn't be mapped to the corresponding PE# via M32DT. Unfortunately,
we're doing that in pnv_ioda_setup_pe_seg() wrongly. The issue was
introduced by commit 262af55 ("powerpc/powernv: Enable M64 aperatus
for PHB3"). The patch fixes the issue by simply skipping M64 resources
when updating to M32DT.

Cc: <stable@vger.kernel.org> # v3.17+
Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
9 years agopowerpc/eeh: Fix PE#0 check in eeh_add_to_parent_pe()
Gavin Shan [Fri, 27 Mar 2015 00:22:17 +0000 (11:22 +1100)]
powerpc/eeh: Fix PE#0 check in eeh_add_to_parent_pe()

The function eeh_add_parent_pe() is used to create a PE or add one
edev to its parent PE. Current code checks if PE#0 is valid for the
later case. Actually, we should validate PE#0 for both cases when
EEH core regards PE#0 as invalid one (without flag EEH_VALID_PE_ZERO).
Otherwise, not all EEH devices can be added to its parent PE#0 for
EEH on P7IOC.

The patch fixes the issue by validating PE#0 for the two cases. So far,
we don't have PE#0 for EEH on P7IOC, but it will show up when we enable
M64 for P7IOC. The patch also makes the error message more meaningful.

Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
9 years agoselftests/powerpc: Add a test of the switch_endian() syscall
Michael Ellerman [Sat, 28 Mar 2015 10:35:17 +0000 (21:35 +1100)]
selftests/powerpc: Add a test of the switch_endian() syscall

This adds a test of the switch_endian() syscall we added in the previous
commit.

We test it by calling the endian switch syscall, and then executing some
code in the other endian to check everything went as expected. That code
checks registers we expect to be maintained are. If the endian switch
failed to happen that code sequence will be illegal and cause the test
to abort.

We then switch back to the original endian, do the same checks and
finally write a success message and exit(0).

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
9 years agopowerpc: Add a proper syscall for switching endianness
Michael Ellerman [Sat, 28 Mar 2015 10:35:16 +0000 (21:35 +1100)]
powerpc: Add a proper syscall for switching endianness

We currently have a "special" syscall for switching endianness. This is
syscall number 0x1ebe, which is handled explicitly in the 64-bit syscall
exception entry.

That has a few problems, firstly the syscall number is outside of the
usual range, which confuses various tools. For example strace doesn't
recognise the syscall at all.

Secondly it's handled explicitly as a special case in the syscall
exception entry, which is complicated enough without it.

As a first step toward removing the special syscall, we need to add a
regular syscall that implements the same functionality.

The logic is simple, it simply toggles the MSR_LE bit in the userspace
MSR. This is the same as the special syscall, with the caveat that the
special syscall clobbers fewer registers.

This version clobbers r9-r12, XER, CTR, and CR0-1,5-7.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
9 years agopowerpc/pseries: Simplify check for suspendability during suspend/migration
Tyrel Datwyler [Fri, 27 Mar 2015 19:47:25 +0000 (12:47 -0700)]
powerpc/pseries: Simplify check for suspendability during suspend/migration

During suspend/migration operation we must wait for the VASI state reported
by the hypervisor to become Suspending prior to making the ibm,suspend-me
RTAS call. Calling routines to rtas_ibm_supend_me() pass a vasi_state variable
that exposes the VASI state to the caller. This is unnecessary as the caller
only really cares about the following three conditions; if there is an error
we should bailout, success indicating we have suspended and woken back up so
proceed to device tree update, or we are not suspendable yet so try calling
rtas_ibm_suspend_me again shortly.

This patch removes the extraneous vasi_state variable and simply uses the
return code to communicate how to proceed. We either succeed, fail, or get
-EAGAIN in which case we sleep for a second before trying to call
rtas_ibm_suspend_me again. The behaviour of ppc_rtas() remains the same,
but migrate_store() now returns the propogated error code on failure.
Previously -1 was returned from migrate_store() in the  failure case which
equates to -EPERM and was clearly wrong.

Signed-off-by: Tyrel Datwyler <tyreld@linux.vnet.ibm.com>
Cc: Nathan Fontenont <nfont@linux.vnet.ibm.com>
Cc: Cyril Bur <cyrilbur@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
9 years agocxl: Fix a typo in ABI documentation
Philippe Bergheaud [Thu, 26 Mar 2015 10:46:56 +0000 (11:46 +0100)]
cxl: Fix a typo in ABI documentation

Fix the attribute name of the configuration record class ID.

Signed-off-by: Philippe Bergheaud <felix@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
9 years agopowerpc/perf: add missing put_cpu_var in power_pmu_event_init
Jan Stancek [Tue, 24 Mar 2015 12:33:22 +0000 (08:33 -0400)]
powerpc/perf: add missing put_cpu_var in power_pmu_event_init

One path in power_pmu_event_init() calls get_cpu_var(), but is
missing matching call to put_cpu_var(), which causes preemption
imbalance and crash in user-space:

  Page fault in user mode with in_atomic() = 1 mm = c000001fefa5a280
  NIP = 3fff9bf2cae0  MSR = 900000014280f032
  Oops: Weird page fault, sig: 11 [#23]
  SMP NR_CPUS=2048 NUMA PowerNV
  Modules linked in: <snip>
  CPU: 43 PID: 10285 Comm: a.out Tainted: G      D         4.0.0-rc5+ #1
  task: c000001fe82c9200 ti: c000001fe835c000 task.ti: c000001fe835c000
  NIP: 00003fff9bf2cae0 LR: 00003fff9bee4898 CTR: 00003fff9bf2cae0
  REGS: c000001fe835fea0 TRAP: 0401   Tainted: G      D          (4.0.0-rc5+)
  MSR: 900000014280f032 <SF,HV,VEC,VSX,EE,PR,FP,ME,IR,DR,RI>  CR: 22000028  XER: 00000000
  CFAR: 00003fff9bee4894 SOFTE: 1
   GPR00: 00003fff9bee494c 00003fffe01c2ee0 00003fff9c084410 0000000010020068
   GPR04: 0000000000000000 0000000000000002 0000000000000008 0000000000000001
   GPR08: 0000000000000001 00003fff9c074a30 00003fff9bf2cae0 00003fff9bf2cd70
   GPR12: 0000000052000022 00003fff9c10b700
  NIP [00003fff9bf2cae0] 0x3fff9bf2cae0
  LR [00003fff9bee4898] 0x3fff9bee4898
  Call Trace:
  ---[ end trace 5d3d952b5d4185d4 ]---

  BUG: sleeping function called from invalid context at kernel/locking/rwsem.c:41
  in_atomic(): 1, irqs_disabled(): 0, pid: 10285, name: a.out
  INFO: lockdep is turned off.
  CPU: 43 PID: 10285 Comm: a.out Tainted: G      D         4.0.0-rc5+ #1
  Call Trace:
  [c000001fe835f990] [c00000000089c014] .dump_stack+0x98/0xd4 (unreliable)
  [c000001fe835fa10] [c0000000000e4138] .___might_sleep+0x1d8/0x2e0
  [c000001fe835faa0] [c000000000888da8] .down_read+0x38/0x110
  [c000001fe835fb30] [c0000000000bf2f4] .exit_signals+0x24/0x160
  [c000001fe835fbc0] [c0000000000abde0] .do_exit+0xd0/0xe70
  [c000001fe835fcb0] [c00000000001f4c4] .die+0x304/0x450
  [c000001fe835fd60] [c00000000088e1f4] .do_page_fault+0x2d4/0x900
  [c000001fe835fe30] [c000000000008664] handle_page_fault+0x10/0x30
  note: a.out[10285] exited with preempt_count 1

Reproducer:
  #include <stdio.h>
  #include <unistd.h>
  #include <syscall.h>
  #include <sys/types.h>
  #include <sys/stat.h>
  #include <linux/perf_event.h>
  #include <linux/hw_breakpoint.h>

  static struct perf_event_attr event = {
          .type = PERF_TYPE_RAW,
          .size = sizeof(struct perf_event_attr),
          .sample_type = PERF_SAMPLE_BRANCH_STACK,
          .branch_sample_type = PERF_SAMPLE_BRANCH_ANY_RETURN,
  };

  int main()
  {
          syscall(__NR_perf_event_open, &event, 0, -1, -1, 0);
  }

Signed-off-by: Jan Stancek <jstancek@redhat.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
9 years agoMerge branch 'next-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerp...
Michael Ellerman [Thu, 26 Mar 2015 09:03:16 +0000 (20:03 +1100)]
Merge branch 'next-misc' of git://git./linux/kernel/git/benh/powerpc into test

Merge miscellaneous bits from benh. Fix a minor conflict with
OpalMessageType changing names to opal_msg_type.

9 years agopowerpc/powernv: Avoid explicit endian conversions while parsing device tree
Preeti U Murthy [Tue, 3 Feb 2015 06:43:44 +0000 (12:13 +0530)]
powerpc/powernv: Avoid explicit endian conversions while parsing device tree

We currently read the information about idle states from the device
tree, so as to find out the CPU idle states supported by the platform.

Use the of_property_read/count_xxx() APIs, which handle endian
conversions for us, and mean we don't need any endian annotations in the
code.

Signed-off-by: Preeti U Murthy <preeti@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
9 years agops3: Fix trivial typos in comment and debug message
Yannick Guerrini [Sat, 7 Mar 2015 12:03:36 +0000 (13:03 +0100)]
ps3: Fix trivial typos in comment and debug message

Change 'prosessor' to 'processor'
Change 'set_inteval' to 'set_interval'

Signed-off-by: Yannick Guerrini <yguerrini@tomshardware.fr>
Acked-by: Geoff Levand <geoff@infradead.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
9 years agopowerpc/mm: Free string after creating kmem cache
Yanjiang Jin [Fri, 27 Feb 2015 05:30:34 +0000 (13:30 +0800)]
powerpc/mm: Free string after creating kmem cache

kmem_cache_create()->kmem_cache_create_memcg()->kstrdup() allocates new
space and copys name's content, so it is safe to free name memory after
calling kmem_cache_create(). Else kmemleak will report the below
warning:

unreferenced object 0xc0000000f9002160 (size 16):
  comm "swapper/0", pid 0, jiffies 4294892296 (age 1386.640s)
  hex dump (first 16 bytes):
    70 67 74 61 62 6c 65 2d 32 5e 39 00 de ad be ef  pgtable-2^9.....
  backtrace:
    [<c0000000004e03ec>] .kvasprintf+0x5c/0xa0
    [<c0000000004e045c>] .kasprintf+0x2c/0x50
    [<c00000000002e36c>] .pgtable_cache_add+0xac/0x100
    [<c00000000002e3e4>] .pgtable_cache_init+0x24/0x80
    [<c000000000c6c67c>] .start_kernel+0x228/0x4c8
    [<c000000000000594>] .start_here_common+0x24/0x90

Signed-off-by: Yanjiang Jin <yanjiang.jin@windriver.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
9 years agopowerpc/powernv: Add OPAL message notifier unregister function
Neelesh Gupta [Wed, 11 Feb 2015 06:27:23 +0000 (11:57 +0530)]
powerpc/powernv: Add OPAL message notifier unregister function

Provide an unregister interface for the opal message notifiers
to be called when not needed like during driver unload/remove.

Signed-off-by: Neelesh Gupta <neelegup@linux.vnet.ibm.com>
Reviewed-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
9 years agopowerpc/powernv: Fix the overflow of OPAL message notifiers head array
Neelesh Gupta [Wed, 11 Feb 2015 06:27:06 +0000 (11:57 +0530)]
powerpc/powernv: Fix the overflow of OPAL message notifiers head array

Fixes the condition check of incoming message type which can
otherwise shoot beyond the message notifiers head array.

Signed-off-by: Neelesh Gupta <neelegup@linux.vnet.ibm.com>
Reviewed-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
Reviewed-by: Anshuman Khandual <khandual@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
9 years agopowerpc/pmac: replace current->state by set_current_state()
Fabian Frederick [Fri, 20 Feb 2015 18:12:53 +0000 (19:12 +0100)]
powerpc/pmac: replace current->state by set_current_state()

Use helper functions to access current->state.
Direct assignments are prone to races and therefore buggy.

current->state = TASK_RUNNING can be replaced by __set_current_state()

Thanks to Peter Zijlstra for the exact definition of the problem.

Suggested-By: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Fabian Frederick <fabf@skynet.be>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
9 years agocpufreq/ppc: Add missing #include <asm/smp.h>
Geert Uytterhoeven [Wed, 4 Mar 2015 11:56:20 +0000 (12:56 +0100)]
cpufreq/ppc: Add missing #include <asm/smp.h>

If CONFIG_SMP=n, <linux/smp.h> does not include <asm/smp.h>, causing:

drivers/cpufreq/ppc-corenet-cpufreq.c: In function 'corenet_cpufreq_cpu_init':
drivers/cpufreq/ppc-corenet-cpufreq.c:173:3: error: implicit declaration of function 'get_hard_smp_processor_id' [-Werror=implicit-funcuresh E. Warrier" <warrier@linux.vnet.ibm.com>
X-Patchwork-Id: 443703
Message-Id: <54EE5989.7010800@linux.vnet.ibm.com>
To: linuxppc-dev@ozlabs.org
Date: Wed, 25 Feb 2015 17:23:53 -0600

Export __spin_yield so that the arch_spin_unlock() function can
be invoked from a module. This will be required for modules where
we want to take a lock that is also is acquired in hypervisor
real mode. Because we want to avoid running any lockdep code
(which may not be safe in real mode), this lock needs to be
an arch_spinlock_t instead of a normal spinlock.

Signed-off-by: Suresh Warrier <warrier@linux.vnet.ibm.com>
Acked-by: Paul Mackerras <paulus@samba.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
9 years agopowerpc/pmac: Fix DT refcount imbalance in pmac_pic_probe_oldstyle
Geert Uytterhoeven [Tue, 3 Mar 2015 10:02:15 +0000 (11:02 +0100)]
powerpc/pmac: Fix DT refcount imbalance in pmac_pic_probe_oldstyle

Internally, of_find_node_by_name() calls of_node_put() on its "from"
parameter, which must not be done on "master", as it's still in use, and
will be released manually later.  This may cause a zero kref refcount.

Call of_node_get() before to compensate for this.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
9 years agodrivers/macintosh: Delete an unnecessary check before the function call "of_node_put"
Markus Elfring [Wed, 4 Feb 2015 20:32:27 +0000 (21:32 +0100)]
drivers/macintosh: Delete an unnecessary check before the function call "of_node_put"

The of_node_put() function tests whether its argument is NULL and then
returns immediately. Thus the test around the call is not needed.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
9 years agopowerpc/powernv: Support OPAL requested heartbeat
Benjamin Herrenschmidt [Fri, 14 Nov 2014 05:13:50 +0000 (16:13 +1100)]
powerpc/powernv: Support OPAL requested heartbeat

If OPAL requests it, call it back via opal_poll_events() at a
regular interval. Some versions of OPAL on some machines require
this to operate some internal timeouts properly.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
9 years agopowerpc/powernv: Check image loaded or not before calling flash
Vasant Hegde [Fri, 13 Feb 2015 09:56:33 +0000 (15:26 +0530)]
powerpc/powernv: Check image loaded or not before calling flash

Present code checks for update_flash_data in opal_flash_term_callback().
update_flash_data has been statically initialized to zero, and that
is the value of FLASH_IMG_READY. Also code update initialization happens
during subsys init.

So if reboot is issued before the subsys init stage then we endup displaying
"Flashing new firmware" message.. which may confuse end user.

This patch fixes above described issue by initializes update_flash status
to invalid state.

Reported-by: Sam Bobroff <sam.bobroff@au1.ibm.com>
Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
9 years agopowerpc: Remove unused st_le*() and ld_le* functions
David Gibson [Tue, 3 Feb 2015 05:36:25 +0000 (16:36 +1100)]
powerpc: Remove unused st_le*() and ld_le* functions

The powerpc specific st_le*() and ld_le*() functions in
arch/powerpc/asm/swab.h no longer have any users.  They are also
misleadingly named, since they always byteswap, even on a little-endian
host.

This patch removes them.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
9 years agopowerpc: Cleanup KVM emulated load/store endian handling
David Gibson [Tue, 3 Feb 2015 05:36:24 +0000 (16:36 +1100)]
powerpc: Cleanup KVM emulated load/store endian handling

Sometimes the KVM code on powerpc needs to emulate load or store
instructions from the guest, which can include both normal and byte
reversed forms.

We currently (AFAICT) handle this correctly, but some variable names are
very misleading.  In particular we use "is_bigendian" in several places to
actually mean "is the IO the same endian as the host", but we now support
little-endian powerpc hosts.  This also ties into the misleadingly named
ld_le*() and st_le*() functions, which in fact always byteswap, even on
an LE host.

This patch cleans this up by renaming to more accurate "host_swabbed", and
uses the generic swab*() functions instead of the powerpc specific and
misleadingly named ld_le*() and st_le*() functions.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
9 years agopowerpc: Remove arch specific byteswappers from the MXC MMC driver
David Gibson [Tue, 3 Feb 2015 05:36:23 +0000 (16:36 +1100)]
powerpc: Remove arch specific byteswappers from the MXC MMC driver

When the MXC MMUC driver is used on a Freescale MPC512x machine, it
contains some additional byteswapping code (I'm assuming this is a
workaround for a hardware defect).  This uses the ppc specific st_le32()
function, but there's no reason not to use the generic swab32() function
instead.  gcc is capable of generating the efficient ppc byte-reversing
load/store instructions without the arch-specific helper.

This patch, therefore, switches to the generic byteswap routine.

Cc: Shawn Guo <shawn.guo@linaro.org>
Cc: Sascha Hauer <kernel@pengutronix.de>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
9 years agomedia/bt8xx: Remove old powerpc cruft
Benjamin Herrenschmidt [Tue, 24 Mar 2015 02:32:03 +0000 (13:32 +1100)]
media/bt8xx: Remove old powerpc cruft

The powerpc arch code enables PCI_COMMAND_MEMORY (and has done so for
more than 10 years at least !) on pci_enable_device() and the hackery
on the MMIO accessor is useless as well, our writel does everything
this driver should need.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
9 years agopowerpc/eeh: Remove device_node dependency
Gavin Shan [Tue, 17 Mar 2015 05:15:08 +0000 (16:15 +1100)]
powerpc/eeh: Remove device_node dependency

The patch removes struct eeh_dev::dn and the corresponding helper
functions: eeh_dev_to_of_node() and of_node_to_eeh_dev(). Instead,
eeh_dev_to_pdn() and pdn_to_eeh_dev() should be used to get the
pdn, which might contain device_node on PowerNV platform.

Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
9 years agopowerpc/eeh: Replace device_node with pci_dn in eeh_ops
Gavin Shan [Tue, 17 Mar 2015 05:15:07 +0000 (16:15 +1100)]
powerpc/eeh: Replace device_node with pci_dn in eeh_ops

There are 3 EEH operations whose arguments contain device_node:
read_config(), write_config() and restore_config(). The patch
replaces device_node with pci_dn.

Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
9 years agopowerpc/eeh: Do probe on pci_dn
Gavin Shan [Tue, 17 Mar 2015 05:15:06 +0000 (16:15 +1100)]
powerpc/eeh: Do probe on pci_dn

Originally, EEH core probes on device_node or pci_dev to populate
EEH devices and PEs, which conflicts with the fact: SRIOV VFs are
usually enabled and created by PF's driver and they don't have the
corresponding device_nodes. Instead, SRIOV VFs have dynamically
created pci_dn, which can be used for EEH probe.

The patch reworks EEH probe for PowerNV and pSeries platforms to
do probing based on pci_dn, instead of pci_dev or device_node any
more.

Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
9 years agopowerpc/eeh: Create eeh_dev from pci_dn instead of device_node
Gavin Shan [Tue, 17 Mar 2015 05:15:05 +0000 (16:15 +1100)]
powerpc/eeh: Create eeh_dev from pci_dn instead of device_node

The patch adds function traverse_pci_dn(), which is similar to
traverse_pci_devices() except it takes pci_dn, not device_node
as parameter. The pci_dev.c has been reworked to create eeh_dev
from pci_dn, instead of device_node.

Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
9 years agopowerpc/pci: Trace more information from pci_dn
Gavin Shan [Tue, 17 Mar 2015 05:15:04 +0000 (16:15 +1100)]
powerpc/pci: Trace more information from pci_dn

Originally, EEH probes on device_node or pci_dev and populates the
corresponding eeh_dev. In the subsequent patches, EEH will probes
on pci_dn and populates the corresponding eeh_dev. So we have to
cache some information in pci_dn, either from device_node or SRIOV
PF's enablement platform hook, to populate the eeh_dev properly.

The motivation to probe pci_dn, instead of device node or pci_dev,
to populate eeh_dev is SRIOV VFs are dynamically created and we
don't have the corresponding device nodes for them.

Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
9 years agopowerpc/powernv: Use pci_dn, not device_node, in PCI config accessor
Gavin Shan [Tue, 17 Mar 2015 05:15:03 +0000 (16:15 +1100)]
powerpc/powernv: Use pci_dn, not device_node, in PCI config accessor

The PCI config accessors previously relied on device_node.  Unfortunately,
VFs don't have a corresponding device_node, so change the accessors to use
pci_dn instead.

[bhelgaas: changelog]
Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
9 years agopowerpc/pci: Refactor pci_dn
Gavin Shan [Tue, 17 Mar 2015 05:15:02 +0000 (16:15 +1100)]
powerpc/pci: Refactor pci_dn

Currently, the PCI config accessors are implemented based on device node.
Unfortunately, SRIOV VFs won't have the corresponding device nodes. pci_dn
will be used in replacement with device node for SRIOV VFs. So we have to
use pci_dn in PCI config accessors.

The patch refactors pci_dn in following aspects to make it ready to be used
in PCI config accessors as we do in subsequent patch:

   * pci_dn is organized as a hierarchy tree.  PCI device's pci_dn is
     put to the child list of pci_dn of its upstream bridge or PHB. VF's
     pci_dn will be put to the child list of pci_dn of PF's bridge.

   * For one particular PCI device (VF or not), its pci_dn can be
     found from pdev->dev.archdata.pci_data, PCI_DN(devnode), or
     parent's list.  The fast path (fetching pci_dn through PCI device
     instance) is populated during early fixup time.

[bhelgaas: changelog]
Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
9 years agonet/ethernet/sfc: Don't use of_node_to_eeh_dev()
Benjamin Herrenschmidt [Mon, 23 Mar 2015 03:00:47 +0000 (14:00 +1100)]
net/ethernet/sfc: Don't use of_node_to_eeh_dev()

This is deprecated, it forces the driver to hop via the OF node
that may or may not exist, instead use pci_dev_to_eeh_dev() which
is simpler.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Acked-by: Shradha Shah <sshah@solarflare.com>
9 years agopowerpc: Enable power monitor feature in defconfig for supported platforms
Hongtao Jia [Thu, 12 Mar 2015 07:00:14 +0000 (15:00 +0800)]
powerpc: Enable power monitor feature in defconfig for supported platforms

Signed-off-by: Jia Hongtao <hongtao.jia@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
9 years agopowerpc: Enable thermal monitor feature in defconfig for supported platforms
Hongtao Jia [Thu, 12 Mar 2015 07:00:13 +0000 (15:00 +0800)]
powerpc: Enable thermal monitor feature in defconfig for supported platforms

Signed-off-by: Jia Hongtao <hongtao.jia@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
9 years agopowerpc/corenet: Enable muxing MDIO buses via FPGA
Shruti Kanetkar [Fri, 27 Feb 2015 15:59:22 +0000 (09:59 -0600)]
powerpc/corenet: Enable muxing MDIO buses via FPGA

Signed-off-by: Andy Fleming <afleming@gmail.com>
Signed-off-by: Shaohui Xie <Shaohui.Xie@freescale.com>
Signed-off-by: Shruti Kanetkar <Kanetkar.Shruti@gmail.com>
Signed-off-by: Emil Medve <Emilian.Medve@Freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
9 years agopowerpc/corenet: Enable muxing MDIO buses via GPIO
Andy Fleming [Fri, 27 Feb 2015 15:57:55 +0000 (09:57 -0600)]
powerpc/corenet: Enable muxing MDIO buses via GPIO

Signed-off-by: Andy Fleming <afleming@gmail.com>
Signed-off-by: Shaohui Xie <Shaohui.Xie@freescale.com>
Signed-off-by: Shruti Kanetkar <Kanetkar.Shruti@gmail.com>
Signed-off-by: Emil Medve <Emilian.Medve@Freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
9 years agopowerpc/mpc85xx: Add FSL QorIQ DPAA BMan support to device tree(s)
Kumar Gala [Fri, 27 Feb 2015 15:16:14 +0000 (09:16 -0600)]
powerpc/mpc85xx: Add FSL QorIQ DPAA BMan support to device tree(s)

Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Signed-off-by: Geoff Thorpe <Geoff.Thorpe@freescale.com>
Signed-off-by: Hai-Ying Wang <Haiying.Wang@freescale.com>
Signed-off-by: Chunhe Lan <Chunhe.Lan@freescale.com>
Signed-off-by: Poonam Aggrwal <poonam.aggrwal@freescale.com>
[Emil Medve: Sync with the upstream binding]
Signed-off-by: Emil Medve <Emilian.Medve@Freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
9 years agopowerpc: Make corenet64_defconfig a bit more useful
Benjamin Herrenschmidt [Fri, 27 Feb 2015 03:09:37 +0000 (14:09 +1100)]
powerpc: Make corenet64_defconfig a bit more useful

CONFIG_BLK_DEV_SD, SR, ... are needed for pretty much any SATA or USB
storage device (corenet32_defconfig has them) and modern any with
systemd needs the CGROUPS gunk.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Scott Wood <scottwood@freescale.com>
9 years agopowerpc/85xx: workaround for chips with MSI hardware errata
Hongtao Jia [Thu, 26 Feb 2015 07:23:08 +0000 (15:23 +0800)]
powerpc/85xx: workaround for chips with MSI hardware errata

The MPIC version 2.0 has a MSI errata (errata PIC1 of mpc8544), It causes
that neither MSI nor MSI-X can work fine. This is a workaround to allow
MSI-X to function properly.

Signed-off-by: Liu Shuo <soniccat.liu@gmail.com>
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Jia Hongtao <hongtao.jia@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
9 years agopowerpc/mpic: Add get_version API both for internal and external use
Hongtao Jia [Wed, 10 Apr 2013 02:52:55 +0000 (10:52 +0800)]
powerpc/mpic: Add get_version API both for internal and external use

MPIC version is useful information for both mpic_alloc() and mpic_init().
The patch provide an API to get MPIC version for reusing the code.
Also, some other IP block may need MPIC version for their own use.
The API for external use is also provided.

This function had been previously added but was removed by commit
5e86bfde9cd93f2 ("powerpc/mpic: remove unused functions") due to the
lack of a user.  This function will be used by "powerpc/mpic: Add
get_version API both for internal and external use".

Signed-off-by: Jia Hongtao <hongtao.jia@freescale.com>
Signed-off-by: Li Yang <leoli@freescale.com>
[scottwood@freescale.com: changelog update]
Signed-off-by: Scott Wood <scottwood@freescale.com>
9 years agopowerpc/mpc85xx: Add FMan platform support
Igal Liberman [Wed, 18 Feb 2015 14:04:45 +0000 (16:04 +0200)]
powerpc/mpc85xx: Add FMan platform support

Get the FMan devices/sub-nodes (MAC, MDIO, etc.) auto-probed

Signed-off-by: Igal Liberman <Igal.Liberman@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
9 years agopowerpc/dts: Remove B4860 emulator support
Emil Medve [Tue, 3 Feb 2015 23:16:48 +0000 (17:16 -0600)]
powerpc/dts: Remove B4860 emulator support

Probably we should have not upstreamed this in the first place

Signed-off-by: Emil Medve <Emilian.Medve@Freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>