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 /* arg == xen_extraversion_t. */
23 #define XENVER_extraversion 1
24 typedef char xen_extraversion_t[16];
25 #define XEN_EXTRAVERSION_LEN (sizeof(xen_extraversion_t))
26 
27 /* arg == xen_compile_info_t. */
28 #define XENVER_compile_info 2
29 struct xen_compile_info {
30     char compiler[64];
31     char compile_by[16];
32     char compile_domain[32];
33     char compile_date[32];
34 };
35 typedef struct xen_compile_info xen_compile_info_t;
36 
37 #define XENVER_capabilities 3
38 typedef char xen_capabilities_info_t[1024];
39 #define XEN_CAPABILITIES_INFO_LEN (sizeof(xen_capabilities_info_t))
40 
41 #define XENVER_changeset 4
42 typedef char xen_changeset_info_t[64];
43 #define XEN_CHANGESET_INFO_LEN (sizeof(xen_changeset_info_t))
44 
45 /*
46  * This API is problematic.
47  *
48  * It is only applicable to guests which share pagetables with Xen (x86 PV
49  * guests), but unfortunately has leaked into other guest types and
50  * architectures with an expectation of never failing.
51  *
52  * It is intended to identify the virtual address split between guest kernel
53  * and Xen.
54  *
55  * For 32bit PV guests, there is a split, and it is variable (between two
56  * fixed bounds), and this boundary is reported to guests.  The detail missing
57  * from the hypercall is that the second boundary is the 32bit architectural
58  * boundary at 4G.
59  *
60  * For 64bit PV guests, Xen lives at the bottom of the upper canonical range.
61  * This hypercall happens to report the architectural boundary, not the one
62  * which would be necessary to make a variable split work.  As such, this
63  * hypercall entirely useless for 64bit PV guests, and all inspected
64  * implementations at the time of writing were found to have compile time
65  * expectations about the split.
66  *
67  * For architectures where this hypercall is implemented, for backwards
68  * compatibility with the expectation of the hypercall never failing Xen will
69  * return 0 instead of failing with -ENOSYS in cases where the guest should
70  * not be making the hypercall.
71  */
72 #define XENVER_platform_parameters 5
73 struct xen_platform_parameters {
74     xen_ulong_t virt_start;
75 };
76 typedef struct xen_platform_parameters xen_platform_parameters_t;
77 
78 #define XENVER_get_features 6
79 struct xen_feature_info {
80     uint32_t     submap_idx;    /* IN: which 32-bit submap to return */
81     uint32_t     submap;        /* OUT: 32-bit submap */
82 };
83 typedef struct xen_feature_info xen_feature_info_t;
84 
85 /* Declares the features reported by XENVER_get_features. */
86 #include "features.h"
87 
88 /* arg == NULL; returns host memory page size. */
89 #define XENVER_pagesize 7
90 
91 /* arg == xen_domain_handle_t.
92  *
93  * The toolstack fills it out for guest consumption. It is intended to hold
94  * the UUID of the guest.
95  */
96 #define XENVER_guest_handle 8
97 
98 #define XENVER_commandline 9
99 typedef char xen_commandline_t[1024];
100 
101 /*
102  * Return value is the number of bytes written, or XEN_Exx on error.
103  * Calling with empty parameter returns the size of build_id.
104  */
105 #define XENVER_build_id 10
106 struct xen_build_id {
107         uint32_t        len; /* IN: size of buf[]. */
108         unsigned char   buf[XEN_FLEX_ARRAY_DIM];
109                              /* OUT: Variable length buffer with build_id. */
110 };
111 typedef struct xen_build_id xen_build_id_t;
112 
113 #endif /* __XEN_PUBLIC_VERSION_H__ */
114 
115 /*
116  * Local variables:
117  * mode: C
118  * c-file-style: "BSD"
119  * c-basic-offset: 4
120  * tab-width: 4
121  * indent-tabs-mode: nil
122  * End:
123  */
124