diff options
author | Catalin Marinas <catalin.marinas@arm.com> | 2013-12-19 12:57:51 -0500 |
---|---|---|
committer | Catalin Marinas <catalin.marinas@arm.com> | 2013-12-19 12:57:51 -0500 |
commit | 0a5be743e8c3c3230600fbc0cf923fb5dbefd579 (patch) | |
tree | 239236cda1f31532831af7b3214b1db6c398221c /arch/arm64/include | |
parent | 6ac2104debc235b745265b64d610237a6833fd53 (diff) | |
parent | 1307220d7bb79fc526d006f854ebfd2bf44e6e87 (diff) |
Merge tag 'arm64-suspend' of git://linux-arm.org/linux-2.6-lp into upstream
* tag 'arm64-suspend' of git://linux-arm.org/linux-2.6-lp:
arm64: add CPU power management menu/entries
arm64: kernel: add PM build infrastructure
arm64: kernel: add CPU idle call
arm64: enable generic clockevent broadcast
arm64: kernel: implement HW breakpoints CPU PM notifier
arm64: kernel: refactor code to install/uninstall breakpoints
arm: kvm: implement CPU PM notifier
arm64: kernel: implement fpsimd CPU PM notifier
arm64: kernel: cpu_{suspend/resume} implementation
arm64: kernel: suspend/resume registers save/restore
arm64: kernel: build MPIDR_EL1 hash function data structure
arm64: kernel: add MPIDR_EL1 accessors macros
Conflicts:
arch/arm64/Kconfig
Diffstat (limited to 'arch/arm64/include')
-rw-r--r-- | arch/arm64/include/asm/cpu_ops.h | 6 | ||||
-rw-r--r-- | arch/arm64/include/asm/cputype.h | 10 | ||||
-rw-r--r-- | arch/arm64/include/asm/hardirq.h | 2 | ||||
-rw-r--r-- | arch/arm64/include/asm/proc-fns.h | 3 | ||||
-rw-r--r-- | arch/arm64/include/asm/smp_plat.h | 13 | ||||
-rw-r--r-- | arch/arm64/include/asm/suspend.h | 27 |
6 files changed, 60 insertions, 1 deletions
diff --git a/arch/arm64/include/asm/cpu_ops.h b/arch/arm64/include/asm/cpu_ops.h index c4cdb5e5b73d..152413076503 100644 --- a/arch/arm64/include/asm/cpu_ops.h +++ b/arch/arm64/include/asm/cpu_ops.h | |||
@@ -39,6 +39,9 @@ struct device_node; | |||
39 | * from the cpu to be killed. | 39 | * from the cpu to be killed. |
40 | * @cpu_die: Makes a cpu leave the kernel. Must not fail. Called from the | 40 | * @cpu_die: Makes a cpu leave the kernel. Must not fail. Called from the |
41 | * cpu being killed. | 41 | * cpu being killed. |
42 | * @cpu_suspend: Suspends a cpu and saves the required context. May fail owing | ||
43 | * to wrong parameters or error conditions. Called from the | ||
44 | * CPU being suspended. Must be called with IRQs disabled. | ||
42 | */ | 45 | */ |
43 | struct cpu_operations { | 46 | struct cpu_operations { |
44 | const char *name; | 47 | const char *name; |
@@ -50,6 +53,9 @@ struct cpu_operations { | |||
50 | int (*cpu_disable)(unsigned int cpu); | 53 | int (*cpu_disable)(unsigned int cpu); |
51 | void (*cpu_die)(unsigned int cpu); | 54 | void (*cpu_die)(unsigned int cpu); |
52 | #endif | 55 | #endif |
56 | #ifdef CONFIG_ARM64_CPU_SUSPEND | ||
57 | int (*cpu_suspend)(unsigned long); | ||
58 | #endif | ||
53 | }; | 59 | }; |
54 | 60 | ||
55 | extern const struct cpu_operations *cpu_ops[NR_CPUS]; | 61 | extern const struct cpu_operations *cpu_ops[NR_CPUS]; |
diff --git a/arch/arm64/include/asm/cputype.h b/arch/arm64/include/asm/cputype.h index e1af1b4200d5..c404fb0df3a6 100644 --- a/arch/arm64/include/asm/cputype.h +++ b/arch/arm64/include/asm/cputype.h | |||
@@ -20,6 +20,16 @@ | |||
20 | 20 | ||
21 | #define MPIDR_HWID_BITMASK 0xff00ffffff | 21 | #define MPIDR_HWID_BITMASK 0xff00ffffff |
22 | 22 | ||
23 | #define MPIDR_LEVEL_BITS_SHIFT 3 | ||
24 | #define MPIDR_LEVEL_BITS (1 << MPIDR_LEVEL_BITS_SHIFT) | ||
25 | #define MPIDR_LEVEL_MASK ((1 << MPIDR_LEVEL_BITS) - 1) | ||
26 | |||
27 | #define MPIDR_LEVEL_SHIFT(level) \ | ||
28 | (((1 << level) >> 1) << MPIDR_LEVEL_BITS_SHIFT) | ||
29 | |||
30 | #define MPIDR_AFFINITY_LEVEL(mpidr, level) \ | ||
31 | ((mpidr >> MPIDR_LEVEL_SHIFT(level)) & MPIDR_LEVEL_MASK) | ||
32 | |||
23 | #define read_cpuid(reg) ({ \ | 33 | #define read_cpuid(reg) ({ \ |
24 | u64 __val; \ | 34 | u64 __val; \ |
25 | asm("mrs %0, " #reg : "=r" (__val)); \ | 35 | asm("mrs %0, " #reg : "=r" (__val)); \ |
diff --git a/arch/arm64/include/asm/hardirq.h b/arch/arm64/include/asm/hardirq.h index 990c051e7829..ae4801d77514 100644 --- a/arch/arm64/include/asm/hardirq.h +++ b/arch/arm64/include/asm/hardirq.h | |||
@@ -20,7 +20,7 @@ | |||
20 | #include <linux/threads.h> | 20 | #include <linux/threads.h> |
21 | #include <asm/irq.h> | 21 | #include <asm/irq.h> |
22 | 22 | ||
23 | #define NR_IPI 4 | 23 | #define NR_IPI 5 |
24 | 24 | ||
25 | typedef struct { | 25 | typedef struct { |
26 | unsigned int __softirq_pending; | 26 | unsigned int __softirq_pending; |
diff --git a/arch/arm64/include/asm/proc-fns.h b/arch/arm64/include/asm/proc-fns.h index 7cdf466fd0c5..0c657bb54597 100644 --- a/arch/arm64/include/asm/proc-fns.h +++ b/arch/arm64/include/asm/proc-fns.h | |||
@@ -26,11 +26,14 @@ | |||
26 | #include <asm/page.h> | 26 | #include <asm/page.h> |
27 | 27 | ||
28 | struct mm_struct; | 28 | struct mm_struct; |
29 | struct cpu_suspend_ctx; | ||
29 | 30 | ||
30 | extern void cpu_cache_off(void); | 31 | extern void cpu_cache_off(void); |
31 | extern void cpu_do_idle(void); | 32 | extern void cpu_do_idle(void); |
32 | extern void cpu_do_switch_mm(unsigned long pgd_phys, struct mm_struct *mm); | 33 | extern void cpu_do_switch_mm(unsigned long pgd_phys, struct mm_struct *mm); |
33 | extern void cpu_reset(unsigned long addr) __attribute__((noreturn)); | 34 | extern void cpu_reset(unsigned long addr) __attribute__((noreturn)); |
35 | extern void cpu_do_suspend(struct cpu_suspend_ctx *ptr); | ||
36 | extern u64 cpu_do_resume(phys_addr_t ptr, u64 idmap_ttbr); | ||
34 | 37 | ||
35 | #include <asm/memory.h> | 38 | #include <asm/memory.h> |
36 | 39 | ||
diff --git a/arch/arm64/include/asm/smp_plat.h b/arch/arm64/include/asm/smp_plat.h index ed43a0d2b1b2..59e282311b58 100644 --- a/arch/arm64/include/asm/smp_plat.h +++ b/arch/arm64/include/asm/smp_plat.h | |||
@@ -21,6 +21,19 @@ | |||
21 | 21 | ||
22 | #include <asm/types.h> | 22 | #include <asm/types.h> |
23 | 23 | ||
24 | struct mpidr_hash { | ||
25 | u64 mask; | ||
26 | u32 shift_aff[4]; | ||
27 | u32 bits; | ||
28 | }; | ||
29 | |||
30 | extern struct mpidr_hash mpidr_hash; | ||
31 | |||
32 | static inline u32 mpidr_hash_size(void) | ||
33 | { | ||
34 | return 1 << mpidr_hash.bits; | ||
35 | } | ||
36 | |||
24 | /* | 37 | /* |
25 | * Logical CPU mapping. | 38 | * Logical CPU mapping. |
26 | */ | 39 | */ |
diff --git a/arch/arm64/include/asm/suspend.h b/arch/arm64/include/asm/suspend.h new file mode 100644 index 000000000000..e9c149c042e0 --- /dev/null +++ b/arch/arm64/include/asm/suspend.h | |||
@@ -0,0 +1,27 @@ | |||
1 | #ifndef __ASM_SUSPEND_H | ||
2 | #define __ASM_SUSPEND_H | ||
3 | |||
4 | #define NR_CTX_REGS 11 | ||
5 | |||
6 | /* | ||
7 | * struct cpu_suspend_ctx must be 16-byte aligned since it is allocated on | ||
8 | * the stack, which must be 16-byte aligned on v8 | ||
9 | */ | ||
10 | struct cpu_suspend_ctx { | ||
11 | /* | ||
12 | * This struct must be kept in sync with | ||
13 | * cpu_do_{suspend/resume} in mm/proc.S | ||
14 | */ | ||
15 | u64 ctx_regs[NR_CTX_REGS]; | ||
16 | u64 sp; | ||
17 | } __aligned(16); | ||
18 | |||
19 | struct sleep_save_sp { | ||
20 | phys_addr_t *save_ptr_stash; | ||
21 | phys_addr_t save_ptr_stash_phys; | ||
22 | }; | ||
23 | |||
24 | extern void cpu_resume(void); | ||
25 | extern int cpu_suspend(unsigned long); | ||
26 | |||
27 | #endif | ||