diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-09-09 19:08:13 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-09-09 19:08:13 -0400 |
commit | a35c6322e52c550b61a04a44df27d22394ee0a2c (patch) | |
tree | da74b2167097281f38ddffcb13b7b43861ce931f | |
parent | bef4a0ab984662d4ccd68d431a7c4ef3daebcb43 (diff) | |
parent | 158a71f83800f07c0da0f0159d2670bdf4bdd852 (diff) |
Merge tag 'drivers-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc
Pull ARM SoC driver update from Kevin Hilman:
"This contains the ARM SoC related driver updates for v3.12. The only
thing this cycle are core PM updates and CPUidle support for ARM's TC2
big.LITTLE development platform"
* tag 'drivers-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc:
cpuidle: big.LITTLE: vexpress-TC2 CPU idle driver
ARM: vexpress: tc2: disable GIC CPU IF in tc2_pm_suspend
drivers: irq-chip: irq-gic: introduce gic_cpu_if_down()
-rw-r--r-- | MAINTAINERS | 9 | ||||
-rw-r--r-- | arch/arm/mach-vexpress/tc2_pm.c | 2 | ||||
-rw-r--r-- | drivers/cpuidle/Kconfig.arm | 10 | ||||
-rw-r--r-- | drivers/cpuidle/Makefile | 1 | ||||
-rw-r--r-- | drivers/cpuidle/cpuidle-big_little.c | 209 | ||||
-rw-r--r-- | drivers/irqchip/irq-gic.c | 6 | ||||
-rw-r--r-- | include/linux/irqchip/arm-gic.h | 1 |
7 files changed, 238 insertions, 0 deletions
diff --git a/MAINTAINERS b/MAINTAINERS index 233ddce8eeff..7a78b9f2aae2 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -2307,6 +2307,15 @@ F: drivers/cpufreq/arm_big_little.h | |||
2307 | F: drivers/cpufreq/arm_big_little.c | 2307 | F: drivers/cpufreq/arm_big_little.c |
2308 | F: drivers/cpufreq/arm_big_little_dt.c | 2308 | F: drivers/cpufreq/arm_big_little_dt.c |
2309 | 2309 | ||
2310 | CPUIDLE DRIVER - ARM BIG LITTLE | ||
2311 | M: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> | ||
2312 | M: Daniel Lezcano <daniel.lezcano@linaro.org> | ||
2313 | L: linux-pm@vger.kernel.org | ||
2314 | L: linux-arm-kernel@lists.infradead.org | ||
2315 | T: git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git | ||
2316 | S: Maintained | ||
2317 | F: drivers/cpuidle/cpuidle-big_little.c | ||
2318 | |||
2310 | CPUIDLE DRIVERS | 2319 | CPUIDLE DRIVERS |
2311 | M: Rafael J. Wysocki <rjw@sisk.pl> | 2320 | M: Rafael J. Wysocki <rjw@sisk.pl> |
2312 | M: Daniel Lezcano <daniel.lezcano@linaro.org> | 2321 | M: Daniel Lezcano <daniel.lezcano@linaro.org> |
diff --git a/arch/arm/mach-vexpress/tc2_pm.c b/arch/arm/mach-vexpress/tc2_pm.c index 2b7c93a724ed..7aeb5d60e484 100644 --- a/arch/arm/mach-vexpress/tc2_pm.c +++ b/arch/arm/mach-vexpress/tc2_pm.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/of_address.h> | 18 | #include <linux/of_address.h> |
19 | #include <linux/spinlock.h> | 19 | #include <linux/spinlock.h> |
20 | #include <linux/errno.h> | 20 | #include <linux/errno.h> |
21 | #include <linux/irqchip/arm-gic.h> | ||
21 | 22 | ||
22 | #include <asm/mcpm.h> | 23 | #include <asm/mcpm.h> |
23 | #include <asm/proc-fns.h> | 24 | #include <asm/proc-fns.h> |
@@ -230,6 +231,7 @@ static void tc2_pm_suspend(u64 residency) | |||
230 | cpu = MPIDR_AFFINITY_LEVEL(mpidr, 0); | 231 | cpu = MPIDR_AFFINITY_LEVEL(mpidr, 0); |
231 | cluster = MPIDR_AFFINITY_LEVEL(mpidr, 1); | 232 | cluster = MPIDR_AFFINITY_LEVEL(mpidr, 1); |
232 | ve_spc_set_resume_addr(cluster, cpu, virt_to_phys(mcpm_entry_point)); | 233 | ve_spc_set_resume_addr(cluster, cpu, virt_to_phys(mcpm_entry_point)); |
234 | gic_cpu_if_down(); | ||
233 | tc2_pm_down(residency); | 235 | tc2_pm_down(residency); |
234 | } | 236 | } |
235 | 237 | ||
diff --git a/drivers/cpuidle/Kconfig.arm b/drivers/cpuidle/Kconfig.arm index b3302193c15a..8e3660322308 100644 --- a/drivers/cpuidle/Kconfig.arm +++ b/drivers/cpuidle/Kconfig.arm | |||
@@ -27,3 +27,13 @@ config ARM_U8500_CPUIDLE | |||
27 | help | 27 | help |
28 | Select this to enable cpuidle for ST-E u8500 processors | 28 | Select this to enable cpuidle for ST-E u8500 processors |
29 | 29 | ||
30 | config CPU_IDLE_BIG_LITTLE | ||
31 | bool "Support for ARM big.LITTLE processors" | ||
32 | depends on ARCH_VEXPRESS_TC2_PM | ||
33 | select ARM_CPU_SUSPEND | ||
34 | select CPU_IDLE_MULTIPLE_DRIVERS | ||
35 | help | ||
36 | Select this option to enable CPU idle driver for big.LITTLE based | ||
37 | ARM systems. Driver manages CPUs coordination through MCPM and | ||
38 | define different C-states for little and big cores through the | ||
39 | multiple CPU idle drivers infrastructure. | ||
diff --git a/drivers/cpuidle/Makefile b/drivers/cpuidle/Makefile index 0b9d200c7e45..cea5ef58876d 100644 --- a/drivers/cpuidle/Makefile +++ b/drivers/cpuidle/Makefile | |||
@@ -11,3 +11,4 @@ obj-$(CONFIG_ARM_HIGHBANK_CPUIDLE) += cpuidle-calxeda.o | |||
11 | obj-$(CONFIG_ARM_KIRKWOOD_CPUIDLE) += cpuidle-kirkwood.o | 11 | obj-$(CONFIG_ARM_KIRKWOOD_CPUIDLE) += cpuidle-kirkwood.o |
12 | obj-$(CONFIG_ARM_ZYNQ_CPUIDLE) += cpuidle-zynq.o | 12 | obj-$(CONFIG_ARM_ZYNQ_CPUIDLE) += cpuidle-zynq.o |
13 | obj-$(CONFIG_ARM_U8500_CPUIDLE) += cpuidle-ux500.o | 13 | obj-$(CONFIG_ARM_U8500_CPUIDLE) += cpuidle-ux500.o |
14 | obj-$(CONFIG_CPU_IDLE_BIG_LITTLE) += cpuidle-big_little.o | ||
diff --git a/drivers/cpuidle/cpuidle-big_little.c b/drivers/cpuidle/cpuidle-big_little.c new file mode 100644 index 000000000000..b45fc6249041 --- /dev/null +++ b/drivers/cpuidle/cpuidle-big_little.c | |||
@@ -0,0 +1,209 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2013 ARM/Linaro | ||
3 | * | ||
4 | * Authors: Daniel Lezcano <daniel.lezcano@linaro.org> | ||
5 | * Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> | ||
6 | * Nicolas Pitre <nicolas.pitre@linaro.org> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | * | ||
12 | * Maintainer: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> | ||
13 | * Maintainer: Daniel Lezcano <daniel.lezcano@linaro.org> | ||
14 | */ | ||
15 | #include <linux/cpuidle.h> | ||
16 | #include <linux/cpu_pm.h> | ||
17 | #include <linux/slab.h> | ||
18 | #include <linux/of.h> | ||
19 | |||
20 | #include <asm/cpu.h> | ||
21 | #include <asm/cputype.h> | ||
22 | #include <asm/cpuidle.h> | ||
23 | #include <asm/mcpm.h> | ||
24 | #include <asm/smp_plat.h> | ||
25 | #include <asm/suspend.h> | ||
26 | |||
27 | static int bl_enter_powerdown(struct cpuidle_device *dev, | ||
28 | struct cpuidle_driver *drv, int idx); | ||
29 | |||
30 | /* | ||
31 | * NB: Owing to current menu governor behaviour big and LITTLE | ||
32 | * index 1 states have to define exit_latency and target_residency for | ||
33 | * cluster state since, when all CPUs in a cluster hit it, the cluster | ||
34 | * can be shutdown. This means that when a single CPU enters this state | ||
35 | * the exit_latency and target_residency values are somewhat overkill. | ||
36 | * There is no notion of cluster states in the menu governor, so CPUs | ||
37 | * have to define CPU states where possibly the cluster will be shutdown | ||
38 | * depending on the state of other CPUs. idle states entry and exit happen | ||
39 | * at random times; however the cluster state provides target_residency | ||
40 | * values as if all CPUs in a cluster enter the state at once; this is | ||
41 | * somewhat optimistic and behaviour should be fixed either in the governor | ||
42 | * or in the MCPM back-ends. | ||
43 | * To make this driver 100% generic the number of states and the exit_latency | ||
44 | * target_residency values must be obtained from device tree bindings. | ||
45 | * | ||
46 | * exit_latency: refers to the TC2 vexpress test chip and depends on the | ||
47 | * current cluster operating point. It is the time it takes to get the CPU | ||
48 | * up and running when the CPU is powered up on cluster wake-up from shutdown. | ||
49 | * Current values for big and LITTLE clusters are provided for clusters | ||
50 | * running at default operating points. | ||
51 | * | ||
52 | * target_residency: it is the minimum amount of time the cluster has | ||
53 | * to be down to break even in terms of power consumption. cluster | ||
54 | * shutdown has inherent dynamic power costs (L2 writebacks to DRAM | ||
55 | * being the main factor) that depend on the current operating points. | ||
56 | * The current values for both clusters are provided for a CPU whose half | ||
57 | * of L2 lines are dirty and require cleaning to DRAM, and takes into | ||
58 | * account leakage static power values related to the vexpress TC2 testchip. | ||
59 | */ | ||
60 | static struct cpuidle_driver bl_idle_little_driver = { | ||
61 | .name = "little_idle", | ||
62 | .owner = THIS_MODULE, | ||
63 | .states[0] = ARM_CPUIDLE_WFI_STATE, | ||
64 | .states[1] = { | ||
65 | .enter = bl_enter_powerdown, | ||
66 | .exit_latency = 700, | ||
67 | .target_residency = 2500, | ||
68 | .flags = CPUIDLE_FLAG_TIME_VALID | | ||
69 | CPUIDLE_FLAG_TIMER_STOP, | ||
70 | .name = "C1", | ||
71 | .desc = "ARM little-cluster power down", | ||
72 | }, | ||
73 | .state_count = 2, | ||
74 | }; | ||
75 | |||
76 | static struct cpuidle_driver bl_idle_big_driver = { | ||
77 | .name = "big_idle", | ||
78 | .owner = THIS_MODULE, | ||
79 | .states[0] = ARM_CPUIDLE_WFI_STATE, | ||
80 | .states[1] = { | ||
81 | .enter = bl_enter_powerdown, | ||
82 | .exit_latency = 500, | ||
83 | .target_residency = 2000, | ||
84 | .flags = CPUIDLE_FLAG_TIME_VALID | | ||
85 | CPUIDLE_FLAG_TIMER_STOP, | ||
86 | .name = "C1", | ||
87 | .desc = "ARM big-cluster power down", | ||
88 | }, | ||
89 | .state_count = 2, | ||
90 | }; | ||
91 | |||
92 | /* | ||
93 | * notrace prevents trace shims from getting inserted where they | ||
94 | * should not. Global jumps and ldrex/strex must not be inserted | ||
95 | * in power down sequences where caches and MMU may be turned off. | ||
96 | */ | ||
97 | static int notrace bl_powerdown_finisher(unsigned long arg) | ||
98 | { | ||
99 | /* MCPM works with HW CPU identifiers */ | ||
100 | unsigned int mpidr = read_cpuid_mpidr(); | ||
101 | unsigned int cluster = MPIDR_AFFINITY_LEVEL(mpidr, 1); | ||
102 | unsigned int cpu = MPIDR_AFFINITY_LEVEL(mpidr, 0); | ||
103 | |||
104 | mcpm_set_entry_vector(cpu, cluster, cpu_resume); | ||
105 | |||
106 | /* | ||
107 | * Residency value passed to mcpm_cpu_suspend back-end | ||
108 | * has to be given clear semantics. Set to 0 as a | ||
109 | * temporary value. | ||
110 | */ | ||
111 | mcpm_cpu_suspend(0); | ||
112 | |||
113 | /* return value != 0 means failure */ | ||
114 | return 1; | ||
115 | } | ||
116 | |||
117 | /** | ||
118 | * bl_enter_powerdown - Programs CPU to enter the specified state | ||
119 | * @dev: cpuidle device | ||
120 | * @drv: The target state to be programmed | ||
121 | * @idx: state index | ||
122 | * | ||
123 | * Called from the CPUidle framework to program the device to the | ||
124 | * specified target state selected by the governor. | ||
125 | */ | ||
126 | static int bl_enter_powerdown(struct cpuidle_device *dev, | ||
127 | struct cpuidle_driver *drv, int idx) | ||
128 | { | ||
129 | cpu_pm_enter(); | ||
130 | |||
131 | cpu_suspend(0, bl_powerdown_finisher); | ||
132 | |||
133 | /* signals the MCPM core that CPU is out of low power state */ | ||
134 | mcpm_cpu_powered_up(); | ||
135 | |||
136 | cpu_pm_exit(); | ||
137 | |||
138 | return idx; | ||
139 | } | ||
140 | |||
141 | static int __init bl_idle_driver_init(struct cpuidle_driver *drv, int cpu_id) | ||
142 | { | ||
143 | struct cpuinfo_arm *cpu_info; | ||
144 | struct cpumask *cpumask; | ||
145 | unsigned long cpuid; | ||
146 | int cpu; | ||
147 | |||
148 | cpumask = kzalloc(cpumask_size(), GFP_KERNEL); | ||
149 | if (!cpumask) | ||
150 | return -ENOMEM; | ||
151 | |||
152 | for_each_possible_cpu(cpu) { | ||
153 | cpu_info = &per_cpu(cpu_data, cpu); | ||
154 | cpuid = is_smp() ? cpu_info->cpuid : read_cpuid_id(); | ||
155 | |||
156 | /* read cpu id part number */ | ||
157 | if ((cpuid & 0xFFF0) == cpu_id) | ||
158 | cpumask_set_cpu(cpu, cpumask); | ||
159 | } | ||
160 | |||
161 | drv->cpumask = cpumask; | ||
162 | |||
163 | return 0; | ||
164 | } | ||
165 | |||
166 | static int __init bl_idle_init(void) | ||
167 | { | ||
168 | int ret; | ||
169 | |||
170 | /* | ||
171 | * Initialize the driver just for a compliant set of machines | ||
172 | */ | ||
173 | if (!of_machine_is_compatible("arm,vexpress,v2p-ca15_a7")) | ||
174 | return -ENODEV; | ||
175 | /* | ||
176 | * For now the differentiation between little and big cores | ||
177 | * is based on the part number. A7 cores are considered little | ||
178 | * cores, A15 are considered big cores. This distinction may | ||
179 | * evolve in the future with a more generic matching approach. | ||
180 | */ | ||
181 | ret = bl_idle_driver_init(&bl_idle_little_driver, | ||
182 | ARM_CPU_PART_CORTEX_A7); | ||
183 | if (ret) | ||
184 | return ret; | ||
185 | |||
186 | ret = bl_idle_driver_init(&bl_idle_big_driver, ARM_CPU_PART_CORTEX_A15); | ||
187 | if (ret) | ||
188 | goto out_uninit_little; | ||
189 | |||
190 | ret = cpuidle_register(&bl_idle_little_driver, NULL); | ||
191 | if (ret) | ||
192 | goto out_uninit_big; | ||
193 | |||
194 | ret = cpuidle_register(&bl_idle_big_driver, NULL); | ||
195 | if (ret) | ||
196 | goto out_unregister_little; | ||
197 | |||
198 | return 0; | ||
199 | |||
200 | out_unregister_little: | ||
201 | cpuidle_unregister(&bl_idle_little_driver); | ||
202 | out_uninit_big: | ||
203 | kfree(bl_idle_big_driver.cpumask); | ||
204 | out_uninit_little: | ||
205 | kfree(bl_idle_little_driver.cpumask); | ||
206 | |||
207 | return ret; | ||
208 | } | ||
209 | device_initcall(bl_idle_init); | ||
diff --git a/drivers/irqchip/irq-gic.c b/drivers/irqchip/irq-gic.c index ee7c50312066..d0e948084eaf 100644 --- a/drivers/irqchip/irq-gic.c +++ b/drivers/irqchip/irq-gic.c | |||
@@ -453,6 +453,12 @@ static void gic_cpu_init(struct gic_chip_data *gic) | |||
453 | writel_relaxed(1, base + GIC_CPU_CTRL); | 453 | writel_relaxed(1, base + GIC_CPU_CTRL); |
454 | } | 454 | } |
455 | 455 | ||
456 | void gic_cpu_if_down(void) | ||
457 | { | ||
458 | void __iomem *cpu_base = gic_data_cpu_base(&gic_data[0]); | ||
459 | writel_relaxed(0, cpu_base + GIC_CPU_CTRL); | ||
460 | } | ||
461 | |||
456 | #ifdef CONFIG_CPU_PM | 462 | #ifdef CONFIG_CPU_PM |
457 | /* | 463 | /* |
458 | * Saves the GIC distributor registers during suspend or idle. Must be called | 464 | * Saves the GIC distributor registers during suspend or idle. Must be called |
diff --git a/include/linux/irqchip/arm-gic.h b/include/linux/irqchip/arm-gic.h index 3e203eb23cc7..0e5d9ecdb2b6 100644 --- a/include/linux/irqchip/arm-gic.h +++ b/include/linux/irqchip/arm-gic.h | |||
@@ -66,6 +66,7 @@ extern struct irq_chip gic_arch_extn; | |||
66 | void gic_init_bases(unsigned int, int, void __iomem *, void __iomem *, | 66 | void gic_init_bases(unsigned int, int, void __iomem *, void __iomem *, |
67 | u32 offset, struct device_node *); | 67 | u32 offset, struct device_node *); |
68 | void gic_cascade_irq(unsigned int gic_nr, unsigned int irq); | 68 | void gic_cascade_irq(unsigned int gic_nr, unsigned int irq); |
69 | void gic_cpu_if_down(void); | ||
69 | 70 | ||
70 | static inline void gic_init(unsigned int nr, int start, | 71 | static inline void gic_init(unsigned int nr, int start, |
71 | void __iomem *dist , void __iomem *cpu) | 72 | void __iomem *dist , void __iomem *cpu) |