Coverage Report

Created: 2017-10-25 09:10

/root/src/xen/xen/include/public/domctl.h
Line
Count
Source (jump to first uncovered line)
1
/******************************************************************************
2
 * domctl.h
3
 * 
4
 * Domain management operations. For use by node control stack.
5
 * 
6
 * Permission is hereby granted, free of charge, to any person obtaining a copy
7
 * of this software and associated documentation files (the "Software"), to
8
 * deal in the Software without restriction, including without limitation the
9
 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10
 * sell copies of the Software, and to permit persons to whom the Software is
11
 * furnished to do so, subject to the following conditions:
12
 *
13
 * The above copyright notice and this permission notice shall be included in
14
 * all copies or substantial portions of the Software.
15
 *
16
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22
 * DEALINGS IN THE SOFTWARE.
23
 *
24
 * Copyright (c) 2002-2003, B Dragovic
25
 * Copyright (c) 2002-2006, K Fraser
26
 */
27
28
#ifndef __XEN_PUBLIC_DOMCTL_H__
29
#define __XEN_PUBLIC_DOMCTL_H__
30
31
#if !defined(__XEN__) && !defined(__XEN_TOOLS__)
32
#error "domctl operations are intended for use by node control tools only"
33
#endif
34
35
#include "xen.h"
36
#include "event_channel.h"
37
#include "grant_table.h"
38
#include "hvm/save.h"
39
#include "memory.h"
40
41
3
#define XEN_DOMCTL_INTERFACE_VERSION 0x0000000e
42
43
/*
44
 * NB. xen_domctl.domain is an IN/OUT parameter for this operation.
45
 * If it is specified as zero, an id is auto-allocated and returned.
46
 */
47
/* XEN_DOMCTL_createdomain */
48
struct xen_domctl_createdomain {
49
    /* IN parameters */
50
    uint32_t ssidref;
51
    xen_domain_handle_t handle;
52
 /* Is this an HVM guest (as opposed to a PVH or PV guest)? */
53
0
#define _XEN_DOMCTL_CDF_hvm_guest     0
54
0
#define XEN_DOMCTL_CDF_hvm_guest      (1U<<_XEN_DOMCTL_CDF_hvm_guest)
55
 /* Use hardware-assisted paging if available? */
56
0
#define _XEN_DOMCTL_CDF_hap           1
57
0
#define XEN_DOMCTL_CDF_hap            (1U<<_XEN_DOMCTL_CDF_hap)
58
 /* Should domain memory integrity be verifed by tboot during Sx? */
59
0
#define _XEN_DOMCTL_CDF_s3_integrity  2
60
0
#define XEN_DOMCTL_CDF_s3_integrity   (1U<<_XEN_DOMCTL_CDF_s3_integrity)
61
 /* Disable out-of-sync shadow page tables? */
62
0
#define _XEN_DOMCTL_CDF_oos_off       3
63
0
#define XEN_DOMCTL_CDF_oos_off        (1U<<_XEN_DOMCTL_CDF_oos_off)
64
 /* Is this a xenstore domain? */
65
0
#define _XEN_DOMCTL_CDF_xs_domain     4
66
0
#define XEN_DOMCTL_CDF_xs_domain      (1U<<_XEN_DOMCTL_CDF_xs_domain)
67
    uint32_t flags;
68
    struct xen_arch_domainconfig config;
69
};
70
71
/* XEN_DOMCTL_getdomaininfo */
72
struct xen_domctl_getdomaininfo {
73
    /* OUT variables. */
74
    domid_t  domain;              /* Also echoed in domctl.domain */
75
 /* Domain is scheduled to die. */
76
0
#define _XEN_DOMINF_dying     0
77
0
#define XEN_DOMINF_dying      (1U<<_XEN_DOMINF_dying)
78
 /* Domain is an HVM guest (as opposed to a PV guest). */
79
4
#define _XEN_DOMINF_hvm_guest 1
80
4
#define XEN_DOMINF_hvm_guest  (1U<<_XEN_DOMINF_hvm_guest)
81
 /* The guest OS has shut down. */
82
0
#define _XEN_DOMINF_shutdown  2
83
0
#define XEN_DOMINF_shutdown   (1U<<_XEN_DOMINF_shutdown)
84
 /* Currently paused by control software. */
85
0
#define _XEN_DOMINF_paused    3
86
0
#define XEN_DOMINF_paused     (1U<<_XEN_DOMINF_paused)
87
 /* Currently blocked pending an event.     */
88
8
#define _XEN_DOMINF_blocked   4
89
8
#define XEN_DOMINF_blocked    (1U<<_XEN_DOMINF_blocked)
90
 /* Domain is currently running.            */
91
4
#define _XEN_DOMINF_running   5
92
4
#define XEN_DOMINF_running    (1U<<_XEN_DOMINF_running)
93
 /* Being debugged.  */
94
0
#define _XEN_DOMINF_debugged  6
95
0
#define XEN_DOMINF_debugged   (1U<<_XEN_DOMINF_debugged)
96
/* domain is a xenstore domain */
97
0
#define _XEN_DOMINF_xs_domain 7
98
0
#define XEN_DOMINF_xs_domain  (1U<<_XEN_DOMINF_xs_domain)
99
/* domain has hardware assisted paging */
100
4
#define _XEN_DOMINF_hap       8
101
4
#define XEN_DOMINF_hap        (1U<<_XEN_DOMINF_hap)
102
 /* XEN_DOMINF_shutdown guest-supplied code.  */
103
#define XEN_DOMINF_shutdownmask 255
104
4
#define XEN_DOMINF_shutdownshift 16
105
    uint32_t flags;              /* XEN_DOMINF_* */
106
    uint64_aligned_t tot_pages;
107
    uint64_aligned_t max_pages;
108
    uint64_aligned_t outstanding_pages;
109
    uint64_aligned_t shr_pages;
110
    uint64_aligned_t paged_pages;
111
    uint64_aligned_t shared_info_frame; /* GMFN of shared_info struct */
112
    uint64_aligned_t cpu_time;
113
    uint32_t nr_online_vcpus;    /* Number of VCPUs currently online. */
114
4
#define XEN_INVALID_MAX_VCPU_ID (~0U) /* Domain has no vcpus? */
115
    uint32_t max_vcpu_id;        /* Maximum VCPUID in use by this domain. */
116
    uint32_t ssidref;
117
    xen_domain_handle_t handle;
118
    uint32_t cpupool;
119
};
120
typedef struct xen_domctl_getdomaininfo xen_domctl_getdomaininfo_t;
121
DEFINE_XEN_GUEST_HANDLE(xen_domctl_getdomaininfo_t);
122
123
124
/* XEN_DOMCTL_getmemlist */
125
struct xen_domctl_getmemlist {
126
    /* IN variables. */
127
    /* Max entries to write to output buffer. */
128
    uint64_aligned_t max_pfns;
129
    /* Start index in guest's page list. */
130
    uint64_aligned_t start_pfn;
131
    XEN_GUEST_HANDLE_64(uint64) buffer;
132
    /* OUT variables. */
133
    uint64_aligned_t num_pfns;
134
};
135
136
137
/* XEN_DOMCTL_getpageframeinfo */
138
139
#define XEN_DOMCTL_PFINFO_LTAB_SHIFT 28
140
#define XEN_DOMCTL_PFINFO_NOTAB   (0x0U<<28)
141
0
#define XEN_DOMCTL_PFINFO_L1TAB   (0x1U<<28)
142
0
#define XEN_DOMCTL_PFINFO_L2TAB   (0x2U<<28)
143
0
#define XEN_DOMCTL_PFINFO_L3TAB   (0x3U<<28)
144
0
#define XEN_DOMCTL_PFINFO_L4TAB   (0x4U<<28)
145
#define XEN_DOMCTL_PFINFO_LTABTYPE_MASK (0x7U<<28)
146
0
#define XEN_DOMCTL_PFINFO_LPINTAB (0x1U<<31)
147
0
#define XEN_DOMCTL_PFINFO_XTAB    (0xfU<<28) /* invalid page */
148
#define XEN_DOMCTL_PFINFO_XALLOC  (0xeU<<28) /* allocate-only page */
149
0
#define XEN_DOMCTL_PFINFO_BROKEN  (0xdU<<28) /* broken page */
150
#define XEN_DOMCTL_PFINFO_LTAB_MASK (0xfU<<28)
151
152
/* XEN_DOMCTL_getpageframeinfo3 */
153
struct xen_domctl_getpageframeinfo3 {
154
    /* IN variables. */
155
    uint64_aligned_t num;
156
    /* IN/OUT variables. */
157
    XEN_GUEST_HANDLE_64(xen_pfn_t) array;
158
};
159
160
161
/*
162
 * Control shadow pagetables operation
163
 */
164
/* XEN_DOMCTL_shadow_op */
165
166
/* Disable shadow mode. */
167
0
#define XEN_DOMCTL_SHADOW_OP_OFF         0
168
169
/* Enable shadow mode (mode contains ORed XEN_DOMCTL_SHADOW_ENABLE_* flags). */
170
0
#define XEN_DOMCTL_SHADOW_OP_ENABLE      32
171
172
/* Log-dirty bitmap operations. */
173
 /* Return the bitmap and clean internal copy for next round. */
174
0
#define XEN_DOMCTL_SHADOW_OP_CLEAN       11
175
 /* Return the bitmap but do not modify internal copy. */
176
0
#define XEN_DOMCTL_SHADOW_OP_PEEK        12
177
178
/* Memory allocation accessors. */
179
0
#define XEN_DOMCTL_SHADOW_OP_GET_ALLOCATION   30
180
0
#define XEN_DOMCTL_SHADOW_OP_SET_ALLOCATION   31
181
182
/* Legacy enable operations. */
183
 /* Equiv. to ENABLE with no mode flags. */
184
0
#define XEN_DOMCTL_SHADOW_OP_ENABLE_TEST       1
185
 /* Equiv. to ENABLE with mode flag ENABLE_LOG_DIRTY. */
186
0
#define XEN_DOMCTL_SHADOW_OP_ENABLE_LOGDIRTY   2
187
 /*
188
  * No longer supported, was equiv. to ENABLE with mode flags
189
  * ENABLE_REFCOUNT and ENABLE_TRANSLATE:
190
#define XEN_DOMCTL_SHADOW_OP_ENABLE_TRANSLATE  3
191
  */
192
193
/* Mode flags for XEN_DOMCTL_SHADOW_OP_ENABLE. */
194
 /*
195
  * Shadow pagetables are refcounted: guest does not use explicit mmu
196
  * operations nor write-protect its pagetables.
197
  */
198
18.4E
#define XEN_DOMCTL_SHADOW_ENABLE_REFCOUNT  (1 << 1)
199
 /*
200
  * Log pages in a bitmap as they are dirtied.
201
  * Used for live relocation to determine which pages must be re-sent.
202
  */
203
9.13k
#define XEN_DOMCTL_SHADOW_ENABLE_LOG_DIRTY (1 << 2)
204
 /*
205
  * Automatically translate GPFNs into MFNs.
206
  */
207
6.90M
#define XEN_DOMCTL_SHADOW_ENABLE_TRANSLATE (1 << 3)
208
 /*
209
  * Xen does not steal virtual address space from the guest.
210
  * Requires HVM support.
211
  */
212
16
#define XEN_DOMCTL_SHADOW_ENABLE_EXTERNAL  (1 << 4)
213
214
/* Mode flags for XEN_DOMCTL_SHADOW_OP_{CLEAN,PEEK}. */
215
 /*
216
  * This is the final iteration: Requesting to include pages mapped
217
  * writably by the hypervisor in the dirty bitmap.
218
  */
219
0
#define XEN_DOMCTL_SHADOW_LOGDIRTY_FINAL   (1 << 0)
220
221
struct xen_domctl_shadow_op_stats {
222
    uint32_t fault_count;
223
    uint32_t dirty_count;
224
};
225
226
struct xen_domctl_shadow_op {
227
    /* IN variables. */
228
    uint32_t       op;       /* XEN_DOMCTL_SHADOW_OP_* */
229
230
    /* OP_ENABLE: XEN_DOMCTL_SHADOW_ENABLE_* */
231
    /* OP_PEAK / OP_CLEAN: XEN_DOMCTL_SHADOW_LOGDIRTY_* */
232
    uint32_t       mode;
233
234
    /* OP_GET_ALLOCATION / OP_SET_ALLOCATION */
235
    uint32_t       mb;       /* Shadow memory allocation in MB */
236
237
    /* OP_PEEK / OP_CLEAN */
238
    XEN_GUEST_HANDLE_64(uint8) dirty_bitmap;
239
    uint64_aligned_t pages; /* Size of buffer. Updated with actual size. */
240
    struct xen_domctl_shadow_op_stats stats;
241
};
242
243
244
/* XEN_DOMCTL_max_mem */
245
struct xen_domctl_max_mem {
246
    /* IN variables. */
247
    uint64_aligned_t max_memkb;
248
};
249
250
251
/* XEN_DOMCTL_setvcpucontext */
252
/* XEN_DOMCTL_getvcpucontext */
253
struct xen_domctl_vcpucontext {
254
    uint32_t              vcpu;                  /* IN */
255
    XEN_GUEST_HANDLE_64(vcpu_guest_context_t) ctxt; /* IN/OUT */
256
};
257
258
259
/* XEN_DOMCTL_getvcpuinfo */
260
struct xen_domctl_getvcpuinfo {
261
    /* IN variables. */
262
    uint32_t vcpu;
263
    /* OUT variables. */
264
    uint8_t  online;                  /* currently online (not hotplugged)? */
265
    uint8_t  blocked;                 /* blocked waiting for an event? */
266
    uint8_t  running;                 /* currently scheduled on its CPU? */
267
    uint64_aligned_t cpu_time;        /* total cpu time consumed (ns) */
268
    uint32_t cpu;                     /* current mapping   */
269
};
270
271
272
/* Get/set the NUMA node(s) with which the guest has affinity with. */
273
/* XEN_DOMCTL_setnodeaffinity */
274
/* XEN_DOMCTL_getnodeaffinity */
275
struct xen_domctl_nodeaffinity {
276
    struct xenctl_bitmap nodemap;/* IN */
277
};
278
279
280
/* Get/set which physical cpus a vcpu can execute on. */
281
/* XEN_DOMCTL_setvcpuaffinity */
282
/* XEN_DOMCTL_getvcpuaffinity */
283
struct xen_domctl_vcpuaffinity {
284
    /* IN variables. */
285
    uint32_t  vcpu;
286
 /* Set/get the hard affinity for vcpu */
287
0
#define _XEN_VCPUAFFINITY_HARD  0
288
0
#define XEN_VCPUAFFINITY_HARD   (1U<<_XEN_VCPUAFFINITY_HARD)
289
 /* Set/get the soft affinity for vcpu */
290
0
#define _XEN_VCPUAFFINITY_SOFT  1
291
0
#define XEN_VCPUAFFINITY_SOFT   (1U<<_XEN_VCPUAFFINITY_SOFT)
292
 /* Undo SCHEDOP_pin_override */
293
0
#define _XEN_VCPUAFFINITY_FORCE 2
294
0
#define XEN_VCPUAFFINITY_FORCE  (1U<<_XEN_VCPUAFFINITY_FORCE)
295
    uint32_t flags;
296
    /*
297
     * IN/OUT variables.
298
     *
299
     * Both are IN/OUT for XEN_DOMCTL_setvcpuaffinity, in which case they
300
     * contain effective hard or/and soft affinity. That is, upon successful
301
     * return, cpumap_soft, contains the intersection of the soft affinity,
302
     * hard affinity and the cpupool's online CPUs for the domain (if
303
     * XEN_VCPUAFFINITY_SOFT was set in flags). cpumap_hard contains the
304
     * intersection between hard affinity and the cpupool's online CPUs (if
305
     * XEN_VCPUAFFINITY_HARD was set in flags).
306
     *
307
     * Both are OUT-only for XEN_DOMCTL_getvcpuaffinity, in which case they
308
     * contain the plain hard and/or soft affinity masks that were set during
309
     * previous successful calls to XEN_DOMCTL_setvcpuaffinity (or the
310
     * default values), without intersecting or altering them in any way.
311
     */
312
    struct xenctl_bitmap cpumap_hard;
313
    struct xenctl_bitmap cpumap_soft;
314
};
315
316
317
/* XEN_DOMCTL_max_vcpus */
318
struct xen_domctl_max_vcpus {
319
    uint32_t max;           /* maximum number of vcpus */
320
};
321
322
323
/* XEN_DOMCTL_scheduler_op */
324
/* Scheduler types. */
325
/* #define XEN_SCHEDULER_SEDF  4 (Removed) */
326
#define XEN_SCHEDULER_CREDIT   5
327
#define XEN_SCHEDULER_CREDIT2  6
328
#define XEN_SCHEDULER_ARINC653 7
329
#define XEN_SCHEDULER_RTDS     8
330
#define XEN_SCHEDULER_NULL     9
331
332
struct xen_domctl_sched_credit {
333
    uint16_t weight;
334
    uint16_t cap;
335
};
336
337
struct xen_domctl_sched_credit2 {
338
    uint16_t weight;
339
    uint16_t cap;
340
};
341
342
struct xen_domctl_sched_rtds {
343
    uint32_t period;
344
    uint32_t budget;
345
/* Can this vCPU execute beyond its reserved amount of time? */
346
0
#define _XEN_DOMCTL_SCHEDRT_extra   0
347
0
#define XEN_DOMCTL_SCHEDRT_extra    (1U<<_XEN_DOMCTL_SCHEDRT_extra)
348
    uint32_t flags;
349
};
350
351
typedef struct xen_domctl_schedparam_vcpu {
352
    union {
353
        struct xen_domctl_sched_credit credit;
354
        struct xen_domctl_sched_credit2 credit2;
355
        struct xen_domctl_sched_rtds rtds;
356
    } u;
357
    uint32_t vcpuid;
358
} xen_domctl_schedparam_vcpu_t;
359
DEFINE_XEN_GUEST_HANDLE(xen_domctl_schedparam_vcpu_t);
360
361
/*
362
 * Set or get info?
363
 * For schedulers supporting per-vcpu settings (e.g., RTDS):
364
 *  XEN_DOMCTL_SCHEDOP_putinfo sets params for all vcpus;
365
 *  XEN_DOMCTL_SCHEDOP_getinfo gets default params;
366
 *  XEN_DOMCTL_SCHEDOP_put(get)vcpuinfo sets (gets) params of vcpus;
367
 *
368
 * For schedulers not supporting per-vcpu settings:
369
 *  XEN_DOMCTL_SCHEDOP_putinfo sets params for all vcpus;
370
 *  XEN_DOMCTL_SCHEDOP_getinfo gets domain-wise params;
371
 *  XEN_DOMCTL_SCHEDOP_put(get)vcpuinfo returns error;
372
 */
373
0
#define XEN_DOMCTL_SCHEDOP_putinfo 0
374
0
#define XEN_DOMCTL_SCHEDOP_getinfo 1
375
0
#define XEN_DOMCTL_SCHEDOP_putvcpuinfo 2
376
0
#define XEN_DOMCTL_SCHEDOP_getvcpuinfo 3
377
struct xen_domctl_scheduler_op {
378
    uint32_t sched_id;  /* XEN_SCHEDULER_* */
379
    uint32_t cmd;       /* XEN_DOMCTL_SCHEDOP_* */
380
    /* IN/OUT */
381
    union {
382
        struct xen_domctl_sched_credit credit;
383
        struct xen_domctl_sched_credit2 credit2;
384
        struct xen_domctl_sched_rtds rtds;
385
        struct {
386
            XEN_GUEST_HANDLE_64(xen_domctl_schedparam_vcpu_t) vcpus;
387
            /*
388
             * IN: Number of elements in vcpus array.
389
             * OUT: Number of processed elements of vcpus array.
390
             */
391
            uint32_t nr_vcpus;
392
            uint32_t padding;
393
        } v;
394
    } u;
395
};
396
397
398
/* XEN_DOMCTL_setdomainhandle */
399
struct xen_domctl_setdomainhandle {
400
    xen_domain_handle_t handle;
401
};
402
403
404
/* XEN_DOMCTL_setdebugging */
405
struct xen_domctl_setdebugging {
406
    uint8_t enable;
407
};
408
409
410
/* XEN_DOMCTL_irq_permission */
411
struct xen_domctl_irq_permission {
412
    uint8_t pirq;
413
    uint8_t allow_access;    /* flag to specify enable/disable of IRQ access */
414
};
415
416
417
/* XEN_DOMCTL_iomem_permission */
418
struct xen_domctl_iomem_permission {
419
    uint64_aligned_t first_mfn;/* first page (physical page number) in range */
420
    uint64_aligned_t nr_mfns;  /* number of pages in range (>0) */
421
    uint8_t  allow_access;     /* allow (!0) or deny (0) access to range? */
422
};
423
424
425
/* XEN_DOMCTL_ioport_permission */
426
struct xen_domctl_ioport_permission {
427
    uint32_t first_port;              /* first port int range */
428
    uint32_t nr_ports;                /* size of port range */
429
    uint8_t  allow_access;            /* allow or deny access to range? */
430
};
431
432
433
/* XEN_DOMCTL_hypercall_init */
434
struct xen_domctl_hypercall_init {
435
    uint64_aligned_t  gmfn;           /* GMFN to be initialised */
436
};
437
438
439
/* XEN_DOMCTL_settimeoffset */
440
struct xen_domctl_settimeoffset {
441
    int64_aligned_t time_offset_seconds; /* applied to domain wallclock time */
442
};
443
444
/* XEN_DOMCTL_gethvmcontext */
445
/* XEN_DOMCTL_sethvmcontext */
446
struct xen_domctl_hvmcontext {
447
    uint32_t size; /* IN/OUT: size of buffer / bytes filled */
448
    XEN_GUEST_HANDLE_64(uint8) buffer; /* IN/OUT: data, or call
449
                                        * gethvmcontext with NULL
450
                                        * buffer to get size req'd */
451
};
452
453
454
/* XEN_DOMCTL_set_address_size */
455
/* XEN_DOMCTL_get_address_size */
456
struct xen_domctl_address_size {
457
    uint32_t size;
458
};
459
460
461
/* XEN_DOMCTL_sendtrigger */
462
0
#define XEN_DOMCTL_SENDTRIGGER_NMI    0
463
#define XEN_DOMCTL_SENDTRIGGER_RESET  1
464
#define XEN_DOMCTL_SENDTRIGGER_INIT   2
465
0
#define XEN_DOMCTL_SENDTRIGGER_POWER  3
466
0
#define XEN_DOMCTL_SENDTRIGGER_SLEEP  4
467
struct xen_domctl_sendtrigger {
468
    uint32_t  trigger;  /* IN */
469
    uint32_t  vcpu;     /* IN */
470
};
471
472
473
/* Assign a device to a guest. Sets up IOMMU structures. */
474
/* XEN_DOMCTL_assign_device */
475
/*
476
 * XEN_DOMCTL_test_assign_device: Pass DOMID_INVALID to find out whether the
477
 * given device is assigned to any DomU at all. Pass a specific domain ID to
478
 * find out whether the given device can be assigned to that domain.
479
 */
