Palacios Public Git Repository

To checkout Palacios execute

  git clone http://v3vee.org/palacios/palacios.web/palacios.git
This will give you the master branch. You probably want the devel branch or one of the release branches. To switch to the devel branch, simply execute
  cd palacios
  git checkout --track -b devel origin/devel
The other branches are similar.


8b448bccbeef3a522311a0f26be8b3e2cfae4b10
[palacios.git] / linux_usr / v3_ctrl.h
1 /* 
2  * V3 Control header file 
3  * (c) Jack lange, 2010
4  */
5
6 #ifndef _v3_ctrl_h
7 #define _v3_ctrl_h
8
9 #include <stdio.h>
10 #include <stdlib.h>
11 #include "ezxml.h"
12
13 /* Global Control IOCTLs */
14 #define V3_CREATE_GUEST 12
15 #define V3_FREE_GUEST 13
16
17 #define V3_ADD_MEMORY 50
18 #define V3_RESET_MEMORY 51
19 #define V3_REMOVE_MEMORY 52
20
21 #define V3_ADD_PCI_HW_DEV 55
22 #define V3_ADD_PCI_USER_DEV 56
23
24 #define V3_DVFS_CTRL  60
25
26 /* VM Specific IOCTLs */
27
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
33
34 #define V3_VM_LAUNCH 25
35 #define V3_VM_STOP 26
36 #define V3_VM_LOAD 27
37 #define V3_VM_SAVE 28
38 #define V3_VM_SIMULATE 29
39 #define V3_VM_INSPECT 30
40 #define V3_VM_DEBUG 31
41
42
43 #define V3_VM_MOVE_CORE 33
44
45 #define V3_VM_SEND    34
46 #define V3_VM_RECEIVE 35
47
48 #define V3_VM_MOVE_MEM 36
49
50 #define V3_VM_FB_INPUT 257
51 #define V3_VM_FB_QUERY 258
52
53 #define V3_VM_HOST_DEV_CONNECT 10245
54 #define V3_VM_KSTREAM_USER_CONNECT 11245
55
56
57 static const char * v3_dev = "/dev/v3vee";
58
59 struct v3_guest_img {
60     unsigned long long size;
61     void * guest_data;
62     char name[128];
63 } __attribute__((packed));
64
65
66 typedef enum { PREALLOCATED=0,          // user space-allocated (e.g. hot remove)
67                REQUESTED,               // kernel will attempt allocation (anywhere)
68                REQUESTED32,             // kernel will attempt allocation (<4GB)
69 } v3_mem_region_type_t;
70
71 struct v3_mem_region {
72     v3_mem_region_type_t type;         // 
73     int                  node;         // numa node for REQUESTED (-1 = any)
74     unsigned long long   base_addr;    // region start (hpa) for PREALLOCATED
75     unsigned long long   num_pages;    // size for PREALLOCATED or request size for REQUESTED
76                                        // should be power of 2 and > V3_CONFIG_MEM_BLOCK
77 } __attribute__((packed));
78
79
80 struct v3_core_move_cmd{
81     unsigned short vcore_id;
82     unsigned short pcore_id;
83 } __attribute__((packed));
84
85 struct v3_mem_move_cmd{
86     unsigned long long gpa;
87     unsigned short     pcore_id;
88 } __attribute__((packed));
89
90 struct v3_debug_cmd {
91     unsigned int core; 
92     unsigned int cmd;
93 } __attribute__((packed));
94
95 struct v3_chkpt_info {
96     char store[128];
97     char url[256]; /* This might need to be bigger... */
98     unsigned long long opts;
99 #define V3_CHKPT_OPT_NONE         0
100 #define V3_CHKPT_OPT_SKIP_MEM     1  // don't write memory to store
101 #define V3_CHKPT_OPT_SKIP_DEVS    2  // don't write devices to store
102 #define V3_CHKPT_OPT_SKIP_CORES   4  // don't write core arch ind data to store
103 #define V3_CHKPT_OPT_SKIP_ARCHDEP 8  // don't write core arch dep data to store
104 } __attribute__((packed));
105
106
107
108 struct v3_hw_pci_dev {
109     char url[128];
110     unsigned int bus;
111     unsigned int dev;
112     unsigned int func;
113 } __attribute__((packed));
114
115 #define V3VEE_STR "\n\n"                         \
116                   "The V3Vee Project (c) 2012\n" \
117                   "\thttp://v3vee.org\n"         \
118                   "\n\n"
119                    
120 #define v3_usage(fmt, args...)                                \
121 {                                                             \
122     printf(("\nUsage: %s " fmt V3VEE_STR), argv[0], ##args);  \
123     exit(0);                                                  \
124 }
125
126
127 int v3_dev_ioctl (int req, void * arg);
128 int v3_vm_ioctl  (const char * filename,
129                   int req,
130                   void * arg);
131 void * v3_mmap_file (const char * filename, int prot, int flags);
132 int v3_read_file (int fd, int size, unsigned char * buf);
133
134 int launch_vm (const char * filename);
135 int stop_vm   (const char * filename);
136
137 unsigned long v3_hash_buffer (unsigned char * msg, unsigned int len);
138
139 /* XML-related structs */
140 struct cfg_value {
141     char * tag;
142     char * value;
143 };
144
145 struct xml_option {
146     char * tag;
147     ezxml_t location;
148     struct xml_option * next;
149 };
150
151
152 struct file_info {
153     int size;
154     char filename[2048];
155     char id[256];
156 };
157
158 struct mem_file_hdr {
159     unsigned int file_idx;
160     unsigned int file_size;
161     unsigned long long file_offset;
162     unsigned long file_hash;
163 };
164
165
166 #endif