Home | History | Annotate | Download | only in vki
      1 #ifndef __VKI_XEN_DOMCTL_H
      2 #define __VKI_XEN_DOMCTL_H
      3 
      4 /*
      5  * The domctl interface is versioned via the interface_version
      6  * field. This structures in this header supports domctl interfaces:
      7  *
      8  * - 00000007: Xen 4.1
      9  * - 00000008: Xen 4.2
     10  * - 00000009: Xen 4.3
     11  *
     12  * When adding a new subop be sure to include the variants used by all
     13  * of the above, both here and in syswrap-xen.c
     14  *
     15  * Structs which are identical in all supported versions have no
     16  * version suffix. Structs which do differ are defined multiple times
     17  * and use the suffix of the latest version to contain that particular
     18  * variant.
     19  */
     20 
     21 #define VKI_XEN_DOMCTL_createdomain                   1
     22 #define VKI_XEN_DOMCTL_destroydomain                  2
     23 #define VKI_XEN_DOMCTL_pausedomain                    3
     24 #define VKI_XEN_DOMCTL_unpausedomain                  4
     25 #define VKI_XEN_DOMCTL_getdomaininfo                  5
     26 #define VKI_XEN_DOMCTL_getmemlist                     6
     27 #define VKI_XEN_DOMCTL_getpageframeinfo               7
     28 #define VKI_XEN_DOMCTL_getpageframeinfo2              8
     29 #define VKI_XEN_DOMCTL_setvcpuaffinity                9
     30 #define VKI_XEN_DOMCTL_shadow_op                     10
     31 #define VKI_XEN_DOMCTL_max_mem                       11
     32 #define VKI_XEN_DOMCTL_setvcpucontext                12
     33 #define VKI_XEN_DOMCTL_getvcpucontext                13
     34 #define VKI_XEN_DOMCTL_getvcpuinfo                   14
     35 #define VKI_XEN_DOMCTL_max_vcpus                     15
     36 #define VKI_XEN_DOMCTL_scheduler_op                  16
     37 #define VKI_XEN_DOMCTL_setdomainhandle               17
     38 #define VKI_XEN_DOMCTL_setdebugging                  18
     39 #define VKI_XEN_DOMCTL_irq_permission                19
     40 #define VKI_XEN_DOMCTL_iomem_permission              20
     41 #define VKI_XEN_DOMCTL_ioport_permission             21
     42 #define VKI_XEN_DOMCTL_hypercall_init                22
     43 #define VKI_XEN_DOMCTL_arch_setup                    23
     44 #define VKI_XEN_DOMCTL_settimeoffset                 24
     45 #define VKI_XEN_DOMCTL_getvcpuaffinity               25
     46 #define VKI_XEN_DOMCTL_real_mode_area                26
     47 #define VKI_XEN_DOMCTL_resumedomain                  27
     48 #define VKI_XEN_DOMCTL_sendtrigger                   28
     49 #define VKI_XEN_DOMCTL_subscribe                     29
     50 #define VKI_XEN_DOMCTL_gethvmcontext                 33
     51 #define VKI_XEN_DOMCTL_sethvmcontext                 34
     52 #define VKI_XEN_DOMCTL_set_address_size              35
     53 #define VKI_XEN_DOMCTL_get_address_size              36
     54 #define VKI_XEN_DOMCTL_assign_device                 37
     55 #define VKI_XEN_DOMCTL_bind_pt_irq                   38
     56 #define VKI_XEN_DOMCTL_memory_mapping                39
     57 #define VKI_XEN_DOMCTL_ioport_mapping                40
     58 #define VKI_XEN_DOMCTL_pin_mem_cacheattr             41
     59 #define VKI_XEN_DOMCTL_set_ext_vcpucontext           42
     60 #define VKI_XEN_DOMCTL_get_ext_vcpucontext           43
     61 #define VKI_XEN_DOMCTL_set_opt_feature               44 /*Obsolete IA64 only */
     62 #define VKI_XEN_DOMCTL_test_assign_device            45
     63 #define VKI_XEN_DOMCTL_set_target                    46
     64 #define VKI_XEN_DOMCTL_deassign_device               47
     65 #define VKI_XEN_DOMCTL_unbind_pt_irq                 48
     66 #define VKI_XEN_DOMCTL_set_cpuid                     49
     67 #define VKI_XEN_DOMCTL_get_device_group              50
     68 #define VKI_XEN_DOMCTL_set_machine_address_size      51
     69 #define VKI_XEN_DOMCTL_get_machine_address_size      52
     70 #define VKI_XEN_DOMCTL_suppress_spurious_page_faults 53
     71 #define VKI_XEN_DOMCTL_debug_op                      54
     72 #define VKI_XEN_DOMCTL_gethvmcontext_partial         55
     73 #define VKI_XEN_DOMCTL_mem_event_op                  56
     74 #define VKI_XEN_DOMCTL_mem_sharing_op                57
     75 #define VKI_XEN_DOMCTL_disable_migrate               58
     76 #define VKI_XEN_DOMCTL_gettscinfo                    59
     77 #define VKI_XEN_DOMCTL_settscinfo                    60
     78 #define VKI_XEN_DOMCTL_getpageframeinfo3             61
     79 #define VKI_XEN_DOMCTL_setvcpuextstate               62
     80 #define VKI_XEN_DOMCTL_getvcpuextstate               63
     81 #define VKI_XEN_DOMCTL_set_access_required           64
     82 #define VKI_XEN_DOMCTL_audit_p2m                     65
     83 #define VKI_XEN_DOMCTL_set_virq_handler              66
     84 #define VKI_XEN_DOMCTL_set_broken_page_p2m           67
     85 #define VKI_XEN_DOMCTL_setnodeaffinity               68
     86 #define VKI_XEN_DOMCTL_getnodeaffinity               69
     87 #define VKI_XEN_DOMCTL_set_max_evtchn                70
     88 #define VKI_XEN_DOMCTL_cacheflush                    71
     89 #define VKI_XEN_DOMCTL_gdbsx_guestmemio            1000
     90 #define VKI_XEN_DOMCTL_gdbsx_pausevcpu             1001
     91 #define VKI_XEN_DOMCTL_gdbsx_unpausevcpu           1002
     92 #define VKI_XEN_DOMCTL_gdbsx_domstatus             1003
     93 
     94 struct vki_xen_domctl_createdomain {
     95     /* IN parameters */
     96     vki_uint32_t ssidref;
     97     vki_xen_domain_handle_t handle;
     98     vki_uint32_t flags;
     99 };
    100 
    101 struct vki_xen_domctl_getdomaininfo_00000007 {
    102     /* OUT variables. */
    103     vki_xen_domid_t  domain;
    104     vki_uint32_t flags;
    105     vki_xen_uint64_aligned_t tot_pages;
    106     vki_xen_uint64_aligned_t max_pages;
    107     vki_xen_uint64_aligned_t shr_pages;
    108     vki_xen_uint64_aligned_t paged_pages;
    109     vki_xen_uint64_aligned_t shared_info_frame;
    110     vki_xen_uint64_aligned_t cpu_time;
    111     vki_uint32_t nr_online_vcpus;
    112     vki_uint32_t max_vcpu_id;
    113     vki_uint32_t ssidref;
    114     vki_xen_domain_handle_t handle;
    115     vki_uint32_t cpupool;
    116 };
    117 typedef struct vki_xen_domctl_getdomaininfo_00000007 vki_xen_domctl_getdomaininfo_00000007_t;
    118 DEFINE_VKI_XEN_GUEST_HANDLE(vki_xen_domctl_getdomaininfo_00000007_t);
    119 
    120 struct vki_xen_domctl_getdomaininfo_00000008 {
    121     /* OUT variables. */
    122     vki_xen_domid_t  domain;
    123     vki_uint32_t flags;
    124     vki_xen_uint64_aligned_t tot_pages;
    125     vki_xen_uint64_aligned_t max_pages;
    126     vki_xen_uint64_aligned_t shr_pages;
    127     vki_xen_uint64_aligned_t paged_pages;
    128     vki_xen_uint64_aligned_t shared_info_frame;
    129     vki_xen_uint64_aligned_t cpu_time;
    130     vki_uint32_t nr_online_vcpus;
    131     vki_uint32_t max_vcpu_id;
    132     vki_uint32_t ssidref;
    133     vki_xen_domain_handle_t handle;
    134     vki_uint32_t cpupool;
    135 };
    136 typedef struct vki_xen_domctl_getdomaininfo_00000008 vki_xen_domctl_getdomaininfo_00000008_t;
    137 DEFINE_VKI_XEN_GUEST_HANDLE(vki_xen_domctl_getdomaininfo_00000008_t);
    138 
    139 struct vki_xen_domctl_getdomaininfo_00000009 {
    140     /* OUT variables. */
    141     vki_xen_domid_t  domain;
    142     vki_uint32_t flags;
    143     vki_xen_uint64_aligned_t tot_pages;
    144     vki_xen_uint64_aligned_t max_pages;
    145     vki_xen_uint64_aligned_t outstanding_pages;
    146     vki_xen_uint64_aligned_t shr_pages;
    147     vki_xen_uint64_aligned_t paged_pages;
    148     vki_xen_uint64_aligned_t shared_info_frame;
    149     vki_xen_uint64_aligned_t cpu_time;
    150     vki_uint32_t nr_online_vcpus;
    151     vki_uint32_t max_vcpu_id;
    152     vki_uint32_t ssidref;
    153     vki_xen_domain_handle_t handle;
    154     vki_uint32_t cpupool;
    155 };
    156 typedef struct vki_xen_domctl_getdomaininfo_00000009 vki_xen_domctl_getdomaininfo_00000009_t;
    157 DEFINE_VKI_XEN_GUEST_HANDLE(vki_xen_domctl_getdomaininfo_00000009_t);
    158 
    159 /* Get/set the NUMA node(s) with which the guest has affinity with. */
    160 /* XEN_DOMCTL_setnodeaffinity */
    161 /* XEN_DOMCTL_getnodeaffinity */
    162 struct vki_xen_domctl_nodeaffinity {
    163     struct vki_xenctl_bitmap nodemap;/* IN */
    164 };
    165 typedef struct vki_xen_domctl_nodeaffinity vki_xen_domctl_nodeaffinity_t;
    166 DEFINE_VKI_XEN_GUEST_HANDLE(vki_xen_domctl_nodeaffinity_t);
    167 
    168 struct vki_xen_domctl_getpageframeinfo3 {
    169     vki_xen_uint64_aligned_t num; /* IN */
    170     VKI_XEN_GUEST_HANDLE_64(vki_xen_pfn_t) array; /* IN/OUT */
    171 };
    172 
    173 struct vki_xen_domctl_vcpuaffinity {
    174     vki_uint32_t  vcpu;              /* IN */
    175     struct vki_xenctl_bitmap cpumap; /* IN/OUT */
    176 };
    177 
    178 struct vki_xen_domctl_shadow_op_stats {
    179     vki_uint32_t fault_count;
    180     vki_uint32_t dirty_count;
    181 };
    182 
    183 /* vki_xen_domctl_shadow_op.op is an utter mess for compatibily reasons. */
    184 
    185 struct vki_xen_domctl_shadow_op {
    186     vki_uint32_t op; /* IN */
    187 
    188 #define VKI_XEN_DOMCTL_SHADOW_OP_OFF               0
    189 #define VKI_XEN_DOMCTL_SHADOW_OP_ENABLE           32
    190 #define VKI_XEN_DOMCTL_SHADOW_OP_CLEAN            11
    191 #define VKI_XEN_DOMCTL_SHADOW_OP_PEEK             12
    192 #define VKI_XEN_DOMCTL_SHADOW_OP_GET_ALLOCATION   30
    193 #define VKI_XEN_DOMCTL_SHADOW_OP_SET_ALLOCATION   31
    194 
    195 #define VKI_XEN_DOMCTL_SHADOW_OP_ENABLE_TEST       1
    196 #define VKI_XEN_DOMCTL_SHADOW_OP_ENABLE_LOGDIRTY   2
    197 #define VKI_XEN_DOMCTL_SHADOW_OP_ENABLE_TRANSLATE  3
    198 
    199     vki_uint32_t mode;
    200 
    201 #define XEN_DOMCTL_SHADOW_ENABLE_REFCOUNT  (1 << 1)
    202 #define XEN_DOMCTL_SHADOW_ENABLE_LOG_DIRTY (1 << 2)
    203 #define XEN_DOMCTL_SHADOW_ENABLE_TRANSLATE (1 << 3)
    204 #define XEN_DOMCTL_SHADOW_ENABLE_EXTERNAL  (1 << 4)
    205 
    206     vki_uint32_t mb;
    207     VKI_XEN_GUEST_HANDLE_64(vki_uint8) dirty_bitmap;
    208     vki_xen_uint64_aligned_t pages;
    209     struct vki_xen_domctl_shadow_op_stats stats;
    210 };
    211 
    212 struct vki_xen_domctl_max_mem {
    213     /* IN variables. */
    214     vki_xen_uint64_aligned_t max_memkb;
    215 };
    216 
    217 struct vki_xen_domctl_vcpucontext {
    218     vki_uint32_t              vcpu;                  /* IN */
    219     VKI_XEN_GUEST_HANDLE_64(vki_xen_vcpu_guest_context_t) ctxt; /* IN/OUT */
    220 };
    221 
    222 struct vki_xen_domctl_getvcpuinfo {
    223     /* IN variables. */
    224     vki_uint32_t vcpu;
    225     /* OUT variables. */
    226     vki_uint8_t  online;              /* currently online (not hotplugged)? */
    227     vki_uint8_t  blocked;             /* blocked waiting for an event? */
    228     vki_uint8_t  running;             /* currently scheduled on its CPU? */
    229     vki_xen_uint64_aligned_t cpu_time;/* total cpu time consumed (ns) */
    230     vki_uint32_t cpu;                 /* current mapping   */
    231 };
    232 
    233 struct vki_xen_domctl_scheduler_op {
    234     vki_uint32_t sched_id;  /* VKI_XEN_SCHEDULER_* */
    235 #define VKI_XEN_SCHEDULER_SEDF     4
    236 #define VKI_XEN_SCHEDULER_CREDIT   5
    237 #define VKI_XEN_SCHEDULER_CREDIT2  6
    238 #define VKI_XEN_SCHEDULER_ARINC653 7
    239     vki_uint32_t cmd;       /* VKI_XEN_DOMCTL_SCHEDOP_* */
    240 #define VKI_XEN_DOMCTL_SCHEDOP_putinfo 0
    241 #define VKI_XEN_DOMCTL_SCHEDOP_getinfo 1
    242     union {
    243         struct xen_domctl_sched_sedf {
    244             vki_xen_uint64_aligned_t period;
    245             vki_xen_uint64_aligned_t slice;
    246             vki_xen_uint64_aligned_t latency;
    247             vki_uint32_t extratime;
    248             vki_uint32_t weight;
    249         } sedf;
    250         struct xen_domctl_sched_credit {
    251             vki_uint16_t weight;
    252             vki_uint16_t cap;
    253         } credit;
    254         struct xen_domctl_sched_credit2 {
    255             vki_uint16_t weight;
    256         } credit2;
    257     } u;
    258 };
    259 
    260 struct vki_xen_domctl_max_vcpus {
    261     vki_uint32_t max;           /* maximum number of vcpus */
    262 };
    263 
    264 struct vki_xen_domctl_hypercall_init {
    265     vki_xen_uint64_aligned_t  gmfn;           /* GMFN to be initialised */
    266 };
    267 
    268 struct vki_xen_domctl_settimeoffset {
    269     vki_int32_t time_offset_seconds;
    270 };
    271 
    272 struct vki_xen_domctl_cpuid {
    273   vki_uint32_t input[2];
    274   vki_uint32_t eax;
    275   vki_uint32_t ebx;
    276   vki_uint32_t ecx;
    277   vki_uint32_t edx;
    278 };
    279 
    280 struct vki_xen_guest_tsc_info {
    281     vki_uint32_t tsc_mode;
    282     vki_uint32_t gtsc_khz;
    283     vki_uint32_t incarnation;
    284     vki_uint32_t pad;
    285     vki_xen_uint64_aligned_t elapsed_nsec;
    286 };
    287 typedef struct vki_xen_guest_tsc_info vki_xen_guest_tsc_info_t;
    288 DEFINE_VKI_XEN_GUEST_HANDLE(vki_xen_guest_tsc_info_t);
    289 
    290 struct vki_xen_domctl_hvmcontext {
    291     vki_uint32_t size; /* IN/OUT size of buffer */
    292     VKI_XEN_GUEST_HANDLE_64(vki_uint8) buffer; /* IN/OUT */
    293 };
    294 typedef struct vki_xen_domctl_hvmcontext vki_xen_domctl_hvmcontext_t;
    295 DEFINE_VKI_XEN_GUEST_HANDLE(vki_xen_domctl_hvmcontext_t);
    296 
    297 struct vki_xen_domctl_tsc_info {
    298     VKI_XEN_GUEST_HANDLE_64(vki_xen_guest_tsc_info_t) out_info; /* OUT */
    299     vki_xen_guest_tsc_info_t info; /* IN */
    300 };
    301 
    302 struct vki_xen_domctl_vcpuextstate {
    303     vki_uint32_t         vcpu;
    304     vki_xen_uint64_aligned_t         xfeature_mask;
    305     vki_xen_uint64_aligned_t         size;
    306     VKI_XEN_GUEST_HANDLE_64(vki_uint64) buffer;
    307 };
    308 
    309 struct vki_xen_domctl_address_size {
    310     vki_uint32_t size;
    311 };
    312 
    313 struct vki_xen_domctl_set_max_evtchn {
    314     vki_uint32_t max_port;
    315 };
    316 
    317 struct vki_xen_domctl_cacheflush {
    318     /* IN: page range to flush. */
    319     vki_xen_pfn_t start_pfn, nr_pfns;
    320 };
    321 
    322 struct vki_xen_domctl {
    323     vki_uint32_t cmd;
    324     vki_uint32_t interface_version; /* XEN_DOMCTL_INTERFACE_VERSION */
    325     vki_xen_domid_t  domain;
    326     union {
    327         struct vki_xen_domctl_createdomain      createdomain;
    328         struct vki_xen_domctl_getdomaininfo_00000007 getdomaininfo_00000007;
    329         struct vki_xen_domctl_getdomaininfo_00000008 getdomaininfo_00000008;
    330         struct vki_xen_domctl_getdomaininfo_00000009 getdomaininfo_00000009;
    331         //struct vki_xen_domctl_getmemlist        getmemlist;
    332         //struct vki_xen_domctl_getpageframeinfo  getpageframeinfo;
    333         //struct vki_xen_domctl_getpageframeinfo2 getpageframeinfo2;
    334         struct vki_xen_domctl_getpageframeinfo3 getpageframeinfo3;
    335         struct vki_xen_domctl_nodeaffinity      nodeaffinity;
    336         struct vki_xen_domctl_vcpuaffinity      vcpuaffinity;
    337         struct vki_xen_domctl_shadow_op         shadow_op;
    338         struct vki_xen_domctl_max_mem           max_mem;
    339         struct vki_xen_domctl_vcpucontext       vcpucontext;
    340         struct vki_xen_domctl_getvcpuinfo       getvcpuinfo;
    341         struct vki_xen_domctl_max_vcpus         max_vcpus;
    342         struct vki_xen_domctl_scheduler_op      scheduler_op;
    343         //struct vki_xen_domctl_setdomainhandle   setdomainhandle;
    344         //struct vki_xen_domctl_setdebugging      setdebugging;
    345         //struct vki_xen_domctl_irq_permission    irq_permission;
    346         //struct vki_xen_domctl_iomem_permission  iomem_permission;
    347         //struct vki_xen_domctl_ioport_permission ioport_permission;
    348         struct vki_xen_domctl_hypercall_init    hypercall_init;
    349         //struct vki_xen_domctl_arch_setup        arch_setup;
    350         struct vki_xen_domctl_settimeoffset     settimeoffset;
    351         //struct vki_xen_domctl_disable_migrate   disable_migrate;
    352         struct vki_xen_domctl_tsc_info          tsc_info;
    353         //struct vki_xen_domctl_real_mode_area    real_mode_area;
    354         struct vki_xen_domctl_hvmcontext        hvmcontext;
    355         //struct vki_xen_domctl_hvmcontext_partial hvmcontext_partial;
    356         struct vki_xen_domctl_address_size      address_size;
    357         //struct vki_xen_domctl_sendtrigger       sendtrigger;
    358         //struct vki_xen_domctl_get_device_group  get_device_group;
    359         //struct vki_xen_domctl_assign_device     assign_device;
    360         //struct vki_xen_domctl_bind_pt_irq       bind_pt_irq;
    361         //struct vki_xen_domctl_memory_mapping    memory_mapping;
    362         //struct vki_xen_domctl_ioport_mapping    ioport_mapping;
    363         //struct vki_xen_domctl_pin_mem_cacheattr pin_mem_cacheattr;
    364         //struct vki_xen_domctl_ext_vcpucontext   ext_vcpucontext;
    365         //struct vki_xen_domctl_set_target        set_target;
    366         //struct vki_xen_domctl_subscribe         subscribe;
    367         //struct vki_xen_domctl_debug_op          debug_op;
    368         //struct vki_xen_domctl_mem_event_op      mem_event_op;
    369         //struct vki_xen_domctl_mem_sharing_op    mem_sharing_op;
    370 #if defined(__i386__) || defined(__x86_64__)
    371         struct vki_xen_domctl_cpuid             cpuid;
    372         struct vki_xen_domctl_vcpuextstate      vcpuextstate;
    373 #endif
    374         //struct vki_xen_domctl_set_access_required access_required;
    375         //struct vki_xen_domctl_audit_p2m         audit_p2m;
    376         //struct vki_xen_domctl_set_virq_handler  set_virq_handler;
    377         struct vki_xen_domctl_set_max_evtchn    set_max_evtchn;
    378         //struct vki_xen_domctl_gdbsx_memio       gdbsx_guest_memio;
    379         //struct vki_xen_domctl_set_broken_page_p2m set_broken_page_p2m;
    380         struct vki_xen_domctl_cacheflush        cacheflush;
    381         //struct vki_xen_domctl_gdbsx_pauseunp_vcpu gdbsx_pauseunp_vcpu;
    382         //struct vki_xen_domctl_gdbsx_domstatus   gdbsx_domstatus;
    383         vki_uint8_t                         pad[128];
    384     } u;
    385 };
    386 
    387 #endif // __VKI_XEN_DOMCTL_H
    388 
    389 /*--------------------------------------------------------------------*/
    390 /*--- end                                                          ---*/
    391 /*--------------------------------------------------------------------*/
    392