Print this page
OS-7125 Need mitigation of L1TF (CVE-2018-3646)
Reviewed by: Robert Mustacchi <rm@joyent.com>
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/uts/intel/sys/x86_archext.h
+++ new/usr/src/uts/intel/sys/x86_archext.h
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License (the "License").
6 6 * You may not use this file except in compliance with the License.
7 7 *
8 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 * or http://www.opensolaris.org/os/licensing.
10 10 * See the License for the specific language governing permissions
11 11 * and limitations under the License.
12 12 *
13 13 * When distributing Covered Code, include this CDDL HEADER in each
14 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 15 * If applicable, add the following below this CDDL HEADER, with the
16 16 * fields enclosed by brackets "[]" replaced with your own identifying
17 17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 18 *
19 19 * CDDL HEADER END
20 20 */
21 21 /*
22 22 * Copyright (c) 1995, 2010, Oracle and/or its affiliates. All rights reserved.
23 23 * Copyright (c) 2011 by Delphix. All rights reserved.
24 24 */
25 25 /*
26 26 * Copyright (c) 2010, Intel Corporation.
27 27 * All rights reserved.
28 28 */
29 29 /*
30 30 * Copyright 2019, Joyent, Inc.
31 31 * Copyright 2012 Jens Elkner <jel+illumos@cs.uni-magdeburg.de>
32 32 * Copyright 2012 Hans Rosenfeld <rosenfeld@grumpf.hope-2000.org>
33 33 * Copyright 2014 Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
34 34 * Copyright 2018 Nexenta Systems, Inc.
35 35 */
36 36
37 37 #ifndef _SYS_X86_ARCHEXT_H
38 38 #define _SYS_X86_ARCHEXT_H
39 39
40 40 #if !defined(_ASM)
41 41 #include <sys/regset.h>
42 42 #include <sys/processor.h>
43 43 #include <vm/seg_enum.h>
44 44 #include <vm/page.h>
45 45 #endif /* _ASM */
46 46
47 47 #ifdef __cplusplus
48 48 extern "C" {
49 49 #endif
50 50
51 51 /*
52 52 * cpuid instruction feature flags in %edx (standard function 1)
53 53 */
54 54
55 55 #define CPUID_INTC_EDX_FPU 0x00000001 /* x87 fpu present */
56 56 #define CPUID_INTC_EDX_VME 0x00000002 /* virtual-8086 extension */
57 57 #define CPUID_INTC_EDX_DE 0x00000004 /* debugging extensions */
58 58 #define CPUID_INTC_EDX_PSE 0x00000008 /* page size extension */
59 59 #define CPUID_INTC_EDX_TSC 0x00000010 /* time stamp counter */
60 60 #define CPUID_INTC_EDX_MSR 0x00000020 /* rdmsr and wrmsr */
61 61 #define CPUID_INTC_EDX_PAE 0x00000040 /* physical addr extension */
62 62 #define CPUID_INTC_EDX_MCE 0x00000080 /* machine check exception */
63 63 #define CPUID_INTC_EDX_CX8 0x00000100 /* cmpxchg8b instruction */
64 64 #define CPUID_INTC_EDX_APIC 0x00000200 /* local APIC */
65 65 /* 0x400 - reserved */
66 66 #define CPUID_INTC_EDX_SEP 0x00000800 /* sysenter and sysexit */
67 67 #define CPUID_INTC_EDX_MTRR 0x00001000 /* memory type range reg */
68 68 #define CPUID_INTC_EDX_PGE 0x00002000 /* page global enable */
69 69 #define CPUID_INTC_EDX_MCA 0x00004000 /* machine check arch */
70 70 #define CPUID_INTC_EDX_CMOV 0x00008000 /* conditional move insns */
71 71 #define CPUID_INTC_EDX_PAT 0x00010000 /* page attribute table */
72 72 #define CPUID_INTC_EDX_PSE36 0x00020000 /* 36-bit pagesize extension */
73 73 #define CPUID_INTC_EDX_PSN 0x00040000 /* processor serial number */
74 74 #define CPUID_INTC_EDX_CLFSH 0x00080000 /* clflush instruction */
75 75 /* 0x100000 - reserved */
76 76 #define CPUID_INTC_EDX_DS 0x00200000 /* debug store exists */
77 77 #define CPUID_INTC_EDX_ACPI 0x00400000 /* monitoring + clock ctrl */
78 78 #define CPUID_INTC_EDX_MMX 0x00800000 /* MMX instructions */
79 79 #define CPUID_INTC_EDX_FXSR 0x01000000 /* fxsave and fxrstor */
80 80 #define CPUID_INTC_EDX_SSE 0x02000000 /* streaming SIMD extensions */
81 81 #define CPUID_INTC_EDX_SSE2 0x04000000 /* SSE extensions */
82 82 #define CPUID_INTC_EDX_SS 0x08000000 /* self-snoop */
83 83 #define CPUID_INTC_EDX_HTT 0x10000000 /* Hyper Thread Technology */
84 84 #define CPUID_INTC_EDX_TM 0x20000000 /* thermal monitoring */
85 85 #define CPUID_INTC_EDX_IA64 0x40000000 /* Itanium emulating IA32 */
86 86 #define CPUID_INTC_EDX_PBE 0x80000000 /* Pending Break Enable */
87 87
88 88 /*
89 89 * cpuid instruction feature flags in %ecx (standard function 1)
90 90 */
91 91
92 92 #define CPUID_INTC_ECX_SSE3 0x00000001 /* Yet more SSE extensions */
93 93 #define CPUID_INTC_ECX_PCLMULQDQ 0x00000002 /* PCLMULQDQ insn */
94 94 #define CPUID_INTC_ECX_DTES64 0x00000004 /* 64-bit DS area */
95 95 #define CPUID_INTC_ECX_MON 0x00000008 /* MONITOR/MWAIT */
96 96 #define CPUID_INTC_ECX_DSCPL 0x00000010 /* CPL-qualified debug store */
97 97 #define CPUID_INTC_ECX_VMX 0x00000020 /* Hardware VM extensions */
98 98 #define CPUID_INTC_ECX_SMX 0x00000040 /* Secure mode extensions */
99 99 #define CPUID_INTC_ECX_EST 0x00000080 /* enhanced SpeedStep */
100 100 #define CPUID_INTC_ECX_TM2 0x00000100 /* thermal monitoring */
101 101 #define CPUID_INTC_ECX_SSSE3 0x00000200 /* Supplemental SSE3 insns */
102 102 #define CPUID_INTC_ECX_CID 0x00000400 /* L1 context ID */
103 103 /* 0x00000800 - reserved */
104 104 #define CPUID_INTC_ECX_FMA 0x00001000 /* Fused Multiply Add */
105 105 #define CPUID_INTC_ECX_CX16 0x00002000 /* cmpxchg16 */
106 106 #define CPUID_INTC_ECX_ETPRD 0x00004000 /* extended task pri messages */
107 107 #define CPUID_INTC_ECX_PDCM 0x00008000 /* Perf/Debug Capability MSR */
108 108 /* 0x00010000 - reserved */
109 109 #define CPUID_INTC_ECX_PCID 0x00020000 /* process-context ids */
110 110 #define CPUID_INTC_ECX_DCA 0x00040000 /* direct cache access */
111 111 #define CPUID_INTC_ECX_SSE4_1 0x00080000 /* SSE4.1 insns */
112 112 #define CPUID_INTC_ECX_SSE4_2 0x00100000 /* SSE4.2 insns */
113 113 #define CPUID_INTC_ECX_X2APIC 0x00200000 /* x2APIC */
114 114 #define CPUID_INTC_ECX_MOVBE 0x00400000 /* MOVBE insn */
115 115 #define CPUID_INTC_ECX_POPCNT 0x00800000 /* POPCNT insn */
116 116 #define CPUID_INTC_ECX_TSCDL 0x01000000 /* Deadline TSC */
117 117 #define CPUID_INTC_ECX_AES 0x02000000 /* AES insns */
118 118 #define CPUID_INTC_ECX_XSAVE 0x04000000 /* XSAVE/XRESTOR insns */
119 119 #define CPUID_INTC_ECX_OSXSAVE 0x08000000 /* OS supports XSAVE insns */
120 120 #define CPUID_INTC_ECX_AVX 0x10000000 /* AVX supported */
121 121 #define CPUID_INTC_ECX_F16C 0x20000000 /* F16C supported */
122 122 #define CPUID_INTC_ECX_RDRAND 0x40000000 /* RDRAND supported */
123 123 #define CPUID_INTC_ECX_HV 0x80000000 /* Hypervisor */
124 124
125 125 /*
126 126 * cpuid instruction feature flags in %edx (extended function 0x80000001)
127 127 */
128 128
129 129 #define CPUID_AMD_EDX_FPU 0x00000001 /* x87 fpu present */
130 130 #define CPUID_AMD_EDX_VME 0x00000002 /* virtual-8086 extension */
131 131 #define CPUID_AMD_EDX_DE 0x00000004 /* debugging extensions */
132 132 #define CPUID_AMD_EDX_PSE 0x00000008 /* page size extensions */
133 133 #define CPUID_AMD_EDX_TSC 0x00000010 /* time stamp counter */
134 134 #define CPUID_AMD_EDX_MSR 0x00000020 /* rdmsr and wrmsr */
135 135 #define CPUID_AMD_EDX_PAE 0x00000040 /* physical addr extension */
136 136 #define CPUID_AMD_EDX_MCE 0x00000080 /* machine check exception */
137 137 #define CPUID_AMD_EDX_CX8 0x00000100 /* cmpxchg8b instruction */
138 138 #define CPUID_AMD_EDX_APIC 0x00000200 /* local APIC */
139 139 /* 0x00000400 - sysc on K6m6 */
140 140 #define CPUID_AMD_EDX_SYSC 0x00000800 /* AMD: syscall and sysret */
141 141 #define CPUID_AMD_EDX_MTRR 0x00001000 /* memory type and range reg */
142 142 #define CPUID_AMD_EDX_PGE 0x00002000 /* page global enable */
143 143 #define CPUID_AMD_EDX_MCA 0x00004000 /* machine check arch */
144 144 #define CPUID_AMD_EDX_CMOV 0x00008000 /* conditional move insns */
145 145 #define CPUID_AMD_EDX_PAT 0x00010000 /* K7: page attribute table */
146 146 #define CPUID_AMD_EDX_FCMOV 0x00010000 /* FCMOVcc etc. */
147 147 #define CPUID_AMD_EDX_PSE36 0x00020000 /* 36-bit pagesize extension */
148 148 /* 0x00040000 - reserved */
149 149 /* 0x00080000 - reserved */
150 150 #define CPUID_AMD_EDX_NX 0x00100000 /* AMD: no-execute page prot */
151 151 /* 0x00200000 - reserved */
152 152 #define CPUID_AMD_EDX_MMXamd 0x00400000 /* AMD: MMX extensions */
153 153 #define CPUID_AMD_EDX_MMX 0x00800000 /* MMX instructions */
154 154 #define CPUID_AMD_EDX_FXSR 0x01000000 /* fxsave and fxrstor */
155 155 #define CPUID_AMD_EDX_FFXSR 0x02000000 /* fast fxsave/fxrstor */
156 156 #define CPUID_AMD_EDX_1GPG 0x04000000 /* 1GB page */
157 157 #define CPUID_AMD_EDX_TSCP 0x08000000 /* rdtscp instruction */
158 158 /* 0x10000000 - reserved */
159 159 #define CPUID_AMD_EDX_LM 0x20000000 /* AMD: long mode */
160 160 #define CPUID_AMD_EDX_3DNowx 0x40000000 /* AMD: extensions to 3DNow! */
161 161 #define CPUID_AMD_EDX_3DNow 0x80000000 /* AMD: 3DNow! instructions */
162 162
163 163 #define CPUID_AMD_ECX_AHF64 0x00000001 /* LAHF and SAHF in long mode */
164 164 #define CPUID_AMD_ECX_CMP_LGCY 0x00000002 /* AMD: multicore chip */
165 165 #define CPUID_AMD_ECX_SVM 0x00000004 /* AMD: secure VM */
166 166 #define CPUID_AMD_ECX_EAS 0x00000008 /* extended apic space */
167 167 #define CPUID_AMD_ECX_CR8D 0x00000010 /* AMD: 32-bit mov %cr8 */
168 168 #define CPUID_AMD_ECX_LZCNT 0x00000020 /* AMD: LZCNT insn */
169 169 #define CPUID_AMD_ECX_SSE4A 0x00000040 /* AMD: SSE4A insns */
170 170 #define CPUID_AMD_ECX_MAS 0x00000080 /* AMD: MisAlignSse mnode */
171 171 #define CPUID_AMD_ECX_3DNP 0x00000100 /* AMD: 3DNowPrefectch */
172 172 #define CPUID_AMD_ECX_OSVW 0x00000200 /* AMD: OSVW */
173 173 #define CPUID_AMD_ECX_IBS 0x00000400 /* AMD: IBS */
174 174 #define CPUID_AMD_ECX_XOP 0x00000800 /* AMD: Extended Operation */
175 175 #define CPUID_AMD_ECX_SKINIT 0x00001000 /* AMD: SKINIT */
176 176 #define CPUID_AMD_ECX_WDT 0x00002000 /* AMD: WDT */
177 177 /* 0x00004000 - reserved */
178 178 #define CPUID_AMD_ECX_LWP 0x00008000 /* AMD: Lightweight profiling */
179 179 #define CPUID_AMD_ECX_FMA4 0x00010000 /* AMD: 4-operand FMA support */
180 180 /* 0x00020000 - reserved */
181 181 /* 0x00040000 - reserved */
182 182 #define CPUID_AMD_ECX_NIDMSR 0x00080000 /* AMD: Node ID MSR */
183 183 /* 0x00100000 - reserved */
184 184 #define CPUID_AMD_ECX_TBM 0x00200000 /* AMD: trailing bit manips. */
185 185 #define CPUID_AMD_ECX_TOPOEXT 0x00400000 /* AMD: Topology Extensions */
186 186 #define CPUID_AMD_ECX_PCEC 0x00800000 /* AMD: Core ext perf counter */
187 187 #define CUPID_AMD_ECX_PCENB 0x01000000 /* AMD: NB ext perf counter */
188 188 /* 0x02000000 - reserved */
189 189 #define CPUID_AMD_ECX_DBKP 0x40000000 /* AMD: Data breakpoint */
190 190 #define CPUID_AMD_ECX_PERFTSC 0x08000000 /* AMD: TSC Perf Counter */
191 191 #define CPUID_AMD_ECX_PERFL3 0x10000000 /* AMD: L3 Perf Counter */
192 192 #define CPUID_AMD_ECX_MONITORX 0x20000000 /* AMD: clzero */
193 193 /* 0x40000000 - reserved */
194 194 /* 0x80000000 - reserved */
195 195
196 196 /*
197 197 * AMD uses %ebx for some of their features (extended function 0x80000008).
198 198 */
199 199 #define CPUID_AMD_EBX_CLZERO 0x000000001 /* AMD: CLZERO instr */
200 200 #define CPUID_AMD_EBX_IRCMSR 0x000000002 /* AMD: Ret. instrs MSR */
201 201 #define CPUID_AMD_EBX_ERR_PTR_ZERO 0x000000004 /* AMD: FP Err. Ptr. Zero */
202 202 #define CPUID_AMD_EBX_IBPB 0x000001000 /* AMD: IBPB */
203 203 #define CPUID_AMD_EBX_IBRS 0x000004000 /* AMD: IBRS */
204 204 #define CPUID_AMD_EBX_STIBP 0x000008000 /* AMD: STIBP */
205 205 #define CPUID_AMD_EBX_IBRS_ALL 0x000010000 /* AMD: Enhanced IBRS */
206 206 #define CPUID_AMD_EBX_STIBP_ALL 0x000020000 /* AMD: STIBP ALL */
207 207 #define CPUID_AMD_EBX_PREFER_IBRS 0x000040000 /* AMD: Don't retpoline */
208 208 #define CPUID_AMD_EBX_SSBD 0x001000000 /* AMD: SSBD */
209 209 #define CPUID_AMD_EBX_VIRT_SSBD 0x002000000 /* AMD: VIRT SSBD */
210 210 #define CPUID_AMD_EBX_SSB_NO 0x004000000 /* AMD: SSB Fixed */
211 211
212 212 /*
213 213 * Intel now seems to have claimed part of the "extended" function
214 214 * space that we previously for non-Intel implementors to use.
215 215 * More excitingly still, they've claimed bit 20 to mean LAHF/SAHF
216 216 * is available in long mode i.e. what AMD indicate using bit 0.
217 217 * On the other hand, everything else is labelled as reserved.
218 218 */
219 219 #define CPUID_INTC_ECX_AHF64 0x00100000 /* LAHF and SAHF in long mode */
220 220
221 221 /*
222 222 * Intel also uses cpuid leaf 7 to have additional instructions and features.
223 223 * Like some other leaves, but unlike the current ones we care about, it
224 224 * requires us to specify both a leaf in %eax and a sub-leaf in %ecx. To deal
225 225 * with the potential use of additional sub-leaves in the future, we now
226 226 * specifically label the EBX features with their leaf and sub-leaf.
227 227 */
228 228 #define CPUID_INTC_EBX_7_0_FSGSBASE 0x00000001 /* FSGSBASE */
229 229 #define CPUID_INTC_EBX_7_0_TSC_ADJ 0x00000002 /* TSC adjust MSR */
230 230 #define CPUID_INTC_EBX_7_0_SGX 0x00000004 /* SGX */
231 231 #define CPUID_INTC_EBX_7_0_BMI1 0x00000008 /* BMI1 instrs */
232 232 #define CPUID_INTC_EBX_7_0_HLE 0x00000010 /* HLE */
233 233 #define CPUID_INTC_EBX_7_0_AVX2 0x00000020 /* AVX2 supported */
234 234 /* Bit 6 is reserved */
235 235 #define CPUID_INTC_EBX_7_0_SMEP 0x00000080 /* SMEP in CR4 */
236 236 #define CPUID_INTC_EBX_7_0_BMI2 0x00000100 /* BMI2 instrs */
237 237 #define CPUID_INTC_EBX_7_0_ENH_REP_MOV 0x00000200 /* Enhanced REP MOVSB */
238 238 #define CPUID_INTC_EBX_7_0_INVPCID 0x00000400 /* invpcid instr */
239 239 #define CPUID_INTC_EBX_7_0_RTM 0x00000800 /* RTM instrs */
240 240 #define CPUID_INTC_EBX_7_0_PQM 0x00001000 /* QoS Monitoring */
241 241 #define CPUID_INTC_EBX_7_0_DEP_CSDS 0x00002000 /* Deprecates CS/DS */
242 242 #define CPUID_INTC_EBX_7_0_MPX 0x00004000 /* Mem. Prot. Ext. */
243 243 #define CPUID_INTC_EBX_7_0_PQE 0x00080000 /* QoS Enforcement */
244 244 #define CPUID_INTC_EBX_7_0_AVX512F 0x00010000 /* AVX512 foundation */
245 245 #define CPUID_INTC_EBX_7_0_AVX512DQ 0x00020000 /* AVX512DQ */
246 246 #define CPUID_INTC_EBX_7_0_RDSEED 0x00040000 /* RDSEED instr */
247 247 #define CPUID_INTC_EBX_7_0_ADX 0x00080000 /* ADX instrs */
248 248 #define CPUID_INTC_EBX_7_0_SMAP 0x00100000 /* SMAP in CR 4 */
249 249 #define CPUID_INTC_EBX_7_0_AVX512IFMA 0x00200000 /* AVX512IFMA */
250 250 /* Bit 22 is reserved */
251 251 #define CPUID_INTC_EBX_7_0_CLFLUSHOPT 0x00800000 /* CLFLUSOPT */
252 252 #define CPUID_INTC_EBX_7_0_CLWB 0x01000000 /* CLWB */
253 253 #define CPUID_INTC_EBX_7_0_PTRACE 0x02000000 /* Processor Trace */
254 254 #define CPUID_INTC_EBX_7_0_AVX512PF 0x04000000 /* AVX512PF */
255 255 #define CPUID_INTC_EBX_7_0_AVX512ER 0x08000000 /* AVX512ER */
256 256 #define CPUID_INTC_EBX_7_0_AVX512CD 0x10000000 /* AVX512CD */
257 257 #define CPUID_INTC_EBX_7_0_SHA 0x20000000 /* SHA extensions */
258 258 #define CPUID_INTC_EBX_7_0_AVX512BW 0x40000000 /* AVX512BW */
259 259 #define CPUID_INTC_EBX_7_0_AVX512VL 0x80000000 /* AVX512VL */
260 260
261 261 #define CPUID_INTC_EBX_7_0_ALL_AVX512 \
262 262 (CPUID_INTC_EBX_7_0_AVX512F | CPUID_INTC_EBX_7_0_AVX512DQ | \
263 263 CPUID_INTC_EBX_7_0_AVX512IFMA | CPUID_INTC_EBX_7_0_AVX512PF | \
264 264 CPUID_INTC_EBX_7_0_AVX512ER | CPUID_INTC_EBX_7_0_AVX512CD | \
265 265 CPUID_INTC_EBX_7_0_AVX512BW | CPUID_INTC_EBX_7_0_AVX512VL)
266 266
267 267 #define CPUID_INTC_ECX_7_0_PREFETCHWT1 0x00000001 /* PREFETCHWT1 */
268 268 #define CPUID_INTC_ECX_7_0_AVX512VBMI 0x00000002 /* AVX512VBMI */
269 269 #define CPUID_INTC_ECX_7_0_UMIP 0x00000004 /* UMIP */
270 270 #define CPUID_INTC_ECX_7_0_PKU 0x00000008 /* umode prot. keys */
271 271 #define CPUID_INTC_ECX_7_0_OSPKE 0x00000010 /* OSPKE */
272 272 #define CPUID_INTC_ECX_7_0_WAITPKG 0x00000020 /* WAITPKG */
273 273 #define CPUID_INTC_ECX_7_0_AVX512VBMI2 0x00000040 /* AVX512 VBMI2 */
274 274 /* bit 7 is reserved */
275 275 #define CPUID_INTC_ECX_7_0_GFNI 0x00000100 /* GFNI */
276 276 #define CPUID_INTC_ECX_7_0_VAES 0x00000200 /* VAES */
277 277 #define CPUID_INTC_ECX_7_0_VPCLMULQDQ 0x00000400 /* VPCLMULQDQ */
278 278 #define CPUID_INTC_ECX_7_0_AVX512VNNI 0x00000800 /* AVX512 VNNI */
279 279 #define CPUID_INTC_ECX_7_0_AVX512BITALG 0x00001000 /* AVX512 BITALG */
280 280 /* bit 13 is reserved */
281 281 #define CPUID_INTC_ECX_7_0_AVX512VPOPCDQ 0x00004000 /* AVX512 VPOPCNTDQ */
282 282 /* bits 15-16 are reserved */
283 283 /* bits 17-21 are the value of MAWAU */
284 284 #define CPUID_INTC_ECX_7_0_RDPID 0x00400000 /* RPID, IA32_TSC_AUX */
285 285 /* bits 23-24 are reserved */
286 286 #define CPUID_INTC_ECX_7_0_CLDEMOTE 0x02000000 /* Cache line demote */
287 287 /* bit 26 is resrved */
288 288 #define CPUID_INTC_ECX_7_0_MOVDIRI 0x08000000 /* MOVDIRI insn */
289 289 #define CPUID_INTC_ECX_7_0_MOVDIR64B 0x10000000 /* MOVDIR64B insn */
290 290 /* bit 29 is reserved */
291 291 #define CPUID_INTC_ECX_7_0_SGXLC 0x40000000 /* SGX Launch config */
292 292 /* bit 31 is reserved */
293 293
294 294 /*
295 295 * While CPUID_INTC_ECX_7_0_GFNI, CPUID_INTC_ECX_7_0_VAES, and
296 296 * CPUID_INTC_ECX_7_0_VPCLMULQDQ all have AVX512 components, they are still
297 297 * valid when AVX512 is not. However, the following flags all are only valid
298 298 * when AVX512 is present.
299 299 */
300 300 #define CPUID_INTC_ECX_7_0_ALL_AVX512 \
301 301 (CPUID_INTC_ECX_7_0_AVX512VBMI | CPUID_INTC_ECX_7_0_AVX512VNNI | \
302 302 CPUID_INTC_ECX_7_0_AVX512BITALG | CPUID_INTC_ECX_7_0_AVX512VPOPCDQ)
303 303
304 304 /* bits 0-1 are reserved */
305 305 #define CPUID_INTC_EDX_7_0_AVX5124NNIW 0x00000004 /* AVX512 4NNIW */
306 306 #define CPUID_INTC_EDX_7_0_AVX5124FMAPS 0x00000008 /* AVX512 4FMAPS */
307 307 #define CPUID_INTC_EDX_7_0_FSREPMOV 0x00000010 /* fast short rep mov */
308 308 /* bits 5-17 are resreved */
309 309 #define CPUID_INTC_EDX_7_0_PCONFIG 0x00040000 /* PCONFIG */
310 310 /* bits 19-26 are reserved */
311 311 #define CPUID_INTC_EDX_7_0_SPEC_CTRL 0x04000000 /* Spec, IBPB, IBRS */
312 312 #define CPUID_INTC_EDX_7_0_STIBP 0x08000000 /* STIBP */
313 313 #define CPUID_INTC_EDX_7_0_FLUSH_CMD 0x10000000 /* IA32_FLUSH_CMD */
314 314 #define CPUID_INTC_EDX_7_0_ARCH_CAPS 0x20000000 /* IA32_ARCH_CAPS */
315 315 #define CPUID_INTC_EDX_7_0_SSBD 0x80000000 /* SSBD */
316 316
317 317 #define CPUID_INTC_EDX_7_0_ALL_AVX512 \
318 318 (CPUID_INTC_EDX_7_0_AVX5124NNIW | CPUID_INTC_EDX_7_0_AVX5124FMAPS)
319 319
320 320 /*
321 321 * Intel also uses cpuid leaf 0xd to report additional instructions and features
322 322 * when the sub-leaf in %ecx == 1. We label these using the same convention as
323 323 * with leaf 7.
324 324 */
325 325 #define CPUID_INTC_EAX_D_1_XSAVEOPT 0x00000001 /* xsaveopt inst. */
326 326 #define CPUID_INTC_EAX_D_1_XSAVEC 0x00000002 /* xsavec inst. */
327 327 #define CPUID_INTC_EAX_D_1_XSAVES 0x00000008 /* xsaves inst. */
328 328
329 329 #define REG_PAT 0x277
330 330 #define REG_TSC 0x10 /* timestamp counter */
331 331 #define REG_APIC_BASE_MSR 0x1b
332 332 #define REG_X2APIC_BASE_MSR 0x800 /* The MSR address offset of x2APIC */
333 333
334 334 #if !defined(__xpv)
335 335 /*
336 336 * AMD C1E
337 337 */
338 338 #define MSR_AMD_INT_PENDING_CMP_HALT 0xC0010055
339 339 #define AMD_ACTONCMPHALT_SHIFT 27
340 340 #define AMD_ACTONCMPHALT_MASK 3
341 341 #endif
342 342
343 343 #define MSR_DEBUGCTL 0x1d9
344 344
345 345 #define DEBUGCTL_LBR 0x01
346 346 #define DEBUGCTL_BTF 0x02
347 347
348 348 /* Intel P6, AMD */
349 349 #define MSR_LBR_FROM 0x1db
350 350 #define MSR_LBR_TO 0x1dc
351 351 #define MSR_LEX_FROM 0x1dd
352 352 #define MSR_LEX_TO 0x1de
353 353
354 354 /* Intel P4 (pre-Prescott, non P4 M) */
355 355 #define MSR_P4_LBSTK_TOS 0x1da
356 356 #define MSR_P4_LBSTK_0 0x1db
357 357 #define MSR_P4_LBSTK_1 0x1dc
358 358 #define MSR_P4_LBSTK_2 0x1dd
359 359 #define MSR_P4_LBSTK_3 0x1de
360 360
361 361 /* Intel Pentium M */
362 362 #define MSR_P6M_LBSTK_TOS 0x1c9
363 363 #define MSR_P6M_LBSTK_0 0x040
364 364 #define MSR_P6M_LBSTK_1 0x041
365 365 #define MSR_P6M_LBSTK_2 0x042
366 366 #define MSR_P6M_LBSTK_3 0x043
367 367 #define MSR_P6M_LBSTK_4 0x044
368 368 #define MSR_P6M_LBSTK_5 0x045
369 369 #define MSR_P6M_LBSTK_6 0x046
370 370 #define MSR_P6M_LBSTK_7 0x047
371 371
372 372 /* Intel P4 (Prescott) */
373 373 #define MSR_PRP4_LBSTK_TOS 0x1da
374 374 #define MSR_PRP4_LBSTK_FROM_0 0x680
375 375 #define MSR_PRP4_LBSTK_FROM_1 0x681
376 376 #define MSR_PRP4_LBSTK_FROM_2 0x682
377 377 #define MSR_PRP4_LBSTK_FROM_3 0x683
378 378 #define MSR_PRP4_LBSTK_FROM_4 0x684
379 379 #define MSR_PRP4_LBSTK_FROM_5 0x685
380 380 #define MSR_PRP4_LBSTK_FROM_6 0x686
381 381 #define MSR_PRP4_LBSTK_FROM_7 0x687
382 382 #define MSR_PRP4_LBSTK_FROM_8 0x688
383 383 #define MSR_PRP4_LBSTK_FROM_9 0x689
384 384 #define MSR_PRP4_LBSTK_FROM_10 0x68a
385 385 #define MSR_PRP4_LBSTK_FROM_11 0x68b
386 386 #define MSR_PRP4_LBSTK_FROM_12 0x68c
387 387 #define MSR_PRP4_LBSTK_FROM_13 0x68d
388 388 #define MSR_PRP4_LBSTK_FROM_14 0x68e
389 389 #define MSR_PRP4_LBSTK_FROM_15 0x68f
390 390 #define MSR_PRP4_LBSTK_TO_0 0x6c0
391 391 #define MSR_PRP4_LBSTK_TO_1 0x6c1
392 392 #define MSR_PRP4_LBSTK_TO_2 0x6c2
393 393 #define MSR_PRP4_LBSTK_TO_3 0x6c3
394 394 #define MSR_PRP4_LBSTK_TO_4 0x6c4
395 395 #define MSR_PRP4_LBSTK_TO_5 0x6c5
396 396 #define MSR_PRP4_LBSTK_TO_6 0x6c6
397 397 #define MSR_PRP4_LBSTK_TO_7 0x6c7
398 398 #define MSR_PRP4_LBSTK_TO_8 0x6c8
399 399 #define MSR_PRP4_LBSTK_TO_9 0x6c9
400 400 #define MSR_PRP4_LBSTK_TO_10 0x6ca
401 401 #define MSR_PRP4_LBSTK_TO_11 0x6cb
402 402 #define MSR_PRP4_LBSTK_TO_12 0x6cc
403 403 #define MSR_PRP4_LBSTK_TO_13 0x6cd
404 404 #define MSR_PRP4_LBSTK_TO_14 0x6ce
405 405 #define MSR_PRP4_LBSTK_TO_15 0x6cf
406 406
407 407 /*
408 408 * General Xeon based MSRs
409 409 */
410 410 #define MSR_PPIN_CTL 0x04e
411 411 #define MSR_PPIN 0x04f
412 412 #define MSR_PLATFORM_INFO 0x0ce
413 413
414 414 #define MSR_PLATFORM_INFO_PPIN (1 << 23)
415 415 #define MSR_PPIN_CTL_MASK 0x03
416 416 #define MSR_PPIN_CTL_LOCKED 0x01
417 417 #define MSR_PPIN_CTL_ENABLED 0x02
418 418
419 419 /*
420 420 * Intel IA32_ARCH_CAPABILITIES MSR.
421 421 */
422 422 #define MSR_IA32_ARCH_CAPABILITIES 0x10a
423 423 #define IA32_ARCH_CAP_RDCL_NO 0x0001
424 424 #define IA32_ARCH_CAP_IBRS_ALL 0x0002
425 425 #define IA32_ARCH_CAP_RSBA 0x0004
426 426 #define IA32_ARCH_CAP_SKIP_L1DFL_VMENTRY 0x0008
427 427 #define IA32_ARCH_CAP_SSB_NO 0x0010
428 428
429 429 /*
430 430 * Intel Speculation related MSRs
431 431 */
432 432 #define MSR_IA32_SPEC_CTRL 0x48
433 433 #define IA32_SPEC_CTRL_IBRS 0x01
434 434 #define IA32_SPEC_CTRL_STIBP 0x02
435 435 #define IA32_SPEC_CTRL_SSBD 0x04
436 436
437 437 #define MSR_IA32_PRED_CMD 0x49
438 438 #define IA32_PRED_CMD_IBPB 0x01
439 439
440 440 #define MSR_IA32_FLUSH_CMD 0x10b
441 441 #define IA32_FLUSH_CMD_L1D 0x01
442 442
443 443 #define MCI_CTL_VALUE 0xffffffff
444 444
445 445 #define MTRR_TYPE_UC 0
446 446 #define MTRR_TYPE_WC 1
447 447 #define MTRR_TYPE_WT 4
448 448 #define MTRR_TYPE_WP 5
449 449 #define MTRR_TYPE_WB 6
450 450 #define MTRR_TYPE_UC_ 7
451 451
452 452 /*
453 453 * For Solaris we set up the page attritubute table in the following way:
454 454 * PAT0 Write-Back
455 455 * PAT1 Write-Through
456 456 * PAT2 Unchacheable-
457 457 * PAT3 Uncacheable
458 458 * PAT4 Write-Back
459 459 * PAT5 Write-Through
460 460 * PAT6 Write-Combine
461 461 * PAT7 Uncacheable
462 462 * The only difference from h/w default is entry 6.
463 463 */
464 464 #define PAT_DEFAULT_ATTRIBUTE \
465 465 ((uint64_t)MTRR_TYPE_WB | \
466 466 ((uint64_t)MTRR_TYPE_WT << 8) | \
467 467 ((uint64_t)MTRR_TYPE_UC_ << 16) | \
468 468 ((uint64_t)MTRR_TYPE_UC << 24) | \
469 469 ((uint64_t)MTRR_TYPE_WB << 32) | \
470 470 ((uint64_t)MTRR_TYPE_WT << 40) | \
471 471 ((uint64_t)MTRR_TYPE_WC << 48) | \
472 472 ((uint64_t)MTRR_TYPE_UC << 56))
473 473
474 474 #define X86FSET_LARGEPAGE 0
475 475 #define X86FSET_TSC 1
476 476 #define X86FSET_MSR 2
477 477 #define X86FSET_MTRR 3
478 478 #define X86FSET_PGE 4
479 479 #define X86FSET_DE 5
480 480 #define X86FSET_CMOV 6
481 481 #define X86FSET_MMX 7
482 482 #define X86FSET_MCA 8
483 483 #define X86FSET_PAE 9
484 484 #define X86FSET_CX8 10
485 485 #define X86FSET_PAT 11
486 486 #define X86FSET_SEP 12
487 487 #define X86FSET_SSE 13
488 488 #define X86FSET_SSE2 14
489 489 #define X86FSET_HTT 15
490 490 #define X86FSET_ASYSC 16
491 491 #define X86FSET_NX 17
492 492 #define X86FSET_SSE3 18
493 493 #define X86FSET_CX16 19
494 494 #define X86FSET_CMP 20
495 495 #define X86FSET_TSCP 21
496 496 #define X86FSET_MWAIT 22
497 497 #define X86FSET_SSE4A 23
498 498 #define X86FSET_CPUID 24
499 499 #define X86FSET_SSSE3 25
500 500 #define X86FSET_SSE4_1 26
501 501 #define X86FSET_SSE4_2 27
502 502 #define X86FSET_1GPG 28
503 503 #define X86FSET_CLFSH 29
504 504 #define X86FSET_64 30
505 505 #define X86FSET_AES 31
506 506 #define X86FSET_PCLMULQDQ 32
507 507 #define X86FSET_XSAVE 33
508 508 #define X86FSET_AVX 34
509 509 #define X86FSET_VMX 35
510 510 #define X86FSET_SVM 36
511 511 #define X86FSET_TOPOEXT 37
512 512 #define X86FSET_F16C 38
513 513 #define X86FSET_RDRAND 39
514 514 #define X86FSET_X2APIC 40
515 515 #define X86FSET_AVX2 41
516 516 #define X86FSET_BMI1 42
517 517 #define X86FSET_BMI2 43
518 518 #define X86FSET_FMA 44
519 519 #define X86FSET_SMEP 45
520 520 #define X86FSET_SMAP 46
521 521 #define X86FSET_ADX 47
522 522 #define X86FSET_RDSEED 48
523 523 #define X86FSET_MPX 49
524 524 #define X86FSET_AVX512F 50
525 525 #define X86FSET_AVX512DQ 51
526 526 #define X86FSET_AVX512PF 52
527 527 #define X86FSET_AVX512ER 53
528 528 #define X86FSET_AVX512CD 54
529 529 #define X86FSET_AVX512BW 55
530 530 #define X86FSET_AVX512VL 56
531 531 #define X86FSET_AVX512FMA 57
532 532 #define X86FSET_AVX512VBMI 58
533 533 #define X86FSET_AVX512VPOPCDQ 59
534 534 #define X86FSET_AVX512NNIW 60
535 535 #define X86FSET_AVX512FMAPS 61
536 536 #define X86FSET_XSAVEOPT 62
537 537 #define X86FSET_XSAVEC 63
538 538 #define X86FSET_XSAVES 64
539 539 #define X86FSET_SHA 65
540 540 #define X86FSET_UMIP 66
541 541 #define X86FSET_PKU 67
542 542 #define X86FSET_OSPKE 68
543 543 #define X86FSET_PCID 69
544 544 #define X86FSET_INVPCID 70
545 545 #define X86FSET_IBRS 71
546 546 #define X86FSET_IBPB 72
547 547 #define X86FSET_STIBP 73
548 548 #define X86FSET_SSBD 74
549 549 #define X86FSET_SSBD_VIRT 75
550 550 #define X86FSET_RDCL_NO 76
551 551 #define X86FSET_IBRS_ALL 77
552 552 #define X86FSET_RSBA 78
553 553 #define X86FSET_SSB_NO 79
554 554 #define X86FSET_STIBP_ALL 80
555 555 #define X86FSET_FLUSH_CMD 81
556 556 #define X86FSET_L1D_VM_NO 82
557 557 #define X86FSET_FSGSBASE 83
558 558 #define X86FSET_CLFLUSHOPT 84
559 559 #define X86FSET_CLWB 85
560 560 #define X86FSET_MONITORX 86
561 561 #define X86FSET_CLZERO 87
562 562 #define X86FSET_XOP 88
563 563 #define X86FSET_FMA4 89
564 564 #define X86FSET_TBM 90
565 565 #define X86FSET_AVX512VNNI 91
566 566
567 567 /*
568 568 * Intel Deep C-State invariant TSC in leaf 0x80000007.
569 569 */
570 570 #define CPUID_TSC_CSTATE_INVARIANCE (0x100)
571 571
572 572 /*
573 573 * Intel Deep C-state always-running local APIC timer
574 574 */
575 575 #define CPUID_CSTATE_ARAT (0x4)
576 576
577 577 /*
578 578 * Intel ENERGY_PERF_BIAS MSR indicated by feature bit CPUID.6.ECX[3].
579 579 */
580 580 #define CPUID_EPB_SUPPORT (1 << 3)
581 581
582 582 /*
583 583 * Intel TSC deadline timer
584 584 */
585 585 #define CPUID_DEADLINE_TSC (1 << 24)
586 586
587 587 /*
588 588 * x86_type is a legacy concept; this is supplanted
589 589 * for most purposes by x86_featureset; modern CPUs
590 590 * should be X86_TYPE_OTHER
591 591 */
592 592 #define X86_TYPE_OTHER 0
593 593 #define X86_TYPE_486 1
594 594 #define X86_TYPE_P5 2
595 595 #define X86_TYPE_P6 3
596 596 #define X86_TYPE_CYRIX_486 4
597 597 #define X86_TYPE_CYRIX_6x86L 5
598 598 #define X86_TYPE_CYRIX_6x86 6
599 599 #define X86_TYPE_CYRIX_GXm 7
600 600 #define X86_TYPE_CYRIX_6x86MX 8
601 601 #define X86_TYPE_CYRIX_MediaGX 9
602 602 #define X86_TYPE_CYRIX_MII 10
603 603 #define X86_TYPE_VIA_CYRIX_III 11
604 604 #define X86_TYPE_P4 12
605 605
606 606 /*
607 607 * x86_vendor allows us to select between
608 608 * implementation features and helps guide
609 609 * the interpretation of the cpuid instruction.
610 610 */
611 611 #define X86_VENDOR_Intel 0
612 612 #define X86_VENDORSTR_Intel "GenuineIntel"
613 613
614 614 #define X86_VENDOR_IntelClone 1
615 615
616 616 #define X86_VENDOR_AMD 2
617 617 #define X86_VENDORSTR_AMD "AuthenticAMD"
618 618
619 619 #define X86_VENDOR_Cyrix 3
620 620 #define X86_VENDORSTR_CYRIX "CyrixInstead"
621 621
622 622 #define X86_VENDOR_UMC 4
623 623 #define X86_VENDORSTR_UMC "UMC UMC UMC "
624 624
625 625 #define X86_VENDOR_NexGen 5
626 626 #define X86_VENDORSTR_NexGen "NexGenDriven"
627 627
628 628 #define X86_VENDOR_Centaur 6
629 629 #define X86_VENDORSTR_Centaur "CentaurHauls"
630 630
631 631 #define X86_VENDOR_Rise 7
632 632 #define X86_VENDORSTR_Rise "RiseRiseRise"
633 633
634 634 #define X86_VENDOR_SiS 8
635 635 #define X86_VENDORSTR_SiS "SiS SiS SiS "
636 636
637 637 #define X86_VENDOR_TM 9
638 638 #define X86_VENDORSTR_TM "GenuineTMx86"
639 639
640 640 #define X86_VENDOR_NSC 10
641 641 #define X86_VENDORSTR_NSC "Geode by NSC"
642 642
643 643 /*
644 644 * Vendor string max len + \0
645 645 */
646 646 #define X86_VENDOR_STRLEN 13
647 647
648 648 /*
649 649 * Some vendor/family/model/stepping ranges are commonly grouped under
650 650 * a single identifying banner by the vendor. The following encode
651 651 * that "revision" in a uint32_t with the 8 most significant bits
652 652 * identifying the vendor with X86_VENDOR_*, the next 8 identifying the
653 653 * family, and the remaining 16 typically forming a bitmask of revisions
654 654 * within that family with more significant bits indicating "later" revisions.
655 655 */
656 656
657 657 #define _X86_CHIPREV_VENDOR_MASK 0xff000000u
658 658 #define _X86_CHIPREV_VENDOR_SHIFT 24
659 659 #define _X86_CHIPREV_FAMILY_MASK 0x00ff0000u
660 660 #define _X86_CHIPREV_FAMILY_SHIFT 16
661 661 #define _X86_CHIPREV_REV_MASK 0x0000ffffu
662 662
663 663 #define _X86_CHIPREV_VENDOR(x) \
664 664 (((x) & _X86_CHIPREV_VENDOR_MASK) >> _X86_CHIPREV_VENDOR_SHIFT)
665 665 #define _X86_CHIPREV_FAMILY(x) \
666 666 (((x) & _X86_CHIPREV_FAMILY_MASK) >> _X86_CHIPREV_FAMILY_SHIFT)
667 667 #define _X86_CHIPREV_REV(x) \
668 668 ((x) & _X86_CHIPREV_REV_MASK)
669 669
670 670 /* True if x matches in vendor and family and if x matches the given rev mask */
671 671 #define X86_CHIPREV_MATCH(x, mask) \
672 672 (_X86_CHIPREV_VENDOR(x) == _X86_CHIPREV_VENDOR(mask) && \
673 673 _X86_CHIPREV_FAMILY(x) == _X86_CHIPREV_FAMILY(mask) && \
674 674 ((_X86_CHIPREV_REV(x) & _X86_CHIPREV_REV(mask)) != 0))
675 675
676 676 /* True if x matches in vendor and family, and rev is at least minx */
677 677 #define X86_CHIPREV_ATLEAST(x, minx) \
678 678 (_X86_CHIPREV_VENDOR(x) == _X86_CHIPREV_VENDOR(minx) && \
679 679 _X86_CHIPREV_FAMILY(x) == _X86_CHIPREV_FAMILY(minx) && \
680 680 _X86_CHIPREV_REV(x) >= _X86_CHIPREV_REV(minx))
681 681
682 682 #define _X86_CHIPREV_MKREV(vendor, family, rev) \
683 683 ((uint32_t)(vendor) << _X86_CHIPREV_VENDOR_SHIFT | \
684 684 (family) << _X86_CHIPREV_FAMILY_SHIFT | (rev))
685 685
686 686 /* True if x matches in vendor, and family is at least minx */
687 687 #define X86_CHIPFAM_ATLEAST(x, minx) \
688 688 (_X86_CHIPREV_VENDOR(x) == _X86_CHIPREV_VENDOR(minx) && \
689 689 _X86_CHIPREV_FAMILY(x) >= _X86_CHIPREV_FAMILY(minx))
690 690
691 691 /* Revision default */
692 692 #define X86_CHIPREV_UNKNOWN 0x0
693 693
694 694 /*
695 695 * Definitions for AMD Family 0xf. Minor revisions C0 and CG are
696 696 * sufficiently different that we will distinguish them; in all other
697 697 * case we will identify the major revision.
698 698 */
699 699 #define X86_CHIPREV_AMD_F_REV_B _X86_CHIPREV_MKREV(X86_VENDOR_AMD, 0xf, 0x0001)
700 700 #define X86_CHIPREV_AMD_F_REV_C0 _X86_CHIPREV_MKREV(X86_VENDOR_AMD, 0xf, 0x0002)
701 701 #define X86_CHIPREV_AMD_F_REV_CG _X86_CHIPREV_MKREV(X86_VENDOR_AMD, 0xf, 0x0004)
702 702 #define X86_CHIPREV_AMD_F_REV_D _X86_CHIPREV_MKREV(X86_VENDOR_AMD, 0xf, 0x0008)
703 703 #define X86_CHIPREV_AMD_F_REV_E _X86_CHIPREV_MKREV(X86_VENDOR_AMD, 0xf, 0x0010)
704 704 #define X86_CHIPREV_AMD_F_REV_F _X86_CHIPREV_MKREV(X86_VENDOR_AMD, 0xf, 0x0020)
705 705 #define X86_CHIPREV_AMD_F_REV_G _X86_CHIPREV_MKREV(X86_VENDOR_AMD, 0xf, 0x0040)
706 706
707 707 /*
708 708 * Definitions for AMD Family 0x10. Rev A was Engineering Samples only.
709 709 */
710 710 #define X86_CHIPREV_AMD_10_REV_A \
711 711 _X86_CHIPREV_MKREV(X86_VENDOR_AMD, 0x10, 0x0001)
712 712 #define X86_CHIPREV_AMD_10_REV_B \
713 713 _X86_CHIPREV_MKREV(X86_VENDOR_AMD, 0x10, 0x0002)
714 714 #define X86_CHIPREV_AMD_10_REV_C2 \
715 715 _X86_CHIPREV_MKREV(X86_VENDOR_AMD, 0x10, 0x0004)
716 716 #define X86_CHIPREV_AMD_10_REV_C3 \
717 717 _X86_CHIPREV_MKREV(X86_VENDOR_AMD, 0x10, 0x0008)
718 718 #define X86_CHIPREV_AMD_10_REV_D0 \
719 719 _X86_CHIPREV_MKREV(X86_VENDOR_AMD, 0x10, 0x0010)
720 720 #define X86_CHIPREV_AMD_10_REV_D1 \
721 721 _X86_CHIPREV_MKREV(X86_VENDOR_AMD, 0x10, 0x0020)
722 722 #define X86_CHIPREV_AMD_10_REV_E \
723 723 _X86_CHIPREV_MKREV(X86_VENDOR_AMD, 0x10, 0x0040)
724 724
725 725 /*
726 726 * Definitions for AMD Family 0x11.
727 727 */
728 728 #define X86_CHIPREV_AMD_11_REV_B \
729 729 _X86_CHIPREV_MKREV(X86_VENDOR_AMD, 0x11, 0x0002)
730 730
731 731 /*
732 732 * Definitions for AMD Family 0x12.
733 733 */
734 734 #define X86_CHIPREV_AMD_12_REV_B \
735 735 _X86_CHIPREV_MKREV(X86_VENDOR_AMD, 0x12, 0x0002)
736 736
737 737 /*
738 738 * Definitions for AMD Family 0x14.
739 739 */
740 740 #define X86_CHIPREV_AMD_14_REV_B \
741 741 _X86_CHIPREV_MKREV(X86_VENDOR_AMD, 0x14, 0x0002)
742 742 #define X86_CHIPREV_AMD_14_REV_C \
743 743 _X86_CHIPREV_MKREV(X86_VENDOR_AMD, 0x14, 0x0004)
744 744
745 745 /*
746 746 * Definitions for AMD Family 0x15
747 747 */
748 748 #define X86_CHIPREV_AMD_15OR_REV_B2 \
749 749 _X86_CHIPREV_MKREV(X86_VENDOR_AMD, 0x15, 0x0001)
750 750
751 751 #define X86_CHIPREV_AMD_15TN_REV_A1 \
752 752 _X86_CHIPREV_MKREV(X86_VENDOR_AMD, 0x15, 0x0002)
753 753
754 754 #define X86_CHIPREV_AMD_150R_REV_C0 \
755 755 _X86_CHIPREV_MKREV(X86_VENDOR_AMD, 0x15, 0x0003)
756 756
757 757 #define X86_CHIPREV_AMD_15KV_REV_A1 \
758 758 _X86_CHIPREV_MKREV(X86_VENDOR_AMD, 0x15, 0x0004)
759 759
760 760 #define X86_CHIPREV_AMD_15F60 \
761 761 _X86_CHIPREV_MKREV(X86_VENDOR_AMD, 0x15, 0x0005)
762 762
763 763 #define X86_CHIPREV_AMD_15ST_REV_A0 \
764 764 _X86_CHIPREV_MKREV(X86_VENDOR_AMD, 0x15, 0x0006)
765 765
766 766 /*
767 767 * Definitions for AMD Family 0x16
768 768 */
769 769 #define X86_CHIPREV_AMD_16_KB_A1 \
770 770 _X86_CHIPREV_MKREV(X86_VENDOR_AMD, 0x16, 0x0001)
771 771
772 772 #define X86_CHIPREV_AMD_16_ML_A1 \
773 773 _X86_CHIPREV_MKREV(X86_VENDOR_AMD, 0x16, 0x0002)
774 774
775 775 /*
776 776 * Definitions for AMD Family 0x17
777 777 */
778 778
779 779 #define X86_CHIPREV_AMD_17_ZP_B1 \
780 780 _X86_CHIPREV_MKREV(X86_VENDOR_AMD, 0x17, 0x0001)
781 781
782 782 #define X86_CHIPREV_AMD_17_ZP_B2 \
783 783 _X86_CHIPREV_MKREV(X86_VENDOR_AMD, 0x17, 0x0002)
784 784
785 785 #define X86_CHIPREV_AMD_17_PiR_B2 \
786 786 _X86_CHIPREV_MKREV(X86_VENDOR_AMD, 0x17, 0x0003)
787 787
788 788 /*
789 789 * Various socket/package types, extended as the need to distinguish
790 790 * a new type arises. The top 8 byte identfies the vendor and the
791 791 * remaining 24 bits describe 24 socket types.
792 792 */
793 793
794 794 #define _X86_SOCKET_VENDOR_SHIFT 24
795 795 #define _X86_SOCKET_VENDOR(x) ((x) >> _X86_SOCKET_VENDOR_SHIFT)
796 796 #define _X86_SOCKET_TYPE_MASK 0x00ffffff
797 797 #define _X86_SOCKET_TYPE(x) ((x) & _X86_SOCKET_TYPE_MASK)
798 798
799 799 #define _X86_SOCKET_MKVAL(vendor, bitval) \
800 800 ((uint32_t)(vendor) << _X86_SOCKET_VENDOR_SHIFT | (bitval))
801 801
802 802 #define X86_SOCKET_MATCH(s, mask) \
803 803 (_X86_SOCKET_VENDOR(s) == _X86_SOCKET_VENDOR(mask) && \
804 804 (_X86_SOCKET_TYPE(s) & _X86_SOCKET_TYPE(mask)) != 0)
805 805
806 806 #define X86_SOCKET_UNKNOWN 0x0
807 807 /*
808 808 * AMD socket types
809 809 */
810 810 #define X86_SOCKET_754 _X86_SOCKET_MKVAL(X86_VENDOR_AMD, 0x01)
811 811 #define X86_SOCKET_939 _X86_SOCKET_MKVAL(X86_VENDOR_AMD, 0x02)
812 812 #define X86_SOCKET_940 _X86_SOCKET_MKVAL(X86_VENDOR_AMD, 0x03)
813 813 #define X86_SOCKET_S1g1 _X86_SOCKET_MKVAL(X86_VENDOR_AMD, 0x04)
814 814 #define X86_SOCKET_AM2 _X86_SOCKET_MKVAL(X86_VENDOR_AMD, 0x05)
815 815 #define X86_SOCKET_F1207 _X86_SOCKET_MKVAL(X86_VENDOR_AMD, 0x06)
816 816 #define X86_SOCKET_S1g2 _X86_SOCKET_MKVAL(X86_VENDOR_AMD, 0x07)
817 817 #define X86_SOCKET_S1g3 _X86_SOCKET_MKVAL(X86_VENDOR_AMD, 0x08)
818 818 #define X86_SOCKET_AM _X86_SOCKET_MKVAL(X86_VENDOR_AMD, 0x09)
819 819 #define X86_SOCKET_AM2R2 _X86_SOCKET_MKVAL(X86_VENDOR_AMD, 0x0a)
820 820 #define X86_SOCKET_AM3 _X86_SOCKET_MKVAL(X86_VENDOR_AMD, 0x0b)
821 821 #define X86_SOCKET_G34 _X86_SOCKET_MKVAL(X86_VENDOR_AMD, 0x0c)
822 822 #define X86_SOCKET_ASB2 _X86_SOCKET_MKVAL(X86_VENDOR_AMD, 0x0d)
823 823 #define X86_SOCKET_C32 _X86_SOCKET_MKVAL(X86_VENDOR_AMD, 0x0e)
824 824 #define X86_SOCKET_S1g4 _X86_SOCKET_MKVAL(X86_VENDOR_AMD, 0x0f)
825 825 #define X86_SOCKET_FT1 _X86_SOCKET_MKVAL(X86_VENDOR_AMD, 0x10)
826 826 #define X86_SOCKET_FM1 _X86_SOCKET_MKVAL(X86_VENDOR_AMD, 0x11)
827 827 #define X86_SOCKET_FS1 _X86_SOCKET_MKVAL(X86_VENDOR_AMD, 0x12)
828 828 #define X86_SOCKET_AM3R2 _X86_SOCKET_MKVAL(X86_VENDOR_AMD, 0x13)
829 829 #define X86_SOCKET_FP2 _X86_SOCKET_MKVAL(X86_VENDOR_AMD, 0x14)
830 830 #define X86_SOCKET_FS1R2 _X86_SOCKET_MKVAL(X86_VENDOR_AMD, 0x15)
831 831 #define X86_SOCKET_FM2 _X86_SOCKET_MKVAL(X86_VENDOR_AMD, 0x16)
832 832 #define X86_SOCKET_FP3 _X86_SOCKET_MKVAL(X86_VENDOR_AMD, 0x17)
833 833 #define X86_SOCKET_FM2R2 _X86_SOCKET_MKVAL(X86_VENDOR_AMD, 0x18)
834 834 #define X86_SOCKET_FP4 _X86_SOCKET_MKVAL(X86_VENDOR_AMD, 0x19)
835 835 #define X86_SOCKET_AM4 _X86_SOCKET_MKVAL(X86_VENDOR_AMD, 0x1a)
836 836 #define X86_SOCKET_FT3 _X86_SOCKET_MKVAL(X86_VENDOR_AMD, 0x1b)
837 837 #define X86_SOCKET_FT4 _X86_SOCKET_MKVAL(X86_VENDOR_AMD, 0x1c)
838 838 #define X86_SOCKET_FS1B _X86_SOCKET_MKVAL(X86_VENDOR_AMD, 0x1d)
839 839 #define X86_SOCKET_FT3B _X86_SOCKET_MKVAL(X86_VENDOR_AMD, 0x1e)
840 840 #define X86_SOCKET_SP3 _X86_SOCKET_MKVAL(X86_VENDOR_AMD, 0x1f)
841 841 #define X86_SOCKET_SP3R2 _X86_SOCKET_MKVAL(X86_VENDOR_AMD, 0x20)
842 842 #define X86_NUM_SOCKETS_AMD 0x21
843 843
844 844
845 845 /*
846 846 * Definitions for Intel processor models. These are all for Family 6
847 847 * processors. This list and the Atom set below it are not exhuastive.
848 848 */
849 849 #define INTC_MODEL_MEROM 0x0f
850 850 #define INTC_MODEL_PENRYN 0x17
851 851 #define INTC_MODEL_DUNNINGTON 0x1d
852 852
853 853 #define INTC_MODEL_NEHALEM 0x1e
854 854 #define INTC_MODEL_NEHALEM2 0x1f
855 855 #define INTC_MODEL_NEHALEM_EP 0x1a
856 856 #define INTC_MODEL_NEHALEM_EX 0x2e
857 857
858 858 #define INTC_MODEL_WESTMERE 0x25
859 859 #define INTC_MODEL_WESTMERE_EP 0x2c
860 860 #define INTC_MODEL_WESTMERE_EX 0x2f
861 861
862 862 #define INTC_MODEL_SANDYBRIDGE 0x2a
863 863 #define INTC_MODEL_SANDYBRIDGE_XEON 0x2d
864 864 #define INTC_MODEL_IVYBRIDGE 0x3a
865 865 #define INTC_MODEL_IVYBRIDGE_XEON 0x3e
866 866
867 867 #define INTC_MODEL_HASWELL 0x3c
868 868 #define INTC_MODEL_HASWELL_ULT 0x45
869 869 #define INTC_MODEL_HASWELL_GT3E 0x46
870 870 #define INTC_MODEL_HASWELL_XEON 0x3f
871 871
872 872 #define INTC_MODEL_BROADWELL 0x3d
873 873 #define INTC_MODEL_BROADELL_2 0x47
874 874 #define INTC_MODEL_BROADWELL_XEON 0x4f
875 875 #define INTC_MODEL_BROADWELL_XEON_D 0x56
876 876
877 877 #define INCC_MODEL_SKYLAKE_MOBILE 0x4e
878 878 #define INTC_MODEL_SKYLAKE_XEON 0x55
879 879 #define INTC_MODEL_SKYLAKE_DESKTOP 0x5e
880 880
881 881 #define INTC_MODEL_KABYLAKE_MOBILE 0x8e
882 882 #define INTC_MODEL_KABYLAKE_DESKTOP 0x9e
883 883
884 884 /*
885 885 * Atom Processors
886 886 */
887 887 #define INTC_MODEL_SILVERTHORNE 0x1c
888 888 #define INTC_MODEL_LINCROFT 0x26
889 889 #define INTC_MODEL_PENWELL 0x27
890 890 #define INTC_MODEL_CLOVERVIEW 0x35
891 891 #define INTC_MODEL_CEDARVIEW 0x36
892 892 #define INTC_MODEL_BAY_TRAIL 0x37
893 893 #define INTC_MODEL_AVATON 0x4d
894 894 #define INTC_MODEL_AIRMONT 0x4c
895 895 #define INTC_MODEL_GOLDMONT 0x5c
896 896 #define INTC_MODEL_DENVERTON 0x5f
897 897 #define INTC_MODEL_GEMINI_LAKE 0x7a
898 898
899 899 /*
900 900 * xgetbv/xsetbv support
901 901 * See section 13.3 in vol. 1 of the Intel devlopers manual.
902 902 */
903 903
904 904 #define XFEATURE_ENABLED_MASK 0x0
905 905 /*
906 906 * XFEATURE_ENABLED_MASK values (eax)
907 907 * See setup_xfem().
908 908 */
909 909 #define XFEATURE_LEGACY_FP 0x1
910 910 #define XFEATURE_SSE 0x2
911 911 #define XFEATURE_AVX 0x4
912 912 #define XFEATURE_MPX 0x18 /* 2 bits, both 0 or 1 */
913 913 #define XFEATURE_AVX512 0xe0 /* 3 bits, all 0 or 1 */
914 914 /* bit 8 unused */
915 915 #define XFEATURE_PKRU 0x200
916 916 #define XFEATURE_FP_ALL \
917 917 (XFEATURE_LEGACY_FP | XFEATURE_SSE | XFEATURE_AVX | XFEATURE_MPX | \
918 918 XFEATURE_AVX512 | XFEATURE_PKRU)
919 919
920 920 /*
921 921 * Define the set of xfeature flags that should be considered valid in the xsave
922 922 * state vector when we initialize an lwp. This is distinct from the full set so
923 923 * that all of the processor's normal logic and tracking of the xsave state is
924 924 * usable. This should correspond to the state that's been initialized by the
925 925 * ABI to hold meaningful values. Adding additional bits here can have serious
926 926 * performance implications and cause performance degradations when using the
927 927 * FPU vector (xmm) registers.
928 928 */
929 929 #define XFEATURE_FP_INITIAL (XFEATURE_LEGACY_FP | XFEATURE_SSE)
930 930
931 931 #if !defined(_ASM)
932 932
933 933 #if defined(_KERNEL) || defined(_KMEMUSER)
934 934
935 935 #define NUM_X86_FEATURES 92
936 936 extern uchar_t x86_featureset[];
937 937
938 938 extern void free_x86_featureset(void *featureset);
939 939 extern boolean_t is_x86_feature(void *featureset, uint_t feature);
940 940 extern void add_x86_feature(void *featureset, uint_t feature);
941 941 extern void remove_x86_feature(void *featureset, uint_t feature);
942 942 extern boolean_t compare_x86_featureset(void *setA, void *setB);
943 943 extern void print_x86_featureset(void *featureset);
↓ open down ↓ |
943 lines elided |
↑ open up ↑ |
944 944
945 945
946 946 extern uint_t x86_type;
947 947 extern uint_t x86_vendor;
948 948 extern uint_t x86_clflush_size;
949 949
950 950 extern uint_t pentiumpro_bug4046376;
951 951
952 952 extern const char CyrixInstead[];
953 953
954 +extern void (*spec_l1d_flush)(void);
955 +
954 956 #endif
955 957
956 958 #if defined(_KERNEL)
957 959
958 960 /*
959 961 * This structure is used to pass arguments and get return values back
960 962 * from the CPUID instruction in __cpuid_insn() routine.
961 963 */
962 964 struct cpuid_regs {
963 965 uint32_t cp_eax;
964 966 uint32_t cp_ebx;
965 967 uint32_t cp_ecx;
966 968 uint32_t cp_edx;
967 969 };
968 970
969 971 extern int x86_use_pcid;
970 972 extern int x86_use_invpcid;
971 973
972 974 /*
973 975 * Utility functions to get/set extended control registers (XCR)
974 976 * Initial use is to get/set the contents of the XFEATURE_ENABLED_MASK.
975 977 */
976 978 extern uint64_t get_xcr(uint_t);
977 979 extern void set_xcr(uint_t, uint64_t);
978 980
979 981 extern uint64_t rdmsr(uint_t);
980 982 extern void wrmsr(uint_t, const uint64_t);
981 983 extern uint64_t xrdmsr(uint_t);
982 984 extern void xwrmsr(uint_t, const uint64_t);
983 985 extern int checked_rdmsr(uint_t, uint64_t *);
984 986 extern int checked_wrmsr(uint_t, uint64_t);
985 987
986 988 extern void invalidate_cache(void);
987 989 extern ulong_t getcr4(void);
988 990 extern void setcr4(ulong_t);
989 991
990 992 extern void mtrr_sync(void);
991 993
992 994 extern void cpu_fast_syscall_enable(void);
993 995 extern void cpu_fast_syscall_disable(void);
994 996
995 997 struct cpu;
996 998
997 999 extern int cpuid_checkpass(struct cpu *, int);
998 1000 extern uint32_t cpuid_insn(struct cpu *, struct cpuid_regs *);
999 1001 extern uint32_t __cpuid_insn(struct cpuid_regs *);
1000 1002 extern int cpuid_getbrandstr(struct cpu *, char *, size_t);
1001 1003 extern int cpuid_getidstr(struct cpu *, char *, size_t);
1002 1004 extern const char *cpuid_getvendorstr(struct cpu *);
1003 1005 extern uint_t cpuid_getvendor(struct cpu *);
1004 1006 extern uint_t cpuid_getfamily(struct cpu *);
1005 1007 extern uint_t cpuid_getmodel(struct cpu *);
1006 1008 extern uint_t cpuid_getstep(struct cpu *);
1007 1009 extern uint_t cpuid_getsig(struct cpu *);
1008 1010 extern uint_t cpuid_get_ncpu_per_chip(struct cpu *);
1009 1011 extern uint_t cpuid_get_ncore_per_chip(struct cpu *);
1010 1012 extern uint_t cpuid_get_ncpu_sharing_last_cache(struct cpu *);
1011 1013 extern id_t cpuid_get_last_lvl_cacheid(struct cpu *);
1012 1014 extern int cpuid_get_chipid(struct cpu *);
1013 1015 extern id_t cpuid_get_coreid(struct cpu *);
1014 1016 extern int cpuid_get_pkgcoreid(struct cpu *);
1015 1017 extern int cpuid_get_clogid(struct cpu *);
1016 1018 extern int cpuid_get_cacheid(struct cpu *);
1017 1019 extern uint32_t cpuid_get_apicid(struct cpu *);
1018 1020 extern uint_t cpuid_get_procnodeid(struct cpu *cpu);
1019 1021 extern uint_t cpuid_get_procnodes_per_pkg(struct cpu *cpu);
1020 1022 extern uint_t cpuid_get_compunitid(struct cpu *cpu);
1021 1023 extern uint_t cpuid_get_cores_per_compunit(struct cpu *cpu);
1022 1024 extern size_t cpuid_get_xsave_size();
1023 1025 extern boolean_t cpuid_need_fp_excp_handling();
1024 1026 extern int cpuid_is_cmt(struct cpu *);
1025 1027 extern int cpuid_syscall32_insn(struct cpu *);
1026 1028 extern int getl2cacheinfo(struct cpu *, int *, int *, int *);
1027 1029
1028 1030 extern uint32_t cpuid_getchiprev(struct cpu *);
1029 1031 extern const char *cpuid_getchiprevstr(struct cpu *);
1030 1032 extern uint32_t cpuid_getsockettype(struct cpu *);
1031 1033 extern const char *cpuid_getsocketstr(struct cpu *);
1032 1034
1033 1035 extern int cpuid_have_cr8access(struct cpu *);
1034 1036
1035 1037 extern int cpuid_opteron_erratum(struct cpu *, uint_t);
1036 1038
1037 1039 struct cpuid_info;
1038 1040
1039 1041 extern void setx86isalist(void);
1040 1042 extern void cpuid_alloc_space(struct cpu *);
1041 1043 extern void cpuid_free_space(struct cpu *);
1042 1044 extern void cpuid_pass1(struct cpu *, uchar_t *);
1043 1045 extern void cpuid_pass2(struct cpu *);
1044 1046 extern void cpuid_pass3(struct cpu *);
1045 1047 extern void cpuid_pass4(struct cpu *, uint_t *);
1046 1048 extern void cpuid_set_cpu_properties(void *, processorid_t,
1047 1049 struct cpuid_info *);
1048 1050 extern void cpuid_pass_ucode(struct cpu *, uchar_t *);
1049 1051 extern void cpuid_post_ucodeadm(void);
1050 1052
1051 1053 extern void cpuid_get_addrsize(struct cpu *, uint_t *, uint_t *);
1052 1054 extern uint_t cpuid_get_dtlb_nent(struct cpu *, size_t);
1053 1055
1054 1056 #if !defined(__xpv)
1055 1057 extern uint32_t *cpuid_mwait_alloc(struct cpu *);
1056 1058 extern void cpuid_mwait_free(struct cpu *);
1057 1059 extern int cpuid_deep_cstates_supported(void);
1058 1060 extern int cpuid_arat_supported(void);
1059 1061 extern int cpuid_iepb_supported(struct cpu *);
1060 1062 extern int cpuid_deadline_tsc_supported(void);
1061 1063 extern void vmware_port(int, uint32_t *);
1062 1064 #endif
1063 1065
1064 1066 struct cpu_ucode_info;
1065 1067
1066 1068 extern void ucode_alloc_space(struct cpu *);
1067 1069 extern void ucode_free_space(struct cpu *);
1068 1070 extern void ucode_check(struct cpu *);
1069 1071 extern void ucode_cleanup();
1070 1072
1071 1073 #if !defined(__xpv)
1072 1074 extern char _tsc_mfence_start;
1073 1075 extern char _tsc_mfence_end;
1074 1076 extern char _tscp_start;
1075 1077 extern char _tscp_end;
1076 1078 extern char _no_rdtsc_start;
1077 1079 extern char _no_rdtsc_end;
1078 1080 extern char _tsc_lfence_start;
1079 1081 extern char _tsc_lfence_end;
1080 1082 #endif
1081 1083
1082 1084 #if !defined(__xpv)
1083 1085 extern char bcopy_patch_start;
1084 1086 extern char bcopy_patch_end;
1085 1087 extern char bcopy_ck_size;
1086 1088 #endif
1087 1089
1088 1090 extern void post_startup_cpu_fixups(void);
1089 1091
1090 1092 extern uint_t workaround_errata(struct cpu *);
1091 1093
1092 1094 #if defined(OPTERON_ERRATUM_93)
1093 1095 extern int opteron_erratum_93;
1094 1096 #endif
1095 1097
1096 1098 #if defined(OPTERON_ERRATUM_91)
1097 1099 extern int opteron_erratum_91;
1098 1100 #endif
1099 1101
1100 1102 #if defined(OPTERON_ERRATUM_100)
1101 1103 extern int opteron_erratum_100;
1102 1104 #endif
1103 1105
1104 1106 #if defined(OPTERON_ERRATUM_121)
1105 1107 extern int opteron_erratum_121;
1106 1108 #endif
1107 1109
1108 1110 #if defined(OPTERON_WORKAROUND_6323525)
1109 1111 extern int opteron_workaround_6323525;
1110 1112 extern void patch_workaround_6323525(void);
1111 1113 #endif
1112 1114
1113 1115 #if !defined(__xpv)
1114 1116 extern void determine_platform(void);
1115 1117 #endif
1116 1118 extern int get_hwenv(void);
1117 1119 extern int is_controldom(void);
1118 1120
1119 1121 extern void enable_pcid(void);
1120 1122
1121 1123 extern void xsave_setup_msr(struct cpu *);
1122 1124
1123 1125 #if !defined(__xpv)
1124 1126 extern void reset_gdtr_limit(void);
1125 1127 #endif
1126 1128
1127 1129 /*
1128 1130 * Hypervisor signatures
1129 1131 */
1130 1132 #define HVSIG_XEN_HVM "XenVMMXenVMM"
1131 1133 #define HVSIG_VMWARE "VMwareVMware"
1132 1134 #define HVSIG_KVM "KVMKVMKVM"
1133 1135 #define HVSIG_MICROSOFT "Microsoft Hv"
1134 1136 #define HVSIG_BHYVE "bhyve bhyve "
1135 1137
1136 1138 /*
1137 1139 * Defined hardware environments
1138 1140 */
1139 1141 #define HW_NATIVE (1 << 0) /* Running on bare metal */
1140 1142 #define HW_XEN_PV (1 << 1) /* Running on Xen PVM */
1141 1143
1142 1144 #define HW_XEN_HVM (1 << 2) /* Running on Xen HVM */
1143 1145 #define HW_VMWARE (1 << 3) /* Running on VMware hypervisor */
1144 1146 #define HW_KVM (1 << 4) /* Running on KVM hypervisor */
1145 1147 #define HW_MICROSOFT (1 << 5) /* Running on Microsoft hypervisor */
1146 1148 #define HW_BHYVE (1 << 6) /* Running on bhyve hypervisor */
1147 1149
1148 1150 #define HW_VIRTUAL (HW_XEN_HVM | HW_VMWARE | HW_KVM | HW_MICROSOFT | \
1149 1151 HW_BHYVE)
1150 1152
1151 1153 #endif /* _KERNEL */
1152 1154
1153 1155 #endif /* !_ASM */
1154 1156
1155 1157 /*
1156 1158 * VMware hypervisor related defines
1157 1159 */
1158 1160 #define VMWARE_HVMAGIC 0x564d5868
1159 1161 #define VMWARE_HVPORT 0x5658
1160 1162 #define VMWARE_HVCMD_GETVERSION 0x0a
1161 1163 #define VMWARE_HVCMD_GETTSCFREQ 0x2d
1162 1164
1163 1165 #ifdef __cplusplus
1164 1166 }
1165 1167 #endif
1166 1168
1167 1169 #endif /* _SYS_X86_ARCHEXT_H */
↓ open down ↓ |
204 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX