Commit Graph

377601 Commits

Author SHA1 Message Date
Jon Medhurst
b3792f58be Merge branch 'tracking-armlt-tc2-psci' into lsk-3.10-vexpress 2013-07-17 12:02:21 +01:00
Jon Medhurst
3138d553f9 Merge branch 'tracking-armlt-tc2-pm' into lsk-3.10-vexpress
Conflicts:
	arch/arm/mach-vexpress/Makefile
2013-07-17 12:02:16 +01:00
Jon Medhurst
08f87fd1f8 Merge branch 'tracking-armlt-dcscb' into lsk-3.10-vexpress 2013-07-17 12:02:10 +01:00
Jon Medhurst
20b22bdf99 Merge branch 'tracking-armlt-psci' into lsk-3.10-vexpress
Conflicts:
	arch/arm/kernel/psci.c
2013-07-17 12:02:02 +01:00
Jon Medhurst
a7afdd36a8 Merge branch 'tracking-armlt-spc' into lsk-3.10-vexpress 2013-07-17 12:01:55 +01:00
Jon Medhurst
95106c3b67 Merge branch 'tracking-armlt-cci' into lsk-3.10-vexpress
Conflicts:
	arch/arm/boot/dts/vexpress-v2p-ca15_a7.dts
2013-07-17 12:01:50 +01:00
Jon Medhurst
fcd1e5ad66 Merge branch 'tracking-armlt-mcpm' into lsk-3.10-vexpress 2013-07-17 12:01:44 +01:00
Jon Medhurst
6c75e2cc08 Merge branch 'tracking-armlt-tc2-dt' into lsk-3.10-vexpress 2013-07-17 12:01:44 +01:00
Jon Medhurst
38b7fa2a7c Merge branch 'tracking-armlt-misc-fixes' into lsk-3.10-vexpress 2013-07-17 12:01:43 +01:00
Jon Medhurst
5af2ca472c Merge branch 'tracking-armlt-clcd' into lsk-3.10-vexpress 2013-07-17 12:01:43 +01:00
Jon Medhurst
1d7123299d Merge branch 'tracking-armlt-hdlcd' into lsk-3.10-vexpress 2013-07-17 12:01:42 +01:00
Jon Medhurst
042c5cb741 Merge branch 'tracking-armlt-ve-updates' into lsk-3.10-vexpress 2013-07-17 12:01:37 +01:00
Jon Medhurst
7a6cc8ab22 Merge branch 'tracking-armlt-rtsm' into lsk-3.10-vexpress 2013-07-17 12:01:37 +01:00
Jon Medhurst
50f1a7c407 Merge branch 'tracking-armlt-config' into lsk-3.10-vexpress 2013-07-17 12:01:36 +01:00
Jon Medhurst
521caf641e ARM: vexpress: Ensure SPC driver is loaded before using it in PSCI init
Otherwise we get a nullptr dereference calling vexpress_spc_get_nb_cpus.

Signed-off-by: Jon Medhurst <tixy@linaro.org>
2013-07-01 11:05:16 +01:00
Jon Medhurst
b62c31f526 ARM: vexpress: Get tc2_pm_psci.c to use common CP15 accessor functions
Signed-off-by: Jon Medhurst <tixy@linaro.org>
2013-07-01 11:05:15 +01:00
Jon Medhurst
e64a97aa17 ARM: vexpress: Fixup tc2_pm_psci.c for mcpm APIs
Signed-off-by: Jon Medhurst <tixy@linaro.org>
2013-07-01 11:05:15 +01:00
Achin Gupta
4997791921 ARM: vexpress: add psci support in TC2 device tree
This patch adds a psci device node to allow the ospm subsystems on the
TC2 to work with a psci backend implemented in the secure firmware. The
function offsets start from 1 instead of 0 as thats whats the current
secure firmware implements.

Signed-off-by: Achin Gupta <achin.gupta@arm.com>
Signed-off-by: Liviu Dudau <Liviu.Dudau@arm.com>
2013-07-01 11:05:15 +01:00
Achin Gupta
dfd6f0c314 ARM: vexpress: add shim layer for psci backend on TC2
This patch introduces a shim layer for the TC2 platform which converts
'bL_platform_power_ops' routines to their psci counterparts. The psci
counterparts are implemented by the secure firmware. The shim layer
is used only when Linux is running in non-secure world and the secure
firmware implements psci.

