namespaces.7: ffix
[man-pages.git] / man2 / s390_sthyi.2
blob58e3230a92fa6b6560f8fec9e1571a61ad1fae9a
1 .\" Copyright IBM Corp. 2017
2 .\" Author: QingFeng Hao <haoqf@linux.vnet.ibm.com>
3 .\"
4 .\" %%%LICENSE_START(GPLv2+_DOC_FULL)
5 .\" This is free documentation; you can redistribute it and/or
6 .\" modify it under the terms of the GNU General Public License as
7 .\" published by the Free Software Foundation; either version 2 of
8 .\" the License, or (at your option) any later version.
9 .\"
10 .\" The GNU General Public License's references to "object code"
11 .\" and "executables" are to be interpreted as the output of any
12 .\" document formatting or typesetting system, including
13 .\" intermediate and printed output.
14 .\"
15 .\" This manual is distributed in the hope that it will be useful,
16 .\" but WITHOUT ANY WARRANTY; without even the implied warranty of
17 .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 .\" GNU General Public License for more details.
19 .\"
20 .\" You should have received a copy of the GNU General Public
21 .\" License along with this manual; if not, see
22 .\" <http://www.gnu.org/licenses/>.
23 .\" %%%LICENSE_END
24 .\"
25 .TH S390_STHYI 2 2021-03-22 "Linux Programmer's Manual"
26 .SH NAME
27 s390_sthyi \- emulate STHYI instruction
28 .SH SYNOPSIS
29 .nf
30 .BR "#include <asm/sthyi.h>" "        /* Definition of " STHYI_* " constants */"
31 .BR "#include <sys/syscall.h>" "      /* Definition of " SYS_* " constants */"
32 .B #include <unistd.h>
33 .PP
34 .BI "int syscall(SYS_s390_sthyi, unsigned long " function_code ,
35 .BI "            void *" resp_buffer ", uint64_t *" return_code ,
36 .BI "            unsigned long " flags );
37 .fi
38 .PP
39 .IR Note :
40 glibc provides no wrapper for
41 .BR s390_sthyi (),
42 necessitating the use of
43 .BR syscall (2).
44 .SH DESCRIPTION
45 The
46 .BR s390_sthyi ()
47 system call emulates the STHYI (Store Hypervisor Information) instruction.
48 It provides hardware resource information for the machine and its
49 virtualization levels.
50 This includes CPU type and capacity, as well as the machine model and
51 other metrics.
52 .PP
53 The
54 .I function_code
55 argument indicates which function to perform.
56 The following code(s) are supported:
57 .TP
58 .B STHYI_FC_CP_IFL_CAP
59 Return CP (Central Processor) and IFL (Integrated Facility for Linux)
60 capacity information.
61 .PP
62 The
63 .I resp_buffer
64 argument specifies the address of a response buffer.
65 When the
66 .I function_code
68 .BR STHYI_FC_CP_IFL_CAP ,
69 the buffer must be one page (4K) in size.
70 If the system call returns 0,
71 the response buffer will be filled with CPU capacity information.
72 Otherwise, the response buffer's content is unchanged.
73 .PP
74 The
75 .I return_code
76 argument stores the return code of the STHYI instruction,
77 using one of the following values:
78 .TP
80 Success.
81 .TP
83 Unsupported function code.
84 .PP
85 For further details about
86 .IR return_code ,
87 .IR function_code ,
88 and
89 .IR resp_buffer ,
90 see the reference given in NOTES.
91 .PP
92 The
93 .I flags
94 argument is provided to allow for future extensions and currently
95 must be set to 0.
96 .SH RETURN VALUE
97 On success (that is: emulation succeeded), the return value of
98 .BR s390_sthyi ()
99 matches the condition code of the STHYI instructions, which is a value
100 in the range [0..3].
101 A return value of 0 indicates that CPU capacity information is stored in
102 .IR *resp_buffer .
103 A return value of 3 indicates "unsupported function code" and the content of
104 .IR *resp_buffer
105 is unchanged.
106 The return values 1 and 2 are reserved.
108 On error, \-1 is returned, and
109 .IR errno
110 is set to indicate the error.
111 .SH ERRORS
113 .B EFAULT
114 The value specified in
115 .I resp_buffer
117 .I return_code
118 is not a valid address.
120 .B EINVAL
121 The value specified in
122 .I flags
123 is nonzero.
125 .B ENOMEM
126 Allocating memory for handling the CPU capacity information failed.
128 .B EOPNOTSUPP
129 The value specified in
130 .I function_code
131 is not valid.
132 .SH VERSIONS
133 This system call is available since Linux 4.15.
134 .SH CONFORMING TO
135 This Linux-specific system call is available only on the s390 architecture.
136 .SH NOTES
137 For details of the STHYI instruction, see
138 .UR https://www.ibm.com\:/support\:/knowledgecenter\:/SSB27U_6.3.0\:/com.ibm.zvm.v630.hcpb4\:/hcpb4sth.htm
139 the documentation page
140 .UE .
142 When the system call interface is used, the response buffer doesn't
143 have to fulfill alignment requirements described in the STHYI
144 instruction definition.
146 The kernel caches the response (for up to one second, as of Linux 4.16).
147 Subsequent system call invocations may return the cached response.
148 .SH SEE ALSO
149 .BR syscall (2)