2 * Copyright (c) 2003-2019 Apple Inc. All rights reserved.
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
30 #include <sys/param.h>
31 #include <sys/kernel.h>
32 #include <sys/sysctl.h>
33 #include <i386/cpuid.h>
35 #include <i386/rtclock_protos.h>
36 #include <i386/machine_routines.h>
37 #include <i386/pal_routines.h>
38 #include <i386/ucode.h>
39 #include <kern/clock.h>
40 #include <libkern/libkern.h>
41 #include <i386/lapic.h>
46 _i386_cpu_info SYSCTL_HANDLER_ARGS
48 __unused
struct sysctl_oid
*unused_oidp
= oidp
;
57 if (arg2
== 0 && ((char *)ptr
)[0] == '\0') {
61 if (arg2
== sizeof(uint8_t)) {
62 value
= (uint32_t) *(uint8_t *)ptr
;
64 arg2
= sizeof(uint32_t);
66 return SYSCTL_OUT(req
, ptr
, arg2
? (size_t) arg2
: strlen((char *)ptr
) + 1);
70 i386_cpu_info SYSCTL_HANDLER_ARGS
72 void *ptr
= (uint8_t *)cpuid_info() + (uintptr_t)arg1
;
73 return _i386_cpu_info(oidp
, ptr
, arg2
, req
);
77 i386_cpu_info_nonzero SYSCTL_HANDLER_ARGS
79 void *ptr
= (uint8_t *)cpuid_info() + (uintptr_t)arg1
;
80 int value
= *(uint32_t *)ptr
;
86 return _i386_cpu_info(oidp
, ptr
, arg2
, req
);
89 cpu_mwait SYSCTL_HANDLER_ARGS
91 i386_cpu_info_t
*cpu_info
= cpuid_info();
92 void *ptr
= (uint8_t *)cpu_info
->cpuid_mwait_leafp
+ (uintptr_t)arg1
;
93 if (cpu_info
->cpuid_mwait_leafp
== NULL
) {
96 return _i386_cpu_info(oidp
, ptr
, arg2
, req
);
100 cpu_thermal SYSCTL_HANDLER_ARGS
102 i386_cpu_info_t
*cpu_info
= cpuid_info();
103 void *ptr
= (uint8_t *)cpu_info
->cpuid_thermal_leafp
+ (uintptr_t)arg1
;
104 if (cpu_info
->cpuid_thermal_leafp
== NULL
) {
107 return _i386_cpu_info(oidp
, ptr
, arg2
, req
);
111 cpu_arch_perf SYSCTL_HANDLER_ARGS
113 i386_cpu_info_t
*cpu_info
= cpuid_info();
114 void *ptr
= (uint8_t *)cpu_info
->cpuid_arch_perf_leafp
+ (uintptr_t)arg1
;
115 if (cpu_info
->cpuid_arch_perf_leafp
== NULL
) {
118 return _i386_cpu_info(oidp
, ptr
, arg2
, req
);
122 cpu_xsave SYSCTL_HANDLER_ARGS
124 i386_cpu_info_t
*cpu_info
= cpuid_info();
125 void *ptr
= (uint8_t *)cpu_info
->cpuid_xsave_leafp
+ (uintptr_t)arg1
;
126 if (cpu_info
->cpuid_xsave_leafp
== NULL
) {
129 return _i386_cpu_info(oidp
, ptr
, arg2
, req
);
134 cpu_features SYSCTL_HANDLER_ARGS
136 __unused
struct sysctl_oid
*unused_oidp
= oidp
;
137 __unused
void *unused_arg1
= arg1
;
138 __unused
int unused_arg2
= arg2
;
142 cpuid_get_feature_names(cpuid_features(), buf
, sizeof(buf
));
144 return SYSCTL_OUT(req
, buf
, strlen(buf
) + 1);
148 cpu_extfeatures SYSCTL_HANDLER_ARGS
150 __unused
struct sysctl_oid
*unused_oidp
= oidp
;
151 __unused
void *unused_arg1
= arg1
;
152 __unused
int unused_arg2
= arg2
;
156 cpuid_get_extfeature_names(cpuid_extfeatures(), buf
, sizeof(buf
));
158 return SYSCTL_OUT(req
, buf
, strlen(buf
) + 1);
162 cpu_leaf7_features SYSCTL_HANDLER_ARGS
164 __unused
struct sysctl_oid
*unused_oidp
= oidp
;
165 __unused
void *unused_arg1
= arg1
;
166 __unused
int unused_arg2
= arg2
;
169 uint64_t leaf7_features
= cpuid_info()->cpuid_leaf7_features
;
170 uint64_t leaf7_extfeatures
= cpuid_info()->cpuid_leaf7_extfeatures
;
171 if (leaf7_features
== 0 && leaf7_extfeatures
== 0) {
176 cpuid_get_leaf7_feature_names(leaf7_features
, buf
, sizeof(buf
));
177 if (leaf7_extfeatures
!= 0) {
178 strlcat(buf
, " ", sizeof(buf
));
179 cpuid_get_leaf7_extfeature_names(leaf7_extfeatures
, buf
+ strlen(buf
),
180 sizeof(buf
) - strlen(buf
));
183 return SYSCTL_OUT(req
, buf
, strlen(buf
) + 1);
187 cpu_logical_per_package SYSCTL_HANDLER_ARGS
189 __unused
struct sysctl_oid
*unused_oidp
= oidp
;
190 __unused
void *unused_arg1
= arg1
;
191 __unused
int unused_arg2
= arg2
;
192 i386_cpu_info_t
*cpu_info
= cpuid_info();
194 if (!(cpuid_features() & CPUID_FEATURE_HTT
)) {
198 return SYSCTL_OUT(req
, &cpu_info
->cpuid_logical_per_package
,
199 sizeof(cpu_info
->cpuid_logical_per_package
));
203 cpu_flex_ratio_desired SYSCTL_HANDLER_ARGS
205 __unused
struct sysctl_oid
*unused_oidp
= oidp
;
206 __unused
void *unused_arg1
= arg1
;
207 __unused
int unused_arg2
= arg2
;
208 i386_cpu_info_t
*cpu_info
= cpuid_info();
210 if (cpu_info
->cpuid_model
!= 26) {
214 return SYSCTL_OUT(req
, &flex_ratio
, sizeof(flex_ratio
));
218 cpu_flex_ratio_min SYSCTL_HANDLER_ARGS
220 __unused
struct sysctl_oid
*unused_oidp
= oidp
;
221 __unused
void *unused_arg1
= arg1
;
222 __unused
int unused_arg2
= arg2
;
223 i386_cpu_info_t
*cpu_info
= cpuid_info();
225 if (cpu_info
->cpuid_model
!= 26) {
229 return SYSCTL_OUT(req
, &flex_ratio_min
, sizeof(flex_ratio_min
));
233 cpu_flex_ratio_max SYSCTL_HANDLER_ARGS
235 __unused
struct sysctl_oid
*unused_oidp
= oidp
;
236 __unused
void *unused_arg1
= arg1
;
237 __unused
int unused_arg2
= arg2
;
238 i386_cpu_info_t
*cpu_info
= cpuid_info();
240 if (cpu_info
->cpuid_model
!= 26) {
244 return SYSCTL_OUT(req
, &flex_ratio_max
, sizeof(flex_ratio_max
));
248 cpu_ucode_update SYSCTL_HANDLER_ARGS
250 __unused
struct sysctl_oid
*unused_oidp
= oidp
;
251 __unused
void *unused_arg1
= arg1
;
252 __unused
int unused_arg2
= arg2
;
256 error
= SYSCTL_IN(req
, &addr
, sizeof(addr
));
261 int ret
= ucode_interface(addr
);
265 extern uint64_t panic_restart_timeout
;
267 panic_set_restart_timeout(__unused
struct sysctl_oid
*oidp
, __unused
void *arg1
, __unused
int arg2
, struct sysctl_req
*req
)
269 int new_value
= 0, old_value
= 0, changed
= 0, error
;
272 if (panic_restart_timeout
) {
273 absolutetime_to_nanoseconds(panic_restart_timeout
, &nstime
);
274 old_value
= nstime
/ NSEC_PER_SEC
;
277 error
= sysctl_io_number(req
, old_value
, sizeof(int), &new_value
, &changed
);
278 if (error
== 0 && changed
) {
279 nanoseconds_to_absolutetime(((uint64_t)new_value
) * NSEC_PER_SEC
, &panic_restart_timeout
);
285 * Populates the {CPU, vector, latency} triple for the maximum observed primary
289 misc_interrupt_latency_max(__unused
struct sysctl_oid
*oidp
, __unused
void *arg1
, __unused
int arg2
, struct sysctl_req
*req
)
291 int changed
= 0, error
;
295 interrupt_populate_latency_stats(buf
, sizeof(buf
));
297 error
= sysctl_io_string(req
, buf
, sizeof(buf
), 0, &changed
);
299 if (error
== 0 && changed
) {
300 interrupt_reset_latency_stats();
306 #if DEVELOPMENT || DEBUG
308 * Triggers a machine-check exception - for a suitably configured kernel only.
310 extern void mca_exception_panic(void);
312 misc_machine_check_panic(__unused
struct sysctl_oid
*oidp
, __unused
void *arg1
, __unused
int arg2
, struct sysctl_req
*req
)
314 int changed
= 0, error
;
318 error
= sysctl_io_string(req
, buf
, sizeof(buf
), 0, &changed
);
320 if (error
== 0 && changed
) {
321 mca_exception_panic();
327 * Triggers a non-responsive processor timeout panic - for a suitably configured kernel only.
329 static uint64_t kernel_timeout_spin
= 0;
331 misc_kernel_timeout_spin(__unused
struct sysctl_oid
*oidp
, __unused
void *arg1
, __unused
int arg2
, struct sysctl_req
*req
)
335 int changed
= 0, error
;
339 absolutetime_to_nanoseconds(kernel_timeout_spin
, &old_value
);
341 error
= sysctl_io_number(req
, old_value
, sizeof(uint64_t), &new_value
, &changed
);
342 if (error
== 0 && changed
) {
343 nanoseconds_to_absolutetime(((uint64_t)new_value
), &kernel_timeout_spin
);
344 kernel_spin(kernel_timeout_spin
);
348 #endif /* DEVELOPMENT || DEBUG */
351 SYSCTL_NODE(_machdep
, OID_AUTO
, cpu
, CTLFLAG_RW
| CTLFLAG_LOCKED
, 0,
354 SYSCTL_PROC(_machdep_cpu
, OID_AUTO
, max_basic
, CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
355 (void *)offsetof(i386_cpu_info_t
, cpuid_max_basic
), sizeof(uint32_t),
356 i386_cpu_info
, "IU", "Max Basic Information value");
358 SYSCTL_PROC(_machdep_cpu
, OID_AUTO
, max_ext
, CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
359 (void *)offsetof(i386_cpu_info_t
, cpuid_max_ext
), sizeof(uint32_t),
360 i386_cpu_info
, "IU", "Max Extended Function Information value");
362 SYSCTL_PROC(_machdep_cpu
, OID_AUTO
, vendor
, CTLTYPE_STRING
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
363 (void *)offsetof(i386_cpu_info_t
, cpuid_vendor
), 0,
364 i386_cpu_info
, "A", "CPU vendor");
366 SYSCTL_PROC(_machdep_cpu
, OID_AUTO
, brand_string
, CTLTYPE_STRING
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
367 (void *)offsetof(i386_cpu_info_t
, cpuid_brand_string
), 0,
368 i386_cpu_info
, "A", "CPU brand string");
370 SYSCTL_PROC(_machdep_cpu
, OID_AUTO
, family
, CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
371 (void *)offsetof(i386_cpu_info_t
, cpuid_family
), sizeof(uint8_t),
372 i386_cpu_info
, "I", "CPU family");
374 SYSCTL_PROC(_machdep_cpu
, OID_AUTO
, model
, CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
375 (void *)offsetof(i386_cpu_info_t
, cpuid_model
), sizeof(uint8_t),
376 i386_cpu_info
, "I", "CPU model");
378 SYSCTL_PROC(_machdep_cpu
, OID_AUTO
, extmodel
, CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
379 (void *)offsetof(i386_cpu_info_t
, cpuid_extmodel
), sizeof(uint8_t),
380 i386_cpu_info
, "I", "CPU extended model");
382 SYSCTL_PROC(_machdep_cpu
, OID_AUTO
, extfamily
, CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
383 (void *)offsetof(i386_cpu_info_t
, cpuid_extfamily
), sizeof(uint8_t),
384 i386_cpu_info
, "I", "CPU extended family");
386 SYSCTL_PROC(_machdep_cpu
, OID_AUTO
, stepping
, CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
387 (void *)offsetof(i386_cpu_info_t
, cpuid_stepping
), sizeof(uint8_t),
388 i386_cpu_info
, "I", "CPU stepping");
390 SYSCTL_PROC(_machdep_cpu
, OID_AUTO
, feature_bits
, CTLTYPE_QUAD
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
391 (void *)offsetof(i386_cpu_info_t
, cpuid_features
), sizeof(uint64_t),
392 i386_cpu_info
, "IU", "CPU features");
394 SYSCTL_PROC(_machdep_cpu
, OID_AUTO
, leaf7_feature_bits
,
395 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
396 (void *)offsetof(i386_cpu_info_t
, cpuid_leaf7_features
),
398 i386_cpu_info_nonzero
, "IU", "CPU Leaf7 features [EBX ECX]");
400 SYSCTL_PROC(_machdep_cpu
, OID_AUTO
, leaf7_feature_bits_edx
,
401 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
402 (void *)offsetof(i386_cpu_info_t
, cpuid_leaf7_extfeatures
),
404 i386_cpu_info_nonzero
, "IU", "CPU Leaf7 features [EDX]");
406 SYSCTL_PROC(_machdep_cpu
, OID_AUTO
, extfeature_bits
, CTLTYPE_QUAD
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
407 (void *)offsetof(i386_cpu_info_t
, cpuid_extfeatures
), sizeof(uint64_t),
408 i386_cpu_info
, "IU", "CPU extended features");
410 SYSCTL_PROC(_machdep_cpu
, OID_AUTO
, signature
, CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
411 (void *)offsetof(i386_cpu_info_t
, cpuid_signature
), sizeof(uint32_t),
412 i386_cpu_info
, "I", "CPU signature");
414 SYSCTL_PROC(_machdep_cpu
, OID_AUTO
, brand
, CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
415 (void *)offsetof(i386_cpu_info_t
, cpuid_brand
), sizeof(uint8_t),
416 i386_cpu_info
, "I", "CPU brand");
418 SYSCTL_PROC(_machdep_cpu
, OID_AUTO
, features
, CTLTYPE_STRING
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
420 cpu_features
, "A", "CPU feature names");
422 SYSCTL_PROC(_machdep_cpu
, OID_AUTO
, leaf7_features
,
423 CTLTYPE_STRING
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
425 cpu_leaf7_features
, "A", "CPU Leaf7 feature names");
427 SYSCTL_PROC(_machdep_cpu
, OID_AUTO
, extfeatures
, CTLTYPE_STRING
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
429 cpu_extfeatures
, "A", "CPU extended feature names");
431 SYSCTL_PROC(_machdep_cpu
, OID_AUTO
, logical_per_package
,
432 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
434 cpu_logical_per_package
, "I", "CPU logical cpus per package");
436 SYSCTL_PROC(_machdep_cpu
, OID_AUTO
, cores_per_package
,
437 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
438 (void *)offsetof(i386_cpu_info_t
, cpuid_cores_per_package
),
440 i386_cpu_info
, "I", "CPU cores per package");
442 SYSCTL_PROC(_machdep_cpu
, OID_AUTO
, microcode_version
,
443 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
444 (void *)offsetof(i386_cpu_info_t
, cpuid_microcode_version
),
446 i386_cpu_info
, "I", "Microcode version number");
448 SYSCTL_PROC(_machdep_cpu
, OID_AUTO
, processor_flag
,
449 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
450 (void *)offsetof(i386_cpu_info_t
, cpuid_processor_flag
),
452 i386_cpu_info
, "I", "CPU processor flag");
455 SYSCTL_NODE(_machdep_cpu
, OID_AUTO
, mwait
, CTLFLAG_RW
| CTLFLAG_LOCKED
, 0,
458 SYSCTL_PROC(_machdep_cpu_mwait
, OID_AUTO
, linesize_min
,
459 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
460 (void *)offsetof(cpuid_mwait_leaf_t
, linesize_min
),
462 cpu_mwait
, "I", "Monitor/mwait minimum line size");
464 SYSCTL_PROC(_machdep_cpu_mwait
, OID_AUTO
, linesize_max
,
465 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
466 (void *)offsetof(cpuid_mwait_leaf_t
, linesize_max
),
468 cpu_mwait
, "I", "Monitor/mwait maximum line size");
470 SYSCTL_PROC(_machdep_cpu_mwait
, OID_AUTO
, extensions
,
471 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
472 (void *)offsetof(cpuid_mwait_leaf_t
, extensions
),
474 cpu_mwait
, "I", "Monitor/mwait extensions");
476 SYSCTL_PROC(_machdep_cpu_mwait
, OID_AUTO
, sub_Cstates
,
477 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
478 (void *)offsetof(cpuid_mwait_leaf_t
, sub_Cstates
),
480 cpu_mwait
, "I", "Monitor/mwait sub C-states");
483 SYSCTL_NODE(_machdep_cpu
, OID_AUTO
, thermal
, CTLFLAG_RW
| CTLFLAG_LOCKED
, 0,
486 SYSCTL_PROC(_machdep_cpu_thermal
, OID_AUTO
, sensor
,
487 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
488 (void *)offsetof(cpuid_thermal_leaf_t
, sensor
),
490 cpu_thermal
, "I", "Thermal sensor present");
492 SYSCTL_PROC(_machdep_cpu_thermal
, OID_AUTO
, dynamic_acceleration
,
493 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
494 (void *)offsetof(cpuid_thermal_leaf_t
, dynamic_acceleration
),
496 cpu_thermal
, "I", "Dynamic Acceleration Technology (Turbo Mode)");
498 SYSCTL_PROC(_machdep_cpu_thermal
, OID_AUTO
, invariant_APIC_timer
,
499 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
500 (void *)offsetof(cpuid_thermal_leaf_t
, invariant_APIC_timer
),
502 cpu_thermal
, "I", "Invariant APIC Timer");
504 SYSCTL_PROC(_machdep_cpu_thermal
, OID_AUTO
, thresholds
,
505 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
506 (void *)offsetof(cpuid_thermal_leaf_t
, thresholds
),
508 cpu_thermal
, "I", "Number of interrupt thresholds");
510 SYSCTL_PROC(_machdep_cpu_thermal
, OID_AUTO
, ACNT_MCNT
,
511 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
512 (void *)offsetof(cpuid_thermal_leaf_t
, ACNT_MCNT
),
514 cpu_thermal
, "I", "ACNT_MCNT capability");
516 SYSCTL_PROC(_machdep_cpu_thermal
, OID_AUTO
, core_power_limits
,
517 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
518 (void *)offsetof(cpuid_thermal_leaf_t
, core_power_limits
),
520 cpu_thermal
, "I", "Power Limit Notifications at a Core Level");
522 SYSCTL_PROC(_machdep_cpu_thermal
, OID_AUTO
, fine_grain_clock_mod
,
523 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
524 (void *)offsetof(cpuid_thermal_leaf_t
, fine_grain_clock_mod
),
526 cpu_thermal
, "I", "Fine Grain Clock Modulation");
528 SYSCTL_PROC(_machdep_cpu_thermal
, OID_AUTO
, package_thermal_intr
,
529 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
530 (void *)offsetof(cpuid_thermal_leaf_t
, package_thermal_intr
),
532 cpu_thermal
, "I", "Package Thermal interrupt and Status");
534 SYSCTL_PROC(_machdep_cpu_thermal
, OID_AUTO
, hardware_feedback
,
535 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
536 (void *)offsetof(cpuid_thermal_leaf_t
, hardware_feedback
),
538 cpu_thermal
, "I", "Hardware Coordination Feedback");
540 SYSCTL_PROC(_machdep_cpu_thermal
, OID_AUTO
, energy_policy
,
541 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
542 (void *)offsetof(cpuid_thermal_leaf_t
, energy_policy
),
544 cpu_thermal
, "I", "Energy Efficient Policy Support");
546 SYSCTL_NODE(_machdep_cpu
, OID_AUTO
, xsave
, CTLFLAG_RW
| CTLFLAG_LOCKED
, 0,
549 SYSCTL_PROC(_machdep_cpu_xsave
, OID_AUTO
, extended_state
,
550 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
552 sizeof(cpuid_xsave_leaf_t
),
553 cpu_xsave
, "IU", "XSAVE Extended State Main Leaf");
555 SYSCTL_PROC(_machdep_cpu_xsave
, OID_AUTO
, extended_state1
,
556 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
557 (void *) sizeof(cpuid_xsave_leaf_t
),
558 sizeof(cpuid_xsave_leaf_t
),
559 cpu_xsave
, "IU", "XSAVE Extended State Sub-leaf 1");
562 SYSCTL_NODE(_machdep_cpu
, OID_AUTO
, arch_perf
, CTLFLAG_RW
| CTLFLAG_LOCKED
, 0,
565 SYSCTL_PROC(_machdep_cpu_arch_perf
, OID_AUTO
, version
,
566 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
567 (void *)offsetof(cpuid_arch_perf_leaf_t
, version
),
569 cpu_arch_perf
, "I", "Architectural Performance Version Number");
571 SYSCTL_PROC(_machdep_cpu_arch_perf
, OID_AUTO
, number
,
572 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
573 (void *)offsetof(cpuid_arch_perf_leaf_t
, number
),
575 cpu_arch_perf
, "I", "Number of counters per logical cpu");
577 SYSCTL_PROC(_machdep_cpu_arch_perf
, OID_AUTO
, width
,
578 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
579 (void *)offsetof(cpuid_arch_perf_leaf_t
, width
),
581 cpu_arch_perf
, "I", "Bit width of counters");
583 SYSCTL_PROC(_machdep_cpu_arch_perf
, OID_AUTO
, events_number
,
584 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
585 (void *)offsetof(cpuid_arch_perf_leaf_t
, events_number
),
587 cpu_arch_perf
, "I", "Number of monitoring events");
589 SYSCTL_PROC(_machdep_cpu_arch_perf
, OID_AUTO
, events
,
590 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
591 (void *)offsetof(cpuid_arch_perf_leaf_t
, events
),
593 cpu_arch_perf
, "I", "Bit vector of events");
595 SYSCTL_PROC(_machdep_cpu_arch_perf
, OID_AUTO
, fixed_number
,
596 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
597 (void *)offsetof(cpuid_arch_perf_leaf_t
, fixed_number
),
599 cpu_arch_perf
, "I", "Number of fixed-function counters");
601 SYSCTL_PROC(_machdep_cpu_arch_perf
, OID_AUTO
, fixed_width
,
602 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
603 (void *)offsetof(cpuid_arch_perf_leaf_t
, fixed_width
),
605 cpu_arch_perf
, "I", "Bit-width of fixed-function counters");
608 SYSCTL_NODE(_machdep_cpu
, OID_AUTO
, cache
, CTLFLAG_RW
| CTLFLAG_LOCKED
, 0,
611 SYSCTL_PROC(_machdep_cpu_cache
, OID_AUTO
, linesize
,
612 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
613 (void *)offsetof(i386_cpu_info_t
, cpuid_cache_linesize
),
615 i386_cpu_info
, "I", "Cacheline size");
617 SYSCTL_PROC(_machdep_cpu_cache
, OID_AUTO
, L2_associativity
,
618 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
619 (void *)offsetof(i386_cpu_info_t
, cpuid_cache_L2_associativity
),
621 i386_cpu_info
, "I", "L2 cache associativity");
623 SYSCTL_PROC(_machdep_cpu_cache
, OID_AUTO
, size
,
624 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
625 (void *)offsetof(i386_cpu_info_t
, cpuid_cache_size
),
627 i386_cpu_info
, "I", "Cache size (in Kbytes)");
630 SYSCTL_NODE(_machdep_cpu
, OID_AUTO
, tlb
, CTLFLAG_RW
| CTLFLAG_LOCKED
, 0,
632 SYSCTL_NODE(_machdep_cpu_tlb
, OID_AUTO
, inst
, CTLFLAG_RW
| CTLFLAG_LOCKED
, 0,
634 SYSCTL_NODE(_machdep_cpu_tlb
, OID_AUTO
, data
, CTLFLAG_RW
| CTLFLAG_LOCKED
, 0,
637 SYSCTL_PROC(_machdep_cpu_tlb_inst
, OID_AUTO
, small
,
638 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
639 (void *)offsetof(i386_cpu_info_t
,
640 cpuid_tlb
[TLB_INST
][TLB_SMALL
][0]),
642 i386_cpu_info_nonzero
, "I",
643 "Number of small page instruction TLBs");
645 SYSCTL_PROC(_machdep_cpu_tlb_data
, OID_AUTO
, small
,
646 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
647 (void *)offsetof(i386_cpu_info_t
,
648 cpuid_tlb
[TLB_DATA
][TLB_SMALL
][0]),
650 i386_cpu_info_nonzero
, "I",
651 "Number of small page data TLBs (1st level)");
653 SYSCTL_PROC(_machdep_cpu_tlb_data
, OID_AUTO
, small_level1
,
654 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
655 (void *)offsetof(i386_cpu_info_t
,
656 cpuid_tlb
[TLB_DATA
][TLB_SMALL
][1]),
658 i386_cpu_info_nonzero
, "I",
659 "Number of small page data TLBs (2nd level)");
661 SYSCTL_PROC(_machdep_cpu_tlb_inst
, OID_AUTO
, large
,
662 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
663 (void *)offsetof(i386_cpu_info_t
,
664 cpuid_tlb
[TLB_INST
][TLB_LARGE
][0]),
666 i386_cpu_info_nonzero
, "I",
667 "Number of large page instruction TLBs");
669 SYSCTL_PROC(_machdep_cpu_tlb_data
, OID_AUTO
, large
,
670 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
671 (void *)offsetof(i386_cpu_info_t
,
672 cpuid_tlb
[TLB_DATA
][TLB_LARGE
][0]),
674 i386_cpu_info_nonzero
, "I",
675 "Number of large page data TLBs (1st level)");
677 SYSCTL_PROC(_machdep_cpu_tlb_data
, OID_AUTO
, large_level1
,
678 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
679 (void *)offsetof(i386_cpu_info_t
,
680 cpuid_tlb
[TLB_DATA
][TLB_LARGE
][1]),
682 i386_cpu_info_nonzero
, "I",
683 "Number of large page data TLBs (2nd level)");
685 SYSCTL_PROC(_machdep_cpu_tlb
, OID_AUTO
, shared
,
686 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
687 (void *)offsetof(i386_cpu_info_t
, cpuid_stlb
),
689 i386_cpu_info_nonzero
, "I",
690 "Number of shared TLBs");
693 SYSCTL_NODE(_machdep_cpu
, OID_AUTO
, address_bits
, CTLFLAG_RW
| CTLFLAG_LOCKED
, 0,
696 SYSCTL_PROC(_machdep_cpu_address_bits
, OID_AUTO
, physical
,
697 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
698 (void *)offsetof(i386_cpu_info_t
, cpuid_address_bits_physical
),
700 i386_cpu_info
, "I", "Number of physical address bits");
702 SYSCTL_PROC(_machdep_cpu_address_bits
, OID_AUTO
, virtual,
703 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
704 (void *)offsetof(i386_cpu_info_t
, cpuid_address_bits_virtual
),
706 i386_cpu_info
, "I", "Number of virtual address bits");
709 SYSCTL_PROC(_machdep_cpu
, OID_AUTO
, core_count
,
710 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
711 (void *)offsetof(i386_cpu_info_t
, core_count
),
713 i386_cpu_info
, "I", "Number of enabled cores per package");
715 SYSCTL_PROC(_machdep_cpu
, OID_AUTO
, thread_count
,
716 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
717 (void *)offsetof(i386_cpu_info_t
, thread_count
),
719 i386_cpu_info
, "I", "Number of enabled threads per package");
721 SYSCTL_NODE(_machdep_cpu
, OID_AUTO
, flex_ratio
, CTLFLAG_RW
| CTLFLAG_LOCKED
, 0,
724 SYSCTL_PROC(_machdep_cpu_flex_ratio
, OID_AUTO
, desired
,
725 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
727 cpu_flex_ratio_desired
, "I", "Flex ratio desired (0 disabled)");
729 SYSCTL_PROC(_machdep_cpu_flex_ratio
, OID_AUTO
, min
,
730 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
732 cpu_flex_ratio_min
, "I", "Flex ratio min (efficiency)");
734 SYSCTL_PROC(_machdep_cpu_flex_ratio
, OID_AUTO
, max
,
735 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
737 cpu_flex_ratio_max
, "I", "Flex ratio max (non-turbo)");
739 SYSCTL_PROC(_machdep_cpu
, OID_AUTO
, ucupdate
,
740 CTLTYPE_INT
| CTLFLAG_WR
| CTLFLAG_LOCKED
, 0, 0,
741 cpu_ucode_update
, "S", "Microcode update interface");
743 SYSCTL_NODE(_machdep_cpu
, OID_AUTO
, tsc_ccc
, CTLFLAG_RW
| CTLFLAG_LOCKED
, 0,
744 "TSC/CCC frequency information");
746 SYSCTL_PROC(_machdep_cpu_tsc_ccc
, OID_AUTO
, numerator
,
747 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
748 (void *)offsetof(i386_cpu_info_t
, cpuid_tsc_leaf
.numerator
),
750 i386_cpu_info
, "I", "Numerator of TSC/CCC ratio");
752 SYSCTL_PROC(_machdep_cpu_tsc_ccc
, OID_AUTO
, denominator
,
753 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
754 (void *)offsetof(i386_cpu_info_t
, cpuid_tsc_leaf
.denominator
),
756 i386_cpu_info
, "I", "Denominator of TSC/CCC ratio");
758 static const uint32_t apic_timer_vector
= (LAPIC_DEFAULT_INTERRUPT_BASE
+ LAPIC_TIMER_INTERRUPT
);
759 static const uint32_t apic_IPI_vector
= (LAPIC_DEFAULT_INTERRUPT_BASE
+ LAPIC_INTERPROCESSOR_INTERRUPT
);
761 SYSCTL_NODE(_machdep
, OID_AUTO
, vectors
, CTLFLAG_RD
| CTLFLAG_LOCKED
, 0,
762 "Interrupt vector assignments");
764 SYSCTL_UINT(_machdep_vectors
, OID_AUTO
, timer
, CTLFLAG_RD
| CTLFLAG_KERN
| CTLFLAG_LOCKED
, __DECONST(uint32_t *, &apic_timer_vector
), 0, "");
765 SYSCTL_UINT(_machdep_vectors
, OID_AUTO
, IPI
, CTLFLAG_RD
| CTLFLAG_KERN
| CTLFLAG_LOCKED
, __DECONST(uint32_t *, &apic_IPI_vector
), 0, "");
767 uint64_t pmap_pv_hashlist_walks
;
768 uint64_t pmap_pv_hashlist_cnts
;
769 uint32_t pmap_pv_hashlist_max
;
770 uint32_t pmap_kernel_text_ps
= PAGE_SIZE
;
771 extern uint32_t pv_hashed_kern_low_water_mark
;
773 /*extern struct sysctl_oid_list sysctl__machdep_pmap_children;*/
775 SYSCTL_NODE(_machdep
, OID_AUTO
, pmap
, CTLFLAG_RW
| CTLFLAG_LOCKED
, 0,
778 SYSCTL_QUAD(_machdep_pmap
, OID_AUTO
, hashwalks
, CTLFLAG_RD
| CTLFLAG_KERN
| CTLFLAG_LOCKED
, &pmap_pv_hashlist_walks
, "");
779 SYSCTL_QUAD(_machdep_pmap
, OID_AUTO
, hashcnts
, CTLFLAG_RD
| CTLFLAG_KERN
| CTLFLAG_LOCKED
, &pmap_pv_hashlist_cnts
, "");
780 SYSCTL_INT(_machdep_pmap
, OID_AUTO
, hashmax
, CTLFLAG_RD
| CTLFLAG_KERN
| CTLFLAG_LOCKED
, &pmap_pv_hashlist_max
, 0, "");
781 SYSCTL_INT(_machdep_pmap
, OID_AUTO
, kernel_text_ps
, CTLFLAG_RD
| CTLFLAG_KERN
| CTLFLAG_LOCKED
, &pmap_kernel_text_ps
, 0, "");
782 SYSCTL_INT(_machdep_pmap
, OID_AUTO
, kern_pv_reserve
, CTLFLAG_RW
| CTLFLAG_KERN
| CTLFLAG_LOCKED
, &pv_hashed_kern_low_water_mark
, 0, "");
784 SYSCTL_NODE(_machdep
, OID_AUTO
, memmap
, CTLFLAG_RD
| CTLFLAG_LOCKED
, NULL
, "physical memory map");
786 uint64_t firmware_Conventional_bytes
= 0;
787 uint64_t firmware_RuntimeServices_bytes
= 0;
788 uint64_t firmware_ACPIReclaim_bytes
= 0;
789 uint64_t firmware_ACPINVS_bytes
= 0;
790 uint64_t firmware_PalCode_bytes
= 0;
791 uint64_t firmware_Reserved_bytes
= 0;
792 uint64_t firmware_Unusable_bytes
= 0;
793 uint64_t firmware_other_bytes
= 0;
795 SYSCTL_QUAD(_machdep_memmap
, OID_AUTO
, Conventional
, CTLFLAG_RD
| CTLFLAG_LOCKED
, &firmware_Conventional_bytes
, "");
796 SYSCTL_QUAD(_machdep_memmap
, OID_AUTO
, RuntimeServices
, CTLFLAG_RD
| CTLFLAG_LOCKED
, &firmware_RuntimeServices_bytes
, "");
797 SYSCTL_QUAD(_machdep_memmap
, OID_AUTO
, ACPIReclaim
, CTLFLAG_RD
| CTLFLAG_LOCKED
, &firmware_ACPIReclaim_bytes
, "");
798 SYSCTL_QUAD(_machdep_memmap
, OID_AUTO
, ACPINVS
, CTLFLAG_RD
| CTLFLAG_LOCKED
, &firmware_ACPINVS_bytes
, "");
799 SYSCTL_QUAD(_machdep_memmap
, OID_AUTO
, PalCode
, CTLFLAG_RD
| CTLFLAG_LOCKED
, &firmware_PalCode_bytes
, "");
800 SYSCTL_QUAD(_machdep_memmap
, OID_AUTO
, Reserved
, CTLFLAG_RD
| CTLFLAG_LOCKED
, &firmware_Reserved_bytes
, "");
801 SYSCTL_QUAD(_machdep_memmap
, OID_AUTO
, Unusable
, CTLFLAG_RD
| CTLFLAG_LOCKED
, &firmware_Unusable_bytes
, "");
802 SYSCTL_QUAD(_machdep_memmap
, OID_AUTO
, Other
, CTLFLAG_RD
| CTLFLAG_LOCKED
, &firmware_other_bytes
, "");
804 SYSCTL_NODE(_machdep
, OID_AUTO
, tsc
, CTLFLAG_RD
| CTLFLAG_LOCKED
, NULL
, "Timestamp counter parameters");
806 SYSCTL_QUAD(_machdep_tsc
, OID_AUTO
, frequency
,
807 CTLFLAG_RD
| CTLFLAG_LOCKED
, &tscFreq
, "");
809 extern uint32_t deep_idle_rebase
;
810 SYSCTL_UINT(_machdep_tsc
, OID_AUTO
, deep_idle_rebase
,
811 CTLFLAG_RD
| CTLFLAG_LOCKED
, &deep_idle_rebase
, 0, "");
812 SYSCTL_QUAD(_machdep_tsc
, OID_AUTO
, at_boot
,
813 CTLFLAG_RD
| CTLFLAG_LOCKED
, &tsc_at_boot
, "");
814 SYSCTL_QUAD(_machdep_tsc
, OID_AUTO
, rebase_abs_time
,
815 CTLFLAG_RD
| CTLFLAG_LOCKED
, &tsc_rebase_abs_time
, "");
817 SYSCTL_NODE(_machdep_tsc
, OID_AUTO
, nanotime
,
818 CTLFLAG_RD
| CTLFLAG_LOCKED
, NULL
, "TSC to ns conversion");
819 SYSCTL_QUAD(_machdep_tsc_nanotime
, OID_AUTO
, tsc_base
,
820 CTLFLAG_RD
| CTLFLAG_LOCKED
,
821 __DECONST(uint64_t *, &pal_rtc_nanotime_info
.tsc_base
), "");
822 SYSCTL_QUAD(_machdep_tsc_nanotime
, OID_AUTO
, ns_base
,
823 CTLFLAG_RD
| CTLFLAG_LOCKED
,
824 __DECONST(uint64_t *, &pal_rtc_nanotime_info
.ns_base
), "");
825 SYSCTL_UINT(_machdep_tsc_nanotime
, OID_AUTO
, scale
,
826 CTLFLAG_RD
| CTLFLAG_LOCKED
,
827 __DECONST(uint32_t *, &pal_rtc_nanotime_info
.scale
), 0, "");
828 SYSCTL_UINT(_machdep_tsc_nanotime
, OID_AUTO
, shift
,
829 CTLFLAG_RD
| CTLFLAG_LOCKED
,
830 __DECONST(uint32_t *, &pal_rtc_nanotime_info
.shift
), 0, "");
831 SYSCTL_UINT(_machdep_tsc_nanotime
, OID_AUTO
, generation
,
832 CTLFLAG_RD
| CTLFLAG_LOCKED
,
833 __DECONST(uint32_t *, &pal_rtc_nanotime_info
.generation
), 0, "");
835 SYSCTL_NODE(_machdep
, OID_AUTO
, misc
, CTLFLAG_RW
| CTLFLAG_LOCKED
, 0,
836 "Miscellaneous x86 kernel parameters");
838 #if (DEVELOPMENT || DEBUG)
839 extern uint32_t mp_interrupt_watchdog_events
;
840 SYSCTL_UINT(_machdep_misc
, OID_AUTO
, interrupt_watchdog_events
,
841 CTLFLAG_RW
| CTLFLAG_LOCKED
, &mp_interrupt_watchdog_events
, 0, "");
845 SYSCTL_PROC(_machdep_misc
, OID_AUTO
, panic_restart_timeout
,
846 CTLTYPE_INT
| CTLFLAG_RW
| CTLFLAG_LOCKED
,
848 panic_set_restart_timeout
, "I", "Panic restart timeout in seconds");
850 SYSCTL_PROC(_machdep_misc
, OID_AUTO
, interrupt_latency_max
,
851 CTLTYPE_STRING
| CTLFLAG_RW
| CTLFLAG_LOCKED
,
853 misc_interrupt_latency_max
, "A", "Maximum Interrupt latency");
855 #if DEVELOPMENT || DEBUG
856 SYSCTL_PROC(_machdep_misc
, OID_AUTO
, machine_check_panic
,
857 CTLTYPE_STRING
| CTLFLAG_RW
| CTLFLAG_LOCKED
,
859 misc_machine_check_panic
, "A", "Machine-check exception test");
861 SYSCTL_PROC(_machdep_misc
, OID_AUTO
, kernel_timeout_spin
,
862 CTLTYPE_QUAD
| CTLFLAG_RW
| CTLFLAG_LOCKED
,
863 0, sizeof(kernel_timeout_spin
),
864 misc_kernel_timeout_spin
, "Q", "Kernel timeout panic test");
866 SYSCTL_QUAD(_machdep
, OID_AUTO
, reportphyreadabs
,
867 CTLFLAG_KERN
| CTLFLAG_RW
| CTLFLAG_LOCKED
,
868 &reportphyreaddelayabs
, "");
869 SYSCTL_QUAD(_machdep
, OID_AUTO
, reportphywriteabs
,
870 CTLFLAG_KERN
| CTLFLAG_RW
| CTLFLAG_LOCKED
,
871 &reportphywritedelayabs
, "");
872 SYSCTL_QUAD(_machdep
, OID_AUTO
, tracephyreadabs
,
873 CTLFLAG_KERN
| CTLFLAG_RW
| CTLFLAG_LOCKED
,
874 &tracephyreaddelayabs
, "");
875 SYSCTL_QUAD(_machdep
, OID_AUTO
, tracephywriteabs
,
876 CTLFLAG_KERN
| CTLFLAG_RW
| CTLFLAG_LOCKED
,
877 &tracephywritedelayabs
, "");
878 SYSCTL_INT(_machdep
, OID_AUTO
, reportphyreadosbt
,
879 CTLFLAG_KERN
| CTLFLAG_RW
| CTLFLAG_LOCKED
,
880 &reportphyreadosbt
, 0, "");
881 SYSCTL_INT(_machdep
, OID_AUTO
, reportphywriteosbt
,
882 CTLFLAG_KERN
| CTLFLAG_RW
| CTLFLAG_LOCKED
,
883 &reportphywriteosbt
, 0, "");
884 SYSCTL_INT(_machdep
, OID_AUTO
, phyreaddelaypanic
,
885 CTLFLAG_KERN
| CTLFLAG_RW
| CTLFLAG_LOCKED
,
886 &phyreadpanic
, 0, "");
887 SYSCTL_INT(_machdep
, OID_AUTO
, phywritedelaypanic
,
888 CTLFLAG_KERN
| CTLFLAG_RW
| CTLFLAG_LOCKED
,
889 &phywritepanic
, 0, "");
890 #if DEVELOPMENT || DEBUG
891 extern uint64_t simulate_stretched_io
;
892 SYSCTL_QUAD(_machdep
, OID_AUTO
, sim_stretched_io_ns
,
893 CTLFLAG_KERN
| CTLFLAG_RW
| CTLFLAG_LOCKED
,
894 &simulate_stretched_io
, "");
897 extern int pmap_pagezero_mitigation
;
898 extern int pmap_asserts_enabled
, pmap_asserts_traced
;
899 /* On DEV/DEBUG kernels, clear this to disable the SMAP emulation
900 * (address space disconnect) for pagezero-less processes.
902 SYSCTL_INT(_machdep
, OID_AUTO
, pmap_pagezero_mitigation
,
903 CTLFLAG_KERN
| CTLFLAG_RW
| CTLFLAG_LOCKED
,
904 &pmap_pagezero_mitigation
, 0, "");
905 /* Toggle pmap assertions */
906 SYSCTL_INT(_machdep
, OID_AUTO
, pmap_asserts
,
907 CTLFLAG_KERN
| CTLFLAG_RW
| CTLFLAG_LOCKED
,
908 &pmap_asserts_enabled
, 0, "");
909 /* Transform pmap assertions into kernel trace terminations */
910 SYSCTL_INT(_machdep
, OID_AUTO
, pmap_asserts_traced
,
911 CTLFLAG_KERN
| CTLFLAG_RW
| CTLFLAG_LOCKED
,
912 &pmap_asserts_traced
, 0, "");
915 misc_svisor_read(__unused
struct sysctl_oid
*oidp
, __unused
void *arg1
, __unused
int arg2
, struct sysctl_req
*req
)
917 uint64_t new_value
= 0, old_value
= 0;
918 int changed
= 0, error
;
920 error
= sysctl_io_number(req
, old_value
, sizeof(uint64_t), &new_value
, &changed
);
921 if ((error
== 0) && changed
) {
922 volatile uint32_t *raddr
= (uint32_t *) new_value
;
923 printf("Supervisor: value at 0x%llx is 0x%x\n", new_value
, *raddr
);
928 SYSCTL_PROC(_machdep_misc
, OID_AUTO
, misc_svisor_read
,
929 CTLTYPE_QUAD
| CTLFLAG_RW
| CTLFLAG_LOCKED
,
931 misc_svisor_read
, "I", "supervisor mode read");
933 #endif /* DEVELOPMENT || DEBUG */
935 extern void timer_queue_trace_cpu(int);
937 misc_timer_queue_trace(__unused
struct sysctl_oid
*oidp
, __unused
void *arg1
, __unused
int arg2
, struct sysctl_req
*req
)
939 int changed
= 0, error
;
943 error
= sysctl_io_string(req
, buf
, sizeof(buf
), 0, &changed
);
945 if (error
== 0 && changed
) {
946 timer_queue_trace_cpu(0);
951 SYSCTL_PROC(_machdep_misc
, OID_AUTO
, timer_queue_trace
,
952 CTLTYPE_STRING
| CTLFLAG_RW
| CTLFLAG_LOCKED
,
954 misc_timer_queue_trace
, "A", "Cut timer queue tracepoint");
956 extern long NMI_count
;
957 extern void NMI_cpus(void);
959 misc_nmis(__unused
struct sysctl_oid
*oidp
, __unused
void *arg1
, __unused
int arg2
, struct sysctl_req
*req
)
961 int new = 0, old
= 0, changed
= 0, error
;
965 error
= sysctl_io_number(req
, old
, sizeof(int), &new, &changed
);
966 if (error
== 0 && changed
) {
973 SYSCTL_PROC(_machdep_misc
, OID_AUTO
, nmis
,
974 CTLTYPE_INT
| CTLFLAG_RW
| CTLFLAG_LOCKED
,
976 misc_nmis
, "I", "Report/increment NMI count");
978 /* Parameters related to timer coalescing tuning, to be replaced
979 * with a dedicated systemcall in the future.
981 /* Enable processing pending timers in the context of any other interrupt */
982 SYSCTL_INT(_kern
, OID_AUTO
, interrupt_timer_coalescing_enabled
,
983 CTLFLAG_KERN
| CTLFLAG_RW
| CTLFLAG_LOCKED
,
984 &interrupt_timer_coalescing_enabled
, 0, "");
985 /* Upon entering idle, process pending timers with HW deadlines
986 * this far in the future.
988 SYSCTL_INT(_kern
, OID_AUTO
, timer_coalesce_idle_entry_hard_deadline_max
,
989 CTLFLAG_KERN
| CTLFLAG_RW
| CTLFLAG_LOCKED
,
990 &idle_entry_timer_processing_hdeadline_threshold
, 0, "");
992 /* Track potentially expensive eager timer evaluations on QoS tier
995 extern uint32_t ml_timer_eager_evaluations
;
997 SYSCTL_INT(_machdep
, OID_AUTO
, eager_timer_evaluations
,
998 CTLFLAG_KERN
| CTLFLAG_RW
| CTLFLAG_LOCKED
,
999 &ml_timer_eager_evaluations
, 0, "");
1001 extern uint64_t ml_timer_eager_evaluation_max
;
1003 SYSCTL_QUAD(_machdep
, OID_AUTO
, eager_timer_evaluation_max
,
1004 CTLFLAG_KERN
| CTLFLAG_RW
| CTLFLAG_LOCKED
,
1005 &ml_timer_eager_evaluation_max
, "");
1006 extern uint64_t x86_isr_fp_simd_use
;
1007 SYSCTL_QUAD(_machdep
, OID_AUTO
, x86_fp_simd_isr_uses
,
1008 CTLFLAG_KERN
| CTLFLAG_RW
| CTLFLAG_LOCKED
,
1009 &x86_isr_fp_simd_use
, "");
1010 #if DEVELOPMENT || DEBUG
1012 extern int plctrace_enabled
;
1014 SYSCTL_INT(_machdep
, OID_AUTO
, pltrace
,
1015 CTLFLAG_KERN
| CTLFLAG_RW
| CTLFLAG_LOCKED
,
1016 &plctrace_enabled
, 0, "");
1018 /* Intentionally not declared as volatile here: */
1019 extern int mmiotrace_enabled
;
1021 SYSCTL_INT(_machdep
, OID_AUTO
, MMIOtrace
,
1022 CTLFLAG_KERN
| CTLFLAG_RW
| CTLFLAG_LOCKED
,
1023 &mmiotrace_enabled
, 0, "");
1025 extern int fpsimd_fault_popc
;
1026 SYSCTL_INT(_machdep
, OID_AUTO
, fpsimd_fault_popc
,
1027 CTLFLAG_KERN
| CTLFLAG_RW
| CTLFLAG_LOCKED
,
1028 &fpsimd_fault_popc
, 0, "");
1030 volatile int stop_spinning
;
1032 spin_in_the_kernel(__unused
struct sysctl_oid
*oidp
, __unused
void *arg1
, __unused
int arg2
, struct sysctl_req
*req
)
1034 int new = 0, old
= 0, changed
= 0, error
;
1036 error
= sysctl_io_number(req
, old
, sizeof(int), &new, &changed
);
1037 if (error
== 0 && changed
) {
1038 stop_spinning
= FALSE
;
1039 while (stop_spinning
== FALSE
) {
1040 __builtin_ia32_pause();
1042 } else if (error
== 0) {
1043 stop_spinning
= TRUE
;
1049 SYSCTL_PROC(_machdep_misc
, OID_AUTO
, spin_forever
,
1050 CTLTYPE_INT
| CTLFLAG_RW
| CTLFLAG_LOCKED
| CTLFLAG_MASKED
,
1052 spin_in_the_kernel
, "I", "Spin forever");
1054 #endif /* DEVELOPMENT || DEBUG */