480
/*
481
 * XEN_DOMCTL_deassign_device: The behavior of this DOMCTL differs
482
 * between the different type of device:
483
 *  - PCI device (XEN_DOMCTL_DEV_PCI) will be reassigned to DOM0
484
 *  - DT device (XEN_DOMCTL_DEV_DT) will left unassigned. DOM0
485
 *  will have to call XEN_DOMCTL_assign_device in order to use the
486
 *  device.
487
 */
488
0
#define XEN_DOMCTL_DEV_PCI      0
489
#define XEN_DOMCTL_DEV_DT       1
490
struct xen_domctl_assign_device {
491
    /* IN */
492
    uint32_t dev;   /* XEN_DOMCTL_DEV_* */
493
    uint32_t flags;
494
0
#define XEN_DOMCTL_DEV_RDM_RELAXED      1 /* assign only */
495
    union {
496
        struct {
497
            uint32_t machine_sbdf;   /* machine PCI ID of assigned device */
498
        } pci;
499
        struct {
500
            uint32_t size; /* Length of the path */
501
            XEN_GUEST_HANDLE_64(char) path; /* path to the device tree node */
502
        } dt;
503
    } u;
504
};
505
506
/* Retrieve sibling devices infomation of machine_sbdf */
507
/* XEN_DOMCTL_get_device_group */
508
struct xen_domctl_get_device_group {
509
    uint32_t  machine_sbdf;     /* IN */
510
    uint32_t  max_sdevs;        /* IN */
511
    uint32_t  num_sdevs;        /* OUT */
512
    XEN_GUEST_HANDLE_64(uint32)  sdev_array;   /* OUT */
513
};
514
515
/* Pass-through interrupts: bind real irq -> hvm devfn. */
516
/* XEN_DOMCTL_bind_pt_irq */
517
/* XEN_DOMCTL_unbind_pt_irq */
518
enum pt_irq_type {
519
    PT_IRQ_TYPE_PCI,
520
    PT_IRQ_TYPE_ISA,
521
    PT_IRQ_TYPE_MSI,
522
    PT_IRQ_TYPE_MSI_TRANSLATE,
523
    PT_IRQ_TYPE_SPI,    /* ARM: valid range 32-1019 */
524
};
525
struct xen_domctl_bind_pt_irq {
526
    uint32_t machine_irq;
527
    uint32_t irq_type; /* enum pt_irq_type */
528
529
    union {
530
        struct {
531
            uint8_t isa_irq;
532
        } isa;
533
        struct {
534
            uint8_t bus;
535
            uint8_t device;
536
            uint8_t intx;
537
        } pci;
538
        struct {
539
            uint8_t gvec;
540
            uint32_t gflags;
541
#define XEN_DOMCTL_VMSI_X86_DEST_ID_MASK 0x0000ff
542
#define XEN_DOMCTL_VMSI_X86_RH_MASK      0x000100
543
3.88k
#define XEN_DOMCTL_VMSI_X86_DM_MASK      0x000200
544
#define XEN_DOMCTL_VMSI_X86_DELIV_MASK   0x007000
545
3.84k
#define XEN_DOMCTL_VMSI_X86_TRIG_MASK    0x008000
546
84
#define XEN_DOMCTL_VMSI_X86_UNMASKED     0x010000
547
548
            uint64_aligned_t gtable;
549
        } msi;
550
        struct {
551
            uint16_t spi;
552
        } spi;
553
    } u;
554
};
555
556
557
/* Bind machine I/O address range -> HVM address range. */
558
/* XEN_DOMCTL_memory_mapping */
559
/* Returns
560
   - zero     success, everything done
561
   - -E2BIG   passed in nr_mfns value too large for the implementation
562
   - positive partial success for the first <result> page frames (with
563
              <result> less than nr_mfns), requiring re-invocation by the
564
              caller after updating inputs
565
   - negative error; other than -E2BIG
566
*/
567
#define DPCI_ADD_MAPPING         1
568
#define DPCI_REMOVE_MAPPING      0
569
struct xen_domctl_memory_mapping {
570
    uint64_aligned_t first_gfn; /* first page (hvm guest phys page) in range */
571
    uint64_aligned_t first_mfn; /* first page (machine page) in range */
572
    uint64_aligned_t nr_mfns;   /* number of pages in range (>0) */
573
    uint32_t add_mapping;       /* add or remove mapping */
574
    uint32_t padding;           /* padding for 64-bit aligned structure */
575
};
576
577
578
/* Bind machine I/O port range -> HVM I/O port range. */
579
/* XEN_DOMCTL_ioport_mapping */
580
struct xen_domctl_ioport_mapping {
581
    uint32_t first_gport;     /* first guest IO port*/
582
    uint32_t first_mport;     /* first machine IO port */
583
    uint32_t nr_ports;        /* size of port range */
584
    uint32_t add_mapping;     /* add or remove mapping */
585
};
586
587
588
/*
589
 * Pin caching type of RAM space for x86 HVM domU.
590
 */
591
/* XEN_DOMCTL_pin_mem_cacheattr */
592
/* Caching types: these happen to be the same as x86 MTRR/PAT type codes. */
593
#define XEN_DOMCTL_MEM_CACHEATTR_UC  0
594
#define XEN_DOMCTL_MEM_CACHEATTR_WC  1
595
#define XEN_DOMCTL_MEM_CACHEATTR_WT  4
596
#define XEN_DOMCTL_MEM_CACHEATTR_WP  5
597
#define XEN_DOMCTL_MEM_CACHEATTR_WB  6
598
#define XEN_DOMCTL_MEM_CACHEATTR_UCM 7
599
0
#define XEN_DOMCTL_DELETE_MEM_CACHEATTR (~(uint32_t)0)
600
struct xen_domctl_pin_mem_cacheattr {
601
    uint64_aligned_t start, end;
602
    uint32_t type; /* XEN_DOMCTL_MEM_CACHEATTR_* */
603
};
604
605
606
/* XEN_DOMCTL_set_ext_vcpucontext */
607
/* XEN_DOMCTL_get_ext_vcpucontext */
608
struct xen_domctl_ext_vcpucontext {
609
    /* IN: VCPU that this call applies to. */
610
    uint32_t         vcpu;
611
    /*
612
     * SET: Size of struct (IN)
613
     * GET: Size of struct (OUT, up to 128 bytes)
614
     */
615
    uint32_t         size;
616
#if defined(__i386__) || defined(__x86_64__)
617
    /* SYSCALL from 32-bit mode and SYSENTER callback information. */
618
    /* NB. SYSCALL from 64-bit mode is contained in vcpu_guest_context_t */
619
    uint64_aligned_t syscall32_callback_eip;
620
    uint64_aligned_t sysenter_callback_eip;
621
    uint16_t         syscall32_callback_cs;
622
    uint16_t         sysenter_callback_cs;
623
    uint8_t          syscall32_disables_events;
624
    uint8_t          sysenter_disables_events;
625
#if defined(__GNUC__)
626
    union {
627
        uint64_aligned_t mcg_cap;
628
        struct hvm_vmce_vcpu vmce;
629
    };
630
#else
631
    struct hvm_vmce_vcpu vmce;
632
#endif
633
#endif
634
};
635
636
/*
637
 * Set the target domain for a domain
638
 */
