Calculate PTI, PCID and INVPCID modes earlier, before ifuncs are resolved.
This will be used in following conversion of pmap_activate_sw(). Reviewed by: alc, markj Sponsored by: The FreeBSD Foundation Approved by: re (gjb) Differential revision: https://reviews.freebsd.org/D17181
This commit is contained in:
parent
76ed0c542f
commit
09a6ada991
@ -1581,6 +1581,21 @@ hammer_time(u_int64_t modulep, u_int64_t physfree)
|
||||
*/
|
||||
identify_cpu2();
|
||||
|
||||
/*
|
||||
* Check for pti, pcid, and invpcid before ifuncs are
|
||||
* resolved, to correctly select the implementation for
|
||||
* pmap_activate_sw_mode().
|
||||
*/
|
||||
pti = pti_get_default();
|
||||
TUNABLE_INT_FETCH("vm.pmap.pti", &pti);
|
||||
TUNABLE_INT_FETCH("vm.pmap.pcid_enabled", &pmap_pcid_enabled);
|
||||
if ((cpu_feature2 & CPUID2_PCID) != 0 && pmap_pcid_enabled) {
|
||||
invpcid_works = (cpu_stdext_feature &
|
||||
CPUID_STDEXT_INVPCID) != 0;
|
||||
} else {
|
||||
pmap_pcid_enabled = 0;
|
||||
}
|
||||
|
||||
link_elf_ireloc(kmdp);
|
||||
|
||||
/*
|
||||
@ -1645,9 +1660,6 @@ hammer_time(u_int64_t modulep, u_int64_t physfree)
|
||||
mtx_init(&dt_lock, "descriptor tables", NULL, MTX_DEF);
|
||||
|
||||
/* exceptions */
|
||||
pti = pti_get_default();
|
||||
TUNABLE_INT_FETCH("vm.pmap.pti", &pti);
|
||||
|
||||
for (x = 0; x < NIDT; x++)
|
||||
setidt(x, pti ? &IDTVEC(rsvd_pti) : &IDTVEC(rsvd), SDT_SYSIGT,
|
||||
SEL_KPL, 0);
|
||||
|
@ -1179,11 +1179,7 @@ pmap_bootstrap(vm_paddr_t *firstaddr)
|
||||
pmap_init_pat();
|
||||
|
||||
/* Initialize TLB Context Id. */
|
||||
TUNABLE_INT_FETCH("vm.pmap.pcid_enabled", &pmap_pcid_enabled);
|
||||
if ((cpu_feature2 & CPUID2_PCID) != 0 && pmap_pcid_enabled) {
|
||||
/* Check for INVPCID support */
|
||||
invpcid_works = (cpu_stdext_feature & CPUID_STDEXT_INVPCID)
|
||||
!= 0;
|
||||
if (pmap_pcid_enabled) {
|
||||
for (i = 0; i < MAXCPU; i++) {
|
||||
kernel_pmap->pm_pcids[i].pm_pcid = PMAP_PCID_KERN;
|
||||
kernel_pmap->pm_pcids[i].pm_gen = 1;
|
||||
@ -1204,8 +1200,6 @@ pmap_bootstrap(vm_paddr_t *firstaddr)
|
||||
* during pcpu setup.
|
||||
*/
|
||||
load_cr4(rcr4() | CR4_PCIDE);
|
||||
} else {
|
||||
pmap_pcid_enabled = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user