@@ -21,6 +21,7 @@
#include <asm/io.h>
#include <asm/intel_pt.h>
#include <asm/intel-family.h>
+#include <asm/cpufeature.h>
#include "../perf_event.h"
#include "pt.h"
@@ -2,12 +2,19 @@
#ifndef _ASM_X86_CPUFEATURE_H
#define _ASM_X86_CPUFEATURE_H
-#include <asm/processor.h>
+#include <linux/types.h>
-#if defined(__KERNEL__) && !defined(__ASSEMBLY__)
+#ifndef __ASSEMBLY__
+struct cpuid_regs {
+ u32 eax, ebx, ecx, edx;
+};
-#include <asm/asm.h>
-#include <linux/bitops.h>
+enum cpuid_regs_idx {
+ CPUID_EAX = 0,
+ CPUID_EBX,
+ CPUID_ECX,
+ CPUID_EDX,
+};
enum cpuid_leafs
{
@@ -32,6 +39,11 @@ enum cpuid_leafs
CPUID_7_EDX,
CPUID_8000_001F_EAX,
};
+#ifdef __KERNEL__
+
+#include <asm/processor.h>
+#include <asm/asm.h>
+#include <linux/bitops.h>
#ifdef CONFIG_X86_FEATURE_NAMES
extern const char * const x86_cap_flags[NCAPINTS*32];
@@ -240,5 +252,6 @@ static __always_inline bool _static_cpu_has(u16 bit)
#define CPU_FEATURE_TYPEVAL boot_cpu_data.x86_vendor, boot_cpu_data.x86, \
boot_cpu_data.x86_model
-#endif /* defined(__KERNEL__) && !defined(__ASSEMBLY__) */
+#endif /* defined(__KERNEL__) */
+#endif /* !defined(__ASSEMBLY__) */
#endif /* _ASM_X86_CPUFEATURE_H */
@@ -142,17 +142,6 @@ struct cpuinfo_x86 {
unsigned initialized : 1;
} __randomize_layout;
-struct cpuid_regs {
- u32 eax, ebx, ecx, edx;
-};
-
-enum cpuid_regs_idx {
- CPUID_EAX = 0,
- CPUID_EBX,
- CPUID_ECX,
- CPUID_EDX,
-};
-
#define X86_VENDOR_INTEL 0
#define X86_VENDOR_CYRIX 1
#define X86_VENDOR_AMD 2
@@ -6,7 +6,7 @@
#include <asm/memtype.h>
#include <asm/apic.h>
-#include <asm/processor.h>
+#include <asm/cpufeature.h>
#include "cpu.h"
@@ -37,7 +37,7 @@
#include <linux/gfp.h>
#include <linux/completion.h>
-#include <asm/processor.h>
+#include <asm/cpufeature.h>
#include <asm/msr.h>
static struct class *cpuid_class;
Move cpuid_regs, cpuid_regs_idx, and cpuid_leafs out of their '#ifdef __KERNEL__' guards so that KVM selftests can reuse the definitions in future patches. Move cpuid_regs and cpuid_regs_idx from processor.h to cpufeature.h to avoid blasting processor.h with several '#ifdefs'. Suggested-by: Sean Christopherson <seanjc@google.com> Signed-off-by: Ricardo Koller <ricarkol@google.com> --- arch/x86/events/intel/pt.c | 1 + arch/x86/include/asm/cpufeature.h | 23 ++++++++++++++++++----- arch/x86/include/asm/processor.h | 11 ----------- arch/x86/kernel/cpu/scattered.c | 2 +- arch/x86/kernel/cpuid.c | 2 +- 5 files changed, 21 insertions(+), 18 deletions(-)