xref: /netbsd-src/share/man/man9/man9.x86/x86_msr_xcall.9 (revision 53476e53610d3d93009a823cbc21cc511ce170f6)
1.\" $NetBSD: x86_msr_xcall.9,v 1.5 2017/02/17 22:31:08 christos Exp $
2.\"
3.\" Copyright (c) 2010 The NetBSD Foundation, Inc.
4.\" All rights reserved.
5.\"
6.\" This code is derived from software contributed to The NetBSD Foundation
7.\" by Jukka Ruohonen.
8.\"
9.\" Redistribution and use in source and binary forms, with or without
10.\" modification, are permitted provided that the following conditions
11.\" are met:
12.\" 1. Redistributions of source code must retain the above copyright
13.\"    notice, this list of conditions and the following disclaimer.
14.\" 2. Redistributions in binary form must reproduce the above copyright
15.\"    notice, this list of conditions and the following disclaimer in the
16.\"    documentation and/or other materials provided with the distribution.
17.\"
18.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
19.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
20.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
22.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28.\" POSSIBILITY OF SUCH DAMAGE.
29.\"
30.Dd February 17, 2017
31.Dt X86_MSR_XCALL 9 x86
32.Os
33.Sh NAME
34.Nm x86_msr_xcall
35.Nd MSR specific cross-call
36.Sh SYNOPSIS
37.In x86/cpu_msr.h
38.Ft void
39.Fn x86_msr_xcall "void *arg1" "void *arg1"
40.Sh DESCRIPTION
41The
42.Fn x86_msr_xcall
43function provides a x86-specific IPI handler suitable for use with the
44.Xr xcall 9
45interface.
46It can be used to ensure that a given
47.Tn MSR
48call is executed on all processors.
49The prototype follows the
50.Ft xcfunc_t
51function pointer type and the opaque
52.Fa arg1
53pointer is casted to the following structure:
54.Bd -literal -offset indent
55struct msr_rw_info {
56	int		msr_read;
57	int		msr_type;
58	uint64_t	msr_value;
59	uint64_t	msr_mask;
60};
61.Ed
62.Pp
63This structure must be filled prior to the call.
64Two fields are compulsory:
65.Fa msr_type
66is used as the address of the
67.Tn MSR
68and
69.Fa msr_value
70is the value to be written.
71If
72.Fa msr_read
73is not zero,
74.Fn x86_msr_xcall
75will first read from
76.Fa msr_type
77and then clear the mask specified in
78.Fa msr_mask
79before the write operation.
80.Sh EXAMPLES
81The following example writes a value zero to the
82.Tn MSR_THERM_CONTROL
83model-specific register on all processors in the system:
84.Bd -literal -offset indent
85struct msr_rw_info msr;
86uint64_t xc;
87
88msr.msr_value = 0;
89msr.msr_read = true;
90msr.msr_type = MSR_THERM_CONTROL;
91msr.msr_mask = 0x1e;
92
93xc = xc_broadcast(0, (xcfunc_t)x86_msr_xcall, &msr, NULL);
94xc_wait(xc);
95.Ed
96.Sh SEE ALSO
97.Xr x86/rdmsr 9 ,
98.Xr xcall 9
99