It also introduces the use of a reference count to allow a power up call
to go ahead of a power down call.

Signed-off-by: Achin Gupta <achin.gupta@arm.com>
Signed-off-by: Liviu Dudau <Liviu.Dudau@arm.com>
2013-07-01 11:05:15 +01:00
Achin Gupta
58068c45b8 ARM: vexpress: allow native pm ops backends to probe for psci suppport
This patch allows the vexpress 'tc2' native backend to probe
the dt for presence of the psci backend. If present then the native
implementation of the 'bL_platform_power_ops' is not used.

Signed-off-by: Achin Gupta <achin.gupta@arm.com>
Signed-off-by: Liviu Dudau <Liviu.Dudau@arm.com>
2013-07-01 11:05:15 +01:00
Achin Gupta
922b78c709 ARM: TC2: replace hard coded cluster and cpu values with constants
This patch adds constants in a tc2 specific header file to prevent
use of hard coded values for specifying the number of cpus and
clusters.

Signed-off-by: Achin Gupta <achin.gupta@arm.com>
Signed-off-by: Liviu Dudau <Liviu.Dudau@arm.com>
2013-07-01 11:05:15 +01:00
Jon Medhurst
dd94c6f646 tc2_pm: Fixup for new SPC driver
Signed-off-by: Jon Medhurst <tixy@linaro.org>
2013-07-01 11:05:14 +01:00
Nicolas Pitre
5ecac7d220 ARM: vexpress: use generic CCI code to turn on CCI ports on TC2
Signed-off-by: Nicolas Pitre <nico@linaro.org>
2013-07-01 11:05:14 +01:00
Jon Medhurst
d955295af4 tc2_pm: fixup for new CCI driver
Signed-off-by: Jon Medhurst <tixy@linaro.org>
2013-07-01 11:05:14 +01:00
Jon Medhurst
a7dda41efb cpuidle: arm_big_little: Initialise earlier by using device_initcall
Using late_initcall is too late for IKS.

Requested-by: Nicolas Pitre <nicolas.pitre@linaro.org>
Signed-off-by: Jon Medhurst <tixy@linaro.org>
2013-07-01 11:05:14 +01:00
Lorenzo Pieralisi
aa55d8151d ARM: TC2: reset CPUs spuriously woken up on cluster power up
On TC2, all CPUs in a cluster are woken up when an IRQ event triggers for a
CPU in a cluster in shutdown state.

This patch puts spuriously woken CPUs back in reset by checking the
pending IRQ status in the SPC wake-up interrupt status register; if the
CPU has no pending IRQ routed to it, the core reexecutes wfi and it is put
in reset by FW straight away.

Tested-by: Viresh Kumar <viresh.kumar2@arm.com>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
2013-07-01 11:05:14 +01:00
Nicolas Pitre
62373580b2 cpuidle: arm_big_little: fixup for MCPM
The low-level layer is now called "mcpm".
2013-07-01 11:05:13 +01:00
mark hambleton
13a7b5d656 Use dts compatible node to init cpuidle-tc2
Change the init code for cpuidle-tc2 to check for a
compatible node in the devicetree of "arm,generic"
in preparation for moving it to driver/cpuidle.

Rename functions / variable from tc2_ to bl_.

Signed-off-by: mark hambleton <mahamble@broadcom.com>
2013-07-01 11:05:13 +01:00
Nicolas Pitre
0251cea2c0 ARM: vexpress/tc2: clean up the cpuidle driver
Use the bL_cpu_suspend method instead of bL_cpu_power_down.

This allows for the driver to become usable on non SPC based platform
such as RTSM if vexpress_spc_check_loaded() is removed.

Signed-off-by: Nicolas Pitre <nico@linaro.org>
2013-07-01 11:05:13 +01:00
Dave Martin
625b10c3d3 ARM: mcpm: Make all mcpm functions notrace
The functions in mcpm_entry.c are mostly intended for use during
scary cache and coherency disabling sequences, or do other things
which confuse trace ...  like powering a CPU down and not
returning.  Similarly for the backend code.

For simplicity, this patch just makes whole files notrace.
There should be more than enough traceable points on the paths to
these functions, but we can be more fine-grained later if there is
a need for it.

