1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
|
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#include <sys/types.h>
#include <sys/machsystm.h>
#include <sys/cmp.h>
#include <sys/cmt.h>
/*
* Note: For now assume the chip ID as 0 for all the cpus until additional
* information is available via machine description table
*/
/*
* Returns 1 if cpuid is CMP-capable, 0 otherwise.
*/
/*ARGSUSED*/
int
cmp_cpu_is_cmp(processorid_t cpuid)
{
return (0);
}
/*
* Indicate that this core (cpuid) resides on the chip indicated by chipid.
* Called during boot and DR add.
*/
/*ARGSUSED*/
void
cmp_add_cpu(chipid_t chipid, processorid_t cpuid)
{
}
/*
* Indicate that this core (cpuid) is being DR removed.
*/
/*ARGSUSED*/
void
cmp_delete_cpu(processorid_t cpuid)
{
}
/*
* Called when cpuid is being onlined or offlined. If the offlined
* processor is CMP-capable then current target of the CMP Error Steering
* Register is set to either the lowest numbered on-line sibling core, if
* one exists, or else to this core.
*/
/*ARGSUSED*/
void
cmp_error_resteer(processorid_t cpuid)
{
}
/*
* Return 0, shortterm workaround until MD table is updated
* to provide cpu-chip mapping
*/
/*ARGSUSED*/
chipid_t
cmp_cpu_to_chip(processorid_t cpuid)
{
return (cpu[cpuid]->cpu_m.cpu_chip);
}
/*ARGSUSED*/
int
pg_plat_hw_shared(cpu_t *cp, pghw_type_t hw)
{
switch (hw) {
case PGHW_IPIPE:
return (1);
case PGHW_FPU:
return (1);
case PGHW_MPIPE:
return (1);
}
return (0);
}
int
pg_plat_cpus_share(cpu_t *cpu_a, cpu_t *cpu_b, pghw_type_t hw)
{
if (pg_plat_hw_shared(cpu_a, hw) == 0 ||
pg_plat_hw_shared(cpu_b, hw) == 0)
return (0);
return (pg_plat_hw_instance_id(cpu_a, hw) ==
pg_plat_hw_instance_id(cpu_b, hw));
}
id_t
pg_plat_hw_instance_id(cpu_t *cpu, pghw_type_t hw)
{
switch (hw) {
case PGHW_IPIPE:
return (cpu->cpu_m.cpu_ipipe);
case PGHW_CHIP:
return (cpu->cpu_m.cpu_chip);
case PGHW_MPIPE:
return (cpu->cpu_m.cpu_mpipe);
case PGHW_FPU:
return (cpu->cpu_m.cpu_fpu);
default:
return (-1);
}
}
/*
* Rank the relative importance of optimizing for hw1 or hw2
*/
pghw_type_t
pg_plat_hw_rank(pghw_type_t hw1, pghw_type_t hw2)
{
int i;
int rank1 = 0;
int rank2 = 0;
static pghw_type_t hw_hier[] = {
PGHW_IPIPE,
PGHW_FPU,
PGHW_MPIPE,
PGHW_NUM_COMPONENTS
};
for (i = 0; hw_hier[i] != PGHW_NUM_COMPONENTS; i++) {
if (hw_hier[i] == hw1)
rank1 = i;
if (hw_hier[i] == hw2)
rank2 = i;
}
if (rank1 > rank2)
return (hw1);
else
return (hw2);
}
/*
* Override the default CMT dispatcher policy for the specified
* hardware sharing relationship
*/
/* ARGSUSED */
pg_cmt_policy_t
pg_plat_cmt_policy(pghw_type_t hw)
{
/* Accept the default policies */
return (CMT_NO_POLICY);
}
id_t
pg_plat_get_core_id(cpu_t *cpu)
{
return (cpu->cpu_m.cpu_core);
}
void
cmp_set_nosteal_interval(void)
{
nosteal_nsec = 0;
}
/*
* Return 1 if CMT load balancing policies should be
* implemented across instances of the specified hardware
* sharing relationship.
*/
int
pg_cmt_load_bal_hw(pghw_type_t hw)
{
if (hw == PGHW_IPIPE ||
hw == PGHW_FPU ||
hw == PGHW_MPIPE)
return (1);
else
return (0);
}
/*
* Return 1 if thread affinity policies should be implemented
* for instances of the specifed hardware sharing relationship.
*/
int
pg_cmt_affinity_hw(pghw_type_t hw)
{
if (hw == PGHW_CACHE)
return (1);
else
return (0);
}
/*
* Return number of counter events requested to measure hardware capacity and
* utilization and setup CPC requests for specified CPU if list where to add
* CPC requests is given
*/
int
/* LINTED E_FUNC_ARG_UNUSED */
cu_plat_cpc_init(cpu_t *cp, kcpc_request_list_t *reqs, int nreqs)
{
/*
* Return error to tell common code to decide what counter events to
* program on this CPU for measuring hardware capacity and utilization
*/
return (-1);
}
|