Commit b92a226e authored by Kevin Hao's avatar Kevin Hao Committed by Michael Ellerman

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: default avatarKevin Hao <haokexin@gmail.com>
Signed-off-by: default avatarAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
[mpe: Rename to cpu_has_feature.h and flesh out change log]
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
parent 905259e3
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include <asm/book3s/64/pgtable.h> #include <asm/book3s/64/pgtable.h>
#include <asm/bug.h> #include <asm/bug.h>
#include <asm/processor.h> #include <asm/processor.h>
#include <asm/cpu_has_feature.h>
/* /*
* SLB * SLB
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include <linux/mm.h> #include <linux/mm.h>
#include <asm/cputable.h> #include <asm/cputable.h>
#include <asm/cpu_has_feature.h>
/* /*
* No cache flushing is required when address mappings are changed, * No cache flushing is required when address mappings are changed,
......
#ifndef __ASM_POWERPC_CPUFEATURES_H
#define __ASM_POWERPC_CPUFEATURES_H
#ifndef __ASSEMBLY__
#include <asm/cputable.h>
static inline bool early_cpu_has_feature(unsigned long feature)
{
return !!((CPU_FTRS_ALWAYS & feature) ||
(CPU_FTRS_POSSIBLE & cur_cpu_spec->cpu_features & feature));
}
static inline bool cpu_has_feature(unsigned long feature)
{
return early_cpu_has_feature(feature);
}
#endif /* __ASSEMBLY__ */
#endif /* __ASM_POWERPC_CPUFEATURE_H */
...@@ -577,17 +577,6 @@ enum { ...@@ -577,17 +577,6 @@ enum {
}; };
#endif /* __powerpc64__ */ #endif /* __powerpc64__ */
static inline bool early_cpu_has_feature(unsigned long feature)
{
return !!((CPU_FTRS_ALWAYS & feature) ||
(CPU_FTRS_POSSIBLE & cur_cpu_spec->cpu_features & feature));
}
static inline bool cpu_has_feature(unsigned long feature)
{
return early_cpu_has_feature(feature);
}
#define HBP_NUM 1 #define HBP_NUM 1
#endif /* !__ASSEMBLY__ */ #endif /* !__ASSEMBLY__ */
......
...@@ -28,6 +28,7 @@ static inline void setup_cputime_one_jiffy(void) { } ...@@ -28,6 +28,7 @@ static inline void setup_cputime_one_jiffy(void) { }
#include <asm/div64.h> #include <asm/div64.h>
#include <asm/time.h> #include <asm/time.h>
#include <asm/param.h> #include <asm/param.h>
#include <asm/cpu_has_feature.h>
typedef u64 __nocast cputime_t; typedef u64 __nocast cputime_t;
typedef u64 __nocast cputime64_t; typedef u64 __nocast cputime64_t;
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include <linux/threads.h> #include <linux/threads.h>
#include <asm/ppc-opcode.h> #include <asm/ppc-opcode.h>
#include <asm/cpu_has_feature.h>
#define PPC_DBELL_MSG_BRDCAST (0x04000000) #define PPC_DBELL_MSG_BRDCAST (0x04000000)
#define PPC_DBELL_TYPE(x) (((x) & 0xf) << (63-36)) #define PPC_DBELL_TYPE(x) (((x) & 0xf) << (63-36))
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include <linux/spinlock.h> #include <linux/spinlock.h>
#include <asm/cputable.h> #include <asm/cputable.h>
#include <asm/cpu_has_feature.h>
typedef struct { typedef struct {
unsigned int base; unsigned int base;
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include <asm/cputable.h> #include <asm/cputable.h>
#include <linux/mm.h> #include <linux/mm.h>
#include <asm/cpu_has_feature.h>
/* /*
* This file is included by linux/mman.h, so we can't use cacl_vm_prot_bits() * This file is included by linux/mman.h, so we can't use cacl_vm_prot_bits()
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#include <linux/percpu.h> #include <linux/percpu.h>
#include <asm/processor.h> #include <asm/processor.h>
#include <asm/cpu_has_feature.h>
/* time.c */ /* time.c */
extern unsigned long tb_ticks_per_jiffy; extern unsigned long tb_ticks_per_jiffy;
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#ifdef CONFIG_ALTIVEC #ifdef CONFIG_ALTIVEC
#include <asm/cputable.h> #include <asm/cputable.h>
#include <asm/cpu_has_feature.h>
void xor_altivec_2(unsigned long bytes, unsigned long *v1_in, void xor_altivec_2(unsigned long bytes, unsigned long *v1_in,
unsigned long *v2_in); unsigned long *v2_in);
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include <asm/emulated_ops.h> #include <asm/emulated_ops.h>
#include <asm/switch_to.h> #include <asm/switch_to.h>
#include <asm/disassemble.h> #include <asm/disassemble.h>
#include <asm/cpu_has_feature.h>
struct aligninfo { struct aligninfo {
unsigned char len; unsigned char len;
......
...@@ -75,6 +75,7 @@ ...@@ -75,6 +75,7 @@
#endif #endif
#define CREATE_TRACE_POINTS #define CREATE_TRACE_POINTS
#include <asm/trace.h> #include <asm/trace.h>
#include <asm/cpu_has_feature.h>
DEFINE_PER_CPU_SHARED_ALIGNED(irq_cpustat_t, irq_stat); DEFINE_PER_CPU_SHARED_ALIGNED(irq_cpustat_t, irq_stat);
EXPORT_PER_CPU_SYMBOL(irq_stat); EXPORT_PER_CPU_SYMBOL(irq_stat);
......
...@@ -58,6 +58,7 @@ ...@@ -58,6 +58,7 @@
#include <asm/code-patching.h> #include <asm/code-patching.h>
#include <asm/exec.h> #include <asm/exec.h>
#include <asm/livepatch.h> #include <asm/livepatch.h>
#include <asm/cpu_has_feature.h>
#include <linux/kprobes.h> #include <linux/kprobes.h>
#include <linux/kdebug.h> #include <linux/kdebug.h>
......
...@@ -66,6 +66,7 @@ ...@@ -66,6 +66,7 @@
#include <asm/hugetlb.h> #include <asm/hugetlb.h>
#include <asm/livepatch.h> #include <asm/livepatch.h>
#include <asm/mmu_context.h> #include <asm/mmu_context.h>
#include <asm/cpu_has_feature.h>
#include "setup.h" #include "setup.h"
......
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
#include <asm/serial.h> #include <asm/serial.h>
#include <asm/udbg.h> #include <asm/udbg.h>
#include <asm/code-patching.h> #include <asm/code-patching.h>
#include <asm/cpu_has_feature.h>
#define DBG(fmt...) #define DBG(fmt...)
......
...@@ -55,6 +55,7 @@ ...@@ -55,6 +55,7 @@
#include <asm/debug.h> #include <asm/debug.h>
#include <asm/kexec.h> #include <asm/kexec.h>
#include <asm/asm-prototypes.h> #include <asm/asm-prototypes.h>
#include <asm/cpu_has_feature.h>
#ifdef DEBUG #ifdef DEBUG
#include <asm/udbg.h> #include <asm/udbg.h>
......
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
#include <asm/pgtable.h> #include <asm/pgtable.h>
#include <asm/reg.h> #include <asm/reg.h>
#include <asm/cell-regs.h> #include <asm/cell-regs.h>
#include <asm/cpu_has_feature.h>
#include "pervasive.h" #include "pervasive.h"
......
...@@ -20,6 +20,7 @@ along with this file; see the file COPYING. If not, write to the Free ...@@ -20,6 +20,7 @@ along with this file; see the file COPYING. If not, write to the Free
Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
#include <asm/cputable.h> #include <asm/cputable.h>
#include <asm/cpu_has_feature.h>
#include "nonstdio.h" #include "nonstdio.h"
#include "ansidecl.h" #include "ansidecl.h"
#include "ppc.h" #include "ppc.h"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment