[REVERT-ME]: disable turbo mode

there is a bug for system hang on SBL bootloader after we enabled turbo mode.
so add tmp patch to disable turbo mode as the work-around.
after SBL fixed it, we revert this patch.

Signed-off-by: Jason Chen CJ <jason.cj.chen@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
Jason Chen CJ 2018-07-10 12:00:37 +08:00 committed by lijinxia
parent 3fed57bb9f
commit b3690987bd
2 changed files with 13 additions and 0 deletions

View File

@ -368,6 +368,7 @@ static void get_cpu_name(void)
void bsp_boot_init(void) void bsp_boot_init(void)
{ {
uint64_t rsp; uint64_t rsp;
uint64_t misc_en;
start_tsc = rdtsc(); start_tsc = rdtsc();
@ -436,6 +437,10 @@ void bsp_boot_init(void)
__bitmap_set(BOOT_CPU_ID, &pcpu_active_bitmap); __bitmap_set(BOOT_CPU_ID, &pcpu_active_bitmap);
misc_en = msr_read(MSR_IA32_MISC_ENABLE);
if ((misc_en & TURBO_MODE_DISABLE) == 0)
msr_write(MSR_IA32_MISC_ENABLE, misc_en | TURBO_MODE_DISABLE);
/* Get CPU capabilities thru CPUID, including the physical address bit /* Get CPU capabilities thru CPUID, including the physical address bit
* limit which is required for initializing paging. * limit which is required for initializing paging.
*/ */
@ -563,6 +568,7 @@ static void bsp_boot_post(void)
void cpu_secondary_init(void) void cpu_secondary_init(void)
{ {
uint64_t rsp; uint64_t rsp;
uint64_t misc_en;
/* Switch this CPU to use the same page tables set-up by the /* Switch this CPU to use the same page tables set-up by the
* primary/boot CPU * primary/boot CPU
@ -581,6 +587,10 @@ void cpu_secondary_init(void)
__bitmap_set(get_cpu_id(), &pcpu_active_bitmap); __bitmap_set(get_cpu_id(), &pcpu_active_bitmap);
misc_en = msr_read(MSR_IA32_MISC_ENABLE);
if ((misc_en & TURBO_MODE_DISABLE) == 0)
msr_write(MSR_IA32_MISC_ENABLE, misc_en | TURBO_MODE_DISABLE);
/* Switch to run-time stack */ /* Switch to run-time stack */
rsp = (uint64_t)(&get_cpu_var(stack)[CONFIG_STACK_SIZE - 1]); rsp = (uint64_t)(&get_cpu_var(stack)[CONFIG_STACK_SIZE - 1]);
rsp &= ~(CPU_STACK_ALIGN - 1UL); rsp &= ~(CPU_STACK_ALIGN - 1UL);

View File

@ -554,4 +554,7 @@
#define SPEC_ENABLE_STIBP (1U<<1) #define SPEC_ENABLE_STIBP (1U<<1)
#define PRED_SET_IBPB (1U<<0) #define PRED_SET_IBPB (1U<<0)
/* Turbo config bit */
#define TURBO_MODE_DISABLE (1UL<<38)
#endif /* MSR_H */ #endif /* MSR_H */