2 * Copyright (c) 2003-2020 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>
43 #include <kern/kalloc.h>
47 _i386_cpu_info SYSCTL_HANDLER_ARGS
49 __unused
struct sysctl_oid
*unused_oidp
= oidp
;
58 if (arg2
== 0 && ((char *)ptr
)[0] == '\0') {
62 if (arg2
== sizeof(uint8_t)) {
63 value
= (uint32_t) *(uint8_t *)ptr
;
65 arg2
= sizeof(uint32_t);
67 return SYSCTL_OUT(req
, ptr
, arg2
? (size_t) arg2
: strlen((char *)ptr
) + 1);
71 i386_cpu_info SYSCTL_HANDLER_ARGS
73 void *ptr
= (uint8_t *)cpuid_info() + (uintptr_t)arg1
;
74 return _i386_cpu_info(oidp
, ptr
, arg2
, req
);
78 i386_cpu_info_nonzero SYSCTL_HANDLER_ARGS
80 void *ptr
= (uint8_t *)cpuid_info() + (uintptr_t)arg1
;
81 int value
= *(uint32_t *)ptr
;
87 return _i386_cpu_info(oidp
, ptr
, arg2
, req
);
90 cpu_mwait SYSCTL_HANDLER_ARGS
92 i386_cpu_info_t
*cpu_info
= cpuid_info();
93 void *ptr
= (uint8_t *)cpu_info
->cpuid_mwait_leafp
+ (uintptr_t)arg1
;
94 if (cpu_info
->cpuid_mwait_leafp
== NULL
) {
97 return _i386_cpu_info(oidp
, ptr
, arg2
, req
);
101 cpu_thermal SYSCTL_HANDLER_ARGS
103 i386_cpu_info_t
*cpu_info
= cpuid_info();
104 void *ptr
= (uint8_t *)cpu_info
->cpuid_thermal_leafp
+ (uintptr_t)arg1
;
105 if (cpu_info
->cpuid_thermal_leafp
== NULL
) {
108 return _i386_cpu_info(oidp
, ptr
, arg2
, req
);
112 cpu_arch_perf SYSCTL_HANDLER_ARGS
114 i386_cpu_info_t
*cpu_info
= cpuid_info();
115 void *ptr
= (uint8_t *)cpu_info
->cpuid_arch_perf_leafp
+ (uintptr_t)arg1
;
116 if (cpu_info
->cpuid_arch_perf_leafp
== NULL
) {
119 return _i386_cpu_info(oidp
, ptr
, arg2
, req
);
123 cpu_xsave SYSCTL_HANDLER_ARGS
125 i386_cpu_info_t
*cpu_info
= cpuid_info();
126 void *ptr
= (uint8_t *)cpu_info
->cpuid_xsave_leafp
+ (uintptr_t)arg1
;
127 if (cpu_info
->cpuid_xsave_leafp
== NULL
) {
130 return _i386_cpu_info(oidp
, ptr
, arg2
, req
);
135 cpu_features SYSCTL_HANDLER_ARGS
137 __unused
struct sysctl_oid
*unused_oidp
= oidp
;
138 __unused
void *unused_arg1
= arg1
;
139 __unused
int unused_arg2
= arg2
;
143 cpuid_get_feature_names(cpuid_features(), buf
, sizeof(buf
));
145 return SYSCTL_OUT(req
, buf
, strlen(buf
) + 1);
149 cpu_extfeatures SYSCTL_HANDLER_ARGS
151 __unused
struct sysctl_oid
*unused_oidp
= oidp
;
152 __unused
void *unused_arg1
= arg1
;
153 __unused
int unused_arg2
= arg2
;
157 cpuid_get_extfeature_names(cpuid_extfeatures(), buf
, sizeof(buf
));
159 return SYSCTL_OUT(req
, buf
, strlen(buf
) + 1);
163 cpu_leaf7_features SYSCTL_HANDLER_ARGS
165 __unused
struct sysctl_oid
*unused_oidp
= oidp
;
166 __unused
void *unused_arg1
= arg1
;
167 __unused
int unused_arg2
= arg2
;
170 uint64_t leaf7_features
= cpuid_info()->cpuid_leaf7_features
;
171 uint64_t leaf7_extfeatures
= cpuid_info()->cpuid_leaf7_extfeatures
;
172 if (leaf7_features
== 0 && leaf7_extfeatures
== 0) {
177 cpuid_get_leaf7_feature_names(leaf7_features
, buf
, sizeof(buf
));
178 if (leaf7_extfeatures
!= 0) {
179 strlcat(buf
, " ", sizeof(buf
));
180 cpuid_get_leaf7_extfeature_names(leaf7_extfeatures
, buf
+ strlen(buf
),
181 (unsigned int)(sizeof(buf
) - strlen(buf
)));
184 return SYSCTL_OUT(req
, buf
, strlen(buf
) + 1);
188 cpu_logical_per_package SYSCTL_HANDLER_ARGS
190 __unused
struct sysctl_oid
*unused_oidp
= oidp
;
191 __unused
void *unused_arg1
= arg1
;
192 __unused
int unused_arg2
= arg2
;
193 i386_cpu_info_t
*cpu_info
= cpuid_info();
195 if (!(cpuid_features() & CPUID_FEATURE_HTT
)) {
199 return SYSCTL_OUT(req
, &cpu_info
->cpuid_logical_per_package
,
200 sizeof(cpu_info
->cpuid_logical_per_package
));
204 cpu_flex_ratio_desired SYSCTL_HANDLER_ARGS
206 __unused
struct sysctl_oid
*unused_oidp
= oidp
;
207 __unused
void *unused_arg1
= arg1
;
208 __unused
int unused_arg2
= arg2
;
209 i386_cpu_info_t
*cpu_info
= cpuid_info();
211 if (cpu_info
->cpuid_model
!= 26) {
215 return SYSCTL_OUT(req
, &flex_ratio
, sizeof(flex_ratio
));
219 cpu_flex_ratio_min SYSCTL_HANDLER_ARGS
221 __unused
struct sysctl_oid
*unused_oidp
= oidp
;
222 __unused
void *unused_arg1
= arg1
;
223 __unused
int unused_arg2
= arg2
;
224 i386_cpu_info_t
*cpu_info
= cpuid_info();
226 if (cpu_info
->cpuid_model
!= 26) {
230 return SYSCTL_OUT(req
, &flex_ratio_min
, sizeof(flex_ratio_min
));
234 cpu_flex_ratio_max SYSCTL_HANDLER_ARGS
236 __unused
struct sysctl_oid
*unused_oidp
= oidp
;
237 __unused
void *unused_arg1
= arg1
;
238 __unused
int unused_arg2
= arg2
;
239 i386_cpu_info_t
*cpu_info
= cpuid_info();
241 if (cpu_info
->cpuid_model
!= 26) {
245 return SYSCTL_OUT(req
, &flex_ratio_max
, sizeof(flex_ratio_max
));
249 cpu_ucode_update SYSCTL_HANDLER_ARGS
251 #pragma unused(oidp, arg1, arg2)
255 /* Can't update microcode from within a VM. */
257 if (cpuid_features() & CPUID_FEATURE_VMM
) {
261 if (req
->newptr
== USER_ADDR_NULL
) {
265 error
= SYSCTL_IN(req
, &addr
, sizeof(addr
));
270 return ucode_interface(addr
);
273 extern uint64_t panic_restart_timeout
;
275 panic_set_restart_timeout(__unused
struct sysctl_oid
*oidp
, __unused
void *arg1
, __unused
int arg2
, struct sysctl_req
*req
)
277 int new_value
= 0, old_value
= 0, changed
= 0, error
;
280 if (panic_restart_timeout
) {
281 absolutetime_to_nanoseconds(panic_restart_timeout
, &nstime
);
282 old_value
= (int)MIN(nstime
/ NSEC_PER_SEC
, INT_MAX
);
285 error
= sysctl_io_number(req
, old_value
, sizeof(old_value
), &new_value
, &changed
);
286 if (error
== 0 && changed
) {
287 if (new_value
>= 0) {
288 nanoseconds_to_absolutetime(((uint64_t)new_value
) * NSEC_PER_SEC
, &panic_restart_timeout
);
297 * Populates the {CPU, vector, latency} triple for the maximum observed primary
301 misc_interrupt_latency_max(__unused
struct sysctl_oid
*oidp
, __unused
void *arg1
, __unused
int arg2
, struct sysctl_req
*req
)
303 int changed
= 0, error
;
307 interrupt_populate_latency_stats(buf
, sizeof(buf
));
309 error
= sysctl_io_string(req
, buf
, sizeof(buf
), 0, &changed
);
311 if (error
== 0 && changed
) {
312 interrupt_reset_latency_stats();
318 #if DEVELOPMENT || DEBUG
320 * Populates a string with each CPU's tsc synch delta.
323 x86_cpu_tsc_deltas(__unused
struct sysctl_oid
*oidp
, __unused
void *arg1
, __unused
int arg2
, struct sysctl_req
*req
)
326 uint32_t ncpus
= ml_wait_max_cpus();
327 uint32_t buflen
= (2 /* hex digits */ * sizeof(uint64_t) + 3 /* for "0x" + " " */) * ncpus
+ 1;
328 char *buf
= kalloc(buflen
);
330 cpu_data_tsc_sync_deltas_string(buf
, buflen
, 0, ncpus
- 1);
332 err
= sysctl_io_string(req
, buf
, buflen
, 0, 0);
340 * Triggers a machine-check exception - for a suitably configured kernel only.
342 extern void mca_exception_panic(void);
344 misc_machine_check_panic(__unused
struct sysctl_oid
*oidp
, __unused
void *arg1
, __unused
int arg2
, struct sysctl_req
*req
)
346 int changed
= 0, error
;
350 error
= sysctl_io_string(req
, buf
, sizeof(buf
), 0, &changed
);
352 if (error
== 0 && changed
) {
353 mca_exception_panic();
359 * Triggers a non-responsive processor timeout panic - for a suitably configured kernel only.
361 static uint64_t kernel_timeout_spin
= 0;
363 misc_kernel_timeout_spin(__unused
struct sysctl_oid
*oidp
, __unused
void *arg1
, __unused
int arg2
, struct sysctl_req
*req
)
367 int changed
= 0, error
;
371 absolutetime_to_nanoseconds(kernel_timeout_spin
, &old_value
);
373 error
= sysctl_io_number(req
, old_value
, sizeof(uint64_t), &new_value
, &changed
);
374 if (error
== 0 && changed
) {
375 nanoseconds_to_absolutetime(((uint64_t)new_value
), &kernel_timeout_spin
);
376 kernel_spin(kernel_timeout_spin
);
380 #endif /* DEVELOPMENT || DEBUG */
383 SYSCTL_NODE(_machdep
, OID_AUTO
, cpu
, CTLFLAG_RW
| CTLFLAG_LOCKED
, 0,
386 SYSCTL_PROC(_machdep_cpu
, OID_AUTO
, max_basic
, CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
387 (void *)offsetof(i386_cpu_info_t
, cpuid_max_basic
), sizeof(uint32_t),
388 i386_cpu_info
, "IU", "Max Basic Information value");
390 SYSCTL_PROC(_machdep_cpu
, OID_AUTO
, max_ext
, CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
391 (void *)offsetof(i386_cpu_info_t
, cpuid_max_ext
), sizeof(uint32_t),
392 i386_cpu_info
, "IU", "Max Extended Function Information value");
394 SYSCTL_PROC(_machdep_cpu
, OID_AUTO
, vendor
, CTLTYPE_STRING
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
395 (void *)offsetof(i386_cpu_info_t
, cpuid_vendor
), 0,
396 i386_cpu_info
, "A", "CPU vendor");
398 SYSCTL_PROC(_machdep_cpu
, OID_AUTO
, brand_string
, CTLTYPE_STRING
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
399 (void *)offsetof(i386_cpu_info_t
, cpuid_brand_string
), 0,
400 i386_cpu_info
, "A", "CPU brand string");
402 SYSCTL_PROC(_machdep_cpu
, OID_AUTO
, family
, CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
403 (void *)offsetof(i386_cpu_info_t
, cpuid_family
), sizeof(uint8_t),
404 i386_cpu_info
, "I", "CPU family");
406 SYSCTL_PROC(_machdep_cpu
, OID_AUTO
, model
, CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
407 (void *)offsetof(i386_cpu_info_t
, cpuid_model
), sizeof(uint8_t),
408 i386_cpu_info
, "I", "CPU model");
410 SYSCTL_PROC(_machdep_cpu
, OID_AUTO
, extmodel
, CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
411 (void *)offsetof(i386_cpu_info_t
, cpuid_extmodel
), sizeof(uint8_t),
412 i386_cpu_info
, "I", "CPU extended model");
414 SYSCTL_PROC(_machdep_cpu
, OID_AUTO
, extfamily
, CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
415 (void *)offsetof(i386_cpu_info_t
, cpuid_extfamily
), sizeof(uint8_t),
416 i386_cpu_info
, "I", "CPU extended family");
418 SYSCTL_PROC(_machdep_cpu
, OID_AUTO
, stepping
, CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
419 (void *)offsetof(i386_cpu_info_t
, cpuid_stepping
), sizeof(uint8_t),
420 i386_cpu_info
, "I", "CPU stepping");
422 SYSCTL_PROC(_machdep_cpu
, OID_AUTO
, feature_bits
, CTLTYPE_QUAD
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
423 (void *)offsetof(i386_cpu_info_t
, cpuid_features
), sizeof(uint64_t),
424 i386_cpu_info
, "IU", "CPU features");
426 SYSCTL_PROC(_machdep_cpu
, OID_AUTO
, leaf7_feature_bits
,
427 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
428 (void *)offsetof(i386_cpu_info_t
, cpuid_leaf7_features
),
430 i386_cpu_info_nonzero
, "IU", "CPU Leaf7 features [EBX ECX]");
432 SYSCTL_PROC(_machdep_cpu
, OID_AUTO
, leaf7_feature_bits_edx
,
433 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
434 (void *)offsetof(i386_cpu_info_t
, cpuid_leaf7_extfeatures
),
436 i386_cpu_info_nonzero
, "IU", "CPU Leaf7 features [EDX]");
438 SYSCTL_PROC(_machdep_cpu
, OID_AUTO
, extfeature_bits
, CTLTYPE_QUAD
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
439 (void *)offsetof(i386_cpu_info_t
, cpuid_extfeatures
), sizeof(uint64_t),
440 i386_cpu_info
, "IU", "CPU extended features");
442 SYSCTL_PROC(_machdep_cpu
, OID_AUTO
, signature
, CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
443 (void *)offsetof(i386_cpu_info_t
, cpuid_signature
), sizeof(uint32_t),
444 i386_cpu_info
, "I", "CPU signature");
446 SYSCTL_PROC(_machdep_cpu
, OID_AUTO
, brand
, CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
447 (void *)offsetof(i386_cpu_info_t
, cpuid_brand
), sizeof(uint8_t),
448 i386_cpu_info
, "I", "CPU brand");
450 SYSCTL_PROC(_machdep_cpu
, OID_AUTO
, features
, CTLTYPE_STRING
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
452 cpu_features
, "A", "CPU feature names");
454 SYSCTL_PROC(_machdep_cpu
, OID_AUTO
, leaf7_features
,
455 CTLTYPE_STRING
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
457 cpu_leaf7_features
, "A", "CPU Leaf7 feature names");
459 SYSCTL_PROC(_machdep_cpu
, OID_AUTO
, extfeatures
, CTLTYPE_STRING
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
461 cpu_extfeatures
, "A", "CPU extended feature names");
463 SYSCTL_PROC(_machdep_cpu
, OID_AUTO
, logical_per_package
,
464 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
466 cpu_logical_per_package
, "I", "CPU logical cpus per package");
468 SYSCTL_PROC(_machdep_cpu
, OID_AUTO
, cores_per_package
,
469 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
470 (void *)offsetof(i386_cpu_info_t
, cpuid_cores_per_package
),
472 i386_cpu_info
, "I", "CPU cores per package");
474 SYSCTL_PROC(_machdep_cpu
, OID_AUTO
, microcode_version
,
475 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
476 (void *)offsetof(i386_cpu_info_t
, cpuid_microcode_version
),
478 i386_cpu_info
, "I", "Microcode version number");
480 SYSCTL_PROC(_machdep_cpu
, OID_AUTO
, processor_flag
,
481 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
482 (void *)offsetof(i386_cpu_info_t
, cpuid_processor_flag
),
484 i386_cpu_info
, "I", "CPU processor flag");
487 SYSCTL_NODE(_machdep_cpu
, OID_AUTO
, mwait
, CTLFLAG_RW
| CTLFLAG_LOCKED
, 0,
490 SYSCTL_PROC(_machdep_cpu_mwait
, OID_AUTO
, linesize_min
,
491 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
492 (void *)offsetof(cpuid_mwait_leaf_t
, linesize_min
),
494 cpu_mwait
, "I", "Monitor/mwait minimum line size");
496 SYSCTL_PROC(_machdep_cpu_mwait
, OID_AUTO
, linesize_max
,
497 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
498 (void *)offsetof(cpuid_mwait_leaf_t
, linesize_max
),
500 cpu_mwait
, "I", "Monitor/mwait maximum line size");
502 SYSCTL_PROC(_machdep_cpu_mwait
, OID_AUTO
, extensions
,
503 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
504 (void *)offsetof(cpuid_mwait_leaf_t
, extensions
),
506 cpu_mwait
, "I", "Monitor/mwait extensions");
508 SYSCTL_PROC(_machdep_cpu_mwait
, OID_AUTO
, sub_Cstates
,
509 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
510 (void *)offsetof(cpuid_mwait_leaf_t
, sub_Cstates
),
512 cpu_mwait
, "I", "Monitor/mwait sub C-states");
515 SYSCTL_NODE(_machdep_cpu
, OID_AUTO
, thermal
, CTLFLAG_RW
| CTLFLAG_LOCKED
, 0,
518 SYSCTL_PROC(_machdep_cpu_thermal
, OID_AUTO
, sensor
,
519 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
520 (void *)offsetof(cpuid_thermal_leaf_t
, sensor
),
522 cpu_thermal
, "I", "Thermal sensor present");
524 SYSCTL_PROC(_machdep_cpu_thermal
, OID_AUTO
, dynamic_acceleration
,
525 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
526 (void *)offsetof(cpuid_thermal_leaf_t
, dynamic_acceleration
),
528 cpu_thermal
, "I", "Dynamic Acceleration Technology (Turbo Mode)");
530 SYSCTL_PROC(_machdep_cpu_thermal
, OID_AUTO
, invariant_APIC_timer
,
531 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
532 (void *)offsetof(cpuid_thermal_leaf_t
, invariant_APIC_timer
),
534 cpu_thermal
, "I", "Invariant APIC Timer");
536 SYSCTL_PROC(_machdep_cpu_thermal
, OID_AUTO
, thresholds
,
537 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
538 (void *)offsetof(cpuid_thermal_leaf_t
, thresholds
),
540 cpu_thermal
, "I", "Number of interrupt thresholds");
542 SYSCTL_PROC(_machdep_cpu_thermal
, OID_AUTO
, ACNT_MCNT
,
543 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
544 (void *)offsetof(cpuid_thermal_leaf_t
, ACNT_MCNT
),
546 cpu_thermal
, "I", "ACNT_MCNT capability");
548 SYSCTL_PROC(_machdep_cpu_thermal
, OID_AUTO
, core_power_limits
,
549 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
550 (void *)offsetof(cpuid_thermal_leaf_t
, core_power_limits
),
552 cpu_thermal
, "I", "Power Limit Notifications at a Core Level");
554 SYSCTL_PROC(_machdep_cpu_thermal
, OID_AUTO
, fine_grain_clock_mod
,
555 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
556 (void *)offsetof(cpuid_thermal_leaf_t
, fine_grain_clock_mod
),
558 cpu_thermal
, "I", "Fine Grain Clock Modulation");
560 SYSCTL_PROC(_machdep_cpu_thermal
, OID_AUTO
, package_thermal_intr
,
561 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
562 (void *)offsetof(cpuid_thermal_leaf_t
, package_thermal_intr
),
564 cpu_thermal
, "I", "Package Thermal interrupt and Status");
566 SYSCTL_PROC(_machdep_cpu_thermal
, OID_AUTO
, hardware_feedback
,
567 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
568 (void *)offsetof(cpuid_thermal_leaf_t
, hardware_feedback
),
570 cpu_thermal
, "I", "Hardware Coordination Feedback");
572 SYSCTL_PROC(_machdep_cpu_thermal
, OID_AUTO
, energy_policy
,
573 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
574 (void *)offsetof(cpuid_thermal_leaf_t
, energy_policy
),
576 cpu_thermal
, "I", "Energy Efficient Policy Support");
578 SYSCTL_NODE(_machdep_cpu
, OID_AUTO
, xsave
, CTLFLAG_RW
| CTLFLAG_LOCKED
, 0,
581 SYSCTL_PROC(_machdep_cpu_xsave
, OID_AUTO
, extended_state
,
582 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
584 sizeof(cpuid_xsave_leaf_t
),
585 cpu_xsave
, "IU", "XSAVE Extended State Main Leaf");
587 SYSCTL_PROC(_machdep_cpu_xsave
, OID_AUTO
, extended_state1
,
588 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
589 (void *) sizeof(cpuid_xsave_leaf_t
),
590 sizeof(cpuid_xsave_leaf_t
),
591 cpu_xsave
, "IU", "XSAVE Extended State Sub-leaf 1");
594 SYSCTL_NODE(_machdep_cpu
, OID_AUTO
, arch_perf
, CTLFLAG_RW
| CTLFLAG_LOCKED
, 0,
597 SYSCTL_PROC(_machdep_cpu_arch_perf
, OID_AUTO
, version
,
598 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
599 (void *)offsetof(cpuid_arch_perf_leaf_t
, version
),
601 cpu_arch_perf
, "I", "Architectural Performance Version Number");
603 SYSCTL_PROC(_machdep_cpu_arch_perf
, OID_AUTO
, number
,
604 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
605 (void *)offsetof(cpuid_arch_perf_leaf_t
, number
),
607 cpu_arch_perf
, "I", "Number of counters per logical cpu");
609 SYSCTL_PROC(_machdep_cpu_arch_perf
, OID_AUTO
, width
,
610 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
611 (void *)offsetof(cpuid_arch_perf_leaf_t
, width
),
613 cpu_arch_perf
, "I", "Bit width of counters");
615 SYSCTL_PROC(_machdep_cpu_arch_perf
, OID_AUTO
, events_number
,
616 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
617 (void *)offsetof(cpuid_arch_perf_leaf_t
, events_number
),
619 cpu_arch_perf
, "I", "Number of monitoring events");
621 SYSCTL_PROC(_machdep_cpu_arch_perf
, OID_AUTO
, events
,
622 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
623 (void *)offsetof(cpuid_arch_perf_leaf_t
, events
),
625 cpu_arch_perf
, "I", "Bit vector of events");
627 SYSCTL_PROC(_machdep_cpu_arch_perf
, OID_AUTO
, fixed_number
,
628 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
629 (void *)offsetof(cpuid_arch_perf_leaf_t
, fixed_number
),
631 cpu_arch_perf
, "I", "Number of fixed-function counters");
633 SYSCTL_PROC(_machdep_cpu_arch_perf
, OID_AUTO
, fixed_width
,
634 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
635 (void *)offsetof(cpuid_arch_perf_leaf_t
, fixed_width
),
637 cpu_arch_perf
, "I", "Bit-width of fixed-function counters");
640 SYSCTL_NODE(_machdep_cpu
, OID_AUTO
, cache
, CTLFLAG_RW
| CTLFLAG_LOCKED
, 0,
643 SYSCTL_PROC(_machdep_cpu_cache
, OID_AUTO
, linesize
,
644 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
645 (void *)offsetof(i386_cpu_info_t
, cpuid_cache_linesize
),
647 i386_cpu_info
, "I", "Cacheline size");
649 SYSCTL_PROC(_machdep_cpu_cache
, OID_AUTO
, L2_associativity
,
650 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
651 (void *)offsetof(i386_cpu_info_t
, cpuid_cache_L2_associativity
),
653 i386_cpu_info
, "I", "L2 cache associativity");
655 SYSCTL_PROC(_machdep_cpu_cache
, OID_AUTO
, size
,
656 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
657 (void *)offsetof(i386_cpu_info_t
, cpuid_cache_size
),
659 i386_cpu_info
, "I", "Cache size (in Kbytes)");
662 SYSCTL_NODE(_machdep_cpu
, OID_AUTO
, tlb
, CTLFLAG_RW
| CTLFLAG_LOCKED
, 0,
664 SYSCTL_NODE(_machdep_cpu_tlb
, OID_AUTO
, inst
, CTLFLAG_RW
| CTLFLAG_LOCKED
, 0,
666 SYSCTL_NODE(_machdep_cpu_tlb
, OID_AUTO
, data
, CTLFLAG_RW
| CTLFLAG_LOCKED
, 0,
669 SYSCTL_PROC(_machdep_cpu_tlb_inst
, OID_AUTO
, small
,
670 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
671 (void *)offsetof(i386_cpu_info_t
,
672 cpuid_tlb
[TLB_INST
][TLB_SMALL
][0]),
674 i386_cpu_info_nonzero
, "I",
675 "Number of small page instruction TLBs");
677 SYSCTL_PROC(_machdep_cpu_tlb_data
, OID_AUTO
, small
,
678 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
679 (void *)offsetof(i386_cpu_info_t
,
680 cpuid_tlb
[TLB_DATA
][TLB_SMALL
][0]),
682 i386_cpu_info_nonzero
, "I",
683 "Number of small page data TLBs (1st level)");
685 SYSCTL_PROC(_machdep_cpu_tlb_data
, OID_AUTO
, small_level1
,
686 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
687 (void *)offsetof(i386_cpu_info_t
,
688 cpuid_tlb
[TLB_DATA
][TLB_SMALL
][1]),
690 i386_cpu_info_nonzero
, "I",
691 "Number of small page data TLBs (2nd level)");
693 SYSCTL_PROC(_machdep_cpu_tlb_inst
, OID_AUTO
, large
,
694 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
695 (void *)offsetof(i386_cpu_info_t
,
696 cpuid_tlb
[TLB_INST
][TLB_LARGE
][0]),
698 i386_cpu_info_nonzero
, "I",
699 "Number of large page instruction TLBs");
701 SYSCTL_PROC(_machdep_cpu_tlb_data
, OID_AUTO
, large
,
702 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
703 (void *)offsetof(i386_cpu_info_t
,
704 cpuid_tlb
[TLB_DATA
][TLB_LARGE
][0]),
706 i386_cpu_info_nonzero
, "I",
707 "Number of large page data TLBs (1st level)");
709 SYSCTL_PROC(_machdep_cpu_tlb_data
, OID_AUTO
, large_level1
,
710 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
711 (void *)offsetof(i386_cpu_info_t
,
712 cpuid_tlb
[TLB_DATA
][TLB_LARGE
][1]),
714 i386_cpu_info_nonzero
, "I",
715 "Number of large page data TLBs (2nd level)");
717 SYSCTL_PROC(_machdep_cpu_tlb
, OID_AUTO
, shared
,
718 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
719 (void *)offsetof(i386_cpu_info_t
, cpuid_stlb
),
721 i386_cpu_info_nonzero
, "I",
722 "Number of shared TLBs");
725 SYSCTL_NODE(_machdep_cpu
, OID_AUTO
, address_bits
, CTLFLAG_RW
| CTLFLAG_LOCKED
, 0,
728 SYSCTL_PROC(_machdep_cpu_address_bits
, OID_AUTO
, physical
,
729 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
730 (void *)offsetof(i386_cpu_info_t
, cpuid_address_bits_physical
),
732 i386_cpu_info
, "I", "Number of physical address bits");
734 SYSCTL_PROC(_machdep_cpu_address_bits
, OID_AUTO
, virtual,
735 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
736 (void *)offsetof(i386_cpu_info_t
, cpuid_address_bits_virtual
),
738 i386_cpu_info
, "I", "Number of virtual address bits");
741 SYSCTL_PROC(_machdep_cpu
, OID_AUTO
, core_count
,
742 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
743 (void *)offsetof(i386_cpu_info_t
, core_count
),
745 i386_cpu_info
, "I", "Number of enabled cores per package");
747 SYSCTL_PROC(_machdep_cpu
, OID_AUTO
, thread_count
,
748 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
749 (void *)offsetof(i386_cpu_info_t
, thread_count
),
751 i386_cpu_info
, "I", "Number of enabled threads per package");
753 SYSCTL_NODE(_machdep_cpu
, OID_AUTO
, flex_ratio
, CTLFLAG_RW
| CTLFLAG_LOCKED
, 0,
756 SYSCTL_PROC(_machdep_cpu_flex_ratio
, OID_AUTO
, desired
,
757 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
759 cpu_flex_ratio_desired
, "I", "Flex ratio desired (0 disabled)");
761 SYSCTL_PROC(_machdep_cpu_flex_ratio
, OID_AUTO
, min
,
762 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
764 cpu_flex_ratio_min
, "I", "Flex ratio min (efficiency)");
766 SYSCTL_PROC(_machdep_cpu_flex_ratio
, OID_AUTO
, max
,
767 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
769 cpu_flex_ratio_max
, "I", "Flex ratio max (non-turbo)");
771 SYSCTL_PROC(_machdep_cpu
, OID_AUTO
, ucupdate
,
772 CTLTYPE_INT
| CTLFLAG_WR
| CTLFLAG_LOCKED
, 0, 0,
773 cpu_ucode_update
, "S", "Microcode update interface");
775 SYSCTL_NODE(_machdep_cpu
, OID_AUTO
, tsc_ccc
, CTLFLAG_RW
| CTLFLAG_LOCKED
, 0,
776 "TSC/CCC frequency information");
778 SYSCTL_PROC(_machdep_cpu_tsc_ccc
, OID_AUTO
, numerator
,
779 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
780 (void *)offsetof(i386_cpu_info_t
, cpuid_tsc_leaf
.numerator
),
782 i386_cpu_info
, "I", "Numerator of TSC/CCC ratio");
784 SYSCTL_PROC(_machdep_cpu_tsc_ccc
, OID_AUTO
, denominator
,
785 CTLTYPE_INT
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
786 (void *)offsetof(i386_cpu_info_t
, cpuid_tsc_leaf
.denominator
),
788 i386_cpu_info
, "I", "Denominator of TSC/CCC ratio");
790 static const uint32_t apic_timer_vector
= (LAPIC_DEFAULT_INTERRUPT_BASE
+ LAPIC_TIMER_INTERRUPT
);
791 static const uint32_t apic_IPI_vector
= (LAPIC_DEFAULT_INTERRUPT_BASE
+ LAPIC_INTERPROCESSOR_INTERRUPT
);
793 SYSCTL_NODE(_machdep
, OID_AUTO
, vectors
, CTLFLAG_RD
| CTLFLAG_LOCKED
, 0,
794 "Interrupt vector assignments");
796 SYSCTL_UINT(_machdep_vectors
, OID_AUTO
, timer
, CTLFLAG_RD
| CTLFLAG_KERN
| CTLFLAG_LOCKED
, __DECONST(uint32_t *, &apic_timer_vector
), 0, "");
797 SYSCTL_UINT(_machdep_vectors
, OID_AUTO
, IPI
, CTLFLAG_RD
| CTLFLAG_KERN
| CTLFLAG_LOCKED
, __DECONST(uint32_t *, &apic_IPI_vector
), 0, "");
799 uint64_t pmap_pv_hashlist_walks
;
800 uint64_t pmap_pv_hashlist_cnts
;
801 uint32_t pmap_pv_hashlist_max
;
802 uint32_t pmap_kernel_text_ps
= PAGE_SIZE
;
803 extern uint32_t pv_hashed_kern_low_water_mark
;
805 /*extern struct sysctl_oid_list sysctl__machdep_pmap_children;*/
807 SYSCTL_NODE(_machdep
, OID_AUTO
, pmap
, CTLFLAG_RW
| CTLFLAG_LOCKED
, 0,
810 SYSCTL_QUAD(_machdep_pmap
, OID_AUTO
, hashwalks
, CTLFLAG_RD
| CTLFLAG_KERN
| CTLFLAG_LOCKED
, &pmap_pv_hashlist_walks
, "");
811 SYSCTL_QUAD(_machdep_pmap
, OID_AUTO
, hashcnts
, CTLFLAG_RD
| CTLFLAG_KERN
| CTLFLAG_LOCKED
, &pmap_pv_hashlist_cnts
, "");
812 SYSCTL_INT(_machdep_pmap
, OID_AUTO
, hashmax
, CTLFLAG_RD
| CTLFLAG_KERN
| CTLFLAG_LOCKED
, &pmap_pv_hashlist_max
, 0, "");
813 SYSCTL_INT(_machdep_pmap
, OID_AUTO
, kernel_text_ps
, CTLFLAG_RD
| CTLFLAG_KERN
| CTLFLAG_LOCKED
, &pmap_kernel_text_ps
, 0, "");
814 SYSCTL_INT(_machdep_pmap
, OID_AUTO
, kern_pv_reserve
, CTLFLAG_RW
| CTLFLAG_KERN
| CTLFLAG_LOCKED
, &pv_hashed_kern_low_water_mark
, 0, "");
816 SYSCTL_NODE(_machdep
, OID_AUTO
, memmap
, CTLFLAG_RD
| CTLFLAG_LOCKED
, NULL
, "physical memory map");
818 uint64_t firmware_Conventional_bytes
= 0;
819 uint64_t firmware_RuntimeServices_bytes
= 0;
820 uint64_t firmware_ACPIReclaim_bytes
= 0;
821 uint64_t firmware_ACPINVS_bytes
= 0;
822 uint64_t firmware_PalCode_bytes
= 0;
823 uint64_t firmware_Reserved_bytes
= 0;
824 uint64_t firmware_Unusable_bytes
= 0;
825 uint64_t firmware_other_bytes
= 0;
827 SYSCTL_QUAD(_machdep_memmap
, OID_AUTO
, Conventional
, CTLFLAG_RD
| CTLFLAG_LOCKED
, &firmware_Conventional_bytes
, "");
828 SYSCTL_QUAD(_machdep_memmap
, OID_AUTO
, RuntimeServices
, CTLFLAG_RD
| CTLFLAG_LOCKED
, &firmware_RuntimeServices_bytes
, "");
829 SYSCTL_QUAD(_machdep_memmap
, OID_AUTO
, ACPIReclaim
, CTLFLAG_RD
| CTLFLAG_LOCKED
, &firmware_ACPIReclaim_bytes
, "");
830 SYSCTL_QUAD(_machdep_memmap
, OID_AUTO
, ACPINVS
, CTLFLAG_RD
| CTLFLAG_LOCKED
, &firmware_ACPINVS_bytes
, "");
831 SYSCTL_QUAD(_machdep_memmap
, OID_AUTO
, PalCode
, CTLFLAG_RD
| CTLFLAG_LOCKED
, &firmware_PalCode_bytes
, "");
832 SYSCTL_QUAD(_machdep_memmap
, OID_AUTO
, Reserved
, CTLFLAG_RD
| CTLFLAG_LOCKED
, &firmware_Reserved_bytes
, "");
833 SYSCTL_QUAD(_machdep_memmap
, OID_AUTO
, Unusable
, CTLFLAG_RD
| CTLFLAG_LOCKED
, &firmware_Unusable_bytes
, "");
834 SYSCTL_QUAD(_machdep_memmap
, OID_AUTO
, Other
, CTLFLAG_RD
| CTLFLAG_LOCKED
, &firmware_other_bytes
, "");
836 SYSCTL_NODE(_machdep
, OID_AUTO
, tsc
, CTLFLAG_RD
| CTLFLAG_LOCKED
, NULL
, "Timestamp counter parameters");
838 SYSCTL_QUAD(_machdep_tsc
, OID_AUTO
, frequency
,
839 CTLFLAG_RD
| CTLFLAG_LOCKED
, &tscFreq
, "");
841 extern uint32_t deep_idle_rebase
;
842 SYSCTL_UINT(_machdep_tsc
, OID_AUTO
, deep_idle_rebase
,
843 CTLFLAG_RD
| CTLFLAG_LOCKED
, &deep_idle_rebase
, 0, "");
844 SYSCTL_QUAD(_machdep_tsc
, OID_AUTO
, at_boot
,
845 CTLFLAG_RD
| CTLFLAG_LOCKED
, &tsc_at_boot
, "");
846 SYSCTL_QUAD(_machdep_tsc
, OID_AUTO
, rebase_abs_time
,
847 CTLFLAG_RD
| CTLFLAG_LOCKED
, &tsc_rebase_abs_time
, "");
848 #if DEVELOPMENT || DEBUG
849 SYSCTL_PROC(_machdep_tsc
, OID_AUTO
, synch_deltas
,
850 CTLTYPE_STRING
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
851 0, 0, x86_cpu_tsc_deltas
, "A", "TSC synch deltas");
854 SYSCTL_NODE(_machdep_tsc
, OID_AUTO
, nanotime
,
855 CTLFLAG_RD
| CTLFLAG_LOCKED
, NULL
, "TSC to ns conversion");
856 SYSCTL_QUAD(_machdep_tsc_nanotime
, OID_AUTO
, tsc_base
,
857 CTLFLAG_RD
| CTLFLAG_LOCKED
,
858 __DECONST(uint64_t *, &pal_rtc_nanotime_info
.tsc_base
), "");
859 SYSCTL_QUAD(_machdep_tsc_nanotime
, OID_AUTO
, ns_base
,
860 CTLFLAG_RD
| CTLFLAG_LOCKED
,
861 __DECONST(uint64_t *, &pal_rtc_nanotime_info
.ns_base
), "");
862 SYSCTL_UINT(_machdep_tsc_nanotime
, OID_AUTO
, scale
,
863 CTLFLAG_RD
| CTLFLAG_LOCKED
,
864 __DECONST(uint32_t *, &pal_rtc_nanotime_info
.scale
), 0, "");
865 SYSCTL_UINT(_machdep_tsc_nanotime
, OID_AUTO
, shift
,
866 CTLFLAG_RD
| CTLFLAG_LOCKED
,
867 __DECONST(uint32_t *, &pal_rtc_nanotime_info
.shift
), 0, "");
868 SYSCTL_UINT(_machdep_tsc_nanotime
, OID_AUTO
, generation
,
869 CTLFLAG_RD
| CTLFLAG_LOCKED
,
870 __DECONST(uint32_t *, &pal_rtc_nanotime_info
.generation
), 0, "");
872 SYSCTL_NODE(_machdep
, OID_AUTO
, misc
, CTLFLAG_RW
| CTLFLAG_LOCKED
, 0,
873 "Miscellaneous x86 kernel parameters");
875 #if (DEVELOPMENT || DEBUG)
876 extern uint32_t mp_interrupt_watchdog_events
;
877 SYSCTL_UINT(_machdep_misc
, OID_AUTO
, interrupt_watchdog_events
,
878 CTLFLAG_RW
| CTLFLAG_LOCKED
, &mp_interrupt_watchdog_events
, 0, "");
880 extern int insnstream_force_cacheline_mismatch
;
881 SYSCTL_INT(_machdep_misc
, OID_AUTO
, insnstream_force_clmismatch
,
882 CTLFLAG_RW
| CTLFLAG_LOCKED
, &insnstream_force_cacheline_mismatch
, 0, "");
886 SYSCTL_PROC(_machdep_misc
, OID_AUTO
, panic_restart_timeout
,
887 CTLTYPE_INT
| CTLFLAG_RW
| CTLFLAG_LOCKED
,
889 panic_set_restart_timeout
, "I", "Panic restart timeout in seconds");
891 SYSCTL_PROC(_machdep_misc
, OID_AUTO
, interrupt_latency_max
,
892 CTLTYPE_STRING
| CTLFLAG_RW
| CTLFLAG_LOCKED
,
894 misc_interrupt_latency_max
, "A", "Maximum Interrupt latency");
896 extern boolean_t is_x2apic
;
897 SYSCTL_INT(_machdep
, OID_AUTO
, x2apic_enabled
,
898 CTLFLAG_KERN
| CTLFLAG_RD
| CTLFLAG_LOCKED
,
901 #if DEVELOPMENT || DEBUG
902 SYSCTL_PROC(_machdep_misc
, OID_AUTO
, machine_check_panic
,
903 CTLTYPE_STRING
| CTLFLAG_RW
| CTLFLAG_LOCKED
,
905 misc_machine_check_panic
, "A", "Machine-check exception test");
907 SYSCTL_PROC(_machdep_misc
, OID_AUTO
, kernel_timeout_spin
,
908 CTLTYPE_QUAD
| CTLFLAG_RW
| CTLFLAG_LOCKED
,
909 0, sizeof(kernel_timeout_spin
),
910 misc_kernel_timeout_spin
, "Q", "Kernel timeout panic test");
912 SYSCTL_QUAD(_machdep
, OID_AUTO
, reportphyreadabs
,
913 CTLFLAG_KERN
| CTLFLAG_RW
| CTLFLAG_LOCKED
,
914 &reportphyreaddelayabs
, "");
915 SYSCTL_QUAD(_machdep
, OID_AUTO
, reportphywriteabs
,
916 CTLFLAG_KERN
| CTLFLAG_RW
| CTLFLAG_LOCKED
,
917 &reportphywritedelayabs
, "");
918 SYSCTL_QUAD(_machdep
, OID_AUTO
, tracephyreadabs
,
919 CTLFLAG_KERN
| CTLFLAG_RW
| CTLFLAG_LOCKED
,
920 &tracephyreaddelayabs
, "");
921 SYSCTL_QUAD(_machdep
, OID_AUTO
, tracephywriteabs
,
922 CTLFLAG_KERN
| CTLFLAG_RW
| CTLFLAG_LOCKED
,
923 &tracephywritedelayabs
, "");
924 SYSCTL_INT(_machdep
, OID_AUTO
, reportphyreadosbt
,
925 CTLFLAG_KERN
| CTLFLAG_RW
| CTLFLAG_LOCKED
,
926 &reportphyreadosbt
, 0, "");
927 SYSCTL_INT(_machdep
, OID_AUTO
, reportphywriteosbt
,
928 CTLFLAG_KERN
| CTLFLAG_RW
| CTLFLAG_LOCKED
,
929 &reportphywriteosbt
, 0, "");
930 SYSCTL_INT(_machdep
, OID_AUTO
, phyreaddelaypanic
,
931 CTLFLAG_KERN
| CTLFLAG_RW
| CTLFLAG_LOCKED
,
932 &phyreadpanic
, 0, "");
933 SYSCTL_INT(_machdep
, OID_AUTO
, phywritedelaypanic
,
934 CTLFLAG_KERN
| CTLFLAG_RW
| CTLFLAG_LOCKED
,
935 &phywritepanic
, 0, "");
936 #if DEVELOPMENT || DEBUG
937 extern uint64_t simulate_stretched_io
;
938 SYSCTL_QUAD(_machdep
, OID_AUTO
, sim_stretched_io_ns
,
939 CTLFLAG_KERN
| CTLFLAG_RW
| CTLFLAG_LOCKED
,
940 &simulate_stretched_io
, "");
943 extern int pmap_pagezero_mitigation
;
944 extern int pmap_asserts_enabled
, pmap_asserts_traced
;
945 /* On DEV/DEBUG kernels, clear this to disable the SMAP emulation
946 * (address space disconnect) for pagezero-less processes.
948 SYSCTL_INT(_machdep
, OID_AUTO
, pmap_pagezero_mitigation
,
949 CTLFLAG_KERN
| CTLFLAG_RW
| CTLFLAG_LOCKED
,
950 &pmap_pagezero_mitigation
, 0, "");
951 /* Toggle pmap assertions */
952 SYSCTL_INT(_machdep
, OID_AUTO
, pmap_asserts
,
953 CTLFLAG_KERN
| CTLFLAG_RW
| CTLFLAG_LOCKED
,
954 &pmap_asserts_enabled
, 0, "");
955 /* Transform pmap assertions into kernel trace terminations */
956 SYSCTL_INT(_machdep
, OID_AUTO
, pmap_asserts_traced
,
957 CTLFLAG_KERN
| CTLFLAG_RW
| CTLFLAG_LOCKED
,
958 &pmap_asserts_traced
, 0, "");
961 misc_svisor_read(__unused
struct sysctl_oid
*oidp
, __unused
void *arg1
, __unused
int arg2
, struct sysctl_req
*req
)
963 uint64_t new_value
= 0, old_value
= 0;
964 int changed
= 0, error
;
966 error
= sysctl_io_number(req
, old_value
, sizeof(uint64_t), &new_value
, &changed
);
967 if ((error
== 0) && changed
) {
968 volatile uint32_t *raddr
= (uint32_t *) new_value
;
969 printf("Supervisor: value at 0x%llx is 0x%x\n", new_value
, *raddr
);
974 SYSCTL_PROC(_machdep_misc
, OID_AUTO
, misc_svisor_read
,
975 CTLTYPE_QUAD
| CTLFLAG_RW
| CTLFLAG_LOCKED
,
977 misc_svisor_read
, "I", "supervisor mode read");
979 #endif /* DEVELOPMENT || DEBUG */
981 extern void timer_queue_trace_cpu(int);
983 misc_timer_queue_trace(__unused
struct sysctl_oid
*oidp
, __unused
void *arg1
, __unused
int arg2
, struct sysctl_req
*req
)
985 int changed
= 0, error
;
989 error
= sysctl_io_string(req
, buf
, sizeof(buf
), 0, &changed
);
991 if (error
== 0 && changed
) {
992 timer_queue_trace_cpu(0);
997 SYSCTL_PROC(_machdep_misc
, OID_AUTO
, timer_queue_trace
,
998 CTLTYPE_STRING
| CTLFLAG_RW
| CTLFLAG_LOCKED
,
1000 misc_timer_queue_trace
, "A", "Cut timer queue tracepoint");
1002 extern long NMI_count
;
1003 extern void NMI_cpus(void);
1005 misc_nmis(__unused
struct sysctl_oid
*oidp
, __unused
void *arg1
, __unused
int arg2
, struct sysctl_req
*req
)
1007 int new = 0, old
= 0, changed
= 0, error
;
1009 old
= (int)MIN(NMI_count
, INT_MAX
);
1011 error
= sysctl_io_number(req
, old
, sizeof(int), &new, &changed
);
1012 if (error
== 0 && changed
) {
1019 SYSCTL_PROC(_machdep_misc
, OID_AUTO
, nmis
,
1020 CTLTYPE_INT
| CTLFLAG_RW
| CTLFLAG_LOCKED
,
1022 misc_nmis
, "I", "Report/increment NMI count");
1024 /* Parameters related to timer coalescing tuning, to be replaced
1025 * with a dedicated systemcall in the future.
1027 /* Enable processing pending timers in the context of any other interrupt */
1028 SYSCTL_INT(_kern
, OID_AUTO
, interrupt_timer_coalescing_enabled
,
1029 CTLFLAG_KERN
| CTLFLAG_RW
| CTLFLAG_LOCKED
,
1030 &interrupt_timer_coalescing_enabled
, 0, "");
1031 /* Upon entering idle, process pending timers with HW deadlines
1032 * this far in the future.
1034 SYSCTL_INT(_kern
, OID_AUTO
, timer_coalesce_idle_entry_hard_deadline_max
,
1035 CTLFLAG_KERN
| CTLFLAG_RW
| CTLFLAG_LOCKED
,
1036 &idle_entry_timer_processing_hdeadline_threshold
, 0, "");
1038 /* Track potentially expensive eager timer evaluations on QoS tier
1041 extern uint32_t ml_timer_eager_evaluations
;
1043 SYSCTL_INT(_machdep
, OID_AUTO
, eager_timer_evaluations
,
1044 CTLFLAG_KERN
| CTLFLAG_RW
| CTLFLAG_LOCKED
,
1045 &ml_timer_eager_evaluations
, 0, "");
1047 extern uint64_t ml_timer_eager_evaluation_max
;
1049 SYSCTL_QUAD(_machdep
, OID_AUTO
, eager_timer_evaluation_max
,
1050 CTLFLAG_KERN
| CTLFLAG_RW
| CTLFLAG_LOCKED
,
1051 &ml_timer_eager_evaluation_max
, "");
1052 extern uint64_t x86_isr_fp_simd_use
;
1053 SYSCTL_QUAD(_machdep
, OID_AUTO
, x86_fp_simd_isr_uses
,
1054 CTLFLAG_KERN
| CTLFLAG_RW
| CTLFLAG_LOCKED
,
1055 &x86_isr_fp_simd_use
, "");
1056 #if DEVELOPMENT || DEBUG
1058 extern int plctrace_enabled
;
1060 SYSCTL_INT(_machdep
, OID_AUTO
, pltrace
,
1061 CTLFLAG_KERN
| CTLFLAG_RW
| CTLFLAG_LOCKED
,
1062 &plctrace_enabled
, 0, "");
1064 /* Intentionally not declared as volatile here: */
1065 extern int mmiotrace_enabled
;
1067 SYSCTL_INT(_machdep
, OID_AUTO
, MMIOtrace
,
1068 CTLFLAG_KERN
| CTLFLAG_RW
| CTLFLAG_LOCKED
,
1069 &mmiotrace_enabled
, 0, "");
1071 extern int fpsimd_fault_popc
;
1072 SYSCTL_INT(_machdep
, OID_AUTO
, fpsimd_fault_popc
,
1073 CTLFLAG_KERN
| CTLFLAG_RW
| CTLFLAG_LOCKED
,
1074 &fpsimd_fault_popc
, 0, "");
1076 volatile int stop_spinning
;
1078 spin_in_the_kernel(__unused
struct sysctl_oid
*oidp
, __unused
void *arg1
, __unused
int arg2
, struct sysctl_req
*req
)
1080 int new = 0, old
= 0, changed
= 0, error
;
1082 error
= sysctl_io_number(req
, old
, sizeof(int), &new, &changed
);
1083 if (error
== 0 && changed
) {
1084 stop_spinning
= FALSE
;
1085 while (stop_spinning
== FALSE
) {
1086 __builtin_ia32_pause();
1088 } else if (error
== 0) {
1089 stop_spinning
= TRUE
;
1095 SYSCTL_PROC(_machdep_misc
, OID_AUTO
, spin_forever
,
1096 CTLTYPE_INT
| CTLFLAG_RW
| CTLFLAG_LOCKED
| CTLFLAG_MASKED
,
1098 spin_in_the_kernel
, "I", "Spin forever");
1101 extern int traptrace_enabled
;
1102 SYSCTL_INT(_machdep_misc
, OID_AUTO
, traptrace_enabled
,
1103 CTLFLAG_KERN
| CTLFLAG_RW
| CTLFLAG_LOCKED
,
1104 &traptrace_enabled
, 0, "Enabled/disable trap trace");
1106 #endif /* DEVELOPMENT || DEBUG */