1 /* SPDX-License-Identifier: MIT */
2 /******************************************************************************
3  * version.h
4  *
5  * Xen version, type, and compile information.
6  *
7  * Copyright (c) 2005, Nguyen Anh Quynh <aquynh@gmail.com>
8  * Copyright (c) 2005, Keir Fraser <keir@xensource.com>
9  */
10 
11 #ifndef __XEN_PUBLIC_VERSION_H__
12 #define __XEN_PUBLIC_VERSION_H__
13 
14 #include "xen.h"
15 
16 /* NB. All ops return zero on success, except XENVER_{version,pagesize}
17  * XENVER_{version,pagesize,build_id} */
18 
19 /* arg == NULL; returns major:minor (16:16). */
20 #define XENVER_version      0
21 
22 /*
23  * arg == xen_extraversion_t.
24  *
25  * This API/ABI is broken.  Use XENVER_extraversion2 where possible.
26  */
27 #define XENVER_extraversion 1
28 typedef char xen_extraversion_t[16];
29 #define XEN_EXTRAVERSION_LEN (sizeof(xen_extraversion_t))
30 
31 /*
32  * arg == xen_compile_info_t.
33  *
34  * This API/ABI is broken and truncates data.
35  */
36 #define XENVER_compile_info 2
37 struct xen_compile_info {
38     char compiler[64];
39     char compile_by[16];
40     char compile_domain[32];
41     char compile_date[32];
42 };
43 typedef struct xen_compile_info xen_compile_info_t;
44 
45 /*
46  * arg == xen_capabilities_info_t.
47  *
48  * This API/ABI is broken.  Use XENVER_capabilities2 where possible.
49  */
50 #define XENVER_capabilities 3
51 typedef char xen_capabilities_info_t[1024];
52 #define XEN_CAPABILITIES_INFO_LEN (sizeof(xen_capabilities_info_t))
53 
54 /*
55  * arg == xen_changeset_info_t.
56  *
57  * This API/ABI is broken.  Use XENVER_changeset2 where possible.
58  */
59 #define XENVER_changeset 4
60 typedef char xen_changeset_info_t[64];
61 #define XEN_CHANGESET_INFO_LEN (sizeof(xen_changeset_info_t))
62 
63 /*
64  * This API is problematic.
65  *
66  * It is only applicable to guests which share pagetables with Xen (x86 PV
67  * guests), but unfortunately has leaked into other guest types and
68  * architectures with an expectation of never failing.
69  *
70  * It is intended to identify the virtual address split between guest kernel
71  * and Xen.
72  *
73  * For 32bit PV guests, there is a split, and it is variable (between two
74  * fixed bounds), and this boundary is reported to guests.  The detail missing
75  * from the hypercall is that the second boundary is the 32bit architectural
76  * boundary at 4G.
77  *
78  * For 64bit PV guests, Xen lives at the bottom of the upper canonical range.
79  * This hypercall happens to report the architectural boundary, not the one
80  * which would be necessary to make a variable split work.  As such, this
81  * hypercall entirely useless for 64bit PV guests, and all inspected
82  * implementations at the time of writing were found to have compile time
83  * expectations about the split.
84  *
85  * For architectures where this hypercall is implemented, for backwards
86  * compatibility with the expectation of the hypercall never failing Xen will
87  * return 0 instead of failing with -ENOSYS in cases where the guest should
88  * not be making the hypercall.
89  */
90 #define XENVER_platform_parameters 5
91 struct xen_platform_parameters {
92     xen_ulong_t virt_start;
93 };
94 typedef struct xen_platform_parameters xen_platform_parameters_t;
95 
96 #define XENVER_get_features 6
97 struct xen_feature_info {
98     uint32_t     submap_idx;    /* IN: which 32-bit submap to return */
99     uint32_t     submap;        /* OUT: 32-bit submap */
100 };
101 typedef struct xen_feature_info xen_feature_info_t;
102 
103 /* Declares the features reported by XENVER_get_features. */
104 #include "features.h"
105 
106 /* arg == NULL; returns host memory page size. */
107 #define XENVER_pagesize 7
108 
109 /* arg == xen_domain_handle_t.
110  *
111  * The toolstack fills it out for guest consumption. It is intended to hold
112  * the UUID of the guest.
113  */
114 #define XENVER_guest_handle 8
115 
116 /*
117  * arg == xen_commandline_t.
118  *
119  * This API/ABI is broken.  Use XENVER_commandline2 where possible.
120  */
121 #define XENVER_commandline 9
122 typedef char xen_commandline_t[1024];
123 
124 /*
125  * Return value is the number of bytes written, or XEN_Exx on error.
126  * Calling with empty parameter returns the size of build_id.
127  *
128  * Note: structure only kept for backwards compatibility.  Xen operates in
129  * terms of xen_varbuf_t.
130  */
131 struct xen_build_id {
132         uint32_t        len; /* IN: size of buf[]. */
133         unsigned char   buf[XEN_FLEX_ARRAY_DIM];
134                              /* OUT: Variable length buffer with build_id. */
135 };
136 typedef struct xen_build_id xen_build_id_t;
137 
138 /*
139  * Container for an arbitrary variable length buffer.
140  */
141 struct xen_varbuf {
142     uint32_t len;                          /* IN:  size of buf[] in bytes. */
143     unsigned char buf[XEN_FLEX_ARRAY_DIM]; /* OUT: requested data.         */
144 };
145 typedef struct xen_varbuf xen_varbuf_t;
146 
147 /*
148  * arg == xen_varbuf_t
149  *
150  * Equivalent to the original ops, but with a non-truncating API/ABI.
151  *
152  * These hypercalls can fail for a number of reasons.  All callers must handle
153  * -XEN_xxx return values appropriately.
154  *
155  * Passing arg == NULL is a request for size, which will be signalled with a
156  * non-negative return value.  Note: a return size of 0 may be legitimate for
157  * the requested subop.
158  *
159  * Otherwise, the input xen_varbuf_t provides the size of the following
160  * buffer.  Xen will fill the buffer, and return the number of bytes written
161  * (e.g. if the input buffer was longer than necessary).
162  *
163  * Some subops may return binary data.  Some subops may be expected to return
164  * textural data.  These are returned without a NUL terminator, and while the
165  * contents is expected to be ASCII/UTF-8, Xen makes no guarentees to this
166  * effect.  e.g. Xen has no control over the formatting used for the command
167  * line.
168  */
169 #define XENVER_build_id      10
170 #define XENVER_extraversion2 11
171 #define XENVER_capabilities2 12
172 #define XENVER_changeset2    13
173 #define XENVER_commandline2  14
174 
175 #endif /* __XEN_PUBLIC_VERSION_H__ */
176 
177 /*
178  * Local variables:
179  * mode: C
180  * c-file-style: "BSD"
181  * c-basic-offset: 4
182  * tab-width: 4
183  * indent-tabs-mode: nil
184  * End:
185  */
186