xref: /freebsd/usr.sbin/cpucontrol/cpucontrol.8 (revision a2aef24aa3c8458e4036735dd6928b4ef77294e5)
1.\" Copyright (c) 2006, 2008 Stanislav Sedov <stas@FreeBSD.org>.
2.\" All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\"    notice, this list of conditions and the following disclaimer.
9.\" 2. Redistributions in binary form must reproduce the above copyright
10.\"    notice, this list of conditions and the following disclaimer in the
11.\"    documentation and/or other materials provided with the distribution.
12.\"
13.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23.\" SUCH DAMAGE.
24.\"
25.\" $FreeBSD$
26.\"
27.Dd September 30, 2017
28.Dt CPUCONTROL 8
29.Os
30.Sh NAME
31.Nm cpucontrol
32.Nd control utility for the
33.Xr cpuctl 4
34device
35.Sh SYNOPSIS
36.Nm
37.Op Fl v
38.Fl m Ar msr
39.Bk
40.Ar device
41.Ek
42.Nm
43.Op Fl v
44.Fl m Ar msr Ns = Ns Ar value
45.Bk
46.Ar device
47.Ek
48.Nm
49.Op Fl v
50.Fl m Ar msr Ns &= Ns Ar mask
51.Bk
52.Ar device
53.Ek
54.Nm
55.Op Fl v
56.Fl m Ar msr Ns |= Ns Ar mask
57.Bk
58.Ar device
59.Ek
60.Nm
61.Op Fl v
62.Fl i Ar level
63.Bk
64.Ar device
65.Ek
66.Nm
67.Op Fl v
68.Fl i Ar level,level_type
69.Bk
70.Ar device
71.Ek
72.Nm
73.Op Fl vn
74.Op Fl d Ar datadir
75.Fl u
76.Bk
77.Ar device
78.Ek
79.Sh DESCRIPTION
80The
81.Nm
82utility can be used to read and write arbitrary machine-specific
83CPU registers via the
84.Xr cpuctl 4
85special device.
86It can also be used to apply CPU firmware updates.
87.Pp
88The following options are available:
89.Bl -tag -width indent
90.It Fl d Ar datadir
91Directory paths where to look for microcode images.
92The option can be specified multiple times.
93The paths are added in order of the options appearance on the command
94line, default directories are appended after the user-supplied paths.
95.It Fl n
96Do not look for the microcode images in the standard directories.
97Currently standard directory to look for the microcode update files is
98.Pa /usr/local/share/cpucontrol .
99.It Fl m Ar msr
100Show value of the specified MSR.
101MSR register number should be given as a hexadecimal number.
102The high word is printed first, then the low word is printed second.
103.It Fl m Ar msr Ns = Ns Ar value
104Store the
105.Ar value
106in the specified MSR register.
107The
108.Ar value
109argument can be prefixed with ~ operator.
110In this case the inverted value of argument will be stored in the register.
111.It Fl m Ar msr Ns &= Ns Ar mask
112Store the result of bitwise AND operation between
113.Ar mask
114and the current MSR value in the MSR register.
115The
116.Ar mask
117argument can be prefixed with ~ operator.
118In this case the inverted value of mask will be used.
119.It Fl m Ar msr Ns |= Ns Ar mask
120Store the result of bitwise OR operation between
121.Ar mask
122and the current MSR value in the MSR register.
123The
124.Ar mask
125argument can be prefixed with ~ operator.
126In this case the inverted value of mask will be used.
127.It Fl i Ar level
128Retrieve CPUID info.
129Level should be given as a hex number.
130.It Fl i Ar level,level_type
131Retrieve CPUID info.
132Level and level_type should be given as hex numbers.
133.It Fl u
134Apply CPU firmware updates.
135The
136.Nm
137utility will walk through the configured data directories
138and apply all firmware updates available for this CPU.
139.It Fl v
140Increase the verbosity level.
141.It Fl h
142Show help message.
143.El
144.Sh EXIT STATUS
145.Ex -std
146.Sh EXAMPLES
147The command
148.Pp
149.Dq Li "cpucontrol -m 0x10 /dev/cpuctl0"
150.Pp
151will read the contents of TSC MSR from CPU 0.
152.Pp
153To set the CPU 0 TSC MSR register value to 0x1 issue
154.Pp
155.Dq Li "cpucontrol -m 0x10=0x1 /dev/cpuctl0" .
156.Pp
157The following command will clear the second bit of TSC register:
158.Pp
159.Dq Li "cpucontrol -m 0x10&=~0x02 /dev/cpuctl0" .
160.Pp
161The following command will set the forth and second bit of TSC register:
162.Pp
163.Dq Li "cpucontrol -m 0x10|=0x0a /dev/cpuctl0" .
164.Pp
165The command
166.Pp
167.Dq Li "cpucontrol -i 0x1 /dev/cpuctl1"
168.Pp
169will retrieve the CPUID level 0x1 from CPU 1.
170.Pp
171To perform firmware updates on CPU 0 from images located at
172.Pa /usr/local/share/cpuctl
173use the following command:
174.Pp
175.Dq Li "cpucontrol -nd /usr/local/share/cpuctl -u /dev/cpuctl0"
176.Sh SEE ALSO
177.Xr cpuctl 4
178.Sh HISTORY
179The
180.Nm
181utility first appeared in
182.Fx 7.2 .
183.Sh AUTHORS
184The
185.Nm
186utility and this manual page was written by
187.An Stanislav Sedov Aq Mt stas@FreeBSD.org .
188