Mercurial > illumos > illumos-gate
annotate usr/src/uts/i86pc/os/cpuid.c @ 13148:67d1861e02c1 onnv_147
6970888 panic BAD TRAP: type=d (#gp General protection) due to incorrect use of x86_featureset
author | Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com> |
---|---|
date | Mon, 16 Aug 2010 22:47:01 -0700 |
parents | 8315ff49e22e |
children | 8640246a3548 |
rev | line source |
---|---|
0 | 1 /* |
2 * CDDL HEADER START | |
3 * | |
4 * The contents of this file are subject to the terms of the | |
1582
eb879d43ab47
6323525 Mutual exclusion primitives don't work as expected on Opteron systems
kchow
parents:
1414
diff
changeset
|
5 * Common Development and Distribution License (the "License"). |
eb879d43ab47
6323525 Mutual exclusion primitives don't work as expected on Opteron systems
kchow
parents:
1414
diff
changeset
|
6 * You may not use this file except in compliance with the License. |
0 | 7 * |
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE | |
9 * or http://www.opensolaris.org/os/licensing. | |
10 * See the License for the specific language governing permissions | |
11 * and limitations under the License. | |
12 * | |
13 * When distributing Covered Code, include this CDDL HEADER in each | |
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. | |
15 * If applicable, add the following below this CDDL HEADER, with the | |
16 * fields enclosed by brackets "[]" replaced with your own identifying | |
17 * information: Portions Copyright [yyyy] [name of copyright owner] | |
18 * | |
19 * CDDL HEADER END | |
20 */ | |
21 /* | |
12090
2986679fe0b5
6941777 determine_platform needs to do a better job inside a Xen HVM guest
Frank Van Der Linden <Frank.Vanderlinden@Sun.COM>
parents:
12004
diff
changeset
|
22 * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved. |
0 | 23 */ |
9283
2ee48b3d20ef
6821708 deeper C-state support required for processors with ARAT
Bill Holler <Bill.Holler@Sun.COM>
parents:
9000
diff
changeset
|
24 /* |
13041
2ba2eec82e2a
6932990 Support for TSC deadline timer
Krishnendu Sadhukhan - Sun Microsystems <Krishnendu.Sadhukhan@Sun.COM>
parents:
12838
diff
changeset
|
25 * Copyright (c) 2010, Intel Corporation. |
9283
2ee48b3d20ef
6821708 deeper C-state support required for processors with ARAT
Bill Holler <Bill.Holler@Sun.COM>
parents:
9000
diff
changeset
|
26 * All rights reserved. |
2ee48b3d20ef
6821708 deeper C-state support required for processors with ARAT
Bill Holler <Bill.Holler@Sun.COM>
parents:
9000
diff
changeset
|
27 */ |
10947
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
28 /* |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
29 * Portions Copyright 2009 Advanced Micro Devices, Inc. |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
30 */ |
0 | 31 |
32 /* | |
33 * Various routines to handle identification | |
34 * and classification of x86 processors. | |
35 */ | |
36 | |
37 #include <sys/types.h> | |
38 #include <sys/archsystm.h> | |
39 #include <sys/x86_archext.h> | |
40 #include <sys/kmem.h> | |
41 #include <sys/systm.h> | |
42 #include <sys/cmn_err.h> | |
43 #include <sys/sunddi.h> | |
44 #include <sys/sunndi.h> | |
45 #include <sys/cpuvar.h> | |
46 #include <sys/processor.h> | |
5045
75a798a98460
6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents:
4858
diff
changeset
|
47 #include <sys/sysmacros.h> |
3434 | 48 #include <sys/pg.h> |
0 | 49 #include <sys/fp.h> |
50 #include <sys/controlregs.h> | |
13148
67d1861e02c1
6970888 panic BAD TRAP: type=d (#gp General protection) due to incorrect use of x86_featureset
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13146
diff
changeset
|
51 #include <sys/bitmap.h> |
0 | 52 #include <sys/auxv_386.h> |
53 #include <sys/memnode.h> | |
10947
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
54 #include <sys/pci_cfgspace.h> |
0 | 55 |
7532
bb6372f778bb
PSARC 2008/569 FMA Topology & Retire Agent Refinements
Cheng Sean Ye <Sean.Ye@Sun.COM>
parents:
7282
diff
changeset
|
56 #ifdef __xpv |
bb6372f778bb
PSARC 2008/569 FMA Topology & Retire Agent Refinements
Cheng Sean Ye <Sean.Ye@Sun.COM>
parents:
7282
diff
changeset
|
57 #include <sys/hypervisor.h> |
8930
02055889c73a
6786943 AMD-based systems with C1E state enabled hang at boot
Bill Holler <Bill.Holler@Sun.COM>
parents:
8906
diff
changeset
|
58 #else |
02055889c73a
6786943 AMD-based systems with C1E state enabled hang at boot
Bill Holler <Bill.Holler@Sun.COM>
parents:
8906
diff
changeset
|
59 #include <sys/ontrap.h> |
7532
bb6372f778bb
PSARC 2008/569 FMA Topology & Retire Agent Refinements
Cheng Sean Ye <Sean.Ye@Sun.COM>
parents:
7282
diff
changeset
|
60 #endif |
bb6372f778bb
PSARC 2008/569 FMA Topology & Retire Agent Refinements
Cheng Sean Ye <Sean.Ye@Sun.COM>
parents:
7282
diff
changeset
|
61 |
0 | 62 /* |
63 * Pass 0 of cpuid feature analysis happens in locore. It contains special code | |
64 * to recognize Cyrix processors that are not cpuid-compliant, and to deal with | |
65 * them accordingly. For most modern processors, feature detection occurs here | |
66 * in pass 1. | |
67 * | |
68 * Pass 1 of cpuid feature analysis happens just at the beginning of mlsetup() | |
69 * for the boot CPU and does the basic analysis that the early kernel needs. | |
12838
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
70 * x86_featureset is set based on the return value of cpuid_pass1() of the boot |
0 | 71 * CPU. |
72 * | |
73 * Pass 1 includes: | |
74 * | |
75 * o Determining vendor/model/family/stepping and setting x86_type and | |
76 * x86_vendor accordingly. | |
77 * o Processing the feature flags returned by the cpuid instruction while | |
78 * applying any workarounds or tricks for the specific processor. | |
79 * o Mapping the feature flags into Solaris feature bits (X86_*). | |
80 * o Processing extended feature flags if supported by the processor, | |
81 * again while applying specific processor knowledge. | |
82 * o Determining the CMT characteristics of the system. | |
83 * | |
84 * Pass 1 is done on non-boot CPUs during their initialization and the results | |
85 * are used only as a meager attempt at ensuring that all processors within the | |
86 * system support the same features. | |
87 * | |
88 * Pass 2 of cpuid feature analysis happens just at the beginning | |
89 * of startup(). It just copies in and corrects the remainder | |
90 * of the cpuid data we depend on: standard cpuid functions that we didn't | |
91 * need for pass1 feature analysis, and extended cpuid functions beyond the | |
92 * simple feature processing done in pass1. | |
93 * | |
94 * Pass 3 of cpuid analysis is invoked after basic kernel services; in | |
95 * particular kernel memory allocation has been made available. It creates a | |
96 * readable brand string based on the data collected in the first two passes. | |
97 * | |
98 * Pass 4 of cpuid analysis is invoked after post_startup() when all | |
99 * the support infrastructure for various hardware features has been | |
100 * initialized. It determines which processor features will be reported | |
101 * to userland via the aux vector. | |
102 * | |
103 * All passes are executed on all CPUs, but only the boot CPU determines what | |
104 * features the kernel will use. | |
105 * | |
106 * Much of the worst junk in this file is for the support of processors | |
107 * that didn't really implement the cpuid instruction properly. | |
108 * | |
109 * NOTE: The accessor functions (cpuid_get*) are aware of, and ASSERT upon, | |
110 * the pass numbers. Accordingly, changes to the pass code may require changes | |
111 * to the accessor code. | |
112 */ | |
113 | |
114 uint_t x86_vendor = X86_VENDOR_IntelClone; | |
115 uint_t x86_type = X86_TYPE_OTHER; | |
7589
7de800909a06
PSARC 2008/560 Intel IOMMU
Vikram Hegde <Vikram.Hegde@Sun.COM>
parents:
7532
diff
changeset
|
116 uint_t x86_clflush_size = 0; |
0 | 117 |
118 uint_t pentiumpro_bug4046376; | |
119 uint_t pentiumpro_bug4064495; | |
120 | |
13148
67d1861e02c1
6970888 panic BAD TRAP: type=d (#gp General protection) due to incorrect use of x86_featureset
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13146
diff
changeset
|
121 uchar_t x86_featureset[BT_SIZEOFMAP(NUM_X86_FEATURES)]; |
67d1861e02c1
6970888 panic BAD TRAP: type=d (#gp General protection) due to incorrect use of x86_featureset
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13146
diff
changeset
|
122 |
67d1861e02c1
6970888 panic BAD TRAP: type=d (#gp General protection) due to incorrect use of x86_featureset
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13146
diff
changeset
|
123 static char *x86_feature_names[NUM_X86_FEATURES] = { |
12838
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
124 "lgpg", |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
125 "tsc", |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
126 "msr", |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
127 "mtrr", |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
128 "pge", |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
129 "de", |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
130 "cmov", |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
131 "mmx", |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
132 "mca", |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
133 "pae", |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
134 "cv8", |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
135 "pat", |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
136 "sep", |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
137 "sse", |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
138 "sse2", |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
139 "htt", |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
140 "asysc", |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
141 "nx", |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
142 "sse3", |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
143 "cx16", |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
144 "cmp", |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
145 "tscp", |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
146 "mwait", |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
147 "sse4a", |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
148 "cpuid", |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
149 "ssse3", |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
150 "sse4_1", |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
151 "sse4_2", |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
152 "1gpg", |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
153 "clfsh", |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
154 "64", |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
155 "aes", |
13146
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
156 "pclmulqdq", |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
157 "xsave", |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
158 "avx" }; |
12838
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
159 |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
160 boolean_t |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
161 is_x86_feature(void *featureset, uint_t feature) |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
162 { |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
163 ASSERT(feature < NUM_X86_FEATURES); |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
164 return (BT_TEST((ulong_t *)featureset, feature)); |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
165 } |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
166 |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
167 void |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
168 add_x86_feature(void *featureset, uint_t feature) |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
169 { |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
170 ASSERT(feature < NUM_X86_FEATURES); |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
171 BT_SET((ulong_t *)featureset, feature); |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
172 } |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
173 |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
174 void |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
175 remove_x86_feature(void *featureset, uint_t feature) |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
176 { |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
177 ASSERT(feature < NUM_X86_FEATURES); |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
178 BT_CLEAR((ulong_t *)featureset, feature); |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
179 } |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
180 |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
181 boolean_t |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
182 compare_x86_featureset(void *setA, void *setB) |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
183 { |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
184 /* |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
185 * We assume that the unused bits of the bitmap are always zero. |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
186 */ |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
187 if (memcmp(setA, setB, BT_SIZEOFMAP(NUM_X86_FEATURES)) == 0) { |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
188 return (B_TRUE); |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
189 } else { |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
190 return (B_FALSE); |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
191 } |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
192 } |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
193 |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
194 void |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
195 print_x86_featureset(void *featureset) |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
196 { |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
197 uint_t i; |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
198 |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
199 for (i = 0; i < NUM_X86_FEATURES; i++) { |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
200 if (is_x86_feature(featureset, i)) { |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
201 cmn_err(CE_CONT, "?x86_feature: %s\n", |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
202 x86_feature_names[i]); |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
203 } |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
204 } |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
205 } |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
206 |
0 | 207 uint_t enable486; |
13146
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
208 |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
209 static size_t xsave_state_size = 0; |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
210 uint64_t xsave_bv_all = (XFEATURE_LEGACY_FP | XFEATURE_SSE); |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
211 boolean_t xsave_force_disable = B_FALSE; |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
212 |
8990
67ae112ecc4f
6621869 Solaris hangs on TSC calibration while powering on under VMware ESX Server
Surya Prakki <Surya.Prakki@Sun.COM>
parents:
8930
diff
changeset
|
213 /* |
9000
7a9c5c9ed60d
6775011 bad trap page fault while starting dom0
Stuart Maybee <Stuart.Maybee@Sun.COM>
parents:
8990
diff
changeset
|
214 * This is set to platform type Solaris is running on. |
8990
67ae112ecc4f
6621869 Solaris hangs on TSC calibration while powering on under VMware ESX Server
Surya Prakki <Surya.Prakki@Sun.COM>
parents:
8930
diff
changeset
|
215 */ |
10175
dd9708d1f561
6849090 Need to synch with newer versions of Xen and associated tools
Stuart Maybee <Stuart.Maybee@Sun.COM>
parents:
10080
diff
changeset
|
216 static int platform_type = -1; |
dd9708d1f561
6849090 Need to synch with newer versions of Xen and associated tools
Stuart Maybee <Stuart.Maybee@Sun.COM>
parents:
10080
diff
changeset
|
217 |
dd9708d1f561
6849090 Need to synch with newer versions of Xen and associated tools
Stuart Maybee <Stuart.Maybee@Sun.COM>
parents:
10080
diff
changeset
|
218 #if !defined(__xpv) |
dd9708d1f561
6849090 Need to synch with newer versions of Xen and associated tools
Stuart Maybee <Stuart.Maybee@Sun.COM>
parents:
10080
diff
changeset
|
219 /* |
dd9708d1f561
6849090 Need to synch with newer versions of Xen and associated tools
Stuart Maybee <Stuart.Maybee@Sun.COM>
parents:
10080
diff
changeset
|
220 * Variable to patch if hypervisor platform detection needs to be |
dd9708d1f561
6849090 Need to synch with newer versions of Xen and associated tools
Stuart Maybee <Stuart.Maybee@Sun.COM>
parents:
10080
diff
changeset
|
221 * disabled (e.g. platform_type will always be HW_NATIVE if this is 0). |
dd9708d1f561
6849090 Need to synch with newer versions of Xen and associated tools
Stuart Maybee <Stuart.Maybee@Sun.COM>
parents:
10080
diff
changeset
|
222 */ |
dd9708d1f561
6849090 Need to synch with newer versions of Xen and associated tools
Stuart Maybee <Stuart.Maybee@Sun.COM>
parents:
10080
diff
changeset
|
223 int enable_platform_detection = 1; |
dd9708d1f561
6849090 Need to synch with newer versions of Xen and associated tools
Stuart Maybee <Stuart.Maybee@Sun.COM>
parents:
10080
diff
changeset
|
224 #endif |
0 | 225 |
226 /* | |
4481
2bb321aaf3c3
6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents:
4265
diff
changeset
|
227 * monitor/mwait info. |
5045
75a798a98460
6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents:
4858
diff
changeset
|
228 * |
75a798a98460
6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents:
4858
diff
changeset
|
229 * size_actual and buf_actual are the real address and size allocated to get |
75a798a98460
6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents:
4858
diff
changeset
|
230 * proper mwait_buf alignement. buf_actual and size_actual should be passed |
75a798a98460
6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents:
4858
diff
changeset
|
231 * to kmem_free(). Currently kmem_alloc() and mwait happen to both use |
75a798a98460
6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents:
4858
diff
changeset
|
232 * processor cache-line alignment, but this is not guarantied in the furture. |
4481
2bb321aaf3c3
6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents:
4265
diff
changeset
|
233 */ |
2bb321aaf3c3
6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents:
4265
diff
changeset
|
234 struct mwait_info { |
2bb321aaf3c3
6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents:
4265
diff
changeset
|
235 size_t mon_min; /* min size to avoid missed wakeups */ |
2bb321aaf3c3
6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents:
4265
diff
changeset
|
236 size_t mon_max; /* size to avoid false wakeups */ |
5045
75a798a98460
6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents:
4858
diff
changeset
|
237 size_t size_actual; /* size actually allocated */ |
75a798a98460
6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents:
4858
diff
changeset
|
238 void *buf_actual; /* memory actually allocated */ |
4481
2bb321aaf3c3
6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents:
4265
diff
changeset
|
239 uint32_t support; /* processor support of monitor/mwait */ |
2bb321aaf3c3
6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents:
4265
diff
changeset
|
240 }; |
2bb321aaf3c3
6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents:
4265
diff
changeset
|
241 |
2bb321aaf3c3
6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents:
4265
diff
changeset
|
242 /* |
13146
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
243 * xsave/xrestor info. |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
244 * |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
245 * This structure contains HW feature bits and size of the xsave save area. |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
246 * Note: the kernel will use the maximum size required for all hardware |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
247 * features. It is not optimize for potential memory savings if features at |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
248 * the end of the save area are not enabled. |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
249 */ |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
250 struct xsave_info { |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
251 uint32_t xsav_hw_features_low; /* Supported HW features */ |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
252 uint32_t xsav_hw_features_high; /* Supported HW features */ |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
253 size_t xsav_max_size; /* max size save area for HW features */ |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
254 size_t ymm_size; /* AVX: size of ymm save area */ |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
255 size_t ymm_offset; /* AVX: offset for ymm save area */ |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
256 }; |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
257 |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
258 |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
259 /* |
0 | 260 * These constants determine how many of the elements of the |
261 * cpuid we cache in the cpuid_info data structure; the | |
262 * remaining elements are accessible via the cpuid instruction. | |
263 */ | |
264 | |
265 #define NMAX_CPI_STD 6 /* eax = 0 .. 5 */ | |
10947
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
266 #define NMAX_CPI_EXTD 0x1c /* eax = 0x80000000 .. 0x8000001b */ |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
267 |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
268 /* |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
269 * Some terminology needs to be explained: |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
270 * - Socket: Something that can be plugged into a motherboard. |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
271 * - Package: Same as socket |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
272 * - Chip: Same as socket. Note that AMD's documentation uses term "chip" |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
273 * differently: there, chip is the same as processor node (below) |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
274 * - Processor node: Some AMD processors have more than one |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
275 * "subprocessor" embedded in a package. These subprocessors (nodes) |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
276 * are fully-functional processors themselves with cores, caches, |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
277 * memory controllers, PCI configuration spaces. They are connected |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
278 * inside the package with Hypertransport links. On single-node |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
279 * processors, processor node is equivalent to chip/socket/package. |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
280 */ |
0 | 281 |
282 struct cpuid_info { | |
283 uint_t cpi_pass; /* last pass completed */ | |
284 /* | |
285 * standard function information | |
286 */ | |
287 uint_t cpi_maxeax; /* fn 0: %eax */ | |
288 char cpi_vendorstr[13]; /* fn 0: %ebx:%ecx:%edx */ | |
289 uint_t cpi_vendor; /* enum of cpi_vendorstr */ | |
290 | |
291 uint_t cpi_family; /* fn 1: extended family */ | |
292 uint_t cpi_model; /* fn 1: extended model */ | |
293 uint_t cpi_step; /* fn 1: stepping */ | |
10947
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
294 chipid_t cpi_chipid; /* fn 1: %ebx: Intel: chip # */ |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
295 /* AMD: package/socket # */ |
0 | 296 uint_t cpi_brandid; /* fn 1: %ebx: brand ID */ |
297 int cpi_clogid; /* fn 1: %ebx: thread # */ | |
1228 | 298 uint_t cpi_ncpu_per_chip; /* fn 1: %ebx: logical cpu count */ |
0 | 299 uint8_t cpi_cacheinfo[16]; /* fn 2: intel-style cache desc */ |
300 uint_t cpi_ncache; /* fn 2: number of elements */ | |
4606 | 301 uint_t cpi_ncpu_shr_last_cache; /* fn 4: %eax: ncpus sharing cache */ |
302 id_t cpi_last_lvl_cacheid; /* fn 4: %eax: derived cache id */ | |
303 uint_t cpi_std_4_size; /* fn 4: number of fn 4 elements */ | |
304 struct cpuid_regs **cpi_std_4; /* fn 4: %ecx == 0 .. fn4_size */ | |
1228 | 305 struct cpuid_regs cpi_std[NMAX_CPI_STD]; /* 0 .. 5 */ |
0 | 306 /* |
307 * extended function information | |
308 */ | |
309 uint_t cpi_xmaxeax; /* fn 0x80000000: %eax */ | |
310 char cpi_brandstr[49]; /* fn 0x8000000[234] */ | |
311 uint8_t cpi_pabits; /* fn 0x80000006: %eax */ | |
10947
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
312 uint8_t cpi_vabits; /* fn 0x80000006: %eax */ |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
313 struct cpuid_regs cpi_extd[NMAX_CPI_EXTD]; /* 0x800000XX */ |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
314 |
5870
2513339ac53a
6642169 cpu.generic panic during install of snv_76 and later builds
gavinm
parents:
5741
diff
changeset
|
315 id_t cpi_coreid; /* same coreid => strands share core */ |
2513339ac53a
6642169 cpu.generic panic during install of snv_76 and later builds
gavinm
parents:
5741
diff
changeset
|
316 int cpi_pkgcoreid; /* core number within single package */ |
1228 | 317 uint_t cpi_ncore_per_chip; /* AMD: fn 0x80000008: %ecx[7-0] */ |
318 /* Intel: fn 4: %eax[31-26] */ | |
0 | 319 /* |
320 * supported feature information | |
321 */ | |
3446 | 322 uint32_t cpi_support[5]; |
0 | 323 #define STD_EDX_FEATURES 0 |
324 #define AMD_EDX_FEATURES 1 | |
325 #define TM_EDX_FEATURES 2 | |
326 #define STD_ECX_FEATURES 3 | |
3446 | 327 #define AMD_ECX_FEATURES 4 |
2869
324151eecd58
PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents:
2584
diff
changeset
|
328 /* |
324151eecd58
PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents:
2584
diff
changeset
|
329 * Synthesized information, where known. |
324151eecd58
PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents:
2584
diff
changeset
|
330 */ |
324151eecd58
PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents:
2584
diff
changeset
|
331 uint32_t cpi_chiprev; /* See X86_CHIPREV_* in x86_archext.h */ |
324151eecd58
PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents:
2584
diff
changeset
|
332 const char *cpi_chiprevstr; /* May be NULL if chiprev unknown */ |
324151eecd58
PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents:
2584
diff
changeset
|
333 uint32_t cpi_socket; /* Chip package/socket type */ |
4481
2bb321aaf3c3
6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents:
4265
diff
changeset
|
334 |
2bb321aaf3c3
6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents:
4265
diff
changeset
|
335 struct mwait_info cpi_mwait; /* fn 5: monitor/mwait info */ |
7282
5b3b6674ac91
6528768 apic_navail_vector() fails when IPL equals 8 or 9
mishra
parents:
6964
diff
changeset
|
336 uint32_t cpi_apicid; |
10947
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
337 uint_t cpi_procnodeid; /* AMD: nodeID on HT, Intel: chipid */ |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
338 uint_t cpi_procnodes_per_pkg; /* AMD: # of nodes in the package */ |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
339 /* Intel: 1 */ |
13146
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
340 |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
341 struct xsave_info cpi_xsave; /* fn D: xsave/xrestor info */ |
0 | 342 }; |
343 | |
344 | |
345 static struct cpuid_info cpuid_info0; | |
346 | |
347 /* | |
348 * These bit fields are defined by the Intel Application Note AP-485 | |
349 * "Intel Processor Identification and the CPUID Instruction" | |
350 */ | |
351 #define CPI_FAMILY_XTD(cpi) BITX((cpi)->cpi_std[1].cp_eax, 27, 20) | |
352 #define CPI_MODEL_XTD(cpi) BITX((cpi)->cpi_std[1].cp_eax, 19, 16) | |
353 #define CPI_TYPE(cpi) BITX((cpi)->cpi_std[1].cp_eax, 13, 12) | |
354 #define CPI_FAMILY(cpi) BITX((cpi)->cpi_std[1].cp_eax, 11, 8) | |
355 #define CPI_STEP(cpi) BITX((cpi)->cpi_std[1].cp_eax, 3, 0) | |
356 #define CPI_MODEL(cpi) BITX((cpi)->cpi_std[1].cp_eax, 7, 4) | |
357 | |
358 #define CPI_FEATURES_EDX(cpi) ((cpi)->cpi_std[1].cp_edx) | |
359 #define CPI_FEATURES_ECX(cpi) ((cpi)->cpi_std[1].cp_ecx) | |
360 #define CPI_FEATURES_XTD_EDX(cpi) ((cpi)->cpi_extd[1].cp_edx) | |
361 #define CPI_FEATURES_XTD_ECX(cpi) ((cpi)->cpi_extd[1].cp_ecx) | |
362 | |
363 #define CPI_BRANDID(cpi) BITX((cpi)->cpi_std[1].cp_ebx, 7, 0) | |
364 #define CPI_CHUNKS(cpi) BITX((cpi)->cpi_std[1].cp_ebx, 15, 7) | |
365 #define CPI_CPU_COUNT(cpi) BITX((cpi)->cpi_std[1].cp_ebx, 23, 16) | |
366 #define CPI_APIC_ID(cpi) BITX((cpi)->cpi_std[1].cp_ebx, 31, 24) | |
367 | |
368 #define CPI_MAXEAX_MAX 0x100 /* sanity control */ | |
369 #define CPI_XMAXEAX_MAX 0x80000100 | |
4606 | 370 #define CPI_FN4_ECX_MAX 0x20 /* sanity: max fn 4 levels */ |
7282
5b3b6674ac91
6528768 apic_navail_vector() fails when IPL equals 8 or 9
mishra
parents:
6964
diff
changeset
|
371 #define CPI_FNB_ECX_MAX 0x20 /* sanity: max fn B levels */ |
4606 | 372 |
373 /* | |
374 * Function 4 (Deterministic Cache Parameters) macros | |
375 * Defined by Intel Application Note AP-485 | |
376 */ | |
377 #define CPI_NUM_CORES(regs) BITX((regs)->cp_eax, 31, 26) | |
378 #define CPI_NTHR_SHR_CACHE(regs) BITX((regs)->cp_eax, 25, 14) | |
379 #define CPI_FULL_ASSOC_CACHE(regs) BITX((regs)->cp_eax, 9, 9) | |
380 #define CPI_SELF_INIT_CACHE(regs) BITX((regs)->cp_eax, 8, 8) | |
381 #define CPI_CACHE_LVL(regs) BITX((regs)->cp_eax, 7, 5) | |
382 #define CPI_CACHE_TYPE(regs) BITX((regs)->cp_eax, 4, 0) | |
7282
5b3b6674ac91
6528768 apic_navail_vector() fails when IPL equals 8 or 9
mishra
parents:
6964
diff
changeset
|
383 #define CPI_CPU_LEVEL_TYPE(regs) BITX((regs)->cp_ecx, 15, 8) |
4606 | 384 |
385 #define CPI_CACHE_WAYS(regs) BITX((regs)->cp_ebx, 31, 22) | |
386 #define CPI_CACHE_PARTS(regs) BITX((regs)->cp_ebx, 21, 12) | |
387 #define CPI_CACHE_COH_LN_SZ(regs) BITX((regs)->cp_ebx, 11, 0) | |
388 | |
389 #define CPI_CACHE_SETS(regs) BITX((regs)->cp_ecx, 31, 0) | |
390 | |
391 #define CPI_PREFCH_STRIDE(regs) BITX((regs)->cp_edx, 9, 0) | |
392 | |
0 | 393 |
394 /* | |
1975
7490b056500b
6183891 Missing brand ID strings for several common x86 CPUs
dmick
parents:
1727
diff
changeset
|
395 * A couple of shorthand macros to identify "later" P6-family chips |
7490b056500b
6183891 Missing brand ID strings for several common x86 CPUs
dmick
parents:
1727
diff
changeset
|
396 * like the Pentium M and Core. First, the "older" P6-based stuff |
7490b056500b
6183891 Missing brand ID strings for several common x86 CPUs
dmick
parents:
1727
diff
changeset
|
397 * (loosely defined as "pre-Pentium-4"): |
7490b056500b
6183891 Missing brand ID strings for several common x86 CPUs
dmick
parents:
1727
diff
changeset
|
398 * P6, PII, Mobile PII, PII Xeon, PIII, Mobile PIII, PIII Xeon |
7490b056500b
6183891 Missing brand ID strings for several common x86 CPUs
dmick
parents:
1727
diff
changeset
|
399 */ |
7490b056500b
6183891 Missing brand ID strings for several common x86 CPUs
dmick
parents:
1727
diff
changeset
|
400 |
7490b056500b
6183891 Missing brand ID strings for several common x86 CPUs
dmick
parents:
1727
diff
changeset
|
401 #define IS_LEGACY_P6(cpi) ( \ |
7490b056500b
6183891 Missing brand ID strings for several common x86 CPUs
dmick
parents:
1727
diff
changeset
|
402 cpi->cpi_family == 6 && \ |
7490b056500b
6183891 Missing brand ID strings for several common x86 CPUs
dmick
parents:
1727
diff
changeset
|
403 (cpi->cpi_model == 1 || \ |
7490b056500b
6183891 Missing brand ID strings for several common x86 CPUs
dmick
parents:
1727
diff
changeset
|
404 cpi->cpi_model == 3 || \ |
7490b056500b
6183891 Missing brand ID strings for several common x86 CPUs
dmick
parents:
1727
diff
changeset
|
405 cpi->cpi_model == 5 || \ |
7490b056500b
6183891 Missing brand ID strings for several common x86 CPUs
dmick
parents:
1727
diff
changeset
|
406 cpi->cpi_model == 6 || \ |
7490b056500b
6183891 Missing brand ID strings for several common x86 CPUs
dmick
parents:
1727
diff
changeset
|
407 cpi->cpi_model == 7 || \ |
7490b056500b
6183891 Missing brand ID strings for several common x86 CPUs
dmick
parents:
1727
diff
changeset
|
408 cpi->cpi_model == 8 || \ |
7490b056500b
6183891 Missing brand ID strings for several common x86 CPUs
dmick
parents:
1727
diff
changeset
|
409 cpi->cpi_model == 0xA || \ |
7490b056500b
6183891 Missing brand ID strings for several common x86 CPUs
dmick
parents:
1727
diff
changeset
|
410 cpi->cpi_model == 0xB) \ |
7490b056500b
6183891 Missing brand ID strings for several common x86 CPUs
dmick
parents:
1727
diff
changeset
|
411 ) |
7490b056500b
6183891 Missing brand ID strings for several common x86 CPUs
dmick
parents:
1727
diff
changeset
|
412 |
7490b056500b
6183891 Missing brand ID strings for several common x86 CPUs
dmick
parents:
1727
diff
changeset
|
413 /* A "new F6" is everything with family 6 that's not the above */ |
7490b056500b
6183891 Missing brand ID strings for several common x86 CPUs
dmick
parents:
1727
diff
changeset
|
414 #define IS_NEW_F6(cpi) ((cpi->cpi_family == 6) && !IS_LEGACY_P6(cpi)) |
7490b056500b
6183891 Missing brand ID strings for several common x86 CPUs
dmick
parents:
1727
diff
changeset
|
415 |
4855
3319ad80f260
6574102 Need to add extended family/model/stepping info to cpuid_pass1() for Intel processors
ksadhukh
parents:
4797
diff
changeset
|
416 /* Extended family/model support */ |
3319ad80f260
6574102 Need to add extended family/model/stepping info to cpuid_pass1() for Intel processors
ksadhukh
parents:
4797
diff
changeset
|
417 #define IS_EXTENDED_MODEL_INTEL(cpi) (cpi->cpi_family == 0x6 || \ |
3319ad80f260
6574102 Need to add extended family/model/stepping info to cpuid_pass1() for Intel processors
ksadhukh
parents:
4797
diff
changeset
|
418 cpi->cpi_family >= 0xf) |
3319ad80f260
6574102 Need to add extended family/model/stepping info to cpuid_pass1() for Intel processors
ksadhukh
parents:
4797
diff
changeset
|
419 |
1975
7490b056500b
6183891 Missing brand ID strings for several common x86 CPUs
dmick
parents:
1727
diff
changeset
|
420 /* |
4481
2bb321aaf3c3
6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents:
4265
diff
changeset
|
421 * Info for monitor/mwait idle loop. |
2bb321aaf3c3
6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents:
4265
diff
changeset
|
422 * |
2bb321aaf3c3
6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents:
4265
diff
changeset
|
423 * See cpuid section of "Intel 64 and IA-32 Architectures Software Developer's |
2bb321aaf3c3
6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents:
4265
diff
changeset
|
424 * Manual Volume 2A: Instruction Set Reference, A-M" #25366-022US, November |
2bb321aaf3c3
6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents:
4265
diff
changeset
|
425 * 2006. |
2bb321aaf3c3
6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents:
4265
diff
changeset
|
426 * See MONITOR/MWAIT section of "AMD64 Architecture Programmer's Manual |
2bb321aaf3c3
6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents:
4265
diff
changeset
|
427 * Documentation Updates" #33633, Rev 2.05, December 2006. |
2bb321aaf3c3
6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents:
4265
diff
changeset
|
428 */ |
2bb321aaf3c3
6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents:
4265
diff
changeset
|
429 #define MWAIT_SUPPORT (0x00000001) /* mwait supported */ |
2bb321aaf3c3
6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents:
4265
diff
changeset
|
430 #define MWAIT_EXTENSIONS (0x00000002) /* extenstion supported */ |
2bb321aaf3c3
6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents:
4265
diff
changeset
|
431 #define MWAIT_ECX_INT_ENABLE (0x00000004) /* ecx 1 extension supported */ |
2bb321aaf3c3
6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents:
4265
diff
changeset
|
432 #define MWAIT_SUPPORTED(cpi) ((cpi)->cpi_std[1].cp_ecx & CPUID_INTC_ECX_MON) |
2bb321aaf3c3
6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents:
4265
diff
changeset
|
433 #define MWAIT_INT_ENABLE(cpi) ((cpi)->cpi_std[5].cp_ecx & 0x2) |
2bb321aaf3c3
6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents:
4265
diff
changeset
|
434 #define MWAIT_EXTENSION(cpi) ((cpi)->cpi_std[5].cp_ecx & 0x1) |
2bb321aaf3c3
6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents:
4265
diff
changeset
|
435 #define MWAIT_SIZE_MIN(cpi) BITX((cpi)->cpi_std[5].cp_eax, 15, 0) |
2bb321aaf3c3
6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents:
4265
diff
changeset
|
436 #define MWAIT_SIZE_MAX(cpi) BITX((cpi)->cpi_std[5].cp_ebx, 15, 0) |
2bb321aaf3c3
6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents:
4265
diff
changeset
|
437 /* |
2bb321aaf3c3
6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents:
4265
diff
changeset
|
438 * Number of sub-cstates for a given c-state. |
2bb321aaf3c3
6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents:
4265
diff
changeset
|
439 */ |
2bb321aaf3c3
6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents:
4265
diff
changeset
|
440 #define MWAIT_NUM_SUBC_STATES(cpi, c_state) \ |
2bb321aaf3c3
6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents:
4265
diff
changeset
|
441 BITX((cpi)->cpi_std[5].cp_edx, c_state + 3, c_state) |
2bb321aaf3c3
6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents:
4265
diff
changeset
|
442 |
7532
bb6372f778bb
PSARC 2008/569 FMA Topology & Retire Agent Refinements
Cheng Sean Ye <Sean.Ye@Sun.COM>
parents:
7282
diff
changeset
|
443 /* |
13146
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
444 * XSAVE leaf 0xD enumeration |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
445 */ |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
446 #define CPUID_LEAFD_2_YMM_OFFSET 576 |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
447 #define CPUID_LEAFD_2_YMM_SIZE 256 |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
448 |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
449 /* |
7532
bb6372f778bb
PSARC 2008/569 FMA Topology & Retire Agent Refinements
Cheng Sean Ye <Sean.Ye@Sun.COM>
parents:
7282
diff
changeset
|
450 * Functions we consune from cpuid_subr.c; don't publish these in a header |
bb6372f778bb
PSARC 2008/569 FMA Topology & Retire Agent Refinements
Cheng Sean Ye <Sean.Ye@Sun.COM>
parents:
7282
diff
changeset
|
451 * file to try and keep people using the expected cpuid_* interfaces. |
bb6372f778bb
PSARC 2008/569 FMA Topology & Retire Agent Refinements
Cheng Sean Ye <Sean.Ye@Sun.COM>
parents:
7282
diff
changeset
|
452 */ |
bb6372f778bb
PSARC 2008/569 FMA Topology & Retire Agent Refinements
Cheng Sean Ye <Sean.Ye@Sun.COM>
parents:
7282
diff
changeset
|
453 extern uint32_t _cpuid_skt(uint_t, uint_t, uint_t, uint_t); |
9482
42f3d60af7ca
6770233 New model ID for Istanbul processor
Kuriakose Kuruvilla <Kuriakose.Kuruvilla@Sun.COM>
parents:
9370
diff
changeset
|
454 extern const char *_cpuid_sktstr(uint_t, uint_t, uint_t, uint_t); |
7532
bb6372f778bb
PSARC 2008/569 FMA Topology & Retire Agent Refinements
Cheng Sean Ye <Sean.Ye@Sun.COM>
parents:
7282
diff
changeset
|
455 extern uint32_t _cpuid_chiprev(uint_t, uint_t, uint_t, uint_t); |
bb6372f778bb
PSARC 2008/569 FMA Topology & Retire Agent Refinements
Cheng Sean Ye <Sean.Ye@Sun.COM>
parents:
7282
diff
changeset
|
456 extern const char *_cpuid_chiprevstr(uint_t, uint_t, uint_t, uint_t); |
bb6372f778bb
PSARC 2008/569 FMA Topology & Retire Agent Refinements
Cheng Sean Ye <Sean.Ye@Sun.COM>
parents:
7282
diff
changeset
|
457 extern uint_t _cpuid_vendorstr_to_vendorcode(char *); |
2869
324151eecd58
PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents:
2584
diff
changeset
|
458 |
324151eecd58
PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents:
2584
diff
changeset
|
459 /* |
3446 | 460 * Apply up various platform-dependent restrictions where the |
461 * underlying platform restrictions mean the CPU can be marked | |
462 * as less capable than its cpuid instruction would imply. | |
463 */ | |
5084 | 464 #if defined(__xpv) |
465 static void | |
466 platform_cpuid_mangle(uint_t vendor, uint32_t eax, struct cpuid_regs *cp) | |
467 { | |
468 switch (eax) { | |
7532
bb6372f778bb
PSARC 2008/569 FMA Topology & Retire Agent Refinements
Cheng Sean Ye <Sean.Ye@Sun.COM>
parents:
7282
diff
changeset
|
469 case 1: { |
bb6372f778bb
PSARC 2008/569 FMA Topology & Retire Agent Refinements
Cheng Sean Ye <Sean.Ye@Sun.COM>
parents:
7282
diff
changeset
|
470 uint32_t mcamask = DOMAIN_IS_INITDOMAIN(xen_info) ? |
bb6372f778bb
PSARC 2008/569 FMA Topology & Retire Agent Refinements
Cheng Sean Ye <Sean.Ye@Sun.COM>
parents:
7282
diff
changeset
|
471 0 : CPUID_INTC_EDX_MCA; |
5084 | 472 cp->cp_edx &= |
7532
bb6372f778bb
PSARC 2008/569 FMA Topology & Retire Agent Refinements
Cheng Sean Ye <Sean.Ye@Sun.COM>
parents:
7282
diff
changeset
|
473 ~(mcamask | |
bb6372f778bb
PSARC 2008/569 FMA Topology & Retire Agent Refinements
Cheng Sean Ye <Sean.Ye@Sun.COM>
parents:
7282
diff
changeset
|
474 CPUID_INTC_EDX_PSE | |
5084 | 475 CPUID_INTC_EDX_VME | CPUID_INTC_EDX_DE | |
476 CPUID_INTC_EDX_SEP | CPUID_INTC_EDX_MTRR | | |
477 CPUID_INTC_EDX_PGE | CPUID_INTC_EDX_PAT | | |
478 CPUID_AMD_EDX_SYSC | CPUID_INTC_EDX_SEP | | |
479 CPUID_INTC_EDX_PSE36 | CPUID_INTC_EDX_HTT); | |
480 break; | |
7532
bb6372f778bb
PSARC 2008/569 FMA Topology & Retire Agent Refinements
Cheng Sean Ye <Sean.Ye@Sun.COM>
parents:
7282
diff
changeset
|
481 } |
5084 | 482 |
483 case 0x80000001: | |
484 cp->cp_edx &= | |
485 ~(CPUID_AMD_EDX_PSE | | |
486 CPUID_INTC_EDX_VME | CPUID_INTC_EDX_DE | | |
487 CPUID_AMD_EDX_MTRR | CPUID_AMD_EDX_PGE | | |
488 CPUID_AMD_EDX_PAT | CPUID_AMD_EDX_PSE36 | | |
489 CPUID_AMD_EDX_SYSC | CPUID_INTC_EDX_SEP | | |
490 CPUID_AMD_EDX_TSCP); | |
491 cp->cp_ecx &= ~CPUID_AMD_ECX_CMP_LGCY; | |
492 break; | |
493 default: | |
494 break; | |
495 } | |
496 | |
497 switch (vendor) { | |
498 case X86_VENDOR_Intel: | |
499 switch (eax) { | |
500 case 4: | |
501 /* | |
502 * Zero out the (ncores-per-chip - 1) field | |
503 */ | |
504 cp->cp_eax &= 0x03fffffff; | |
505 break; | |
506 default: | |
507 break; | |
508 } | |
509 break; | |
510 case X86_VENDOR_AMD: | |
511 switch (eax) { | |
10080
29a4a1bb9f3f
6848982 32 bit kernel should use %cr8 to access the TPR when possible
Joe Bonasera <Joe.Bonasera@sun.com>
parents:
9652
diff
changeset
|
512 |
29a4a1bb9f3f
6848982 32 bit kernel should use %cr8 to access the TPR when possible
Joe Bonasera <Joe.Bonasera@sun.com>
parents:
9652
diff
changeset
|
513 case 0x80000001: |
29a4a1bb9f3f
6848982 32 bit kernel should use %cr8 to access the TPR when possible
Joe Bonasera <Joe.Bonasera@sun.com>
parents:
9652
diff
changeset
|
514 cp->cp_ecx &= ~CPUID_AMD_ECX_CR8D; |
29a4a1bb9f3f
6848982 32 bit kernel should use %cr8 to access the TPR when possible
Joe Bonasera <Joe.Bonasera@sun.com>
parents:
9652
diff
changeset
|
515 break; |
29a4a1bb9f3f
6848982 32 bit kernel should use %cr8 to access the TPR when possible
Joe Bonasera <Joe.Bonasera@sun.com>
parents:
9652
diff
changeset
|
516 |
5084 | 517 case 0x80000008: |
518 /* | |
519 * Zero out the (ncores-per-chip - 1) field | |
520 */ | |
521 cp->cp_ecx &= 0xffffff00; | |
522 break; | |
523 default: | |
524 break; | |
525 } | |
526 break; | |
527 default: | |
528 break; | |
529 } | |
530 } | |
531 #else | |
3446 | 532 #define platform_cpuid_mangle(vendor, eax, cp) /* nothing */ |
5084 | 533 #endif |
3446 | 534 |
535 /* | |
0 | 536 * Some undocumented ways of patching the results of the cpuid |
537 * instruction to permit running Solaris 10 on future cpus that | |
538 * we don't currently support. Could be set to non-zero values | |
539 * via settings in eeprom. | |
540 */ | |
541 | |
542 uint32_t cpuid_feature_ecx_include; | |
543 uint32_t cpuid_feature_ecx_exclude; | |
544 uint32_t cpuid_feature_edx_include; | |
545 uint32_t cpuid_feature_edx_exclude; | |
546 | |
12004
93f274d4a367
PSARC/2009/104 Hot-Plug Support for ACPI-based Systems
Gerry Liu <jiang.liu@intel.com>
parents:
11919
diff
changeset
|
547 /* |
93f274d4a367
PSARC/2009/104 Hot-Plug Support for ACPI-based Systems
Gerry Liu <jiang.liu@intel.com>
parents:
11919
diff
changeset
|
548 * Allocate space for mcpu_cpi in the machcpu structure for all non-boot CPUs. |
93f274d4a367
PSARC/2009/104 Hot-Plug Support for ACPI-based Systems
Gerry Liu <jiang.liu@intel.com>
parents:
11919
diff
changeset
|
549 */ |
3446 | 550 void |
551 cpuid_alloc_space(cpu_t *cpu) | |
552 { | |
553 /* | |
554 * By convention, cpu0 is the boot cpu, which is set up | |
555 * before memory allocation is available. All other cpus get | |
556 * their cpuid_info struct allocated here. | |
557 */ | |
558 ASSERT(cpu->cpu_id != 0); | |
12004
93f274d4a367
PSARC/2009/104 Hot-Plug Support for ACPI-based Systems
Gerry Liu <jiang.liu@intel.com>
parents:
11919
diff
changeset
|
559 ASSERT(cpu->cpu_m.mcpu_cpi == NULL); |
3446 | 560 cpu->cpu_m.mcpu_cpi = |
561 kmem_zalloc(sizeof (*cpu->cpu_m.mcpu_cpi), KM_SLEEP); | |
562 } | |
563 | |
564 void | |
565 cpuid_free_space(cpu_t *cpu) | |
566 { | |
4606 | 567 struct cpuid_info *cpi = cpu->cpu_m.mcpu_cpi; |
568 int i; | |
569 | |
12004
93f274d4a367
PSARC/2009/104 Hot-Plug Support for ACPI-based Systems
Gerry Liu <jiang.liu@intel.com>
parents:
11919
diff
changeset
|
570 ASSERT(cpi != NULL); |
93f274d4a367
PSARC/2009/104 Hot-Plug Support for ACPI-based Systems
Gerry Liu <jiang.liu@intel.com>
parents:
11919
diff
changeset
|
571 ASSERT(cpi != &cpuid_info0); |
4606 | 572 |
573 /* | |
574 * Free up any function 4 related dynamic storage | |
575 */ | |
576 for (i = 1; i < cpi->cpi_std_4_size; i++) | |
577 kmem_free(cpi->cpi_std_4[i], sizeof (struct cpuid_regs)); | |
578 if (cpi->cpi_std_4_size > 0) | |
579 kmem_free(cpi->cpi_std_4, | |
580 cpi->cpi_std_4_size * sizeof (struct cpuid_regs *)); | |
581 | |
12004
93f274d4a367
PSARC/2009/104 Hot-Plug Support for ACPI-based Systems
Gerry Liu <jiang.liu@intel.com>
parents:
11919
diff
changeset
|
582 kmem_free(cpi, sizeof (*cpi)); |
93f274d4a367
PSARC/2009/104 Hot-Plug Support for ACPI-based Systems
Gerry Liu <jiang.liu@intel.com>
parents:
11919
diff
changeset
|
583 cpu->cpu_m.mcpu_cpi = NULL; |
3446 | 584 } |
585 | |
5741
58423876d513
PSARC 2007/664 Paravirtualized Drivers for Fully Virtualized xVM Domains
mrj
parents:
5438
diff
changeset
|
586 #if !defined(__xpv) |
58423876d513
PSARC 2007/664 Paravirtualized Drivers for Fully Virtualized xVM Domains
mrj
parents:
5438
diff
changeset
|
587 |
58423876d513
PSARC 2007/664 Paravirtualized Drivers for Fully Virtualized xVM Domains
mrj
parents:
5438
diff
changeset
|
588 static void |
9000
7a9c5c9ed60d
6775011 bad trap page fault while starting dom0
Stuart Maybee <Stuart.Maybee@Sun.COM>
parents:
8990
diff
changeset
|
589 determine_platform() |
5741
58423876d513
PSARC 2007/664 Paravirtualized Drivers for Fully Virtualized xVM Domains
mrj
parents:
5438
diff
changeset
|
590 { |
58423876d513
PSARC 2007/664 Paravirtualized Drivers for Fully Virtualized xVM Domains
mrj
parents:
5438
diff
changeset
|
591 struct cpuid_regs cp; |
58423876d513
PSARC 2007/664 Paravirtualized Drivers for Fully Virtualized xVM Domains
mrj
parents:
5438
diff
changeset
|
592 char *xen_str; |
12090
2986679fe0b5
6941777 determine_platform needs to do a better job inside a Xen HVM guest
Frank Van Der Linden <Frank.Vanderlinden@Sun.COM>
parents:
12004
diff
changeset
|
593 uint32_t xen_signature[4], base; |
5741
58423876d513
PSARC 2007/664 Paravirtualized Drivers for Fully Virtualized xVM Domains
mrj
parents:
5438
diff
changeset
|
594 |
10175
dd9708d1f561
6849090 Need to synch with newer versions of Xen and associated tools
Stuart Maybee <Stuart.Maybee@Sun.COM>
parents:
10080
diff
changeset
|
595 platform_type = HW_NATIVE; |
dd9708d1f561
6849090 Need to synch with newer versions of Xen and associated tools
Stuart Maybee <Stuart.Maybee@Sun.COM>
parents:
10080
diff
changeset
|
596 |
dd9708d1f561
6849090 Need to synch with newer versions of Xen and associated tools
Stuart Maybee <Stuart.Maybee@Sun.COM>
parents:
10080
diff
changeset
|
597 if (!enable_platform_detection) |
dd9708d1f561
6849090 Need to synch with newer versions of Xen and associated tools
Stuart Maybee <Stuart.Maybee@Sun.COM>
parents:
10080
diff
changeset
|
598 return; |
dd9708d1f561
6849090 Need to synch with newer versions of Xen and associated tools
Stuart Maybee <Stuart.Maybee@Sun.COM>
parents:
10080
diff
changeset
|
599 |
5741
58423876d513
PSARC 2007/664 Paravirtualized Drivers for Fully Virtualized xVM Domains
mrj
parents:
5438
diff
changeset
|
600 /* |
58423876d513
PSARC 2007/664 Paravirtualized Drivers for Fully Virtualized xVM Domains
mrj
parents:
5438
diff
changeset
|
601 * In a fully virtualized domain, Xen's pseudo-cpuid function |
12090
2986679fe0b5
6941777 determine_platform needs to do a better job inside a Xen HVM guest
Frank Van Der Linden <Frank.Vanderlinden@Sun.COM>
parents:
12004
diff
changeset
|
602 * returns a string representing the Xen signature in %ebx, %ecx, |
2986679fe0b5
6941777 determine_platform needs to do a better job inside a Xen HVM guest
Frank Van Der Linden <Frank.Vanderlinden@Sun.COM>
parents:
12004
diff
changeset
|
603 * and %edx. %eax contains the maximum supported cpuid function. |
2986679fe0b5
6941777 determine_platform needs to do a better job inside a Xen HVM guest
Frank Van Der Linden <Frank.Vanderlinden@Sun.COM>
parents:
12004
diff
changeset
|
604 * We need at least a (base + 2) leaf value to do what we want |
2986679fe0b5
6941777 determine_platform needs to do a better job inside a Xen HVM guest
Frank Van Der Linden <Frank.Vanderlinden@Sun.COM>
parents:
12004
diff
changeset
|
605 * to do. Try different base values, since the hypervisor might |
2986679fe0b5
6941777 determine_platform needs to do a better job inside a Xen HVM guest
Frank Van Der Linden <Frank.Vanderlinden@Sun.COM>
parents:
12004
diff
changeset
|
606 * use a different one depending on whether hyper-v emulation |
2986679fe0b5
6941777 determine_platform needs to do a better job inside a Xen HVM guest
Frank Van Der Linden <Frank.Vanderlinden@Sun.COM>
parents:
12004
diff
changeset
|
607 * is switched on by default or not. |
5741
58423876d513
PSARC 2007/664 Paravirtualized Drivers for Fully Virtualized xVM Domains
mrj
parents:
5438
diff
changeset
|
608 */ |
12090
2986679fe0b5
6941777 determine_platform needs to do a better job inside a Xen HVM guest
Frank Van Der Linden <Frank.Vanderlinden@Sun.COM>
parents:
12004
diff
changeset
|
609 for (base = 0x40000000; base < 0x40010000; base += 0x100) { |
2986679fe0b5
6941777 determine_platform needs to do a better job inside a Xen HVM guest
Frank Van Der Linden <Frank.Vanderlinden@Sun.COM>
parents:
12004
diff
changeset
|
610 cp.cp_eax = base; |
2986679fe0b5
6941777 determine_platform needs to do a better job inside a Xen HVM guest
Frank Van Der Linden <Frank.Vanderlinden@Sun.COM>
parents:
12004
diff
changeset
|
611 (void) __cpuid_insn(&cp); |
2986679fe0b5
6941777 determine_platform needs to do a better job inside a Xen HVM guest
Frank Van Der Linden <Frank.Vanderlinden@Sun.COM>
parents:
12004
diff
changeset
|
612 xen_signature[0] = cp.cp_ebx; |
2986679fe0b5
6941777 determine_platform needs to do a better job inside a Xen HVM guest
Frank Van Der Linden <Frank.Vanderlinden@Sun.COM>
parents:
12004
diff
changeset
|
613 xen_signature[1] = cp.cp_ecx; |
2986679fe0b5
6941777 determine_platform needs to do a better job inside a Xen HVM guest
Frank Van Der Linden <Frank.Vanderlinden@Sun.COM>
parents:
12004
diff
changeset
|
614 xen_signature[2] = cp.cp_edx; |
2986679fe0b5
6941777 determine_platform needs to do a better job inside a Xen HVM guest
Frank Van Der Linden <Frank.Vanderlinden@Sun.COM>
parents:
12004
diff
changeset
|
615 xen_signature[3] = 0; |
2986679fe0b5
6941777 determine_platform needs to do a better job inside a Xen HVM guest
Frank Van Der Linden <Frank.Vanderlinden@Sun.COM>
parents:
12004
diff
changeset
|
616 xen_str = (char *)xen_signature; |
2986679fe0b5
6941777 determine_platform needs to do a better job inside a Xen HVM guest
Frank Van Der Linden <Frank.Vanderlinden@Sun.COM>
parents:
12004
diff
changeset
|
617 if (strcmp("XenVMMXenVMM", xen_str) == 0 && |
2986679fe0b5
6941777 determine_platform needs to do a better job inside a Xen HVM guest
Frank Van Der Linden <Frank.Vanderlinden@Sun.COM>
parents:
12004
diff
changeset
|
618 cp.cp_eax >= (base + 2)) { |
2986679fe0b5
6941777 determine_platform needs to do a better job inside a Xen HVM guest
Frank Van Der Linden <Frank.Vanderlinden@Sun.COM>
parents:
12004
diff
changeset
|
619 platform_type = HW_XEN_HVM; |
2986679fe0b5
6941777 determine_platform needs to do a better job inside a Xen HVM guest
Frank Van Der Linden <Frank.Vanderlinden@Sun.COM>
parents:
12004
diff
changeset
|
620 return; |
2986679fe0b5
6941777 determine_platform needs to do a better job inside a Xen HVM guest
Frank Van Der Linden <Frank.Vanderlinden@Sun.COM>
parents:
12004
diff
changeset
|
621 } |
2986679fe0b5
6941777 determine_platform needs to do a better job inside a Xen HVM guest
Frank Van Der Linden <Frank.Vanderlinden@Sun.COM>
parents:
12004
diff
changeset
|
622 } |
2986679fe0b5
6941777 determine_platform needs to do a better job inside a Xen HVM guest
Frank Van Der Linden <Frank.Vanderlinden@Sun.COM>
parents:
12004
diff
changeset
|
623 |
2986679fe0b5
6941777 determine_platform needs to do a better job inside a Xen HVM guest
Frank Van Der Linden <Frank.Vanderlinden@Sun.COM>
parents:
12004
diff
changeset
|
624 if (vmware_platform()) /* running under vmware hypervisor? */ |
9000
7a9c5c9ed60d
6775011 bad trap page fault while starting dom0
Stuart Maybee <Stuart.Maybee@Sun.COM>
parents:
8990
diff
changeset
|
625 platform_type = HW_VMWARE; |
7a9c5c9ed60d
6775011 bad trap page fault while starting dom0
Stuart Maybee <Stuart.Maybee@Sun.COM>
parents:
8990
diff
changeset
|
626 } |
7a9c5c9ed60d
6775011 bad trap page fault while starting dom0
Stuart Maybee <Stuart.Maybee@Sun.COM>
parents:
8990
diff
changeset
|
627 |
7a9c5c9ed60d
6775011 bad trap page fault while starting dom0
Stuart Maybee <Stuart.Maybee@Sun.COM>
parents:
8990
diff
changeset
|
628 int |
7a9c5c9ed60d
6775011 bad trap page fault while starting dom0
Stuart Maybee <Stuart.Maybee@Sun.COM>
parents:
8990
diff
changeset
|
629 get_hwenv(void) |
7a9c5c9ed60d
6775011 bad trap page fault while starting dom0
Stuart Maybee <Stuart.Maybee@Sun.COM>
parents:
8990
diff
changeset
|
630 { |
10175
dd9708d1f561
6849090 Need to synch with newer versions of Xen and associated tools
Stuart Maybee <Stuart.Maybee@Sun.COM>
parents:
10080
diff
changeset
|
631 if (platform_type == -1) |
dd9708d1f561
6849090 Need to synch with newer versions of Xen and associated tools
Stuart Maybee <Stuart.Maybee@Sun.COM>
parents:
10080
diff
changeset
|
632 determine_platform(); |
dd9708d1f561
6849090 Need to synch with newer versions of Xen and associated tools
Stuart Maybee <Stuart.Maybee@Sun.COM>
parents:
10080
diff
changeset
|
633 |
9000
7a9c5c9ed60d
6775011 bad trap page fault while starting dom0
Stuart Maybee <Stuart.Maybee@Sun.COM>
parents:
8990
diff
changeset
|
634 return (platform_type); |
5741
58423876d513
PSARC 2007/664 Paravirtualized Drivers for Fully Virtualized xVM Domains
mrj
parents:
5438
diff
changeset
|
635 } |
9000
7a9c5c9ed60d
6775011 bad trap page fault while starting dom0
Stuart Maybee <Stuart.Maybee@Sun.COM>
parents:
8990
diff
changeset
|
636 |
7a9c5c9ed60d
6775011 bad trap page fault while starting dom0
Stuart Maybee <Stuart.Maybee@Sun.COM>
parents:
8990
diff
changeset
|
637 int |
7a9c5c9ed60d
6775011 bad trap page fault while starting dom0
Stuart Maybee <Stuart.Maybee@Sun.COM>
parents:
8990
diff
changeset
|
638 is_controldom(void) |
7a9c5c9ed60d
6775011 bad trap page fault while starting dom0
Stuart Maybee <Stuart.Maybee@Sun.COM>
parents:
8990
diff
changeset
|
639 { |
7a9c5c9ed60d
6775011 bad trap page fault while starting dom0
Stuart Maybee <Stuart.Maybee@Sun.COM>
parents:
8990
diff
changeset
|
640 return (0); |
7a9c5c9ed60d
6775011 bad trap page fault while starting dom0
Stuart Maybee <Stuart.Maybee@Sun.COM>
parents:
8990
diff
changeset
|
641 } |
7a9c5c9ed60d
6775011 bad trap page fault while starting dom0
Stuart Maybee <Stuart.Maybee@Sun.COM>
parents:
8990
diff
changeset
|
642 |
7a9c5c9ed60d
6775011 bad trap page fault while starting dom0
Stuart Maybee <Stuart.Maybee@Sun.COM>
parents:
8990
diff
changeset
|
643 #else |
7a9c5c9ed60d
6775011 bad trap page fault while starting dom0
Stuart Maybee <Stuart.Maybee@Sun.COM>
parents:
8990
diff
changeset
|
644 |
7a9c5c9ed60d
6775011 bad trap page fault while starting dom0
Stuart Maybee <Stuart.Maybee@Sun.COM>
parents:
8990
diff
changeset
|
645 int |
7a9c5c9ed60d
6775011 bad trap page fault while starting dom0
Stuart Maybee <Stuart.Maybee@Sun.COM>
parents:
8990
diff
changeset
|
646 get_hwenv(void) |
7a9c5c9ed60d
6775011 bad trap page fault while starting dom0
Stuart Maybee <Stuart.Maybee@Sun.COM>
parents:
8990
diff
changeset
|
647 { |
7a9c5c9ed60d
6775011 bad trap page fault while starting dom0
Stuart Maybee <Stuart.Maybee@Sun.COM>
parents:
8990
diff
changeset
|
648 return (HW_XEN_PV); |
7a9c5c9ed60d
6775011 bad trap page fault while starting dom0
Stuart Maybee <Stuart.Maybee@Sun.COM>
parents:
8990
diff
changeset
|
649 } |
7a9c5c9ed60d
6775011 bad trap page fault while starting dom0
Stuart Maybee <Stuart.Maybee@Sun.COM>
parents:
8990
diff
changeset
|
650 |
7a9c5c9ed60d
6775011 bad trap page fault while starting dom0
Stuart Maybee <Stuart.Maybee@Sun.COM>
parents:
8990
diff
changeset
|
651 int |
7a9c5c9ed60d
6775011 bad trap page fault while starting dom0
Stuart Maybee <Stuart.Maybee@Sun.COM>
parents:
8990
diff
changeset
|
652 is_controldom(void) |
7a9c5c9ed60d
6775011 bad trap page fault while starting dom0
Stuart Maybee <Stuart.Maybee@Sun.COM>
parents:
8990
diff
changeset
|
653 { |
7a9c5c9ed60d
6775011 bad trap page fault while starting dom0
Stuart Maybee <Stuart.Maybee@Sun.COM>
parents:
8990
diff
changeset
|
654 return (DOMAIN_IS_INITDOMAIN(xen_info)); |
7a9c5c9ed60d
6775011 bad trap page fault while starting dom0
Stuart Maybee <Stuart.Maybee@Sun.COM>
parents:
8990
diff
changeset
|
655 } |
7a9c5c9ed60d
6775011 bad trap page fault while starting dom0
Stuart Maybee <Stuart.Maybee@Sun.COM>
parents:
8990
diff
changeset
|
656 |
5741
58423876d513
PSARC 2007/664 Paravirtualized Drivers for Fully Virtualized xVM Domains
mrj
parents:
5438
diff
changeset
|
657 #endif /* __xpv */ |
58423876d513
PSARC 2007/664 Paravirtualized Drivers for Fully Virtualized xVM Domains
mrj
parents:
5438
diff
changeset
|
658 |
10947
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
659 static void |
12838
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
660 cpuid_intel_getids(cpu_t *cpu, void *feature) |
10947
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
661 { |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
662 uint_t i; |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
663 uint_t chipid_shift = 0; |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
664 uint_t coreid_shift = 0; |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
665 struct cpuid_info *cpi = cpu->cpu_m.mcpu_cpi; |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
666 |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
667 for (i = 1; i < cpi->cpi_ncpu_per_chip; i <<= 1) |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
668 chipid_shift++; |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
669 |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
670 cpi->cpi_chipid = cpi->cpi_apicid >> chipid_shift; |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
671 cpi->cpi_clogid = cpi->cpi_apicid & ((1 << chipid_shift) - 1); |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
672 |
12838
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
673 if (is_x86_feature(feature, X86FSET_CMP)) { |
10947
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
674 /* |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
675 * Multi-core (and possibly multi-threaded) |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
676 * processors. |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
677 */ |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
678 uint_t ncpu_per_core; |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
679 if (cpi->cpi_ncore_per_chip == 1) |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
680 ncpu_per_core = cpi->cpi_ncpu_per_chip; |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
681 else if (cpi->cpi_ncore_per_chip > 1) |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
682 ncpu_per_core = cpi->cpi_ncpu_per_chip / |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
683 cpi->cpi_ncore_per_chip; |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
684 /* |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
685 * 8bit APIC IDs on dual core Pentiums |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
686 * look like this: |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
687 * |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
688 * +-----------------------+------+------+ |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
689 * | Physical Package ID | MC | HT | |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
690 * +-----------------------+------+------+ |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
691 * <------- chipid --------> |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
692 * <------- coreid ---------------> |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
693 * <--- clogid --> |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
694 * <------> |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
695 * pkgcoreid |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
696 * |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
697 * Where the number of bits necessary to |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
698 * represent MC and HT fields together equals |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
699 * to the minimum number of bits necessary to |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
700 * store the value of cpi->cpi_ncpu_per_chip. |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
701 * Of those bits, the MC part uses the number |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
702 * of bits necessary to store the value of |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
703 * cpi->cpi_ncore_per_chip. |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
704 */ |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
705 for (i = 1; i < ncpu_per_core; i <<= 1) |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
706 coreid_shift++; |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
707 cpi->cpi_coreid = cpi->cpi_apicid >> coreid_shift; |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
708 cpi->cpi_pkgcoreid = cpi->cpi_clogid >> coreid_shift; |
12838
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
709 } else if (is_x86_feature(feature, X86FSET_HTT)) { |
10947
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
710 /* |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
711 * Single-core multi-threaded processors. |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
712 */ |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
713 cpi->cpi_coreid = cpi->cpi_chipid; |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
714 cpi->cpi_pkgcoreid = 0; |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
715 } |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
716 cpi->cpi_procnodeid = cpi->cpi_chipid; |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
717 } |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
718 |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
719 static void |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
720 cpuid_amd_getids(cpu_t *cpu) |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
721 { |
11013
3aa288b66f8e
6899212 cmi_hdl_impl structure is not exactly duplicated in the generic_cpu mdb module
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10992
diff
changeset
|
722 int i, first_half, coreidsz; |
10947
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
723 uint32_t nb_caps_reg; |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
724 uint_t node2_1; |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
725 struct cpuid_info *cpi = cpu->cpu_m.mcpu_cpi; |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
726 |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
727 /* |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
728 * AMD CMP chips currently have a single thread per core. |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
729 * |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
730 * Since no two cpus share a core we must assign a distinct coreid |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
731 * per cpu, and we do this by using the cpu_id. This scheme does not, |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
732 * however, guarantee that sibling cores of a chip will have sequential |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
733 * coreids starting at a multiple of the number of cores per chip - |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
734 * that is usually the case, but if the ACPI MADT table is presented |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
735 * in a different order then we need to perform a few more gymnastics |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
736 * for the pkgcoreid. |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
737 * |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
738 * All processors in the system have the same number of enabled |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
739 * cores. Cores within a processor are always numbered sequentially |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
740 * from 0 regardless of how many or which are disabled, and there |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
741 * is no way for operating system to discover the real core id when some |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
742 * are disabled. |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
743 */ |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
744 |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
745 cpi->cpi_coreid = cpu->cpu_id; |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
746 |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
747 if (cpi->cpi_xmaxeax >= 0x80000008) { |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
748 |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
749 coreidsz = BITX((cpi)->cpi_extd[8].cp_ecx, 15, 12); |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
750 |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
751 /* |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
752 * In AMD parlance chip is really a node while Solaris |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
753 * sees chip as equivalent to socket/package. |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
754 */ |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
755 cpi->cpi_ncore_per_chip = |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
756 BITX((cpi)->cpi_extd[8].cp_ecx, 7, 0) + 1; |
11013
3aa288b66f8e
6899212 cmi_hdl_impl structure is not exactly duplicated in the generic_cpu mdb module
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10992
diff
changeset
|
757 if (coreidsz == 0) { |
10947
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
758 /* Use legacy method */ |
11013
3aa288b66f8e
6899212 cmi_hdl_impl structure is not exactly duplicated in the generic_cpu mdb module
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10992
diff
changeset
|
759 for (i = 1; i < cpi->cpi_ncore_per_chip; i <<= 1) |
3aa288b66f8e
6899212 cmi_hdl_impl structure is not exactly duplicated in the generic_cpu mdb module
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10992
diff
changeset
|
760 coreidsz++; |
3aa288b66f8e
6899212 cmi_hdl_impl structure is not exactly duplicated in the generic_cpu mdb module
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10992
diff
changeset
|
761 if (coreidsz == 0) |
3aa288b66f8e
6899212 cmi_hdl_impl structure is not exactly duplicated in the generic_cpu mdb module
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10992
diff
changeset
|
762 coreidsz = 1; |
3aa288b66f8e
6899212 cmi_hdl_impl structure is not exactly duplicated in the generic_cpu mdb module
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10992
diff
changeset
|
763 } |
10947
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
764 } else { |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
765 /* Assume single-core part */ |
11013
3aa288b66f8e
6899212 cmi_hdl_impl structure is not exactly duplicated in the generic_cpu mdb module
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10992
diff
changeset
|
766 cpi->cpi_ncore_per_chip = 1; |
12726
8f2fba7fcf9c
6957730 cpuid_amd_getids() uses uninitialized variable coreidsz
Jakub Jermar <Jakub.Jermar@Sun.COM>
parents:
12261
diff
changeset
|
767 coreidsz = 1; |
10947
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
768 } |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
769 |
11013
3aa288b66f8e
6899212 cmi_hdl_impl structure is not exactly duplicated in the generic_cpu mdb module
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10992
diff
changeset
|
770 cpi->cpi_clogid = cpi->cpi_pkgcoreid = |
3aa288b66f8e
6899212 cmi_hdl_impl structure is not exactly duplicated in the generic_cpu mdb module
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10992
diff
changeset
|
771 cpi->cpi_apicid & ((1<<coreidsz) - 1); |
10947
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
772 cpi->cpi_ncpu_per_chip = cpi->cpi_ncore_per_chip; |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
773 |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
774 /* Get nodeID */ |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
775 if (cpi->cpi_family == 0xf) { |
11013
3aa288b66f8e
6899212 cmi_hdl_impl structure is not exactly duplicated in the generic_cpu mdb module
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10992
diff
changeset
|
776 cpi->cpi_procnodeid = (cpi->cpi_apicid >> coreidsz) & 7; |
10947
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
777 cpi->cpi_chipid = cpi->cpi_procnodeid; |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
778 } else if (cpi->cpi_family == 0x10) { |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
779 /* |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
780 * See if we are a multi-node processor. |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
781 * All processors in the system have the same number of nodes |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
782 */ |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
783 nb_caps_reg = pci_getl_func(0, 24, 3, 0xe8); |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
784 if ((cpi->cpi_model < 8) || BITX(nb_caps_reg, 29, 29) == 0) { |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
785 /* Single-node */ |
11013
3aa288b66f8e
6899212 cmi_hdl_impl structure is not exactly duplicated in the generic_cpu mdb module
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10992
diff
changeset
|
786 cpi->cpi_procnodeid = BITX(cpi->cpi_apicid, 5, |
3aa288b66f8e
6899212 cmi_hdl_impl structure is not exactly duplicated in the generic_cpu mdb module
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10992
diff
changeset
|
787 coreidsz); |
10947
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
788 cpi->cpi_chipid = cpi->cpi_procnodeid; |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
789 } else { |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
790 |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
791 /* |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
792 * Multi-node revision D (2 nodes per package |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
793 * are supported) |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
794 */ |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
795 cpi->cpi_procnodes_per_pkg = 2; |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
796 |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
797 first_half = (cpi->cpi_pkgcoreid <= |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
798 (cpi->cpi_ncore_per_chip/2 - 1)); |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
799 |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
800 if (cpi->cpi_apicid == cpi->cpi_pkgcoreid) { |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
801 /* We are BSP */ |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
802 cpi->cpi_procnodeid = (first_half ? 0 : 1); |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
803 cpi->cpi_chipid = cpi->cpi_procnodeid >> 1; |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
804 } else { |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
805 |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
806 /* We are AP */ |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
807 /* NodeId[2:1] bits to use for reading F3xe8 */ |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
808 node2_1 = BITX(cpi->cpi_apicid, 5, 4) << 1; |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
809 |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
810 nb_caps_reg = |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
811 pci_getl_func(0, 24 + node2_1, 3, 0xe8); |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
812 |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
813 /* |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
814 * Check IntNodeNum bit (31:30, but bit 31 is |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
815 * always 0 on dual-node processors) |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
816 */ |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
817 if (BITX(nb_caps_reg, 30, 30) == 0) |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
818 cpi->cpi_procnodeid = node2_1 + |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
819 !first_half; |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
820 else |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
821 cpi->cpi_procnodeid = node2_1 + |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
822 first_half; |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
823 |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
824 cpi->cpi_chipid = cpi->cpi_procnodeid >> 1; |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
825 } |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
826 } |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
827 } else if (cpi->cpi_family >= 0x11) { |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
828 cpi->cpi_procnodeid = (cpi->cpi_apicid >> coreidsz) & 7; |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
829 cpi->cpi_chipid = cpi->cpi_procnodeid; |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
830 } else { |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
831 cpi->cpi_procnodeid = 0; |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
832 cpi->cpi_chipid = cpi->cpi_procnodeid; |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
833 } |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
834 } |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
835 |
13146
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
836 /* |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
837 * Setup XFeature_Enabled_Mask register. Required by xsave feature. |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
838 */ |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
839 void |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
840 setup_xfem(void) |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
841 { |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
842 uint64_t flags = XFEATURE_LEGACY_FP; |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
843 |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
844 ASSERT(is_x86_feature(x86_featureset, X86FSET_XSAVE)); |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
845 |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
846 if (is_x86_feature(x86_featureset, X86FSET_SSE)) |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
847 flags |= XFEATURE_SSE; |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
848 |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
849 if (is_x86_feature(x86_featureset, X86FSET_AVX)) |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
850 flags |= XFEATURE_AVX; |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
851 |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
852 set_xcr(XFEATURE_ENABLED_MASK, flags); |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
853 |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
854 xsave_bv_all = flags; |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
855 } |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
856 |
13148
67d1861e02c1
6970888 panic BAD TRAP: type=d (#gp General protection) due to incorrect use of x86_featureset
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13146
diff
changeset
|
857 void |
67d1861e02c1
6970888 panic BAD TRAP: type=d (#gp General protection) due to incorrect use of x86_featureset
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13146
diff
changeset
|
858 cpuid_pass1(cpu_t *cpu, uchar_t *featureset) |
0 | 859 { |
860 uint32_t mask_ecx, mask_edx; | |
861 struct cpuid_info *cpi; | |
1228 | 862 struct cpuid_regs *cp; |
0 | 863 int xcpuid; |
5084 | 864 #if !defined(__xpv) |
5045
75a798a98460
6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents:
4858
diff
changeset
|
865 extern int idle_cpu_prefer_mwait; |
5084 | 866 #endif |
3446 | 867 |
9482
42f3d60af7ca
6770233 New model ID for Istanbul processor
Kuriakose Kuruvilla <Kuriakose.Kuruvilla@Sun.COM>
parents:
9370
diff
changeset
|
868 #if !defined(__xpv) |
42f3d60af7ca
6770233 New model ID for Istanbul processor
Kuriakose Kuruvilla <Kuriakose.Kuruvilla@Sun.COM>
parents:
9370
diff
changeset
|
869 determine_platform(); |
42f3d60af7ca
6770233 New model ID for Istanbul processor
Kuriakose Kuruvilla <Kuriakose.Kuruvilla@Sun.COM>
parents:
9370
diff
changeset
|
870 #endif |
0 | 871 /* |
12004
93f274d4a367
PSARC/2009/104 Hot-Plug Support for ACPI-based Systems
Gerry Liu <jiang.liu@intel.com>
parents:
11919
diff
changeset
|
872 * Space statically allocated for BSP, ensure pointer is set |
0 | 873 */ |
12838
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
874 if (cpu->cpu_id == 0) { |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
875 if (cpu->cpu_m.mcpu_cpi == NULL) |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
876 cpu->cpu_m.mcpu_cpi = &cpuid_info0; |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
877 } |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
878 |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
879 add_x86_feature(featureset, X86FSET_CPUID); |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
880 |
3446 | 881 cpi = cpu->cpu_m.mcpu_cpi; |
882 ASSERT(cpi != NULL); | |
0 | 883 cp = &cpi->cpi_std[0]; |
1228 | 884 cp->cp_eax = 0; |
885 cpi->cpi_maxeax = __cpuid_insn(cp); | |
0 | 886 { |
887 uint32_t *iptr = (uint32_t *)cpi->cpi_vendorstr; | |
888 *iptr++ = cp->cp_ebx; | |
889 *iptr++ = cp->cp_edx; | |
890 *iptr++ = cp->cp_ecx; | |
891 *(char *)&cpi->cpi_vendorstr[12] = '\0'; | |
892 } | |
893 | |
7532
bb6372f778bb
PSARC 2008/569 FMA Topology & Retire Agent Refinements
Cheng Sean Ye <Sean.Ye@Sun.COM>
parents:
7282
diff
changeset
|
894 cpi->cpi_vendor = _cpuid_vendorstr_to_vendorcode(cpi->cpi_vendorstr); |
0 | 895 x86_vendor = cpi->cpi_vendor; /* for compatibility */ |
896 | |
897 /* | |
898 * Limit the range in case of weird hardware | |
899 */ | |
900 if (cpi->cpi_maxeax > CPI_MAXEAX_MAX) | |
901 cpi->cpi_maxeax = CPI_MAXEAX_MAX; | |
902 if (cpi->cpi_maxeax < 1) | |
903 goto pass1_done; | |
904 | |
905 cp = &cpi->cpi_std[1]; | |
1228 | 906 cp->cp_eax = 1; |
907 (void) __cpuid_insn(cp); | |
0 | 908 |
909 /* | |
910 * Extract identifying constants for easy access. | |
911 */ | |
912 cpi->cpi_model = CPI_MODEL(cpi); | |
913 cpi->cpi_family = CPI_FAMILY(cpi); | |
914 | |
1975
7490b056500b
6183891 Missing brand ID strings for several common x86 CPUs
dmick
parents:
1727
diff
changeset
|
915 if (cpi->cpi_family == 0xf) |
0 | 916 cpi->cpi_family += CPI_FAMILY_XTD(cpi); |
1975
7490b056500b
6183891 Missing brand ID strings for several common x86 CPUs
dmick
parents:
1727
diff
changeset
|
917 |
2001
427a702b03e2
6427092 extended-model CPUID information is different between AMD and Intel
dmick
parents:
1975
diff
changeset
|
918 /* |
4265
6be078c4d3b4
6555108 workarounds being applied for errata not present in greyhound processors
kchow
parents:
3779
diff
changeset
|
919 * Beware: AMD uses "extended model" iff base *FAMILY* == 0xf. |
2001
427a702b03e2
6427092 extended-model CPUID information is different between AMD and Intel
dmick
parents:
1975
diff
changeset
|
920 * Intel, and presumably everyone else, uses model == 0xf, as |
427a702b03e2
6427092 extended-model CPUID information is different between AMD and Intel
dmick
parents:
1975
diff
changeset
|
921 * one would expect (max value means possible overflow). Sigh. |
427a702b03e2
6427092 extended-model CPUID information is different between AMD and Intel
dmick
parents:
1975
diff
changeset
|
922 */ |
427a702b03e2
6427092 extended-model CPUID information is different between AMD and Intel
dmick
parents:
1975
diff
changeset
|
923 |
427a702b03e2
6427092 extended-model CPUID information is different between AMD and Intel
dmick
parents:
1975
diff
changeset
|
924 switch (cpi->cpi_vendor) { |
4855
3319ad80f260
6574102 Need to add extended family/model/stepping info to cpuid_pass1() for Intel processors
ksadhukh
parents:
4797
diff
changeset
|
925 case X86_VENDOR_Intel: |
3319ad80f260
6574102 Need to add extended family/model/stepping info to cpuid_pass1() for Intel processors
ksadhukh
parents:
4797
diff
changeset
|
926 if (IS_EXTENDED_MODEL_INTEL(cpi)) |
3319ad80f260
6574102 Need to add extended family/model/stepping info to cpuid_pass1() for Intel processors
ksadhukh
parents:
4797
diff
changeset
|
927 cpi->cpi_model += CPI_MODEL_XTD(cpi) << 4; |
4858
08409e2eed12
6574102 Need to add extended family/model/stepping info to cpuid_pass1() for Intel processors (fix lint)
ksadhukh
parents:
4855
diff
changeset
|
928 break; |
2001
427a702b03e2
6427092 extended-model CPUID information is different between AMD and Intel
dmick
parents:
1975
diff
changeset
|
929 case X86_VENDOR_AMD: |
4265
6be078c4d3b4
6555108 workarounds being applied for errata not present in greyhound processors
kchow
parents:
3779
diff
changeset
|
930 if (CPI_FAMILY(cpi) == 0xf) |
2001
427a702b03e2
6427092 extended-model CPUID information is different between AMD and Intel
dmick
parents:
1975
diff
changeset
|
931 cpi->cpi_model += CPI_MODEL_XTD(cpi) << 4; |
427a702b03e2
6427092 extended-model CPUID information is different between AMD and Intel
dmick
parents:
1975
diff
changeset
|
932 break; |
427a702b03e2
6427092 extended-model CPUID information is different between AMD and Intel
dmick
parents:
1975
diff
changeset
|
933 default: |
427a702b03e2
6427092 extended-model CPUID information is different between AMD and Intel
dmick
parents:
1975
diff
changeset
|
934 if (cpi->cpi_model == 0xf) |
427a702b03e2
6427092 extended-model CPUID information is different between AMD and Intel
dmick
parents:
1975
diff
changeset
|
935 cpi->cpi_model += CPI_MODEL_XTD(cpi) << 4; |
427a702b03e2
6427092 extended-model CPUID information is different between AMD and Intel
dmick
parents:
1975
diff
changeset
|
936 break; |
427a702b03e2
6427092 extended-model CPUID information is different between AMD and Intel
dmick
parents:
1975
diff
changeset
|
937 } |
0 | 938 |
939 cpi->cpi_step = CPI_STEP(cpi); | |
940 cpi->cpi_brandid = CPI_BRANDID(cpi); | |
941 | |
942 /* | |
943 * *default* assumptions: | |
944 * - believe %edx feature word | |
945 * - ignore %ecx feature word | |
946 * - 32-bit virtual and physical addressing | |
947 */ | |
948 mask_edx = 0xffffffff; | |
949 mask_ecx = 0; | |
950 | |
951 cpi->cpi_pabits = cpi->cpi_vabits = 32; | |
952 | |
953 switch (cpi->cpi_vendor) { | |
954 case X86_VENDOR_Intel: | |
955 if (cpi->cpi_family == 5) | |
956 x86_type = X86_TYPE_P5; | |
1975
7490b056500b
6183891 Missing brand ID strings for several common x86 CPUs
dmick
parents:
1727
diff
changeset
|
957 else if (IS_LEGACY_P6(cpi)) { |
0 | 958 x86_type = X86_TYPE_P6; |
959 pentiumpro_bug4046376 = 1; | |
960 pentiumpro_bug4064495 = 1; | |
961 /* | |
962 * Clear the SEP bit when it was set erroneously | |
963 */ | |
964 if (cpi->cpi_model < 3 && cpi->cpi_step < 3) | |
965 cp->cp_edx &= ~CPUID_INTC_EDX_SEP; | |
1975
7490b056500b
6183891 Missing brand ID strings for several common x86 CPUs
dmick
parents:
1727
diff
changeset
|
966 } else if (IS_NEW_F6(cpi) || cpi->cpi_family == 0xf) { |
0 | 967 x86_type = X86_TYPE_P4; |
968 /* | |
969 * We don't currently depend on any of the %ecx | |
970 * features until Prescott, so we'll only check | |
971 * this from P4 onwards. We might want to revisit | |
972 * that idea later. | |
973 */ | |
974 mask_ecx = 0xffffffff; | |
975 } else if (cpi->cpi_family > 0xf) | |
976 mask_ecx = 0xffffffff; | |
4636
f7779128d972
6577473 Nocona box panic when booting snv_68: Can't handle mwait size 0
bholler
parents:
4628
diff
changeset
|
977 /* |
f7779128d972
6577473 Nocona box panic when booting snv_68: Can't handle mwait size 0
bholler
parents:
4628
diff
changeset
|
978 * We don't support MONITOR/MWAIT if leaf 5 is not available |
f7779128d972
6577473 Nocona box panic when booting snv_68: Can't handle mwait size 0
bholler
parents:
4628
diff
changeset
|
979 * to obtain the monitor linesize. |
f7779128d972
6577473 Nocona box panic when booting snv_68: Can't handle mwait size 0
bholler
parents:
4628
diff
changeset
|
980 */ |
f7779128d972
6577473 Nocona box panic when booting snv_68: Can't handle mwait size 0
bholler
parents:
4628
diff
changeset
|
981 if (cpi->cpi_maxeax < 5) |
f7779128d972
6577473 Nocona box panic when booting snv_68: Can't handle mwait size 0
bholler
parents:
4628
diff
changeset
|
982 mask_ecx &= ~CPUID_INTC_ECX_MON; |
0 | 983 break; |
984 case X86_VENDOR_IntelClone: | |
985 default: | |
986 break; | |
987 case X86_VENDOR_AMD: | |
988 #if defined(OPTERON_ERRATUM_108) | |
989 if (cpi->cpi_family == 0xf && cpi->cpi_model == 0xe) { | |
990 cp->cp_eax = (0xf0f & cp->cp_eax) | 0xc0; | |
991 cpi->cpi_model = 0xc; | |
992 } else | |
993 #endif | |
994 if (cpi->cpi_family == 5) { | |
995 /* | |
996 * AMD K5 and K6 | |
997 * | |
998 * These CPUs have an incomplete implementation | |
999 * of MCA/MCE which we mask away. | |
1000 */ | |
1228 | 1001 mask_edx &= ~(CPUID_INTC_EDX_MCE | CPUID_INTC_EDX_MCA); |
1002 | |
1003 /* | |
1004 * Model 0 uses the wrong (APIC) bit | |
1005 * to indicate PGE. Fix it here. | |
1006 */ | |
0 | 1007 if (cpi->cpi_model == 0) { |
1008 if (cp->cp_edx & 0x200) { | |
1009 cp->cp_edx &= ~0x200; | |
1010 cp->cp_edx |= CPUID_INTC_EDX_PGE; | |
1011 } | |
1228 | 1012 } |
1013 | |
1014 /* | |
1015 * Early models had problems w/ MMX; disable. | |
1016 */ | |
1017 if (cpi->cpi_model < 6) | |
1018 mask_edx &= ~CPUID_INTC_EDX_MMX; | |
1019 } | |
1020 | |
1021 /* | |
1022 * For newer families, SSE3 and CX16, at least, are valid; | |
1023 * enable all | |
1024 */ | |
1025 if (cpi->cpi_family >= 0xf) | |
771
1c25a2120ec0
6327969 cpuid sse3 feature bit not noted on any AMD processor
dmick
parents:
359
diff
changeset
|
1026 mask_ecx = 0xffffffff; |
4636
f7779128d972
6577473 Nocona box panic when booting snv_68: Can't handle mwait size 0
bholler
parents:
4628
diff
changeset
|
1027 /* |
f7779128d972
6577473 Nocona box panic when booting snv_68: Can't handle mwait size 0
bholler
parents:
4628
diff
changeset
|
1028 * We don't support MONITOR/MWAIT if leaf 5 is not available |
f7779128d972
6577473 Nocona box panic when booting snv_68: Can't handle mwait size 0
bholler
parents:
4628
diff
changeset
|
1029 * to obtain the monitor linesize. |
f7779128d972
6577473 Nocona box panic when booting snv_68: Can't handle mwait size 0
bholler
parents:
4628
diff
changeset
|
1030 */ |
f7779128d972
6577473 Nocona box panic when booting snv_68: Can't handle mwait size 0
bholler
parents:
4628
diff
changeset
|
1031 if (cpi->cpi_maxeax < 5) |
f7779128d972
6577473 Nocona box panic when booting snv_68: Can't handle mwait size 0
bholler
parents:
4628
diff
changeset
|
1032 mask_ecx &= ~CPUID_INTC_ECX_MON; |
5045
75a798a98460
6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents:
4858
diff
changeset
|
1033 |
5084 | 1034 #if !defined(__xpv) |
5045
75a798a98460
6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents:
4858
diff
changeset
|
1035 /* |
75a798a98460
6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents:
4858
diff
changeset
|
1036 * Do not use MONITOR/MWAIT to halt in the idle loop on any AMD |
75a798a98460
6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents:
4858
diff
changeset
|
1037 * processors. AMD does not intend MWAIT to be used in the cpu |
75a798a98460
6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents:
4858
diff
changeset
|
1038 * idle loop on current and future processors. 10h and future |
75a798a98460
6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents:
4858
diff
changeset
|
1039 * AMD processors use more power in MWAIT than HLT. |
75a798a98460
6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents:
4858
diff
changeset
|
1040 * Pre-family-10h Opterons do not have the MWAIT instruction. |
75a798a98460
6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents:
4858
diff
changeset
|
1041 */ |
75a798a98460
6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents:
4858
diff
changeset
|
1042 idle_cpu_prefer_mwait = 0; |
5084 | 1043 #endif |
5045
75a798a98460
6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents:
4858
diff
changeset
|
1044 |
0 | 1045 break; |
1046 case X86_VENDOR_TM: | |
1047 /* | |
1048 * workaround the NT workaround in CMS 4.1 | |
1049 */ | |
1050 if (cpi->cpi_family == 5 && cpi->cpi_model == 4 && | |
1051 (cpi->cpi_step == 2 || cpi->cpi_step == 3)) | |
1052 cp->cp_edx |= CPUID_INTC_EDX_CX8; | |
1053 break; | |
1054 case X86_VENDOR_Centaur: | |
1055 /* | |
1056 * workaround the NT workarounds again | |
1057 */ | |
1058 if (cpi->cpi_family == 6) | |
1059 cp->cp_edx |= CPUID_INTC_EDX_CX8; | |
1060 break; | |
1061 case X86_VENDOR_Cyrix: | |
1062 /* | |
1063 * We rely heavily on the probing in locore | |
1064 * to actually figure out what parts, if any, | |
1065 * of the Cyrix cpuid instruction to believe. | |
1066 */ | |
1067 switch (x86_type) { | |
1068 case X86_TYPE_CYRIX_486: | |
1069 mask_edx = 0; | |
1070 break; | |
1071 case X86_TYPE_CYRIX_6x86: | |
1072 mask_edx = 0; | |
1073 break; | |
1074 case X86_TYPE_CYRIX_6x86L: | |
1075 mask_edx = | |
1076 CPUID_INTC_EDX_DE | | |
1077 CPUID_INTC_EDX_CX8; | |
1078 break; | |
1079 case X86_TYPE_CYRIX_6x86MX: | |
1080 mask_edx = | |
1081 CPUID_INTC_EDX_DE | | |
1082 CPUID_INTC_EDX_MSR | | |
1083 CPUID_INTC_EDX_CX8 | | |
1084 CPUID_INTC_EDX_PGE | | |
1085 CPUID_INTC_EDX_CMOV | | |
1086 CPUID_INTC_EDX_MMX; | |
1087 break; | |
1088 case X86_TYPE_CYRIX_GXm: | |
1089 mask_edx = | |
1090 CPUID_INTC_EDX_MSR | | |
1091 CPUID_INTC_EDX_CX8 | | |
1092 CPUID_INTC_EDX_CMOV | | |
1093 CPUID_INTC_EDX_MMX; | |
1094 break; | |
1095 case X86_TYPE_CYRIX_MediaGX: | |
1096 break; | |
1097 case X86_TYPE_CYRIX_MII: | |
1098 case X86_TYPE_VIA_CYRIX_III: | |
1099 mask_edx = | |
1100 CPUID_INTC_EDX_DE | | |
1101 CPUID_INTC_EDX_TSC | | |
1102 CPUID_INTC_EDX_MSR | | |
1103 CPUID_INTC_EDX_CX8 | | |
1104 CPUID_INTC_EDX_PGE | | |
1105 CPUID_INTC_EDX_CMOV | | |
1106 CPUID_INTC_EDX_MMX; | |
1107 break; | |
1108 default: | |
1109 break; | |
1110 } | |
1111 break; | |
1112 } | |
1113 | |
5084 | 1114 #if defined(__xpv) |
1115 /* | |
1116 * Do not support MONITOR/MWAIT under a hypervisor | |
1117 */ | |
1118 mask_ecx &= ~CPUID_INTC_ECX_MON; | |
13146
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
1119 /* |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
1120 * Do not support XSAVE under a hypervisor for now |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
1121 */ |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
1122 xsave_force_disable = B_TRUE; |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
1123 |
5084 | 1124 #endif /* __xpv */ |
1125 | |
13146
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
1126 if (xsave_force_disable) { |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
1127 mask_ecx &= ~CPUID_INTC_ECX_XSAVE; |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
1128 mask_ecx &= ~CPUID_INTC_ECX_AVX; |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
1129 } |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
1130 |
0 | 1131 /* |
1132 * Now we've figured out the masks that determine | |
1133 * which bits we choose to believe, apply the masks | |
1134 * to the feature words, then map the kernel's view | |
1135 * of these feature words into its feature word. | |
1136 */ | |
1137 cp->cp_edx &= mask_edx; | |
1138 cp->cp_ecx &= mask_ecx; | |
1139 | |
1140 /* | |
3446 | 1141 * apply any platform restrictions (we don't call this |
1142 * immediately after __cpuid_insn here, because we need the | |
1143 * workarounds applied above first) | |
0 | 1144 */ |
3446 | 1145 platform_cpuid_mangle(cpi->cpi_vendor, 1, cp); |
0 | 1146 |
3446 | 1147 /* |
1148 * fold in overrides from the "eeprom" mechanism | |
1149 */ | |
0 | 1150 cp->cp_edx |= cpuid_feature_edx_include; |
1151 cp->cp_edx &= ~cpuid_feature_edx_exclude; | |
1152 | |
1153 cp->cp_ecx |= cpuid_feature_ecx_include; | |
1154 cp->cp_ecx &= ~cpuid_feature_ecx_exclude; | |
1155 | |
12838
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
1156 if (cp->cp_edx & CPUID_INTC_EDX_PSE) { |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
1157 add_x86_feature(featureset, X86FSET_LARGEPAGE); |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
1158 } |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
1159 if (cp->cp_edx & CPUID_INTC_EDX_TSC) { |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
1160 add_x86_feature(featureset, X86FSET_TSC); |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
1161 } |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
1162 if (cp->cp_edx & CPUID_INTC_EDX_MSR) { |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
1163 add_x86_feature(featureset, X86FSET_MSR); |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
1164 } |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
1165 if (cp->cp_edx & CPUID_INTC_EDX_MTRR) { |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
1166 add_x86_feature(featureset, X86FSET_MTRR); |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
1167 } |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
1168 if (cp->cp_edx & CPUID_INTC_EDX_PGE) { |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
1169 add_x86_feature(featureset, X86FSET_PGE); |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
1170 } |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
1171 if (cp->cp_edx & CPUID_INTC_EDX_CMOV) { |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
1172 add_x86_feature(featureset, X86FSET_CMOV); |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
1173 } |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
1174 if (cp->cp_edx & CPUID_INTC_EDX_MMX) { |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
1175 add_x86_feature(featureset, X86FSET_MMX); |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
1176 } |
0 | 1177 if ((cp->cp_edx & CPUID_INTC_EDX_MCE) != 0 && |
12838
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
1178 (cp->cp_edx & CPUID_INTC_EDX_MCA) != 0) { |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
1179 add_x86_feature(featureset, X86FSET_MCA); |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
1180 } |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
1181 if (cp->cp_edx & CPUID_INTC_EDX_PAE) { |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
1182 add_x86_feature(featureset, X86FSET_PAE); |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
1183 } |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
1184 if (cp->cp_edx & CPUID_INTC_EDX_CX8) { |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
1185 add_x86_feature(featureset, X86FSET_CX8); |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
1186 } |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
1187 if (cp->cp_ecx & CPUID_INTC_ECX_CX16) { |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
1188 add_x86_feature(featureset, X86FSET_CX16); |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
1189 } |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
1190 if (cp->cp_edx & CPUID_INTC_EDX_PAT) { |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
1191 add_x86_feature(featureset, X86FSET_PAT); |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
1192 } |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
1193 if (cp->cp_edx & CPUID_INTC_EDX_SEP) { |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
1194 add_x86_feature(featureset, X86FSET_SEP); |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
1195 } |
0 | 1196 if (cp->cp_edx & CPUID_INTC_EDX_FXSR) { |
1197 /* | |
1198 * In our implementation, fxsave/fxrstor | |
1199 * are prerequisites before we'll even | |
1200 * try and do SSE things. | |
1201 */ | |
12838
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
1202 if (cp->cp_edx & CPUID_INTC_EDX_SSE) { |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
1203 add_x86_feature(featureset, X86FSET_SSE); |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
1204 } |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
1205 if (cp->cp_edx & CPUID_INTC_EDX_SSE2) { |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
1206 add_x86_feature(featureset, X86FSET_SSE2); |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
1207 } |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
1208 if (cp->cp_ecx & CPUID_INTC_ECX_SSE3) { |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
1209 add_x86_feature(featureset, X86FSET_SSE3); |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
1210 } |
5269
395a95dbfd17
6526262 cpuid ssse3 feature not noted on Intel Woodcrest/Conroe processors
kk208521
parents:
5254
diff
changeset
|
1211 if (cpi->cpi_vendor == X86_VENDOR_Intel) { |
12838
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
1212 if (cp->cp_ecx & CPUID_INTC_ECX_SSSE3) { |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
1213 add_x86_feature(featureset, X86FSET_SSSE3); |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
1214 } |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
1215 if (cp->cp_ecx & CPUID_INTC_ECX_SSE4_1) { |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
1216 add_x86_feature(featureset, X86FSET_SSE4_1); |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
1217 } |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
1218 if (cp->cp_ecx & CPUID_INTC_ECX_SSE4_2) { |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
1219 add_x86_feature(featureset, X86FSET_SSE4_2); |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
1220 } |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
1221 if (cp->cp_ecx & CPUID_INTC_ECX_AES) { |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
1222 add_x86_feature(featureset, X86FSET_AES); |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
1223 } |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
1224 if (cp->cp_ecx & CPUID_INTC_ECX_PCLMULQDQ) { |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
1225 add_x86_feature(featureset, X86FSET_PCLMULQDQ); |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
1226 } |
13146
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
1227 |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
1228 if (cp->cp_ecx & CPUID_INTC_ECX_XSAVE) { |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
1229 add_x86_feature(featureset, X86FSET_XSAVE); |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
1230 /* We only test AVX when there is XSAVE */ |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
1231 if (cp->cp_ecx & CPUID_INTC_ECX_AVX) { |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
1232 add_x86_feature(featureset, |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
1233 X86FSET_AVX); |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
1234 } |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
1235 } |
5269
395a95dbfd17
6526262 cpuid ssse3 feature not noted on Intel Woodcrest/Conroe processors
kk208521
parents:
5254
diff
changeset
|
1236 } |
0 | 1237 } |
12838
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
1238 if (cp->cp_edx & CPUID_INTC_EDX_DE) { |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
1239 add_x86_feature(featureset, X86FSET_DE); |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
1240 } |
7716
44c2ec1382be
6726459 dunnington based tucani system has huge memory latency, almost 5x of tigerton based tucani system
Bill Holler <Bill.Holler@Sun.COM>
parents:
7656
diff
changeset
|
1241 #if !defined(__xpv) |
4481
2bb321aaf3c3
6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents:
4265
diff
changeset
|
1242 if (cp->cp_ecx & CPUID_INTC_ECX_MON) { |
7716
44c2ec1382be
6726459 dunnington based tucani system has huge memory latency, almost 5x of tigerton based tucani system
Bill Holler <Bill.Holler@Sun.COM>
parents:
7656
diff
changeset
|
1243 |
44c2ec1382be
6726459 dunnington based tucani system has huge memory latency, almost 5x of tigerton based tucani system
Bill Holler <Bill.Holler@Sun.COM>
parents:
7656
diff
changeset
|
1244 /* |
44c2ec1382be
6726459 dunnington based tucani system has huge memory latency, almost 5x of tigerton based tucani system
Bill Holler <Bill.Holler@Sun.COM>
parents:
7656
diff
changeset
|
1245 * We require the CLFLUSH instruction for erratum workaround |
44c2ec1382be
6726459 dunnington based tucani system has huge memory latency, almost 5x of tigerton based tucani system
Bill Holler <Bill.Holler@Sun.COM>
parents:
7656
diff
changeset
|
1246 * to use MONITOR/MWAIT. |
44c2ec1382be
6726459 dunnington based tucani system has huge memory latency, almost 5x of tigerton based tucani system
Bill Holler <Bill.Holler@Sun.COM>
parents:
7656
diff
changeset
|
1247 */ |
44c2ec1382be
6726459 dunnington based tucani system has huge memory latency, almost 5x of tigerton based tucani system
Bill Holler <Bill.Holler@Sun.COM>
parents:
7656
diff
changeset
|
1248 if (cp->cp_edx & CPUID_INTC_EDX_CLFSH) { |
44c2ec1382be
6726459 dunnington based tucani system has huge memory latency, almost 5x of tigerton based tucani system
Bill Holler <Bill.Holler@Sun.COM>
parents:
7656
diff
changeset
|
1249 cpi->cpi_mwait.support |= MWAIT_SUPPORT; |
12838
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
1250 add_x86_feature(featureset, X86FSET_MWAIT); |
7716
44c2ec1382be
6726459 dunnington based tucani system has huge memory latency, almost 5x of tigerton based tucani system
Bill Holler <Bill.Holler@Sun.COM>
parents:
7656
diff
changeset
|
1251 } else { |
44c2ec1382be
6726459 dunnington based tucani system has huge memory latency, almost 5x of tigerton based tucani system
Bill Holler <Bill.Holler@Sun.COM>
parents:
7656
diff
changeset
|
1252 extern int idle_cpu_assert_cflush_monitor; |
44c2ec1382be
6726459 dunnington based tucani system has huge memory latency, almost 5x of tigerton based tucani system
Bill Holler <Bill.Holler@Sun.COM>
parents:
7656
diff
changeset
|
1253 |
44c2ec1382be
6726459 dunnington based tucani system has huge memory latency, almost 5x of tigerton based tucani system
Bill Holler <Bill.Holler@Sun.COM>
parents:
7656
diff
changeset
|
1254 /* |
44c2ec1382be
6726459 dunnington based tucani system has huge memory latency, almost 5x of tigerton based tucani system
Bill Holler <Bill.Holler@Sun.COM>
parents:
7656
diff
changeset
|
1255 * All processors we are aware of which have |
44c2ec1382be
6726459 dunnington based tucani system has huge memory latency, almost 5x of tigerton based tucani system
Bill Holler <Bill.Holler@Sun.COM>
parents:
7656
diff
changeset
|
1256 * MONITOR/MWAIT also have CLFLUSH. |
44c2ec1382be
6726459 dunnington based tucani system has huge memory latency, almost 5x of tigerton based tucani system
Bill Holler <Bill.Holler@Sun.COM>
parents:
7656
diff
changeset
|
1257 */ |
44c2ec1382be
6726459 dunnington based tucani system has huge memory latency, almost 5x of tigerton based tucani system
Bill Holler <Bill.Holler@Sun.COM>
parents:
7656
diff
changeset
|
1258 if (idle_cpu_assert_cflush_monitor) { |
44c2ec1382be
6726459 dunnington based tucani system has huge memory latency, almost 5x of tigerton based tucani system
Bill Holler <Bill.Holler@Sun.COM>
parents:
7656
diff
changeset
|
1259 ASSERT((cp->cp_ecx & CPUID_INTC_ECX_MON) && |
44c2ec1382be
6726459 dunnington based tucani system has huge memory latency, almost 5x of tigerton based tucani system
Bill Holler <Bill.Holler@Sun.COM>
parents:
7656
diff
changeset
|
1260 (cp->cp_edx & CPUID_INTC_EDX_CLFSH)); |
44c2ec1382be
6726459 dunnington based tucani system has huge memory latency, almost 5x of tigerton based tucani system
Bill Holler <Bill.Holler@Sun.COM>
parents:
7656
diff
changeset
|
1261 } |
44c2ec1382be
6726459 dunnington based tucani system has huge memory latency, almost 5x of tigerton based tucani system
Bill Holler <Bill.Holler@Sun.COM>
parents:
7656
diff
changeset
|
1262 } |
4481
2bb321aaf3c3
6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents:
4265
diff
changeset
|
1263 } |
7716
44c2ec1382be
6726459 dunnington based tucani system has huge memory latency, almost 5x of tigerton based tucani system
Bill Holler <Bill.Holler@Sun.COM>
parents:
7656
diff
changeset
|
1264 #endif /* __xpv */ |
0 | 1265 |
7589
7de800909a06
PSARC 2008/560 Intel IOMMU
Vikram Hegde <Vikram.Hegde@Sun.COM>
parents:
7532
diff
changeset
|
1266 /* |
7de800909a06
PSARC 2008/560 Intel IOMMU
Vikram Hegde <Vikram.Hegde@Sun.COM>
parents:
7532
diff
changeset
|
1267 * Only need it first time, rest of the cpus would follow suite. |
7de800909a06
PSARC 2008/560 Intel IOMMU
Vikram Hegde <Vikram.Hegde@Sun.COM>
parents:
7532
diff
changeset
|
1268 * we only capture this for the bootcpu. |
7de800909a06
PSARC 2008/560 Intel IOMMU
Vikram Hegde <Vikram.Hegde@Sun.COM>
parents:
7532
diff
changeset
|
1269 */ |
7de800909a06
PSARC 2008/560 Intel IOMMU
Vikram Hegde <Vikram.Hegde@Sun.COM>
parents:
7532
diff
changeset
|
1270 if (cp->cp_edx & CPUID_INTC_EDX_CLFSH) { |
12838
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
1271 add_x86_feature(featureset, X86FSET_CLFSH); |
7589
7de800909a06
PSARC 2008/560 Intel IOMMU
Vikram Hegde <Vikram.Hegde@Sun.COM>
parents:
7532
diff
changeset
|
1272 x86_clflush_size = (BITX(cp->cp_ebx, 15, 8) * 8); |
7de800909a06
PSARC 2008/560 Intel IOMMU
Vikram Hegde <Vikram.Hegde@Sun.COM>
parents:
7532
diff
changeset
|
1273 } |
12838
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
1274 if (is_x86_feature(featureset, X86FSET_PAE)) |
0 | 1275 cpi->cpi_pabits = 36; |
1276 | |
1277 /* | |
1278 * Hyperthreading configuration is slightly tricky on Intel | |
1279 * and pure clones, and even trickier on AMD. | |
1280 * | |
1281 * (AMD chose to set the HTT bit on their CMP processors, | |
1282 * even though they're not actually hyperthreaded. Thus it | |
1283 * takes a bit more work to figure out what's really going | |
3446 | 1284 * on ... see the handling of the CMP_LGCY bit below) |
0 | 1285 */ |
1286 if (cp->cp_edx & CPUID_INTC_EDX_HTT) { | |
1287 cpi->cpi_ncpu_per_chip = CPI_CPU_COUNT(cpi); | |
1288 if (cpi->cpi_ncpu_per_chip > 1) | |
12838
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
1289 add_x86_feature(featureset, X86FSET_HTT); |
1228 | 1290 } else { |
1291 cpi->cpi_ncpu_per_chip = 1; | |
0 | 1292 } |
1293 | |
1294 /* | |
1295 * Work on the "extended" feature information, doing | |
1296 * some basic initialization for cpuid_pass2() | |
1297 */ | |
1298 xcpuid = 0; | |
1299 switch (cpi->cpi_vendor) { | |
1300 case X86_VENDOR_Intel: | |
1975
7490b056500b
6183891 Missing brand ID strings for several common x86 CPUs
dmick
parents:
1727
diff
changeset
|
1301 if (IS_NEW_F6(cpi) || cpi->cpi_family >= 0xf) |
0 | 1302 xcpuid++; |
1303 break; | |
1304 case X86_VENDOR_AMD: | |
1305 if (cpi->cpi_family > 5 || | |
1306 (cpi->cpi_family == 5 && cpi->cpi_model >= 1)) | |
1307 xcpuid++; | |
1308 break; | |
1309 case X86_VENDOR_Cyrix: | |
1310 /* | |
1311 * Only these Cyrix CPUs are -known- to support | |
1312 * extended cpuid operations. | |
1313 */ | |
1314 if (x86_type == X86_TYPE_VIA_CYRIX_III || | |
1315 x86_type == X86_TYPE_CYRIX_GXm) | |
1316 xcpuid++; | |
1317 break; | |
1318 case X86_VENDOR_Centaur: | |
1319 case X86_VENDOR_TM: | |
1320 default: | |
1321 xcpuid++; | |
1322 break; | |
1323 } | |
1324 | |
1325 if (xcpuid) { | |
1326 cp = &cpi->cpi_extd[0]; | |
1228 | 1327 cp->cp_eax = 0x80000000; |
1328 cpi->cpi_xmaxeax = __cpuid_insn(cp); | |
0 | 1329 } |
1330 | |
1331 if (cpi->cpi_xmaxeax & 0x80000000) { | |
1332 | |
1333 if (cpi->cpi_xmaxeax > CPI_XMAXEAX_MAX) | |
1334 cpi->cpi_xmaxeax = CPI_XMAXEAX_MAX; | |
1335 | |
1336 switch (cpi->cpi_vendor) { | |
1337 case X86_VENDOR_Intel: | |
1338 case X86_VENDOR_AMD: | |
1339 if (cpi->cpi_xmaxeax < 0x80000001) | |
1340 break; | |
1341 cp = &cpi->cpi_extd[1]; | |
1228 | 1342 cp->cp_eax = 0x80000001; |
1343 (void) __cpuid_insn(cp); | |
3446 | 1344 |
0 | 1345 if (cpi->cpi_vendor == X86_VENDOR_AMD && |
1346 cpi->cpi_family == 5 && | |
1347 cpi->cpi_model == 6 && | |
1348 cpi->cpi_step == 6) { | |
1349 /* | |
1350 * K6 model 6 uses bit 10 to indicate SYSC | |
1351 * Later models use bit 11. Fix it here. | |
1352 */ | |
1353 if (cp->cp_edx & 0x400) { | |
1354 cp->cp_edx &= ~0x400; | |
1355 cp->cp_edx |= CPUID_AMD_EDX_SYSC; | |
1356 } | |
1357 } | |
1358 | |
3446 | 1359 platform_cpuid_mangle(cpi->cpi_vendor, 0x80000001, cp); |
1360 | |
0 | 1361 /* |
1362 * Compute the additions to the kernel's feature word. | |
1363 */ | |
12838
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
1364 if (cp->cp_edx & CPUID_AMD_EDX_NX) { |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
1365 add_x86_feature(featureset, X86FSET_NX); |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
1366 } |
0 | 1367 |
7656
2621e50fdf4a
PSARC 2008/382 Fast Reboot
Sherry Moore <Sherry.Moore@Sun.COM>
parents:
7589
diff
changeset
|
1368 /* |
2621e50fdf4a
PSARC 2008/382 Fast Reboot
Sherry Moore <Sherry.Moore@Sun.COM>
parents:
7589
diff
changeset
|
1369 * Regardless whether or not we boot 64-bit, |
2621e50fdf4a
PSARC 2008/382 Fast Reboot
Sherry Moore <Sherry.Moore@Sun.COM>
parents:
7589
diff
changeset
|
1370 * we should have a way to identify whether |
2621e50fdf4a
PSARC 2008/382 Fast Reboot
Sherry Moore <Sherry.Moore@Sun.COM>
parents:
7589
diff
changeset
|
1371 * the CPU is capable of running 64-bit. |
2621e50fdf4a
PSARC 2008/382 Fast Reboot
Sherry Moore <Sherry.Moore@Sun.COM>
parents:
7589
diff
changeset
|
1372 */ |
12838
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
1373 if (cp->cp_edx & CPUID_AMD_EDX_LM) { |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
1374 add_x86_feature(featureset, X86FSET_64); |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
1375 } |
7656
2621e50fdf4a
PSARC 2008/382 Fast Reboot
Sherry Moore <Sherry.Moore@Sun.COM>
parents:
7589
diff
changeset
|
1376 |
5349
01422ec04372
6453272 ctfmerge uses the largest pagesize from getpagesizes() which can be bad on systems with giant pages
kchow
parents:
5338
diff
changeset
|
1377 #if defined(__amd64) |
01422ec04372
6453272 ctfmerge uses the largest pagesize from getpagesizes() which can be bad on systems with giant pages
kchow
parents:
5338
diff
changeset
|
1378 /* 1 GB large page - enable only for 64 bit kernel */ |
12838
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
1379 if (cp->cp_edx & CPUID_AMD_EDX_1GPG) { |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
1380 add_x86_feature(featureset, X86FSET_1GPG); |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
1381 } |
5349
01422ec04372
6453272 ctfmerge uses the largest pagesize from getpagesizes() which can be bad on systems with giant pages
kchow
parents:
5338
diff
changeset
|
1382 #endif |
01422ec04372
6453272 ctfmerge uses the largest pagesize from getpagesizes() which can be bad on systems with giant pages
kchow
parents:
5338
diff
changeset
|
1383 |
4628
f90cf8fd4710
6525798 Need Hardware Capabilities support for AMD Family 10h/sse4a processor
kk208521
parents:
4606
diff
changeset
|
1384 if ((cpi->cpi_vendor == X86_VENDOR_AMD) && |
f90cf8fd4710
6525798 Need Hardware Capabilities support for AMD Family 10h/sse4a processor
kk208521
parents:
4606
diff
changeset
|
1385 (cpi->cpi_std[1].cp_edx & CPUID_INTC_EDX_FXSR) && |
12838
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
1386 (cp->cp_ecx & CPUID_AMD_ECX_SSE4A)) { |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
1387 add_x86_feature(featureset, X86FSET_SSE4A); |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
1388 } |
4628
f90cf8fd4710
6525798 Need Hardware Capabilities support for AMD Family 10h/sse4a processor
kk208521
parents:
4606
diff
changeset
|
1389 |
0 | 1390 /* |
3446 | 1391 * If both the HTT and CMP_LGCY bits are set, |
1228 | 1392 * then we're not actually HyperThreaded. Read |
1393 * "AMD CPUID Specification" for more details. | |
0 | 1394 */ |
1395 if (cpi->cpi_vendor == X86_VENDOR_AMD && | |
12838
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
1396 is_x86_feature(featureset, X86FSET_HTT) && |
3446 | 1397 (cp->cp_ecx & CPUID_AMD_ECX_CMP_LGCY)) { |
12838
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
1398 remove_x86_feature(featureset, X86FSET_HTT); |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
1399 add_x86_feature(featureset, X86FSET_CMP); |
1228 | 1400 } |
3446 | 1401 #if defined(__amd64) |
0 | 1402 /* |
1403 * It's really tricky to support syscall/sysret in | |
1404 * the i386 kernel; we rely on sysenter/sysexit | |
1405 * instead. In the amd64 kernel, things are -way- | |
1406 * better. | |
1407 */ | |
12838
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
1408 if (cp->cp_edx & CPUID_AMD_EDX_SYSC) { |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
1409 add_x86_feature(featureset, X86FSET_ASYSC); |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
1410 } |
0 | 1411 |
1412 /* | |
1413 * While we're thinking about system calls, note | |
1414 * that AMD processors don't support sysenter | |
1415 * in long mode at all, so don't try to program them. | |
1416 */ | |
12838
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
1417 if (x86_vendor == X86_VENDOR_AMD) { |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
1418 remove_x86_feature(featureset, X86FSET_SEP); |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
1419 } |
0 | 1420 #endif |
12838
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
1421 if (cp->cp_edx & CPUID_AMD_EDX_TSCP) { |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
1422 add_x86_feature(featureset, X86FSET_TSCP); |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
1423 } |
0 | 1424 break; |
1425 default: | |
1426 break; | |
1427 } | |
1428 | |
1228 | 1429 /* |
1430 * Get CPUID data about processor cores and hyperthreads. | |
1431 */ | |
0 | 1432 switch (cpi->cpi_vendor) { |
1433 case X86_VENDOR_Intel: | |
1228 | 1434 if (cpi->cpi_maxeax >= 4) { |
1435 cp = &cpi->cpi_std[4]; | |
1436 cp->cp_eax = 4; | |
1437 cp->cp_ecx = 0; | |
1438 (void) __cpuid_insn(cp); | |
3446 | 1439 platform_cpuid_mangle(cpi->cpi_vendor, 4, cp); |
1228 | 1440 } |
1441 /*FALLTHROUGH*/ | |
0 | 1442 case X86_VENDOR_AMD: |
1443 if (cpi->cpi_xmaxeax < 0x80000008) | |
1444 break; | |
1445 cp = &cpi->cpi_extd[8]; | |
1228 | 1446 cp->cp_eax = 0x80000008; |
1447 (void) __cpuid_insn(cp); | |
3446 | 1448 platform_cpuid_mangle(cpi->cpi_vendor, 0x80000008, cp); |
1449 | |
0 | 1450 /* |
1451 * Virtual and physical address limits from | |
1452 * cpuid override previously guessed values. | |
1453 */ | |
1454 cpi->cpi_pabits = BITX(cp->cp_eax, 7, 0); | |
1455 cpi->cpi_vabits = BITX(cp->cp_eax, 15, 8); | |
1456 break; | |
1457 default: | |
1458 break; | |
1459 } | |
1228 | 1460 |
4606 | 1461 /* |
1462 * Derive the number of cores per chip | |
1463 */ | |
1228 | 1464 switch (cpi->cpi_vendor) { |
1465 case X86_VENDOR_Intel: | |
1466 if (cpi->cpi_maxeax < 4) { | |
1467 cpi->cpi_ncore_per_chip = 1; | |
1468 break; | |
1469 } else { | |
1470 cpi->cpi_ncore_per_chip = | |
1471 BITX((cpi)->cpi_std[4].cp_eax, 31, 26) + 1; | |
1472 } | |
1473 break; | |
1474 case X86_VENDOR_AMD: | |
1475 if (cpi->cpi_xmaxeax < 0x80000008) { | |
1476 cpi->cpi_ncore_per_chip = 1; | |
1477 break; | |
1478 } else { | |
5870
2513339ac53a
6642169 cpu.generic panic during install of snv_76 and later builds
gavinm
parents:
5741
diff
changeset
|
1479 /* |
2513339ac53a
6642169 cpu.generic panic during install of snv_76 and later builds
gavinm
parents:
5741
diff
changeset
|
1480 * On family 0xf cpuid fn 2 ECX[7:0] "NC" is |
2513339ac53a
6642169 cpu.generic panic during install of snv_76 and later builds
gavinm
parents:
5741
diff
changeset
|
1481 * 1 less than the number of physical cores on |
2513339ac53a
6642169 cpu.generic panic during install of snv_76 and later builds
gavinm
parents:
5741
diff
changeset
|
1482 * the chip. In family 0x10 this value can |
2513339ac53a
6642169 cpu.generic panic during install of snv_76 and later builds
gavinm
parents:
5741
diff
changeset
|
1483 * be affected by "downcoring" - it reflects |
2513339ac53a
6642169 cpu.generic panic during install of snv_76 and later builds
gavinm
parents:
5741
diff
changeset
|
1484 * 1 less than the number of cores actually |
2513339ac53a
6642169 cpu.generic panic during install of snv_76 and later builds
gavinm
parents:
5741
diff
changeset
|
1485 * enabled on this node. |
2513339ac53a
6642169 cpu.generic panic during install of snv_76 and later builds
gavinm
parents:
5741
diff
changeset
|
1486 */ |
1228 | 1487 cpi->cpi_ncore_per_chip = |
1488 BITX((cpi)->cpi_extd[8].cp_ecx, 7, 0) + 1; | |
1489 } | |
1490 break; | |
1491 default: | |
1492 cpi->cpi_ncore_per_chip = 1; | |
1493 break; | |
1494 } | |
8906
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
8418
diff
changeset
|
1495 |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
8418
diff
changeset
|
1496 /* |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
8418
diff
changeset
|
1497 * Get CPUID data about TSC Invariance in Deep C-State. |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
8418
diff
changeset
|
1498 */ |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
8418
diff
changeset
|
1499 switch (cpi->cpi_vendor) { |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
8418
diff
changeset
|
1500 case X86_VENDOR_Intel: |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
8418
diff
changeset
|
1501 if (cpi->cpi_maxeax >= 7) { |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
8418
diff
changeset
|
1502 cp = &cpi->cpi_extd[7]; |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
8418
diff
changeset
|
1503 cp->cp_eax = 0x80000007; |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
8418
diff
changeset
|
1504 cp->cp_ecx = 0; |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
8418
diff
changeset
|
1505 (void) __cpuid_insn(cp); |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
8418
diff
changeset
|
1506 } |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
8418
diff
changeset
|
1507 break; |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
8418
diff
changeset
|
1508 default: |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
8418
diff
changeset
|
1509 break; |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
8418
diff
changeset
|
1510 } |
5284 | 1511 } else { |
1512 cpi->cpi_ncore_per_chip = 1; | |
0 | 1513 } |
1514 | |
1228 | 1515 /* |
1516 * If more than one core, then this processor is CMP. | |
1517 */ | |
12838
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
1518 if (cpi->cpi_ncore_per_chip > 1) { |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
1519 add_x86_feature(featureset, X86FSET_CMP); |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
1520 } |
3446 | 1521 |
1228 | 1522 /* |
1523 * If the number of cores is the same as the number | |
1524 * of CPUs, then we cannot have HyperThreading. | |
1525 */ | |
12838
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
1526 if (cpi->cpi_ncpu_per_chip == cpi->cpi_ncore_per_chip) { |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
1527 remove_x86_feature(featureset, X86FSET_HTT); |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
1528 } |
1228 | 1529 |
10947
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
1530 cpi->cpi_apicid = CPI_APIC_ID(cpi); |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
1531 cpi->cpi_procnodes_per_pkg = 1; |
12838
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
1532 if (is_x86_feature(featureset, X86FSET_HTT) == B_FALSE && |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
1533 is_x86_feature(featureset, X86FSET_CMP) == B_FALSE) { |
1228 | 1534 /* |
1535 * Single-core single-threaded processors. | |
1536 */ | |
0 | 1537 cpi->cpi_chipid = -1; |
1538 cpi->cpi_clogid = 0; | |
1228 | 1539 cpi->cpi_coreid = cpu->cpu_id; |
5870
2513339ac53a
6642169 cpu.generic panic during install of snv_76 and later builds
gavinm
parents:
5741
diff
changeset
|
1540 cpi->cpi_pkgcoreid = 0; |
10947
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
1541 if (cpi->cpi_vendor == X86_VENDOR_AMD) |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
1542 cpi->cpi_procnodeid = BITX(cpi->cpi_apicid, 3, 0); |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
1543 else |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
1544 cpi->cpi_procnodeid = cpi->cpi_chipid; |
0 | 1545 } else if (cpi->cpi_ncpu_per_chip > 1) { |
10947
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
1546 if (cpi->cpi_vendor == X86_VENDOR_Intel) |
12838
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
1547 cpuid_intel_getids(cpu, featureset); |
10947
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
1548 else if (cpi->cpi_vendor == X86_VENDOR_AMD) |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
1549 cpuid_amd_getids(cpu); |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
1550 else { |
1228 | 1551 /* |
1552 * All other processors are currently | |
1553 * assumed to have single cores. | |
1554 */ | |
1555 cpi->cpi_coreid = cpi->cpi_chipid; | |
5870
2513339ac53a
6642169 cpu.generic panic during install of snv_76 and later builds
gavinm
parents:
5741
diff
changeset
|
1556 cpi->cpi_pkgcoreid = 0; |
10947
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
1557 cpi->cpi_procnodeid = cpi->cpi_chipid; |
1228 | 1558 } |
0 | 1559 } |
1560 | |
2869
324151eecd58
PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents:
2584
diff
changeset
|
1561 /* |
324151eecd58
PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents:
2584
diff
changeset
|
1562 * Synthesize chip "revision" and socket type |
324151eecd58
PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents:
2584
diff
changeset
|
1563 */ |
7532
bb6372f778bb
PSARC 2008/569 FMA Topology & Retire Agent Refinements
Cheng Sean Ye <Sean.Ye@Sun.COM>
parents:
7282
diff
changeset
|
1564 cpi->cpi_chiprev = _cpuid_chiprev(cpi->cpi_vendor, cpi->cpi_family, |
bb6372f778bb
PSARC 2008/569 FMA Topology & Retire Agent Refinements
Cheng Sean Ye <Sean.Ye@Sun.COM>
parents:
7282
diff
changeset
|
1565 cpi->cpi_model, cpi->cpi_step); |
bb6372f778bb
PSARC 2008/569 FMA Topology & Retire Agent Refinements
Cheng Sean Ye <Sean.Ye@Sun.COM>
parents:
7282
diff
changeset
|
1566 cpi->cpi_chiprevstr = _cpuid_chiprevstr(cpi->cpi_vendor, |
bb6372f778bb
PSARC 2008/569 FMA Topology & Retire Agent Refinements
Cheng Sean Ye <Sean.Ye@Sun.COM>
parents:
7282
diff
changeset
|
1567 cpi->cpi_family, cpi->cpi_model, cpi->cpi_step); |
bb6372f778bb
PSARC 2008/569 FMA Topology & Retire Agent Refinements
Cheng Sean Ye <Sean.Ye@Sun.COM>
parents:
7282
diff
changeset
|
1568 cpi->cpi_socket = _cpuid_skt(cpi->cpi_vendor, cpi->cpi_family, |
bb6372f778bb
PSARC 2008/569 FMA Topology & Retire Agent Refinements
Cheng Sean Ye <Sean.Ye@Sun.COM>
parents:
7282
diff
changeset
|
1569 cpi->cpi_model, cpi->cpi_step); |
2869
324151eecd58
PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents:
2584
diff
changeset
|
1570 |
0 | 1571 pass1_done: |
1572 cpi->cpi_pass = 1; | |
1573 } | |
1574 | |
1575 /* | |
1576 * Make copies of the cpuid table entries we depend on, in | |
1577 * part for ease of parsing now, in part so that we have only | |
1578 * one place to correct any of it, in part for ease of | |
1579 * later export to userland, and in part so we can look at | |
1580 * this stuff in a crash dump. | |
1581 */ | |
1582 | |
1583 /*ARGSUSED*/ | |
1584 void | |
1585 cpuid_pass2(cpu_t *cpu) | |
1586 { | |
1587 uint_t n, nmax; | |
1588 int i; | |
1228 | 1589 struct cpuid_regs *cp; |
0 | 1590 uint8_t *dp; |
1591 uint32_t *iptr; | |
1592 struct cpuid_info *cpi = cpu->cpu_m.mcpu_cpi; | |
1593 | |
1594 ASSERT(cpi->cpi_pass == 1); | |
1595 | |
1596 if (cpi->cpi_maxeax < 1) | |
1597 goto pass2_done; | |
1598 | |
1599 if ((nmax = cpi->cpi_maxeax + 1) > NMAX_CPI_STD) | |
1600 nmax = NMAX_CPI_STD; | |
1601 /* | |
1602 * (We already handled n == 0 and n == 1 in pass 1) | |
1603 */ | |
1604 for (n = 2, cp = &cpi->cpi_std[2]; n < nmax; n++, cp++) { | |
1228 | 1605 cp->cp_eax = n; |
4606 | 1606 |
1607 /* | |
1608 * CPUID function 4 expects %ecx to be initialized | |
1609 * with an index which indicates which cache to return | |
1610 * information about. The OS is expected to call function 4 | |
1611 * with %ecx set to 0, 1, 2, ... until it returns with | |
1612 * EAX[4:0] set to 0, which indicates there are no more | |
1613 * caches. | |
1614 * | |
1615 * Here, populate cpi_std[4] with the information returned by | |
1616 * function 4 when %ecx == 0, and do the rest in cpuid_pass3() | |
1617 * when dynamic memory allocation becomes available. | |
1618 * | |
1619 * Note: we need to explicitly initialize %ecx here, since | |
1620 * function 4 may have been previously invoked. | |
1621 */ | |
1622 if (n == 4) | |
1623 cp->cp_ecx = 0; | |
1624 | |
1228 | 1625 (void) __cpuid_insn(cp); |
3446 | 1626 platform_cpuid_mangle(cpi->cpi_vendor, n, cp); |
0 | 1627 switch (n) { |
1628 case 2: | |
1629 /* | |
1630 * "the lower 8 bits of the %eax register | |
1631 * contain a value that identifies the number | |
1632 * of times the cpuid [instruction] has to be | |
1633 * executed to obtain a complete image of the | |
1634 * processor's caching systems." | |
1635 * | |
1636 * How *do* they make this stuff up? | |
1637 */ | |
1638 cpi->cpi_ncache = sizeof (*cp) * | |
1639 BITX(cp->cp_eax, 7, 0); | |
1640 if (cpi->cpi_ncache == 0) | |
1641 break; | |
1642 cpi->cpi_ncache--; /* skip count byte */ | |
1643 | |
1644 /* | |
1645 * Well, for now, rather than attempt to implement | |
1646 * this slightly dubious algorithm, we just look | |
1647 * at the first 15 .. | |
1648 */ | |
1649 if (cpi->cpi_ncache > (sizeof (*cp) - 1)) | |
1650 cpi->cpi_ncache = sizeof (*cp) - 1; | |
1651 | |
1652 dp = cpi->cpi_cacheinfo; | |
1653 if (BITX(cp->cp_eax, 31, 31) == 0) { | |
1654 uint8_t *p = (void *)&cp->cp_eax; | |
6317
8afb524fc268
6667600 Incomplete initialization of cpi_cacheinfo field of struct cpuid_info
kk208521
parents:
5870
diff
changeset
|
1655 for (i = 1; i < 4; i++) |
0 | 1656 if (p[i] != 0) |
1657 *dp++ = p[i]; | |
1658 } | |
1659 if (BITX(cp->cp_ebx, 31, 31) == 0) { | |
1660 uint8_t *p = (void *)&cp->cp_ebx; | |
1661 for (i = 0; i < 4; i++) | |
1662 if (p[i] != 0) | |
1663 *dp++ = p[i]; | |
1664 } | |
1665 if (BITX(cp->cp_ecx, 31, 31) == 0) { | |
1666 uint8_t *p = (void *)&cp->cp_ecx; | |
1667 for (i = 0; i < 4; i++) | |
1668 if (p[i] != 0) | |
1669 *dp++ = p[i]; | |
1670 } | |
1671 if (BITX(cp->cp_edx, 31, 31) == 0) { | |
1672 uint8_t *p = (void *)&cp->cp_edx; | |
1673 for (i = 0; i < 4; i++) | |
1674 if (p[i] != 0) | |
1675 *dp++ = p[i]; | |
1676 } | |
1677 break; | |
4481
2bb321aaf3c3
6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents:
4265
diff
changeset
|
1678 |
0 | 1679 case 3: /* Processor serial number, if PSN supported */ |
4481
2bb321aaf3c3
6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents:
4265
diff
changeset
|
1680 break; |
2bb321aaf3c3
6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents:
4265
diff
changeset
|
1681 |
0 | 1682 case 4: /* Deterministic cache parameters */ |
4481
2bb321aaf3c3
6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents:
4265
diff
changeset
|
1683 break; |
2bb321aaf3c3
6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents:
4265
diff
changeset
|
1684 |
0 | 1685 case 5: /* Monitor/Mwait parameters */ |
5045
75a798a98460
6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents:
4858
diff
changeset
|
1686 { |
75a798a98460
6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents:
4858
diff
changeset
|
1687 size_t mwait_size; |
4481
2bb321aaf3c3
6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents:
4265
diff
changeset
|
1688 |
2bb321aaf3c3
6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents:
4265
diff
changeset
|
1689 /* |
2bb321aaf3c3
6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents:
4265
diff
changeset
|
1690 * check cpi_mwait.support which was set in cpuid_pass1 |
2bb321aaf3c3
6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents:
4265
diff
changeset
|
1691 */ |
2bb321aaf3c3
6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents:
4265
diff
changeset
|
1692 if (!(cpi->cpi_mwait.support & MWAIT_SUPPORT)) |
2bb321aaf3c3
6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents:
4265
diff
changeset
|
1693 break; |
2bb321aaf3c3
6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents:
4265
diff
changeset
|
1694 |
5045
75a798a98460
6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents:
4858
diff
changeset
|
1695 /* |
75a798a98460
6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents:
4858
diff
changeset
|
1696 * Protect ourself from insane mwait line size. |
75a798a98460
6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents:
4858
diff
changeset
|
1697 * Workaround for incomplete hardware emulator(s). |
75a798a98460
6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents:
4858
diff
changeset
|
1698 */ |
75a798a98460
6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents:
4858
diff
changeset
|
1699 mwait_size = (size_t)MWAIT_SIZE_MAX(cpi); |
75a798a98460
6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents:
4858
diff
changeset
|
1700 if (mwait_size < sizeof (uint32_t) || |
75a798a98460
6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents:
4858
diff
changeset
|
1701 !ISP2(mwait_size)) { |
75a798a98460
6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents:
4858
diff
changeset
|
1702 #if DEBUG |
75a798a98460
6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents:
4858
diff
changeset
|
1703 cmn_err(CE_NOTE, "Cannot handle cpu %d mwait " |
7798
2a682532f0ca
6749646 cpuid_pass2 stomps on cpi_xmaxeax
Saurabh Misra <Saurabh.Mishra@Sun.COM>
parents:
7716
diff
changeset
|
1704 "size %ld", cpu->cpu_id, (long)mwait_size); |
5045
75a798a98460
6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents:
4858
diff
changeset
|
1705 #endif |
75a798a98460
6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents:
4858
diff
changeset
|
1706 break; |
75a798a98460
6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents:
4858
diff
changeset
|
1707 } |
75a798a98460
6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents:
4858
diff
changeset
|
1708 |
4481
2bb321aaf3c3
6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents:
4265
diff
changeset
|
1709 cpi->cpi_mwait.mon_min = (size_t)MWAIT_SIZE_MIN(cpi); |
5045
75a798a98460
6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents:
4858
diff
changeset
|
1710 cpi->cpi_mwait.mon_max = mwait_size; |
4481
2bb321aaf3c3
6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents:
4265
diff
changeset
|
1711 if (MWAIT_EXTENSION(cpi)) { |
2bb321aaf3c3
6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents:
4265
diff
changeset
|
1712 cpi->cpi_mwait.support |= MWAIT_EXTENSIONS; |
2bb321aaf3c3
6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents:
4265
diff
changeset
|
1713 if (MWAIT_INT_ENABLE(cpi)) |
2bb321aaf3c3
6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents:
4265
diff
changeset
|
1714 cpi->cpi_mwait.support |= |
2bb321aaf3c3
6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents:
4265
diff
changeset
|
1715 MWAIT_ECX_INT_ENABLE; |
2bb321aaf3c3
6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents:
4265
diff
changeset
|
1716 } |
2bb321aaf3c3
6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents:
4265
diff
changeset
|
1717 break; |
5045
75a798a98460
6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents:
4858
diff
changeset
|
1718 } |
0 | 1719 default: |
1720 break; | |
1721 } | |
1722 } | |
1723 | |
7282
5b3b6674ac91
6528768 apic_navail_vector() fails when IPL equals 8 or 9
mishra
parents:
6964
diff
changeset
|
1724 if (cpi->cpi_maxeax >= 0xB && cpi->cpi_vendor == X86_VENDOR_Intel) { |
7798
2a682532f0ca
6749646 cpuid_pass2 stomps on cpi_xmaxeax
Saurabh Misra <Saurabh.Mishra@Sun.COM>
parents:
7716
diff
changeset
|
1725 struct cpuid_regs regs; |
2a682532f0ca
6749646 cpuid_pass2 stomps on cpi_xmaxeax
Saurabh Misra <Saurabh.Mishra@Sun.COM>
parents:
7716
diff
changeset
|
1726 |
2a682532f0ca
6749646 cpuid_pass2 stomps on cpi_xmaxeax
Saurabh Misra <Saurabh.Mishra@Sun.COM>
parents:
7716
diff
changeset
|
1727 cp = ®s; |
7282
5b3b6674ac91
6528768 apic_navail_vector() fails when IPL equals 8 or 9
mishra
parents:
6964
diff
changeset
|
1728 cp->cp_eax = 0xB; |
7798
2a682532f0ca
6749646 cpuid_pass2 stomps on cpi_xmaxeax
Saurabh Misra <Saurabh.Mishra@Sun.COM>
parents:
7716
diff
changeset
|
1729 cp->cp_edx = cp->cp_ebx = cp->cp_ecx = 0; |
7282
5b3b6674ac91
6528768 apic_navail_vector() fails when IPL equals 8 or 9
mishra
parents:
6964
diff
changeset
|
1730 |
5b3b6674ac91
6528768 apic_navail_vector() fails when IPL equals 8 or 9
mishra
parents:
6964
diff
changeset
|
1731 (void) __cpuid_insn(cp); |
5b3b6674ac91
6528768 apic_navail_vector() fails when IPL equals 8 or 9
mishra
parents:
6964
diff
changeset
|
1732 |
5b3b6674ac91
6528768 apic_navail_vector() fails when IPL equals 8 or 9
mishra
parents:
6964
diff
changeset
|
1733 /* |
5b3b6674ac91
6528768 apic_navail_vector() fails when IPL equals 8 or 9
mishra
parents:
6964
diff
changeset
|
1734 * Check CPUID.EAX=0BH, ECX=0H:EBX is non-zero, which |
5b3b6674ac91
6528768 apic_navail_vector() fails when IPL equals 8 or 9
mishra
parents:
6964
diff
changeset
|
1735 * indicates that the extended topology enumeration leaf is |
5b3b6674ac91
6528768 apic_navail_vector() fails when IPL equals 8 or 9
mishra
parents:
6964
diff
changeset
|
1736 * available. |
5b3b6674ac91
6528768 apic_navail_vector() fails when IPL equals 8 or 9
mishra
parents:
6964
diff
changeset
|
1737 */ |
5b3b6674ac91
6528768 apic_navail_vector() fails when IPL equals 8 or 9
mishra
parents:
6964
diff
changeset
|
1738 if (cp->cp_ebx) { |
5b3b6674ac91
6528768 apic_navail_vector() fails when IPL equals 8 or 9
mishra
parents:
6964
diff
changeset
|
1739 uint32_t x2apic_id; |
5b3b6674ac91
6528768 apic_navail_vector() fails when IPL equals 8 or 9
mishra
parents:
6964
diff
changeset
|
1740 uint_t coreid_shift = 0; |
5b3b6674ac91
6528768 apic_navail_vector() fails when IPL equals 8 or 9
mishra
parents:
6964
diff
changeset
|
1741 uint_t ncpu_per_core = 1; |
5b3b6674ac91
6528768 apic_navail_vector() fails when IPL equals 8 or 9
mishra
parents:
6964
diff
changeset
|
1742 uint_t chipid_shift = 0; |
5b3b6674ac91
6528768 apic_navail_vector() fails when IPL equals 8 or 9
mishra
parents:
6964
diff
changeset
|
1743 uint_t ncpu_per_chip = 1; |
5b3b6674ac91
6528768 apic_navail_vector() fails when IPL equals 8 or 9
mishra
parents:
6964
diff
changeset
|
1744 uint_t i; |
5b3b6674ac91
6528768 apic_navail_vector() fails when IPL equals 8 or 9
mishra
parents:
6964
diff
changeset
|
1745 uint_t level; |
5b3b6674ac91
6528768 apic_navail_vector() fails when IPL equals 8 or 9
mishra
parents:
6964
diff
changeset
|
1746 |
5b3b6674ac91
6528768 apic_navail_vector() fails when IPL equals 8 or 9
mishra
parents:
6964
diff
changeset
|
1747 for (i = 0; i < CPI_FNB_ECX_MAX; i++) { |
5b3b6674ac91
6528768 apic_navail_vector() fails when IPL equals 8 or 9
mishra
parents:
6964
diff
changeset
|
1748 cp->cp_eax = 0xB; |
5b3b6674ac91
6528768 apic_navail_vector() fails when IPL equals 8 or 9
mishra
parents:
6964
diff
changeset
|
1749 cp->cp_ecx = i; |
5b3b6674ac91
6528768 apic_navail_vector() fails when IPL equals 8 or 9
mishra
parents:
6964
diff
changeset
|
1750 |
5b3b6674ac91
6528768 apic_navail_vector() fails when IPL equals 8 or 9
mishra
parents:
6964
diff
changeset
|
1751 (void) __cpuid_insn(cp); |
5b3b6674ac91
6528768 apic_navail_vector() fails when IPL equals 8 or 9
mishra
parents:
6964
diff
changeset
|
1752 level = CPI_CPU_LEVEL_TYPE(cp); |
5b3b6674ac91
6528768 apic_navail_vector() fails when IPL equals 8 or 9
mishra
parents:
6964
diff
changeset
|
1753 |
5b3b6674ac91
6528768 apic_navail_vector() fails when IPL equals 8 or 9
mishra
parents:
6964
diff
changeset
|
1754 if (level == 1) { |
5b3b6674ac91
6528768 apic_navail_vector() fails when IPL equals 8 or 9
mishra
parents:
6964
diff
changeset
|
1755 x2apic_id = cp->cp_edx; |
5b3b6674ac91
6528768 apic_navail_vector() fails when IPL equals 8 or 9
mishra
parents:
6964
diff
changeset
|
1756 coreid_shift = BITX(cp->cp_eax, 4, 0); |
5b3b6674ac91
6528768 apic_navail_vector() fails when IPL equals 8 or 9
mishra
parents:
6964
diff
changeset
|
1757 ncpu_per_core = BITX(cp->cp_ebx, 15, 0); |
5b3b6674ac91
6528768 apic_navail_vector() fails when IPL equals 8 or 9
mishra
parents:
6964
diff
changeset
|
1758 } else if (level == 2) { |
5b3b6674ac91
6528768 apic_navail_vector() fails when IPL equals 8 or 9
mishra
parents:
6964
diff
changeset
|
1759 x2apic_id = cp->cp_edx; |
5b3b6674ac91
6528768 apic_navail_vector() fails when IPL equals 8 or 9
mishra
parents:
6964
diff
changeset
|
1760 chipid_shift = BITX(cp->cp_eax, 4, 0); |
5b3b6674ac91
6528768 apic_navail_vector() fails when IPL equals 8 or 9
mishra
parents:
6964
diff
changeset
|
1761 ncpu_per_chip = BITX(cp->cp_ebx, 15, 0); |
5b3b6674ac91
6528768 apic_navail_vector() fails when IPL equals 8 or 9
mishra
parents:
6964
diff
changeset
|
1762 } |
5b3b6674ac91
6528768 apic_navail_vector() fails when IPL equals 8 or 9
mishra
parents:
6964
diff
changeset
|
1763 } |
5b3b6674ac91
6528768 apic_navail_vector() fails when IPL equals 8 or 9
mishra
parents:
6964
diff
changeset
|
1764 |
5b3b6674ac91
6528768 apic_navail_vector() fails when IPL equals 8 or 9
mishra
parents:
6964
diff
changeset
|
1765 cpi->cpi_apicid = x2apic_id; |
5b3b6674ac91
6528768 apic_navail_vector() fails when IPL equals 8 or 9
mishra
parents:
6964
diff
changeset
|
1766 cpi->cpi_ncpu_per_chip = ncpu_per_chip; |
5b3b6674ac91
6528768 apic_navail_vector() fails when IPL equals 8 or 9
mishra
parents:
6964
diff
changeset
|
1767 cpi->cpi_ncore_per_chip = ncpu_per_chip / |
5b3b6674ac91
6528768 apic_navail_vector() fails when IPL equals 8 or 9
mishra
parents:
6964
diff
changeset
|
1768 ncpu_per_core; |
5b3b6674ac91
6528768 apic_navail_vector() fails when IPL equals 8 or 9
mishra
parents:
6964
diff
changeset
|
1769 cpi->cpi_chipid = x2apic_id >> chipid_shift; |
5b3b6674ac91
6528768 apic_navail_vector() fails when IPL equals 8 or 9
mishra
parents:
6964
diff
changeset
|
1770 cpi->cpi_clogid = x2apic_id & ((1 << chipid_shift) - 1); |
5b3b6674ac91
6528768 apic_navail_vector() fails when IPL equals 8 or 9
mishra
parents:
6964
diff
changeset
|
1771 cpi->cpi_coreid = x2apic_id >> coreid_shift; |
5b3b6674ac91
6528768 apic_navail_vector() fails when IPL equals 8 or 9
mishra
parents:
6964
diff
changeset
|
1772 cpi->cpi_pkgcoreid = cpi->cpi_clogid >> coreid_shift; |
5b3b6674ac91
6528768 apic_navail_vector() fails when IPL equals 8 or 9
mishra
parents:
6964
diff
changeset
|
1773 } |
7798
2a682532f0ca
6749646 cpuid_pass2 stomps on cpi_xmaxeax
Saurabh Misra <Saurabh.Mishra@Sun.COM>
parents:
7716
diff
changeset
|
1774 |
2a682532f0ca
6749646 cpuid_pass2 stomps on cpi_xmaxeax
Saurabh Misra <Saurabh.Mishra@Sun.COM>
parents:
7716
diff
changeset
|
1775 /* Make cp NULL so that we don't stumble on others */ |
2a682532f0ca
6749646 cpuid_pass2 stomps on cpi_xmaxeax
Saurabh Misra <Saurabh.Mishra@Sun.COM>
parents:
7716
diff
changeset
|
1776 cp = NULL; |
7282
5b3b6674ac91
6528768 apic_navail_vector() fails when IPL equals 8 or 9
mishra
parents:
6964
diff
changeset
|
1777 } |
5b3b6674ac91
6528768 apic_navail_vector() fails when IPL equals 8 or 9
mishra
parents:
6964
diff
changeset
|
1778 |
13146
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
1779 /* |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
1780 * XSAVE enumeration |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
1781 */ |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
1782 if (cpi->cpi_maxeax >= 0xD && cpi->cpi_vendor == X86_VENDOR_Intel) { |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
1783 struct cpuid_regs regs; |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
1784 boolean_t cpuid_d_valid = B_TRUE; |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
1785 |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
1786 cp = ®s; |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
1787 cp->cp_eax = 0xD; |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
1788 cp->cp_edx = cp->cp_ebx = cp->cp_ecx = 0; |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
1789 |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
1790 (void) __cpuid_insn(cp); |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
1791 |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
1792 /* |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
1793 * Sanity checks for debug |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
1794 */ |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
1795 if ((cp->cp_eax & XFEATURE_LEGACY_FP) == 0 || |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
1796 (cp->cp_eax & XFEATURE_SSE) == 0) { |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
1797 cpuid_d_valid = B_FALSE; |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
1798 } |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
1799 |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
1800 cpi->cpi_xsave.xsav_hw_features_low = cp->cp_eax; |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
1801 cpi->cpi_xsave.xsav_hw_features_high = cp->cp_edx; |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
1802 cpi->cpi_xsave.xsav_max_size = cp->cp_ecx; |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
1803 |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
1804 /* |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
1805 * If the hw supports AVX, get the size and offset in the save |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
1806 * area for the ymm state. |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
1807 */ |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
1808 if (cpi->cpi_xsave.xsav_hw_features_low & XFEATURE_AVX) { |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
1809 cp->cp_eax = 0xD; |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
1810 cp->cp_ecx = 2; |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
1811 cp->cp_edx = cp->cp_ebx = 0; |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
1812 |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
1813 (void) __cpuid_insn(cp); |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
1814 |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
1815 if (cp->cp_ebx != CPUID_LEAFD_2_YMM_OFFSET || |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
1816 cp->cp_eax != CPUID_LEAFD_2_YMM_SIZE) { |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
1817 cpuid_d_valid = B_FALSE; |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
1818 } |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
1819 |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
1820 cpi->cpi_xsave.ymm_size = cp->cp_eax; |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
1821 cpi->cpi_xsave.ymm_offset = cp->cp_ebx; |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
1822 } |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
1823 |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
1824 if (is_x86_feature(x86_featureset, X86FSET_XSAVE)) { |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
1825 xsave_state_size = 0; |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
1826 } else if (cpuid_d_valid) { |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
1827 xsave_state_size = cpi->cpi_xsave.xsav_max_size; |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
1828 } else { |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
1829 /* Broken CPUID 0xD, probably in HVM */ |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
1830 cmn_err(CE_WARN, "cpu%d: CPUID.0xD returns invalid " |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
1831 "value: hw_low = %d, hw_high = %d, xsave_size = %d" |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
1832 ", ymm_size = %d, ymm_offset = %d\n", |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
1833 cpu->cpu_id, cpi->cpi_xsave.xsav_hw_features_low, |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
1834 cpi->cpi_xsave.xsav_hw_features_high, |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
1835 (int)cpi->cpi_xsave.xsav_max_size, |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
1836 (int)cpi->cpi_xsave.ymm_size, |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
1837 (int)cpi->cpi_xsave.ymm_offset); |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
1838 |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
1839 if (xsave_state_size != 0) { |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
1840 /* |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
1841 * This must be a non-boot CPU. We cannot |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
1842 * continue, because boot cpu has already |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
1843 * enabled XSAVE. |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
1844 */ |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
1845 ASSERT(cpu->cpu_id != 0); |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
1846 cmn_err(CE_PANIC, "cpu%d: we have already " |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
1847 "enabled XSAVE on boot cpu, cannot " |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
1848 "continue.", cpu->cpu_id); |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
1849 } else { |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
1850 /* |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
1851 * Must be from boot CPU, OK to disable XSAVE. |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
1852 */ |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
1853 ASSERT(cpu->cpu_id == 0); |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
1854 remove_x86_feature(x86_featureset, |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
1855 X86FSET_XSAVE); |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
1856 remove_x86_feature(x86_featureset, X86FSET_AVX); |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
1857 CPI_FEATURES_ECX(cpi) &= ~CPUID_INTC_ECX_XSAVE; |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
1858 CPI_FEATURES_ECX(cpi) &= ~CPUID_INTC_ECX_AVX; |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
1859 xsave_force_disable = B_TRUE; |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
1860 } |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
1861 } |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
1862 } |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
1863 |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
1864 |
0 | 1865 if ((cpi->cpi_xmaxeax & 0x80000000) == 0) |
1866 goto pass2_done; | |
1867 | |
1868 if ((nmax = cpi->cpi_xmaxeax - 0x80000000 + 1) > NMAX_CPI_EXTD) | |
1869 nmax = NMAX_CPI_EXTD; | |
1870 /* | |
1871 * Copy the extended properties, fixing them as we go. | |
1872 * (We already handled n == 0 and n == 1 in pass 1) | |
1873 */ | |
1874 iptr = (void *)cpi->cpi_brandstr; | |
1875 for (n = 2, cp = &cpi->cpi_extd[2]; n < nmax; cp++, n++) { | |
1228 | 1876 cp->cp_eax = 0x80000000 + n; |
1877 (void) __cpuid_insn(cp); | |
3446 | 1878 platform_cpuid_mangle(cpi->cpi_vendor, 0x80000000 + n, cp); |
0 | 1879 switch (n) { |
1880 case 2: | |
1881 case 3: | |
1882 case 4: | |
1883 /* | |
1884 * Extract the brand string | |
1885 */ | |
1886 *iptr++ = cp->cp_eax; | |
1887 *iptr++ = cp->cp_ebx; | |
1888 *iptr++ = cp->cp_ecx; | |
1889 *iptr++ = cp->cp_edx; | |
1890 break; | |
1891 case 5: | |
1892 switch (cpi->cpi_vendor) { | |
1893 case X86_VENDOR_AMD: | |
1894 /* | |
1895 * The Athlon and Duron were the first | |
1896 * parts to report the sizes of the | |
1897 * TLB for large pages. Before then, | |
1898 * we don't trust the data. | |
1899 */ | |
1900 if (cpi->cpi_family < 6 || | |
1901 (cpi->cpi_family == 6 && | |
1902 cpi->cpi_model < 1)) | |
1903 cp->cp_eax = 0; | |
1904 break; | |
1905 default: | |
1906 break; | |
1907 } | |
1908 break; | |
1909 case 6: | |
1910 switch (cpi->cpi_vendor) { | |
1911 case X86_VENDOR_AMD: | |
1912 /* | |
1913 * The Athlon and Duron were the first | |
1914 * AMD parts with L2 TLB's. | |
1915 * Before then, don't trust the data. | |
1916 */ | |
1917 if (cpi->cpi_family < 6 || | |
1918 cpi->cpi_family == 6 && | |
1919 cpi->cpi_model < 1) | |
1920 cp->cp_eax = cp->cp_ebx = 0; | |
1921 /* | |
1922 * AMD Duron rev A0 reports L2 | |
1923 * cache size incorrectly as 1K | |
1924 * when it is really 64K | |
1925 */ | |
1926 if (cpi->cpi_family == 6 && | |
1927 cpi->cpi_model == 3 && | |
1928 cpi->cpi_step == 0) { | |
1929 cp->cp_ecx &= 0xffff; | |
1930 cp->cp_ecx |= 0x400000; | |
1931 } | |
1932 break; | |
1933 case X86_VENDOR_Cyrix: /* VIA C3 */ | |
1934 /* | |
1935 * VIA C3 processors are a bit messed | |
1936 * up w.r.t. encoding cache sizes in %ecx | |
1937 */ | |
1938 if (cpi->cpi_family != 6) | |
1939 break; | |
1940 /* | |
1941 * model 7 and 8 were incorrectly encoded | |
1942 * | |
1943 * xxx is model 8 really broken? | |
1944 */ | |
1945 if (cpi->cpi_model == 7 || | |
1946 cpi->cpi_model == 8) | |
1947 cp->cp_ecx = | |
1948 BITX(cp->cp_ecx, 31, 24) << 16 | | |
1949 BITX(cp->cp_ecx, 23, 16) << 12 | | |
1950 BITX(cp->cp_ecx, 15, 8) << 8 | | |
1951 BITX(cp->cp_ecx, 7, 0); | |
1952 /* | |
1953 * model 9 stepping 1 has wrong associativity | |
1954 */ | |
1955 if (cpi->cpi_model == 9 && cpi->cpi_step == 1) | |
1956 cp->cp_ecx |= 8 << 12; | |
1957 break; | |
1958 case X86_VENDOR_Intel: | |
1959 /* | |
1960 * Extended L2 Cache features function. | |
1961 * First appeared on Prescott. | |
1962 */ | |
1963 default: | |
1964 break; | |
1965 } | |
1966 break; | |
1967 default: | |
1968 break; | |
1969 } | |
1970 } | |
1971 | |
1972 pass2_done: | |
1973 cpi->cpi_pass = 2; | |
1974 } | |
1975 | |
1976 static const char * | |
1977 intel_cpubrand(const struct cpuid_info *cpi) | |
1978 { | |
1979 int i; | |
1980 | |
12838
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
1981 if (!is_x86_feature(x86_featureset, X86FSET_CPUID) || |
0 | 1982 cpi->cpi_maxeax < 1 || cpi->cpi_family < 5) |
1983 return ("i486"); | |
1984 | |
1985 switch (cpi->cpi_family) { | |
1986 case 5: | |
1987 return ("Intel Pentium(r)"); | |
1988 case 6: | |
1989 switch (cpi->cpi_model) { | |
1990 uint_t celeron, xeon; | |
1228 | 1991 const struct cpuid_regs *cp; |
0 | 1992 case 0: |
1993 case 1: | |
1994 case 2: | |
1995 return ("Intel Pentium(r) Pro"); | |
1996 case 3: | |
1997 case 4: | |
1998 return ("Intel Pentium(r) II"); | |
1999 case 6: | |
2000 return ("Intel Celeron(r)"); | |
2001 case 5: | |
2002 case 7: | |
2003 celeron = xeon = 0; | |
2004 cp = &cpi->cpi_std[2]; /* cache info */ | |
2005 | |
6317
8afb524fc268
6667600 Incomplete initialization of cpi_cacheinfo field of struct cpuid_info
kk208521
parents:
5870
diff
changeset
|
2006 for (i = 1; i < 4; i++) { |
0 | 2007 uint_t tmp; |
2008 | |
2009 tmp = (cp->cp_eax >> (8 * i)) & 0xff; | |
2010 if (tmp == 0x40) | |
2011 celeron++; | |
2012 if (tmp >= 0x44 && tmp <= 0x45) | |
2013 xeon++; | |
2014 } | |
2015 | |
2016 for (i = 0; i < 2; i++) { | |
2017 uint_t tmp; | |
2018 | |
2019 tmp = (cp->cp_ebx >> (8 * i)) & 0xff; | |
2020 if (tmp == 0x40) | |
2021 celeron++; | |
2022 else if (tmp >= 0x44 && tmp <= 0x45) | |
2023 xeon++; | |
2024 } | |
2025 | |
2026 for (i = 0; i < 4; i++) { | |
2027 uint_t tmp; | |
2028 | |
2029 tmp = (cp->cp_ecx >> (8 * i)) & 0xff; | |
2030 if (tmp == 0x40) | |
2031 celeron++; | |
2032 else if (tmp >= 0x44 && tmp <= 0x45) | |
2033 xeon++; | |
2034 } | |
2035 | |
2036 for (i = 0; i < 4; i++) { | |
2037 uint_t tmp; | |
2038 | |
2039 tmp = (cp->cp_edx >> (8 * i)) & 0xff; | |
2040 if (tmp == 0x40) | |
2041 celeron++; | |
2042 else if (tmp >= 0x44 && tmp <= 0x45) | |
2043 xeon++; | |
2044 } | |
2045 | |
2046 if (celeron) | |
2047 return ("Intel Celeron(r)"); | |
2048 if (xeon) | |
2049 return (cpi->cpi_model == 5 ? | |
2050 "Intel Pentium(r) II Xeon(tm)" : | |
2051 "Intel Pentium(r) III Xeon(tm)"); | |
2052 return (cpi->cpi_model == 5 ? | |
2053 "Intel Pentium(r) II or Pentium(r) II Xeon(tm)" : | |
2054 "Intel Pentium(r) III or Pentium(r) III Xeon(tm)"); | |
2055 default: | |
2056 break; | |
2057 } | |
2058 default: | |
2059 break; | |
2060 } | |
2061 | |
1975
7490b056500b
6183891 Missing brand ID strings for several common x86 CPUs
dmick
parents:
1727
diff
changeset
|
2062 /* BrandID is present if the field is nonzero */ |
7490b056500b
6183891 Missing brand ID strings for several common x86 CPUs
dmick
parents:
1727
diff
changeset
|
2063 if (cpi->cpi_brandid != 0) { |
0 | 2064 static const struct { |
2065 uint_t bt_bid; | |
2066 const char *bt_str; | |
2067 } brand_tbl[] = { | |
2068 { 0x1, "Intel(r) Celeron(r)" }, | |
2069 { 0x2, "Intel(r) Pentium(r) III" }, | |
2070 { 0x3, "Intel(r) Pentium(r) III Xeon(tm)" }, | |
2071 { 0x4, "Intel(r) Pentium(r) III" }, | |
2072 { 0x6, "Mobile Intel(r) Pentium(r) III" }, | |
2073 { 0x7, "Mobile Intel(r) Celeron(r)" }, | |
2074 { 0x8, "Intel(r) Pentium(r) 4" }, | |
2075 { 0x9, "Intel(r) Pentium(r) 4" }, | |
2076 { 0xa, "Intel(r) Celeron(r)" }, | |
2077 { 0xb, "Intel(r) Xeon(tm)" }, | |
2078 { 0xc, "Intel(r) Xeon(tm) MP" }, | |
2079 { 0xe, "Mobile Intel(r) Pentium(r) 4" }, | |
1975
7490b056500b
6183891 Missing brand ID strings for several common x86 CPUs
dmick
parents:
1727
diff
changeset
|
2080 { 0xf, "Mobile Intel(r) Celeron(r)" }, |
7490b056500b
6183891 Missing brand ID strings for several common x86 CPUs
dmick
parents:
1727
diff
changeset
|
2081 { 0x11, "Mobile Genuine Intel(r)" }, |
7490b056500b
6183891 Missing brand ID strings for several common x86 CPUs
dmick
parents:
1727
diff
changeset
|
2082 { 0x12, "Intel(r) Celeron(r) M" }, |
7490b056500b
6183891 Missing brand ID strings for several common x86 CPUs
dmick
parents:
1727
diff
changeset
|
2083 { 0x13, "Mobile Intel(r) Celeron(r)" }, |
7490b056500b
6183891 Missing brand ID strings for several common x86 CPUs
dmick
parents:
1727
diff
changeset
|
2084 { 0x14, "Intel(r) Celeron(r)" }, |
7490b056500b
6183891 Missing brand ID strings for several common x86 CPUs
dmick
parents:
1727
diff
changeset
|
2085 { 0x15, "Mobile Genuine Intel(r)" }, |
7490b056500b
6183891 Missing brand ID strings for several common x86 CPUs
dmick
parents:
1727
diff
changeset
|
2086 { 0x16, "Intel(r) Pentium(r) M" }, |
7490b056500b
6183891 Missing brand ID strings for several common x86 CPUs
dmick
parents:
1727
diff
changeset
|
2087 { 0x17, "Mobile Intel(r) Celeron(r)" } |
0 | 2088 }; |
2089 uint_t btblmax = sizeof (brand_tbl) / sizeof (brand_tbl[0]); | |
2090 uint_t sgn; | |
2091 | |
2092 sgn = (cpi->cpi_family << 8) | | |
2093 (cpi->cpi_model << 4) | cpi->cpi_step; | |
2094 | |
2095 for (i = 0; i < btblmax; i++) | |
2096 if (brand_tbl[i].bt_bid == cpi->cpi_brandid) | |
2097 break; | |
2098 if (i < btblmax) { | |
2099 if (sgn == 0x6b1 && cpi->cpi_brandid == 3) | |
2100 return ("Intel(r) Celeron(r)"); | |
2101 if (sgn < 0xf13 && cpi->cpi_brandid == 0xb) | |
2102 return ("Intel(r) Xeon(tm) MP"); | |
2103 if (sgn < 0xf13 && cpi->cpi_brandid == 0xe) | |
2104 return ("Intel(r) Xeon(tm)"); | |
2105 return (brand_tbl[i].bt_str); | |
2106 } | |
2107 } | |
2108 | |
2109 return (NULL); | |
2110 } | |
2111 | |
2112 static const char * | |
2113 amd_cpubrand(const struct cpuid_info *cpi) | |
2114 { | |
12838
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
2115 if (!is_x86_feature(x86_featureset, X86FSET_CPUID) || |
0 | 2116 cpi->cpi_maxeax < 1 || cpi->cpi_family < 5) |
2117 return ("i486 compatible"); | |
2118 | |
2119 switch (cpi->cpi_family) { | |
2120 case 5: | |
2121 switch (cpi->cpi_model) { | |
2122 case 0: | |
2123 case 1: | |
2124 case 2: | |
2125 case 3: | |
2126 case 4: | |
2127 case 5: | |
2128 return ("AMD-K5(r)"); | |
2129 case 6: | |
2130 case 7: | |
2131 return ("AMD-K6(r)"); | |
2132 case 8: | |
2133 return ("AMD-K6(r)-2"); | |
2134 case 9: | |
2135 return ("AMD-K6(r)-III"); | |
2136 default: | |
2137 return ("AMD (family 5)"); | |
2138 } | |
2139 case 6: | |
2140 switch (cpi->cpi_model) { | |
2141 case 1: | |
2142 return ("AMD-K7(tm)"); | |
2143 case 0: | |
2144 case 2: | |
2145 case 4: | |
2146 return ("AMD Athlon(tm)"); | |
2147 case 3: | |
2148 case 7: | |
2149 return ("AMD Duron(tm)"); | |
2150 case 6: | |
2151 case 8: | |
2152 case 10: | |
2153 /* | |
2154 * Use the L2 cache size to distinguish | |
2155 */ | |
2156 return ((cpi->cpi_extd[6].cp_ecx >> 16) >= 256 ? | |
2157 "AMD Athlon(tm)" : "AMD Duron(tm)"); | |
2158 default: | |
2159 return ("AMD (family 6)"); | |
2160 } | |
2161 default: | |
2162 break; | |
2163 } | |
2164 | |
2165 if (cpi->cpi_family == 0xf && cpi->cpi_model == 5 && | |
2166 cpi->cpi_brandid != 0) { | |
2167 switch (BITX(cpi->cpi_brandid, 7, 5)) { | |
2168 case 3: | |
2169 return ("AMD Opteron(tm) UP 1xx"); | |
2170 case 4: | |
2171 return ("AMD Opteron(tm) DP 2xx"); | |
2172 case 5: | |
2173 return ("AMD Opteron(tm) MP 8xx"); | |
2174 default: | |
2175 return ("AMD Opteron(tm)"); | |
2176 } | |
2177 } | |
2178 | |
2179 return (NULL); | |
2180 } | |
2181 | |
2182 static const char * | |
2183 cyrix_cpubrand(struct cpuid_info *cpi, uint_t type) | |
2184 { | |
12838
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
2185 if (!is_x86_feature(x86_featureset, X86FSET_CPUID) || |
0 | 2186 cpi->cpi_maxeax < 1 || cpi->cpi_family < 5 || |
2187 type == X86_TYPE_CYRIX_486) | |
2188 return ("i486 compatible"); | |
2189 | |
2190 switch (type) { | |
2191 case X86_TYPE_CYRIX_6x86: | |
2192 return ("Cyrix 6x86"); | |
2193 case X86_TYPE_CYRIX_6x86L: | |
2194 return ("Cyrix 6x86L"); | |
2195 case X86_TYPE_CYRIX_6x86MX: | |
2196 return ("Cyrix 6x86MX"); | |
2197 case X86_TYPE_CYRIX_GXm: | |
2198 return ("Cyrix GXm"); | |
2199 case X86_TYPE_CYRIX_MediaGX: | |
2200 return ("Cyrix MediaGX"); | |
2201 case X86_TYPE_CYRIX_MII: | |
2202 return ("Cyrix M2"); | |
2203 case X86_TYPE_VIA_CYRIX_III: | |
2204 return ("VIA Cyrix M3"); | |
2205 default: | |
2206 /* | |
2207 * Have another wild guess .. | |
2208 */ | |
2209 if (cpi->cpi_family == 4 && cpi->cpi_model == 9) | |
2210 return ("Cyrix 5x86"); | |
2211 else if (cpi->cpi_family == 5) { | |
2212 switch (cpi->cpi_model) { | |
2213 case 2: | |
2214 return ("Cyrix 6x86"); /* Cyrix M1 */ | |
2215 case 4: | |
2216 return ("Cyrix MediaGX"); | |
2217 default: | |
2218 break; | |
2219 } | |
2220 } else if (cpi->cpi_family == 6) { | |
2221 switch (cpi->cpi_model) { | |
2222 case 0: | |
2223 return ("Cyrix 6x86MX"); /* Cyrix M2? */ | |
2224 case 5: | |
2225 case 6: | |
2226 case 7: | |
2227 case 8: | |
2228 case 9: | |
2229 return ("VIA C3"); | |
2230 default: | |
2231 break; | |
2232 } | |
2233 } | |
2234 break; | |
2235 } | |
2236 return (NULL); | |
2237 } | |
2238 | |
2239 /* | |
2240 * This only gets called in the case that the CPU extended | |
2241 * feature brand string (0x80000002, 0x80000003, 0x80000004) | |
2242 * aren't available, or contain null bytes for some reason. | |
2243 */ | |
2244 static void | |
2245 fabricate_brandstr(struct cpuid_info *cpi) | |
2246 { | |
2247 const char *brand = NULL; | |
2248 | |
2249 switch (cpi->cpi_vendor) { | |
2250 case X86_VENDOR_Intel: | |
2251 brand = intel_cpubrand(cpi); | |
2252 break; | |
2253 case X86_VENDOR_AMD: | |
2254 brand = amd_cpubrand(cpi); | |
2255 break; | |
2256 case X86_VENDOR_Cyrix: | |
2257 brand = cyrix_cpubrand(cpi, x86_type); | |
2258 break; | |
2259 case X86_VENDOR_NexGen: | |
2260 if (cpi->cpi_family == 5 && cpi->cpi_model == 0) | |
2261 brand = "NexGen Nx586"; | |
2262 break; | |
2263 case X86_VENDOR_Centaur: | |
2264 if (cpi->cpi_family == 5) | |
2265 switch (cpi->cpi_model) { | |
2266 case 4: | |
2267 brand = "Centaur C6"; | |
2268 break; | |
2269 case 8: | |
2270 brand = "Centaur C2"; | |
2271 break; | |
2272 case 9: | |
2273 brand = "Centaur C3"; | |
2274 break; | |
2275 default: | |
2276 break; | |
2277 } | |
2278 break; | |
2279 case X86_VENDOR_Rise: | |
2280 if (cpi->cpi_family == 5 && | |
2281 (cpi->cpi_model == 0 || cpi->cpi_model == 2)) | |
2282 brand = "Rise mP6"; | |
2283 break; | |
2284 case X86_VENDOR_SiS: | |
2285 if (cpi->cpi_family == 5 && cpi->cpi_model == 0) | |
2286 brand = "SiS 55x"; | |
2287 break; | |
2288 case X86_VENDOR_TM: | |
2289 if (cpi->cpi_family == 5 && cpi->cpi_model == 4) | |
2290 brand = "Transmeta Crusoe TM3x00 or TM5x00"; | |
2291 break; | |
2292 case X86_VENDOR_NSC: | |
2293 case X86_VENDOR_UMC: | |
2294 default: | |
2295 break; | |
2296 } | |
2297 if (brand) { | |
2298 (void) strcpy((char *)cpi->cpi_brandstr, brand); | |
2299 return; | |
2300 } | |
2301 | |
2302 /* | |
2303 * If all else fails ... | |
2304 */ | |
2305 (void) snprintf(cpi->cpi_brandstr, sizeof (cpi->cpi_brandstr), | |
2306 "%s %d.%d.%d", cpi->cpi_vendorstr, cpi->cpi_family, | |
2307 cpi->cpi_model, cpi->cpi_step); | |
2308 } | |
2309 | |
2310 /* | |
2311 * This routine is called just after kernel memory allocation | |
2312 * becomes available on cpu0, and as part of mp_startup() on | |
2313 * the other cpus. | |
2314 * | |
4606 | 2315 * Fixup the brand string, and collect any information from cpuid |
2316 * that requires dynamicically allocated storage to represent. | |
0 | 2317 */ |
2318 /*ARGSUSED*/ | |
2319 void | |
2320 cpuid_pass3(cpu_t *cpu) | |
2321 { | |
4606 | 2322 int i, max, shft, level, size; |
2323 struct cpuid_regs regs; | |
2324 struct cpuid_regs *cp; | |
0 | 2325 struct cpuid_info *cpi = cpu->cpu_m.mcpu_cpi; |
2326 | |
2327 ASSERT(cpi->cpi_pass == 2); | |
2328 | |
4606 | 2329 /* |
2330 * Function 4: Deterministic cache parameters | |
2331 * | |
2332 * Take this opportunity to detect the number of threads | |
2333 * sharing the last level cache, and construct a corresponding | |
2334 * cache id. The respective cpuid_info members are initialized | |
2335 * to the default case of "no last level cache sharing". | |
2336 */ | |
2337 cpi->cpi_ncpu_shr_last_cache = 1; | |
2338 cpi->cpi_last_lvl_cacheid = cpu->cpu_id; | |
2339 | |
2340 if (cpi->cpi_maxeax >= 4 && cpi->cpi_vendor == X86_VENDOR_Intel) { | |
2341 | |
2342 /* | |
2343 * Find the # of elements (size) returned by fn 4, and along | |
2344 * the way detect last level cache sharing details. | |
2345 */ | |
2346 bzero(®s, sizeof (regs)); | |
2347 cp = ®s; | |
2348 for (i = 0, max = 0; i < CPI_FN4_ECX_MAX; i++) { | |
2349 cp->cp_eax = 4; | |
2350 cp->cp_ecx = i; | |
2351 | |
2352 (void) __cpuid_insn(cp); | |
2353 | |
2354 if (CPI_CACHE_TYPE(cp) == 0) | |
2355 break; | |
2356 level = CPI_CACHE_LVL(cp); | |
2357 if (level > max) { | |
2358 max = level; | |
2359 cpi->cpi_ncpu_shr_last_cache = | |
2360 CPI_NTHR_SHR_CACHE(cp) + 1; | |
2361 } | |
2362 } | |
2363 cpi->cpi_std_4_size = size = i; | |
2364 | |
2365 /* | |
2366 * Allocate the cpi_std_4 array. The first element | |
2367 * references the regs for fn 4, %ecx == 0, which | |
2368 * cpuid_pass2() stashed in cpi->cpi_std[4]. | |
2369 */ | |
2370 if (size > 0) { | |
2371 cpi->cpi_std_4 = | |
2372 kmem_alloc(size * sizeof (cp), KM_SLEEP); | |
2373 cpi->cpi_std_4[0] = &cpi->cpi_std[4]; | |
2374 | |
2375 /* | |
2376 * Allocate storage to hold the additional regs | |
2377 * for function 4, %ecx == 1 .. cpi_std_4_size. | |
2378 * | |
2379 * The regs for fn 4, %ecx == 0 has already | |
2380 * been allocated as indicated above. | |
2381 */ | |
2382 for (i = 1; i < size; i++) { | |
2383 cp = cpi->cpi_std_4[i] = | |
2384 kmem_zalloc(sizeof (regs), KM_SLEEP); | |
2385 cp->cp_eax = 4; | |
2386 cp->cp_ecx = i; | |
2387 | |
2388 (void) __cpuid_insn(cp); | |
2389 } | |
2390 } | |
2391 /* | |
2392 * Determine the number of bits needed to represent | |
2393 * the number of CPUs sharing the last level cache. | |
2394 * | |
2395 * Shift off that number of bits from the APIC id to | |
2396 * derive the cache id. | |
2397 */ | |
2398 shft = 0; | |
2399 for (i = 1; i < cpi->cpi_ncpu_shr_last_cache; i <<= 1) | |
2400 shft++; | |
7282
5b3b6674ac91
6528768 apic_navail_vector() fails when IPL equals 8 or 9
mishra
parents:
6964
diff
changeset
|
2401 cpi->cpi_last_lvl_cacheid = cpi->cpi_apicid >> shft; |
0 | 2402 } |
2403 | |
2404 /* | |
4606 | 2405 * Now fixup the brand string |
0 | 2406 */ |
4606 | 2407 if ((cpi->cpi_xmaxeax & 0x80000000) == 0) { |
2408 fabricate_brandstr(cpi); | |
2409 } else { | |
0 | 2410 |
2411 /* | |
4606 | 2412 * If we successfully extracted a brand string from the cpuid |
2413 * instruction, clean it up by removing leading spaces and | |
2414 * similar junk. | |
0 | 2415 */ |
4606 | 2416 if (cpi->cpi_brandstr[0]) { |
2417 size_t maxlen = sizeof (cpi->cpi_brandstr); | |
2418 char *src, *dst; | |
2419 | |
2420 dst = src = (char *)cpi->cpi_brandstr; | |
2421 src[maxlen - 1] = '\0'; | |
2422 /* | |
2423 * strip leading spaces | |
2424 */ | |
2425 while (*src == ' ') | |
2426 src++; | |
2427 /* | |
2428 * Remove any 'Genuine' or "Authentic" prefixes | |
2429 */ | |
2430 if (strncmp(src, "Genuine ", 8) == 0) | |
2431 src += 8; | |
2432 if (strncmp(src, "Authentic ", 10) == 0) | |
2433 src += 10; | |
2434 | |
2435 /* | |
2436 * Now do an in-place copy. | |
2437 * Map (R) to (r) and (TM) to (tm). | |
2438 * The era of teletypes is long gone, and there's | |
2439 * -really- no need to shout. | |
2440 */ | |
2441 while (*src != '\0') { | |
2442 if (src[0] == '(') { | |
2443 if (strncmp(src + 1, "R)", 2) == 0) { | |
2444 (void) strncpy(dst, "(r)", 3); | |
2445 src += 3; | |
2446 dst += 3; | |
2447 continue; | |
2448 } | |
2449 if (strncmp(src + 1, "TM)", 3) == 0) { | |
2450 (void) strncpy(dst, "(tm)", 4); | |
2451 src += 4; | |
2452 dst += 4; | |
2453 continue; | |
2454 } | |
0 | 2455 } |
4606 | 2456 *dst++ = *src++; |
0 | 2457 } |
4606 | 2458 *dst = '\0'; |
2459 | |
2460 /* | |
2461 * Finally, remove any trailing spaces | |
2462 */ | |
2463 while (--dst > cpi->cpi_brandstr) | |
2464 if (*dst == ' ') | |
2465 *dst = '\0'; | |
2466 else | |
2467 break; | |
2468 } else | |
2469 fabricate_brandstr(cpi); | |
2470 } | |
0 | 2471 cpi->cpi_pass = 3; |
2472 } | |
2473 | |
2474 /* | |
2475 * This routine is called out of bind_hwcap() much later in the life | |
2476 * of the kernel (post_startup()). The job of this routine is to resolve | |
2477 * the hardware feature support and kernel support for those features into | |
2478 * what we're actually going to tell applications via the aux vector. | |
2479 */ | |
2480 uint_t | |
2481 cpuid_pass4(cpu_t *cpu) | |
2482 { | |
2483 struct cpuid_info *cpi; | |
2484 uint_t hwcap_flags = 0; | |
2485 | |
2486 if (cpu == NULL) | |
2487 cpu = CPU; | |
2488 cpi = cpu->cpu_m.mcpu_cpi; | |
2489 | |
2490 ASSERT(cpi->cpi_pass == 3); | |
2491 | |
2492 if (cpi->cpi_maxeax >= 1) { | |
2493 uint32_t *edx = &cpi->cpi_support[STD_EDX_FEATURES]; | |
2494 uint32_t *ecx = &cpi->cpi_support[STD_ECX_FEATURES]; | |
2495 | |
2496 *edx = CPI_FEATURES_EDX(cpi); | |
2497 *ecx = CPI_FEATURES_ECX(cpi); | |
2498 | |
2499 /* | |
2500 * [these require explicit kernel support] | |
2501 */ | |
12838
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
2502 if (!is_x86_feature(x86_featureset, X86FSET_SEP)) |
0 | 2503 *edx &= ~CPUID_INTC_EDX_SEP; |
2504 | |
12838
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
2505 if (!is_x86_feature(x86_featureset, X86FSET_SSE)) |
0 | 2506 *edx &= ~(CPUID_INTC_EDX_FXSR|CPUID_INTC_EDX_SSE); |
12838
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
2507 if (!is_x86_feature(x86_featureset, X86FSET_SSE2)) |
0 | 2508 *edx &= ~CPUID_INTC_EDX_SSE2; |
2509 | |
12838
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
2510 if (!is_x86_feature(x86_featureset, X86FSET_HTT)) |
0 | 2511 *edx &= ~CPUID_INTC_EDX_HTT; |
2512 | |
12838
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
2513 if (!is_x86_feature(x86_featureset, X86FSET_SSE3)) |
0 | 2514 *ecx &= ~CPUID_INTC_ECX_SSE3; |
2515 | |
5269
395a95dbfd17
6526262 cpuid ssse3 feature not noted on Intel Woodcrest/Conroe processors
kk208521
parents:
5254
diff
changeset
|
2516 if (cpi->cpi_vendor == X86_VENDOR_Intel) { |
12838
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
2517 if (!is_x86_feature(x86_featureset, X86FSET_SSSE3)) |
5269
395a95dbfd17
6526262 cpuid ssse3 feature not noted on Intel Woodcrest/Conroe processors
kk208521
parents:
5254
diff
changeset
|
2518 *ecx &= ~CPUID_INTC_ECX_SSSE3; |
12838
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
2519 if (!is_x86_feature(x86_featureset, X86FSET_SSE4_1)) |
5269
395a95dbfd17
6526262 cpuid ssse3 feature not noted on Intel Woodcrest/Conroe processors
kk208521
parents:
5254
diff
changeset
|
2520 *ecx &= ~CPUID_INTC_ECX_SSE4_1; |
12838
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
2521 if (!is_x86_feature(x86_featureset, X86FSET_SSE4_2)) |
5269
395a95dbfd17
6526262 cpuid ssse3 feature not noted on Intel Woodcrest/Conroe processors
kk208521
parents:
5254
diff
changeset
|
2522 *ecx &= ~CPUID_INTC_ECX_SSE4_2; |
12838
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
2523 if (!is_x86_feature(x86_featureset, X86FSET_AES)) |
9370
5f964d9a7826
6750666 getisax(2) needs to detect Intel AES instruction set extension and PCLMULQDQ instruction
Kuriakose Kuruvilla <Kuriakose.Kuruvilla@Sun.COM>
parents:
9283
diff
changeset
|
2524 *ecx &= ~CPUID_INTC_ECX_AES; |
12838
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
2525 if (!is_x86_feature(x86_featureset, X86FSET_PCLMULQDQ)) |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
2526 *ecx &= ~CPUID_INTC_ECX_PCLMULQDQ; |
13146
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
2527 if (!is_x86_feature(x86_featureset, X86FSET_XSAVE)) |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
2528 *ecx &= ~(CPUID_INTC_ECX_XSAVE | |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
2529 CPUID_INTC_ECX_OSXSAVE); |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
2530 if (!is_x86_feature(x86_featureset, X86FSET_AVX)) |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
2531 *ecx &= ~CPUID_INTC_ECX_AVX; |
5269
395a95dbfd17
6526262 cpuid ssse3 feature not noted on Intel Woodcrest/Conroe processors
kk208521
parents:
5254
diff
changeset
|
2532 } |
395a95dbfd17
6526262 cpuid ssse3 feature not noted on Intel Woodcrest/Conroe processors
kk208521
parents:
5254
diff
changeset
|
2533 |
0 | 2534 /* |
2535 * [no explicit support required beyond x87 fp context] | |
2536 */ | |
2537 if (!fpu_exists) | |
2538 *edx &= ~(CPUID_INTC_EDX_FPU | CPUID_INTC_EDX_MMX); | |
2539 | |
2540 /* | |
2541 * Now map the supported feature vector to things that we | |
2542 * think userland will care about. | |
2543 */ | |
2544 if (*edx & CPUID_INTC_EDX_SEP) | |
2545 hwcap_flags |= AV_386_SEP; | |
2546 if (*edx & CPUID_INTC_EDX_SSE) | |
2547 hwcap_flags |= AV_386_FXSR | AV_386_SSE; | |
2548 if (*edx & CPUID_INTC_EDX_SSE2) | |
2549 hwcap_flags |= AV_386_SSE2; | |
2550 if (*ecx & CPUID_INTC_ECX_SSE3) | |
2551 hwcap_flags |= AV_386_SSE3; | |
5269
395a95dbfd17
6526262 cpuid ssse3 feature not noted on Intel Woodcrest/Conroe processors
kk208521
parents:
5254
diff
changeset
|
2552 if (cpi->cpi_vendor == X86_VENDOR_Intel) { |
395a95dbfd17
6526262 cpuid ssse3 feature not noted on Intel Woodcrest/Conroe processors
kk208521
parents:
5254
diff
changeset
|
2553 if (*ecx & CPUID_INTC_ECX_SSSE3) |
395a95dbfd17
6526262 cpuid ssse3 feature not noted on Intel Woodcrest/Conroe processors
kk208521
parents:
5254
diff
changeset
|
2554 hwcap_flags |= AV_386_SSSE3; |
395a95dbfd17
6526262 cpuid ssse3 feature not noted on Intel Woodcrest/Conroe processors
kk208521
parents:
5254
diff
changeset
|
2555 if (*ecx & CPUID_INTC_ECX_SSE4_1) |
395a95dbfd17
6526262 cpuid ssse3 feature not noted on Intel Woodcrest/Conroe processors
kk208521
parents:
5254
diff
changeset
|
2556 hwcap_flags |= AV_386_SSE4_1; |
395a95dbfd17
6526262 cpuid ssse3 feature not noted on Intel Woodcrest/Conroe processors
kk208521
parents:
5254
diff
changeset
|
2557 if (*ecx & CPUID_INTC_ECX_SSE4_2) |
395a95dbfd17
6526262 cpuid ssse3 feature not noted on Intel Woodcrest/Conroe processors
kk208521
parents:
5254
diff
changeset
|
2558 hwcap_flags |= AV_386_SSE4_2; |
8418
a4853cd72a21
6719310 Expose availability of MOVBE instruction
Krishnendu Sadhukhan - Sun Microsystems <Krishnendu.Sadhukhan@Sun.COM>
parents:
8377
diff
changeset
|
2559 if (*ecx & CPUID_INTC_ECX_MOVBE) |
a4853cd72a21
6719310 Expose availability of MOVBE instruction
Krishnendu Sadhukhan - Sun Microsystems <Krishnendu.Sadhukhan@Sun.COM>
parents:
8377
diff
changeset
|
2560 hwcap_flags |= AV_386_MOVBE; |
9370
5f964d9a7826
6750666 getisax(2) needs to detect Intel AES instruction set extension and PCLMULQDQ instruction
Kuriakose Kuruvilla <Kuriakose.Kuruvilla@Sun.COM>
parents:
9283
diff
changeset
|
2561 if (*ecx & CPUID_INTC_ECX_AES) |
5f964d9a7826
6750666 getisax(2) needs to detect Intel AES instruction set extension and PCLMULQDQ instruction
Kuriakose Kuruvilla <Kuriakose.Kuruvilla@Sun.COM>
parents:
9283
diff
changeset
|
2562 hwcap_flags |= AV_386_AES; |
5f964d9a7826
6750666 getisax(2) needs to detect Intel AES instruction set extension and PCLMULQDQ instruction
Kuriakose Kuruvilla <Kuriakose.Kuruvilla@Sun.COM>
parents:
9283
diff
changeset
|
2563 if (*ecx & CPUID_INTC_ECX_PCLMULQDQ) |
5f964d9a7826
6750666 getisax(2) needs to detect Intel AES instruction set extension and PCLMULQDQ instruction
Kuriakose Kuruvilla <Kuriakose.Kuruvilla@Sun.COM>
parents:
9283
diff
changeset
|
2564 hwcap_flags |= AV_386_PCLMULQDQ; |
13146
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
2565 if ((*ecx & CPUID_INTC_ECX_XSAVE) && |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
2566 (*ecx & CPUID_INTC_ECX_OSXSAVE)) |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
2567 hwcap_flags |= AV_386_XSAVE; |
5269
395a95dbfd17
6526262 cpuid ssse3 feature not noted on Intel Woodcrest/Conroe processors
kk208521
parents:
5254
diff
changeset
|
2568 } |
4628
f90cf8fd4710
6525798 Need Hardware Capabilities support for AMD Family 10h/sse4a processor
kk208521
parents:
4606
diff
changeset
|
2569 if (*ecx & CPUID_INTC_ECX_POPCNT) |
f90cf8fd4710
6525798 Need Hardware Capabilities support for AMD Family 10h/sse4a processor
kk208521
parents:
4606
diff
changeset
|
2570 hwcap_flags |= AV_386_POPCNT; |
0 | 2571 if (*edx & CPUID_INTC_EDX_FPU) |
2572 hwcap_flags |= AV_386_FPU; | |
2573 if (*edx & CPUID_INTC_EDX_MMX) | |
2574 hwcap_flags |= AV_386_MMX; | |
2575 | |
2576 if (*edx & CPUID_INTC_EDX_TSC) | |
2577 hwcap_flags |= AV_386_TSC; | |
2578 if (*edx & CPUID_INTC_EDX_CX8) | |
2579 hwcap_flags |= AV_386_CX8; | |
2580 if (*edx & CPUID_INTC_EDX_CMOV) | |
2581 hwcap_flags |= AV_386_CMOV; | |
2582 if (*ecx & CPUID_INTC_ECX_CX16) | |
2583 hwcap_flags |= AV_386_CX16; | |
2584 } | |
2585 | |
2586 if (cpi->cpi_xmaxeax < 0x80000001) | |
2587 goto pass4_done; | |
2588 | |
2589 switch (cpi->cpi_vendor) { | |
1228 | 2590 struct cpuid_regs cp; |
3446 | 2591 uint32_t *edx, *ecx; |
0 | 2592 |
3446 | 2593 case X86_VENDOR_Intel: |
2594 /* | |
2595 * Seems like Intel duplicated what we necessary | |
2596 * here to make the initial crop of 64-bit OS's work. | |
2597 * Hopefully, those are the only "extended" bits | |
2598 * they'll add. | |
2599 */ | |
2600 /*FALLTHROUGH*/ | |
2601 | |
0 | 2602 case X86_VENDOR_AMD: |
2603 edx = &cpi->cpi_support[AMD_EDX_FEATURES]; | |
3446 | 2604 ecx = &cpi->cpi_support[AMD_ECX_FEATURES]; |
0 | 2605 |
2606 *edx = CPI_FEATURES_XTD_EDX(cpi); | |
3446 | 2607 *ecx = CPI_FEATURES_XTD_ECX(cpi); |
2608 | |
2609 /* | |
2610 * [these features require explicit kernel support] | |
2611 */ | |
2612 switch (cpi->cpi_vendor) { | |
2613 case X86_VENDOR_Intel: | |
12838
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
2614 if (!is_x86_feature(x86_featureset, X86FSET_TSCP)) |
6657 | 2615 *edx &= ~CPUID_AMD_EDX_TSCP; |
3446 | 2616 break; |
2617 | |
2618 case X86_VENDOR_AMD: | |
12838
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
2619 if (!is_x86_feature(x86_featureset, X86FSET_TSCP)) |
3446 | 2620 *edx &= ~CPUID_AMD_EDX_TSCP; |
12838
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
2621 if (!is_x86_feature(x86_featureset, X86FSET_SSE4A)) |
4628
f90cf8fd4710
6525798 Need Hardware Capabilities support for AMD Family 10h/sse4a processor
kk208521
parents:
4606
diff
changeset
|
2622 *ecx &= ~CPUID_AMD_ECX_SSE4A; |
3446 | 2623 break; |
2624 | |
2625 default: | |
2626 break; | |
2627 } | |
0 | 2628 |
2629 /* | |
2630 * [no explicit support required beyond | |
2631 * x87 fp context and exception handlers] | |
2632 */ | |
2633 if (!fpu_exists) | |
2634 *edx &= ~(CPUID_AMD_EDX_MMXamd | | |
2635 CPUID_AMD_EDX_3DNow | CPUID_AMD_EDX_3DNowx); | |
2636 | |
12838
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
2637 if (!is_x86_feature(x86_featureset, X86FSET_NX)) |
0 | 2638 *edx &= ~CPUID_AMD_EDX_NX; |
3446 | 2639 #if !defined(__amd64) |
0 | 2640 *edx &= ~CPUID_AMD_EDX_LM; |
2641 #endif | |
2642 /* | |
2643 * Now map the supported feature vector to | |
2644 * things that we think userland will care about. | |
2645 */ | |
3446 | 2646 #if defined(__amd64) |
0 | 2647 if (*edx & CPUID_AMD_EDX_SYSC) |
2648 hwcap_flags |= AV_386_AMD_SYSC; | |
3446 | 2649 #endif |
0 | 2650 if (*edx & CPUID_AMD_EDX_MMXamd) |
2651 hwcap_flags |= AV_386_AMD_MMX; | |
2652 if (*edx & CPUID_AMD_EDX_3DNow) | |
2653 hwcap_flags |= AV_386_AMD_3DNow; | |
2654 if (*edx & CPUID_AMD_EDX_3DNowx) | |
2655 hwcap_flags |= AV_386_AMD_3DNowx; | |
3446 | 2656 |
2657 switch (cpi->cpi_vendor) { | |
2658 case X86_VENDOR_AMD: | |
2659 if (*edx & CPUID_AMD_EDX_TSCP) | |
2660 hwcap_flags |= AV_386_TSCP; | |
2661 if (*ecx & CPUID_AMD_ECX_AHF64) | |
2662 hwcap_flags |= AV_386_AHF; | |
4628
f90cf8fd4710
6525798 Need Hardware Capabilities support for AMD Family 10h/sse4a processor
kk208521
parents:
4606
diff
changeset
|
2663 if (*ecx & CPUID_AMD_ECX_SSE4A) |
f90cf8fd4710
6525798 Need Hardware Capabilities support for AMD Family 10h/sse4a processor
kk208521
parents:
4606
diff
changeset
|
2664 hwcap_flags |= AV_386_AMD_SSE4A; |
f90cf8fd4710
6525798 Need Hardware Capabilities support for AMD Family 10h/sse4a processor
kk208521
parents:
4606
diff
changeset
|
2665 if (*ecx & CPUID_AMD_ECX_LZCNT) |
f90cf8fd4710
6525798 Need Hardware Capabilities support for AMD Family 10h/sse4a processor
kk208521
parents:
4606
diff
changeset
|
2666 hwcap_flags |= AV_386_AMD_LZCNT; |
3446 | 2667 break; |
2668 | |
2669 case X86_VENDOR_Intel: | |
6657 | 2670 if (*edx & CPUID_AMD_EDX_TSCP) |
2671 hwcap_flags |= AV_386_TSCP; | |
3446 | 2672 /* |
2673 * Aarrgh. | |
2674 * Intel uses a different bit in the same word. | |
2675 */ | |
2676 if (*ecx & CPUID_INTC_ECX_AHF64) | |
2677 hwcap_flags |= AV_386_AHF; | |
2678 break; | |
2679 | |
2680 default: | |
2681 break; | |
2682 } | |
0 | 2683 break; |
2684 | |
2685 case X86_VENDOR_TM: | |
1228 | 2686 cp.cp_eax = 0x80860001; |
2687 (void) __cpuid_insn(&cp); | |
2688 cpi->cpi_support[TM_EDX_FEATURES] = cp.cp_edx; | |
0 | 2689 break; |
2690 | |
2691 default: | |
2692 break; | |
2693 } | |
2694 | |
2695 pass4_done: | |
2696 cpi->cpi_pass = 4; | |
2697 return (hwcap_flags); | |
2698 } | |
2699 | |
2700 | |
2701 /* | |
2702 * Simulate the cpuid instruction using the data we previously | |
2703 * captured about this CPU. We try our best to return the truth | |
2704 * about the hardware, independently of kernel support. | |
2705 */ | |
2706 uint32_t | |
1228 | 2707 cpuid_insn(cpu_t *cpu, struct cpuid_regs *cp) |
0 | 2708 { |
2709 struct cpuid_info *cpi; | |
1228 | 2710 struct cpuid_regs *xcp; |
0 | 2711 |
2712 if (cpu == NULL) | |
2713 cpu = CPU; | |
2714 cpi = cpu->cpu_m.mcpu_cpi; | |
2715 | |
2716 ASSERT(cpuid_checkpass(cpu, 3)); | |
2717 | |
2718 /* | |
2719 * CPUID data is cached in two separate places: cpi_std for standard | |
2720 * CPUID functions, and cpi_extd for extended CPUID functions. | |
2721 */ | |
1228 | 2722 if (cp->cp_eax <= cpi->cpi_maxeax && cp->cp_eax < NMAX_CPI_STD) |
2723 xcp = &cpi->cpi_std[cp->cp_eax]; | |
2724 else if (cp->cp_eax >= 0x80000000 && cp->cp_eax <= cpi->cpi_xmaxeax && | |
2725 cp->cp_eax < 0x80000000 + NMAX_CPI_EXTD) | |
2726 xcp = &cpi->cpi_extd[cp->cp_eax - 0x80000000]; | |
0 | 2727 else |
2728 /* | |
2729 * The caller is asking for data from an input parameter which | |
2730 * the kernel has not cached. In this case we go fetch from | |
2731 * the hardware and return the data directly to the user. | |
2732 */ | |
1228 | 2733 return (__cpuid_insn(cp)); |
2734 | |
2735 cp->cp_eax = xcp->cp_eax; | |
2736 cp->cp_ebx = xcp->cp_ebx; | |
2737 cp->cp_ecx = xcp->cp_ecx; | |
2738 cp->cp_edx = xcp->cp_edx; | |
0 | 2739 return (cp->cp_eax); |
2740 } | |
2741 | |
2742 int | |
2743 cpuid_checkpass(cpu_t *cpu, int pass) | |
2744 { | |
2745 return (cpu != NULL && cpu->cpu_m.mcpu_cpi != NULL && | |
2746 cpu->cpu_m.mcpu_cpi->cpi_pass >= pass); | |
2747 } | |
2748 | |
2749 int | |
2750 cpuid_getbrandstr(cpu_t *cpu, char *s, size_t n) | |
2751 { | |
2752 ASSERT(cpuid_checkpass(cpu, 3)); | |
2753 | |
2754 return (snprintf(s, n, "%s", cpu->cpu_m.mcpu_cpi->cpi_brandstr)); | |
2755 } | |
2756 | |
2757 int | |
1228 | 2758 cpuid_is_cmt(cpu_t *cpu) |
0 | 2759 { |
2760 if (cpu == NULL) | |
2761 cpu = CPU; | |
2762 | |
2763 ASSERT(cpuid_checkpass(cpu, 1)); | |
2764 | |
2765 return (cpu->cpu_m.mcpu_cpi->cpi_chipid >= 0); | |
2766 } | |
2767 | |
2768 /* | |
2769 * AMD and Intel both implement the 64-bit variant of the syscall | |
2770 * instruction (syscallq), so if there's -any- support for syscall, | |
2771 * cpuid currently says "yes, we support this". | |
2772 * | |
2773 * However, Intel decided to -not- implement the 32-bit variant of the | |
2774 * syscall instruction, so we provide a predicate to allow our caller | |
2775 * to test that subtlety here. | |
5084 | 2776 * |
2777 * XXPV Currently, 32-bit syscall instructions don't work via the hypervisor, | |
2778 * even in the case where the hardware would in fact support it. | |
0 | 2779 */ |
2780 /*ARGSUSED*/ | |
2781 int | |
2782 cpuid_syscall32_insn(cpu_t *cpu) | |
2783 { | |
2784 ASSERT(cpuid_checkpass((cpu == NULL ? CPU : cpu), 1)); | |
2785 | |
5084 | 2786 #if !defined(__xpv) |
3446 | 2787 if (cpu == NULL) |
2788 cpu = CPU; | |
2789 | |
2790 /*CSTYLED*/ | |
2791 { | |
2792 struct cpuid_info *cpi = cpu->cpu_m.mcpu_cpi; | |
2793 | |
2794 if (cpi->cpi_vendor == X86_VENDOR_AMD && | |
2795 cpi->cpi_xmaxeax >= 0x80000001 && | |
2796 (CPI_FEATURES_XTD_EDX(cpi) & CPUID_AMD_EDX_SYSC)) | |
2797 return (1); | |
2798 } | |
5084 | 2799 #endif |
0 | 2800 return (0); |
2801 } | |
2802 | |
2803 int | |
2804 cpuid_getidstr(cpu_t *cpu, char *s, size_t n) | |
2805 { | |
2806 struct cpuid_info *cpi = cpu->cpu_m.mcpu_cpi; | |
2807 | |
2808 static const char fmt[] = | |
3779
f34a44686f8b
6532527 psrinfo output should show "EAX Page 1" hex value to identify processors
dmick
parents:
3446
diff
changeset
|
2809 "x86 (%s %X family %d model %d step %d clock %d MHz)"; |
0 | 2810 static const char fmt_ht[] = |
3779
f34a44686f8b
6532527 psrinfo output should show "EAX Page 1" hex value to identify processors
dmick
parents:
3446
diff
changeset
|
2811 "x86 (chipid 0x%x %s %X family %d model %d step %d clock %d MHz)"; |
0 | 2812 |
2813 ASSERT(cpuid_checkpass(cpu, 1)); | |
2814 | |
1228 | 2815 if (cpuid_is_cmt(cpu)) |
0 | 2816 return (snprintf(s, n, fmt_ht, cpi->cpi_chipid, |
3779
f34a44686f8b
6532527 psrinfo output should show "EAX Page 1" hex value to identify processors
dmick
parents:
3446
diff
changeset
|
2817 cpi->cpi_vendorstr, cpi->cpi_std[1].cp_eax, |
f34a44686f8b
6532527 psrinfo output should show "EAX Page 1" hex value to identify processors
dmick
parents:
3446
diff
changeset
|
2818 cpi->cpi_family, cpi->cpi_model, |
0 | 2819 cpi->cpi_step, cpu->cpu_type_info.pi_clock)); |
2820 return (snprintf(s, n, fmt, | |
3779
f34a44686f8b
6532527 psrinfo output should show "EAX Page 1" hex value to identify processors
dmick
parents:
3446
diff
changeset
|
2821 cpi->cpi_vendorstr, cpi->cpi_std[1].cp_eax, |
f34a44686f8b
6532527 psrinfo output should show "EAX Page 1" hex value to identify processors
dmick
parents:
3446
diff
changeset
|
2822 cpi->cpi_family, cpi->cpi_model, |
0 | 2823 cpi->cpi_step, cpu->cpu_type_info.pi_clock)); |
2824 } | |
2825 | |
2826 const char * | |
2827 cpuid_getvendorstr(cpu_t *cpu) | |
2828 { | |
2829 ASSERT(cpuid_checkpass(cpu, 1)); | |
2830 return ((const char *)cpu->cpu_m.mcpu_cpi->cpi_vendorstr); | |
2831 } | |
2832 | |
2833 uint_t | |
2834 cpuid_getvendor(cpu_t *cpu) | |
2835 { | |
2836 ASSERT(cpuid_checkpass(cpu, 1)); | |
2837 return (cpu->cpu_m.mcpu_cpi->cpi_vendor); | |
2838 } | |
2839 | |
2840 uint_t | |
2841 cpuid_getfamily(cpu_t *cpu) | |
2842 { | |
2843 ASSERT(cpuid_checkpass(cpu, 1)); | |
2844 return (cpu->cpu_m.mcpu_cpi->cpi_family); | |
2845 } | |
2846 | |
2847 uint_t | |
2848 cpuid_getmodel(cpu_t *cpu) | |
2849 { | |
2850 ASSERT(cpuid_checkpass(cpu, 1)); | |
2851 return (cpu->cpu_m.mcpu_cpi->cpi_model); | |
2852 } | |
2853 | |
2854 uint_t | |
2855 cpuid_get_ncpu_per_chip(cpu_t *cpu) | |
2856 { | |
2857 ASSERT(cpuid_checkpass(cpu, 1)); | |
2858 return (cpu->cpu_m.mcpu_cpi->cpi_ncpu_per_chip); | |
2859 } | |
2860 | |
2861 uint_t | |
1228 | 2862 cpuid_get_ncore_per_chip(cpu_t *cpu) |
2863 { | |
2864 ASSERT(cpuid_checkpass(cpu, 1)); | |
2865 return (cpu->cpu_m.mcpu_cpi->cpi_ncore_per_chip); | |
2866 } | |
2867 | |
2868 uint_t | |
4606 | 2869 cpuid_get_ncpu_sharing_last_cache(cpu_t *cpu) |
2870 { | |
2871 ASSERT(cpuid_checkpass(cpu, 2)); | |
2872 return (cpu->cpu_m.mcpu_cpi->cpi_ncpu_shr_last_cache); | |
2873 } | |
2874 | |
2875 id_t | |
2876 cpuid_get_last_lvl_cacheid(cpu_t *cpu) | |
2877 { | |
2878 ASSERT(cpuid_checkpass(cpu, 2)); | |
2879 return (cpu->cpu_m.mcpu_cpi->cpi_last_lvl_cacheid); | |
2880 } | |
2881 | |
2882 uint_t | |
0 | 2883 cpuid_getstep(cpu_t *cpu) |
2884 { | |
2885 ASSERT(cpuid_checkpass(cpu, 1)); | |
2886 return (cpu->cpu_m.mcpu_cpi->cpi_step); | |
2887 } | |
2888 | |
4581 | 2889 uint_t |
2890 cpuid_getsig(struct cpu *cpu) | |
2891 { | |
2892 ASSERT(cpuid_checkpass(cpu, 1)); | |
2893 return (cpu->cpu_m.mcpu_cpi->cpi_std[1].cp_eax); | |
2894 } | |
2895 | |
2869
324151eecd58
PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents:
2584
diff
changeset
|
2896 uint32_t |
324151eecd58
PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents:
2584
diff
changeset
|
2897 cpuid_getchiprev(struct cpu *cpu) |
324151eecd58
PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents:
2584
diff
changeset
|
2898 { |
324151eecd58
PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents:
2584
diff
changeset
|
2899 ASSERT(cpuid_checkpass(cpu, 1)); |
324151eecd58
PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents:
2584
diff
changeset
|
2900 return (cpu->cpu_m.mcpu_cpi->cpi_chiprev); |
324151eecd58
PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents:
2584
diff
changeset
|
2901 } |
324151eecd58
PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents:
2584
diff
changeset
|
2902 |
324151eecd58
PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents:
2584
diff
changeset
|
2903 const char * |
324151eecd58
PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents:
2584
diff
changeset
|
2904 cpuid_getchiprevstr(struct cpu *cpu) |
324151eecd58
PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents:
2584
diff
changeset
|
2905 { |
324151eecd58
PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents:
2584
diff
changeset
|
2906 ASSERT(cpuid_checkpass(cpu, 1)); |
324151eecd58
PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents:
2584
diff
changeset
|
2907 return (cpu->cpu_m.mcpu_cpi->cpi_chiprevstr); |
324151eecd58
PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents:
2584
diff
changeset
|
2908 } |
324151eecd58
PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents:
2584
diff
changeset
|
2909 |
324151eecd58
PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents:
2584
diff
changeset
|
2910 uint32_t |
324151eecd58
PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents:
2584
diff
changeset
|
2911 cpuid_getsockettype(struct cpu *cpu) |
324151eecd58
PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents:
2584
diff
changeset
|
2912 { |
324151eecd58
PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents:
2584
diff
changeset
|
2913 ASSERT(cpuid_checkpass(cpu, 1)); |
324151eecd58
PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents:
2584
diff
changeset
|
2914 return (cpu->cpu_m.mcpu_cpi->cpi_socket); |
324151eecd58
PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents:
2584
diff
changeset
|
2915 } |
324151eecd58
PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents:
2584
diff
changeset
|
2916 |
9482
42f3d60af7ca
6770233 New model ID for Istanbul processor
Kuriakose Kuruvilla <Kuriakose.Kuruvilla@Sun.COM>
parents:
9370
diff
changeset
|
2917 const char * |
42f3d60af7ca
6770233 New model ID for Istanbul processor
Kuriakose Kuruvilla <Kuriakose.Kuruvilla@Sun.COM>
parents:
9370
diff
changeset
|
2918 cpuid_getsocketstr(cpu_t *cpu) |
42f3d60af7ca
6770233 New model ID for Istanbul processor
Kuriakose Kuruvilla <Kuriakose.Kuruvilla@Sun.COM>
parents:
9370
diff
changeset
|
2919 { |
42f3d60af7ca
6770233 New model ID for Istanbul processor
Kuriakose Kuruvilla <Kuriakose.Kuruvilla@Sun.COM>
parents:
9370
diff
changeset
|
2920 static const char *socketstr = NULL; |
42f3d60af7ca
6770233 New model ID for Istanbul processor
Kuriakose Kuruvilla <Kuriakose.Kuruvilla@Sun.COM>
parents:
9370
diff
changeset
|
2921 struct cpuid_info *cpi; |
42f3d60af7ca
6770233 New model ID for Istanbul processor
Kuriakose Kuruvilla <Kuriakose.Kuruvilla@Sun.COM>
parents:
9370
diff
changeset
|
2922 |
42f3d60af7ca
6770233 New model ID for Istanbul processor
Kuriakose Kuruvilla <Kuriakose.Kuruvilla@Sun.COM>
parents:
9370
diff
changeset
|
2923 ASSERT(cpuid_checkpass(cpu, 1)); |
42f3d60af7ca
6770233 New model ID for Istanbul processor
Kuriakose Kuruvilla <Kuriakose.Kuruvilla@Sun.COM>
parents:
9370
diff
changeset
|
2924 cpi = cpu->cpu_m.mcpu_cpi; |
42f3d60af7ca
6770233 New model ID for Istanbul processor
Kuriakose Kuruvilla <Kuriakose.Kuruvilla@Sun.COM>
parents:
9370
diff
changeset
|
2925 |
42f3d60af7ca
6770233 New model ID for Istanbul processor
Kuriakose Kuruvilla <Kuriakose.Kuruvilla@Sun.COM>
parents:
9370
diff
changeset
|
2926 /* Assume that socket types are the same across the system */ |
42f3d60af7ca
6770233 New model ID for Istanbul processor
Kuriakose Kuruvilla <Kuriakose.Kuruvilla@Sun.COM>
parents:
9370
diff
changeset
|
2927 if (socketstr == NULL) |
42f3d60af7ca
6770233 New model ID for Istanbul processor
Kuriakose Kuruvilla <Kuriakose.Kuruvilla@Sun.COM>
parents:
9370
diff
changeset
|
2928 socketstr = _cpuid_sktstr(cpi->cpi_vendor, cpi->cpi_family, |
42f3d60af7ca
6770233 New model ID for Istanbul processor
Kuriakose Kuruvilla <Kuriakose.Kuruvilla@Sun.COM>
parents:
9370
diff
changeset
|
2929 cpi->cpi_model, cpi->cpi_step); |
42f3d60af7ca
6770233 New model ID for Istanbul processor
Kuriakose Kuruvilla <Kuriakose.Kuruvilla@Sun.COM>
parents:
9370
diff
changeset
|
2930 |
42f3d60af7ca
6770233 New model ID for Istanbul processor
Kuriakose Kuruvilla <Kuriakose.Kuruvilla@Sun.COM>
parents:
9370
diff
changeset
|
2931 |
42f3d60af7ca
6770233 New model ID for Istanbul processor
Kuriakose Kuruvilla <Kuriakose.Kuruvilla@Sun.COM>
parents:
9370
diff
changeset
|
2932 return (socketstr); |
42f3d60af7ca
6770233 New model ID for Istanbul processor
Kuriakose Kuruvilla <Kuriakose.Kuruvilla@Sun.COM>
parents:
9370
diff
changeset
|
2933 } |
42f3d60af7ca
6770233 New model ID for Istanbul processor
Kuriakose Kuruvilla <Kuriakose.Kuruvilla@Sun.COM>
parents:
9370
diff
changeset
|
2934 |
3434 | 2935 int |
2936 cpuid_get_chipid(cpu_t *cpu) | |
0 | 2937 { |
2938 ASSERT(cpuid_checkpass(cpu, 1)); | |
2939 | |
1228 | 2940 if (cpuid_is_cmt(cpu)) |
0 | 2941 return (cpu->cpu_m.mcpu_cpi->cpi_chipid); |
2942 return (cpu->cpu_id); | |
2943 } | |
2944 | |
1228 | 2945 id_t |
3434 | 2946 cpuid_get_coreid(cpu_t *cpu) |
1228 | 2947 { |
2948 ASSERT(cpuid_checkpass(cpu, 1)); | |
2949 return (cpu->cpu_m.mcpu_cpi->cpi_coreid); | |
2950 } | |
2951 | |
0 | 2952 int |
5870
2513339ac53a
6642169 cpu.generic panic during install of snv_76 and later builds
gavinm
parents:
5741
diff
changeset
|
2953 cpuid_get_pkgcoreid(cpu_t *cpu) |
2513339ac53a
6642169 cpu.generic panic during install of snv_76 and later builds
gavinm
parents:
5741
diff
changeset
|
2954 { |
2513339ac53a
6642169 cpu.generic panic during install of snv_76 and later builds
gavinm
parents:
5741
diff
changeset
|
2955 ASSERT(cpuid_checkpass(cpu, 1)); |
2513339ac53a
6642169 cpu.generic panic during install of snv_76 and later builds
gavinm
parents:
5741
diff
changeset
|
2956 return (cpu->cpu_m.mcpu_cpi->cpi_pkgcoreid); |
2513339ac53a
6642169 cpu.generic panic during install of snv_76 and later builds
gavinm
parents:
5741
diff
changeset
|
2957 } |
2513339ac53a
6642169 cpu.generic panic during install of snv_76 and later builds
gavinm
parents:
5741
diff
changeset
|
2958 |
2513339ac53a
6642169 cpu.generic panic during install of snv_76 and later builds
gavinm
parents:
5741
diff
changeset
|
2959 int |
3434 | 2960 cpuid_get_clogid(cpu_t *cpu) |
0 | 2961 { |
2962 ASSERT(cpuid_checkpass(cpu, 1)); | |
2963 return (cpu->cpu_m.mcpu_cpi->cpi_clogid); | |
2964 } | |
2965 | |
11389
dd00b884e84f
6764832 Provide user-level processor groups observability
Alexander Kolbasov <Alexander.Kolbasov@Sun.COM>
parents:
11013
diff
changeset
|
2966 int |
dd00b884e84f
6764832 Provide user-level processor groups observability
Alexander Kolbasov <Alexander.Kolbasov@Sun.COM>
parents:
11013
diff
changeset
|
2967 cpuid_get_cacheid(cpu_t *cpu) |
dd00b884e84f
6764832 Provide user-level processor groups observability
Alexander Kolbasov <Alexander.Kolbasov@Sun.COM>
parents:
11013
diff
changeset
|
2968 { |
dd00b884e84f
6764832 Provide user-level processor groups observability
Alexander Kolbasov <Alexander.Kolbasov@Sun.COM>
parents:
11013
diff
changeset
|
2969 ASSERT(cpuid_checkpass(cpu, 1)); |
dd00b884e84f
6764832 Provide user-level processor groups observability
Alexander Kolbasov <Alexander.Kolbasov@Sun.COM>
parents:
11013
diff
changeset
|
2970 return (cpu->cpu_m.mcpu_cpi->cpi_last_lvl_cacheid); |
dd00b884e84f
6764832 Provide user-level processor groups observability
Alexander Kolbasov <Alexander.Kolbasov@Sun.COM>
parents:
11013
diff
changeset
|
2971 } |
dd00b884e84f
6764832 Provide user-level processor groups observability
Alexander Kolbasov <Alexander.Kolbasov@Sun.COM>
parents:
11013
diff
changeset
|
2972 |
10947
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
2973 uint_t |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
2974 cpuid_get_procnodeid(cpu_t *cpu) |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
2975 { |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
2976 ASSERT(cpuid_checkpass(cpu, 1)); |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
2977 return (cpu->cpu_m.mcpu_cpi->cpi_procnodeid); |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
2978 } |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
2979 |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
2980 uint_t |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
2981 cpuid_get_procnodes_per_pkg(cpu_t *cpu) |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
2982 { |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
2983 ASSERT(cpuid_checkpass(cpu, 1)); |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
2984 return (cpu->cpu_m.mcpu_cpi->cpi_procnodes_per_pkg); |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
2985 } |
2ecbb0a4d189
6843035 Need support for Magny-Cours processors
Srihari Venkatesan <Srihari.Venkatesan@Sun.COM>
parents:
10175
diff
changeset
|
2986 |
10080
29a4a1bb9f3f
6848982 32 bit kernel should use %cr8 to access the TPR when possible
Joe Bonasera <Joe.Bonasera@sun.com>
parents:
9652
diff
changeset
|
2987 /*ARGSUSED*/ |
29a4a1bb9f3f
6848982 32 bit kernel should use %cr8 to access the TPR when possible
Joe Bonasera <Joe.Bonasera@sun.com>
parents:
9652
diff
changeset
|
2988 int |
29a4a1bb9f3f
6848982 32 bit kernel should use %cr8 to access the TPR when possible
Joe Bonasera <Joe.Bonasera@sun.com>
parents:
9652
diff
changeset
|
2989 cpuid_have_cr8access(cpu_t *cpu) |
29a4a1bb9f3f
6848982 32 bit kernel should use %cr8 to access the TPR when possible
Joe Bonasera <Joe.Bonasera@sun.com>
parents:
9652
diff
changeset
|
2990 { |
29a4a1bb9f3f
6848982 32 bit kernel should use %cr8 to access the TPR when possible
Joe Bonasera <Joe.Bonasera@sun.com>
parents:
9652
diff
changeset
|
2991 #if defined(__amd64) |
29a4a1bb9f3f
6848982 32 bit kernel should use %cr8 to access the TPR when possible
Joe Bonasera <Joe.Bonasera@sun.com>
parents:
9652
diff
changeset
|
2992 return (1); |
29a4a1bb9f3f
6848982 32 bit kernel should use %cr8 to access the TPR when possible
Joe Bonasera <Joe.Bonasera@sun.com>
parents:
9652
diff
changeset
|
2993 #else |
29a4a1bb9f3f
6848982 32 bit kernel should use %cr8 to access the TPR when possible
Joe Bonasera <Joe.Bonasera@sun.com>
parents:
9652
diff
changeset
|
2994 struct cpuid_info *cpi; |
29a4a1bb9f3f
6848982 32 bit kernel should use %cr8 to access the TPR when possible
Joe Bonasera <Joe.Bonasera@sun.com>
parents:
9652
diff
changeset
|
2995 |
29a4a1bb9f3f
6848982 32 bit kernel should use %cr8 to access the TPR when possible
Joe Bonasera <Joe.Bonasera@sun.com>
parents:
9652
diff
changeset
|
2996 ASSERT(cpu != NULL); |
29a4a1bb9f3f
6848982 32 bit kernel should use %cr8 to access the TPR when possible
Joe Bonasera <Joe.Bonasera@sun.com>
parents:
9652
diff
changeset
|
2997 cpi = cpu->cpu_m.mcpu_cpi; |
29a4a1bb9f3f
6848982 32 bit kernel should use %cr8 to access the TPR when possible
Joe Bonasera <Joe.Bonasera@sun.com>
parents:
9652
diff
changeset
|
2998 if (cpi->cpi_vendor == X86_VENDOR_AMD && cpi->cpi_maxeax >= 1 && |
29a4a1bb9f3f
6848982 32 bit kernel should use %cr8 to access the TPR when possible
Joe Bonasera <Joe.Bonasera@sun.com>
parents:
9652
diff
changeset
|
2999 (CPI_FEATURES_XTD_ECX(cpi) & CPUID_AMD_ECX_CR8D) != 0) |
29a4a1bb9f3f
6848982 32 bit kernel should use %cr8 to access the TPR when possible
Joe Bonasera <Joe.Bonasera@sun.com>
parents:
9652
diff
changeset
|
3000 return (1); |
29a4a1bb9f3f
6848982 32 bit kernel should use %cr8 to access the TPR when possible
Joe Bonasera <Joe.Bonasera@sun.com>
parents:
9652
diff
changeset
|
3001 return (0); |
29a4a1bb9f3f
6848982 32 bit kernel should use %cr8 to access the TPR when possible
Joe Bonasera <Joe.Bonasera@sun.com>
parents:
9652
diff
changeset
|
3002 #endif |
29a4a1bb9f3f
6848982 32 bit kernel should use %cr8 to access the TPR when possible
Joe Bonasera <Joe.Bonasera@sun.com>
parents:
9652
diff
changeset
|
3003 } |
29a4a1bb9f3f
6848982 32 bit kernel should use %cr8 to access the TPR when possible
Joe Bonasera <Joe.Bonasera@sun.com>
parents:
9652
diff
changeset
|
3004 |
9652
6b40e106879c
6815568 ACPICA enhancements for support of ACPI-based device enumeration earlier in boot
Michael Corcoran <Michael.Corcoran@Sun.COM>
parents:
9482
diff
changeset
|
3005 uint32_t |
6b40e106879c
6815568 ACPICA enhancements for support of ACPI-based device enumeration earlier in boot
Michael Corcoran <Michael.Corcoran@Sun.COM>
parents:
9482
diff
changeset
|
3006 cpuid_get_apicid(cpu_t *cpu) |
6b40e106879c
6815568 ACPICA enhancements for support of ACPI-based device enumeration earlier in boot
Michael Corcoran <Michael.Corcoran@Sun.COM>
parents:
9482
diff
changeset
|
3007 { |
6b40e106879c
6815568 ACPICA enhancements for support of ACPI-based device enumeration earlier in boot
Michael Corcoran <Michael.Corcoran@Sun.COM>
parents:
9482
diff
changeset
|
3008 ASSERT(cpuid_checkpass(cpu, 1)); |
6b40e106879c
6815568 ACPICA enhancements for support of ACPI-based device enumeration earlier in boot
Michael Corcoran <Michael.Corcoran@Sun.COM>
parents:
9482
diff
changeset
|
3009 if (cpu->cpu_m.mcpu_cpi->cpi_maxeax < 1) { |
6b40e106879c
6815568 ACPICA enhancements for support of ACPI-based device enumeration earlier in boot
Michael Corcoran <Michael.Corcoran@Sun.COM>
parents:
9482
diff
changeset
|
3010 return (UINT32_MAX); |
6b40e106879c
6815568 ACPICA enhancements for support of ACPI-based device enumeration earlier in boot
Michael Corcoran <Michael.Corcoran@Sun.COM>
parents:
9482
diff
changeset
|
3011 } else { |
6b40e106879c
6815568 ACPICA enhancements for support of ACPI-based device enumeration earlier in boot
Michael Corcoran <Michael.Corcoran@Sun.COM>
parents:
9482
diff
changeset
|
3012 return (cpu->cpu_m.mcpu_cpi->cpi_apicid); |
6b40e106879c
6815568 ACPICA enhancements for support of ACPI-based device enumeration earlier in boot
Michael Corcoran <Michael.Corcoran@Sun.COM>
parents:
9482
diff
changeset
|
3013 } |
6b40e106879c
6815568 ACPICA enhancements for support of ACPI-based device enumeration earlier in boot
Michael Corcoran <Michael.Corcoran@Sun.COM>
parents:
9482
diff
changeset
|
3014 } |
6b40e106879c
6815568 ACPICA enhancements for support of ACPI-based device enumeration earlier in boot
Michael Corcoran <Michael.Corcoran@Sun.COM>
parents:
9482
diff
changeset
|
3015 |
0 | 3016 void |
3017 cpuid_get_addrsize(cpu_t *cpu, uint_t *pabits, uint_t *vabits) | |
3018 { | |
3019 struct cpuid_info *cpi; | |
3020 | |
3021 if (cpu == NULL) | |
3022 cpu = CPU; | |
3023 cpi = cpu->cpu_m.mcpu_cpi; | |
3024 | |
3025 ASSERT(cpuid_checkpass(cpu, 1)); | |
3026 | |
3027 if (pabits) | |
3028 *pabits = cpi->cpi_pabits; | |
3029 if (vabits) | |
3030 *vabits = cpi->cpi_vabits; | |
3031 } | |
3032 | |
3033 /* | |
3034 * Returns the number of data TLB entries for a corresponding | |
3035 * pagesize. If it can't be computed, or isn't known, the | |
3036 * routine returns zero. If you ask about an architecturally | |
3037 * impossible pagesize, the routine will panic (so that the | |
3038 * hat implementor knows that things are inconsistent.) | |
3039 */ | |
3040 uint_t | |
3041 cpuid_get_dtlb_nent(cpu_t *cpu, size_t pagesize) | |
3042 { | |
3043 struct cpuid_info *cpi; | |
3044 uint_t dtlb_nent = 0; | |
3045 | |
3046 if (cpu == NULL) | |
3047 cpu = CPU; | |
3048 cpi = cpu->cpu_m.mcpu_cpi; | |
3049 | |
3050 ASSERT(cpuid_checkpass(cpu, 1)); | |
3051 | |
3052 /* | |
3053 * Check the L2 TLB info | |
3054 */ | |
3055 if (cpi->cpi_xmaxeax >= 0x80000006) { | |
1228 | 3056 struct cpuid_regs *cp = &cpi->cpi_extd[6]; |
0 | 3057 |
3058 switch (pagesize) { | |
3059 | |
3060 case 4 * 1024: | |
3061 /* | |
3062 * All zero in the top 16 bits of the register | |
3063 * indicates a unified TLB. Size is in low 16 bits. | |
3064 */ | |
3065 if ((cp->cp_ebx & 0xffff0000) == 0) | |
3066 dtlb_nent = cp->cp_ebx & 0x0000ffff; | |
3067 else | |
3068 dtlb_nent = BITX(cp->cp_ebx, 27, 16); | |
3069 break; | |
3070 | |
3071 case 2 * 1024 * 1024: | |
3072 if ((cp->cp_eax & 0xffff0000) == 0) | |
3073 dtlb_nent = cp->cp_eax & 0x0000ffff; | |
3074 else | |
3075 dtlb_nent = BITX(cp->cp_eax, 27, 16); | |
3076 break; | |
3077 | |
3078 default: | |
3079 panic("unknown L2 pagesize"); | |
3080 /*NOTREACHED*/ | |
3081 } | |
3082 } | |
3083 | |
3084 if (dtlb_nent != 0) | |
3085 return (dtlb_nent); | |
3086 | |
3087 /* | |
3088 * No L2 TLB support for this size, try L1. | |
3089 */ | |
3090 if (cpi->cpi_xmaxeax >= 0x80000005) { | |
1228 | 3091 struct cpuid_regs *cp = &cpi->cpi_extd[5]; |
0 | 3092 |
3093 switch (pagesize) { | |
3094 case 4 * 1024: | |
3095 dtlb_nent = BITX(cp->cp_ebx, 23, 16); | |
3096 break; | |
3097 case 2 * 1024 * 1024: | |
3098 dtlb_nent = BITX(cp->cp_eax, 23, 16); | |
3099 break; | |
3100 default: | |
3101 panic("unknown L1 d-TLB pagesize"); | |
3102 /*NOTREACHED*/ | |
3103 } | |
3104 } | |
3105 | |
3106 return (dtlb_nent); | |
3107 } | |
3108 | |
3109 /* | |
3110 * Return 0 if the erratum is not present or not applicable, positive | |
3111 * if it is, and negative if the status of the erratum is unknown. | |
3112 * | |
3113 * See "Revision Guide for AMD Athlon(tm) 64 and AMD Opteron(tm) | |
359
a88cb999e7ec
6288246 amd64 kernel needs to detect AMD Opteron erratum 131
kucharsk
parents:
0
diff
changeset
|
3114 * Processors" #25759, Rev 3.57, August 2005 |
0 | 3115 */ |
3116 int | |
3117 cpuid_opteron_erratum(cpu_t *cpu, uint_t erratum) | |
3118 { | |
3119 struct cpuid_info *cpi = cpu->cpu_m.mcpu_cpi; | |
1228 | 3120 uint_t eax; |
0 | 3121 |
2584
c8f937287646
6462189 cpuid_opteron_erratum does not bail out on non-AMD64 AMD CPUs
sethg
parents:
2519
diff
changeset
|
3122 /* |
c8f937287646
6462189 cpuid_opteron_erratum does not bail out on non-AMD64 AMD CPUs
sethg
parents:
2519
diff
changeset
|
3123 * Bail out if this CPU isn't an AMD CPU, or if it's |
c8f937287646
6462189 cpuid_opteron_erratum does not bail out on non-AMD64 AMD CPUs
sethg
parents:
2519
diff
changeset
|
3124 * a legacy (32-bit) AMD CPU. |
c8f937287646
6462189 cpuid_opteron_erratum does not bail out on non-AMD64 AMD CPUs
sethg
parents:
2519
diff
changeset
|
3125 */ |
c8f937287646
6462189 cpuid_opteron_erratum does not bail out on non-AMD64 AMD CPUs
sethg
parents:
2519
diff
changeset
|
3126 if (cpi->cpi_vendor != X86_VENDOR_AMD || |
4265
6be078c4d3b4
6555108 workarounds being applied for errata not present in greyhound processors
kchow
parents:
3779
diff
changeset
|
3127 cpi->cpi_family == 4 || cpi->cpi_family == 5 || |
6be078c4d3b4
6555108 workarounds being applied for errata not present in greyhound processors
kchow
parents:
3779
diff
changeset
|
3128 cpi->cpi_family == 6) |
2869
324151eecd58
PSARC 2006/564 FMA for Athlon 64 and Opteron Rev F/G Processors
gavinm
parents:
2584
diff
changeset
|
3129 |
0 | 3130 return (0); |
3131 | |
3132 eax = cpi->cpi_std[1].cp_eax; | |
3133 | |
3134 #define SH_B0(eax) (eax == 0xf40 || eax == 0xf50) | |
3135 #define SH_B3(eax) (eax == 0xf51) | |
1582
eb879d43ab47
6323525 Mutual exclusion primitives don't work as expected on Opteron systems
kchow
parents:
1414
diff
changeset
|
3136 #define B(eax) (SH_B0(eax) || SH_B3(eax)) |
0 | 3137 |
3138 #define SH_C0(eax) (eax == 0xf48 || eax == 0xf58) | |
3139 | |
3140 #define SH_CG(eax) (eax == 0xf4a || eax == 0xf5a || eax == 0xf7a) | |
3141 #define DH_CG(eax) (eax == 0xfc0 || eax == 0xfe0 || eax == 0xff0) | |
3142 #define CH_CG(eax) (eax == 0xf82 || eax == 0xfb2) | |
1582
eb879d43ab47
6323525 Mutual exclusion primitives don't work as expected on Opteron systems
kchow
parents:
1414
diff
changeset
|
3143 #define CG(eax) (SH_CG(eax) || DH_CG(eax) || CH_CG(eax)) |
0 | 3144 |
3145 #define SH_D0(eax) (eax == 0x10f40 || eax == 0x10f50 || eax == 0x10f70) | |
3146 #define DH_D0(eax) (eax == 0x10fc0 || eax == 0x10ff0) | |
3147 #define CH_D0(eax) (eax == 0x10f80 || eax == 0x10fb0) | |
1582
eb879d43ab47
6323525 Mutual exclusion primitives don't work as expected on Opteron systems
kchow
parents:
1414
diff
changeset
|
3148 #define D0(eax) (SH_D0(eax) || DH_D0(eax) || CH_D0(eax)) |
0 | 3149 |
3150 #define SH_E0(eax) (eax == 0x20f50 || eax == 0x20f40 || eax == 0x20f70) | |
3151 #define JH_E1(eax) (eax == 0x20f10) /* JH8_E0 had 0x20f30 */ | |
3152 #define DH_E3(eax) (eax == 0x20fc0 || eax == 0x20ff0) | |
3153 #define SH_E4(eax) (eax == 0x20f51 || eax == 0x20f71) | |
3154 #define BH_E4(eax) (eax == 0x20fb1) | |
3155 #define SH_E5(eax) (eax == 0x20f42) | |
3156 #define DH_E6(eax) (eax == 0x20ff2 || eax == 0x20fc2) | |
3157 #define JH_E6(eax) (eax == 0x20f12 || eax == 0x20f32) | |
1582
eb879d43ab47
6323525 Mutual exclusion primitives don't work as expected on Opteron systems
kchow
parents:
1414
diff
changeset
|
3158 #define EX(eax) (SH_E0(eax) || JH_E1(eax) || DH_E3(eax) || \ |
eb879d43ab47
6323525 Mutual exclusion primitives don't work as expected on Opteron systems
kchow
parents:
1414
diff
changeset
|
3159 SH_E4(eax) || BH_E4(eax) || SH_E5(eax) || \ |
eb879d43ab47
6323525 Mutual exclusion primitives don't work as expected on Opteron systems
kchow
parents:
1414
diff
changeset
|
3160 DH_E6(eax) || JH_E6(eax)) |
0 | 3161 |
6691
f8848c7acc9e
6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents:
6671
diff
changeset
|
3162 #define DR_AX(eax) (eax == 0x100f00 || eax == 0x100f01 || eax == 0x100f02) |
f8848c7acc9e
6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents:
6671
diff
changeset
|
3163 #define DR_B0(eax) (eax == 0x100f20) |
f8848c7acc9e
6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents:
6671
diff
changeset
|
3164 #define DR_B1(eax) (eax == 0x100f21) |
f8848c7acc9e
6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents:
6671
diff
changeset
|
3165 #define DR_BA(eax) (eax == 0x100f2a) |
f8848c7acc9e
6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents:
6671
diff
changeset
|
3166 #define DR_B2(eax) (eax == 0x100f22) |
f8848c7acc9e
6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents:
6671
diff
changeset
|
3167 #define DR_B3(eax) (eax == 0x100f23) |
f8848c7acc9e
6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents:
6671
diff
changeset
|
3168 #define RB_C0(eax) (eax == 0x100f40) |
f8848c7acc9e
6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents:
6671
diff
changeset
|
3169 |
0 | 3170 switch (erratum) { |
3171 case 1: | |
4265
6be078c4d3b4
6555108 workarounds being applied for errata not present in greyhound processors
kchow
parents:
3779
diff
changeset
|
3172 return (cpi->cpi_family < 0x10); |
0 | 3173 case 51: /* what does the asterisk mean? */ |
3174 return (B(eax) || SH_C0(eax) || CG(eax)); | |
3175 case 52: | |
3176 return (B(eax)); | |
3177 case 57: | |
6691
f8848c7acc9e
6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents:
6671
diff
changeset
|
3178 return (cpi->cpi_family <= 0x11); |
0 | 3179 case 58: |
3180 return (B(eax)); | |
3181 case 60: | |
6691
f8848c7acc9e
6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents:
6671
diff
changeset
|
3182 return (cpi->cpi_family <= 0x11); |
0 | 3183 case 61: |
3184 case 62: | |
3185 case 63: | |
3186 case 64: | |
3187 case 65: | |
3188 case 66: | |
3189 case 68: | |
3190 case 69: | |
3191 case 70: | |
3192 case 71: | |
3193 return (B(eax)); | |
3194 case 72: | |
3195 return (SH_B0(eax)); | |
3196 case 74: | |
3197 return (B(eax)); | |
3198 case 75: | |
4265
6be078c4d3b4
6555108 workarounds being applied for errata not present in greyhound processors
kchow
parents:
3779
diff
changeset
|
3199 return (cpi->cpi_family < 0x10); |
0 | 3200 case 76: |
3201 return (B(eax)); | |
3202 case 77: | |
6691
f8848c7acc9e
6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents:
6671
diff
changeset
|
3203 return (cpi->cpi_family <= 0x11); |
0 | 3204 case 78: |
3205 return (B(eax) || SH_C0(eax)); | |
3206 case 79: | |
3207 return (B(eax) || SH_C0(eax) || CG(eax) || D0(eax) || EX(eax)); | |
3208 case 80: | |
3209 case 81: | |
3210 case 82: | |
3211 return (B(eax)); | |
3212 case 83: | |
3213 return (B(eax) || SH_C0(eax) || CG(eax)); | |
3214 case 85: | |
4265
6be078c4d3b4
6555108 workarounds being applied for errata not present in greyhound processors
kchow
parents:
3779
diff
changeset
|
3215 return (cpi->cpi_family < 0x10); |
0 | 3216 case 86: |
3217 return (SH_C0(eax) || CG(eax)); | |
3218 case 88: | |
3219 #if !defined(__amd64) | |
3220 return (0); | |
3221 #else | |
3222 return (B(eax) || SH_C0(eax)); | |
3223 #endif | |
3224 case 89: | |
4265
6be078c4d3b4
6555108 workarounds being applied for errata not present in greyhound processors
kchow
parents:
3779
diff
changeset
|
3225 return (cpi->cpi_family < 0x10); |
0 | 3226 case 90: |
3227 return (B(eax) || SH_C0(eax) || CG(eax)); | |
3228 case 91: | |
3229 case 92: | |
3230 return (B(eax) || SH_C0(eax)); | |
3231 case 93: | |
3232 return (SH_C0(eax)); | |
3233 case 94: | |
3234 return (B(eax) || SH_C0(eax) || CG(eax)); | |
3235 case 95: | |
3236 #if !defined(__amd64) | |
3237 return (0); | |
3238 #else | |
3239 return (B(eax) || SH_C0(eax)); | |
3240 #endif | |
3241 case 96: | |
3242 return (B(eax) || SH_C0(eax) || CG(eax)); | |
3243 case 97: | |
3244 case 98: | |
3245 return (SH_C0(eax) || CG(eax)); | |
3246 case 99: | |
3247 return (B(eax) || SH_C0(eax) || CG(eax) || D0(eax)); | |
3248 case 100: | |
3249 return (B(eax) || SH_C0(eax)); | |
3250 case 101: | |
3251 case 103: | |
3252 return (B(eax) || SH_C0(eax) || CG(eax) || D0(eax)); | |
3253 case 104: | |
3254 return (SH_C0(eax) || CG(eax) || D0(eax)); | |
3255 case 105: | |
3256 case 106: | |
3257 case 107: | |
3258 return (B(eax) || SH_C0(eax) || CG(eax) || D0(eax)); | |
3259 case 108: | |
3260 return (DH_CG(eax)); | |
3261 case 109: | |
3262 return (SH_C0(eax) || CG(eax) || D0(eax)); | |
3263 case 110: | |
3264 return (D0(eax) || EX(eax)); | |
3265 case 111: | |
3266 return (CG(eax)); | |
3267 case 112: | |
3268 return (B(eax) || SH_C0(eax) || CG(eax) || D0(eax) || EX(eax)); | |
3269 case 113: | |
3270 return (eax == 0x20fc0); | |
3271 case 114: | |
3272 return (SH_E0(eax) || JH_E1(eax) || DH_E3(eax)); | |
3273 case 115: | |
3274 return (SH_E0(eax) || JH_E1(eax)); | |
3275 case 116: | |
3276 return (SH_E0(eax) || JH_E1(eax) || DH_E3(eax)); | |
3277 case 117: | |
3278 return (B(eax) || SH_C0(eax) || CG(eax) || D0(eax)); | |
3279 case 118: | |
3280 return (SH_E0(eax) || JH_E1(eax) || SH_E4(eax) || BH_E4(eax) || | |
3281 JH_E6(eax)); | |
3282 case 121: | |
3283 return (B(eax) || SH_C0(eax) || CG(eax) || D0(eax) || EX(eax)); | |
3284 case 122: | |
6691
f8848c7acc9e
6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents:
6671
diff
changeset
|
3285 return (cpi->cpi_family < 0x10 || cpi->cpi_family == 0x11); |
0 | 3286 case 123: |
3287 return (JH_E1(eax) || BH_E4(eax) || JH_E6(eax)); | |
359
a88cb999e7ec
6288246 amd64 kernel needs to detect AMD Opteron erratum 131
kucharsk
parents:
0
diff
changeset
|
3288 case 131: |
4265
6be078c4d3b4
6555108 workarounds being applied for errata not present in greyhound processors
kchow
parents:
3779
diff
changeset
|
3289 return (cpi->cpi_family < 0x10); |
938
2d438f28c673
6336786 time doesn't fly when CPUs are not having fun
esaxe
parents:
789
diff
changeset
|
3290 case 6336786: |
2d438f28c673
6336786 time doesn't fly when CPUs are not having fun
esaxe
parents:
789
diff
changeset
|
3291 /* |
2d438f28c673
6336786 time doesn't fly when CPUs are not having fun
esaxe
parents:
789
diff
changeset
|
3292 * Test for AdvPowerMgmtInfo.TscPStateInvariant |
4265
6be078c4d3b4
6555108 workarounds being applied for errata not present in greyhound processors
kchow
parents:
3779
diff
changeset
|
3293 * if this is a K8 family or newer processor |
938
2d438f28c673
6336786 time doesn't fly when CPUs are not having fun
esaxe
parents:
789
diff
changeset
|
3294 */ |
2d438f28c673
6336786 time doesn't fly when CPUs are not having fun
esaxe
parents:
789
diff
changeset
|
3295 if (CPI_FAMILY(cpi) == 0xf) { |
1228 | 3296 struct cpuid_regs regs; |
3297 regs.cp_eax = 0x80000007; | |
3298 (void) __cpuid_insn(®s); | |
3299 return (!(regs.cp_edx & 0x100)); | |
938
2d438f28c673
6336786 time doesn't fly when CPUs are not having fun
esaxe
parents:
789
diff
changeset
|
3300 } |
2d438f28c673
6336786 time doesn't fly when CPUs are not having fun
esaxe
parents:
789
diff
changeset
|
3301 return (0); |
1582
eb879d43ab47
6323525 Mutual exclusion primitives don't work as expected on Opteron systems
kchow
parents:
1414
diff
changeset
|
3302 case 6323525: |
eb879d43ab47
6323525 Mutual exclusion primitives don't work as expected on Opteron systems
kchow
parents:
1414
diff
changeset
|
3303 return (((((eax >> 12) & 0xff00) + (eax & 0xf00)) | |
eb879d43ab47
6323525 Mutual exclusion primitives don't work as expected on Opteron systems
kchow
parents:
1414
diff
changeset
|
3304 (((eax >> 4) & 0xf) | ((eax >> 12) & 0xf0))) < 0xf40); |
eb879d43ab47
6323525 Mutual exclusion primitives don't work as expected on Opteron systems
kchow
parents:
1414
diff
changeset
|
3305 |
6691
f8848c7acc9e
6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents:
6671
diff
changeset
|
3306 case 6671130: |
f8848c7acc9e
6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents:
6671
diff
changeset
|
3307 /* |
f8848c7acc9e
6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents:
6671
diff
changeset
|
3308 * check for processors (pre-Shanghai) that do not provide |
f8848c7acc9e
6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents:
6671
diff
changeset
|
3309 * optimal management of 1gb ptes in its tlb. |
f8848c7acc9e
6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents:
6671
diff
changeset
|
3310 */ |
f8848c7acc9e
6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents:
6671
diff
changeset
|
3311 return (cpi->cpi_family == 0x10 && cpi->cpi_model < 4); |
f8848c7acc9e
6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents:
6671
diff
changeset
|
3312 |
f8848c7acc9e
6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents:
6671
diff
changeset
|
3313 case 298: |
f8848c7acc9e
6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents:
6671
diff
changeset
|
3314 return (DR_AX(eax) || DR_B0(eax) || DR_B1(eax) || DR_BA(eax) || |
f8848c7acc9e
6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents:
6671
diff
changeset
|
3315 DR_B2(eax) || RB_C0(eax)); |
f8848c7acc9e
6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents:
6671
diff
changeset
|
3316 |
f8848c7acc9e
6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents:
6671
diff
changeset
|
3317 default: |
f8848c7acc9e
6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents:
6671
diff
changeset
|
3318 return (-1); |
f8848c7acc9e
6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents:
6671
diff
changeset
|
3319 |
f8848c7acc9e
6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents:
6671
diff
changeset
|
3320 } |
f8848c7acc9e
6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents:
6671
diff
changeset
|
3321 } |
f8848c7acc9e
6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents:
6671
diff
changeset
|
3322 |
f8848c7acc9e
6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents:
6671
diff
changeset
|
3323 /* |
f8848c7acc9e
6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents:
6671
diff
changeset
|
3324 * Determine if specified erratum is present via OSVW (OS Visible Workaround). |
f8848c7acc9e
6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents:
6671
diff
changeset
|
3325 * Return 1 if erratum is present, 0 if not present and -1 if indeterminate. |
f8848c7acc9e
6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents:
6671
diff
changeset
|
3326 */ |
f8848c7acc9e
6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents:
6671
diff
changeset
|
3327 int |
f8848c7acc9e
6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents:
6671
diff
changeset
|
3328 osvw_opteron_erratum(cpu_t *cpu, uint_t erratum) |
f8848c7acc9e
6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents:
6671
diff
changeset
|
3329 { |
f8848c7acc9e
6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents:
6671
diff
changeset
|
3330 struct cpuid_info *cpi; |
f8848c7acc9e
6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents:
6671
diff
changeset
|
3331 uint_t osvwid; |
f8848c7acc9e
6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents:
6671
diff
changeset
|
3332 static int osvwfeature = -1; |
f8848c7acc9e
6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents:
6671
diff
changeset
|
3333 uint64_t osvwlength; |
f8848c7acc9e
6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents:
6671
diff
changeset
|
3334 |
f8848c7acc9e
6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents:
6671
diff
changeset
|
3335 |
f8848c7acc9e
6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents:
6671
diff
changeset
|
3336 cpi = cpu->cpu_m.mcpu_cpi; |
f8848c7acc9e
6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents:
6671
diff
changeset
|
3337 |
f8848c7acc9e
6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents:
6671
diff
changeset
|
3338 /* confirm OSVW supported */ |
f8848c7acc9e
6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents:
6671
diff
changeset
|
3339 if (osvwfeature == -1) { |
f8848c7acc9e
6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents:
6671
diff
changeset
|
3340 osvwfeature = cpi->cpi_extd[1].cp_ecx & CPUID_AMD_ECX_OSVW; |
f8848c7acc9e
6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents:
6671
diff
changeset
|
3341 } else { |
f8848c7acc9e
6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents:
6671
diff
changeset
|
3342 /* assert that osvw feature setting is consistent on all cpus */ |
f8848c7acc9e
6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents:
6671
diff
changeset
|
3343 ASSERT(osvwfeature == |
f8848c7acc9e
6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents:
6671
diff
changeset
|
3344 (cpi->cpi_extd[1].cp_ecx & CPUID_AMD_ECX_OSVW)); |
f8848c7acc9e
6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents:
6671
diff
changeset
|
3345 } |
f8848c7acc9e
6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents:
6671
diff
changeset
|
3346 if (!osvwfeature) |
f8848c7acc9e
6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents:
6671
diff
changeset
|
3347 return (-1); |
f8848c7acc9e
6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents:
6671
diff
changeset
|
3348 |
f8848c7acc9e
6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents:
6671
diff
changeset
|
3349 osvwlength = rdmsr(MSR_AMD_OSVW_ID_LEN) & OSVW_ID_LEN_MASK; |
f8848c7acc9e
6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents:
6671
diff
changeset
|
3350 |
f8848c7acc9e
6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents:
6671
diff
changeset
|
3351 switch (erratum) { |
f8848c7acc9e
6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents:
6671
diff
changeset
|
3352 case 298: /* osvwid is 0 */ |
f8848c7acc9e
6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents:
6671
diff
changeset
|
3353 osvwid = 0; |
f8848c7acc9e
6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents:
6671
diff
changeset
|
3354 if (osvwlength <= (uint64_t)osvwid) { |
f8848c7acc9e
6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents:
6671
diff
changeset
|
3355 /* osvwid 0 is unknown */ |
f8848c7acc9e
6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents:
6671
diff
changeset
|
3356 return (-1); |
f8848c7acc9e
6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents:
6671
diff
changeset
|
3357 } |
f8848c7acc9e
6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents:
6671
diff
changeset
|
3358 |
f8848c7acc9e
6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents:
6671
diff
changeset
|
3359 /* |
f8848c7acc9e
6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents:
6671
diff
changeset
|
3360 * Check the OSVW STATUS MSR to determine the state |
f8848c7acc9e
6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents:
6671
diff
changeset
|
3361 * of the erratum where: |
f8848c7acc9e
6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents:
6671
diff
changeset
|
3362 * 0 - fixed by HW |
f8848c7acc9e
6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents:
6671
diff
changeset
|
3363 * 1 - BIOS has applied the workaround when BIOS |
f8848c7acc9e
6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents:
6671
diff
changeset
|
3364 * workaround is available. (Or for other errata, |
f8848c7acc9e
6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents:
6671
diff
changeset
|
3365 * OS workaround is required.) |
f8848c7acc9e
6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents:
6671
diff
changeset
|
3366 * For a value of 1, caller will confirm that the |
f8848c7acc9e
6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents:
6671
diff
changeset
|
3367 * erratum 298 workaround has indeed been applied by BIOS. |
f8848c7acc9e
6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents:
6671
diff
changeset
|
3368 * |
f8848c7acc9e
6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents:
6671
diff
changeset
|
3369 * A 1 may be set in cpus that have a HW fix |
f8848c7acc9e
6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents:
6671
diff
changeset
|
3370 * in a mixed cpu system. Regarding erratum 298: |
f8848c7acc9e
6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents:
6671
diff
changeset
|
3371 * In a multiprocessor platform, the workaround above |
f8848c7acc9e
6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents:
6671
diff
changeset
|
3372 * should be applied to all processors regardless of |
f8848c7acc9e
6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents:
6671
diff
changeset
|
3373 * silicon revision when an affected processor is |
f8848c7acc9e
6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents:
6671
diff
changeset
|
3374 * present. |
f8848c7acc9e
6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents:
6671
diff
changeset
|
3375 */ |
f8848c7acc9e
6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents:
6671
diff
changeset
|
3376 |
f8848c7acc9e
6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents:
6671
diff
changeset
|
3377 return (rdmsr(MSR_AMD_OSVW_STATUS + |
f8848c7acc9e
6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents:
6671
diff
changeset
|
3378 (osvwid / OSVW_ID_CNT_PER_MSR)) & |
f8848c7acc9e
6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents:
6671
diff
changeset
|
3379 (1ULL << (osvwid % OSVW_ID_CNT_PER_MSR))); |
f8848c7acc9e
6671130 Shanghai provides better TLB management for 1GB pages
kchow
parents:
6671
diff
changeset
|
3380 |
0 | 3381 default: |
3382 return (-1); | |
3383 } | |
3384 } | |
3385 | |
3386 static const char assoc_str[] = "associativity"; | |
3387 static const char line_str[] = "line-size"; | |
3388 static const char size_str[] = "size"; | |
3389 | |
3390 static void | |
3391 add_cache_prop(dev_info_t *devi, const char *label, const char *type, | |
3392 uint32_t val) | |
3393 { | |
3394 char buf[128]; | |
3395 | |
3396 /* | |
3397 * ndi_prop_update_int() is used because it is desirable for | |
3398 * DDI_PROP_HW_DEF and DDI_PROP_DONTSLEEP to be set. | |
3399 */ | |
3400 if (snprintf(buf, sizeof (buf), "%s-%s", label, type) < sizeof (buf)) | |
3401 (void) ndi_prop_update_int(DDI_DEV_T_NONE, devi, buf, val); | |
3402 } | |
3403 | |
3404 /* | |
3405 * Intel-style cache/tlb description | |
3406 * | |
3407 * Standard cpuid level 2 gives a randomly ordered | |
3408 * selection of tags that index into a table that describes | |
3409 * cache and tlb properties. | |
3410 */ | |
3411 | |
3412 static const char l1_icache_str[] = "l1-icache"; | |
3413 static const char l1_dcache_str[] = "l1-dcache"; | |
3414 static const char l2_cache_str[] = "l2-cache"; | |
3446 | 3415 static const char l3_cache_str[] = "l3-cache"; |
0 | 3416 static const char itlb4k_str[] = "itlb-4K"; |
3417 static const char dtlb4k_str[] = "dtlb-4K"; | |
6964
3eb8a0c8b90a
6667592 Mismatch between intel_ctab array and processor specification for the cache descriptors
vd224797
parents:
6691
diff
changeset
|
3418 static const char itlb2M_str[] = "itlb-2M"; |
0 | 3419 static const char itlb4M_str[] = "itlb-4M"; |
3420 static const char dtlb4M_str[] = "dtlb-4M"; | |
6334
950d3f34a725
6662206 Add new CPUID.2 descriptors for upcoming Intel processor
ksadhukh
parents:
6317
diff
changeset
|
3421 static const char dtlb24_str[] = "dtlb0-2M-4M"; |
0 | 3422 static const char itlb424_str[] = "itlb-4K-2M-4M"; |
6334
950d3f34a725
6662206 Add new CPUID.2 descriptors for upcoming Intel processor
ksadhukh
parents:
6317
diff
changeset
|
3423 static const char itlb24_str[] = "itlb-2M-4M"; |
0 | 3424 static const char dtlb44_str[] = "dtlb-4K-4M"; |
3425 static const char sl1_dcache_str[] = "sectored-l1-dcache"; | |
3426 static const char sl2_cache_str[] = "sectored-l2-cache"; | |
3427 static const char itrace_str[] = "itrace-cache"; | |
3428 static const char sl3_cache_str[] = "sectored-l3-cache"; | |
6334
950d3f34a725
6662206 Add new CPUID.2 descriptors for upcoming Intel processor
ksadhukh
parents:
6317
diff
changeset
|
3429 static const char sh_l2_tlb4k_str[] = "shared-l2-tlb-4k"; |
0 | 3430 |
3431 static const struct cachetab { | |
3432 uint8_t ct_code; | |
3433 uint8_t ct_assoc; | |
3434 uint16_t ct_line_size; | |
3435 size_t ct_size; | |
3436 const char *ct_label; | |
3437 } intel_ctab[] = { | |
6964
3eb8a0c8b90a
6667592 Mismatch between intel_ctab array and processor specification for the cache descriptors
vd224797
parents:
6691
diff
changeset
|
3438 /* |
3eb8a0c8b90a
6667592 Mismatch between intel_ctab array and processor specification for the cache descriptors
vd224797
parents:
6691
diff
changeset
|
3439 * maintain descending order! |
3eb8a0c8b90a
6667592 Mismatch between intel_ctab array and processor specification for the cache descriptors
vd224797
parents:
6691
diff
changeset
|
3440 * |
3eb8a0c8b90a
6667592 Mismatch between intel_ctab array and processor specification for the cache descriptors
vd224797
parents:
6691
diff
changeset
|
3441 * Codes ignored - Reason |
3eb8a0c8b90a
6667592 Mismatch between intel_ctab array and processor specification for the cache descriptors
vd224797
parents:
6691
diff
changeset
|
3442 * ---------------------- |
3eb8a0c8b90a
6667592 Mismatch between intel_ctab array and processor specification for the cache descriptors
vd224797
parents:
6691
diff
changeset
|
3443 * 40H - intel_cpuid_4_cache_info() disambiguates l2/l3 cache |
3eb8a0c8b90a
6667592 Mismatch between intel_ctab array and processor specification for the cache descriptors
vd224797
parents:
6691
diff
changeset
|
3444 * f0H/f1H - Currently we do not interpret prefetch size by design |
3eb8a0c8b90a
6667592 Mismatch between intel_ctab array and processor specification for the cache descriptors
vd224797
parents:
6691
diff
changeset
|
3445 */ |
6334
950d3f34a725
6662206 Add new CPUID.2 descriptors for upcoming Intel processor
ksadhukh
parents:
6317
diff
changeset
|
3446 { 0xe4, 16, 64, 8*1024*1024, l3_cache_str}, |
950d3f34a725
6662206 Add new CPUID.2 descriptors for upcoming Intel processor
ksadhukh
parents:
6317
diff
changeset
|
3447 { 0xe3, 16, 64, 4*1024*1024, l3_cache_str}, |
950d3f34a725
6662206 Add new CPUID.2 descriptors for upcoming Intel processor
ksadhukh
parents:
6317
diff
changeset
|
3448 { 0xe2, 16, 64, 2*1024*1024, l3_cache_str}, |
950d3f34a725
6662206 Add new CPUID.2 descriptors for upcoming Intel processor
ksadhukh
parents:
6317
diff
changeset
|
3449 { 0xde, 12, 64, 6*1024*1024, l3_cache_str}, |
950d3f34a725
6662206 Add new CPUID.2 descriptors for upcoming Intel processor
ksadhukh
parents:
6317
diff
changeset
|
3450 { 0xdd, 12, 64, 3*1024*1024, l3_cache_str}, |
950d3f34a725
6662206 Add new CPUID.2 descriptors for upcoming Intel processor
ksadhukh
parents:
6317
diff
changeset
|
3451 { 0xdc, 12, 64, ((1*1024*1024)+(512*1024)), l3_cache_str}, |
950d3f34a725
6662206 Add new CPUID.2 descriptors for upcoming Intel processor
ksadhukh
parents:
6317
diff
changeset
|
3452 { 0xd8, 8, 64, 4*1024*1024, l3_cache_str}, |
950d3f34a725
6662206 Add new CPUID.2 descriptors for upcoming Intel processor
ksadhukh
parents:
6317
diff
changeset
|
3453 { 0xd7, 8, 64, 2*1024*1024, l3_cache_str}, |
950d3f34a725
6662206 Add new CPUID.2 descriptors for upcoming Intel processor
ksadhukh
parents:
6317
diff
changeset
|
3454 { 0xd6, 8, 64, 1*1024*1024, l3_cache_str}, |
950d3f34a725
6662206 Add new CPUID.2 descriptors for upcoming Intel processor
ksadhukh
parents:
6317
diff
changeset
|
3455 { 0xd2, 4, 64, 2*1024*1024, l3_cache_str}, |
950d3f34a725
6662206 Add new CPUID.2 descriptors for upcoming Intel processor
ksadhukh
parents:
6317
diff
changeset
|
3456 { 0xd1, 4, 64, 1*1024*1024, l3_cache_str}, |
950d3f34a725
6662206 Add new CPUID.2 descriptors for upcoming Intel processor
ksadhukh
parents:
6317
diff
changeset
|
3457 { 0xd0, 4, 64, 512*1024, l3_cache_str}, |
950d3f34a725
6662206 Add new CPUID.2 descriptors for upcoming Intel processor
ksadhukh
parents:
6317
diff
changeset
|
3458 { 0xca, 4, 0, 512, sh_l2_tlb4k_str}, |
6964
3eb8a0c8b90a
6667592 Mismatch between intel_ctab array and processor specification for the cache descriptors
vd224797
parents:
6691
diff
changeset
|
3459 { 0xc0, 4, 0, 8, dtlb44_str }, |
3eb8a0c8b90a
6667592 Mismatch between intel_ctab array and processor specification for the cache descriptors
vd224797
parents:
6691
diff
changeset
|
3460 { 0xba, 4, 0, 64, dtlb4k_str }, |
3446 | 3461 { 0xb4, 4, 0, 256, dtlb4k_str }, |
0 | 3462 { 0xb3, 4, 0, 128, dtlb4k_str }, |
6334
950d3f34a725
6662206 Add new CPUID.2 descriptors for upcoming Intel processor
ksadhukh
parents:
6317
diff
changeset
|
3463 { 0xb2, 4, 0, 64, itlb4k_str }, |
0 | 3464 { 0xb0, 4, 0, 128, itlb4k_str }, |
3465 { 0x87, 8, 64, 1024*1024, l2_cache_str}, | |
3466 { 0x86, 4, 64, 512*1024, l2_cache_str}, | |
3467 { 0x85, 8, 32, 2*1024*1024, l2_cache_str}, | |
3468 { 0x84, 8, 32, 1024*1024, l2_cache_str}, | |
3469 { 0x83, 8, 32, 512*1024, l2_cache_str}, | |
3470 { 0x82, 8, 32, 256*1024, l2_cache_str}, | |
6964
3eb8a0c8b90a
6667592 Mismatch between intel_ctab array and processor specification for the cache descriptors
vd224797
parents:
6691
diff
changeset
|
3471 { 0x80, 8, 64, 512*1024, l2_cache_str}, |
0 | 3472 { 0x7f, 2, 64, 512*1024, l2_cache_str}, |
3473 { 0x7d, 8, 64, 2*1024*1024, sl2_cache_str}, | |
3474 { 0x7c, 8, 64, 1024*1024, sl2_cache_str}, | |
3475 { 0x7b, 8, 64, 512*1024, sl2_cache_str}, | |
3476 { 0x7a, 8, 64, 256*1024, sl2_cache_str}, | |
3477 { 0x79, 8, 64, 128*1024, sl2_cache_str}, | |
3478 { 0x78, 8, 64, 1024*1024, l2_cache_str}, | |
3446 | 3479 { 0x73, 8, 0, 64*1024, itrace_str}, |
0 | 3480 { 0x72, 8, 0, 32*1024, itrace_str}, |
3481 { 0x71, 8, 0, 16*1024, itrace_str}, | |
3482 { 0x70, 8, 0, 12*1024, itrace_str}, | |
3483 { 0x68, 4, 64, 32*1024, sl1_dcache_str}, | |
3484 { 0x67, 4, 64, 16*1024, sl1_dcache_str}, | |
3485 { 0x66, 4, 64, 8*1024, sl1_dcache_str}, | |
3486 { 0x60, 8, 64, 16*1024, sl1_dcache_str}, | |
3487 { 0x5d, 0, 0, 256, dtlb44_str}, | |
3488 { 0x5c, 0, 0, 128, dtlb44_str}, | |
3489 { 0x5b, 0, 0, 64, dtlb44_str}, | |
6334
950d3f34a725
6662206 Add new CPUID.2 descriptors for upcoming Intel processor
ksadhukh
parents:
6317
diff
changeset
|
3490 { 0x5a, 4, 0, 32, dtlb24_str}, |
6964
3eb8a0c8b90a
6667592 Mismatch between intel_ctab array and processor specification for the cache descriptors
vd224797
parents:
6691
diff
changeset
|
3491 { 0x59, 0, 0, 16, dtlb4k_str}, |
3eb8a0c8b90a
6667592 Mismatch between intel_ctab array and processor specification for the cache descriptors
vd224797
parents:
6691
diff
changeset
|
3492 { 0x57, 4, 0, 16, dtlb4k_str}, |
3eb8a0c8b90a
6667592 Mismatch between intel_ctab array and processor specification for the cache descriptors
vd224797
parents:
6691
diff
changeset
|
3493 { 0x56, 4, 0, 16, dtlb4M_str}, |
6334
950d3f34a725
6662206 Add new CPUID.2 descriptors for upcoming Intel processor
ksadhukh
parents:
6317
diff
changeset
|
3494 { 0x55, 0, 0, 7, itlb24_str}, |
0 | 3495 { 0x52, 0, 0, 256, itlb424_str}, |
3496 { 0x51, 0, 0, 128, itlb424_str}, | |
3497 { 0x50, 0, 0, 64, itlb424_str}, | |
6964
3eb8a0c8b90a
6667592 Mismatch between intel_ctab array and processor specification for the cache descriptors
vd224797
parents:
6691
diff
changeset
|
3498 { 0x4f, 0, 0, 32, itlb4k_str}, |
3eb8a0c8b90a
6667592 Mismatch between intel_ctab array and processor specification for the cache descriptors
vd224797
parents:
6691
diff
changeset
|
3499 { 0x4e, 24, 64, 6*1024*1024, l2_cache_str}, |
3446 | 3500 { 0x4d, 16, 64, 16*1024*1024, l3_cache_str}, |
3501 { 0x4c, 12, 64, 12*1024*1024, l3_cache_str}, | |
3502 { 0x4b, 16, 64, 8*1024*1024, l3_cache_str}, | |
3503 { 0x4a, 12, 64, 6*1024*1024, l3_cache_str}, | |
3504 { 0x49, 16, 64, 4*1024*1024, l3_cache_str}, | |
6964
3eb8a0c8b90a
6667592 Mismatch between intel_ctab array and processor specification for the cache descriptors
vd224797
parents:
6691
diff
changeset
|
3505 { 0x48, 12, 64, 3*1024*1024, l2_cache_str}, |
3446 | 3506 { 0x47, 8, 64, 8*1024*1024, l3_cache_str}, |
3507 { 0x46, 4, 64, 4*1024*1024, l3_cache_str}, | |
0 | 3508 { 0x45, 4, 32, 2*1024*1024, l2_cache_str}, |
3509 { 0x44, 4, 32, 1024*1024, l2_cache_str}, | |
3510 { 0x43, 4, 32, 512*1024, l2_cache_str}, | |
3511 { 0x42, 4, 32, 256*1024, l2_cache_str}, | |
3512 { 0x41, 4, 32, 128*1024, l2_cache_str}, | |
3446 | 3513 { 0x3e, 4, 64, 512*1024, sl2_cache_str}, |
3514 { 0x3d, 6, 64, 384*1024, sl2_cache_str}, | |
0 | 3515 { 0x3c, 4, 64, 256*1024, sl2_cache_str}, |
3516 { 0x3b, 2, 64, 128*1024, sl2_cache_str}, | |
3446 | 3517 { 0x3a, 6, 64, 192*1024, sl2_cache_str}, |
0 | 3518 { 0x39, 4, 64, 128*1024, sl2_cache_str}, |
3519 { 0x30, 8, 64, 32*1024, l1_icache_str}, | |
3520 { 0x2c, 8, 64, 32*1024, l1_dcache_str}, | |
3521 { 0x29, 8, 64, 4096*1024, sl3_cache_str}, | |
3522 { 0x25, 8, 64, 2048*1024, sl3_cache_str}, | |
3523 { 0x23, 8, 64, 1024*1024, sl3_cache_str}, | |
3524 { 0x22, 4, 64, 512*1024, sl3_cache_str}, | |
6964
3eb8a0c8b90a
6667592 Mismatch between intel_ctab array and processor specification for the cache descriptors
vd224797
parents:
6691
diff
changeset
|
3525 { 0x0e, 6, 64, 24*1024, l1_dcache_str}, |
6334
950d3f34a725
6662206 Add new CPUID.2 descriptors for upcoming Intel processor
ksadhukh
parents:
6317
diff
changeset
|
3526 { 0x0d, 4, 32, 16*1024, l1_dcache_str}, |
0 | 3527 { 0x0c, 4, 32, 16*1024, l1_dcache_str}, |
3446 | 3528 { 0x0b, 4, 0, 4, itlb4M_str}, |
0 | 3529 { 0x0a, 2, 32, 8*1024, l1_dcache_str}, |
3530 { 0x08, 4, 32, 16*1024, l1_icache_str}, | |
3531 { 0x06, 4, 32, 8*1024, l1_icache_str}, | |
6964
3eb8a0c8b90a
6667592 Mismatch between intel_ctab array and processor specification for the cache descriptors
vd224797
parents:
6691
diff
changeset
|
3532 { 0x05, 4, 0, 32, dtlb4M_str}, |
0 | 3533 { 0x04, 4, 0, 8, dtlb4M_str}, |
3534 { 0x03, 4, 0, 64, dtlb4k_str}, | |
3535 { 0x02, 4, 0, 2, itlb4M_str}, | |
3536 { 0x01, 4, 0, 32, itlb4k_str}, | |
3537 { 0 } | |
3538 }; | |
3539 | |
3540 static const struct cachetab cyrix_ctab[] = { | |
3541 { 0x70, 4, 0, 32, "tlb-4K" }, | |
3542 { 0x80, 4, 16, 16*1024, "l1-cache" }, | |
3543 { 0 } | |
3544 }; | |
3545 | |
3546 /* | |
3547 * Search a cache table for a matching entry | |
3548 */ | |
3549 static const struct cachetab * | |
3550 find_cacheent(const struct cachetab *ct, uint_t code) | |
3551 { | |
3552 if (code != 0) { | |
3553 for (; ct->ct_code != 0; ct++) | |
3554 if (ct->ct_code <= code) | |
3555 break; | |
3556 if (ct->ct_code == code) | |
3557 return (ct); | |
3558 } | |
3559 return (NULL); | |
3560 } | |
3561 | |
3562 /* | |
5438
41d8edfa90d7
6603986 Installing a Linux zone on an Intel blade causes a panic
ksadhukh
parents:
5349
diff
changeset
|
3563 * Populate cachetab entry with L2 or L3 cache-information using |
41d8edfa90d7
6603986 Installing a Linux zone on an Intel blade causes a panic
ksadhukh
parents:
5349
diff
changeset
|
3564 * cpuid function 4. This function is called from intel_walk_cacheinfo() |
41d8edfa90d7
6603986 Installing a Linux zone on an Intel blade causes a panic
ksadhukh
parents:
5349
diff
changeset
|
3565 * when descriptor 0x49 is encountered. It returns 0 if no such cache |
41d8edfa90d7
6603986 Installing a Linux zone on an Intel blade causes a panic
ksadhukh
parents:
5349
diff
changeset
|
3566 * information is found. |
41d8edfa90d7
6603986 Installing a Linux zone on an Intel blade causes a panic
ksadhukh
parents:
5349
diff
changeset
|
3567 */ |
41d8edfa90d7
6603986 Installing a Linux zone on an Intel blade causes a panic
ksadhukh
parents:
5349
diff
changeset
|
3568 static int |
41d8edfa90d7
6603986 Installing a Linux zone on an Intel blade causes a panic
ksadhukh
parents:
5349
diff
changeset
|
3569 intel_cpuid_4_cache_info(struct cachetab *ct, struct cpuid_info *cpi) |
41d8edfa90d7
6603986 Installing a Linux zone on an Intel blade causes a panic
ksadhukh
parents:
5349
diff
changeset
|
3570 { |
41d8edfa90d7
6603986 Installing a Linux zone on an Intel blade causes a panic
ksadhukh
parents:
5349
diff
changeset
|
3571 uint32_t level, i; |
41d8edfa90d7
6603986 Installing a Linux zone on an Intel blade causes a panic
ksadhukh
parents:
5349
diff
changeset
|
3572 int ret = 0; |
41d8edfa90d7
6603986 Installing a Linux zone on an Intel blade causes a panic
ksadhukh
parents:
5349
diff
changeset
|
3573 |
41d8edfa90d7
6603986 Installing a Linux zone on an Intel blade causes a panic
ksadhukh
parents:
5349
diff
changeset
|
3574 for (i = 0; i < cpi->cpi_std_4_size; i++) { |
41d8edfa90d7
6603986 Installing a Linux zone on an Intel blade causes a panic
ksadhukh
parents:
5349
diff
changeset
|
3575 level = CPI_CACHE_LVL(cpi->cpi_std_4[i]); |
41d8edfa90d7
6603986 Installing a Linux zone on an Intel blade causes a panic
ksadhukh
parents:
5349
diff
changeset
|
3576 |
41d8edfa90d7
6603986 Installing a Linux zone on an Intel blade causes a panic
ksadhukh
parents:
5349
diff
changeset
|
3577 if (level == 2 || level == 3) { |
41d8edfa90d7
6603986 Installing a Linux zone on an Intel blade causes a panic
ksadhukh
parents:
5349
diff
changeset
|
3578 ct->ct_assoc = CPI_CACHE_WAYS(cpi->cpi_std_4[i]) + 1; |
41d8edfa90d7
6603986 Installing a Linux zone on an Intel blade causes a panic
ksadhukh
parents:
5349
diff
changeset
|
3579 ct->ct_line_size = |
41d8edfa90d7
6603986 Installing a Linux zone on an Intel blade causes a panic
ksadhukh
parents:
5349
diff
changeset
|
3580 CPI_CACHE_COH_LN_SZ(cpi->cpi_std_4[i]) + 1; |
41d8edfa90d7
6603986 Installing a Linux zone on an Intel blade causes a panic
ksadhukh
parents:
5349
diff
changeset
|
3581 ct->ct_size = ct->ct_assoc * |
41d8edfa90d7
6603986 Installing a Linux zone on an Intel blade causes a panic
ksadhukh
parents:
5349
diff
changeset
|
3582 (CPI_CACHE_PARTS(cpi->cpi_std_4[i]) + 1) * |
41d8edfa90d7
6603986 Installing a Linux zone on an Intel blade causes a panic
ksadhukh
parents:
5349
diff
changeset
|
3583 ct->ct_line_size * |
41d8edfa90d7
6603986 Installing a Linux zone on an Intel blade causes a panic
ksadhukh
parents:
5349
diff
changeset
|
3584 (cpi->cpi_std_4[i]->cp_ecx + 1); |
41d8edfa90d7
6603986 Installing a Linux zone on an Intel blade causes a panic
ksadhukh
parents:
5349
diff
changeset
|
3585 |
41d8edfa90d7
6603986 Installing a Linux zone on an Intel blade causes a panic
ksadhukh
parents:
5349
diff
changeset
|
3586 if (level == 2) { |
41d8edfa90d7
6603986 Installing a Linux zone on an Intel blade causes a panic
ksadhukh
parents:
5349
diff
changeset
|
3587 ct->ct_label = l2_cache_str; |
41d8edfa90d7
6603986 Installing a Linux zone on an Intel blade causes a panic
ksadhukh
parents:
5349
diff
changeset
|
3588 } else if (level == 3) { |
41d8edfa90d7
6603986 Installing a Linux zone on an Intel blade causes a panic
ksadhukh
parents:
5349
diff
changeset
|
3589 ct->ct_label = l3_cache_str; |
41d8edfa90d7
6603986 Installing a Linux zone on an Intel blade causes a panic
ksadhukh
parents:
5349
diff
changeset
|
3590 } |
41d8edfa90d7
6603986 Installing a Linux zone on an Intel blade causes a panic
ksadhukh
parents:
5349
diff
changeset
|
3591 ret = 1; |
41d8edfa90d7
6603986 Installing a Linux zone on an Intel blade causes a panic
ksadhukh
parents:
5349
diff
changeset
|
3592 } |
41d8edfa90d7
6603986 Installing a Linux zone on an Intel blade causes a panic
ksadhukh
parents:
5349
diff
changeset
|
3593 } |
41d8edfa90d7
6603986 Installing a Linux zone on an Intel blade causes a panic
ksadhukh
parents:
5349
diff
changeset
|
3594 |
41d8edfa90d7
6603986 Installing a Linux zone on an Intel blade causes a panic
ksadhukh
parents:
5349
diff
changeset
|
3595 return (ret); |
41d8edfa90d7
6603986 Installing a Linux zone on an Intel blade causes a panic
ksadhukh
parents:
5349
diff
changeset
|
3596 } |
41d8edfa90d7
6603986 Installing a Linux zone on an Intel blade causes a panic
ksadhukh
parents:
5349
diff
changeset
|
3597 |
41d8edfa90d7
6603986 Installing a Linux zone on an Intel blade causes a panic
ksadhukh
parents:
5349
diff
changeset
|
3598 /* |
0 | 3599 * Walk the cacheinfo descriptor, applying 'func' to every valid element |
3600 * The walk is terminated if the walker returns non-zero. | |
3601 */ | |
3602 static void | |
3603 intel_walk_cacheinfo(struct cpuid_info *cpi, | |
3604 void *arg, int (*func)(void *, const struct cachetab *)) | |
3605 { | |
3606 const struct cachetab *ct; | |
6964
3eb8a0c8b90a
6667592 Mismatch between intel_ctab array and processor specification for the cache descriptors
vd224797
parents:
6691
diff
changeset
|
3607 struct cachetab des_49_ct, des_b1_ct; |
0 | 3608 uint8_t *dp; |
3609 int i; | |
3610 | |
3611 if ((dp = cpi->cpi_cacheinfo) == NULL) | |
3612 return; | |
4797
2ebe22df4dfc
6563585 prtconf reports wrong cache-level on x86 systems having 4MB (associative=16, line-size=64) L2 cache
ksadhukh
parents:
4636
diff
changeset
|
3613 for (i = 0; i < cpi->cpi_ncache; i++, dp++) { |
2ebe22df4dfc
6563585 prtconf reports wrong cache-level on x86 systems having 4MB (associative=16, line-size=64) L2 cache
ksadhukh
parents:
4636
diff
changeset
|
3614 /* |
2ebe22df4dfc
6563585 prtconf reports wrong cache-level on x86 systems having 4MB (associative=16, line-size=64) L2 cache
ksadhukh
parents:
4636
diff
changeset
|
3615 * For overloaded descriptor 0x49 we use cpuid function 4 |
5438
41d8edfa90d7
6603986 Installing a Linux zone on an Intel blade causes a panic
ksadhukh
parents:
5349
diff
changeset
|
3616 * if supported by the current processor, to create |
4797
2ebe22df4dfc
6563585 prtconf reports wrong cache-level on x86 systems having 4MB (associative=16, line-size=64) L2 cache
ksadhukh
parents:
4636
diff
changeset
|
3617 * cache information. |
6964
3eb8a0c8b90a
6667592 Mismatch between intel_ctab array and processor specification for the cache descriptors
vd224797
parents:
6691
diff
changeset
|
3618 * For overloaded descriptor 0xb1 we use X86_PAE flag |
3eb8a0c8b90a
6667592 Mismatch between intel_ctab array and processor specification for the cache descriptors
vd224797
parents:
6691
diff
changeset
|
3619 * to disambiguate the cache information. |
4797
2ebe22df4dfc
6563585 prtconf reports wrong cache-level on x86 systems having 4MB (associative=16, line-size=64) L2 cache
ksadhukh
parents:
4636
diff
changeset
|
3620 */ |
5438
41d8edfa90d7
6603986 Installing a Linux zone on an Intel blade causes a panic
ksadhukh
parents:
5349
diff
changeset
|
3621 if (*dp == 0x49 && cpi->cpi_maxeax >= 0x4 && |
41d8edfa90d7
6603986 Installing a Linux zone on an Intel blade causes a panic
ksadhukh
parents:
5349
diff
changeset
|
3622 intel_cpuid_4_cache_info(&des_49_ct, cpi) == 1) { |
41d8edfa90d7
6603986 Installing a Linux zone on an Intel blade causes a panic
ksadhukh
parents:
5349
diff
changeset
|
3623 ct = &des_49_ct; |
6964
3eb8a0c8b90a
6667592 Mismatch between intel_ctab array and processor specification for the cache descriptors
vd224797
parents:
6691
diff
changeset
|
3624 } else if (*dp == 0xb1) { |
3eb8a0c8b90a
6667592 Mismatch between intel_ctab array and processor specification for the cache descriptors
vd224797
parents:
6691
diff
changeset
|
3625 des_b1_ct.ct_code = 0xb1; |
3eb8a0c8b90a
6667592 Mismatch between intel_ctab array and processor specification for the cache descriptors
vd224797
parents:
6691
diff
changeset
|
3626 des_b1_ct.ct_assoc = 4; |
3eb8a0c8b90a
6667592 Mismatch between intel_ctab array and processor specification for the cache descriptors
vd224797
parents:
6691
diff
changeset
|
3627 des_b1_ct.ct_line_size = 0; |
12838
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
3628 if (is_x86_feature(x86_featureset, X86FSET_PAE)) { |
6964
3eb8a0c8b90a
6667592 Mismatch between intel_ctab array and processor specification for the cache descriptors
vd224797
parents:
6691
diff
changeset
|
3629 des_b1_ct.ct_size = 8; |
3eb8a0c8b90a
6667592 Mismatch between intel_ctab array and processor specification for the cache descriptors
vd224797
parents:
6691
diff
changeset
|
3630 des_b1_ct.ct_label = itlb2M_str; |
3eb8a0c8b90a
6667592 Mismatch between intel_ctab array and processor specification for the cache descriptors
vd224797
parents:
6691
diff
changeset
|
3631 } else { |
3eb8a0c8b90a
6667592 Mismatch between intel_ctab array and processor specification for the cache descriptors
vd224797
parents:
6691
diff
changeset
|
3632 des_b1_ct.ct_size = 4; |
3eb8a0c8b90a
6667592 Mismatch between intel_ctab array and processor specification for the cache descriptors
vd224797
parents:
6691
diff
changeset
|
3633 des_b1_ct.ct_label = itlb4M_str; |
3eb8a0c8b90a
6667592 Mismatch between intel_ctab array and processor specification for the cache descriptors
vd224797
parents:
6691
diff
changeset
|
3634 } |
3eb8a0c8b90a
6667592 Mismatch between intel_ctab array and processor specification for the cache descriptors
vd224797
parents:
6691
diff
changeset
|
3635 ct = &des_b1_ct; |
5438
41d8edfa90d7
6603986 Installing a Linux zone on an Intel blade causes a panic
ksadhukh
parents:
5349
diff
changeset
|
3636 } else { |
41d8edfa90d7
6603986 Installing a Linux zone on an Intel blade causes a panic
ksadhukh
parents:
5349
diff
changeset
|
3637 if ((ct = find_cacheent(intel_ctab, *dp)) == NULL) { |
41d8edfa90d7
6603986 Installing a Linux zone on an Intel blade causes a panic
ksadhukh
parents:
5349
diff
changeset
|
3638 continue; |
41d8edfa90d7
6603986 Installing a Linux zone on an Intel blade causes a panic
ksadhukh
parents:
5349
diff
changeset
|
3639 } |
4797
2ebe22df4dfc
6563585 prtconf reports wrong cache-level on x86 systems having 4MB (associative=16, line-size=64) L2 cache
ksadhukh
parents:
4636
diff
changeset
|
3640 } |
2ebe22df4dfc
6563585 prtconf reports wrong cache-level on x86 systems having 4MB (associative=16, line-size=64) L2 cache
ksadhukh
parents:
4636
diff
changeset
|
3641 |
5438
41d8edfa90d7
6603986 Installing a Linux zone on an Intel blade causes a panic
ksadhukh
parents:
5349
diff
changeset
|
3642 if (func(arg, ct) != 0) { |
41d8edfa90d7
6603986 Installing a Linux zone on an Intel blade causes a panic
ksadhukh
parents:
5349
diff
changeset
|
3643 break; |
0 | 3644 } |
4797
2ebe22df4dfc
6563585 prtconf reports wrong cache-level on x86 systems having 4MB (associative=16, line-size=64) L2 cache
ksadhukh
parents:
4636
diff
changeset
|
3645 } |
0 | 3646 } |
3647 | |
3648 /* | |
3649 * (Like the Intel one, except for Cyrix CPUs) | |
3650 */ | |
3651 static void | |
3652 cyrix_walk_cacheinfo(struct cpuid_info *cpi, | |
3653 void *arg, int (*func)(void *, const struct cachetab *)) | |
3654 { | |
3655 const struct cachetab *ct; | |
3656 uint8_t *dp; | |
3657 int i; | |
3658 | |
3659 if ((dp = cpi->cpi_cacheinfo) == NULL) | |
3660 return; | |
3661 for (i = 0; i < cpi->cpi_ncache; i++, dp++) { | |
3662 /* | |
3663 * Search Cyrix-specific descriptor table first .. | |
3664 */ | |
3665 if ((ct = find_cacheent(cyrix_ctab, *dp)) != NULL) { | |
3666 if (func(arg, ct) != 0) | |
3667 break; | |
3668 continue; | |
3669 } | |
3670 /* | |
3671 * .. else fall back to the Intel one | |
3672 */ | |
3673 if ((ct = find_cacheent(intel_ctab, *dp)) != NULL) { | |
3674 if (func(arg, ct) != 0) | |
3675 break; | |
3676 continue; | |
3677 } | |
3678 } | |
3679 } | |
3680 | |
3681 /* | |
3682 * A cacheinfo walker that adds associativity, line-size, and size properties | |
3683 * to the devinfo node it is passed as an argument. | |
3684 */ | |
3685 static int | |
3686 add_cacheent_props(void *arg, const struct cachetab *ct) | |
3687 { | |
3688 dev_info_t *devi = arg; | |
3689 | |
3690 add_cache_prop(devi, ct->ct_label, assoc_str, ct->ct_assoc); | |
3691 if (ct->ct_line_size != 0) | |
3692 add_cache_prop(devi, ct->ct_label, line_str, | |
3693 ct->ct_line_size); | |
3694 add_cache_prop(devi, ct->ct_label, size_str, ct->ct_size); | |
3695 return (0); | |
3696 } | |
3697 | |
4797
2ebe22df4dfc
6563585 prtconf reports wrong cache-level on x86 systems having 4MB (associative=16, line-size=64) L2 cache
ksadhukh
parents:
4636
diff
changeset
|
3698 |
0 | 3699 static const char fully_assoc[] = "fully-associative?"; |
3700 | |
3701 /* | |
3702 * AMD style cache/tlb description | |
3703 * | |
3704 * Extended functions 5 and 6 directly describe properties of | |
3705 * tlbs and various cache levels. | |
3706 */ | |
3707 static void | |
3708 add_amd_assoc(dev_info_t *devi, const char *label, uint_t assoc) | |
3709 { | |
3710 switch (assoc) { | |
3711 case 0: /* reserved; ignore */ | |
3712 break; | |
3713 default: | |
3714 add_cache_prop(devi, label, assoc_str, assoc); | |
3715 break; | |
3716 case 0xff: | |
3717 add_cache_prop(devi, label, fully_assoc, 1); | |
3718 break; | |
3719 } | |
3720 } | |
3721 | |
3722 static void | |
3723 add_amd_tlb(dev_info_t *devi, const char *label, uint_t assoc, uint_t size) | |
3724 { | |
3725 if (size == 0) | |
3726 return; | |
3727 add_cache_prop(devi, label, size_str, size); | |
3728 add_amd_assoc(devi, label, assoc); | |
3729 } | |
3730 | |
3731 static void | |
3732 add_amd_cache(dev_info_t *devi, const char *label, | |
3733 uint_t size, uint_t assoc, uint_t lines_per_tag, uint_t line_size) | |
3734 { | |
3735 if (size == 0 || line_size == 0) | |
3736 return; | |
3737 add_amd_assoc(devi, label, assoc); | |
3738 /* | |
3739 * Most AMD parts have a sectored cache. Multiple cache lines are | |
3740 * associated with each tag. A sector consists of all cache lines | |
3741 * associated with a tag. For example, the AMD K6-III has a sector | |
3742 * size of 2 cache lines per tag. | |
3743 */ | |
3744 if (lines_per_tag != 0) | |
3745 add_cache_prop(devi, label, "lines-per-tag", lines_per_tag); | |
3746 add_cache_prop(devi, label, line_str, line_size); | |
3747 add_cache_prop(devi, label, size_str, size * 1024); | |
3748 } | |
3749 | |
3750 static void | |
3751 add_amd_l2_assoc(dev_info_t *devi, const char *label, uint_t assoc) | |
3752 { | |
3753 switch (assoc) { | |
3754 case 0: /* off */ | |
3755 break; | |
3756 case 1: | |
3757 case 2: | |
3758 case 4: | |
3759 add_cache_prop(devi, label, assoc_str, assoc); | |
3760 break; | |
3761 case 6: | |
3762 add_cache_prop(devi, label, assoc_str, 8); | |
3763 break; | |
3764 case 8: | |
3765 add_cache_prop(devi, label, assoc_str, 16); | |
3766 break; | |
3767 case 0xf: | |
3768 add_cache_prop(devi, label, fully_assoc, 1); | |
3769 break; | |
3770 default: /* reserved; ignore */ | |
3771 break; | |
3772 } | |
3773 } | |
3774 | |
3775 static void | |
3776 add_amd_l2_tlb(dev_info_t *devi, const char *label, uint_t assoc, uint_t size) | |
3777 { | |
3778 if (size == 0 || assoc == 0) | |
3779 return; | |
3780 add_amd_l2_assoc(devi, label, assoc); | |
3781 add_cache_prop(devi, label, size_str, size); | |
3782 } | |
3783 | |
3784 static void | |
3785 add_amd_l2_cache(dev_info_t *devi, const char *label, | |
3786 uint_t size, uint_t assoc, uint_t lines_per_tag, uint_t line_size) | |
3787 { | |
3788 if (size == 0 || assoc == 0 || line_size == 0) | |
3789 return; | |
3790 add_amd_l2_assoc(devi, label, assoc); | |
3791 if (lines_per_tag != 0) | |
3792 add_cache_prop(devi, label, "lines-per-tag", lines_per_tag); | |
3793 add_cache_prop(devi, label, line_str, line_size); | |
3794 add_cache_prop(devi, label, size_str, size * 1024); | |
3795 } | |
3796 | |
3797 static void | |
3798 amd_cache_info(struct cpuid_info *cpi, dev_info_t *devi) | |
3799 { | |
1228 | 3800 struct cpuid_regs *cp; |
0 | 3801 |
3802 if (cpi->cpi_xmaxeax < 0x80000005) | |
3803 return; | |
3804 cp = &cpi->cpi_extd[5]; | |
3805 | |
3806 /* | |
3807 * 4M/2M L1 TLB configuration | |
3808 * | |
3809 * We report the size for 2M pages because AMD uses two | |
3810 * TLB entries for one 4M page. | |
3811 */ | |
3812 add_amd_tlb(devi, "dtlb-2M", | |
3813 BITX(cp->cp_eax, 31, 24), BITX(cp->cp_eax, 23, 16)); | |
3814 add_amd_tlb(devi, "itlb-2M", | |
3815 BITX(cp->cp_eax, 15, 8), BITX(cp->cp_eax, 7, 0)); | |
3816 | |
3817 /* | |
3818 * 4K L1 TLB configuration | |
3819 */ | |
3820 | |
3821 switch (cpi->cpi_vendor) { | |
3822 uint_t nentries; | |
3823 case X86_VENDOR_TM: | |
3824 if (cpi->cpi_family >= 5) { | |
3825 /* | |
3826 * Crusoe processors have 256 TLB entries, but | |
3827 * cpuid data format constrains them to only | |
3828 * reporting 255 of them. | |
3829 */ | |
3830 if ((nentries = BITX(cp->cp_ebx, 23, 16)) == 255) | |
3831 nentries = 256; | |
3832 /* | |
3833 * Crusoe processors also have a unified TLB | |
3834 */ | |
3835 add_amd_tlb(devi, "tlb-4K", BITX(cp->cp_ebx, 31, 24), | |
3836 nentries); | |
3837 break; | |
3838 } | |
3839 /*FALLTHROUGH*/ | |
3840 default: | |
3841 add_amd_tlb(devi, itlb4k_str, | |
3842 BITX(cp->cp_ebx, 31, 24), BITX(cp->cp_ebx, 23, 16)); | |
3843 add_amd_tlb(devi, dtlb4k_str, | |
3844 BITX(cp->cp_ebx, 15, 8), BITX(cp->cp_ebx, 7, 0)); | |
3845 break; | |
3846 } | |
3847 | |
3848 /* | |
3849 * data L1 cache configuration | |
3850 */ | |
3851 | |
3852 add_amd_cache(devi, l1_dcache_str, | |
3853 BITX(cp->cp_ecx, 31, 24), BITX(cp->cp_ecx, 23, 16), | |
3854 BITX(cp->cp_ecx, 15, 8), BITX(cp->cp_ecx, 7, 0)); | |
3855 | |
3856 /* | |
3857 * code L1 cache configuration | |
3858 */ | |
3859 | |
3860 add_amd_cache(devi, l1_icache_str, | |
3861 BITX(cp->cp_edx, 31, 24), BITX(cp->cp_edx, 23, 16), | |
3862 BITX(cp->cp_edx, 15, 8), BITX(cp->cp_edx, 7, 0)); | |
3863 | |
3864 if (cpi->cpi_xmaxeax < 0x80000006) | |
3865 return; | |
3866 cp = &cpi->cpi_extd[6]; | |
3867 | |
3868 /* Check for a unified L2 TLB for large pages */ | |
3869 | |
3870 if (BITX(cp->cp_eax, 31, 16) == 0) | |
3871 add_amd_l2_tlb(devi, "l2-tlb-2M", | |
3872 BITX(cp->cp_eax, 15, 12), BITX(cp->cp_eax, 11, 0)); | |
3873 else { | |
3874 add_amd_l2_tlb(devi, "l2-dtlb-2M", | |
3875 BITX(cp->cp_eax, 31, 28), BITX(cp->cp_eax, 27, 16)); | |
3876 add_amd_l2_tlb(devi, "l2-itlb-2M", | |
3877 BITX(cp->cp_eax, 15, 12), BITX(cp->cp_eax, 11, 0)); | |
3878 } | |
3879 | |
3880 /* Check for a unified L2 TLB for 4K pages */ | |
3881 | |
3882 if (BITX(cp->cp_ebx, 31, 16) == 0) { | |
3883 add_amd_l2_tlb(devi, "l2-tlb-4K", | |
3884 BITX(cp->cp_eax, 15, 12), BITX(cp->cp_eax, 11, 0)); | |
3885 } else { | |
3886 add_amd_l2_tlb(devi, "l2-dtlb-4K", | |
3887 BITX(cp->cp_eax, 31, 28), BITX(cp->cp_eax, 27, 16)); | |
3888 add_amd_l2_tlb(devi, "l2-itlb-4K", | |
3889 BITX(cp->cp_eax, 15, 12), BITX(cp->cp_eax, 11, 0)); | |
3890 } | |
3891 | |
3892 add_amd_l2_cache(devi, l2_cache_str, | |
3893 BITX(cp->cp_ecx, 31, 16), BITX(cp->cp_ecx, 15, 12), | |
3894 BITX(cp->cp_ecx, 11, 8), BITX(cp->cp_ecx, 7, 0)); | |
3895 } | |
3896 | |
3897 /* | |
3898 * There are two basic ways that the x86 world describes it cache | |
3899 * and tlb architecture - Intel's way and AMD's way. | |
3900 * | |
3901 * Return which flavor of cache architecture we should use | |
3902 */ | |
3903 static int | |
3904 x86_which_cacheinfo(struct cpuid_info *cpi) | |
3905 { | |
3906 switch (cpi->cpi_vendor) { | |
3907 case X86_VENDOR_Intel: | |
3908 if (cpi->cpi_maxeax >= 2) | |
3909 return (X86_VENDOR_Intel); | |
3910 break; | |
3911 case X86_VENDOR_AMD: | |
3912 /* | |
3913 * The K5 model 1 was the first part from AMD that reported | |
3914 * cache sizes via extended cpuid functions. | |
3915 */ | |
3916 if (cpi->cpi_family > 5 || | |
3917 (cpi->cpi_family == 5 && cpi->cpi_model >= 1)) | |
3918 return (X86_VENDOR_AMD); | |
3919 break; | |
3920 case X86_VENDOR_TM: | |
3921 if (cpi->cpi_family >= 5) | |
3922 return (X86_VENDOR_AMD); | |
3923 /*FALLTHROUGH*/ | |
3924 default: | |
3925 /* | |
3926 * If they have extended CPU data for 0x80000005 | |
3927 * then we assume they have AMD-format cache | |
3928 * information. | |
3929 * | |
3930 * If not, and the vendor happens to be Cyrix, | |
3931 * then try our-Cyrix specific handler. | |
3932 * | |
3933 * If we're not Cyrix, then assume we're using Intel's | |
3934 * table-driven format instead. | |
3935 */ | |
3936 if (cpi->cpi_xmaxeax >= 0x80000005) | |
3937 return (X86_VENDOR_AMD); | |
3938 else if (cpi->cpi_vendor == X86_VENDOR_Cyrix) | |
3939 return (X86_VENDOR_Cyrix); | |
3940 else if (cpi->cpi_maxeax >= 2) | |
3941 return (X86_VENDOR_Intel); | |
3942 break; | |
3943 } | |
3944 return (-1); | |
3945 } | |
3946 | |
3947 void | |
9652
6b40e106879c
6815568 ACPICA enhancements for support of ACPI-based device enumeration earlier in boot
Michael Corcoran <Michael.Corcoran@Sun.COM>
parents:
9482
diff
changeset
|
3948 cpuid_set_cpu_properties(void *dip, processorid_t cpu_id, |
6b40e106879c
6815568 ACPICA enhancements for support of ACPI-based device enumeration earlier in boot
Michael Corcoran <Michael.Corcoran@Sun.COM>
parents:
9482
diff
changeset
|
3949 struct cpuid_info *cpi) |
0 | 3950 { |
3951 dev_info_t *cpu_devi; | |
3952 int create; | |
3953 | |
9652
6b40e106879c
6815568 ACPICA enhancements for support of ACPI-based device enumeration earlier in boot
Michael Corcoran <Michael.Corcoran@Sun.COM>
parents:
9482
diff
changeset
|
3954 cpu_devi = (dev_info_t *)dip; |
0 | 3955 |
3956 /* device_type */ | |
3957 (void) ndi_prop_update_string(DDI_DEV_T_NONE, cpu_devi, | |
3958 "device_type", "cpu"); | |
3959 | |
3960 /* reg */ | |
3961 (void) ndi_prop_update_int(DDI_DEV_T_NONE, cpu_devi, | |
3962 "reg", cpu_id); | |
3963 | |
3964 /* cpu-mhz, and clock-frequency */ | |
3965 if (cpu_freq > 0) { | |
3966 long long mul; | |
3967 | |
3968 (void) ndi_prop_update_int(DDI_DEV_T_NONE, cpu_devi, | |
3969 "cpu-mhz", cpu_freq); | |
3970 if ((mul = cpu_freq * 1000000LL) <= INT_MAX) | |
3971 (void) ndi_prop_update_int(DDI_DEV_T_NONE, cpu_devi, | |
3972 "clock-frequency", (int)mul); | |
3973 } | |
3974 | |
12838
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
3975 if (!is_x86_feature(x86_featureset, X86FSET_CPUID)) { |
0 | 3976 return; |
3977 } | |
3978 | |
3979 /* vendor-id */ | |
3980 (void) ndi_prop_update_string(DDI_DEV_T_NONE, cpu_devi, | |
4481
2bb321aaf3c3
6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents:
4265
diff
changeset
|
3981 "vendor-id", cpi->cpi_vendorstr); |
0 | 3982 |
3983 if (cpi->cpi_maxeax == 0) { | |
3984 return; | |
3985 } | |
3986 | |
3987 /* | |
3988 * family, model, and step | |
3989 */ | |
3990 (void) ndi_prop_update_int(DDI_DEV_T_NONE, cpu_devi, | |
4481
2bb321aaf3c3
6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents:
4265
diff
changeset
|
3991 "family", CPI_FAMILY(cpi)); |
0 | 3992 (void) ndi_prop_update_int(DDI_DEV_T_NONE, cpu_devi, |
4481
2bb321aaf3c3
6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents:
4265
diff
changeset
|
3993 "cpu-model", CPI_MODEL(cpi)); |
0 | 3994 (void) ndi_prop_update_int(DDI_DEV_T_NONE, cpu_devi, |
4481
2bb321aaf3c3
6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents:
4265
diff
changeset
|
3995 "stepping-id", CPI_STEP(cpi)); |
0 | 3996 |
3997 /* type */ | |
3998 switch (cpi->cpi_vendor) { | |
3999 case X86_VENDOR_Intel: | |
4000 create = 1; | |
4001 break; | |
4002 default: | |
4003 create = 0; | |
4004 break; | |
4005 } | |
4006 if (create) | |
4007 (void) ndi_prop_update_int(DDI_DEV_T_NONE, cpu_devi, | |
4481
2bb321aaf3c3
6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents:
4265
diff
changeset
|
4008 "type", CPI_TYPE(cpi)); |
0 | 4009 |
4010 /* ext-family */ | |
4011 switch (cpi->cpi_vendor) { | |
4012 case X86_VENDOR_Intel: | |
4013 case X86_VENDOR_AMD: | |
4014 create = cpi->cpi_family >= 0xf; | |
4015 break; | |
4016 default: | |
4017 create = 0; | |
4018 break; | |
4019 } | |
4020 if (create) | |
4021 (void) ndi_prop_update_int(DDI_DEV_T_NONE, cpu_devi, | |
4022 "ext-family", CPI_FAMILY_XTD(cpi)); | |
4023 | |
4024 /* ext-model */ | |
4025 switch (cpi->cpi_vendor) { | |
4026 case X86_VENDOR_Intel: | |
6317
8afb524fc268
6667600 Incomplete initialization of cpi_cacheinfo field of struct cpuid_info
kk208521
parents:
5870
diff
changeset
|
4027 create = IS_EXTENDED_MODEL_INTEL(cpi); |
2001
427a702b03e2
6427092 extended-model CPUID information is different between AMD and Intel
dmick
parents:
1975
diff
changeset
|
4028 break; |
0 | 4029 case X86_VENDOR_AMD: |
1582
eb879d43ab47
6323525 Mutual exclusion primitives don't work as expected on Opteron systems
kchow
parents:
1414
diff
changeset
|
4030 create = CPI_FAMILY(cpi) == 0xf; |
0 | 4031 break; |
4032 default: | |
4033 create = 0; | |
4034 break; | |
4035 } | |
4036 if (create) | |
4037 (void) ndi_prop_update_int(DDI_DEV_T_NONE, cpu_devi, | |
4481
2bb321aaf3c3
6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents:
4265
diff
changeset
|
4038 "ext-model", CPI_MODEL_XTD(cpi)); |
0 | 4039 |
4040 /* generation */ | |
4041 switch (cpi->cpi_vendor) { | |
4042 case X86_VENDOR_AMD: | |
4043 /* | |
4044 * AMD K5 model 1 was the first part to support this | |
4045 */ | |
4046 create = cpi->cpi_xmaxeax >= 0x80000001; | |
4047 break; | |
4048 default: | |
4049 create = 0; | |
4050 break; | |
4051 } | |
4052 if (create) | |
4053 (void) ndi_prop_update_int(DDI_DEV_T_NONE, cpu_devi, | |
4054 "generation", BITX((cpi)->cpi_extd[1].cp_eax, 11, 8)); | |
4055 | |
4056 /* brand-id */ | |
4057 switch (cpi->cpi_vendor) { | |
4058 case X86_VENDOR_Intel: | |
4059 /* | |
4060 * brand id first appeared on Pentium III Xeon model 8, | |
4061 * and Celeron model 8 processors and Opteron | |
4062 */ | |
4063 create = cpi->cpi_family > 6 || | |
4064 (cpi->cpi_family == 6 && cpi->cpi_model >= 8); | |
4065 break; | |
4066 case X86_VENDOR_AMD: | |
4067 create = cpi->cpi_family >= 0xf; | |
4068 break; | |
4069 default: | |
4070 create = 0; | |
4071 break; | |
4072 } | |
4073 if (create && cpi->cpi_brandid != 0) { | |
4074 (void) ndi_prop_update_int(DDI_DEV_T_NONE, cpu_devi, | |
4075 "brand-id", cpi->cpi_brandid); | |
4076 } | |
4077 | |
4078 /* chunks, and apic-id */ | |
4079 switch (cpi->cpi_vendor) { | |
4080 /* | |
4081 * first available on Pentium IV and Opteron (K8) | |
4082 */ | |
1975
7490b056500b
6183891 Missing brand ID strings for several common x86 CPUs
dmick
parents:
1727
diff
changeset
|
4083 case X86_VENDOR_Intel: |
7490b056500b
6183891 Missing brand ID strings for several common x86 CPUs
dmick
parents:
1727
diff
changeset
|
4084 create = IS_NEW_F6(cpi) || cpi->cpi_family >= 0xf; |
7490b056500b
6183891 Missing brand ID strings for several common x86 CPUs
dmick
parents:
1727
diff
changeset
|
4085 break; |
7490b056500b
6183891 Missing brand ID strings for several common x86 CPUs
dmick
parents:
1727
diff
changeset
|
4086 case X86_VENDOR_AMD: |
0 | 4087 create = cpi->cpi_family >= 0xf; |
4088 break; | |
4089 default: | |
4090 create = 0; | |
4091 break; | |
4092 } | |
4093 if (create) { | |
4094 (void) ndi_prop_update_int(DDI_DEV_T_NONE, cpu_devi, | |
4481
2bb321aaf3c3
6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents:
4265
diff
changeset
|
4095 "chunks", CPI_CHUNKS(cpi)); |
0 | 4096 (void) ndi_prop_update_int(DDI_DEV_T_NONE, cpu_devi, |
7282
5b3b6674ac91
6528768 apic_navail_vector() fails when IPL equals 8 or 9
mishra
parents:
6964
diff
changeset
|
4097 "apic-id", cpi->cpi_apicid); |
1414
b4126407ac5b
PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
1228
diff
changeset
|
4098 if (cpi->cpi_chipid >= 0) { |
0 | 4099 (void) ndi_prop_update_int(DDI_DEV_T_NONE, cpu_devi, |
4100 "chip#", cpi->cpi_chipid); | |
1414
b4126407ac5b
PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
1228
diff
changeset
|
4101 (void) ndi_prop_update_int(DDI_DEV_T_NONE, cpu_devi, |
b4126407ac5b
PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
1228
diff
changeset
|
4102 "clog#", cpi->cpi_clogid); |
b4126407ac5b
PSARC 2006/020 FMA for Athlon 64 and Opteron Processors
cindi
parents:
1228
diff
changeset
|
4103 } |
0 | 4104 } |
4105 | |
4106 /* cpuid-features */ | |
4107 (void) ndi_prop_update_int(DDI_DEV_T_NONE, cpu_devi, | |
4108 "cpuid-features", CPI_FEATURES_EDX(cpi)); | |
4109 | |
4110 | |
4111 /* cpuid-features-ecx */ | |
4112 switch (cpi->cpi_vendor) { | |
4113 case X86_VENDOR_Intel: | |
1975
7490b056500b
6183891 Missing brand ID strings for several common x86 CPUs
dmick
parents:
1727
diff
changeset
|
4114 create = IS_NEW_F6(cpi) || cpi->cpi_family >= 0xf; |
0 | 4115 break; |
4116 default: | |
4117 create = 0; | |
4118 break; | |
4119 } | |
4120 if (create) | |
4121 (void) ndi_prop_update_int(DDI_DEV_T_NONE, cpu_devi, | |
4122 "cpuid-features-ecx", CPI_FEATURES_ECX(cpi)); | |
4123 | |
4124 /* ext-cpuid-features */ | |
4125 switch (cpi->cpi_vendor) { | |
1975
7490b056500b
6183891 Missing brand ID strings for several common x86 CPUs
dmick
parents:
1727
diff
changeset
|
4126 case X86_VENDOR_Intel: |
0 | 4127 case X86_VENDOR_AMD: |
4128 case X86_VENDOR_Cyrix: | |
4129 case X86_VENDOR_TM: | |
4130 case X86_VENDOR_Centaur: | |
4131 create = cpi->cpi_xmaxeax >= 0x80000001; | |
4132 break; | |
4133 default: | |
4134 create = 0; | |
4135 break; | |
4136 } | |
1975
7490b056500b
6183891 Missing brand ID strings for several common x86 CPUs
dmick
parents:
1727
diff
changeset
|
4137 if (create) { |
0 | 4138 (void) ndi_prop_update_int(DDI_DEV_T_NONE, cpu_devi, |
4481
2bb321aaf3c3
6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents:
4265
diff
changeset
|
4139 "ext-cpuid-features", CPI_FEATURES_XTD_EDX(cpi)); |
1975
7490b056500b
6183891 Missing brand ID strings for several common x86 CPUs
dmick
parents:
1727
diff
changeset
|
4140 (void) ndi_prop_update_int(DDI_DEV_T_NONE, cpu_devi, |
4481
2bb321aaf3c3
6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents:
4265
diff
changeset
|
4141 "ext-cpuid-features-ecx", CPI_FEATURES_XTD_ECX(cpi)); |
1975
7490b056500b
6183891 Missing brand ID strings for several common x86 CPUs
dmick
parents:
1727
diff
changeset
|
4142 } |
0 | 4143 |
4144 /* | |
4145 * Brand String first appeared in Intel Pentium IV, AMD K5 | |
4146 * model 1, and Cyrix GXm. On earlier models we try and | |
4147 * simulate something similar .. so this string should always | |
4148 * same -something- about the processor, however lame. | |
4149 */ | |
4150 (void) ndi_prop_update_string(DDI_DEV_T_NONE, cpu_devi, | |
4151 "brand-string", cpi->cpi_brandstr); | |
4152 | |
4153 /* | |
4154 * Finally, cache and tlb information | |
4155 */ | |
4156 switch (x86_which_cacheinfo(cpi)) { | |
4157 case X86_VENDOR_Intel: | |
4158 intel_walk_cacheinfo(cpi, cpu_devi, add_cacheent_props); | |
4159 break; | |
4160 case X86_VENDOR_Cyrix: | |
4161 cyrix_walk_cacheinfo(cpi, cpu_devi, add_cacheent_props); | |
4162 break; | |
4163 case X86_VENDOR_AMD: | |
4164 amd_cache_info(cpi, cpu_devi); | |
4165 break; | |
4166 default: | |
4167 break; | |
4168 } | |
4169 } | |
4170 | |
4171 struct l2info { | |
4172 int *l2i_csz; | |
4173 int *l2i_lsz; | |
4174 int *l2i_assoc; | |
4175 int l2i_ret; | |
4176 }; | |
4177 | |
4178 /* | |
4179 * A cacheinfo walker that fetches the size, line-size and associativity | |
4180 * of the L2 cache | |
4181 */ | |
4182 static int | |
4183 intel_l2cinfo(void *arg, const struct cachetab *ct) | |
4184 { | |
4185 struct l2info *l2i = arg; | |
4186 int *ip; | |
4187 | |
4188 if (ct->ct_label != l2_cache_str && | |
4189 ct->ct_label != sl2_cache_str) | |
4190 return (0); /* not an L2 -- keep walking */ | |
4191 | |
4192 if ((ip = l2i->l2i_csz) != NULL) | |
4193 *ip = ct->ct_size; | |
4194 if ((ip = l2i->l2i_lsz) != NULL) | |
4195 *ip = ct->ct_line_size; | |
4196 if ((ip = l2i->l2i_assoc) != NULL) | |
4197 *ip = ct->ct_assoc; | |
4198 l2i->l2i_ret = ct->ct_size; | |
4199 return (1); /* was an L2 -- terminate walk */ | |
4200 } | |
4201 | |
5070
f1c8fa0cbaca
6580117 panic: assertion failed: ISP2(CPUSETSIZE()) on VIA Esther based system
kchow
parents:
5045
diff
changeset
|
4202 /* |
f1c8fa0cbaca
6580117 panic: assertion failed: ISP2(CPUSETSIZE()) on VIA Esther based system
kchow
parents:
5045
diff
changeset
|
4203 * AMD L2/L3 Cache and TLB Associativity Field Definition: |
f1c8fa0cbaca
6580117 panic: assertion failed: ISP2(CPUSETSIZE()) on VIA Esther based system
kchow
parents:
5045
diff
changeset
|
4204 * |
f1c8fa0cbaca
6580117 panic: assertion failed: ISP2(CPUSETSIZE()) on VIA Esther based system
kchow
parents:
5045
diff
changeset
|
4205 * Unlike the associativity for the L1 cache and tlb where the 8 bit |
f1c8fa0cbaca
6580117 panic: assertion failed: ISP2(CPUSETSIZE()) on VIA Esther based system
kchow
parents:
5045
diff
changeset
|
4206 * value is the associativity, the associativity for the L2 cache and |
f1c8fa0cbaca
6580117 panic: assertion failed: ISP2(CPUSETSIZE()) on VIA Esther based system
kchow
parents:
5045
diff
changeset
|
4207 * tlb is encoded in the following table. The 4 bit L2 value serves as |
f1c8fa0cbaca
6580117 panic: assertion failed: ISP2(CPUSETSIZE()) on VIA Esther based system
kchow
parents:
5045
diff
changeset
|
4208 * an index into the amd_afd[] array to determine the associativity. |
f1c8fa0cbaca
6580117 panic: assertion failed: ISP2(CPUSETSIZE()) on VIA Esther based system
kchow
parents:
5045
diff
changeset
|
4209 * -1 is undefined. 0 is fully associative. |
f1c8fa0cbaca
6580117 panic: assertion failed: ISP2(CPUSETSIZE()) on VIA Esther based system
kchow
parents:
5045
diff
changeset
|
4210 */ |
f1c8fa0cbaca
6580117 panic: assertion failed: ISP2(CPUSETSIZE()) on VIA Esther based system
kchow
parents:
5045
diff
changeset
|
4211 |
f1c8fa0cbaca
6580117 panic: assertion failed: ISP2(CPUSETSIZE()) on VIA Esther based system
kchow
parents:
5045
diff
changeset
|
4212 static int amd_afd[] = |
f1c8fa0cbaca
6580117 panic: assertion failed: ISP2(CPUSETSIZE()) on VIA Esther based system
kchow
parents:
5045
diff
changeset
|
4213 {-1, 1, 2, -1, 4, -1, 8, -1, 16, -1, 32, 48, 64, 96, 128, 0}; |
f1c8fa0cbaca
6580117 panic: assertion failed: ISP2(CPUSETSIZE()) on VIA Esther based system
kchow
parents:
5045
diff
changeset
|
4214 |
0 | 4215 static void |
4216 amd_l2cacheinfo(struct cpuid_info *cpi, struct l2info *l2i) | |
4217 { | |
1228 | 4218 struct cpuid_regs *cp; |
0 | 4219 uint_t size, assoc; |
5070
f1c8fa0cbaca
6580117 panic: assertion failed: ISP2(CPUSETSIZE()) on VIA Esther based system
kchow
parents:
5045
diff
changeset
|
4220 int i; |
0 | 4221 int *ip; |
4222 | |
4223 if (cpi->cpi_xmaxeax < 0x80000006) | |
4224 return; | |
4225 cp = &cpi->cpi_extd[6]; | |
4226 | |
5070
f1c8fa0cbaca
6580117 panic: assertion failed: ISP2(CPUSETSIZE()) on VIA Esther based system
kchow
parents:
5045
diff
changeset
|
4227 if ((i = BITX(cp->cp_ecx, 15, 12)) != 0 && |
0 | 4228 (size = BITX(cp->cp_ecx, 31, 16)) != 0) { |
4229 uint_t cachesz = size * 1024; | |
5070
f1c8fa0cbaca
6580117 panic: assertion failed: ISP2(CPUSETSIZE()) on VIA Esther based system
kchow
parents:
5045
diff
changeset
|
4230 assoc = amd_afd[i]; |
f1c8fa0cbaca
6580117 panic: assertion failed: ISP2(CPUSETSIZE()) on VIA Esther based system
kchow
parents:
5045
diff
changeset
|
4231 |
f1c8fa0cbaca
6580117 panic: assertion failed: ISP2(CPUSETSIZE()) on VIA Esther based system
kchow
parents:
5045
diff
changeset
|
4232 ASSERT(assoc != -1); |
0 | 4233 |
4234 if ((ip = l2i->l2i_csz) != NULL) | |
4235 *ip = cachesz; | |
4236 if ((ip = l2i->l2i_lsz) != NULL) | |
4237 *ip = BITX(cp->cp_ecx, 7, 0); | |
4238 if ((ip = l2i->l2i_assoc) != NULL) | |
4239 *ip = assoc; | |
4240 l2i->l2i_ret = cachesz; | |
4241 } | |
4242 } | |
4243 | |
4244 int | |
4245 getl2cacheinfo(cpu_t *cpu, int *csz, int *lsz, int *assoc) | |
4246 { | |
4247 struct cpuid_info *cpi = cpu->cpu_m.mcpu_cpi; | |
4248 struct l2info __l2info, *l2i = &__l2info; | |
4249 | |
4250 l2i->l2i_csz = csz; | |
4251 l2i->l2i_lsz = lsz; | |
4252 l2i->l2i_assoc = assoc; | |
4253 l2i->l2i_ret = -1; | |
4254 | |
4255 switch (x86_which_cacheinfo(cpi)) { | |
4256 case X86_VENDOR_Intel: | |
4257 intel_walk_cacheinfo(cpi, l2i, intel_l2cinfo); | |
4258 break; | |
4259 case X86_VENDOR_Cyrix: | |
4260 cyrix_walk_cacheinfo(cpi, l2i, intel_l2cinfo); | |
4261 break; | |
4262 case X86_VENDOR_AMD: | |
4263 amd_l2cacheinfo(cpi, l2i); | |
4264 break; | |
4265 default: | |
4266 break; | |
4267 } | |
4268 return (l2i->l2i_ret); | |
4269 } | |
4481
2bb321aaf3c3
6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents:
4265
diff
changeset
|
4270 |
5084 | 4271 #if !defined(__xpv) |
4272 | |
5045
75a798a98460
6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents:
4858
diff
changeset
|
4273 uint32_t * |
75a798a98460
6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents:
4858
diff
changeset
|
4274 cpuid_mwait_alloc(cpu_t *cpu) |
75a798a98460
6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents:
4858
diff
changeset
|
4275 { |
75a798a98460
6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents:
4858
diff
changeset
|
4276 uint32_t *ret; |
75a798a98460
6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents:
4858
diff
changeset
|
4277 size_t mwait_size; |
75a798a98460
6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents:
4858
diff
changeset
|
4278 |
12004
93f274d4a367
PSARC/2009/104 Hot-Plug Support for ACPI-based Systems
Gerry Liu <jiang.liu@intel.com>
parents:
11919
diff
changeset
|
4279 ASSERT(cpuid_checkpass(CPU, 2)); |
93f274d4a367
PSARC/2009/104 Hot-Plug Support for ACPI-based Systems
Gerry Liu <jiang.liu@intel.com>
parents:
11919
diff
changeset
|
4280 |
93f274d4a367
PSARC/2009/104 Hot-Plug Support for ACPI-based Systems
Gerry Liu <jiang.liu@intel.com>
parents:
11919
diff
changeset
|
4281 mwait_size = CPU->cpu_m.mcpu_cpi->cpi_mwait.mon_max; |
5045
75a798a98460
6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents:
4858
diff
changeset
|
4282 if (mwait_size == 0) |
75a798a98460
6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents:
4858
diff
changeset
|
4283 return (NULL); |
75a798a98460
6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents:
4858
diff
changeset
|
4284 |
75a798a98460
6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents:
4858
diff
changeset
|
4285 /* |
75a798a98460
6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents:
4858
diff
changeset
|
4286 * kmem_alloc() returns cache line size aligned data for mwait_size |
75a798a98460
6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents:
4858
diff
changeset
|
4287 * allocations. mwait_size is currently cache line sized. Neither |
75a798a98460
6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents:
4858
diff
changeset
|
4288 * of these implementation details are guarantied to be true in the |
75a798a98460
6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents:
4858
diff
changeset
|
4289 * future. |
75a798a98460
6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents:
4858
diff
changeset
|
4290 * |
75a798a98460
6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents:
4858
diff
changeset
|
4291 * First try allocating mwait_size as kmem_alloc() currently returns |
75a798a98460
6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents:
4858
diff
changeset
|
4292 * correctly aligned memory. If kmem_alloc() does not return |
75a798a98460
6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents:
4858
diff
changeset
|
4293 * mwait_size aligned memory, then use mwait_size ROUNDUP. |
75a798a98460
6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents:
4858
diff
changeset
|
4294 * |
75a798a98460
6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents:
4858
diff
changeset
|
4295 * Set cpi_mwait.buf_actual and cpi_mwait.size_actual in case we |
75a798a98460
6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents:
4858
diff
changeset
|
4296 * decide to free this memory. |
75a798a98460
6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents:
4858
diff
changeset
|
4297 */ |
75a798a98460
6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents:
4858
diff
changeset
|
4298 ret = kmem_zalloc(mwait_size, KM_SLEEP); |
75a798a98460
6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents:
4858
diff
changeset
|
4299 if (ret == (uint32_t *)P2ROUNDUP((uintptr_t)ret, mwait_size)) { |
75a798a98460
6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents:
4858
diff
changeset
|
4300 cpu->cpu_m.mcpu_cpi->cpi_mwait.buf_actual = ret; |
75a798a98460
6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents:
4858
diff
changeset
|
4301 cpu->cpu_m.mcpu_cpi->cpi_mwait.size_actual = mwait_size; |
75a798a98460
6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents:
4858
diff
changeset
|
4302 *ret = MWAIT_RUNNING; |
75a798a98460
6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents:
4858
diff
changeset
|
4303 return (ret); |
75a798a98460
6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents:
4858
diff
changeset
|
4304 } else { |
75a798a98460
6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents:
4858
diff
changeset
|
4305 kmem_free(ret, mwait_size); |
75a798a98460
6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents:
4858
diff
changeset
|
4306 ret = kmem_zalloc(mwait_size * 2, KM_SLEEP); |
75a798a98460
6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents:
4858
diff
changeset
|
4307 cpu->cpu_m.mcpu_cpi->cpi_mwait.buf_actual = ret; |
75a798a98460
6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents:
4858
diff
changeset
|
4308 cpu->cpu_m.mcpu_cpi->cpi_mwait.size_actual = mwait_size * 2; |
75a798a98460
6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents:
4858
diff
changeset
|
4309 ret = (uint32_t *)P2ROUNDUP((uintptr_t)ret, mwait_size); |
75a798a98460
6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents:
4858
diff
changeset
|
4310 *ret = MWAIT_RUNNING; |
75a798a98460
6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents:
4858
diff
changeset
|
4311 return (ret); |
75a798a98460
6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents:
4858
diff
changeset
|
4312 } |
75a798a98460
6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents:
4858
diff
changeset
|
4313 } |
75a798a98460
6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents:
4858
diff
changeset
|
4314 |
75a798a98460
6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents:
4858
diff
changeset
|
4315 void |
75a798a98460
6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents:
4858
diff
changeset
|
4316 cpuid_mwait_free(cpu_t *cpu) |
4481
2bb321aaf3c3
6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents:
4265
diff
changeset
|
4317 { |
12004
93f274d4a367
PSARC/2009/104 Hot-Plug Support for ACPI-based Systems
Gerry Liu <jiang.liu@intel.com>
parents:
11919
diff
changeset
|
4318 if (cpu->cpu_m.mcpu_cpi == NULL) { |
93f274d4a367
PSARC/2009/104 Hot-Plug Support for ACPI-based Systems
Gerry Liu <jiang.liu@intel.com>
parents:
11919
diff
changeset
|
4319 return; |
93f274d4a367
PSARC/2009/104 Hot-Plug Support for ACPI-based Systems
Gerry Liu <jiang.liu@intel.com>
parents:
11919
diff
changeset
|
4320 } |
5045
75a798a98460
6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents:
4858
diff
changeset
|
4321 |
75a798a98460
6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents:
4858
diff
changeset
|
4322 if (cpu->cpu_m.mcpu_cpi->cpi_mwait.buf_actual != NULL && |
75a798a98460
6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents:
4858
diff
changeset
|
4323 cpu->cpu_m.mcpu_cpi->cpi_mwait.size_actual > 0) { |
75a798a98460
6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents:
4858
diff
changeset
|
4324 kmem_free(cpu->cpu_m.mcpu_cpi->cpi_mwait.buf_actual, |
75a798a98460
6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents:
4858
diff
changeset
|
4325 cpu->cpu_m.mcpu_cpi->cpi_mwait.size_actual); |
75a798a98460
6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents:
4858
diff
changeset
|
4326 } |
75a798a98460
6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents:
4858
diff
changeset
|
4327 |
75a798a98460
6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents:
4858
diff
changeset
|
4328 cpu->cpu_m.mcpu_cpi->cpi_mwait.buf_actual = NULL; |
75a798a98460
6577948 mach_alloc_mwait leaks memory when a CPU fails to start
bholler
parents:
4858
diff
changeset
|
4329 cpu->cpu_m.mcpu_cpi->cpi_mwait.size_actual = 0; |
4481
2bb321aaf3c3
6495392 use monitor/mwait for halting idle CPUs where supported
bholler
parents:
4265
diff
changeset
|
4330 } |
5084 | 4331 |
5322
010e79fdab36
6600939 gethrtime sometimes return a large time value into the future
sudheer
parents:
5284
diff
changeset
|
4332 void |
010e79fdab36
6600939 gethrtime sometimes return a large time value into the future
sudheer
parents:
5284
diff
changeset
|
4333 patch_tsc_read(int flag) |
010e79fdab36
6600939 gethrtime sometimes return a large time value into the future
sudheer
parents:
5284
diff
changeset
|
4334 { |
010e79fdab36
6600939 gethrtime sometimes return a large time value into the future
sudheer
parents:
5284
diff
changeset
|
4335 size_t cnt; |
7532
bb6372f778bb
PSARC 2008/569 FMA Topology & Retire Agent Refinements
Cheng Sean Ye <Sean.Ye@Sun.COM>
parents:
7282
diff
changeset
|
4336 |
5322
010e79fdab36
6600939 gethrtime sometimes return a large time value into the future
sudheer
parents:
5284
diff
changeset
|
4337 switch (flag) { |
010e79fdab36
6600939 gethrtime sometimes return a large time value into the future
sudheer
parents:
5284
diff
changeset
|
4338 case X86_NO_TSC: |
010e79fdab36
6600939 gethrtime sometimes return a large time value into the future
sudheer
parents:
5284
diff
changeset
|
4339 cnt = &_no_rdtsc_end - &_no_rdtsc_start; |
5338
fd7cad8433cf
6600939 gethrtime sometimes return a large time value into the future (fix lint)
sudheer
parents:
5322
diff
changeset
|
4340 (void) memcpy((void *)tsc_read, (void *)&_no_rdtsc_start, cnt); |
5322
010e79fdab36
6600939 gethrtime sometimes return a large time value into the future
sudheer
parents:
5284
diff
changeset
|
4341 break; |
010e79fdab36
6600939 gethrtime sometimes return a large time value into the future
sudheer
parents:
5284
diff
changeset
|
4342 case X86_HAVE_TSCP: |
010e79fdab36
6600939 gethrtime sometimes return a large time value into the future
sudheer
parents:
5284
diff
changeset
|
4343 cnt = &_tscp_end - &_tscp_start; |
5338
fd7cad8433cf
6600939 gethrtime sometimes return a large time value into the future (fix lint)
sudheer
parents:
5322
diff
changeset
|
4344 (void) memcpy((void *)tsc_read, (void *)&_tscp_start, cnt); |
5322
010e79fdab36
6600939 gethrtime sometimes return a large time value into the future
sudheer
parents:
5284
diff
changeset
|
4345 break; |
010e79fdab36
6600939 gethrtime sometimes return a large time value into the future
sudheer
parents:
5284
diff
changeset
|
4346 case X86_TSC_MFENCE: |
010e79fdab36
6600939 gethrtime sometimes return a large time value into the future
sudheer
parents:
5284
diff
changeset
|
4347 cnt = &_tsc_mfence_end - &_tsc_mfence_start; |
5338
fd7cad8433cf
6600939 gethrtime sometimes return a large time value into the future (fix lint)
sudheer
parents:
5322
diff
changeset
|
4348 (void) memcpy((void *)tsc_read, |
fd7cad8433cf
6600939 gethrtime sometimes return a large time value into the future (fix lint)
sudheer
parents:
5322
diff
changeset
|
4349 (void *)&_tsc_mfence_start, cnt); |
5322
010e79fdab36
6600939 gethrtime sometimes return a large time value into the future
sudheer
parents:
5284
diff
changeset
|
4350 break; |
6642
c41a8f6eba0e
6671782 rdtsc synchronization change for Intel processors
sudheer
parents:
6445
diff
changeset
|
4351 case X86_TSC_LFENCE: |
c41a8f6eba0e
6671782 rdtsc synchronization change for Intel processors
sudheer
parents:
6445
diff
changeset
|
4352 cnt = &_tsc_lfence_end - &_tsc_lfence_start; |
c41a8f6eba0e
6671782 rdtsc synchronization change for Intel processors
sudheer
parents:
6445
diff
changeset
|
4353 (void) memcpy((void *)tsc_read, |
c41a8f6eba0e
6671782 rdtsc synchronization change for Intel processors
sudheer
parents:
6445
diff
changeset
|
4354 (void *)&_tsc_lfence_start, cnt); |
c41a8f6eba0e
6671782 rdtsc synchronization change for Intel processors
sudheer
parents:
6445
diff
changeset
|
4355 break; |
5322
010e79fdab36
6600939 gethrtime sometimes return a large time value into the future
sudheer
parents:
5284
diff
changeset
|
4356 default: |
010e79fdab36
6600939 gethrtime sometimes return a large time value into the future
sudheer
parents:
5284
diff
changeset
|
4357 break; |
010e79fdab36
6600939 gethrtime sometimes return a large time value into the future
sudheer
parents:
5284
diff
changeset
|
4358 } |
010e79fdab36
6600939 gethrtime sometimes return a large time value into the future
sudheer
parents:
5284
diff
changeset
|
4359 } |
010e79fdab36
6600939 gethrtime sometimes return a large time value into the future
sudheer
parents:
5284
diff
changeset
|
4360 |
8906
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
8418
diff
changeset
|
4361 int |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
8418
diff
changeset
|
4362 cpuid_deep_cstates_supported(void) |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
8418
diff
changeset
|
4363 { |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
8418
diff
changeset
|
4364 struct cpuid_info *cpi; |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
8418
diff
changeset
|
4365 struct cpuid_regs regs; |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
8418
diff
changeset
|
4366 |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
8418
diff
changeset
|
4367 ASSERT(cpuid_checkpass(CPU, 1)); |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
8418
diff
changeset
|
4368 |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
8418
diff
changeset
|
4369 cpi = CPU->cpu_m.mcpu_cpi; |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
8418
diff
changeset
|
4370 |
12838
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
4371 if (!is_x86_feature(x86_featureset, X86FSET_CPUID)) |
8906
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
8418
diff
changeset
|
4372 return (0); |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
8418
diff
changeset
|
4373 |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
8418
diff
changeset
|
4374 switch (cpi->cpi_vendor) { |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
8418
diff
changeset
|
4375 case X86_VENDOR_Intel: |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
8418
diff
changeset
|
4376 if (cpi->cpi_xmaxeax < 0x80000007) |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
8418
diff
changeset
|
4377 return (0); |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
8418
diff
changeset
|
4378 |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
8418
diff
changeset
|
4379 /* |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
8418
diff
changeset
|
4380 * TSC run at a constant rate in all ACPI C-states? |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
8418
diff
changeset
|
4381 */ |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
8418
diff
changeset
|
4382 regs.cp_eax = 0x80000007; |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
8418
diff
changeset
|
4383 (void) __cpuid_insn(®s); |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
8418
diff
changeset
|
4384 return (regs.cp_edx & CPUID_TSC_CSTATE_INVARIANCE); |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
8418
diff
changeset
|
4385 |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
8418
diff
changeset
|
4386 default: |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
8418
diff
changeset
|
4387 return (0); |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
8418
diff
changeset
|
4388 } |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
8418
diff
changeset
|
4389 } |
e559381f1e2b
PSARC 2008/777 cpupm keyword mode extensions
Eric Saxe <Eric.Saxe@Sun.COM>
parents:
8418
diff
changeset
|
4390 |
8930
02055889c73a
6786943 AMD-based systems with C1E state enabled hang at boot
Bill Holler <Bill.Holler@Sun.COM>
parents:
8906
diff
changeset
|
4391 #endif /* !__xpv */ |
02055889c73a
6786943 AMD-based systems with C1E state enabled hang at boot
Bill Holler <Bill.Holler@Sun.COM>
parents:
8906
diff
changeset
|
4392 |
02055889c73a
6786943 AMD-based systems with C1E state enabled hang at boot
Bill Holler <Bill.Holler@Sun.COM>
parents:
8906
diff
changeset
|
4393 void |
02055889c73a
6786943 AMD-based systems with C1E state enabled hang at boot
Bill Holler <Bill.Holler@Sun.COM>
parents:
8906
diff
changeset
|
4394 post_startup_cpu_fixups(void) |
02055889c73a
6786943 AMD-based systems with C1E state enabled hang at boot
Bill Holler <Bill.Holler@Sun.COM>
parents:
8906
diff
changeset
|
4395 { |
02055889c73a
6786943 AMD-based systems with C1E state enabled hang at boot
Bill Holler <Bill.Holler@Sun.COM>
parents:
8906
diff
changeset
|
4396 #ifndef __xpv |
02055889c73a
6786943 AMD-based systems with C1E state enabled hang at boot
Bill Holler <Bill.Holler@Sun.COM>
parents:
8906
diff
changeset
|
4397 /* |
02055889c73a
6786943 AMD-based systems with C1E state enabled hang at boot
Bill Holler <Bill.Holler@Sun.COM>
parents:
8906
diff
changeset
|
4398 * Some AMD processors support C1E state. Entering this state will |
02055889c73a
6786943 AMD-based systems with C1E state enabled hang at boot
Bill Holler <Bill.Holler@Sun.COM>
parents:
8906
diff
changeset
|
4399 * cause the local APIC timer to stop, which we can't deal with at |
02055889c73a
6786943 AMD-based systems with C1E state enabled hang at boot
Bill Holler <Bill.Holler@Sun.COM>
parents:
8906
diff
changeset
|
4400 * this time. |
02055889c73a
6786943 AMD-based systems with C1E state enabled hang at boot
Bill Holler <Bill.Holler@Sun.COM>
parents:
8906
diff
changeset
|
4401 */ |
02055889c73a
6786943 AMD-based systems with C1E state enabled hang at boot
Bill Holler <Bill.Holler@Sun.COM>
parents:
8906
diff
changeset
|
4402 if (cpuid_getvendor(CPU) == X86_VENDOR_AMD) { |
02055889c73a
6786943 AMD-based systems with C1E state enabled hang at boot
Bill Holler <Bill.Holler@Sun.COM>
parents:
8906
diff
changeset
|
4403 on_trap_data_t otd; |
02055889c73a
6786943 AMD-based systems with C1E state enabled hang at boot
Bill Holler <Bill.Holler@Sun.COM>
parents:
8906
diff
changeset
|
4404 uint64_t reg; |
02055889c73a
6786943 AMD-based systems with C1E state enabled hang at boot
Bill Holler <Bill.Holler@Sun.COM>
parents:
8906
diff
changeset
|
4405 |
02055889c73a
6786943 AMD-based systems with C1E state enabled hang at boot
Bill Holler <Bill.Holler@Sun.COM>
parents:
8906
diff
changeset
|
4406 if (!on_trap(&otd, OT_DATA_ACCESS)) { |
02055889c73a
6786943 AMD-based systems with C1E state enabled hang at boot
Bill Holler <Bill.Holler@Sun.COM>
parents:
8906
diff
changeset
|
4407 reg = rdmsr(MSR_AMD_INT_PENDING_CMP_HALT); |
02055889c73a
6786943 AMD-based systems with C1E state enabled hang at boot
Bill Holler <Bill.Holler@Sun.COM>
parents:
8906
diff
changeset
|
4408 /* Disable C1E state if it is enabled by BIOS */ |
02055889c73a
6786943 AMD-based systems with C1E state enabled hang at boot
Bill Holler <Bill.Holler@Sun.COM>
parents:
8906
diff
changeset
|
4409 if ((reg >> AMD_ACTONCMPHALT_SHIFT) & |
02055889c73a
6786943 AMD-based systems with C1E state enabled hang at boot
Bill Holler <Bill.Holler@Sun.COM>
parents:
8906
diff
changeset
|
4410 AMD_ACTONCMPHALT_MASK) { |
02055889c73a
6786943 AMD-based systems with C1E state enabled hang at boot
Bill Holler <Bill.Holler@Sun.COM>
parents:
8906
diff
changeset
|
4411 reg &= ~(AMD_ACTONCMPHALT_MASK << |
02055889c73a
6786943 AMD-based systems with C1E state enabled hang at boot
Bill Holler <Bill.Holler@Sun.COM>
parents:
8906
diff
changeset
|
4412 AMD_ACTONCMPHALT_SHIFT); |
02055889c73a
6786943 AMD-based systems with C1E state enabled hang at boot
Bill Holler <Bill.Holler@Sun.COM>
parents:
8906
diff
changeset
|
4413 wrmsr(MSR_AMD_INT_PENDING_CMP_HALT, reg); |
02055889c73a
6786943 AMD-based systems with C1E state enabled hang at boot
Bill Holler <Bill.Holler@Sun.COM>
parents:
8906
diff
changeset
|
4414 } |
02055889c73a
6786943 AMD-based systems with C1E state enabled hang at boot
Bill Holler <Bill.Holler@Sun.COM>
parents:
8906
diff
changeset
|
4415 } |
02055889c73a
6786943 AMD-based systems with C1E state enabled hang at boot
Bill Holler <Bill.Holler@Sun.COM>
parents:
8906
diff
changeset
|
4416 no_trap(); |
02055889c73a
6786943 AMD-based systems with C1E state enabled hang at boot
Bill Holler <Bill.Holler@Sun.COM>
parents:
8906
diff
changeset
|
4417 } |
02055889c73a
6786943 AMD-based systems with C1E state enabled hang at boot
Bill Holler <Bill.Holler@Sun.COM>
parents:
8906
diff
changeset
|
4418 #endif /* !__xpv */ |
02055889c73a
6786943 AMD-based systems with C1E state enabled hang at boot
Bill Holler <Bill.Holler@Sun.COM>
parents:
8906
diff
changeset
|
4419 } |
02055889c73a
6786943 AMD-based systems with C1E state enabled hang at boot
Bill Holler <Bill.Holler@Sun.COM>
parents:
8906
diff
changeset
|
4420 |
9283
2ee48b3d20ef
6821708 deeper C-state support required for processors with ARAT
Bill Holler <Bill.Holler@Sun.COM>
parents:
9000
diff
changeset
|
4421 /* |
13146
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
4422 * Setup necessary registers to enable XSAVE feature on this processor. |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
4423 * This function needs to be called early enough, so that no xsave/xrstor |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
4424 * ops will execute on the processor before the MSRs are properly set up. |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
4425 * |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
4426 * Current implementation has the following assumption: |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
4427 * - cpuid_pass1() is done, so that X86 features are known. |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
4428 * - fpu_probe() is done, so that fp_save_mech is chosen. |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
4429 */ |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
4430 void |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
4431 xsave_setup_msr(cpu_t *cpu) |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
4432 { |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
4433 ASSERT(fp_save_mech == FP_XSAVE); |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
4434 ASSERT(is_x86_feature(x86_featureset, X86FSET_XSAVE)); |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
4435 |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
4436 /* Enable OSXSAVE in CR4. */ |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
4437 setcr4(getcr4() | CR4_OSXSAVE); |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
4438 /* |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
4439 * Update SW copy of ECX, so that /dev/cpu/self/cpuid will report |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
4440 * correct value. |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
4441 */ |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
4442 cpu->cpu_m.mcpu_cpi->cpi_std[1].cp_ecx |= CPUID_INTC_ECX_OSXSAVE; |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
4443 setup_xfem(); |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
4444 } |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
4445 |
8315ff49e22e
6958308 XSAVE/XRSTOR mechanism to save and restore processor state
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
13041
diff
changeset
|
4446 /* |
9283
2ee48b3d20ef
6821708 deeper C-state support required for processors with ARAT
Bill Holler <Bill.Holler@Sun.COM>
parents:
9000
diff
changeset
|
4447 * Starting with the Westmere processor the local |
2ee48b3d20ef
6821708 deeper C-state support required for processors with ARAT
Bill Holler <Bill.Holler@Sun.COM>
parents:
9000
diff
changeset
|
4448 * APIC timer will continue running in all C-states, |
2ee48b3d20ef
6821708 deeper C-state support required for processors with ARAT
Bill Holler <Bill.Holler@Sun.COM>
parents:
9000
diff
changeset
|
4449 * including the deepest C-states. |
2ee48b3d20ef
6821708 deeper C-state support required for processors with ARAT
Bill Holler <Bill.Holler@Sun.COM>
parents:
9000
diff
changeset
|
4450 */ |
2ee48b3d20ef
6821708 deeper C-state support required for processors with ARAT
Bill Holler <Bill.Holler@Sun.COM>
parents:
9000
diff
changeset
|
4451 int |
2ee48b3d20ef
6821708 deeper C-state support required for processors with ARAT
Bill Holler <Bill.Holler@Sun.COM>
parents:
9000
diff
changeset
|
4452 cpuid_arat_supported(void) |
2ee48b3d20ef
6821708 deeper C-state support required for processors with ARAT
Bill Holler <Bill.Holler@Sun.COM>
parents:
9000
diff
changeset
|
4453 { |
2ee48b3d20ef
6821708 deeper C-state support required for processors with ARAT
Bill Holler <Bill.Holler@Sun.COM>
parents:
9000
diff
changeset
|
4454 struct cpuid_info *cpi; |
2ee48b3d20ef
6821708 deeper C-state support required for processors with ARAT
Bill Holler <Bill.Holler@Sun.COM>
parents:
9000
diff
changeset
|
4455 struct cpuid_regs regs; |
2ee48b3d20ef
6821708 deeper C-state support required for processors with ARAT
Bill Holler <Bill.Holler@Sun.COM>
parents:
9000
diff
changeset
|
4456 |
2ee48b3d20ef
6821708 deeper C-state support required for processors with ARAT
Bill Holler <Bill.Holler@Sun.COM>
parents:
9000
diff
changeset
|
4457 ASSERT(cpuid_checkpass(CPU, 1)); |
12838
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
4458 ASSERT(is_x86_feature(x86_featureset, X86FSET_CPUID)); |
9283
2ee48b3d20ef
6821708 deeper C-state support required for processors with ARAT
Bill Holler <Bill.Holler@Sun.COM>
parents:
9000
diff
changeset
|
4459 |
2ee48b3d20ef
6821708 deeper C-state support required for processors with ARAT
Bill Holler <Bill.Holler@Sun.COM>
parents:
9000
diff
changeset
|
4460 cpi = CPU->cpu_m.mcpu_cpi; |
2ee48b3d20ef
6821708 deeper C-state support required for processors with ARAT
Bill Holler <Bill.Holler@Sun.COM>
parents:
9000
diff
changeset
|
4461 |
2ee48b3d20ef
6821708 deeper C-state support required for processors with ARAT
Bill Holler <Bill.Holler@Sun.COM>
parents:
9000
diff
changeset
|
4462 switch (cpi->cpi_vendor) { |
2ee48b3d20ef
6821708 deeper C-state support required for processors with ARAT
Bill Holler <Bill.Holler@Sun.COM>
parents:
9000
diff
changeset
|
4463 case X86_VENDOR_Intel: |
2ee48b3d20ef
6821708 deeper C-state support required for processors with ARAT
Bill Holler <Bill.Holler@Sun.COM>
parents:
9000
diff
changeset
|
4464 /* |
2ee48b3d20ef
6821708 deeper C-state support required for processors with ARAT
Bill Holler <Bill.Holler@Sun.COM>
parents:
9000
diff
changeset
|
4465 * Always-running Local APIC Timer is |
2ee48b3d20ef
6821708 deeper C-state support required for processors with ARAT
Bill Holler <Bill.Holler@Sun.COM>
parents:
9000
diff
changeset
|
4466 * indicated by CPUID.6.EAX[2]. |
2ee48b3d20ef
6821708 deeper C-state support required for processors with ARAT
Bill Holler <Bill.Holler@Sun.COM>
parents:
9000
diff
changeset
|
4467 */ |
2ee48b3d20ef
6821708 deeper C-state support required for processors with ARAT
Bill Holler <Bill.Holler@Sun.COM>
parents:
9000
diff
changeset
|
4468 if (cpi->cpi_maxeax >= 6) { |
2ee48b3d20ef
6821708 deeper C-state support required for processors with ARAT
Bill Holler <Bill.Holler@Sun.COM>
parents:
9000
diff
changeset
|
4469 regs.cp_eax = 6; |
2ee48b3d20ef
6821708 deeper C-state support required for processors with ARAT
Bill Holler <Bill.Holler@Sun.COM>
parents:
9000
diff
changeset
|
4470 (void) cpuid_insn(NULL, ®s); |
2ee48b3d20ef
6821708 deeper C-state support required for processors with ARAT
Bill Holler <Bill.Holler@Sun.COM>
parents:
9000
diff
changeset
|
4471 return (regs.cp_eax & CPUID_CSTATE_ARAT); |
2ee48b3d20ef
6821708 deeper C-state support required for processors with ARAT
Bill Holler <Bill.Holler@Sun.COM>
parents:
9000
diff
changeset
|
4472 } else { |
2ee48b3d20ef
6821708 deeper C-state support required for processors with ARAT
Bill Holler <Bill.Holler@Sun.COM>
parents:
9000
diff
changeset
|
4473 return (0); |
2ee48b3d20ef
6821708 deeper C-state support required for processors with ARAT
Bill Holler <Bill.Holler@Sun.COM>
parents:
9000
diff
changeset
|
4474 } |
2ee48b3d20ef
6821708 deeper C-state support required for processors with ARAT
Bill Holler <Bill.Holler@Sun.COM>
parents:
9000
diff
changeset
|
4475 default: |
2ee48b3d20ef
6821708 deeper C-state support required for processors with ARAT
Bill Holler <Bill.Holler@Sun.COM>
parents:
9000
diff
changeset
|
4476 return (0); |
2ee48b3d20ef
6821708 deeper C-state support required for processors with ARAT
Bill Holler <Bill.Holler@Sun.COM>
parents:
9000
diff
changeset
|
4477 } |
2ee48b3d20ef
6821708 deeper C-state support required for processors with ARAT
Bill Holler <Bill.Holler@Sun.COM>
parents:
9000
diff
changeset
|
4478 } |
2ee48b3d20ef
6821708 deeper C-state support required for processors with ARAT
Bill Holler <Bill.Holler@Sun.COM>
parents:
9000
diff
changeset
|
4479 |
10992
54a1c1cbd683
6887944 support for IA32_ENERGY_PERF_BIAS MSR
aubrey.li@intel.com
parents:
10947
diff
changeset
|
4480 /* |
54a1c1cbd683
6887944 support for IA32_ENERGY_PERF_BIAS MSR
aubrey.li@intel.com
parents:
10947
diff
changeset
|
4481 * Check support for Intel ENERGY_PERF_BIAS feature |
54a1c1cbd683
6887944 support for IA32_ENERGY_PERF_BIAS MSR
aubrey.li@intel.com
parents:
10947
diff
changeset
|
4482 */ |
54a1c1cbd683
6887944 support for IA32_ENERGY_PERF_BIAS MSR
aubrey.li@intel.com
parents:
10947
diff
changeset
|
4483 int |
54a1c1cbd683
6887944 support for IA32_ENERGY_PERF_BIAS MSR
aubrey.li@intel.com
parents:
10947
diff
changeset
|
4484 cpuid_iepb_supported(struct cpu *cp) |
54a1c1cbd683
6887944 support for IA32_ENERGY_PERF_BIAS MSR
aubrey.li@intel.com
parents:
10947
diff
changeset
|
4485 { |
54a1c1cbd683
6887944 support for IA32_ENERGY_PERF_BIAS MSR
aubrey.li@intel.com
parents:
10947
diff
changeset
|
4486 struct cpuid_info *cpi = cp->cpu_m.mcpu_cpi; |
54a1c1cbd683
6887944 support for IA32_ENERGY_PERF_BIAS MSR
aubrey.li@intel.com
parents:
10947
diff
changeset
|
4487 struct cpuid_regs regs; |
54a1c1cbd683
6887944 support for IA32_ENERGY_PERF_BIAS MSR
aubrey.li@intel.com
parents:
10947
diff
changeset
|
4488 |
54a1c1cbd683
6887944 support for IA32_ENERGY_PERF_BIAS MSR
aubrey.li@intel.com
parents:
10947
diff
changeset
|
4489 ASSERT(cpuid_checkpass(cp, 1)); |
54a1c1cbd683
6887944 support for IA32_ENERGY_PERF_BIAS MSR
aubrey.li@intel.com
parents:
10947
diff
changeset
|
4490 |
12838
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
4491 if (!(is_x86_feature(x86_featureset, X86FSET_CPUID)) || |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
4492 !(is_x86_feature(x86_featureset, X86FSET_MSR))) { |
10992
54a1c1cbd683
6887944 support for IA32_ENERGY_PERF_BIAS MSR
aubrey.li@intel.com
parents:
10947
diff
changeset
|
4493 return (0); |
54a1c1cbd683
6887944 support for IA32_ENERGY_PERF_BIAS MSR
aubrey.li@intel.com
parents:
10947
diff
changeset
|
4494 } |
54a1c1cbd683
6887944 support for IA32_ENERGY_PERF_BIAS MSR
aubrey.li@intel.com
parents:
10947
diff
changeset
|
4495 |
54a1c1cbd683
6887944 support for IA32_ENERGY_PERF_BIAS MSR
aubrey.li@intel.com
parents:
10947
diff
changeset
|
4496 /* |
54a1c1cbd683
6887944 support for IA32_ENERGY_PERF_BIAS MSR
aubrey.li@intel.com
parents:
10947
diff
changeset
|
4497 * Intel ENERGY_PERF_BIAS MSR is indicated by |
54a1c1cbd683
6887944 support for IA32_ENERGY_PERF_BIAS MSR
aubrey.li@intel.com
parents:
10947
diff
changeset
|
4498 * capability bit CPUID.6.ECX.3 |
54a1c1cbd683
6887944 support for IA32_ENERGY_PERF_BIAS MSR
aubrey.li@intel.com
parents:
10947
diff
changeset
|
4499 */ |
54a1c1cbd683
6887944 support for IA32_ENERGY_PERF_BIAS MSR
aubrey.li@intel.com
parents:
10947
diff
changeset
|
4500 if ((cpi->cpi_vendor != X86_VENDOR_Intel) || (cpi->cpi_maxeax < 6)) |
54a1c1cbd683
6887944 support for IA32_ENERGY_PERF_BIAS MSR
aubrey.li@intel.com
parents:
10947
diff
changeset
|
4501 return (0); |
54a1c1cbd683
6887944 support for IA32_ENERGY_PERF_BIAS MSR
aubrey.li@intel.com
parents:
10947
diff
changeset
|
4502 |
54a1c1cbd683
6887944 support for IA32_ENERGY_PERF_BIAS MSR
aubrey.li@intel.com
parents:
10947
diff
changeset
|
4503 regs.cp_eax = 0x6; |
54a1c1cbd683
6887944 support for IA32_ENERGY_PERF_BIAS MSR
aubrey.li@intel.com
parents:
10947
diff
changeset
|
4504 (void) cpuid_insn(NULL, ®s); |
54a1c1cbd683
6887944 support for IA32_ENERGY_PERF_BIAS MSR
aubrey.li@intel.com
parents:
10947
diff
changeset
|
4505 return (regs.cp_ecx & CPUID_EPB_SUPPORT); |
54a1c1cbd683
6887944 support for IA32_ENERGY_PERF_BIAS MSR
aubrey.li@intel.com
parents:
10947
diff
changeset
|
4506 } |
54a1c1cbd683
6887944 support for IA32_ENERGY_PERF_BIAS MSR
aubrey.li@intel.com
parents:
10947
diff
changeset
|
4507 |
13041
2ba2eec82e2a
6932990 Support for TSC deadline timer
Krishnendu Sadhukhan - Sun Microsystems <Krishnendu.Sadhukhan@Sun.COM>
parents:
12838
diff
changeset
|
4508 /* |
2ba2eec82e2a
6932990 Support for TSC deadline timer
Krishnendu Sadhukhan - Sun Microsystems <Krishnendu.Sadhukhan@Sun.COM>
parents:
12838
diff
changeset
|
4509 * Check support for TSC deadline timer |
2ba2eec82e2a
6932990 Support for TSC deadline timer
Krishnendu Sadhukhan - Sun Microsystems <Krishnendu.Sadhukhan@Sun.COM>
parents:
12838
diff
changeset
|
4510 * |
2ba2eec82e2a
6932990 Support for TSC deadline timer
Krishnendu Sadhukhan - Sun Microsystems <Krishnendu.Sadhukhan@Sun.COM>
parents:
12838
diff
changeset
|
4511 * TSC deadline timer provides a superior software programming |
2ba2eec82e2a
6932990 Support for TSC deadline timer
Krishnendu Sadhukhan - Sun Microsystems <Krishnendu.Sadhukhan@Sun.COM>
parents:
12838
diff
changeset
|
4512 * model over local APIC timer that eliminates "time drifts". |
2ba2eec82e2a
6932990 Support for TSC deadline timer
Krishnendu Sadhukhan - Sun Microsystems <Krishnendu.Sadhukhan@Sun.COM>
parents:
12838
diff
changeset
|
4513 * Instead of specifying a relative time, software specifies an |
2ba2eec82e2a
6932990 Support for TSC deadline timer
Krishnendu Sadhukhan - Sun Microsystems <Krishnendu.Sadhukhan@Sun.COM>
parents:
12838
diff
changeset
|
4514 * absolute time as the target at which the processor should |
2ba2eec82e2a
6932990 Support for TSC deadline timer
Krishnendu Sadhukhan - Sun Microsystems <Krishnendu.Sadhukhan@Sun.COM>
parents:
12838
diff
changeset
|
4515 * generate a timer event. |
2ba2eec82e2a
6932990 Support for TSC deadline timer
Krishnendu Sadhukhan - Sun Microsystems <Krishnendu.Sadhukhan@Sun.COM>
parents:
12838
diff
changeset
|
4516 */ |
2ba2eec82e2a
6932990 Support for TSC deadline timer
Krishnendu Sadhukhan - Sun Microsystems <Krishnendu.Sadhukhan@Sun.COM>
parents:
12838
diff
changeset
|
4517 int |
2ba2eec82e2a
6932990 Support for TSC deadline timer
Krishnendu Sadhukhan - Sun Microsystems <Krishnendu.Sadhukhan@Sun.COM>
parents:
12838
diff
changeset
|
4518 cpuid_deadline_tsc_supported(void) |
2ba2eec82e2a
6932990 Support for TSC deadline timer
Krishnendu Sadhukhan - Sun Microsystems <Krishnendu.Sadhukhan@Sun.COM>
parents:
12838
diff
changeset
|
4519 { |
2ba2eec82e2a
6932990 Support for TSC deadline timer
Krishnendu Sadhukhan - Sun Microsystems <Krishnendu.Sadhukhan@Sun.COM>
parents:
12838
diff
changeset
|
4520 struct cpuid_info *cpi = CPU->cpu_m.mcpu_cpi; |
2ba2eec82e2a
6932990 Support for TSC deadline timer
Krishnendu Sadhukhan - Sun Microsystems <Krishnendu.Sadhukhan@Sun.COM>
parents:
12838
diff
changeset
|
4521 struct cpuid_regs regs; |
2ba2eec82e2a
6932990 Support for TSC deadline timer
Krishnendu Sadhukhan - Sun Microsystems <Krishnendu.Sadhukhan@Sun.COM>
parents:
12838
diff
changeset
|
4522 |
2ba2eec82e2a
6932990 Support for TSC deadline timer
Krishnendu Sadhukhan - Sun Microsystems <Krishnendu.Sadhukhan@Sun.COM>
parents:
12838
diff
changeset
|
4523 ASSERT(cpuid_checkpass(CPU, 1)); |
2ba2eec82e2a
6932990 Support for TSC deadline timer
Krishnendu Sadhukhan - Sun Microsystems <Krishnendu.Sadhukhan@Sun.COM>
parents:
12838
diff
changeset
|
4524 ASSERT(is_x86_feature(x86_featureset, X86FSET_CPUID)); |
2ba2eec82e2a
6932990 Support for TSC deadline timer
Krishnendu Sadhukhan - Sun Microsystems <Krishnendu.Sadhukhan@Sun.COM>
parents:
12838
diff
changeset
|
4525 |
2ba2eec82e2a
6932990 Support for TSC deadline timer
Krishnendu Sadhukhan - Sun Microsystems <Krishnendu.Sadhukhan@Sun.COM>
parents:
12838
diff
changeset
|
4526 switch (cpi->cpi_vendor) { |
2ba2eec82e2a
6932990 Support for TSC deadline timer
Krishnendu Sadhukhan - Sun Microsystems <Krishnendu.Sadhukhan@Sun.COM>
parents:
12838
diff
changeset
|
4527 case X86_VENDOR_Intel: |
2ba2eec82e2a
6932990 Support for TSC deadline timer
Krishnendu Sadhukhan - Sun Microsystems <Krishnendu.Sadhukhan@Sun.COM>
parents:
12838
diff
changeset
|
4528 if (cpi->cpi_maxeax >= 1) { |
2ba2eec82e2a
6932990 Support for TSC deadline timer
Krishnendu Sadhukhan - Sun Microsystems <Krishnendu.Sadhukhan@Sun.COM>
parents:
12838
diff
changeset
|
4529 regs.cp_eax = 1; |
2ba2eec82e2a
6932990 Support for TSC deadline timer
Krishnendu Sadhukhan - Sun Microsystems <Krishnendu.Sadhukhan@Sun.COM>
parents:
12838
diff
changeset
|
4530 (void) cpuid_insn(NULL, ®s); |
2ba2eec82e2a
6932990 Support for TSC deadline timer
Krishnendu Sadhukhan - Sun Microsystems <Krishnendu.Sadhukhan@Sun.COM>
parents:
12838
diff
changeset
|
4531 return (regs.cp_ecx & CPUID_DEADLINE_TSC); |
2ba2eec82e2a
6932990 Support for TSC deadline timer
Krishnendu Sadhukhan - Sun Microsystems <Krishnendu.Sadhukhan@Sun.COM>
parents:
12838
diff
changeset
|
4532 } else { |
2ba2eec82e2a
6932990 Support for TSC deadline timer
Krishnendu Sadhukhan - Sun Microsystems <Krishnendu.Sadhukhan@Sun.COM>
parents:
12838
diff
changeset
|
4533 return (0); |
2ba2eec82e2a
6932990 Support for TSC deadline timer
Krishnendu Sadhukhan - Sun Microsystems <Krishnendu.Sadhukhan@Sun.COM>
parents:
12838
diff
changeset
|
4534 } |
2ba2eec82e2a
6932990 Support for TSC deadline timer
Krishnendu Sadhukhan - Sun Microsystems <Krishnendu.Sadhukhan@Sun.COM>
parents:
12838
diff
changeset
|
4535 default: |
2ba2eec82e2a
6932990 Support for TSC deadline timer
Krishnendu Sadhukhan - Sun Microsystems <Krishnendu.Sadhukhan@Sun.COM>
parents:
12838
diff
changeset
|
4536 return (0); |
2ba2eec82e2a
6932990 Support for TSC deadline timer
Krishnendu Sadhukhan - Sun Microsystems <Krishnendu.Sadhukhan@Sun.COM>
parents:
12838
diff
changeset
|
4537 } |
2ba2eec82e2a
6932990 Support for TSC deadline timer
Krishnendu Sadhukhan - Sun Microsystems <Krishnendu.Sadhukhan@Sun.COM>
parents:
12838
diff
changeset
|
4538 } |
2ba2eec82e2a
6932990 Support for TSC deadline timer
Krishnendu Sadhukhan - Sun Microsystems <Krishnendu.Sadhukhan@Sun.COM>
parents:
12838
diff
changeset
|
4539 |
8377
e4fb59d35f38
6292199 bcopy and kcopy should'nt use rep, smov
Bill Holler <Bill.Holler@Sun.COM>
parents:
7798
diff
changeset
|
4540 #if defined(__amd64) && !defined(__xpv) |
e4fb59d35f38
6292199 bcopy and kcopy should'nt use rep, smov
Bill Holler <Bill.Holler@Sun.COM>
parents:
7798
diff
changeset
|
4541 /* |
e4fb59d35f38
6292199 bcopy and kcopy should'nt use rep, smov
Bill Holler <Bill.Holler@Sun.COM>
parents:
7798
diff
changeset
|
4542 * Patch in versions of bcopy for high performance Intel Nhm processors |
e4fb59d35f38
6292199 bcopy and kcopy should'nt use rep, smov
Bill Holler <Bill.Holler@Sun.COM>
parents:
7798
diff
changeset
|
4543 * and later... |
e4fb59d35f38
6292199 bcopy and kcopy should'nt use rep, smov
Bill Holler <Bill.Holler@Sun.COM>
parents:
7798
diff
changeset
|
4544 */ |
e4fb59d35f38
6292199 bcopy and kcopy should'nt use rep, smov
Bill Holler <Bill.Holler@Sun.COM>
parents:
7798
diff
changeset
|
4545 void |
e4fb59d35f38
6292199 bcopy and kcopy should'nt use rep, smov
Bill Holler <Bill.Holler@Sun.COM>
parents:
7798
diff
changeset
|
4546 patch_memops(uint_t vendor) |
e4fb59d35f38
6292199 bcopy and kcopy should'nt use rep, smov
Bill Holler <Bill.Holler@Sun.COM>
parents:
7798
diff
changeset
|
4547 { |
e4fb59d35f38
6292199 bcopy and kcopy should'nt use rep, smov
Bill Holler <Bill.Holler@Sun.COM>
parents:
7798
diff
changeset
|
4548 size_t cnt, i; |
e4fb59d35f38
6292199 bcopy and kcopy should'nt use rep, smov
Bill Holler <Bill.Holler@Sun.COM>
parents:
7798
diff
changeset
|
4549 caddr_t to, from; |
e4fb59d35f38
6292199 bcopy and kcopy should'nt use rep, smov
Bill Holler <Bill.Holler@Sun.COM>
parents:
7798
diff
changeset
|
4550 |
12838
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
4551 if ((vendor == X86_VENDOR_Intel) && |
fca99d9e3f2f
6812663 Running out of bits in x86_feature
Kuriakose Kuruvilla <kuriakose.kuruvilla@oracle.com>
parents:
12726
diff
changeset
|
4552 is_x86_feature(x86_featureset, X86FSET_SSE4_2)) { |
8377
e4fb59d35f38
6292199 bcopy and kcopy should'nt use rep, smov
Bill Holler <Bill.Holler@Sun.COM>
parents:
7798
diff
changeset
|
4553 cnt = &bcopy_patch_end - &bcopy_patch_start; |
e4fb59d35f38
6292199 bcopy and kcopy should'nt use rep, smov
Bill Holler <Bill.Holler@Sun.COM>
parents:
7798
diff
changeset
|
4554 to = &bcopy_ck_size; |
e4fb59d35f38
6292199 bcopy and kcopy should'nt use rep, smov
Bill Holler <Bill.Holler@Sun.COM>
parents:
7798
diff
changeset
|
4555 from = &bcopy_patch_start; |
e4fb59d35f38
6292199 bcopy and kcopy should'nt use rep, smov
Bill Holler <Bill.Holler@Sun.COM>
parents:
7798
diff
changeset
|
4556 for (i = 0; i < cnt; i++) { |
e4fb59d35f38
6292199 bcopy and kcopy should'nt use rep, smov
Bill Holler <Bill.Holler@Sun.COM>
parents:
7798
diff
changeset
|
4557 *to++ = *from++; |
e4fb59d35f38
6292199 bcopy and kcopy should'nt use rep, smov
Bill Holler <Bill.Holler@Sun.COM>
parents:
7798
diff
changeset
|
4558 } |
e4fb59d35f38
6292199 bcopy and kcopy should'nt use rep, smov
Bill Holler <Bill.Holler@Sun.COM>
parents:
7798
diff
changeset
|
4559 } |
e4fb59d35f38
6292199 bcopy and kcopy should'nt use rep, smov
Bill Holler <Bill.Holler@Sun.COM>
parents:
7798
diff
changeset
|
4560 } |
e4fb59d35f38
6292199 bcopy and kcopy should'nt use rep, smov
Bill Holler <Bill.Holler@Sun.COM>
parents:
7798
diff
changeset
|
4561 #endif /* __amd64 && !__xpv */ |
12261
52117d41c06e
6930914 Need enhancement of the cmi handle table for Intel EX chip family
Vuong Nguyen <Vuong.Nguyen@Sun.COM>
parents:
12090
diff
changeset
|
4562 |
52117d41c06e
6930914 Need enhancement of the cmi handle table for Intel EX chip family
Vuong Nguyen <Vuong.Nguyen@Sun.COM>
parents:
12090
diff
changeset
|
4563 /* |
52117d41c06e
6930914 Need enhancement of the cmi handle table for Intel EX chip family
Vuong Nguyen <Vuong.Nguyen@Sun.COM>
parents:
12090
diff
changeset
|
4564 * This function finds the number of bits to represent the number of cores per |
52117d41c06e
6930914 Need enhancement of the cmi handle table for Intel EX chip family
Vuong Nguyen <Vuong.Nguyen@Sun.COM>
parents:
12090
diff
changeset
|
4565 * chip and the number of strands per core for the Intel platforms. |
52117d41c06e
6930914 Need enhancement of the cmi handle table for Intel EX chip family
Vuong Nguyen <Vuong.Nguyen@Sun.COM>
parents:
12090
diff
changeset
|
4566 * It re-uses the x2APIC cpuid code of the cpuid_pass2(). |
52117d41c06e
6930914 Need enhancement of the cmi handle table for Intel EX chip family
Vuong Nguyen <Vuong.Nguyen@Sun.COM>
parents:
12090
diff
changeset
|
4567 */ |
52117d41c06e
6930914 Need enhancement of the cmi handle table for Intel EX chip family
Vuong Nguyen <Vuong.Nguyen@Sun.COM>
parents:
12090
diff
changeset
|
4568 void |
52117d41c06e
6930914 Need enhancement of the cmi handle table for Intel EX chip family
Vuong Nguyen <Vuong.Nguyen@Sun.COM>
parents:
12090
diff
changeset
|
4569 cpuid_get_ext_topo(uint_t vendor, uint_t *core_nbits, uint_t *strand_nbits) |
52117d41c06e
6930914 Need enhancement of the cmi handle table for Intel EX chip family
Vuong Nguyen <Vuong.Nguyen@Sun.COM>
parents:
12090
diff
changeset
|
4570 { |
52117d41c06e
6930914 Need enhancement of the cmi handle table for Intel EX chip family
Vuong Nguyen <Vuong.Nguyen@Sun.COM>
parents:
12090
diff
changeset
|
4571 struct cpuid_regs regs; |
52117d41c06e
6930914 Need enhancement of the cmi handle table for Intel EX chip family
Vuong Nguyen <Vuong.Nguyen@Sun.COM>
parents:
12090
diff
changeset
|
4572 struct cpuid_regs *cp = ®s; |
52117d41c06e
6930914 Need enhancement of the cmi handle table for Intel EX chip family
Vuong Nguyen <Vuong.Nguyen@Sun.COM>
parents:
12090
diff
changeset
|
4573 |
52117d41c06e
6930914 Need enhancement of the cmi handle table for Intel EX chip family
Vuong Nguyen <Vuong.Nguyen@Sun.COM>
parents:
12090
diff
changeset
|
4574 if (vendor != X86_VENDOR_Intel) { |
52117d41c06e
6930914 Need enhancement of the cmi handle table for Intel EX chip family
Vuong Nguyen <Vuong.Nguyen@Sun.COM>
parents:
12090
diff
changeset
|
4575 return; |
52117d41c06e
6930914 Need enhancement of the cmi handle table for Intel EX chip family
Vuong Nguyen <Vuong.Nguyen@Sun.COM>
parents:
12090
diff
changeset
|
4576 } |
52117d41c06e
6930914 Need enhancement of the cmi handle table for Intel EX chip family
Vuong Nguyen <Vuong.Nguyen@Sun.COM>
parents:
12090
diff
changeset
|
4577 |
52117d41c06e
6930914 Need enhancement of the cmi handle table for Intel EX chip family
Vuong Nguyen <Vuong.Nguyen@Sun.COM>
parents:
12090
diff
changeset
|
4578 /* if the cpuid level is 0xB, extended topo is available. */ |
52117d41c06e
6930914 Need enhancement of the cmi handle table for Intel EX chip family
Vuong Nguyen <Vuong.Nguyen@Sun.COM>
parents:
12090
diff
changeset
|
4579 cp->cp_eax = 0; |
52117d41c06e
6930914 Need enhancement of the cmi handle table for Intel EX chip family
Vuong Nguyen <Vuong.Nguyen@Sun.COM>
parents:
12090
diff
changeset
|
4580 if (__cpuid_insn(cp) >= 0xB) { |
52117d41c06e
6930914 Need enhancement of the cmi handle table for Intel EX chip family
Vuong Nguyen <Vuong.Nguyen@Sun.COM>
parents:
12090
diff
changeset
|
4581 |
52117d41c06e
6930914 Need enhancement of the cmi handle table for Intel EX chip family
Vuong Nguyen <Vuong.Nguyen@Sun.COM>
parents:
12090
diff
changeset
|
4582 cp->cp_eax = 0xB; |
52117d41c06e
6930914 Need enhancement of the cmi handle table for Intel EX chip family
Vuong Nguyen <Vuong.Nguyen@Sun.COM>
parents:
12090
diff
changeset
|
4583 cp->cp_edx = cp->cp_ebx = cp->cp_ecx = 0; |
52117d41c06e
6930914 Need enhancement of the cmi handle table for Intel EX chip family
Vuong Nguyen <Vuong.Nguyen@Sun.COM>
parents:
12090
diff
changeset
|
4584 (void) __cpuid_insn(cp); |
52117d41c06e
6930914 Need enhancement of the cmi handle table for Intel EX chip family
Vuong Nguyen <Vuong.Nguyen@Sun.COM>
parents:
12090
diff
changeset
|
4585 |
52117d41c06e
6930914 Need enhancement of the cmi handle table for Intel EX chip family
Vuong Nguyen <Vuong.Nguyen@Sun.COM>
parents:
12090
diff
changeset
|
4586 /* |
52117d41c06e
6930914 Need enhancement of the cmi handle table for Intel EX chip family
Vuong Nguyen <Vuong.Nguyen@Sun.COM>
parents:
12090
diff
changeset
|
4587 * Check CPUID.EAX=0BH, ECX=0H:EBX is non-zero, which |
52117d41c06e
6930914 Need enhancement of the cmi handle table for Intel EX chip family
Vuong Nguyen <Vuong.Nguyen@Sun.COM>
parents:
12090
diff
changeset
|
4588 * indicates that the extended topology enumeration leaf is |
52117d41c06e
6930914 Need enhancement of the cmi handle table for Intel EX chip family
Vuong Nguyen <Vuong.Nguyen@Sun.COM>
parents:
12090
diff
changeset
|
4589 * available. |
52117d41c06e
6930914 Need enhancement of the cmi handle table for Intel EX chip family
Vuong Nguyen <Vuong.Nguyen@Sun.COM>
parents:
12090
diff
changeset
|
4590 */ |
52117d41c06e
6930914 Need enhancement of the cmi handle table for Intel EX chip family
Vuong Nguyen <Vuong.Nguyen@Sun.COM>
parents:
12090
diff
changeset
|
4591 if (cp->cp_ebx) { |
52117d41c06e
6930914 Need enhancement of the cmi handle table for Intel EX chip family
Vuong Nguyen <Vuong.Nguyen@Sun.COM>
parents:
12090
diff
changeset
|
4592 uint_t coreid_shift = 0; |
52117d41c06e
6930914 Need enhancement of the cmi handle table for Intel EX chip family
Vuong Nguyen <Vuong.Nguyen@Sun.COM>
parents:
12090
diff
changeset
|
4593 uint_t chipid_shift = 0; |
52117d41c06e
6930914 Need enhancement of the cmi handle table for Intel EX chip family
Vuong Nguyen <Vuong.Nguyen@Sun.COM>
parents:
12090
diff
changeset
|
4594 uint_t i; |
52117d41c06e
6930914 Need enhancement of the cmi handle table for Intel EX chip family
Vuong Nguyen <Vuong.Nguyen@Sun.COM>
parents:
12090
diff
changeset
|
4595 uint_t level; |
52117d41c06e
6930914 Need enhancement of the cmi handle table for Intel EX chip family
Vuong Nguyen <Vuong.Nguyen@Sun.COM>
parents:
12090
diff
changeset
|
4596 |
52117d41c06e
6930914 Need enhancement of the cmi handle table for Intel EX chip family
Vuong Nguyen <Vuong.Nguyen@Sun.COM>
parents:
12090
diff
changeset
|
4597 for (i = 0; i < CPI_FNB_ECX_MAX; i++) { |
52117d41c06e
6930914 Need enhancement of the cmi handle table for Intel EX chip family
Vuong Nguyen <Vuong.Nguyen@Sun.COM>
parents:
12090
diff
changeset
|
4598 cp->cp_eax = 0xB; |
52117d41c06e
6930914 Need enhancement of the cmi handle table for Intel EX chip family
Vuong Nguyen <Vuong.Nguyen@Sun.COM>
parents:
12090
diff
changeset
|
4599 cp->cp_ecx = i; |
52117d41c06e
6930914 Need enhancement of the cmi handle table for Intel EX chip family
Vuong Nguyen <Vuong.Nguyen@Sun.COM>
parents:
12090
diff
changeset
|
4600 |
52117d41c06e
6930914 Need enhancement of the cmi handle table for Intel EX chip family
Vuong Nguyen <Vuong.Nguyen@Sun.COM>
parents:
12090
diff
changeset
|
4601 (void) __cpuid_insn(cp); |
52117d41c06e
6930914 Need enhancement of the cmi handle table for Intel EX chip family
Vuong Nguyen <Vuong.Nguyen@Sun.COM>
parents:
12090
diff
changeset
|
4602 level = CPI_CPU_LEVEL_TYPE(cp); |
52117d41c06e
6930914 Need enhancement of the cmi handle table for Intel EX chip family
Vuong Nguyen <Vuong.Nguyen@Sun.COM>
parents:
12090
diff
changeset
|
4603 |
52117d41c06e
6930914 Need enhancement of the cmi handle table for Intel EX chip family
Vuong Nguyen <Vuong.Nguyen@Sun.COM>
parents:
12090
diff
changeset
|
4604 if (level == 1) { |
52117d41c06e
6930914 Need enhancement of the cmi handle table for Intel EX chip family
Vuong Nguyen <Vuong.Nguyen@Sun.COM>
parents:
12090
diff
changeset
|
4605 /* |
52117d41c06e
6930914 Need enhancement of the cmi handle table for Intel EX chip family
Vuong Nguyen <Vuong.Nguyen@Sun.COM>
parents:
12090
diff
changeset
|
4606 * Thread level processor topology |
52117d41c06e
6930914 Need enhancement of the cmi handle table for Intel EX chip family
Vuong Nguyen <Vuong.Nguyen@Sun.COM>
parents:
12090
diff
changeset
|
4607 * Number of bits shift right APIC ID |
52117d41c06e
6930914 Need enhancement of the cmi handle table for Intel EX chip family
Vuong Nguyen <Vuong.Nguyen@Sun.COM>
parents:
12090
diff
changeset
|
4608 * to get the coreid. |
52117d41c06e
6930914 Need enhancement of the cmi handle table for Intel EX chip family
Vuong Nguyen <Vuong.Nguyen@Sun.COM>
parents:
12090
diff
changeset
|
4609 */ |
52117d41c06e
6930914 Need enhancement of the cmi handle table for Intel EX chip family
Vuong Nguyen <Vuong.Nguyen@Sun.COM>
parents:
12090
diff
changeset
|
4610 coreid_shift = BITX(cp->cp_eax, 4, 0); |
52117d41c06e
6930914 Need enhancement of the cmi handle table for Intel EX chip family
Vuong Nguyen <Vuong.Nguyen@Sun.COM>
parents:
12090
diff
changeset
|
4611 } else if (level == 2) { |
52117d41c06e
6930914 Need enhancement of the cmi handle table for Intel EX chip family
Vuong Nguyen <Vuong.Nguyen@Sun.COM>
parents:
12090
diff
changeset
|
4612 /* |
52117d41c06e
6930914 Need enhancement of the cmi handle table for Intel EX chip family
Vuong Nguyen <Vuong.Nguyen@Sun.COM>
parents:
12090
diff
changeset
|
4613 * Core level processor topology |
52117d41c06e
6930914 Need enhancement of the cmi handle table for Intel EX chip family
Vuong Nguyen <Vuong.Nguyen@Sun.COM>
parents:
12090
diff
changeset
|
4614 * Number of bits shift right APIC ID |
52117d41c06e
6930914 Need enhancement of the cmi handle table for Intel EX chip family
Vuong Nguyen <Vuong.Nguyen@Sun.COM>
parents:
12090
diff
changeset
|
4615 * to get the chipid. |
52117d41c06e
6930914 Need enhancement of the cmi handle table for Intel EX chip family
Vuong Nguyen <Vuong.Nguyen@Sun.COM>
parents:
12090
diff
changeset
|
4616 */ |
52117d41c06e
6930914 Need enhancement of the cmi handle table for Intel EX chip family
Vuong Nguyen <Vuong.Nguyen@Sun.COM>
parents:
12090
diff
changeset
|
4617 chipid_shift = BITX(cp->cp_eax, 4, 0); |
52117d41c06e
6930914 Need enhancement of the cmi handle table for Intel EX chip family
Vuong Nguyen <Vuong.Nguyen@Sun.COM>
parents:
12090
diff
changeset
|
4618 } |
52117d41c06e
6930914 Need enhancement of the cmi handle table for Intel EX chip family
Vuong Nguyen <Vuong.Nguyen@Sun.COM>
parents:
12090
diff
changeset
|
4619 } |
52117d41c06e
6930914 Need enhancement of the cmi handle table for Intel EX chip family
Vuong Nguyen <Vuong.Nguyen@Sun.COM>
parents:
12090
diff
changeset
|
4620 |
52117d41c06e
6930914 Need enhancement of the cmi handle table for Intel EX chip family
Vuong Nguyen <Vuong.Nguyen@Sun.COM>
parents:
12090
diff
changeset
|
4621 if (coreid_shift > 0 && chipid_shift > coreid_shift) { |
52117d41c06e
6930914 Need enhancement of the cmi handle table for Intel EX chip family
Vuong Nguyen <Vuong.Nguyen@Sun.COM>
parents:
12090
diff
changeset
|
4622 *strand_nbits = coreid_shift; |
52117d41c06e
6930914 Need enhancement of the cmi handle table for Intel EX chip family
Vuong Nguyen <Vuong.Nguyen@Sun.COM>
parents:
12090
diff
changeset
|
4623 *core_nbits = chipid_shift - coreid_shift; |
52117d41c06e
6930914 Need enhancement of the cmi handle table for Intel EX chip family
Vuong Nguyen <Vuong.Nguyen@Sun.COM>
parents:
12090
diff
changeset
|
4624 } |
52117d41c06e
6930914 Need enhancement of the cmi handle table for Intel EX chip family
Vuong Nguyen <Vuong.Nguyen@Sun.COM>
parents:
12090
diff
changeset
|
4625 } |
52117d41c06e
6930914 Need enhancement of the cmi handle table for Intel EX chip family
Vuong Nguyen <Vuong.Nguyen@Sun.COM>
parents:
12090
diff
changeset
|
4626 } |
52117d41c06e
6930914 Need enhancement of the cmi handle table for Intel EX chip family
Vuong Nguyen <Vuong.Nguyen@Sun.COM>
parents:
12090
diff
changeset
|
4627 } |