Signed-off-by: Dave Martin <dave.martin@linaro.org>
2013-07-01 11:05:13 +01:00
Nicolas Pitre
3ce60848e5 ARM: vexpress/tc2: implement PM suspend method
This is simplistic for the moment as the expected residency is used to
prevent the shutting down of L2 and the cluster if the residency for
the last man is lower than 5 ms.  To make this right, the residency
end time for each CPU would need to be recorded and taken into account.

On a suspend, the firmware mailbox address has to be set prior entering
low power mode.

Signed-off-by: Nicolas Pitre <nico@linaro.org>
2013-07-01 11:05:13 +01:00
Lorenzo Pieralisi
0b94e1be54 ARM: TC2: disable GIC CPU IF on power down
On TC2 testchip the GIC CPU IF must be disabled before powering down a
core since a pending IRQ might cause wfi completion and the processor
would exit wfi state while power controller is taking action to reset or
power up the CPU upon IRQ reception.

This patch adds code that disables the GIC CPU IF in TC2 specific
power API methods.

Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
2013-07-01 11:05:12 +01:00
Nicolas Pitre
15438a8f30 gic: introduce gic_cpu_if_down()
This should be queued right before 'Revert "ARM: common: add GIC bybass disable
on GIC CPU IF save function"'.

Signed-off-by: Nicolas Pitre <nico@linaro.org>
2013-07-01 11:05:12 +01:00
Nicolas Pitre
81543a9102 ARM: TC2: basic PM support
Signed-off-by: Nicolas Pitre <nico@linaro.org>
2013-07-01 11:05:12 +01:00
Nicolas Pitre
f8c889662f ARM: b.L: assume aliasing I-cache
To deal with the I-cache discrepancy between Cortex-A15 and Cortex-A7,
let's assume aliasing I-cache in both cases.

Note: this might need to be refined i.e. detect a big.LITTLE system
somehow by probing all CPUs not only the boot one.

Signed-off-by: Nicolas Pitre <nico@linaro.org>
2013-07-01 11:05:12 +01:00
Jon Medhurst
e7fd319fd0 ARM: vexpress: Make cpuidle check for presence of SPC driver
The cpuidle code requires SPC hardware, so check for its presence
before initialising. This enables the cpuidle code to safely exist
in kernels run on hardware without SPC support.

Signed-off-by: Jon Medhurst <tixy@linaro.org>
2013-07-01 11:05:12 +01:00
Lorenzo Pieralisi
88d444dfb9 ARM: vexpress: add TC2 CPU idle PM
TC2 test-chip integrates power management circuitry and firmware that
allows to remove voltage from both (A7 and A15) clusters when they are
idle or more generically when the system is forced into shutdown mode.

All CPUs in a cluster share the same voltage source so they cannot be
shutdown independently. In order to take advantage of TC2 power
management capabilities this patch implements a multi-cluster aware
CPU idle implementation. It is based on coupled C-state concept provided
by this code:

http://lists.infradead.org/pipermail/linux-arm-kernel/2012-April/097084.html

CPUs that are part of the same cluster are coupled using the mask
provided by the MPIDR at boot. Once all CPUs hit the coupled barrier the
primary CPU in the cluster (the one with MPIDR[7:0] == 0) waits for
secondaries to clean their L1 and enter wfi. Then it cleans all cache
levels, exits cluster coherency and starts the procedure to shutdown the
respective cluster. All wake-up IRQ sources are enabled by default.

Deep shutdown states for clusters are not enabled by default.

To enabled them:

A15 cluster

echo 0 > /sys/kernel/debug/idle_debug/enable_idle

A7 cluster

echo 1 > /sys/kernel/debug/idle_debug/enable_idle

Tested thoroughly using lookbusy to modulate system load and trigger idle
states entry/exit.
2013-07-01 11:05:11 +01:00
Jon Medhurst
59e1c2d0f9 ARM: kernel: Fix compilation of sleep.S on ARMv6
The patch "ARM: kernel: fix MPIDR cpu_{suspend}/{resume} usage"
uses the BFC assembler instruction but this isn't available
on ARMv6 CPUs, which breaks compilation when building kernels which
support both SMP and ARMv6, e.g. omap2plus_defconifg.

Fix this by using a BIC instruction instead.

Signed-off-by: Jon Medhurst <tixy@linaro.org>
2013-07-01 11:05:11 +01:00
Lorenzo Pieralisi
5276597a46 ARM: kernel: fix MPIDR cpu_{suspend}/{resume} usage
The current version of cpu_{suspend}/{resume} relies on the 8 LSBs of
the MPIDR register to index the context pointer saved and restored on
CPU shutdown. This approach breaks as soon as platforms with populated
MPIDR affinity levels 1 and 2 are deployed, since the MPIDR cannot be
considered a linear index anymore.

There are multiple solutions to this problem, each with pros and cons.

This patch changes cpu_{suspend}/{resume} so that the CPU logical id
is used to retrieve an index into the context pointers array.

Performance is impacted on both save and restore paths. On save path
the CPU logical id has to be retrieved from thread_info; since caches
are on, the performance hit should be neglectable. In the resume code
path the MMU is off and so are the caches. The patch adds a trivial for
loop that polls the cpu_logical_map array scanning the present MPIDRs and
retrieves the actual CPU logical index. Since everything runs out of
strongly ordered memory the perfomance hit in the resume code path must
be measured and thought over; it worsens as the number of CPUs increases
since it is a linear search (but can be improved).

On the up side, the logical index approach is by far the easiest solution in
terms of coding and make dynamic changes to the cpu mapping trivial at
run-time.

Any change to the cpu_logical_map (ie in-kernel switcher) at run time must be
cleaned from the caches since this data has to be retrieved with the MMU
off, when caches are not searched.

Tested on TC2 and fast models.
2013-07-01 11:05:11 +01:00
Dave Martin
6821d4bd29 ARM: mcpm: Make all mcpm functions notrace
The functions in mcpm_entry.c are mostly intended for use during
scary cache and coherency disabling sequences, or do other things
which confuse trace ...  like powering a CPU down and not
returning.  Similarly for the backend code.

For simplicity, this patch just makes whole files notrace.
There should be more than enough traceable points on the paths to
these functions, but we can be more fine-grained later if there is
a need for it.

Signed-off-by: Dave Martin <dave.martin@linaro.org>
2013-07-01 11:05:07 +01:00
Achin Gupta
659eaba2ac ARM: vexpress: allow native pm ops backends to probe for psci suppport
This patch allows the vexpress 'rtsm' native backend to probe
the dt for presence of the psci backend. If present then the native
implementation of the 'bL_platform_power_ops' is not used.

Signed-off-by: Achin Gupta <achin.gupta@arm.com>
Signed-off-by: Liviu Dudau <Liviu.Dudau@arm.com>
Signed-off-by: Jon Medhurst <tixy@linaro.org>
2013-07-01 11:05:07 +01:00
Dave Martin
3d2f3686f7 ARM: vexpress/dcscb: handle platform coherency exit/setup and CCI
Add the required code to properly handle race free platform coherency exit
to the DCSCB power down method.

The power_up_setup callback is used to enable the CCI interface for
the cluster being brought up.  This must be done in assembly before
the kernel environment is entered.

Thanks to Achin Gupta and Nicolas Pitre for their help and
contributions.

Signed-off-by: Dave Martin <dave.martin@linaro.org>
Signed-off-by: Nicolas Pitre <nico@linaro.org>
Reviewed-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
Acked-by: Pawel Moll <pawel.moll@arm.com>
2013-07-01 11:05:07 +01:00
Nicolas Pitre
c621f114fd ARM: vexpress/dcscb: do not hardcode number of CPUs per cluster
If 4 CPUs are assumed, the A15x1-A7x1 model configuration would never
shut down the initial cluster as the 0xf reset bit mask will never be
observed.  Let's construct this mask based on the provided information
in the DCSCB config register for the number of CPUs per cluster.

Signed-off-by: Nicolas Pitre <nico@linaro.org>
Reviewed-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
Acked-by: Pawel Moll <pawel.moll@arm.com>
2013-07-01 11:05:07 +01:00
Nicolas Pitre
29722e1e61 ARM: vexpress/dcscb: add CPU use counts to the power up/down API implementation
It is possible for a CPU to be told to power up before it managed
to power itself down.  Solve this race with a usage count to deal
with this possibility as mandated by the MCPM API definition.

