Skip to content

Commit b92a226

Browse files
haokexinmpe
authored andcommitted
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>
1 parent 905259e commit b92a226

File tree

18 files changed

+36
-11
lines changed

18 files changed

+36
-11
lines changed

arch/powerpc/include/asm/book3s/64/mmu-hash.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include <asm/book3s/64/pgtable.h>
2525
#include <asm/bug.h>
2626
#include <asm/processor.h>
27+
#include <asm/cpu_has_feature.h>
2728

2829
/*
2930
* SLB

arch/powerpc/include/asm/cacheflush.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
#include <linux/mm.h>
1313
#include <asm/cputable.h>
14+
#include <asm/cpu_has_feature.h>
1415

1516
/*
1617
* No cache flushing is required when address mappings are changed,
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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 */

arch/powerpc/include/asm/cputable.h

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -577,17 +577,6 @@ enum {
577577
};
578578
#endif /* __powerpc64__ */
579579

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-
591580
#define HBP_NUM 1
592581

593582
#endif /* !__ASSEMBLY__ */

arch/powerpc/include/asm/cputime.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ static inline void setup_cputime_one_jiffy(void) { }
2828
#include <asm/div64.h>
2929
#include <asm/time.h>
3030
#include <asm/param.h>
31+
#include <asm/cpu_has_feature.h>
3132

3233
typedef u64 __nocast cputime_t;
3334
typedef u64 __nocast cputime64_t;

arch/powerpc/include/asm/dbell.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include <linux/threads.h>
1717

1818
#include <asm/ppc-opcode.h>
19+
#include <asm/cpu_has_feature.h>
1920

2021
#define PPC_DBELL_MSG_BRDCAST (0x04000000)
2122
#define PPC_DBELL_TYPE(x) (((x) & 0xf) << (63-36))

arch/powerpc/include/asm/dcr-native.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424

2525
#include <linux/spinlock.h>
2626
#include <asm/cputable.h>
27+
#include <asm/cpu_has_feature.h>
2728

2829
typedef struct {
2930
unsigned int base;

arch/powerpc/include/asm/mman.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
#include <asm/cputable.h>
1515
#include <linux/mm.h>
16+
#include <asm/cpu_has_feature.h>
1617

1718
/*
1819
* This file is included by linux/mman.h, so we can't use cacl_vm_prot_bits()

arch/powerpc/include/asm/time.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include <linux/percpu.h>
1919

2020
#include <asm/processor.h>
21+
#include <asm/cpu_has_feature.h>
2122

2223
/* time.c */
2324
extern unsigned long tb_ticks_per_jiffy;

arch/powerpc/include/asm/xor.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#ifdef CONFIG_ALTIVEC
2424

2525
#include <asm/cputable.h>
26+
#include <asm/cpu_has_feature.h>
2627

2728
void xor_altivec_2(unsigned long bytes, unsigned long *v1_in,
2829
unsigned long *v2_in);

0 commit comments

Comments
 (0)