639
/* XEN_DOMCTL_set_target */
640
struct xen_domctl_set_target {
641
    domid_t target;
642
};
643
644
#if defined(__i386__) || defined(__x86_64__)
645
# define XEN_CPUID_INPUT_UNUSED  0xFFFFFFFF
646
/* XEN_DOMCTL_set_cpuid */
647
struct xen_domctl_cpuid {
648
  uint32_t input[2];
649
  uint32_t eax;
650
  uint32_t ebx;
651
  uint32_t ecx;
652
  uint32_t edx;
653
};
654
#endif
655
656
/*
657
 * Arranges that if the domain suspends (specifically, if it shuts
658
 * down with code SHUTDOWN_suspend), this event channel will be
659
 * notified.
660
 *
661
 * This is _instead of_ the usual notification to the global
662
 * VIRQ_DOM_EXC.  (In most systems that pirq is owned by xenstored.)
663
 *
664
 * Only one subscription per domain is possible.  Last subscriber
665
 * wins; others are silently displaced.
666
 *
667
 * NB that contrary to the rather general name, it only applies to
668
 * domain shutdown with code suspend.  Shutdown for other reasons
669
 * (including crash), and domain death, are notified to VIRQ_DOM_EXC
670
 * regardless.
671
 */
672
/* XEN_DOMCTL_subscribe */
673
struct xen_domctl_subscribe {
674
    uint32_t port; /* IN */
675
};
676
677
/*
678
 * Define the maximum machine address size which should be allocated
679
 * to a guest.
680
 */
681
/* XEN_DOMCTL_set_machine_address_size */
682
/* XEN_DOMCTL_get_machine_address_size */
683
684
/*
685
 * Do not inject spurious page faults into this domain.
686
 */
687
/* XEN_DOMCTL_suppress_spurious_page_faults */
688
689
/* XEN_DOMCTL_debug_op */
690
0
#define XEN_DOMCTL_DEBUG_OP_SINGLE_STEP_OFF         0
691
0
#define XEN_DOMCTL_DEBUG_OP_SINGLE_STEP_ON          1
692
struct xen_domctl_debug_op {
693
    uint32_t op;   /* IN */
694
    uint32_t vcpu; /* IN */
695
};
696
697
/*
698
 * Request a particular record from the HVM context
699
 */
700
/* XEN_DOMCTL_gethvmcontext_partial */
701
struct xen_domctl_hvmcontext_partial {
702
    uint32_t type;                      /* IN: Type of record required */
703
    uint32_t instance;                  /* IN: Instance of that type */
704
    uint64_aligned_t bufsz;             /* IN: size of buffer */
705
    XEN_GUEST_HANDLE_64(uint8) buffer;  /* OUT: buffer to write record into */
706
};
707
708
/* XEN_DOMCTL_disable_migrate */
709
struct xen_domctl_disable_migrate {
710
    uint32_t disable; /* IN: 1: disable migration and restore */
711
};
712
713
714
/* XEN_DOMCTL_gettscinfo */
715
/* XEN_DOMCTL_settscinfo */
716
struct xen_domctl_tsc_info {
717
    /* IN/OUT */
718
    uint32_t tsc_mode;
719
    uint32_t gtsc_khz;
720
    uint32_t incarnation;
721
    uint32_t pad;
722
    uint64_aligned_t elapsed_nsec;
723
};
724
725
/* XEN_DOMCTL_gdbsx_guestmemio      guest mem io */
726
struct xen_domctl_gdbsx_memio {
727
    /* IN */
728
    uint64_aligned_t pgd3val;/* optional: init_mm.pgd[3] value */
729
    uint64_aligned_t gva;    /* guest virtual address */
730
    uint64_aligned_t uva;    /* user buffer virtual address */
731
    uint32_t         len;    /* number of bytes to read/write */
732
    uint8_t          gwr;    /* 0 = read from guest. 1 = write to guest */
733
    /* OUT */
734
    uint32_t         remain; /* bytes remaining to be copied */
735
};
736
737
/* XEN_DOMCTL_gdbsx_pausevcpu */
738
/* XEN_DOMCTL_gdbsx_unpausevcpu */
739
struct xen_domctl_gdbsx_pauseunp_vcpu { /* pause/unpause a vcpu */
740
    uint32_t         vcpu;         /* which vcpu */
741
};
742
743
/* XEN_DOMCTL_gdbsx_domstatus */
744
struct xen_domctl_gdbsx_domstatus {
745
    /* OUT */
746
    uint8_t          paused;     /* is the domain paused */
747
    uint32_t         vcpu_id;    /* any vcpu in an event? */
748
    uint32_t         vcpu_ev;    /* if yes, what event? */
749
};
750
751
/*
752
 * VM event operations
753
 */
754
755
/* XEN_DOMCTL_vm_event_op */
756
757
/*
758
 * There are currently three rings available for VM events:
759
 * sharing, monitor and paging. This hypercall allows one to
760
 * control these rings (enable/disable), as well as to signal
761
 * to the hypervisor to pull responses (resume) from the given
762
 * ring.
763
 */
764
0
#define XEN_VM_EVENT_ENABLE               0
765
0
#define XEN_VM_EVENT_DISABLE              1
766
0
#define XEN_VM_EVENT_RESUME               2
767
768
/*
769
 * Domain memory paging
770
 * Page memory in and out.
771
 * Domctl interface to set up and tear down the 
772
 * pager<->hypervisor interface. Use XENMEM_paging_op*
773
 * to perform per-page operations.
774
 *
775
 * The XEN_VM_EVENT_PAGING_ENABLE domctl returns several
776
 * non-standard error codes to indicate why paging could not be enabled:
777
 * ENODEV - host lacks HAP support (EPT/NPT) or HAP is disabled in guest
778
 * EMLINK - guest has iommu passthrough enabled
779
 * EXDEV  - guest has PoD enabled
780
 * EBUSY  - guest has or had paging enabled, ring buffer still active
781
 */
782
0
#define XEN_DOMCTL_VM_EVENT_OP_PAGING            1
783
784
/*
785
 * Monitor helper.
786
 *
787
 * As with paging, use the domctl for teardown/setup of the
788
 * helper<->hypervisor interface.
789
 *
790
 * The monitor interface can be used to register for various VM events. For
791
 * example, there are HVM hypercalls to set the per-page access permissions
792
 * of every page in a domain.  When one of these permissions--independent,
793
 * read, write, and execute--is violated, the VCPU is paused and a memory event
794
 * is sent with what happened. The memory event handler can then resume the
795
 * VCPU and redo the access with a XEN_VM_EVENT_RESUME option.
796
 *
797
 * See public/vm_event.h for the list of available events that can be
798
 * subscribed to via the monitor interface.
799
 *
800
 * The XEN_VM_EVENT_MONITOR_* domctls returns
801
 * non-standard error codes to indicate why access could not be enabled:
802
 * ENODEV - host lacks HAP support (EPT/NPT) or HAP is disabled in guest
803
 * EBUSY  - guest has or had access enabled, ring buffer still active
804
 *
805
 */
806
0
#define XEN_DOMCTL_VM_EVENT_OP_MONITOR           2
807
808
/*
809
 * Sharing ENOMEM helper.
810
 *
811
 * As with paging, use the domctl for teardown/setup of the
812
 * helper<->hypervisor interface.
813
 *
814
 * If setup, this ring is used to communicate failed allocations
815
 * in the unshare path. XENMEM_sharing_op_resume is used to wake up
816
 * vcpus that could not unshare.
817
 *
818
 * Note that shring can be turned on (as per the domctl below)
819
 * *without* this ring being setup.
820
 */
821
0
#define XEN_DOMCTL_VM_EVENT_OP_SHARING           3
822
823
/* Use for teardown/setup of helper<->hypervisor interface for paging, 
824
 * access and sharing.*/
825
struct xen_domctl_vm_event_op {
826
    uint32_t       op;           /* XEN_VM_EVENT_* */
827
    uint32_t       mode;         /* XEN_DOMCTL_VM_EVENT_OP_* */
828
829
    uint32_t port;              /* OUT: event channel for ring */
830
};
831
832
/*
833
 * Memory sharing operations
834
 */
