1# -*- python -*-
2#
3# Builtin libxl types
4#
5
6namespace("libxl_")
7
8libxl_defbool = Builtin("defbool", json_parse_type="JSON_STRING", passby=PASS_BY_REFERENCE, copy_fn=None,
9                        check_default_fn="libxl__defbool_is_default")
10libxl_domid = Builtin("domid", json_gen_fn = "yajl_gen_integer", json_parse_fn = "libxl__uint32_parse_json",
11                      json_parse_type = "JSON_INTEGER", autogenerate_json = False, copy_fn=None)
12libxl_devid = Builtin("devid", json_gen_fn = "yajl_gen_integer", json_parse_fn = "libxl__int_parse_json",
13                      json_parse_type = "JSON_INTEGER", autogenerate_json = False, signed = True, init_val="-1",
14                      copy_fn=None)
15libxl_uuid = Builtin("uuid", json_parse_type="JSON_STRING", passby=PASS_BY_REFERENCE, check_default_fn="libxl_uuid_is_nil",
16                     copy_fn="libxl_uuid_copy")
17libxl_mac = Builtin("mac", json_parse_type="JSON_STRING", passby=PASS_BY_REFERENCE, check_default_fn="libxl__mac_is_default",
18                    copy_fn="libxl_mac_copy")
19libxl_bitmap = Builtin("bitmap", json_parse_type="JSON_ARRAY", dispose_fn="libxl_bitmap_dispose", passby=PASS_BY_REFERENCE,
20                       check_default_fn="libxl_bitmap_is_empty", copy_fn="libxl_bitmap_copy_alloc")
21libxl_cpuid_policy_list = Builtin("cpuid_policy_list", dispose_fn="libxl_cpuid_dispose", passby=PASS_BY_REFERENCE,
22                                  json_parse_type="JSON_ANY", check_default_fn="libxl__cpuid_policy_is_empty",
23                                  copy_fn="libxl_cpuid_policy_list_copy")
24
25libxl_string_list = Builtin("string_list", dispose_fn="libxl_string_list_dispose", passby=PASS_BY_REFERENCE,
26                            json_parse_type="JSON_ARRAY", check_default_fn="libxl__string_list_is_empty",
27                            copy_fn="libxl_string_list_copy")
28libxl_key_value_list = Builtin("key_value_list", dispose_fn="libxl_key_value_list_dispose", passby=PASS_BY_REFERENCE,
29                               json_parse_type="JSON_MAP", check_default_fn="libxl__key_value_list_is_empty",
30                               copy_fn="libxl_key_value_list_copy")
31libxl_hwcap = Builtin("hwcap", passby=PASS_BY_REFERENCE, json_parse_type="JSON_ARRAY",
32                      check_default_fn="libxl__hwcap_is_default", copy_fn="libxl_hwcap_copy")
33libxl_ms_vm_genid = Builtin("ms_vm_genid", passby=PASS_BY_REFERENCE, check_default_fn="libxl_ms_vm_genid_is_zero",
34                            copy_fn="libxl_ms_vm_genid_copy")
35
36#
37# Specific integer types
38#
39
40MemKB = UInt(64, init_val = "LIBXL_MEMKB_DEFAULT", json_gen_fn = "libxl__uint64_gen_json")
41
42#
43# Constants / Enumerations
44#
45
46libxl_error = Enumeration("error", [
47    (-1, "NONSPECIFIC"),
48    (-2, "VERSION"),
49    (-3, "FAIL"),
50    (-4, "NI"),
51    (-5, "NOMEM"),
52    (-6, "INVAL"),
53    (-7, "BADFAIL"),
54    (-8, "GUEST_TIMEDOUT"),
55    (-9, "TIMEDOUT"),
56    (-10, "NOPARAVIRT"),
57    (-11, "NOT_READY"),
58    (-12, "OSEVENT_REG_FAIL"),
59    (-13, "BUFFERFULL"),
60    (-14, "UNKNOWN_CHILD"),
61    (-15, "LOCK_FAIL"),
62    (-16, "JSON_CONFIG_EMPTY"),
63    (-17, "DEVICE_EXISTS"),
64    (-18, "CHECKPOINT_DEVOPS_DOES_NOT_MATCH"),
65    (-19, "CHECKPOINT_DEVICE_NOT_SUPPORTED"),
66    (-20, "VNUMA_CONFIG_INVALID"),
67    (-21, "DOMAIN_NOTFOUND"),
68    (-22, "ABORTED"),
69    (-23, "NOTFOUND"),
70    (-24, "DOMAIN_DESTROYED"), # Target domain ceased to exist during op
71    (-25, "FEATURE_REMOVED"), # For functionality that has been removed
72    (-26, "PROTOCOL_ERROR_QMP"),
73    (-27, "UNKNOWN_QMP_ERROR"),
74    (-28, "QMP_GENERIC_ERROR"), # unspecified qmp error
75    (-29, "QMP_COMMAND_NOT_FOUND"), # the requested command has not been found
76    (-30, "QMP_DEVICE_NOT_ACTIVE"), # a device has failed to be become active
77    (-31, "QMP_DEVICE_NOT_FOUND"), # the requested device has not been found
78    (-32, "QEMU_API"), # QEMU's replies don't contains expected members
79    ], value_namespace = "")
80
81libxl_domain_type = Enumeration("domain_type", [
82    (-1, "INVALID"),
83    (1, "HVM"),
84    (2, "PV"),
85    (3, "PVH"),
86    ], init_val = "LIBXL_DOMAIN_TYPE_INVALID")
87
88libxl_rdm_reserve_strategy = Enumeration("rdm_reserve_strategy", [
89    (0, "ignore"),
90    (1, "host"),
91    ])
92
93libxl_rdm_reserve_policy = Enumeration("rdm_reserve_policy", [
94    (-1, "invalid"),
95    (0, "strict"),
96    (1, "relaxed"),
97    ], init_val = "LIBXL_RDM_RESERVE_POLICY_INVALID")
98
99libxl_channel_connection = Enumeration("channel_connection", [
100    (0, "UNKNOWN"),
101    (1, "PTY"),
102    (2, "SOCKET"), # a listening Unix domain socket
103    ])
104
105libxl_device_model_version = Enumeration("device_model_version", [
106    (0, "UNKNOWN"),
107    (1, "QEMU_XEN_TRADITIONAL"), # Historical dm (qemu-dm, no longer supported)
108    (2, "QEMU_XEN"),             # Upstream based qemu-xen device model
109    ])
110
111libxl_console_type = Enumeration("console_type", [
112    (0, "UNKNOWN"),
113    (1, "SERIAL"),
114    (2, "PV"),
115    (3, "VUART"),
116    ])
117
118libxl_disk_format = Enumeration("disk_format", [
119    (0, "UNKNOWN"),
120    (1, "QCOW"),
121    (2, "QCOW2"),
122    (3, "VHD"),
123    (4, "RAW"),
124    (5, "EMPTY"),
125    (6, "QED"),
126    ])
127
128libxl_disk_backend = Enumeration("disk_backend", [
129    (0, "UNKNOWN"),
130    (1, "PHY"),
131    (2, "TAP"),
132    (3, "QDISK"),
133    (4, "STANDALONE"), # Only relying on the Xenstore data
134    ])
135
136libxl_disk_specification = Enumeration("disk_specification", [
137    (0, "UNKNOWN"),
138    (1, "XEN"),
139    (2, "VIRTIO"),
140    ])
141
142libxl_disk_transport = Enumeration("disk_transport", [
143    (0, "UNKNOWN"),
144    (1, "MMIO"),
145    ])
146
147libxl_nic_type = Enumeration("nic_type", [
148    (0, "UNKNOWN"),
149    (1, "VIF_IOEMU"),
150    (2, "VIF"),
151    ])
152
153libxl_p9_type = Enumeration("p9_type", [
154    (0, "unknown"),
155    (1, "qemu"),
156    (2, "xen_9pfsd"),
157    ])
158
159libxl_action_on_shutdown = Enumeration("action_on_shutdown", [
160    (1, "DESTROY"),
161
162    (2, "RESTART"),
163    (3, "RESTART_RENAME"),
164
165    (4, "PRESERVE"),
166
167    (5, "COREDUMP_DESTROY"),
168    (6, "COREDUMP_RESTART"),
169
170    (7, "SOFT_RESET"),
171    ], init_val = "LIBXL_ACTION_ON_SHUTDOWN_DESTROY")
172
173libxl_trigger = Enumeration("trigger", [
174    (0, "UNKNOWN"),
175    (1, "POWER"),
176    (2, "SLEEP"),
177    (3, "NMI"),
178    (4, "INIT"),
179    (5, "RESET"),
180    (6, "S3RESUME"),
181    ])
182
183libxl_tsc_mode = Enumeration("tsc_mode", [
184    (0, "default"),
185    (1, "always_emulate"),
186    (2, "native"),
187    (3, "native_paravirt"),
188    ])
189
190libxl_gfx_passthru_kind = Enumeration("gfx_passthru_kind", [
191    (0, "default"),
192    (1, "igd"),
193    ])
194
195# Consistent with the values defined for HVM_PARAM_TIMER_MODE.
196libxl_timer_mode = Enumeration("timer_mode", [
197    (-1, "unknown"),
198    (0, "delay_for_missed_ticks"),
199    (1, "no_delay_for_missed_ticks"),
200    (2, "no_missed_ticks_pending"),
201    (3, "one_missed_tick_pending"),
202    ], init_val = "LIBXL_TIMER_MODE_DEFAULT",
203       check_default_fn = "libxl__timer_mode_is_default")
204
205libxl_bios_type = Enumeration("bios_type", [
206    (0, "unknown"),
207    (1, "rombios"),
208    (2, "seabios"),
209    (3, "ovmf"),
210    ])
211
212# Consistent with values defined in domctl.h
213# Except unknown which we have made up
214libxl_scheduler = Enumeration("scheduler", [
215    (0, "unknown"),
216    (4, "sedf"),
217    (5, "credit"),
218    (6, "credit2"),
219    (7, "arinc653"),
220    (8, "rtds"),
221    (9, "null"),
222    ])
223
224# Consistent with SHUTDOWN_* in sched.h (apart from UNKNOWN)
225libxl_shutdown_reason = Enumeration("shutdown_reason", [
226    (-1, "unknown"),
227    (0, "poweroff"),
228    (1, "reboot"),
229    (2, "suspend"),
230    (3, "crash"),
231    (4, "watchdog"),
232    (5, "soft_reset"),
233    ], init_val = "LIBXL_SHUTDOWN_REASON_UNKNOWN")
234
235libxl_vga_interface_type = Enumeration("vga_interface_type", [
236    (0, "UNKNOWN"),
237    (1, "CIRRUS"),
238    (2, "STD"),
239    (3, "NONE"),
240    (4, "QXL"),
241    ], init_val = "LIBXL_VGA_INTERFACE_TYPE_UNKNOWN")
242
243libxl_vendor_device = Enumeration("vendor_device", [
244    (0, "NONE"),
245    (1, "XENSERVER"),
246    ])
247
248libxl_viridian_enlightenment = Enumeration("viridian_enlightenment", [
249    (0, "base"),
250    (1, "freq"),
251    (2, "time_ref_count"),
252    (3, "reference_tsc"),
253    (4, "hcall_remote_tlb_flush"),
254    (5, "apic_assist"),
255    (6, "crash_ctl"),
256    (7, "synic"),
257    (8, "stimer"),
258    (9, "hcall_ipi"),
259    (10, "ex_processor_masks"),
260    (11, "no_vp_limit"),
261    (12, "cpu_hotplug"),
262    ])
263
264libxl_hdtype = Enumeration("hdtype", [
265    (1, "IDE"),
266    (2, "AHCI"),
267    ], init_val = "LIBXL_HDTYPE_IDE")
268
269# Consistent with the values defined for migration_stream.
270libxl_checkpointed_stream = Enumeration("checkpointed_stream", [
271    (0, "NONE"),
272    (1, "REMUS"),
273    (2, "COLO"),
274    ])
275
276libxl_vuart_type = Enumeration("vuart_type", [
277    (0, "unknown"),
278    (1, "sbsa_uart"),
279    ])
280
281libxl_vkb_backend = Enumeration("vkb_backend", [
282    (0, "UNKNOWN"),
283    (1, "QEMU"),
284    (2, "LINUX")
285    ])
286
287libxl_virtio_transport = Enumeration("virtio_transport", [
288    (0, "UNKNOWN"),
289    (1, "MMIO"),
290    ])
291
292libxl_passthrough = Enumeration("passthrough", [
293    (0, "default"),
294    (1, "disabled"),
295    (2, "enabled"), # becomes {sync,share}_pt once defaults are evaluated
296    (3, "sync_pt"),
297    (4, "share_pt"),
298    ])
299
300#
301# Complex libxl types
302#
303
304libxl_ioport_range = Struct("ioport_range", [
305    ("first", uint32),
306    ("number", uint32),
307    ])
308
309libxl_iomem_range = Struct("iomem_range", [
310    # start host frame number to be mapped to the guest
311    ("start", uint64),
312    # number of frames to be mapped
313    ("number", uint64),
314    # guest frame number used as a start for the mapping
315    ("gfn", uint64, {'init_val': "LIBXL_INVALID_GFN"}),
316    ])
317
318libxl_vga_interface_info = Struct("vga_interface_info", [
319    ("kind",    libxl_vga_interface_type),
320    ])
321
322libxl_vnc_info = Struct("vnc_info", [
323    ("enable",        libxl_defbool),
324    # "address:port" that should be listened on
325    ("listen",        string),
326    ("passwd",        string),
327    ("display",       integer),
328    # If set then try to find an unused port
329    ("findunused",    libxl_defbool),
330    ])
331
332libxl_spice_info = Struct("spice_info", [
333    ("enable",      libxl_defbool),
334    # At least one of spice port or spicetls_post must be given
335    ("port",        integer),
336    ("tls_port",    integer),
337    # Interface to bind to
338    ("host",        string),
339    # enable client connection with no password
340    ("disable_ticketing", libxl_defbool),
341    ("passwd",      string),
342    ("agent_mouse", libxl_defbool),
343    ("vdagent",     libxl_defbool),
344    ("clipboard_sharing", libxl_defbool),
345    ("usbredirection", integer),
346    ("image_compression", string),
347    ("streaming_video", string),
348    ])
349
350libxl_sdl_info = Struct("sdl_info", [
351    ("enable",        libxl_defbool),
352    ("opengl",        libxl_defbool),
353    ("display",       string),
354    ("xauthority",    string),
355    ])
356
357libxl_dominfo = Struct("dominfo",[
358    ("uuid",        libxl_uuid),
359    ("domid",       libxl_domid),
360    ("ssidref",     uint32),
361    ("ssid_label",  string),
362    ("running",     bool),
363    ("blocked",     bool),
364    ("paused",      bool),
365    ("shutdown",    bool),
366    ("dying",       bool),
367    ("never_stop",  bool),
368
369    # Valid iff ->shutdown is true.
370    #
371    # Otherwise set to a value guaranteed not to clash with any valid
372    # LIBXL_SHUTDOWN_REASON_* constant.
373    ("shutdown_reason", libxl_shutdown_reason),
374    ("outstanding_memkb",  MemKB),
375    ("current_memkb",   MemKB),
376    ("shared_memkb", MemKB),
377    ("paged_memkb", MemKB),
378    ("max_memkb",   MemKB),
379    ("cpu_time",    uint64),
380    ("vcpu_max_id", uint32),
381    ("vcpu_online", uint32),
382    ("cpupool",     uint32),
383    ("gpaddr_bits", uint8),
384    ("domain_type", libxl_domain_type),
385    ], dir=DIR_OUT)
386
387libxl_cpupoolinfo = Struct("cpupoolinfo", [
388    ("poolid",      uint32),
389    ("pool_name",   string),
390    ("sched",       libxl_scheduler),
391    ("n_dom",       uint32),
392    ("cpumap",      libxl_bitmap)
393    ], dir=DIR_OUT)
394
395libxl_channelinfo = Struct("channelinfo", [
396    ("backend", string),
397    ("backend_id", uint32),
398    ("frontend", string),
399    ("frontend_id", uint32),
400    ("devid", libxl_devid),
401    ("state", integer),
402    ("evtch", integer),
403    ("rref", integer),
404    ("u", KeyedUnion(None, libxl_channel_connection, "connection",
405           [("unknown", None),
406            ("pty", Struct(None, [("path", string),])),
407            ("socket", None),
408           ])),
409    ], dir=DIR_OUT)
410
411libxl_vminfo = Struct("vminfo", [
412    ("uuid", libxl_uuid),
413    ("domid", libxl_domid),
414    ], dir=DIR_OUT)
415
416libxl_version_info = Struct("version_info", [
417    ("xen_version_major", integer),
418    ("xen_version_minor", integer),
419    ("xen_version_extra", string),
420    ("compiler",          string),
421    ("compile_by",        string),
422    ("compile_domain",    string),
423    ("compile_date",      string),
424    ("capabilities",      string),
425    ("changeset",         string),
426    ("virt_start",        uint64),
427    ("pagesize",          integer),
428    ("commandline",       string),
429    ("build_id",          string),
430    ], dir=DIR_OUT)
431
432libxl_smbios_type = Enumeration("smbios_type", [
433    (1,  "bios_vendor"),
434    (2,  "bios_version"),
435    (3,  "system_manufacturer"),
436    (4,  "system_product_name"),
437    (5,  "system_version"),
438    (6,  "system_serial_number"),
439    (7,  "baseboard_manufacturer"),
440    (8,  "baseboard_product_name"),
441    (9,  "baseboard_version"),
442    (10, "baseboard_serial_number"),
443    (11, "baseboard_asset_tag"),
444    (12, "baseboard_location_in_chassis"),
445    (13, "enclosure_manufacturer"),
446    (14, "enclosure_serial_number"),
447    (15, "enclosure_asset_tag"),
448    (16, "battery_manufacturer"),
449    (17, "battery_device_name"),
450    (18, "oem"),
451    ])
452
453libxl_smbios = Struct("smbios", [
454    ("key",          libxl_smbios_type),
455    ("value",        string),
456    ], dir=DIR_IN)
457
458libxl_domain_create_info = Struct("domain_create_info",[
459    ("type",         libxl_domain_type),
460    ("hap",          libxl_defbool),
461    ("oos",          libxl_defbool),
462    ("ssidref",      uint32),
463    ("ssid_label",   string),
464    ("name",         string),
465    ("domid",        libxl_domid),
466    ("uuid",         libxl_uuid),
467    ("xsdata",       libxl_key_value_list),
468    ("platformdata", libxl_key_value_list),
469    ("poolid",       uint32),
470    ("pool_name",    string),
471    ("run_hotplug_scripts",libxl_defbool),
472    ("driver_domain",libxl_defbool),
473    ("passthrough",  libxl_passthrough),
474    ("xend_suspend_evtchn_compat",libxl_defbool),
475    ], dir=DIR_IN)
476
477libxl_domain_restore_params = Struct("domain_restore_params", [
478    ("checkpointed_stream", integer),
479    ("stream_version", uint32, {'init_val': '1'}),
480    ("colo_proxy_script", string),
481    ("userspace_colo_proxy", libxl_defbool),
482    ])
483
484libxl_sched_params = Struct("sched_params",[
485    ("vcpuid",       integer, {'init_val': 'LIBXL_SCHED_PARAM_VCPU_INDEX_DEFAULT'}),
486    ("weight",       integer, {'init_val': 'LIBXL_DOMAIN_SCHED_PARAM_WEIGHT_DEFAULT'}),
487    ("cap",          integer, {'init_val': 'LIBXL_DOMAIN_SCHED_PARAM_CAP_DEFAULT'}),
488    ("period",       integer, {'init_val': 'LIBXL_DOMAIN_SCHED_PARAM_PERIOD_DEFAULT'}),
489    ("extratime",    integer, {'init_val': 'LIBXL_DOMAIN_SCHED_PARAM_EXTRATIME_DEFAULT'}),
490    ("budget",       integer, {'init_val': 'LIBXL_DOMAIN_SCHED_PARAM_BUDGET_DEFAULT'}),
491    ])
492
493libxl_vcpu_sched_params = Struct("vcpu_sched_params",[
494    ("sched",        libxl_scheduler),
495    ("vcpus",        Array(libxl_sched_params, "num_vcpus")),
496    ])
497
498libxl_domain_sched_params = Struct("domain_sched_params",[
499    ("sched",        libxl_scheduler),
500    ("weight",       integer, {'init_val': 'LIBXL_DOMAIN_SCHED_PARAM_WEIGHT_DEFAULT'}),
501    ("cap",          integer, {'init_val': 'LIBXL_DOMAIN_SCHED_PARAM_CAP_DEFAULT'}),
502    ("period",       integer, {'init_val': 'LIBXL_DOMAIN_SCHED_PARAM_PERIOD_DEFAULT'}),
503    ("budget",       integer, {'init_val': 'LIBXL_DOMAIN_SCHED_PARAM_BUDGET_DEFAULT'}),
504    ("extratime",    integer, {'init_val': 'LIBXL_DOMAIN_SCHED_PARAM_EXTRATIME_DEFAULT'}),
505
506    # The following three parameters ('slice' and 'latency') are deprecated,
507    # and will have no effect if used, since the SEDF scheduler has been removed.
508    # Note that 'period' and 'extratime' was an SDF parameter too, but it is still effective
509    # as they are now used (together with 'budget') by the RTDS scheduler.
510    ("slice",        integer, {'init_val': 'LIBXL_DOMAIN_SCHED_PARAM_SLICE_DEFAULT'}),
511    ("latency",      integer, {'init_val': 'LIBXL_DOMAIN_SCHED_PARAM_LATENCY_DEFAULT'}),
512    ])
513
514libxl_vnode_info = Struct("vnode_info", [
515    ("memkb", MemKB),
516    ("distances", Array(uint32, "num_distances")), # distances from this node to other nodes
517    ("pnode", uint32), # physical node of this node
518    ("vcpus", libxl_bitmap), # vcpus in this node
519    ])
520
521libxl_gic_version = Enumeration("gic_version", [
522    (0, "DEFAULT"),
523    (0x20, "v2"),
524    (0x30, "v3")
525    ], init_val = "LIBXL_GIC_VERSION_DEFAULT")
526
527libxl_tee_type = Enumeration("tee_type", [
528    (0, "none"),
529    (1, "optee"),
530    (2, "ffa"),
531    ], init_val = "LIBXL_TEE_TYPE_NONE")
532
533libxl_sve_type = Enumeration("sve_type", [
534    (-1, "hw"),
535    (0, "disabled"),
536    (128, "128"),
537    (256, "256"),
538    (384, "384"),
539    (512, "512"),
540    (640, "640"),
541    (768, "768"),
542    (896, "896"),
543    (1024, "1024"),
544    (1152, "1152"),
545    (1280, "1280"),
546    (1408, "1408"),
547    (1536, "1536"),
548    (1664, "1664"),
549    (1792, "1792"),
550    (1920, "1920"),
551    (2048, "2048")
552    ], init_val = "LIBXL_SVE_TYPE_DISABLED")
553
554libxl_rdm_reserve = Struct("rdm_reserve", [
555    ("strategy",    libxl_rdm_reserve_strategy),
556    ("policy",      libxl_rdm_reserve_policy),
557    ])
558
559# Consistent with the values defined for HVM_PARAM_ALTP2M
560libxl_altp2m_mode = Enumeration("altp2m_mode", [
561    (0, "disabled"),
562    (1, "mixed"),
563    (2, "external"),
564    (3, "limited"),
565    ], init_val = "LIBXL_ALTP2M_MODE_DISABLED")
566
567libxl_domain_build_info = Struct("domain_build_info",[
568    ("max_vcpus",       integer),
569    ("avail_vcpus",     libxl_bitmap),
570    ("cpumap",          libxl_bitmap),
571    ("nodemap",         libxl_bitmap),
572    ("vcpu_hard_affinity", Array(libxl_bitmap, "num_vcpu_hard_affinity")),
573    ("vcpu_soft_affinity", Array(libxl_bitmap, "num_vcpu_soft_affinity")),
574    ("numa_placement",  libxl_defbool),
575    ("tsc_mode",        libxl_tsc_mode),
576    ("max_memkb",       MemKB),
577    ("target_memkb",    MemKB),
578    ("video_memkb",     MemKB),
579    ("shadow_memkb",    MemKB),
580    ("iommu_memkb",     MemKB),
581    ("rtc_timeoffset",  uint32),
582    ("exec_ssidref",    uint32),
583    ("exec_ssid_label", string),
584    ("localtime",       libxl_defbool),
585    ("disable_migrate", libxl_defbool),
586    ("cpuid",           libxl_cpuid_policy_list),
587    ("blkdev_start",    string),
588
589    ("vnuma_nodes", Array(libxl_vnode_info, "num_vnuma_nodes")),
590
591    ("max_grant_frames",    uint32, {'init_val': 'LIBXL_MAX_GRANT_DEFAULT'}),
592    ("max_maptrack_frames", uint32, {'init_val': 'LIBXL_MAX_GRANT_DEFAULT'}),
593    ("max_grant_version",   integer, {'init_val': 'LIBXL_MAX_GRANT_DEFAULT'}),
594
595    ("device_model_version", libxl_device_model_version),
596    ("device_model_stubdomain", libxl_defbool),
597    ("stubdomain_memkb",   MemKB),
598    ("stubdomain_kernel",  string),
599    ("stubdomain_cmdline", string),
600    ("stubdomain_ramdisk", string),
601    # if you set device_model you must set device_model_version too
602    ("device_model",     string),
603    ("device_model_ssidref", uint32),
604    ("device_model_ssid_label", string),
605    ("device_model_user", string),
606
607    # extra parameters pass directly to qemu, NULL terminated
608    ("extra",            libxl_string_list),
609    # extra parameters pass directly to qemu for PV guest, NULL terminated
610    ("extra_pv",         libxl_string_list),
611    # extra parameters pass directly to qemu for HVM guest, NULL terminated
612    ("extra_hvm",        libxl_string_list),
613    #  parameters for all type of scheduler
614    ("sched_params",     libxl_domain_sched_params),
615
616    ("ioports",          Array(libxl_ioport_range, "num_ioports")),
617    ("irqs",             Array(uint32, "num_irqs")),
618    ("iomem",            Array(libxl_iomem_range, "num_iomem")),
619    ("llc_colors",       Array(uint32, "num_llc_colors")),
620    ("claim_mode",	     libxl_defbool),
621    ("event_channels",   uint32),
622    ("kernel",           string),
623    ("cmdline",          string),
624    ("ramdisk",          string),
625    # Given the complexity of verifying the validity of a device tree,
626    # libxl doesn't do any security check on it. It's the responsibility
627    # of the caller to provide only trusted device tree.
628    # Note that the partial device tree should avoid to use the phandle
629    # 65000 which is reserved by the toolstack.
630    ("device_tree",      string),
631    ("acpi",             libxl_defbool),
632    ("bootloader",       string),
633    ("bootloader_args",  libxl_string_list),
634    ("bootloader_restrict", libxl_defbool),
635    ("bootloader_user",  string),
636    ("timer_mode",       libxl_timer_mode),
637    ("nested_hvm",       libxl_defbool),
638    ("apic",             libxl_defbool),
639    ("dm_restrict",      libxl_defbool),
640    ("tee",              libxl_tee_type),
641    ("u", KeyedUnion(None, libxl_domain_type, "type",
642                [("hvm", Struct(None, [("firmware",         string),
643                                       ("bios",             libxl_bios_type),
644                                       ("pae",              libxl_defbool),
645                                       ("apic",             libxl_defbool, {'deprecated_by': 'apic'}),
646                                       # The following acpi field is deprecated.
647                                       # Please use the unified acpi field above
648                                       # which works for both x86 and ARM.
649                                       ("acpi",             libxl_defbool),
650                                       ("acpi_s3",          libxl_defbool),
651                                       ("acpi_s4",          libxl_defbool),
652                                       ("acpi_laptop_slate",libxl_defbool),
653                                       ("nx",               libxl_defbool),
654                                       ("viridian",         libxl_defbool),
655                                       ("viridian_enable",  libxl_bitmap),
656                                       ("viridian_disable", libxl_bitmap),
657                                       ("timeoffset",       string),
658                                       ("hpet",             libxl_defbool),
659                                       ("vpt_align",        libxl_defbool),
660                                       ("mmio_hole_memkb",  MemKB),
661                                       ("timer_mode",       libxl_timer_mode, {'deprecated_by': 'timer_mode'}),
662                                       ("nested_hvm",       libxl_defbool, {'deprecated_by': 'nested_hvm'}),
663                                       # The u.hvm.altp2m field is used solely
664                                       # for x86 HVM guests and is maintained
665                                       # for legacy purposes.
666                                       ("altp2m",           libxl_defbool),
667                                       ("system_firmware",  string),
668                                       ("smbios_firmware",  string),
669                                       ("smbios",           Array(libxl_smbios, "num_smbios")),
670                                       ("acpi_firmware",    string),
671                                       ("hdtype",           libxl_hdtype),
672                                       ("nographic",        libxl_defbool),
673                                       ("vga",              libxl_vga_interface_info),
674                                       ("vnc",              libxl_vnc_info),
675                                       # keyboard layout, default is en-us keyboard
676                                       ("keymap",           string),
677                                       ("sdl",              libxl_sdl_info),
678                                       ("spice",            libxl_spice_info),
679
680                                       ("gfx_passthru",     libxl_defbool),
681                                       ("gfx_passthru_kind", libxl_gfx_passthru_kind),
682
683                                       ("serial",           string),
684                                       ("boot",             string),
685                                       ("usb",              libxl_defbool),
686                                       ("usbversion",       integer),
687                                       # usbdevice:
688                                       # - "tablet" for absolute mouse,
689                                       # - "mouse" for PS/2 protocol relative mouse
690                                       ("usbdevice",        string),
691                                       ("vkb_device",       libxl_defbool),
692                                       ("soundhw",          string),
693                                       ("xen_platform_pci", libxl_defbool),
694                                       ("xen_platform_pci_bar_uc", libxl_defbool),
695                                       ("usbdevice_list",   libxl_string_list),
696                                       ("vendor_device",    libxl_vendor_device),
697                                       # See libxl_ms_vm_genid_generate()
698                                       ("ms_vm_genid",      libxl_ms_vm_genid),
699                                       ("serial_list",      libxl_string_list),
700                                       ("rdm", libxl_rdm_reserve),
701                                       ("rdm_mem_boundary_memkb", MemKB),
702                                       ("mca_caps",         uint64),
703                                       ("pirq",             libxl_defbool),
704                                       ])),
705                 ("pv", Struct(None, [("kernel", string, {'deprecated_by': 'kernel'}),
706                                      ("slack_memkb", MemKB),
707                                      ("bootloader", string, {'deprecated_by': 'bootloader'}),
708                                      ("bootloader_args", libxl_string_list, {'deprecated_by': 'bootloader_args'}),
709                                      ("cmdline", string, {'deprecated_by': 'cmdline'}),
710                                      ("ramdisk", string, {'deprecated_by': 'ramdisk'}),
711                                      ("features", string, {'const': True}),
712                                      # Use host's E820 for PCI passthrough.
713                                      ("e820_host", libxl_defbool),
714                                      ])),
715                 ("pvh", Struct(None, [("pvshim", libxl_defbool),
716                                       ("pvshim_path", string),
717                                       ("pvshim_cmdline", string),
718                                       ("pvshim_extra", string), # eg "loglvl=all guest_loglvl=all apic_verbosity=debug e820-verbose"
719                                       ])),
720                 ("invalid", None),
721                 ], keyvar_init_val = "LIBXL_DOMAIN_TYPE_INVALID")),
722
723
724    ("arch_arm", Struct(None, [("gic_version", libxl_gic_version),
725                               ("vuart", libxl_vuart_type),
726                               ("sve_vl", libxl_sve_type),
727                               ("nr_spis", uint32, {'init_val': 'LIBXL_NR_SPIS_DEFAULT'}),
728                              ])),
729    ("arch_x86", Struct(None, [("msr_relaxed", libxl_defbool),
730                              ])),
731    # Alternate p2m is not bound to any architecture or guest type, as it is
732    # supported by x86 HVM and ARM support is planned.
733    ("altp2m", libxl_altp2m_mode),
734    ("altp2m_count", uint32, {'init_val': 'LIBXL_ALTP2M_COUNT_DEFAULT'}),
735
736    # Size of preallocated vmtrace trace buffers (in KBYTES).
737    # Use zero value to disable this feature.
738    ("vmtrace_buf_kb", integer),
739
740    ("vpmu", libxl_defbool),
741    ("trap_unmapped_accesses", libxl_defbool),
742    ("xenstore_feature_mask", uint32, {'init_val': '~0U'}),
743
744    ], dir=DIR_IN,
745       copy_deprecated_fn="libxl__domain_build_info_copy_deprecated",
746)
747
748libxl_device_vfb = Struct("device_vfb", [
749    ("backend_domid", libxl_domid),
750    ("backend_domname",string),
751    ("devid",         libxl_devid),
752    ("vnc",           libxl_vnc_info),
753    ("sdl",           libxl_sdl_info),
754    # set keyboard layout, default is en-us keyboard
755    ("keymap",        string),
756    ])
757
758libxl_device_vkb = Struct("device_vkb", [
759    ("backend_domid", libxl_domid),
760    ("backend_domname", string),
761    ("devid", libxl_devid),
762    ("backend_type", libxl_vkb_backend),
763    ("unique_id", string),
764    ("feature_disable_keyboard", bool),
765    ("feature_disable_pointer", bool),
766    ("feature_abs_pointer", bool),
767    ("feature_raw_pointer", bool),
768    ("feature_multi_touch", bool),
769    ("width", uint32),
770    ("height", uint32),
771    ("multi_touch_width", uint32),
772    ("multi_touch_height", uint32),
773    ("multi_touch_num_contacts", uint32)
774    ])
775
776libxl_device_virtio = Struct("device_virtio", [
777    ("backend_domid", libxl_domid),
778    ("backend_domname", string),
779    ("type", string),
780    ("transport", libxl_virtio_transport),
781    ("grant_usage", libxl_defbool),
782    ("devid", libxl_devid),
783    # Note that virtio-mmio parameters (irq and base) are for internal
784    # use by libxl and can't be modified.
785    ("irq", uint32),
786    ("base", uint64)
787    ])
788
789libxl_device_disk = Struct("device_disk", [
790    ("backend_domid", libxl_domid),
791    ("backend_domname", string),
792    ("pdev_path", string),
793    ("vdev", string),
794    ("backend", libxl_disk_backend),
795    ("format", libxl_disk_format),
796    ("script", string),
797    ("removable", integer),
798    ("readwrite", integer),
799    ("is_cdrom", integer),
800    ("direct_io_safe", bool),
801    ("discard_enable", libxl_defbool),
802    ("specification", libxl_disk_specification),
803    ("transport", libxl_disk_transport),
804    # Note that virtio-mmio parameters (irq and base) are for internal use
805    # by libxl and can't be modified.
806    ("irq", uint32),
807    ("base", uint64),
808    # Note that the COLO configuration settings should be considered unstable.
809    # They may change incompatibly in future versions of Xen.
810    ("colo_enable", libxl_defbool),
811    ("colo_restore_enable", libxl_defbool),
812    ("colo_host", string),
813    ("colo_port", integer),
814    ("colo_export", string),
815    ("active_disk", string),
816    ("hidden_disk", string),
817    ("trusted", libxl_defbool),
818    ("grant_usage", libxl_defbool),
819    ])
820
821libxl_device_nic = Struct("device_nic", [
822    ("backend_domid", libxl_domid),
823    ("backend_domname", string),
824    ("devid", libxl_devid),
825    ("mtu", integer),
826    ("vlan", string),
827    ("model", string),
828    ("mac", libxl_mac),
829    ("ip", string),
830    ("bridge", string),
831    ("ifname", string),
832    ("script", string),
833    ("nictype", libxl_nic_type),
834    ("rate_bytes_per_interval", uint64),
835    ("rate_interval_usecs", uint32),
836    ("gatewaydev", string),
837    # Note that the COLO configuration settings should be considered unstable.
838    # They may change incompatibly in future versions of Xen.
839    ("coloft_forwarddev", string),
840    ("colo_sock_mirror_id", string),
841    ("colo_sock_mirror_ip", string),
842    ("colo_sock_mirror_port", string),
843    ("colo_sock_compare_pri_in_id", string),
844    ("colo_sock_compare_pri_in_ip", string),
845    ("colo_sock_compare_pri_in_port", string),
846    ("colo_sock_compare_sec_in_id", string),
847    ("colo_sock_compare_sec_in_ip", string),
848    ("colo_sock_compare_sec_in_port", string),
849    ("colo_sock_compare_notify_id", string),
850    ("colo_sock_compare_notify_ip", string),
851    ("colo_sock_compare_notify_port", string),
852    ("colo_sock_redirector0_id", string),
853    ("colo_sock_redirector0_ip", string),
854    ("colo_sock_redirector0_port", string),
855    ("colo_sock_redirector1_id", string),
856    ("colo_sock_redirector1_ip", string),
857    ("colo_sock_redirector1_port", string),
858    ("colo_sock_redirector2_id", string),
859    ("colo_sock_redirector2_ip", string),
860    ("colo_sock_redirector2_port", string),
861    ("colo_filter_mirror_queue", string),
862    ("colo_filter_mirror_outdev", string),
863    ("colo_filter_redirector0_queue", string),
864    ("colo_filter_redirector0_indev", string),
865    ("colo_filter_redirector0_outdev", string),
866    ("colo_filter_redirector1_queue", string),
867    ("colo_filter_redirector1_indev", string),
868    ("colo_filter_redirector1_outdev", string),
869    ("colo_compare_pri_in", string),
870    ("colo_compare_sec_in", string),
871    ("colo_compare_out", string),
872    ("colo_compare_notify_dev", string),
873    ("colo_sock_sec_redirector0_id", string),
874    ("colo_sock_sec_redirector0_ip", string),
875    ("colo_sock_sec_redirector0_port", string),
876    ("colo_sock_sec_redirector1_id", string),
877    ("colo_sock_sec_redirector1_ip", string),
878    ("colo_sock_sec_redirector1_port", string),
879    ("colo_filter_sec_redirector0_queue", string),
880    ("colo_filter_sec_redirector0_indev", string),
881    ("colo_filter_sec_redirector0_outdev", string),
882    ("colo_filter_sec_redirector1_queue", string),
883    ("colo_filter_sec_redirector1_indev", string),
884    ("colo_filter_sec_redirector1_outdev", string),
885    ("colo_filter_sec_rewriter0_queue", string),
886    ("colo_checkpoint_host", string),
887    ("colo_checkpoint_port", string),
888    ("trusted", libxl_defbool),
889    ])
890
891libxl_device_pci = Struct("device_pci", [
892    ("func", uint8),
893    ("dev", uint8),
894    ("bus", uint8),
895    ("domain", integer),
896    ("vdevfn", uint32),
897    ("vfunc_mask", uint32),
898    ("msitranslate", bool),
899    ("power_mgmt", bool),
900    ("permissive", bool),
901    ("seize", bool),
902    ("rdm_policy", libxl_rdm_reserve_policy),
903    ("name", string),
904    ])
905
906libxl_device_rdm = Struct("device_rdm", [
907    ("start", uint64),
908    ("size", uint64),
909    ("policy", libxl_rdm_reserve_policy),
910    ])
911
912libxl_usbctrl_type = Enumeration("usbctrl_type", [
913    (0, "AUTO"),
914    (1, "PV"),
915    (2, "DEVICEMODEL"),
916    (3, "QUSB"),
917    ])
918
919libxl_usbdev_type = Enumeration("usbdev_type", [
920    (1, "hostdev"),
921    ])
922
923libxl_device_usbctrl = Struct("device_usbctrl", [
924    ("type", libxl_usbctrl_type),
925    ("devid", libxl_devid),
926    ("version", integer),
927    ("ports", integer),
928    ("backend_domid", libxl_domid),
929    ("backend_domname", string),
930   ])
931
932libxl_device_usbdev = Struct("device_usbdev", [
933    ("ctrl", libxl_devid),
934    ("port", integer),
935    ("u", KeyedUnion(None, libxl_usbdev_type, "type",
936           [("hostdev", Struct(None, [
937                 ("hostbus",   uint8),
938                 ("hostaddr",  uint8)])),
939           ])),
940    ])
941
942libxl_device_dtdev = Struct("device_dtdev", [
943    ("path", string),
944    ])
945
946libxl_device_vtpm = Struct("device_vtpm", [
947    ("backend_domid",    libxl_domid),
948    ("backend_domname",  string),
949    ("devid",            libxl_devid),
950    ("uuid",             libxl_uuid),
951])
952
953libxl_device_p9 = Struct("device_p9", [
954    ("backend_domid",    libxl_domid),
955    ("backend_domname",  string),
956    ("tag",              string),
957    ("path",             string),
958    ("security_model",   string),
959    ("devid",            libxl_devid),
960    ("type",             libxl_p9_type),
961    ("max_space",        integer),
962    ("max_files",        integer),
963    ("max_open_files",   integer),
964    ("auto_delete",      bool),
965])
966
967libxl_device_pvcallsif = Struct("device_pvcallsif", [
968    ("backend_domid",    libxl_domid),
969    ("backend_domname",  string),
970    ("devid",            libxl_devid),
971])
972
973libxl_device_channel = Struct("device_channel", [
974    ("backend_domid", libxl_domid),
975    ("backend_domname", string),
976    ("devid", libxl_devid),
977    ("name", string),
978    ("u", KeyedUnion(None, libxl_channel_connection, "connection",
979           [("unknown", None),
980            ("pty", None),
981            ("socket", Struct(None, [("path", string)])),
982           ])),
983])
984
985libxl_connector_param = Struct("connector_param", [
986    ("unique_id", string),
987    ("width", uint32),
988    ("height", uint32)
989    ])
990
991libxl_device_vdispl = Struct("device_vdispl", [
992    ("backend_domid", libxl_domid),
993    ("backend_domname", string),
994    ("devid", libxl_devid),
995    ("be_alloc", bool),
996    ("connectors", Array(libxl_connector_param, "num_connectors"))
997    ])
998
999libxl_vsnd_pcm_format = Enumeration("vsnd_pcm_format", [
1000    (1,  "S8"),
1001    (2,  "U8"),
1002    (3,  "S16_LE"),
1003    (4,  "S16_BE"),
1004    (5,  "U16_LE"),
1005    (6,  "U16_BE"),
1006    (7,  "S24_LE"),
1007    (8,  "S24_BE"),
1008    (9,  "U24_LE"),
1009    (10, "U24_BE"),
1010    (11, "S32_LE"),
1011    (12, "S32_BE"),
1012    (13, "U32_LE"),
1013    (14, "U32_BE"),
1014    (15, "F32_LE"),
1015    (16, "F32_BE"),
1016    (17, "F64_LE"),
1017    (18, "F64_BE"),
1018    (19, "IEC958_SUBFRAME_LE"),
1019    (20, "IEC958_SUBFRAME_BE"),
1020    (21, "MU_LAW"),
1021    (22, "A_LAW"),
1022    (23, "IMA_ADPCM"),
1023    (24, "MPEG"),
1024    (25, "GSM")
1025    ])
1026
1027libxl_vsnd_params = Struct("vsnd_params", [
1028    ("sample_rates", Array(uint32, "num_sample_rates")),
1029    ("sample_formats", Array(libxl_vsnd_pcm_format, "num_sample_formats")),
1030    ("channels_min", uint32),
1031    ("channels_max", uint32),
1032    ("buffer_size", uint32)
1033    ])
1034
1035libxl_vsnd_stream_type = Enumeration("vsnd_stream_type", [
1036    (1, "P"),
1037    (2, "C")
1038    ])
1039
1040libxl_vsnd_stream = Struct("vsnd_stream", [
1041    ("unique_id", string),
1042    ("type", libxl_vsnd_stream_type),
1043    ("params", libxl_vsnd_params)
1044    ])
1045
1046libxl_vsnd_pcm = Struct("vsnd_pcm", [
1047    ("name", string),
1048    ("params", libxl_vsnd_params),
1049    ("streams", Array(libxl_vsnd_stream, "num_vsnd_streams"))
1050    ])
1051
1052libxl_device_vsnd = Struct("device_vsnd", [
1053    ("backend_domid", libxl_domid),
1054    ("backend_domname", string),
1055    ("devid", libxl_devid),
1056    ("short_name", string),
1057    ("long_name", string),
1058    ("params", libxl_vsnd_params),
1059    ("pcms", Array(libxl_vsnd_pcm, "num_vsnd_pcms"))
1060    ])
1061
1062libxl_domain_config = Struct("domain_config", [
1063    ("c_info", libxl_domain_create_info),
1064    ("b_info", libxl_domain_build_info),
1065
1066    ("disks", Array(libxl_device_disk, "num_disks")),
1067    ("nics", Array(libxl_device_nic, "num_nics")),
1068    ("pcidevs", Array(libxl_device_pci, "num_pcidevs")),
1069    ("rdms", Array(libxl_device_rdm, "num_rdms")),
1070    ("dtdevs", Array(libxl_device_dtdev, "num_dtdevs")),
1071    ("vfbs", Array(libxl_device_vfb, "num_vfbs")),
1072    ("vkbs", Array(libxl_device_vkb, "num_vkbs")),
1073    ("virtios", Array(libxl_device_virtio, "num_virtios")),
1074    ("vtpms", Array(libxl_device_vtpm, "num_vtpms")),
1075    ("p9s", Array(libxl_device_p9, "num_p9s")),
1076    ("pvcallsifs", Array(libxl_device_pvcallsif, "num_pvcallsifs")),
1077    ("vdispls", Array(libxl_device_vdispl, "num_vdispls")),
1078    ("vsnds", Array(libxl_device_vsnd, "num_vsnds")),
1079    # a channel manifests as a console with a name,
1080    # see docs/misc/channels.txt
1081    ("channels", Array(libxl_device_channel, "num_channels")),
1082    ("usbctrls", Array(libxl_device_usbctrl, "num_usbctrls")),
1083    ("usbdevs", Array(libxl_device_usbdev, "num_usbdevs")),
1084
1085    ("on_poweroff", libxl_action_on_shutdown),
1086    ("on_reboot", libxl_action_on_shutdown),
1087    ("on_watchdog", libxl_action_on_shutdown),
1088    ("on_crash", libxl_action_on_shutdown),
1089    ("on_soft_reset", libxl_action_on_shutdown),
1090    ], dir=DIR_IN)
1091
1092libxl_diskinfo = Struct("diskinfo", [
1093    ("backend", string),
1094    ("backend_id", uint32),
1095    ("frontend", string),
1096    ("frontend_id", uint32),
1097    ("devid", libxl_devid),
1098    ("state", integer),
1099    ("evtch", integer),
1100    ("rref", integer),
1101    ], dir=DIR_OUT)
1102
1103libxl_nicinfo = Struct("nicinfo", [
1104    ("backend", string),
1105    ("backend_id", uint32),
1106    ("frontend", string),
1107    ("frontend_id", uint32),
1108    ("devid", libxl_devid),
1109    ("state", integer),
1110    ("evtch", integer),
1111    ("rref_tx", integer),
1112    ("rref_rx", integer),
1113    ], dir=DIR_OUT)
1114
1115libxl_vtpminfo = Struct("vtpminfo", [
1116    ("backend", string),
1117    ("backend_id", uint32),
1118    ("frontend", string),
1119    ("frontend_id", uint32),
1120    ("devid", libxl_devid),
1121    ("state", integer),
1122    ("evtch", integer),
1123    ("rref", integer),
1124    ("uuid", libxl_uuid),
1125    ], dir=DIR_OUT)
1126
1127libxl_usbctrlinfo = Struct("usbctrlinfo", [
1128    ("type", libxl_usbctrl_type),
1129    ("devid", libxl_devid),
1130    ("version", integer),
1131    ("ports", integer),
1132    ("backend", string),
1133    ("backend_id", uint32),
1134    ("frontend", string),
1135    ("frontend_id", uint32),
1136    ("state", integer),
1137    ("evtch", integer),
1138    ("ref_urb", integer),
1139    ("ref_conn", integer),
1140    ], dir=DIR_OUT)
1141
1142libxl_vcpuinfo = Struct("vcpuinfo", [
1143    ("vcpuid", uint32),
1144    ("cpu", uint32),
1145    ("online", bool),
1146    ("blocked", bool),
1147    ("running", bool),
1148    ("vcpu_time", uint64), # total vcpu time ran (ns)
1149    ("cpumap", libxl_bitmap), # current hard cpu affinity
1150    ("cpumap_soft", libxl_bitmap), # current soft cpu affinity
1151    ], dir=DIR_OUT)
1152
1153libxl_physinfo = Struct("physinfo", [
1154    ("threads_per_core", uint32),
1155    ("cores_per_socket", uint32),
1156
1157    ("max_cpu_id", uint32),
1158    ("nr_cpus", uint32),
1159    ("cpu_khz", uint32),
1160
1161    ("total_pages", uint64),
1162    ("free_pages", uint64),
1163    ("scrub_pages", uint64),
1164    ("outstanding_pages", uint64),
1165    ("sharing_freed_pages", uint64),
1166    ("sharing_used_frames", uint64),
1167    ("max_possible_mfn", uint64),
1168
1169    ("nr_nodes", uint32),
1170    ("hw_cap", libxl_hwcap),
1171
1172    ("cap_hvm", bool),
1173    ("cap_pv", bool),
1174    ("cap_hvm_directio", bool), # No longer HVM specific
1175    ("cap_hap", bool),
1176    ("cap_shadow", bool),
1177    ("cap_iommu_hap_pt_share", bool),
1178    ("cap_vmtrace", bool),
1179    ("cap_vpmu", bool),
1180    ("cap_gnttab_v1", bool),
1181    ("cap_gnttab_v2", bool),
1182    ("arch_capabilities", uint32),
1183    ], dir=DIR_OUT)
1184
1185libxl_connectorinfo = Struct("connectorinfo", [
1186    ("unique_id", string),
1187    ("width", uint32),
1188    ("height", uint32),
1189    ("req_evtch", integer),
1190    ("req_rref", integer),
1191    ("evt_evtch", integer),
1192    ("evt_rref", integer),
1193    ], dir=DIR_OUT)
1194
1195libxl_vdisplinfo = Struct("vdisplinfo", [
1196    ("backend", string),
1197    ("backend_id", uint32),
1198    ("frontend", string),
1199    ("frontend_id", uint32),
1200    ("devid", libxl_devid),
1201    ("state", integer),
1202    ("be_alloc", bool),
1203    ("connectors", Array(libxl_connectorinfo, "num_connectors"))
1204    ], dir=DIR_OUT)
1205
1206libxl_streaminfo = Struct("streaminfo", [
1207    ("req_evtch", integer),
1208    ("req_rref", integer)
1209    ])
1210
1211libxl_pcminfo = Struct("pcminfo", [
1212    ("streams", Array(libxl_streaminfo, "num_vsnd_streams"))
1213    ])
1214
1215libxl_vsndinfo = Struct("vsndinfo", [
1216    ("backend", string),
1217    ("backend_id", uint32),
1218    ("frontend", string),
1219    ("frontend_id", uint32),
1220    ("devid", libxl_devid),
1221    ("state", integer),
1222    ("pcms", Array(libxl_pcminfo, "num_vsnd_pcms"))
1223    ])
1224
1225libxl_vkbinfo = Struct("vkbinfo", [
1226    ("backend", string),
1227    ("backend_id", uint32),
1228    ("frontend", string),
1229    ("frontend_id", uint32),
1230    ("devid", libxl_devid),
1231    ("state", integer),
1232    ("evtch", integer),
1233    ("rref", integer)
1234    ], dir=DIR_OUT)
1235
1236# NUMA node characteristics: size and free are how much memory it has, and how
1237# much of it is free, respectively. dists is an array of distances from this
1238# node to each other node.
1239libxl_numainfo = Struct("numainfo", [
1240    ("size", uint64),
1241    ("free", uint64),
1242    ("dists", Array(uint32, "num_dists")),
1243    ], dir=DIR_OUT)
1244
1245libxl_cputopology = Struct("cputopology", [
1246    ("core", uint32),
1247    ("socket", uint32),
1248    ("node", uint32),
1249    ], dir=DIR_OUT)
1250
1251libxl_pcitopology = Struct("pcitopology", [
1252    ("seg", uint16),
1253    ("bus", uint8),
1254    ("devfn", uint8),
1255    ("node", uint32),
1256    ], dir=DIR_OUT)
1257
1258libxl_sched_credit_params = Struct("sched_credit_params", [
1259    ("tslice_ms", integer),
1260    ("ratelimit_us", integer),
1261    ("vcpu_migr_delay_us", integer),
1262    ], dispose_fn=None)
1263
1264libxl_sched_credit2_params = Struct("sched_credit2_params", [
1265    ("ratelimit_us", integer),
1266    ], dispose_fn=None)
1267
1268libxl_domain_remus_info = Struct("domain_remus_info",[
1269    ("interval",             integer),
1270    ("allow_unsafe",         libxl_defbool),
1271    ("blackhole",            libxl_defbool),
1272    ("compression",          libxl_defbool),
1273    ("netbuf",               libxl_defbool),
1274    ("netbufscript",         string),
1275    ("diskbuf",              libxl_defbool),
1276    ("colo",                 libxl_defbool),
1277    ("userspace_colo_proxy", libxl_defbool)
1278    ])
1279
1280libxl_event_type = Enumeration("event_type", [
1281    (1, "DOMAIN_SHUTDOWN"),
1282    (2, "DOMAIN_DEATH"),
1283    (3, "DISK_EJECT"),
1284    (4, "OPERATION_COMPLETE"),
1285    (5, "DOMAIN_CREATE_CONSOLE_AVAILABLE"),
1286    ])
1287
1288libxl_ev_user = UInt(64)
1289
1290libxl_ev_link = Builtin("ev_link", json_parse_type="JSON_STRING", passby=PASS_BY_REFERENCE, private=True)
1291
1292libxl_event = Struct("event",[
1293    ("link",     libxl_ev_link),
1294     # for use by libxl; caller may use this once the event has been
1295     #   returned by libxl_event_{check,wait}
1296    ("domid",    libxl_domid),
1297    ("domuuid",  libxl_uuid),
1298    ("for_user", libxl_ev_user),
1299    ("u", KeyedUnion(None, libxl_event_type, "type",
1300          [("domain_shutdown", Struct(None, [
1301                                             ("shutdown_reason", uint8),
1302                                      ])),
1303           ("domain_death", None),
1304           ("disk_eject", Struct(None, [
1305                                        ("vdev", string),
1306                                        ("disk", libxl_device_disk),
1307                                 ])),
1308           ("operation_complete", Struct(None, [
1309                                        ("rc", integer),
1310                                 ])),
1311           ("domain_create_console_available", None),
1312           ]))])
1313
1314libxl_psr_cmt_type = Enumeration("psr_cmt_type", [
1315    (1, "CACHE_OCCUPANCY"),
1316    (2, "TOTAL_MEM_COUNT"),
1317    (3, "LOCAL_MEM_COUNT"),
1318    ])
1319
1320libxl_psr_cbm_type = Enumeration("psr_cbm_type", [
1321    (0, "UNKNOWN"),
1322    (1, "L3_CBM"),
1323    (2, "L3_CBM_CODE"),
1324    (3, "L3_CBM_DATA"),
1325    (4, "L2_CBM"),
1326    (5, "MBA_THRTL"),
1327    ])
1328
1329libxl_psr_cat_info = Struct("psr_cat_info", [
1330    ("id", uint32),
1331    ("cos_max", uint32),
1332    ("cbm_len", uint32),
1333    ("cdp_enabled", bool),
1334    ])
1335
1336libxl_psr_feat_type = Enumeration("psr_feat_type", [
1337    (1, "CAT"),
1338    (2, "MBA"),
1339    ])
1340
1341libxl_psr_hw_info = Struct("psr_hw_info", [
1342    ("id", uint32),
1343    ("u", KeyedUnion(None, libxl_psr_feat_type, "type",
1344          [("cat", Struct(None, [
1345                                    ("cos_max",     uint32),
1346                                    ("cbm_len",     uint32),
1347                                    ("cdp_enabled", bool),
1348                               ])),
1349           ("mba", Struct(None, [
1350                                    ("cos_max",     uint32),
1351                                    ("thrtl_max",   uint32),
1352                                    ("linear",      bool),
1353                               ])),
1354          ]))
1355    ], dir=DIR_OUT)
1356