Changeset View
Changeset View
Standalone View
Standalone View
sys/amd64/amd64/initcpu.c
Show All 36 Lines | |||||
#include <sys/param.h> | #include <sys/param.h> | ||||
#include <sys/kernel.h> | #include <sys/kernel.h> | ||||
#include <sys/pcpu.h> | #include <sys/pcpu.h> | ||||
#include <sys/systm.h> | #include <sys/systm.h> | ||||
#include <sys/sysctl.h> | #include <sys/sysctl.h> | ||||
#include <machine/cputypes.h> | #include <machine/cputypes.h> | ||||
#include <machine/md_var.h> | #include <machine/md_var.h> | ||||
#include <machine/psl.h> | |||||
#include <machine/specialreg.h> | #include <machine/specialreg.h> | ||||
#include <vm/vm.h> | #include <vm/vm.h> | ||||
#include <vm/pmap.h> | #include <vm/pmap.h> | ||||
static int hw_instruction_sse; | static int hw_instruction_sse; | ||||
SYSCTL_INT(_hw, OID_AUTO, instruction_sse, CTLFLAG_RD, | SYSCTL_INT(_hw, OID_AUTO, instruction_sse, CTLFLAG_RD, | ||||
&hw_instruction_sse, 0, "SIMD/MMX2 instructions available in CPU"); | &hw_instruction_sse, 0, "SIMD/MMX2 instructions available in CPU"); | ||||
▲ Show 20 Lines • Show All 160 Lines • ▼ Show 20 Lines | if ((val & VIA_CPUID_HAS_PHE) != 0) | ||||
via_feature_xcrypt |= VIA_HAS_SHA; | via_feature_xcrypt |= VIA_HAS_SHA; | ||||
if ((val & VIA_CPUID_HAS_PMM) != 0) | if ((val & VIA_CPUID_HAS_PMM) != 0) | ||||
via_feature_xcrypt |= VIA_HAS_MM; | via_feature_xcrypt |= VIA_HAS_MM; | ||||
if (via_feature_xcrypt != 0) | if (via_feature_xcrypt != 0) | ||||
wrmsr(0x1107, rdmsr(0x1107) | (1 << 28)); | wrmsr(0x1107, rdmsr(0x1107) | (1 << 28)); | ||||
} | } | ||||
/* | /* | ||||
* The value for the TSC_AUX MSR and rdtscp/rdpid. | * The value for the TSC_AUX MSR and rdtscp/rdpid on the invoking CPU. | ||||
* | |||||
* Caller should prevent CPU migration. | |||||
kib: I suggest to trim this sentence to just
```
Caller should prevent CPU migration.
``` | |||||
*/ | */ | ||||
u_int | u_int | ||||
cpu_auxmsr(void) | cpu_auxmsr(void) | ||||
{ | { | ||||
KASSERT((read_rflags() & PSL_I) == 0, ("context switch possible")); | |||||
Done Inline ActionsI suggest to write the message Context switch possible instead of interrupts enabled which just repeats the assert code. It is more to the point IMO. kib: I suggest to write the message `Context switch possible` instead of `interrupts enabled` which… | |||||
return (PCPU_GET(cpuid)); | return (PCPU_GET(cpuid)); | ||||
Done Inline ActionsRemove blank line. kib: Remove blank line. | |||||
} | } | ||||
/* | /* | ||||
* Initialize CPU control registers | * Initialize CPU control registers | ||||
Done Inline ActionsI am not sure the comment is useful. If somebody is using this in context that only prevents scheduling, e.g. in critical section, he should be qualified enough to change assert to accommodate new situation. Comment above the function gives enough clue, if needed. kib: I am not sure the comment is useful. If somebody is using this in context that only prevents… | |||||
*/ | */ | ||||
void | void | ||||
Done Inline ActionsIndent of contig lines should be +4 spaces, no alignment to opening braces. Also I believe the message could be made much shorter without loosing the information. kib: Indent of contig lines should be +4 spaces, no alignment to opening braces. Also I believe the… | |||||
initializecpu(void) | initializecpu(void) | ||||
{ | { | ||||
uint64_t msr; | uint64_t msr; | ||||
uint32_t cr4; | uint32_t cr4; | ||||
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; | ||||
▲ Show 20 Lines • Show All 89 Lines • Show Last 20 Lines |
I suggest to trim this sentence to just