Changeset View
Changeset View
Standalone View
Standalone View
sys/amd64/amd64/initcpu.c
Show First 20 Lines • Show All 249 Lines • ▼ Show 20 Lines | |||||
/* | /* | ||||
* Initialize CPU control registers | * Initialize CPU control registers | ||||
*/ | */ | ||||
void | void | ||||
initializecpu(void) | initializecpu(void) | ||||
{ | { | ||||
uint64_t msr; | uint64_t msr; | ||||
uint32_t cr4; | uint32_t cr4; | ||||
u_int r[4]; | |||||
cr4 = rcr4(); | cr4 = rcr4(); | ||||
if ((cpu_feature & CPUID_XMM) && (cpu_feature & CPUID_FXSR)) { | if ((cpu_feature & CPUID_XMM) && (cpu_feature & CPUID_FXSR)) { | ||||
cr4 |= CR4_FXSR | CR4_XMM; | cr4 |= CR4_FXSR | CR4_XMM; | ||||
cpu_fxsr = hw_instruction_sse = 1; | cpu_fxsr = hw_instruction_sse = 1; | ||||
} | } | ||||
if (cpu_stdext_feature & CPUID_STDEXT_FSGSBASE) | if (cpu_stdext_feature & CPUID_STDEXT_FSGSBASE) | ||||
cr4 |= CR4_FSGSBASE; | cr4 |= CR4_FSGSBASE; | ||||
▲ Show 20 Lines • Show All 46 Lines • ▼ Show 20 Lines | initializecpu(void) | ||||
case CPU_VENDOR_CENTAUR: | case CPU_VENDOR_CENTAUR: | ||||
init_via(); | init_via(); | ||||
break; | break; | ||||
} | } | ||||
if ((amd_feature & AMDID_RDTSCP) != 0 || | if ((amd_feature & AMDID_RDTSCP) != 0 || | ||||
(cpu_stdext_feature2 & CPUID_STDEXT2_RDPID) != 0) | (cpu_stdext_feature2 & CPUID_STDEXT2_RDPID) != 0) | ||||
wrmsr(MSR_TSC_AUX, cpu_auxmsr()); | wrmsr(MSR_TSC_AUX, cpu_auxmsr()); | ||||
if (cpu_high >= 0x1a) { | |||||
cpuid_count(0x1a, 0, r); | |||||
if ((r[0] & CPUID_HYBRID_CORE_MASK) == | |||||
karels: Do you want to add macros for these constants? Identifying the E-cores will be useful even… | |||||
Done Inline ActionsThe identification of small cores is recorded into pcpu data, so it is there. Still added constants. kib: The identification of small cores is recorded into pcpu data, so it is there. Still added… | |||||
CPUID_HYBRID_SMALL_CORE) { | |||||
PCPU_SET(small_core, 1); | |||||
Done Inline ActionsPerhaps add a short comment explaining what is being worked around here. Hopefully this workaround will be deleted soon, but it is worth describing. markj: Perhaps add a short comment explaining what is being worked around here. Hopefully this… | |||||
Done Inline ActionsAdded a comment to pmap_invlpg(). kib: Added a comment to pmap_invlpg(). | |||||
} | |||||
} | |||||
} | } | ||||
Done Inline ActionsThis should be updated to match the sysctl name. More broadly, I would suggest updating the name of the local variable, use_invlpg_pmap, to be pcid_invlpg_workaround, and the same for the PCPU field's name. alc: This should be updated to match the sysctl name. More broadly, I would suggest updating the… | |||||
void | void | ||||
initializecpucache(void) | initializecpucache(void) | ||||
{ | { | ||||
/* | /* | ||||
* CPUID with %eax = 1, %ebx returns | * CPUID with %eax = 1, %ebx returns | ||||
* Bits 15-8: CLFLUSH line size | * Bits 15-8: CLFLUSH line size | ||||
Show All 25 Lines |
Do you want to add macros for these constants? Identifying the E-cores will be useful even without this workaround, e.g. for the scheduler.