diff options
author | Kevin Hao <haokexin@gmail.com> | 2016-07-23 05:12:40 -0400 |
---|---|---|
committer | Michael Ellerman <mpe@ellerman.id.au> | 2016-07-31 21:15:03 -0400 |
commit | b92a226e528423b8d249dd09bb450d53361fbfcb (patch) | |
tree | dd863ac94d80043727c82ab52210f505df5da013 | |
parent | 905259e33d0ca0ee8e0d55783c3eef3402df81b7 (diff) |
powerpc: Move cpu_has_feature() to a separate file
We plan to use jump label for cpu_has_feature(). In order to implement
this we need to include the linux/jump_label.h in asm/cputable.h.
Unfortunately if we do that it leads to an include loop. The root of the
problem seems to be that reg.h needs cputable.h (for CPU_FTRs), and then
cputable.h via jump_label.h eventually pulls in hw_irq.h which needs
reg.h (for MSR_EE).
So move cpu_has_feature() to a separate file on its own.
Signed-off-by: Kevin Hao <haokexin@gmail.com>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
[mpe: Rename to cpu_has_feature.h and flesh out change log]
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
-rw-r--r-- | arch/powerpc/include/asm/book3s/64/mmu-hash.h | 1 | ||||
-rw-r--r-- | arch/powerpc/include/asm/cacheflush.h | 1 | ||||
-rw-r--r-- | arch/powerpc/include/asm/cpu_has_feature.h | 20 | ||||
-rw-r--r-- | arch/powerpc/include/asm/cputable.h | 11 | ||||
-rw-r--r-- | arch/powerpc/include/asm/cputime.h | 1 | ||||
-rw-r--r-- | arch/powerpc/include/asm/dbell.h | 1 | ||||
-rw-r--r-- | arch/powerpc/include/asm/dcr-native.h | 1 | ||||
-rw-r--r-- | arch/powerpc/include/asm/mman.h | 1 | ||||
-rw-r--r-- | arch/powerpc/include/asm/time.h | 1 | ||||
-rw-r--r-- | arch/powerpc/include/asm/xor.h | 1 | ||||
-rw-r--r-- | arch/powerpc/kernel/align.c | 1 | ||||
-rw-r--r-- | arch/powerpc/kernel/irq.c | 1 | ||||
-rw-r--r-- | arch/powerpc/kernel/process.c | 1 | ||||
-rw-r--r-- | arch/powerpc/kernel/setup-common.c | 1 | ||||
-rw-r--r-- | arch/powerpc/kernel/setup_32.c | 1 | ||||
-rw-r--r-- | arch/powerpc/kernel/smp.c | 1 | ||||
-rw-r--r-- | arch/powerpc/platforms/cell/pervasive.c | 1 | ||||
-rw-r--r-- | arch/powerpc/xmon/ppc-dis.c | 1 |
18 files changed, 36 insertions, 11 deletions
diff --git a/arch/powerpc/include/asm/book3s/64/mmu-hash.h b/arch/powerpc/include/asm/book3s/64/mmu-hash.h index 5eaf86ac143d..032e9f0bc708 100644 --- a/arch/powerpc/include/asm/book3s/64/mmu-hash.h +++ b/arch/powerpc/include/asm/book3s/64/mmu-hash.h | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <asm/book3s/64/pgtable.h> | 24 | #include <asm/book3s/64/pgtable.h> |
25 | #include <asm/bug.h> | 25 | #include <asm/bug.h> |
26 | #include <asm/processor.h> | 26 | #include <asm/processor.h> |
27 | #include <asm/cpu_has_feature.h> | ||
27 | 28 | ||
28 | /* | 29 | /* |
29 | * SLB | 30 | * SLB |
diff --git a/arch/powerpc/include/asm/cacheflush.h b/arch/powerpc/include/asm/cacheflush.h index 69fb16d7a811..b77f0364df94 100644 --- a/arch/powerpc/include/asm/cacheflush.h +++ b/arch/powerpc/include/asm/cacheflush.h | |||
@@ -11,6 +11,7 @@ | |||
11 | 11 | ||
12 | #include <linux/mm.h> | 12 | #include <linux/mm.h> |
13 | #include <asm/cputable.h> | 13 | #include <asm/cputable.h> |
14 | #include <asm/cpu_has_feature.h> | ||
14 | 15 | ||
15 | /* | 16 | /* |
16 | * No cache flushing is required when address mappings are changed, | 17 | * No cache flushing is required when address mappings are changed, |
diff --git a/arch/powerpc/include/asm/cpu_has_feature.h b/arch/powerpc/include/asm/cpu_has_feature.h new file mode 100644 index 000000000000..c935c5854fed --- /dev/null +++ b/arch/powerpc/include/asm/cpu_has_feature.h | |||
@@ -0,0 +1,20 @@ | |||
1 | #ifndef __ASM_POWERPC_CPUFEATURES_H | ||
2 | #define __ASM_POWERPC_CPUFEATURES_H | ||
3 | |||
4 | #ifndef __ASSEMBLY__ | ||
5 | |||
6 | #include <asm/cputable.h> | ||
7 | |||
8 | static inline bool early_cpu_has_feature(unsigned long feature) | ||
9 | { | ||
10 | return !!((CPU_FTRS_ALWAYS & feature) || | ||
11 | (CPU_FTRS_POSSIBLE & cur_cpu_spec->cpu_features & feature)); | ||
12 | } | ||
13 | |||
14 | static inline bool cpu_has_feature(unsigned long feature) | ||
15 | { | ||
16 | return early_cpu_has_feature(feature); | ||
17 | } | ||
18 | |||
19 | #endif /* __ASSEMBLY__ */ | ||
20 | #endif /* __ASM_POWERPC_CPUFEATURE_H */ | ||
diff --git a/arch/powerpc/include/asm/cputable.h b/arch/powerpc/include/asm/cputable.h index 3d8dc9a7831d..92961bcfbe3f 100644 --- a/arch/powerpc/include/asm/cputable.h +++ b/arch/powerpc/include/asm/cputable.h | |||
@@ -577,17 +577,6 @@ enum { | |||
577 | }; | 577 | }; |
578 | #endif /* __powerpc64__ */ | 578 | #endif /* __powerpc64__ */ |
579 | 579 | ||
580 | static inline bool early_cpu_has_feature(unsigned long feature) | ||
581 | { | ||
582 | return !!((CPU_FTRS_ALWAYS & feature) || | ||
583 | (CPU_FTRS_POSSIBLE & cur_cpu_spec->cpu_features & feature)); | ||
584 | } | ||
585 | |||
586 | static inline bool cpu_has_feature(unsigned long feature) | ||
587 | { | ||
588 | return early_cpu_has_feature(feature); | ||
589 | } | ||
590 | |||
591 | #define HBP_NUM 1 | 580 | #define HBP_NUM 1 |
592 | 581 | ||
593 | #endif /* !__ASSEMBLY__ */ | 582 | #endif /* !__ASSEMBLY__ */ |
diff --git a/arch/powerpc/include/asm/cputime.h b/arch/powerpc/include/asm/cputime.h index 2dfd4fc41f3e..4f60db074725 100644 --- a/arch/powerpc/include/asm/cputime.h +++ b/arch/powerpc/include/asm/cputime.h | |||
@@ -28,6 +28,7 @@ static inline void setup_cputime_one_jiffy(void) { } | |||
28 | #include <asm/div64.h> | 28 | #include <asm/div64.h> |
29 | #include <asm/time.h> | 29 | #include <asm/time.h> |
30 | #include <asm/param.h> | 30 | #include <asm/param.h> |
31 | #include <asm/cpu_has_feature.h> | ||
31 | 32 | ||
32 | typedef u64 __nocast cputime_t; | 33 | typedef u64 __nocast cputime_t; |
33 | typedef u64 __nocast cputime64_t; | 34 | typedef u64 __nocast cputime64_t; |
diff --git a/arch/powerpc/include/asm/dbell.h b/arch/powerpc/include/asm/dbell.h index 5fa6b20eba10..378167377065 100644 --- a/arch/powerpc/include/asm/dbell.h +++ b/arch/powerpc/include/asm/dbell.h | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <linux/threads.h> | 16 | #include <linux/threads.h> |
17 | 17 | ||
18 | #include <asm/ppc-opcode.h> | 18 | #include <asm/ppc-opcode.h> |
19 | #include <asm/cpu_has_feature.h> | ||
19 | 20 | ||
20 | #define PPC_DBELL_MSG_BRDCAST (0x04000000) | 21 | #define PPC_DBELL_MSG_BRDCAST (0x04000000) |
21 | #define PPC_DBELL_TYPE(x) (((x) & 0xf) << (63-36)) | 22 | #define PPC_DBELL_TYPE(x) (((x) & 0xf) << (63-36)) |
diff --git a/arch/powerpc/include/asm/dcr-native.h b/arch/powerpc/include/asm/dcr-native.h index 4efc11dacb98..4a2beef74277 100644 --- a/arch/powerpc/include/asm/dcr-native.h +++ b/arch/powerpc/include/asm/dcr-native.h | |||
@@ -24,6 +24,7 @@ | |||
24 | 24 | ||
25 | #include <linux/spinlock.h> | 25 | #include <linux/spinlock.h> |
26 | #include <asm/cputable.h> | 26 | #include <asm/cputable.h> |
27 | #include <asm/cpu_has_feature.h> | ||
27 | 28 | ||
28 | typedef struct { | 29 | typedef struct { |
29 | unsigned int base; | 30 | unsigned int base; |
diff --git a/arch/powerpc/include/asm/mman.h b/arch/powerpc/include/asm/mman.h index 2563c435a4b1..ef2d9ac1bc52 100644 --- a/arch/powerpc/include/asm/mman.h +++ b/arch/powerpc/include/asm/mman.h | |||
@@ -13,6 +13,7 @@ | |||
13 | 13 | ||
14 | #include <asm/cputable.h> | 14 | #include <asm/cputable.h> |
15 | #include <linux/mm.h> | 15 | #include <linux/mm.h> |
16 | #include <asm/cpu_has_feature.h> | ||
16 | 17 | ||
17 | /* | 18 | /* |
18 | * This file is included by linux/mman.h, so we can't use cacl_vm_prot_bits() | 19 | * This file is included by linux/mman.h, so we can't use cacl_vm_prot_bits() |
diff --git a/arch/powerpc/include/asm/time.h b/arch/powerpc/include/asm/time.h index cbbeaf0a6597..b240666b7bc1 100644 --- a/arch/powerpc/include/asm/time.h +++ b/arch/powerpc/include/asm/time.h | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/percpu.h> | 18 | #include <linux/percpu.h> |
19 | 19 | ||
20 | #include <asm/processor.h> | 20 | #include <asm/processor.h> |
21 | #include <asm/cpu_has_feature.h> | ||
21 | 22 | ||
22 | /* time.c */ | 23 | /* time.c */ |
23 | extern unsigned long tb_ticks_per_jiffy; | 24 | extern unsigned long tb_ticks_per_jiffy; |
diff --git a/arch/powerpc/include/asm/xor.h b/arch/powerpc/include/asm/xor.h index 0abb97f3be10..a36c2069d8ed 100644 --- a/arch/powerpc/include/asm/xor.h +++ b/arch/powerpc/include/asm/xor.h | |||
@@ -23,6 +23,7 @@ | |||
23 | #ifdef CONFIG_ALTIVEC | 23 | #ifdef CONFIG_ALTIVEC |
24 | 24 | ||
25 | #include <asm/cputable.h> | 25 | #include <asm/cputable.h> |
26 | #include <asm/cpu_has_feature.h> | ||
26 | 27 | ||
27 | void xor_altivec_2(unsigned long bytes, unsigned long *v1_in, | 28 | void xor_altivec_2(unsigned long bytes, unsigned long *v1_in, |
28 | unsigned long *v2_in); | 29 | unsigned long *v2_in); |
diff --git a/arch/powerpc/kernel/align.c b/arch/powerpc/kernel/align.c index c7097f933114..033f3385fa49 100644 --- a/arch/powerpc/kernel/align.c +++ b/arch/powerpc/kernel/align.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <asm/emulated_ops.h> | 26 | #include <asm/emulated_ops.h> |
27 | #include <asm/switch_to.h> | 27 | #include <asm/switch_to.h> |
28 | #include <asm/disassemble.h> | 28 | #include <asm/disassemble.h> |
29 | #include <asm/cpu_has_feature.h> | ||
29 | 30 | ||
30 | struct aligninfo { | 31 | struct aligninfo { |
31 | unsigned char len; | 32 | unsigned char len; |
diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c index ac910d9982df..08887cf2b20e 100644 --- a/arch/powerpc/kernel/irq.c +++ b/arch/powerpc/kernel/irq.c | |||
@@ -75,6 +75,7 @@ | |||
75 | #endif | 75 | #endif |
76 | #define CREATE_TRACE_POINTS | 76 | #define CREATE_TRACE_POINTS |
77 | #include <asm/trace.h> | 77 | #include <asm/trace.h> |
78 | #include <asm/cpu_has_feature.h> | ||
78 | 79 | ||
79 | DEFINE_PER_CPU_SHARED_ALIGNED(irq_cpustat_t, irq_stat); | 80 | DEFINE_PER_CPU_SHARED_ALIGNED(irq_cpustat_t, irq_stat); |
80 | EXPORT_PER_CPU_SYMBOL(irq_stat); | 81 | EXPORT_PER_CPU_SYMBOL(irq_stat); |
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c index a8cca88e972f..9ee2623e0f67 100644 --- a/arch/powerpc/kernel/process.c +++ b/arch/powerpc/kernel/process.c | |||
@@ -58,6 +58,7 @@ | |||
58 | #include <asm/code-patching.h> | 58 | #include <asm/code-patching.h> |
59 | #include <asm/exec.h> | 59 | #include <asm/exec.h> |
60 | #include <asm/livepatch.h> | 60 | #include <asm/livepatch.h> |
61 | #include <asm/cpu_has_feature.h> | ||
61 | 62 | ||
62 | #include <linux/kprobes.h> | 63 | #include <linux/kprobes.h> |
63 | #include <linux/kdebug.h> | 64 | #include <linux/kdebug.h> |
diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c index 714b4ba7ab86..dba265c586df 100644 --- a/arch/powerpc/kernel/setup-common.c +++ b/arch/powerpc/kernel/setup-common.c | |||
@@ -66,6 +66,7 @@ | |||
66 | #include <asm/hugetlb.h> | 66 | #include <asm/hugetlb.h> |
67 | #include <asm/livepatch.h> | 67 | #include <asm/livepatch.h> |
68 | #include <asm/mmu_context.h> | 68 | #include <asm/mmu_context.h> |
69 | #include <asm/cpu_has_feature.h> | ||
69 | 70 | ||
70 | #include "setup.h" | 71 | #include "setup.h" |
71 | 72 | ||
diff --git a/arch/powerpc/kernel/setup_32.c b/arch/powerpc/kernel/setup_32.c index 00f57754407e..c3e861df4b20 100644 --- a/arch/powerpc/kernel/setup_32.c +++ b/arch/powerpc/kernel/setup_32.c | |||
@@ -37,6 +37,7 @@ | |||
37 | #include <asm/serial.h> | 37 | #include <asm/serial.h> |
38 | #include <asm/udbg.h> | 38 | #include <asm/udbg.h> |
39 | #include <asm/code-patching.h> | 39 | #include <asm/code-patching.h> |
40 | #include <asm/cpu_has_feature.h> | ||
40 | 41 | ||
41 | #define DBG(fmt...) | 42 | #define DBG(fmt...) |
42 | 43 | ||
diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c index 5a1f015ea9f3..25a39052bf6b 100644 --- a/arch/powerpc/kernel/smp.c +++ b/arch/powerpc/kernel/smp.c | |||
@@ -55,6 +55,7 @@ | |||
55 | #include <asm/debug.h> | 55 | #include <asm/debug.h> |
56 | #include <asm/kexec.h> | 56 | #include <asm/kexec.h> |
57 | #include <asm/asm-prototypes.h> | 57 | #include <asm/asm-prototypes.h> |
58 | #include <asm/cpu_has_feature.h> | ||
58 | 59 | ||
59 | #ifdef DEBUG | 60 | #ifdef DEBUG |
60 | #include <asm/udbg.h> | 61 | #include <asm/udbg.h> |
diff --git a/arch/powerpc/platforms/cell/pervasive.c b/arch/powerpc/platforms/cell/pervasive.c index d17e98bc0c10..e7d075077cb0 100644 --- a/arch/powerpc/platforms/cell/pervasive.c +++ b/arch/powerpc/platforms/cell/pervasive.c | |||
@@ -35,6 +35,7 @@ | |||
35 | #include <asm/pgtable.h> | 35 | #include <asm/pgtable.h> |
36 | #include <asm/reg.h> | 36 | #include <asm/reg.h> |
37 | #include <asm/cell-regs.h> | 37 | #include <asm/cell-regs.h> |
38 | #include <asm/cpu_has_feature.h> | ||
38 | 39 | ||
39 | #include "pervasive.h" | 40 | #include "pervasive.h" |
40 | 41 | ||
diff --git a/arch/powerpc/xmon/ppc-dis.c b/arch/powerpc/xmon/ppc-dis.c index 89098f320ad5..ee9891734149 100644 --- a/arch/powerpc/xmon/ppc-dis.c +++ b/arch/powerpc/xmon/ppc-dis.c | |||
@@ -20,6 +20,7 @@ along with this file; see the file COPYING. If not, write to the Free | |||
20 | Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ | 20 | Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ |
21 | 21 | ||
22 | #include <asm/cputable.h> | 22 | #include <asm/cputable.h> |
23 | #include <asm/cpu_has_feature.h> | ||
23 | #include "nonstdio.h" | 24 | #include "nonstdio.h" |
24 | #include "ansidecl.h" | 25 | #include "ansidecl.h" |
25 | #include "ppc.h" | 26 | #include "ppc.h" |