Skip to content

Commit f871662

Browse files
authored
1 parent 4515332 commit f871662

File tree

3 files changed

+81
-56
lines changed

3 files changed

+81
-56
lines changed

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ Exit Code 1
281281
| AMXBF16 | Tile computational operations on BFLOAT16 numbers |
282282
| AMXINT8 | Tile computational operations on 8-bit integers |
283283
| AMXFP16 | Tile computational operations on FP16 numbers |
284-
| AMXFP8 | Tile computational operations on FP8 numbers |
284+
| AMXFP8 | Tile computational operations on FP8 numbers |
285285
| AMXCOMPLEX | Tile computational operations on complex numbers |
286286
| AMXTILE | Tile architecture |
287287
| AMXTF32 | Matrix Multiplication of TF32 Tiles into Packed Single Precision Tile |
@@ -451,6 +451,9 @@ Exit Code 1
451451
| TLB_FLUSH_NESTED | AMD: Flushing includes all the nested translations for guest translations |
452452
| TME | Intel Total Memory Encryption. The following MSRs are supported: IA32_TME_CAPABILITY, IA32_TME_ACTIVATE, IA32_TME_EXCLUDE_MASK, and IA32_TME_EXCLUDE_BASE. |
453453
| TOPEXT | TopologyExtensions: topology extensions support. Indicates support for CPUID Fn8000_001D_EAX_x[N:0]-CPUID Fn8000_001E_EDX. |
454+
| TSA_L1_NO | AMD only: Not vulnerable to TSA-L1 |
455+
| TSA_SQ_NO | AMD only: Not vulnerable to TSA-SQ |
456+
| TSA_VERW_CLEAR | AMD: If set, the memory form of the VERW instruction may be used to help mitigate TSA |
454457
| TSCRATEMSR | MSR based TSC rate control. Indicates support for MSR TSC ratio MSRC000_0104 |
455458
| TSXLDTRK | Intel TSX Suspend Load Address Tracking |
456459
| VAES | Vector AES. AVX(512) versions requires additional checks. |

cpuid.go

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,9 @@ const (
256256
TLB_FLUSH_NESTED // AMD: Flushing includes all the nested translations for guest translations
257257
TME // Intel Total Memory Encryption. The following MSRs are supported: IA32_TME_CAPABILITY, IA32_TME_ACTIVATE, IA32_TME_EXCLUDE_MASK, and IA32_TME_EXCLUDE_BASE.
258258
TOPEXT // TopologyExtensions: topology extensions support. Indicates support for CPUID Fn8000_001D_EAX_x[N:0]-CPUID Fn8000_001E_EDX.
259+
TSA_L1_NO // AMD only: Not vulnerable to TSA-L1
260+
TSA_SQ_NO // AM onlyD: Not vulnerable to TSA-SQ
261+
TSA_VERW_CLEAR // If set, the memory form of the VERW instruction may be used to help mitigate TSA
259262
TSCRATEMSR // MSR based TSC rate control. Indicates support for MSR TSC ratio MSRC000_0104
260263
TSXLDTRK // Intel TSX Suspend Load Address Tracking
261264
VAES // Vector AES. AVX(512) versions requires additional checks.
@@ -1553,12 +1556,28 @@ func support() flagSet {
15531556
}
15541557

15551558
if maxExtendedFunction() >= 0x80000021 && vend == AMD {
1556-
a, _, _, _ := cpuid(0x80000021)
1559+
a, _, c, _ := cpuid(0x80000021)
15571560
fs.setIf((a>>31)&1 == 1, SRSO_MSR_FIX)
15581561
fs.setIf((a>>30)&1 == 1, SRSO_USER_KERNEL_NO)
15591562
fs.setIf((a>>29)&1 == 1, SRSO_NO)
15601563
fs.setIf((a>>28)&1 == 1, IBPB_BRTYPE)
15611564
fs.setIf((a>>27)&1 == 1, SBPB)
1565+
fs.setIf((c>>1)&1 == 1, TSA_L1_NO)
1566+
fs.setIf((c>>2)&1 == 1, TSA_SQ_NO)
1567+
fs.setIf((a>>5)&1 == 1, TSA_VERW_CLEAR)
1568+
}
1569+
if vend == AMD {
1570+
if family < 0x19 {
1571+
// AMD CPUs that are older than Family 19h are not vulnerable to TSA but do not set TSA_L1_NO or TSA_SQ_NO.
1572+
// Source: https://www.amd.com/content/dam/amd/en/documents/resources/bulletin/technical-guidance-for-mitigating-transient-scheduler-attacks.pdf
1573+
fs.set(TSA_L1_NO)
1574+
fs.set(TSA_SQ_NO)
1575+
} else if family == 0x1a {
1576+
// AMD Family 1Ah models 00h-4Fh and 60h-7Fh are also not vulnerable to TSA but do not set TSA_L1_NO or TSA_SQ_NO.
1577+
// Future AMD CPUs will set these CPUID bits if appropriate. CPUs will be designed to set these CPUID bits if appropriate.
1578+
notVuln := model <= 0x4f || (model >= 0x60 && model <= 0x7f)
1579+
fs.setIf(notVuln, TSA_L1_NO, TSA_SQ_NO)
1580+
}
15621581
}
15631582

15641583
if mfi >= 0x20 {

featureid_string.go

Lines changed: 57 additions & 54 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)