1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-11-29 08:08:37 +00:00

Align IA32_ARCH_CAP MSR definitions and use with SDM rev. 068.

SDM rev. 068 was released yesterday and it contains the description of
the MSR 0x10a IA32_ARCH_CAP. This change adds symbolic definitions for
all bits present in the document, and decode them in the CPU
identification lines printed on boot.

But also, the document defines SSB_NO as bit 4, while FreeBSD used but
2 to detect the need to work-around Speculative Store Bypass
issue.  Change code to use the bit from SDM.

Similarly, the document describes bit 3 as an indicator that L1TF
issue is not present, in particular, no L1D flush is needed on
VMENTRY.  We used RDCL_NO to avoid flushing, and again I changed the
code to follow new spec from SDM.

In fact my Apollo Lake machine with latest ucode shows this:
    IA32_ARCH_CAPS=0x19<RDCL_NO,SKIP_L1DFL_VME,SSB_NO>

Reviewed by:	bwidawsk
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
Differential revision:	https://reviews.freebsd.org/D18006
This commit is contained in:
Konstantin Belousov 2018-11-16 21:27:11 +00:00
parent d09389fd05
commit 2343757338
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=340487
4 changed files with 9 additions and 3 deletions

View File

@ -814,7 +814,8 @@ vmx_init(int ipinum)
return (error);
}
guest_l1d_flush = (cpu_ia32_arch_caps & IA32_ARCH_CAP_RDCL_NO) == 0;
guest_l1d_flush = (cpu_ia32_arch_caps &
IA32_ARCH_CAP_SKIP_L1DFL_VMENTRY) == 0;
TUNABLE_INT_FETCH("hw.vmm.l1d_flush", &guest_l1d_flush);
/*

View File

@ -434,7 +434,9 @@
/* MSR IA32_ARCH_CAP(ABILITIES) bits */
#define IA32_ARCH_CAP_RDCL_NO 0x00000001
#define IA32_ARCH_CAP_IBRS_ALL 0x00000002
#define IA32_ARCH_CAP_SSBD_NO 0x00000004
#define IA32_ARCH_CAP_RSBA 0x00000004
#define IA32_ARCH_CAP_SKIP_L1DFL_VMENTRY 0x00000008
#define IA32_ARCH_CAP_SSB_NO 0x00000010
/*
* CPUID manufacturers identifiers

View File

@ -891,7 +891,7 @@ hw_ssb_recalculate(bool all_cpus)
hw_ssb_set(true, all_cpus);
break;
case 2: /* auto */
hw_ssb_set((cpu_ia32_arch_caps & IA32_ARCH_CAP_SSBD_NO) != 0 ?
hw_ssb_set((cpu_ia32_arch_caps & IA32_ARCH_CAP_SSB_NO) != 0 ?
false : true, all_cpus);
break;
}

View File

@ -1014,6 +1014,9 @@ printcpuinfo(void)
"\020"
"\001RDCL_NO"
"\002IBRS_ALL"
"\003RSBA"
"\004SKIP_L1DFL_VME"
"\005SSB_NO"
);
}