835
/* XEN_DOMCTL_mem_sharing_op.
836
 * The CONTROL sub-domctl is used for bringup/teardown. */
837
0
#define XEN_DOMCTL_MEM_SHARING_CONTROL          0
838
839
struct xen_domctl_mem_sharing_op {
840
    uint8_t op; /* XEN_DOMCTL_MEM_SHARING_* */
841
842
    union {
843
        uint8_t enable;                   /* CONTROL */
844
    } u;
845
};
846
847
struct xen_domctl_audit_p2m {
848
    /* OUT error counts */
849
    uint64_t orphans;
850
    uint64_t m2p_bad;
851
    uint64_t p2m_bad;
852
};
853
854
struct xen_domctl_set_virq_handler {
855
    uint32_t virq; /* IN */
856
};
857
858
#if defined(__i386__) || defined(__x86_64__)
859
/* XEN_DOMCTL_setvcpuextstate */
860
/* XEN_DOMCTL_getvcpuextstate */
861
struct xen_domctl_vcpuextstate {
862
    /* IN: VCPU that this call applies to. */
863
    uint32_t         vcpu;
864
    /*
865
     * SET: Ignored.
866
     * GET: xfeature support mask of struct (IN/OUT)
867
     * xfeature mask is served as identifications of the saving format
868
     * so that compatible CPUs can have a check on format to decide
869
     * whether it can restore.
870
     */
871
    uint64_aligned_t         xfeature_mask;
872
    /*
873
     * SET: Size of struct (IN)
874
     * GET: Size of struct (IN/OUT)
875
     */
876
    uint64_aligned_t         size;
877
    XEN_GUEST_HANDLE_64(uint64) buffer;
878
};
879
#endif
880
881
/* XEN_DOMCTL_set_access_required: sets whether a memory event listener
882
 * must be present to handle page access events: if false, the page
883
 * access will revert to full permissions if no one is listening;
884
 *  */
885
struct xen_domctl_set_access_required {
886
    uint8_t access_required;
887
};
888
889
struct xen_domctl_set_broken_page_p2m {
890
    uint64_aligned_t pfn;
891
};
892
893
/*
894
 * XEN_DOMCTL_set_max_evtchn: sets the maximum event channel port
895
 * number the guest may use.  Use this limit the amount of resources
896
 * (global mapping space, xenheap) a guest may use for event channels.
897
 */
898
struct xen_domctl_set_max_evtchn {
899
    uint32_t max_port;
900
};
901
902
/*
903
 * ARM: Clean and invalidate caches associated with given region of
904
 * guest memory.
905
 */
906
struct xen_domctl_cacheflush {
907
    /* IN: page range to flush. */
908
    xen_pfn_t start_pfn, nr_pfns;
909
};
910
911
#if defined(__i386__) || defined(__x86_64__)
912
struct xen_domctl_vcpu_msr {
913
    uint32_t         index;
914
    uint32_t         reserved;
915
    uint64_aligned_t value;
916
};
917
typedef struct xen_domctl_vcpu_msr xen_domctl_vcpu_msr_t;
918
DEFINE_XEN_GUEST_HANDLE(xen_domctl_vcpu_msr_t);
919
920
/*
921
 * XEN_DOMCTL_set_vcpu_msrs / XEN_DOMCTL_get_vcpu_msrs.
922
 *
923
 * Input:
924
 * - A NULL 'msrs' guest handle is a request for the maximum 'msr_count'.
925
 * - Otherwise, 'msr_count' is the number of entries in 'msrs'.
926
 *
927
 * Output for get:
928
 * - If 'msr_count' is less than the number Xen needs to write, -ENOBUFS shall
929
 *   be returned and 'msr_count' updated to reflect the intended number.
930
 * - On success, 'msr_count' shall indicate the number of MSRs written, which
931
 *   may be less than the maximum if some are not currently used by the vcpu.
932
 *
933
 * Output for set:
934
 * - If Xen encounters an error with a specific MSR, -EINVAL shall be returned
935
 *   and 'msr_count' shall be set to the offending index, to aid debugging.
936
 */
937
struct xen_domctl_vcpu_msrs {
938
    uint32_t vcpu;                                   /* IN     */
939
    uint32_t msr_count;                              /* IN/OUT */
940
    XEN_GUEST_HANDLE_64(xen_domctl_vcpu_msr_t) msrs; /* IN/OUT */
941
};
942
#endif
943
944
/* XEN_DOMCTL_setvnumainfo: specifies a virtual NUMA topology for the guest */
945
struct xen_domctl_vnuma {
946
    /* IN: number of vNUMA nodes to setup. Shall be greater than 0 */
947
    uint32_t nr_vnodes;
948
    /* IN: number of memory ranges to setup */
949
    uint32_t nr_vmemranges;
950
    /*
951
     * IN: number of vCPUs of the domain (used as size of the vcpu_to_vnode
952
     * array declared below). Shall be equal to the domain's max_vcpus.
953
     */
954
    uint32_t nr_vcpus;
955
    uint32_t pad;                                  /* must be zero */
956
957
    /*
958
     * IN: array for specifying the distances of the vNUMA nodes
959
     * between each others. Shall have nr_vnodes*nr_vnodes elements.
960
     */
961
    XEN_GUEST_HANDLE_64(uint) vdistance;
962
    /*
963
     * IN: array for specifying to what vNUMA node each vCPU belongs.
964
     * Shall have nr_vcpus elements.
965
     */
966
    XEN_GUEST_HANDLE_64(uint) vcpu_to_vnode;
967
    /*
968
     * IN: array for specifying on what physical NUMA node each vNUMA
969
     * node is placed. Shall have nr_vnodes elements.
970
     */
971
    XEN_GUEST_HANDLE_64(uint) vnode_to_pnode;
972
    /*
973
     * IN: array for specifying the memory ranges. Shall have
974
     * nr_vmemranges elements.
975
     */
976
    XEN_GUEST_HANDLE_64(xen_vmemrange_t) vmemrange;
977
};
978
979
struct xen_domctl_psr_cmt_op {
980
0
#define XEN_DOMCTL_PSR_CMT_OP_DETACH         0
981
0
#define XEN_DOMCTL_PSR_CMT_OP_ATTACH         1
982
0
#define XEN_DOMCTL_PSR_CMT_OP_QUERY_RMID     2
983
    uint32_t cmd;
984
    uint32_t data;
985
};
986
987
/*  XEN_DOMCTL_MONITOR_*
988
 *
989
 * Enable/disable monitoring various VM events.
990
 * This domctl configures what events will be reported to helper apps
991
 * via the ring buffer "MONITOR". The ring has to be first enabled
992
 * with the domctl XEN_DOMCTL_VM_EVENT_OP_MONITOR.
993
 *
994
 * GET_CAPABILITIES can be used to determine which of these features is
995
 * available on a given platform.
996
 *
997
 * NOTICE: mem_access events are also delivered via the "MONITOR" ring buffer;
998
 * however, enabling/disabling those events is performed with the use of
999
 * memory_op hypercalls!
1000
 */
