@@ -691,15 +691,14 @@ static inline u32 per_cpu_l2c_id(unsigned int cpu)
return per_cpu(cpu_info.topo.l2c_id, cpu);
}
+#ifdef CONFIG_CPU_SUP_AMD
/* defined by CPUID_Fn80000026_EBX BIT [31:28] */
enum amd_core_type {
- CPU_CORE_TYPE_NO_HETERO_SUP = -1,
- CPU_CORE_TYPE_PERFORMANCE = 0,
- CPU_CORE_TYPE_EFFICIENCY = 1,
- CPU_CORE_TYPE_UNDEFINED = 2,
+ CPU_CORE_TYPE_PERFORMANCE,
+ CPU_CORE_TYPE_EFFICIENCY,
+ CPU_CORE_TYPE_UNDEFINED,
};
-#ifdef CONFIG_CPU_SUP_AMD
/*
* Issue a DIV 0/1 insn to clear any division data from previous DIV
* operations.
@@ -711,13 +710,13 @@ static __always_inline void amd_clear_divider(void)
}
extern void amd_check_microcode(void);
-extern enum amd_core_type amd_get_core_type(void);
+extern int amd_get_core_type(void);
#else
static inline void amd_clear_divider(void) { }
static inline void amd_check_microcode(void) { }
-static inline enum amd_core_type amd_get_core_type(void)
+static inline int amd_get_core_type(void)
{
- return CPU_CORE_TYPE_NO_HETERO_SUP;
+ return -EINVAL;
}
#endif
@@ -273,7 +273,7 @@ int amd_get_boost_ratio_numerator(unsigned int cpu, u64 *numerator)
/* detect if running on heterogeneous design */
smp_call_function_single(cpu, amd_do_get_core_type, &core_type, 1);
switch (core_type) {
- case CPU_CORE_TYPE_NO_HETERO_SUP:
+ case -EINVAL:
break;
case CPU_CORE_TYPE_PERFORMANCE:
/* use the max scale for performance cores */
@@ -1211,10 +1211,9 @@ void amd_check_microcode(void)
* Returns the CPU type [31:28] (i.e., performance or efficient) of
* a CPU in the processor.
*
- * If the processor has no core type support, returns
- * CPU_CORE_TYPE_NO_HETERO_SUP.
+ * If the processor has no core type support, returns -EINVAL.
*/
-enum amd_core_type amd_get_core_type(void)
+int amd_get_core_type(void)
{
struct {
u32 num_processors :16,
@@ -1224,7 +1223,7 @@ enum amd_core_type amd_get_core_type(void)
} props;
if (!cpu_feature_enabled(X86_FEATURE_AMD_HETEROGENEOUS_CORES))
- return CPU_CORE_TYPE_NO_HETERO_SUP;
+ return -EINVAL;
cpuid_leaf_reg(0x80000026, CPUID_EBX, &props);
if (props.core_type >= CPU_CORE_TYPE_UNDEFINED)
The enum used for AMD core type identification is AMD specific so it should only be in the definition for CONFIG_CPU_SUP_AMD. Move the enum into this scope and adjust function return types since enum amd_core_type won't be available in the non CONFIG_CPU_SUP_AMD case. Instead of a dedicated enum definition of no hetero support use -EINVAL. Suggested-by: Borislav Petkov <bp@alien8.de> Signed-off-by: Mario Limonciello <mario.limonciello@amd.com> --- arch/x86/include/asm/processor.h | 15 +++++++-------- arch/x86/kernel/acpi/cppc.c | 2 +- arch/x86/kernel/cpu/amd.c | 7 +++---- 3 files changed, 11 insertions(+), 13 deletions(-)