Signed-off-by: nicolas Pitre <nico@linaro.org>
Reviewed-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
Acked-by: Pawel Moll <pawel.moll@arm.com>
2013-07-01 11:05:06 +01:00
Nicolas Pitre
bd2bf7cdad ARM: vexpress: introduce DCSCB support
This adds basic CPU and cluster reset controls on RTSM for the
A15x4-A7x4 model configuration using the Dual Cluster System
Configuration Block (DCSCB).

The cache coherency interconnect (CCI) is not handled yet.

Signed-off-by: Nicolas Pitre <nico@linaro.org>
Reviewed-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
Acked-by: Pawel Moll <pawel.moll@arm.com>
2013-07-01 11:05:06 +01:00
Rob Herring
983b26177b ARM: introduce common set_auxcr/get_auxcr functions
Move the private set_auxcr/get_auxcr functions from
drivers/cpuidle/cpuidle-calxeda.c so they can be used across platforms.

Signed-off-by: Rob Herring <rob.herring@calxeda.com>
Cc: Russell King <linux@arm.linux.org.uk>
Signed-off-by: Nicolas Pitre <nico@linaro.org>
Acked-by: Tony Lindgren <tony@atomide.com>
Acked-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
Reviewed-by: Will Deacon <will.deacon@arm.com>
2013-07-01 11:05:06 +01:00
Achin Gupta
b5fdc36b35 ARM: psci: add cmdline option to enable use of psci
This patch adds the 'psci' kernel command line option. Secure firmware cannot
yet add a psci device node in the dt to indicate whether it supports psci or
not. So in the current dt, the psci device node is present by default. The
probe function will always indicate that the secure firmware implements psci
irrespective of the address space linux runs in as the same device tree will
be used in either case. Hence a kernel cmdline option is required to choose
either the native or psci power api backend depending upon the address space
linux is running in.

Specifying 'psci=enable' in the cmdline will allow Linux running in the
non-secure address space to use the same dt but use the psci backend instead
of the native backend. It effectively overrides the presence of the native
implementation by ensuring registration of the psci backend. Linux running in
the secure address space will use the native backend for power management when
'psci=disable' in the cmdline (also the default value i.e. psci backend is
disabled by default) or the psci node in the dt is absent.

Signed-off-by: Achin Gupta <achin.gupta@arm.com>
Signed-off-by: Liviu Dudau <Liviu.Dudau@arm.com>
2013-07-01 11:05:02 +01:00
Achin Gupta
25366fe14f ARM: psci: add probe function to discover presence of a psci implementation
This patch adds a probe function to check if the secure firmware has an
implementation of the Power State Coordination Interface.

'bL_platform_power_ops' will be implemented by:

a. a native backend when Linux runs in secure world
b. a psci backend which relies on the secure firmware to implement the
   power ops

presence of b. will be indicated by the psci device node in the device tree.
The device node is expected to be populated by the secure firmware if it
supports psci. If the native backend detects a psci node then it bails out
allowing the psci backend to be registered.

Also a dummy 'psci_probe' function is added for the case when psci support
is not included. This prevents the build from breaking for tc2 and the
rtsm platforms.

Signed-off-by: Achin Gupta <achin.gupta@arm.com>
Signed-off-by: Liviu Dudau <Liviu.Dudau@arm.com>
2013-07-01 11:05:02 +01:00
Achin Gupta
4e57b6c98d ARM: psci: convert psci '-EALREADYON' error code to linux '-EAGAIN'
This patch adds a possible error code of the cpu_on psci api. It
indicates that the cpu specified in the cpu_on call is up and running
(e.g. the firmware still has not seen the preceding cpu_off call).

Signed-off-by: Achin Gupta <achin.gupta@arm.com>
Signed-off-by: Liviu Dudau <Liviu.Dudau@arm.com>
2013-07-01 11:05:02 +01:00
Achin Gupta
88d295ae94 ARM: psci: add constants to specify affinity levels
This patch defines constants to allow callers of the psci 'suspend'
& 'off' calls specify supported affinity levels.

Signed-off-by: Achin Gupta <achin.gupta@arm.com>
Signed-off-by: Liviu Dudau <Liviu.Dudau@arm.com>
2013-07-01 11:05:01 +01:00