1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
|
/******************************************************************************
* dom0_ops.h
*
* Process command requests from domain-0 guest OS.
*
* Copyright (c) 2002-2003, K A Fraser, B Dragovic
*/
#ifndef __DOM0_OPS_H__
#define __DOM0_OPS_H__
#include "hypervisor-if.h"
#include "sched_ctl.h"
/*
* Make sure you increment the interface version whenever you modify this file!
* This makes sure that old versions of dom0 tools will stop working in a
* well-defined way (rather than crashing the machine, for instance).
*/
#define DOM0_INTERFACE_VERSION 0xAAAA0009
#define MAX_CMD_LEN 256
#define MAX_DOMAIN_NAME 16
#define DOM0_CREATEDOMAIN 8
typedef struct dom0_createdomain_st
{
/* IN parameters. */
unsigned int memory_kb;
char name[MAX_DOMAIN_NAME];
/* OUT parameters. */
domid_t domain;
} dom0_createdomain_t;
#define DOM0_STARTDOMAIN 10
typedef struct dom0_startdomain_st
{
/* IN parameters. */
domid_t domain;
} dom0_startdomain_t;
#define DOM0_STOPDOMAIN 11
typedef struct dom0_stopdomain_st
{
/* IN parameters. */
domid_t domain;
} dom0_stopdomain_t;
#define DOM0_DESTROYDOMAIN 9
typedef struct dom0_destroydomain_st
{
/* IN variables. */
domid_t domain;
int force;
} dom0_destroydomain_t;
#define DOM0_GETMEMLIST 2
typedef struct dom0_getmemlist_st
{
/* IN variables. */
domid_t domain;
unsigned long max_pfns;
void *buffer;
/* OUT variables. */
unsigned long num_pfns;
} dom0_getmemlist_t;
#define DOM0_BUILDDOMAIN 13
typedef struct dom0_builddomain_st
{
/* IN variables. */
domid_t domain;
unsigned int num_vifs;
full_execution_context_t ctxt;
} dom0_builddomain_t;
#define DOM0_SCHEDCTL 6
/* struct sched_ctl_cmd is from sched-ctl.h */
typedef struct sched_ctl_cmd dom0_schedctl_t;
#define DOM0_ADJUSTDOM 7
/* struct sched_adjdom_cmd is from sched-ctl.h */
typedef struct sched_adjdom_cmd dom0_adjustdom_t;
#define DOM0_GETDOMAININFO 12
typedef struct dom0_getdomaininfo_st
{
/* IN variables. */
domid_t domain;
/* OUT variables. */
char name[MAX_DOMAIN_NAME];
int processor;
int has_cpu;
#define DOMSTATE_ACTIVE 0
#define DOMSTATE_STOPPED 1
int state;
int hyp_events;
unsigned long mcu_advance;
unsigned int tot_pages;
long long cpu_time;
unsigned long shared_info_frame; /* MFN of shared_info struct */
full_execution_context_t ctxt;
} dom0_getdomaininfo_t;
#define DOM0_GETPAGEFRAMEINFO 18
typedef struct dom0_getpageframeinfo_st
{
/* IN variables. */
unsigned long pfn; /* Machine page frame number to query. */
domid_t domain; /* To which domain does the frame belong? */
/* OUT variables. */
/* Is the page PINNED to a type? */
enum { NONE, L1TAB, L2TAB, L3TAB, L4TAB } type;
} dom0_getpageframeinfo_t;
#define DOM0_IOPL 14
typedef struct dom0_iopl_st
{
domid_t domain;
unsigned int iopl;
} dom0_iopl_t;
#define DOM0_MSR 15
typedef struct dom0_msr_st
{
/* IN variables. */
int write, cpu_mask, msr;
unsigned int in1, in2;
/* OUT variables. */
unsigned int out1, out2;
} dom0_msr_t;
#define DOM0_DEBUG 16
typedef struct dom0_debug_st
{
/* IN variables. */
char opcode;
domid_t domain;
int in1, in2, in3, in4;
/* OUT variables. */
unsigned int status;
int out1, out2;
} dom0_debug_t;
/*
* Set clock such that it would read <secs,usecs> after 00:00:00 UTC,
* 1 January, 1970 if the current system time was <system_time>.
*/
#define DOM0_SETTIME 17
typedef struct dom0_settime_st
{
/* IN variables. */
unsigned long secs, usecs;
u64 system_time;
} dom0_settime_t;
/*
* Read console content from Xen buffer ring.
*/
#define DOM0_READCONSOLE 19
typedef struct dom0_readconsole_st
{
unsigned long str;
unsigned int count;
unsigned int cmd;
} dom0_readconsole_t;
/*
* Pin Domain to a particular CPU (use -1 to unpin)
*/
#define DOM0_PINCPUDOMAIN 20
typedef struct dom0_pincpudomain_st
{
/* IN variables. */
domid_t domain;
int cpu; /* -1 implies unpin */
} dom0_pincpudomain_t;
/* Get trace buffers physical base pointer */
#define DOM0_GETTBUFS 21
typedef struct dom0_gettbufs_st
{
/* OUT variables */
unsigned long phys_addr; /* location of the trace buffers */
unsigned long size; /* size of each trace buffer, in bytes */
} dom0_gettbufs_t;
/*
* Get physical information about the host machine
*/
#define DOM0_PHYSINFO 22
typedef struct dom0_physinfo_st
{
int ht_per_core;
int cores;
unsigned long cpu_khz;
unsigned long total_pages;
unsigned long free_pages;
} dom0_physinfo_t;
/*
* Allow a domain access to a physical PCI device
*/
#define DOM0_PCIDEV_ACCESS 23
typedef struct dom0_pcidev_access_st
{
/* IN variables. */
domid_t domain;
int bus;
int dev;
int func;
int enable;
} dom0_pcidev_access_t;
/*
* Control shadow pagetables operation
*/
#define DOM0_SHADOW_CONTROL 24
#define DOM0_SHADOW_CONTROL_OP_OFF 0
#define DOM0_SHADOW_CONTROL_OP_ENABLE_TEST 1
#define DOM0_SHADOW_CONTROL_OP_FLUSH 10
typedef struct dom0_shadow_control_st
{
/* IN variables. */
domid_t domain;
int op;
} dom0_shadow_control_t;
typedef struct dom0_op_st
{
unsigned long cmd;
unsigned long interface_version; /* DOM0_INTERFACE_VERSION */
union
{
dom0_createdomain_t createdomain;
dom0_startdomain_t startdomain;
dom0_stopdomain_t stopdomain;
dom0_destroydomain_t destroydomain;
dom0_getmemlist_t getmemlist;
dom0_schedctl_t schedctl;
dom0_adjustdom_t adjustdom;
dom0_builddomain_t builddomain;
dom0_getdomaininfo_t getdomaininfo;
dom0_getpageframeinfo_t getpageframeinfo;
dom0_iopl_t iopl;
dom0_msr_t msr;
dom0_debug_t debug;
dom0_settime_t settime;
dom0_readconsole_t readconsole;
dom0_pincpudomain_t pincpudomain;
dom0_gettbufs_t gettbufs;
dom0_physinfo_t physinfo;
dom0_pcidev_access_t pcidev_access;
dom0_shadow_control_t shadow_control;
} u;
} dom0_op_t;
#endif /* __DOM0_OPS_H__ */
|