2 * V3 Control header file
13 /* Global Control IOCTLs */
14 #define V3_CREATE_GUEST 12
15 #define V3_FREE_GUEST 13
17 #define V3_ADD_MEMORY 50
18 #define V3_RESET_MEMORY 51
19 #define V3_REMOVE_MEMORY 52
21 #define V3_ADD_PCI_HW_DEV 55
22 #define V3_ADD_PCI_USER_DEV 56
24 #define V3_DVFS_CTRL 60
26 /* VM Specific IOCTLs */
28 /* VM Specific ioctls */
29 #define V3_VM_CONSOLE_CONNECT 20
30 #define V3_VM_SERIAL_CONNECT 21
31 #define V3_VM_PAUSE 23
32 #define V3_VM_CONTINUE 24
34 #define V3_VM_LAUNCH 25
38 #define V3_VM_SIMULATE 29
39 #define V3_VM_INSPECT 30
40 #define V3_VM_DEBUG 31
43 #define V3_VM_MOVE_CORE 33
46 #define V3_VM_RECEIVE 35
48 #define V3_VM_MOVE_MEM 36
50 #define V3_VM_RESET 40
52 #define V3_VM_FB_INPUT 257
53 #define V3_VM_FB_QUERY 258
55 #define V3_VM_HOST_DEV_CONNECT 10245
56 #define V3_VM_KSTREAM_USER_CONNECT 11245
59 static const char * v3_dev = "/dev/v3vee";
62 unsigned long long size;
65 } __attribute__((packed));
68 typedef enum { PREALLOCATED=0, // user space-allocated (e.g. hot remove)
69 REQUESTED, // kernel will attempt allocation (anywhere)
70 REQUESTED32, // kernel will attempt allocation (<4GB)
71 } v3_mem_region_type_t;
73 struct v3_mem_region {
74 v3_mem_region_type_t type; //
75 int node; // numa node for REQUESTED (-1 = any)
76 unsigned long long base_addr; // region start (hpa) for PREALLOCATED
77 unsigned long long num_pages; // size for PREALLOCATED or request size for REQUESTED
78 // should be power of 2 and > V3_CONFIG_MEM_BLOCK
79 } __attribute__((packed));
82 struct v3_core_move_cmd{
83 unsigned short vcore_id;
84 unsigned short pcore_id;
85 } __attribute__((packed));
87 struct v3_mem_move_cmd{
88 unsigned long long gpa;
89 unsigned short pcore_id;
90 } __attribute__((packed));
95 } __attribute__((packed));
97 struct v3_chkpt_info {
99 char url[256]; /* This might need to be bigger... */
100 unsigned long long opts;
101 #define V3_CHKPT_OPT_NONE 0
102 #define V3_CHKPT_OPT_SKIP_MEM 1 // don't write memory to store
103 #define V3_CHKPT_OPT_SKIP_DEVS 2 // don't write devices to store
104 #define V3_CHKPT_OPT_SKIP_CORES 4 // don't write core arch ind data to store
105 #define V3_CHKPT_OPT_SKIP_ARCHDEP 8 // don't write core arch dep data to store
106 } __attribute__((packed));
108 struct v3_reset_cmd {
109 #define V3_RESET_VM_ALL 0
110 #define V3_RESET_VM_HRT 1
111 #define V3_RESET_VM_ROS 2
112 #define V3_RESET_VM_CORE_RANGE 3
114 unsigned int first_core; // for CORE_RANGE
115 unsigned int num_cores; // for CORE_RANGE
116 } __attribute__((packed));
119 struct v3_hw_pci_dev {
124 } __attribute__((packed));
126 #define V3VEE_STR "\n\n" \
127 "The V3Vee Project (c) 2012\n" \
128 "\thttp://v3vee.org\n" \
131 #define v3_usage(fmt, args...) \
133 printf(("\nUsage: %s " fmt V3VEE_STR), argv[0], ##args); \
138 int v3_dev_ioctl (int req, void * arg);
139 int v3_vm_ioctl (const char * filename,
142 void * v3_mmap_file (const char * filename, int prot, int flags);
143 int v3_read_file (int fd, int size, unsigned char * buf);
145 int launch_vm (const char * filename);
146 int stop_vm (const char * filename);
148 unsigned long v3_hash_buffer (unsigned char * msg, unsigned int len);
150 /* XML-related structs */
159 struct xml_option * next;
169 struct mem_file_hdr {
170 unsigned int file_idx;
171 unsigned int file_size;
172 unsigned long long file_offset;
173 unsigned long file_hash;