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.


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