1001
0
#define XEN_DOMCTL_MONITOR_OP_ENABLE            0
1002
0
#define XEN_DOMCTL_MONITOR_OP_DISABLE           1
1003
0
#define XEN_DOMCTL_MONITOR_OP_GET_CAPABILITIES  2
1004
0
#define XEN_DOMCTL_MONITOR_OP_EMULATE_EACH_REP  3
1005
1006
0
#define XEN_DOMCTL_MONITOR_EVENT_WRITE_CTRLREG         0
1007
0
#define XEN_DOMCTL_MONITOR_EVENT_MOV_TO_MSR            1
1008
0
#define XEN_DOMCTL_MONITOR_EVENT_SINGLESTEP            2
1009
0
#define XEN_DOMCTL_MONITOR_EVENT_SOFTWARE_BREAKPOINT   3
1010
0
#define XEN_DOMCTL_MONITOR_EVENT_GUEST_REQUEST         4
1011
0
#define XEN_DOMCTL_MONITOR_EVENT_DEBUG_EXCEPTION       5
1012
0
#define XEN_DOMCTL_MONITOR_EVENT_CPUID                 6
1013
#define XEN_DOMCTL_MONITOR_EVENT_PRIVILEGED_CALL       7
1014
0
#define XEN_DOMCTL_MONITOR_EVENT_INTERRUPT             8
1015
0
#define XEN_DOMCTL_MONITOR_EVENT_DESC_ACCESS           9
1016
0
#define XEN_DOMCTL_MONITOR_EVENT_EMUL_UNIMPLEMENTED    10
1017
1018
struct xen_domctl_monitor_op {
1019
    uint32_t op; /* XEN_DOMCTL_MONITOR_OP_* */
1020
1021
    /*
1022
     * When used with ENABLE/DISABLE this has to be set to
1023
     * the requested XEN_DOMCTL_MONITOR_EVENT_* value.
1024
     * With GET_CAPABILITIES this field returns a bitmap of
1025
     * events supported by the platform, in the format
1026
     * (1 << XEN_DOMCTL_MONITOR_EVENT_*).
1027
     */
1028
    uint32_t event;
1029
1030
    /*
1031
     * Further options when issuing XEN_DOMCTL_MONITOR_OP_ENABLE.
1032
     */
1033
    union {
1034
        struct {
1035
            /* Which control register */
1036
            uint8_t index;
1037
            /* Pause vCPU until response */
1038
            uint8_t sync;
1039
            /* Send event only on a change of value */
1040
            uint8_t onchangeonly;
1041
            /* Allignment padding */
1042
            uint8_t pad1;
1043
            uint32_t pad2;
1044
            /*
1045
             * Send event only if the changed bit in the control register
1046
             * is not masked.
1047
             */
1048
            uint64_aligned_t bitmask;
1049
        } mov_to_cr;
1050
1051
        struct {
1052
            uint32_t msr;
1053
        } mov_to_msr;
1054
1055
        struct {
1056
            /* Pause vCPU until response */
1057
            uint8_t sync;
1058
            uint8_t allow_userspace;
1059
        } guest_request;
1060
1061
        struct {
1062
            /* Pause vCPU until response */
1063
            uint8_t sync;
1064
        } debug_exception;
1065
    } u;
1066
};
1067
1068
struct xen_domctl_psr_cat_op {
1069
0
#define XEN_DOMCTL_PSR_CAT_OP_SET_L3_CBM     0
1070
0
#define XEN_DOMCTL_PSR_CAT_OP_GET_L3_CBM     1
1071
0
#define XEN_DOMCTL_PSR_CAT_OP_SET_L3_CODE    2
1072
0
#define XEN_DOMCTL_PSR_CAT_OP_SET_L3_DATA    3
1073
0
#define XEN_DOMCTL_PSR_CAT_OP_GET_L3_CODE    4
1074
0
#define XEN_DOMCTL_PSR_CAT_OP_GET_L3_DATA    5
1075
0
#define XEN_DOMCTL_PSR_CAT_OP_SET_L2_CBM     6
1076
0
#define XEN_DOMCTL_PSR_CAT_OP_GET_L2_CBM     7
1077
    uint32_t cmd;       /* IN: XEN_DOMCTL_PSR_CAT_OP_* */
1078
    uint32_t target;    /* IN */
1079
    uint64_t data;      /* IN/OUT */
1080
};
1081
1082
struct xen_domctl_set_gnttab_limits {
1083
    uint32_t grant_frames;     /* IN */
1084
    uint32_t maptrack_frames;  /* IN */
1085
};
1086
1087
/* XEN_DOMCTL_vuart_op */
1088
struct xen_domctl_vuart_op {
1089
#define XEN_DOMCTL_VUART_OP_INIT  0
1090
        uint32_t cmd;           /* XEN_DOMCTL_VUART_OP_* */
1091
#define XEN_DOMCTL_VUART_TYPE_VPL011 0
1092
        uint32_t type;          /* IN - type of vuart.
1093
                                 *      Currently only vpl011 supported.
1094
                                 */
1095
        uint64_aligned_t  gfn;  /* IN - guest gfn to be used as a
1096
                                 *      ring buffer.
1097
                                 */
1098
        domid_t console_domid;  /* IN - domid of domain running the
1099
                                 *      backend console.
1100
                                 */
1101
        uint8_t pad[2];
1102
        evtchn_port_t evtchn;   /* OUT - remote port of the event
1103
                                 *       channel used for sending
1104
                                 *       ring buffer events.
1105
                                 */
1106
};
1107
1108
struct xen_domctl {
1109
    uint32_t cmd;
1110
0
#define XEN_DOMCTL_createdomain                   1
1111
0
#define XEN_DOMCTL_destroydomain                  2
1112
0
#define XEN_DOMCTL_pausedomain                    3
1113
0
#define XEN_DOMCTL_unpausedomain                  4
1114
9
#define XEN_DOMCTL_getdomaininfo                  5
1115
0
#define XEN_DOMCTL_getmemlist                     6
1116
/* #define XEN_DOMCTL_getpageframeinfo            7 Obsolete - use getpageframeinfo3 */
1117
/* #define XEN_DOMCTL_getpageframeinfo2           8 Obsolete - use getpageframeinfo3 */
1118
0
#define XEN_DOMCTL_setvcpuaffinity                9
1119
0
#define XEN_DOMCTL_shadow_op                     10
1120
0
#define XEN_DOMCTL_max_mem                       11
1121
0
#define XEN_DOMCTL_setvcpucontext                12
1122
0
#define XEN_DOMCTL_getvcpucontext                13
1123
0
#define XEN_DOMCTL_getvcpuinfo                   14
1124
0
#define XEN_DOMCTL_max_vcpus                     15
1125
0
#define XEN_DOMCTL_scheduler_op                  16
1126
0
#define XEN_DOMCTL_setdomainhandle               17
1127
0
#define XEN_DOMCTL_setdebugging                  18
1128
0
#define XEN_DOMCTL_irq_permission                19
1129
0
#define XEN_DOMCTL_iomem_permission              20
1130
0
#define XEN_DOMCTL_ioport_permission             21
1131
0
#define XEN_DOMCTL_hypercall_init                22
1132
#define XEN_DOMCTL_arch_setup                    23 /* Obsolete IA64 only */
1133
0
#define XEN_DOMCTL_settimeoffset                 24
1134
0
#define XEN_DOMCTL_getvcpuaffinity               25
1135
#define XEN_DOMCTL_real_mode_area                26 /* Obsolete PPC only */
1136
0
#define XEN_DOMCTL_resumedomain                  27
1137
0
#define XEN_DOMCTL_sendtrigger                   28
1138
0
#define XEN_DOMCTL_subscribe                     29
1139
0
#define XEN_DOMCTL_gethvmcontext                 33
1140
0
#define XEN_DOMCTL_sethvmcontext                 34
1141
0
#define XEN_DOMCTL_set_address_size              35
1142
0
#define XEN_DOMCTL_get_address_size              36
1143
0
#define XEN_DOMCTL_assign_device                 37
1144
0
#define XEN_DOMCTL_bind_pt_irq                   38
1145
0
#define XEN_DOMCTL_memory_mapping                39
1146
0
#define XEN_DOMCTL_ioport_mapping                40
1147
0
#define XEN_DOMCTL_pin_mem_cacheattr             41
1148
0
#define XEN_DOMCTL_set_ext_vcpucontext           42
1149
0
#define XEN_DOMCTL_get_ext_vcpucontext           43
1150
#define XEN_DOMCTL_set_opt_feature               44 /* Obsolete IA64 only */
1151
0
#define XEN_DOMCTL_test_assign_device            45
1152
0
#define XEN_DOMCTL_set_target                    46
1153
0
#define XEN_DOMCTL_deassign_device               47
1154
0
#define XEN_DOMCTL_unbind_pt_irq                 48
1155
0
#define XEN_DOMCTL_set_cpuid                     49
1156
0
#define XEN_DOMCTL_get_device_group              50
1157
0
#define XEN_DOMCTL_set_machine_address_size      51
1158
0
#define XEN_DOMCTL_get_machine_address_size      52
1159
0
#define XEN_DOMCTL_suppress_spurious_page_faults 53
1160
0
#define XEN_DOMCTL_debug_op                      54
1161
0
#define XEN_DOMCTL_gethvmcontext_partial         55
1162
0
#define XEN_DOMCTL_vm_event_op                   56
1163
0
#define XEN_DOMCTL_mem_sharing_op                57
1164
0
#define XEN_DOMCTL_disable_migrate               58
1165
0
#define XEN_DOMCTL_gettscinfo                    59
1166
0
#define XEN_DOMCTL_settscinfo                    60
1167
0
#define XEN_DOMCTL_getpageframeinfo3             61
1168
0
#define XEN_DOMCTL_setvcpuextstate               62
1169
0
#define XEN_DOMCTL_getvcpuextstate               63
1170
0
#define XEN_DOMCTL_set_access_required           64
1171
0
#define XEN_DOMCTL_audit_p2m                     65
1172
0
#define XEN_DOMCTL_set_virq_handler              66
1173
0
#define XEN_DOMCTL_set_broken_page_p2m           67
1174
0
#define XEN_DOMCTL_setnodeaffinity               68
1175
0
#define XEN_DOMCTL_getnodeaffinity               69
1176
0
#define XEN_DOMCTL_set_max_evtchn                70
1177
#define XEN_DOMCTL_cacheflush                    71
1178
0
#define XEN_DOMCTL_get_vcpu_msrs                 72
1179
0
#define XEN_DOMCTL_set_vcpu_msrs                 73
1180
0
#define XEN_DOMCTL_setvnumainfo                  74
1181
0
#define XEN_DOMCTL_psr_cmt_op                    75
1182
0
#define XEN_DOMCTL_monitor_op                    77
1183
0
#define XEN_DOMCTL_psr_cat_op                    78
1184
0
#define XEN_DOMCTL_soft_reset                    79
1185
0
#define XEN_DOMCTL_set_gnttab_limits             80
1186
#define XEN_DOMCTL_vuart_op                      81
1187
0
#define XEN_DOMCTL_gdbsx_guestmemio            1000
1188
0
#define XEN_DOMCTL_gdbsx_pausevcpu             1001
1189
0
#define XEN_DOMCTL_gdbsx_unpausevcpu           1002
1190
0
#define XEN_DOMCTL_gdbsx_domstatus             1003
1191
    uint32_t interface_version; /* XEN_DOMCTL_INTERFACE_VERSION */
1192
    domid_t  domain;
1193
    union {
1194
        struct xen_domctl_createdomain      createdomain;
1195
        struct xen_domctl_getdomaininfo     getdomaininfo;
1196
        struct xen_domctl_getmemlist        getmemlist;
1197
        struct xen_domctl_getpageframeinfo3 getpageframeinfo3;
1198
        struct xen_domctl_nodeaffinity      nodeaffinity;
1199
        struct xen_domctl_vcpuaffinity      vcpuaffinity;
1200
        struct xen_domctl_shadow_op         shadow_op;
1201
        struct xen_domctl_max_mem           max_mem;
1202
        struct xen_domctl_vcpucontext       vcpucontext;
1203
        struct xen_domctl_getvcpuinfo       getvcpuinfo;
1204
        struct xen_domctl_max_vcpus         max_vcpus;
1205
        struct xen_domctl_scheduler_op      scheduler_op;
1206
        struct xen_domctl_setdomainhandle   setdomainhandle;
1207
        struct xen_domctl_setdebugging      setdebugging;
1208
        struct xen_domctl_irq_permission    irq_permission;
1209
        struct xen_domctl_iomem_permission  iomem_permission;
1210
        struct xen_domctl_ioport_permission ioport_permission;
1211
        struct xen_domctl_hypercall_init    hypercall_init;
1212
        struct xen_domctl_settimeoffset     settimeoffset;
1213
        struct xen_domctl_disable_migrate   disable_migrate;
1214
        struct xen_domctl_tsc_info          tsc_info;
1215
        struct xen_domctl_hvmcontext        hvmcontext;
1216
        struct xen_domctl_hvmcontext_partial hvmcontext_partial;
1217
        struct xen_domctl_address_size      address_size;
1218
        struct xen_domctl_sendtrigger       sendtrigger;
1219
        struct xen_domctl_get_device_group  get_device_group;
1220
        struct xen_domctl_assign_device     assign_device;
1221
        struct xen_domctl_bind_pt_irq       bind_pt_irq;
1222
        struct xen_domctl_memory_mapping    memory_mapping;
1223
        struct xen_domctl_ioport_mapping    ioport_mapping;
1224
        struct xen_domctl_pin_mem_cacheattr pin_mem_cacheattr;
1225
        struct xen_domctl_ext_vcpucontext   ext_vcpucontext;
1226
        struct xen_domctl_set_target        set_target;
1227
        struct xen_domctl_subscribe         subscribe;
1228
        struct xen_domctl_debug_op          debug_op;
1229
        struct xen_domctl_vm_event_op       vm_event_op;
1230
        struct xen_domctl_mem_sharing_op    mem_sharing_op;
1231
#if defined(__i386__) || defined(__x86_64__)
1232
        struct xen_domctl_cpuid             cpuid;
1233
        struct xen_domctl_vcpuextstate      vcpuextstate;
1234
        struct xen_domctl_vcpu_msrs         vcpu_msrs;
1235
#endif
1236
        struct xen_domctl_set_access_required access_required;
1237
        struct xen_domctl_audit_p2m         audit_p2m;
1238
        struct xen_domctl_set_virq_handler  set_virq_handler;
1239
        struct xen_domctl_set_max_evtchn    set_max_evtchn;
1240
        struct xen_domctl_gdbsx_memio       gdbsx_guest_memio;
1241
        struct xen_domctl_set_broken_page_p2m set_broken_page_p2m;
1242
        struct xen_domctl_cacheflush        cacheflush;
1243
        struct xen_domctl_gdbsx_pauseunp_vcpu gdbsx_pauseunp_vcpu;
1244
        struct xen_domctl_gdbsx_domstatus   gdbsx_domstatus;
1245
        struct xen_domctl_vnuma             vnuma;
1246
        struct xen_domctl_psr_cmt_op        psr_cmt_op;
1247
        struct xen_domctl_monitor_op        monitor_op;
1248
        struct xen_domctl_psr_cat_op        psr_cat_op;
1249
        struct xen_domctl_set_gnttab_limits set_gnttab_limits;
1250
        struct xen_domctl_vuart_op          vuart_op;
1251
        uint8_t                             pad[128];
1252
    } u;
1253
};
1254
typedef struct xen_domctl xen_domctl_t;
1255
DEFINE_XEN_GUEST_HANDLE(xen_domctl_t);
1256
1257
#endif /* __XEN_PUBLIC_DOMCTL_H__ */
1258
1259
/*
1260
 * Local variables:
1261
 * mode: C
1262
 * c-file-style: "BSD"
1263
 * c-basic-offset: 4
1264
 * tab-width: 4
1265
 * indent-tabs-mode: nil
1266
 * End:
1267
 */