From eecbf169873f54d32a7a748f72044c80fcc94a3d Mon Sep 17 00:00:00 2001 From: Stefan Lankes Date: Tue, 8 Mar 2016 16:20:13 +0100 Subject: [PATCH] add debug messges, disable temporary the p-state handling --- hermit/arch/x86/include/asm/processor.h | 5 +++++ hermit/arch/x86/kernel/processor.c | 16 +++++++++++----- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/hermit/arch/x86/include/asm/processor.h b/hermit/arch/x86/include/asm/processor.h index 54d278a28..860199736 100644 --- a/hermit/arch/x86/include/asm/processor.h +++ b/hermit/arch/x86/include/asm/processor.h @@ -202,6 +202,11 @@ extern "C" { #define MSR_XAPIC_ENABLE (1UL << 11) #define MSR_X2APIC_ENABLE (1UL << 10) +#define MSR_IA32_PLATFORM_ID 0x00000017 + +#define MSR_IA32_PERFCTR0 0x000000c1 +#define MSR_IA32_PERFCTR1 0x000000c2 +#define MSR_FSB_FREQ 0x000000cd #define MSR_PLATFORM_INFO 0x000000ce #define MSR_IA32_MPERF 0x000000e7 diff --git a/hermit/arch/x86/kernel/processor.c b/hermit/arch/x86/kernel/processor.c index f28b6328c..2a52e1696 100644 --- a/hermit/arch/x86/kernel/processor.c +++ b/hermit/arch/x86/kernel/processor.c @@ -224,11 +224,18 @@ static int get_max_pstate(void) return (value >> 8) & 0xFF; } +static uint8_t is_turbo = 0; +static int max_pstate, min_pstate; +static int turbo_pstate; + static int get_turbo_pstate(void) { uint64_t value; int i, ret; + if (!is_turbo) + return get_max_pstate(); + value = rdmsr(MSR_NHM_TURBO_RATIO_LIMIT); i = get_max_pstate(); ret = (value) & 255; @@ -238,10 +245,6 @@ static int get_turbo_pstate(void) return ret; } -static uint8_t is_turbo = 0; -static int max_pstate, min_pstate; -static int turbo_pstate; - static void set_pstate(int pstate) { uint64_t v = pstate << 8; @@ -323,12 +326,14 @@ static void check_est(uint8_t out) min_pstate = get_min_pstate(); turbo_pstate = get_turbo_pstate(); +#if 0 // set boot_processor to turbo pstate because // the boot processor has to handle the LwIP thread if (out) set_pstate(turbo_pstate); else set_pstate(max_pstate); +#endif if (out) dump_pstate(); @@ -559,10 +564,11 @@ int cpu_detection(void) { uint64_t msr; kprintf("IA32_MISC_ENABLE 0x%llx\n", rdmsr(MSR_IA32_MISC_ENABLE)); + kprintf("IA32_PLATFORM_ID 0x%llx\n", rdmsr(MSR_IA32_PLATFORM_ID)); if (has_pat()) { msr = rdmsr(MSR_IA32_CR_PAT); - kprintf("MSR_IA32_CR_PAT 0x%llx\n", msr); + kprintf("IA32_CR_PAT 0x%llx\n", msr); kprintf("PAT use per default %s\n", (msr & 0xF) == 0x6 ? "writeback." : "NO writeback!"); }