nrelease - fix/improve livecd
[dragonfly.git] / usr.sbin / cpucontrol / cpucontrol.8
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 January 5, 2018
28 .Dt CPUCONTROL 8
29 .Os
30 .Sh NAME
31 .Nm cpucontrol
32 .Nd control utility for the
33 .Xr cpuctl 4
34 device
35 .Sh SYNOPSIS
36 .Bk
37 .Nm
38 .Op Fl v
39 .Fl m Ar msr
40 .Ar device
41 .Ek
42 .Bk
43 .Nm
44 .Op Fl v
45 .Fl m Ar msr Ns = Ns Ar value
46 .Ar device
47 .Ek
48 .Bk
49 .Nm
50 .Op Fl v
51 .Fl m Ar msr Ns &= Ns Ar mask
52 .Ar device
53 .Ek
54 .Bk
55 .Nm
56 .Op Fl v
57 .Fl m Ar msr Ns |= Ns Ar mask
58 .Ar device
59 .Ek
60 .Bk
61 .Nm
62 .Op Fl v
63 .Fl i Ar level
64 .Ar device
65 .Ek
66 .Bk
67 .Nm
68 .Op Fl v
69 .Fl i Ar level,level_type
70 .Ar device
71 .Ek
72 .Bk
73 .Nm
74 .Op Fl vn
75 .Op Fl d Ar datadir
76 .Fl u
77 .Ar device
78 .Ek
79 .Bk
80 .Nm
81 .Fl e
82 .Ar device
83 .Ek
84 .Sh DESCRIPTION
85 The
86 .Nm
87 utility can be used to read and write arbitrary machine-specific
88 CPU registers via the
89 .Xr cpuctl 4
90 special device.
91 It can also be used to apply CPU firmware updates.
92 .Pp
93 The following options are available:
94 .Bl -tag -width indent
95 .It Fl d Ar datadir
96 Directory paths where to look for microcode images.
97 The option can be specified multiple times.
98 The paths are added in order of the options appearance on the command
99 line, default directories are appended after the user-supplied paths.
100 .It Fl n
101 Do not look for the microcode images in the standard directories.
102 Currently standard directory to look for the microcode update files is
103 .Pa /usr/local/share/cpucontrol .
104 .It Fl m Ar msr
105 Show value of the specified MSR.
106 MSR register number should be given as a hexadecimal number.
107 The high word is printed first, then the low word is printed second.
108 .It Fl m Ar msr Ns = Ns Ar value
109 Store the
110 .Ar value
111 in the specified MSR register.
112 The
113 .Ar value
114 argument can be prefixed with ~ operator.
115 In this case the inverted value of argument will be stored in the register.
116 .It Fl m Ar msr Ns &= Ns Ar mask
117 Store the result of bitwise AND operation between
118 .Ar mask
119 and the current MSR value in the MSR register.
120 The
121 .Ar mask
122 argument can be prefixed with ~ operator.
123 In this case the inverted value of mask will be used.
124 .It Fl m Ar msr Ns |= Ns Ar mask
125 Store the result of bitwise OR operation between
126 .Ar mask
127 and the current MSR value in the MSR register.
128 The
129 .Ar mask
130 argument can be prefixed with ~ operator.
131 In this case the inverted value of mask will be used.
132 .It Fl i Ar level
133 Retrieve CPUID info.
134 Level should be given as a hex number.
135 .It Fl i Ar level,level_type
136 Retrieve CPUID info.
137 Level and level_type should be given as hex numbers.
138 .It Fl u
139 Apply CPU firmware updates.
140 The
141 .Nm
142 utility will walk through the configured data directories
143 and apply all firmware updates available for this CPU.
144 .It Fl e
145 Re-evaluate the kernel flags indicating the present CPU features.
146 This command is typically executed after a firmware update was applied
147 which changes information reported by the
148 .Dv CPUID
149 instruction.
150 .Pp
151 .Bf -symbolic
152 Only execute the
153 .Fl e
154 command after the microcode update was applied to all CPUs in the system.
155 The kernel does not operate correctly if the features of processors are
156 not identical.
157 .Ef
158 .It Fl v
159 Increase the verbosity level.
160 .It Fl h
161 Show help message.
162 .El
163 .Sh EXIT STATUS
164 .Ex -std
165 .Sh EXAMPLES
166 The command
167 .Pp
168 .Dq Li "cpucontrol -m 0x10 /dev/cpuctl0"
169 .Pp
170 will read the contents of TSC MSR from CPU 0.
171 .Pp
172 To set the CPU 0 TSC MSR register value to 0x1 issue
173 .Pp
174 .Dq Li "cpucontrol -m 0x10=0x1 /dev/cpuctl0" .
175 .Pp
176 The following command will clear the second bit of TSC register:
177 .Pp
178 .Dq Li "cpucontrol -m 0x10&=~0x02 /dev/cpuctl0" .
179 .Pp
180 The following command will set the forth and second bit of TSC register:
181 .Pp
182 .Dq Li "cpucontrol -m 0x10|=0x0a /dev/cpuctl0" .
183 .Pp
184 The command
185 .Pp
186 .Dq Li "cpucontrol -i 0x1 /dev/cpuctl1"
187 .Pp
188 will retrieve the CPUID level 0x1 from CPU 1.
189 .Pp
190 To perform firmware updates on CPU 0 from images located at
191 .Pa /usr/local/share/cpuctl
192 use the following command:
193 .Pp
194 .Dq Li "cpucontrol -nd /usr/local/share/cpuctl -u /dev/cpuctl0"
195 .Sh SEE ALSO
196 .Xr cpuctl 4
197 .Sh HISTORY
198 The
199 .Nm
200 utility first appeared in
201 .Fx 7.2 .
202 .Sh AUTHORS
203 The
204 .Nm
205 utility and this manual page was written by
206 .An Stanislav Sedov Aq Mt stas@FreeBSD.org .