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 from before the call until after | |||||
kib: I suggest to trim this sentence to just
```
Caller should prevent CPU migration.
``` | |||||
* consuming the call's return value. | |||||
*/ | */ | ||||
u_int | u_int | ||||
cpu_auxmsr(void) | cpu_auxmsr(void) | ||||
{ | { | ||||
/* | |||||
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… | |||||
* Although disabling interrupts is, of course, not the only way to | |||||
Done Inline ActionsRemove blank line. kib: Remove blank line. | |||||
* prevent CPU migration, since all existing callers happen to do | |||||
* this, make this the precedent for future callers until there is | |||||
* a reason to do otherwise. | |||||
*/ | |||||
kibUnsubmitted 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… | |||||
KASSERT((read_rflags() & PSL_I) == 0, | |||||
("cpu_auxmsr() returns a CPU-specific value; caller " | |||||
kibUnsubmitted 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… | |||||
"should prevent migration until after consuming it.")); | |||||
return (PCPU_GET(cpuid)); | return (PCPU_GET(cpuid)); | ||||
} | } | ||||
/* | /* | ||||
* Initialize CPU control registers | * Initialize CPU control registers | ||||
*/ | */ | ||||
void | void | ||||
initializecpu(void) | initializecpu(void) | ||||
▲ Show 20 Lines • Show All 96 Lines • Show Last 20 Lines |
I suggest to trim this sentence to just