Page MenuHomeFreeBSD

D55218.id171645.diff
No OneTemporary

D55218.id171645.diff

diff --git a/sys/amd64/amd64/efirt_machdep.c b/sys/amd64/amd64/efirt_machdep.c
--- a/sys/amd64/amd64/efirt_machdep.c
+++ b/sys/amd64/amd64/efirt_machdep.c
@@ -348,6 +348,8 @@
*/
if (!pmap_pcid_enabled)
invltlb();
+ if (lass_enabled)
+ load_cr4(rcr4() & ~CR4_LASS);
return (0);
}
@@ -357,6 +359,8 @@
pmap_t curpmap;
uint64_t cr3;
+ if (lass_enabled)
+ load_cr4(rcr4() | CR4_LASS);
curpmap = &curproc->p_vmspace->vm_pmap;
cr3 = curpmap->pm_cr3;
if (pmap_pcid_enabled) {
diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c
--- a/sys/amd64/amd64/machdep.c
+++ b/sys/amd64/amd64/machdep.c
@@ -204,6 +204,7 @@
long Maxmem = 0;
long realmem = 0;
int late_console = 1;
+int lass_enabled = 0;
struct kva_md_info kmi;
@@ -1351,6 +1352,11 @@
TUNABLE_INT_FETCH("hw.use_xsave", &use_xsave);
}
+ if ((cpu_stdext_feature4 & CPUID_STDEXT4_LASS) != 0) {
+ lass_enabled = 1;
+ TUNABLE_INT_FETCH("hw.lass", &lass_enabled);
+ }
+
sched_instance_select();
link_elf_ireloc();
@@ -1515,6 +1521,8 @@
ltr(gsel_tss);
amd64_conf_fast_syscall();
+ if (lass_enabled)
+ load_cr4(rcr4() | CR4_LASS);
/*
* We initialize the PCB pointer early so that exception
diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c
--- a/sys/amd64/amd64/pmap.c
+++ b/sys/amd64/amd64/pmap.c
@@ -1737,6 +1737,7 @@
{
void (*la57_tramp)(uint64_t pml5);
pml5_entry_t *pt;
+ uint64_t cr4;
if ((cpu_stdext_feature2 & CPUID_STDEXT2_LA57) == 0)
return;
@@ -1757,8 +1758,16 @@
KERNSTART + amd64_loadaddr());
printf("Calling la57 trampoline at %p, KPML5phys %#lx ...",
la57_tramp, KPML5phys);
+ if (lass_enabled) {
+ cr4 = rcr4();
+ load_cr4(cr4 & ~CR4_LASS);
+ }
la57_tramp(KPML5phys);
printf(" alive in la57 mode\n");
+ if (lass_enabled) {
+ cr4 = rcr4();
+ load_cr4(cr4 | CR4_LASS);
+ }
}
static void
diff --git a/sys/amd64/include/md_var.h b/sys/amd64/include/md_var.h
--- a/sys/amd64/include/md_var.h
+++ b/sys/amd64/include/md_var.h
@@ -45,6 +45,7 @@
extern int hw_ssb_disable;
extern int nmi_flush_l1d_sw;
extern int syscall_ret_l1d_flush_mode;
+extern int lass_enabled;
extern vm_paddr_t intel_graphics_stolen_base;
extern vm_paddr_t intel_graphics_stolen_size;
diff --git a/sys/x86/x86/mp_x86.c b/sys/x86/x86/mp_x86.c
--- a/sys/x86/x86/mp_x86.c
+++ b/sys/x86/x86/mp_x86.c
@@ -1127,8 +1127,14 @@
atomic_store_rel_int(&ap_boot_lock, 0);
#ifdef __amd64__
+ u_long cr4;
+
+ cr4 = rcr4();
if (pmap_pcid_enabled)
- load_cr4(rcr4() | CR4_PCIDE);
+ cr4 |= CR4_PCIDE;
+ if (lass_enabled)
+ cr4 |= CR4_LASS;
+ load_cr4(cr4);
load_ds(_udatasel);
load_es(_udatasel);
load_fs(_ufssel);

File Metadata

Mime Type
text/plain
Expires
Sun, Jul 19, 3:49 AM (12 h, 43 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
35219256
Default Alt Text
D55218.id171645.diff (2 KB)

Event Timeline