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.


Changes to linux interfaces:
[palacios.git] / linux_module / palacios.h
1 #ifndef _PALACIOS_H
2 #define _PALACIOS_H
3
4 #include <linux/cdev.h>
5 #include <linux/list.h>
6 #include <linux/sched.h>
7 #include <linux/slab.h>
8
9
10 /* Global Control IOCTLs */
11 #define V3_CREATE_GUEST 12
12 #define V3_FREE_GUEST 13
13
14 #define V3_ADD_MEMORY 50
15
16 /* VM Specific IOCTLs */
17 #define V3_VM_CONSOLE_CONNECT 20
18 #define V3_VM_STREAM_CONNECT 21
19
20 #define V3_VM_PAUSE 23
21 #define V3_VM_CONTINUE 24
22
23 #define V3_VM_LAUNCH 25
24 #define V3_VM_STOP 26
25 #define V3_VM_LOAD 27
26 #define V3_VM_SAVE 28
27 #define V3_VM_SIMULATE 29
28
29 #define V3_VM_INSPECT 30
30 #define V3_VM_DEBUG 31
31
32 #define V3_VM_MOVE_CORE 33
33
34 #define V3_VM_FB_INPUT 257
35 #define V3_VM_FB_QUERY 258
36
37 #define V3_VM_HOST_DEV_CONNECT 10245
38
39 #define V3_VM_KSTREAM_USER_CONNECT 11245
40
41
42 struct v3_guest_img {
43     unsigned long long size;
44     void * guest_data;
45     char name[128];
46 } __attribute__((packed));
47
48 struct v3_mem_region {
49     unsigned long long base_addr;
50     unsigned long long num_pages;
51 } __attribute__((packed));
52
53 struct v3_debug_cmd {
54     unsigned int core; 
55     unsigned int cmd;
56 } __attribute__((packed));
57
58 struct v3_core_move_cmd {
59     unsigned short vcore_id;
60     unsigned short pcore_id;
61 } __attribute__((packed));
62
63 struct v3_chkpt_info {
64     char store[128];
65     char url[256]; /* This might need to be bigger... */
66 } __attribute__((packed));
67
68
69
70
71 void * trace_malloc(size_t size, gfp_t flags);
72 void trace_free(const void * objp);
73
74
75 struct v3_guest {
76     void * v3_ctx;
77
78     void * img; 
79     u32 img_size;
80
81     char name[128];
82
83
84     struct rb_root vm_ctrls;
85     struct list_head exts;
86
87     dev_t vm_dev; 
88     struct cdev cdev;
89 };
90
91 // For now MAX_VMS must be a multiple of 8
92 // This is due to the minor number bitmap
93 #define MAX_VMS 32
94
95
96
97 int palacios_vmm_init( void );
98 int palacios_vmm_exit( void );
99
100
101 // This is how a component finds the proc dir we are using for global state
102 struct proc_dir_entry *palacios_get_procdir(void);
103
104 // Selected exported stubs, for use in other palacios components, like vnet
105 // The idea is that everything uses the same stubs
106 void  palacios_print(const char *fmt, ...);
107 void *palacios_allocate_pages(int num_pages, unsigned int alignment);
108 void  palacios_free_pages(void *page_addr, int num_pages);
109 void *palacios_alloc(unsigned int size);
110 void  palacios_free(void *);
111 void *palacios_vaddr_to_paddr(void *vaddr);
112 void *palacios_paddr_to_vaddr(void *paddr);
113 void *palacios_start_kernel_thread(int (*fn)(void * arg), void *arg, char *thread_name);
114 void *palacios_start_thread_on_cpu(int cpu_id, int (*fn)(void * arg), void *arg, char *thread_name);
115 int   palacios_move_thread_to_cpu(int new_cpu_id, void *thread_ptr);
116 void  palacios_yield_cpu(void);
117 void  palacios_yield_cpu_timed(unsigned int us);
118 unsigned int palacios_get_cpu(void);
119 unsigned int palacios_get_cpu_khz(void);
120 void *palacios_mutex_alloc(void);
121 void  palacios_mutex_free(void *mutex);
122 void  palacios_mutex_lock(void *mutex, int must_spin);
123 void  palacios_mutex_unlock(void *mutex);
124 void *palacios_mutex_lock_irqsave(void *mutex, int must_spin);
125 void  palacios_mutex_unlock_irqrestore(void *mutex, void *flags);
126
127
128
129 // Palacios Printing Support
130
131 // These macros affect how palacios_print will generate output
132 // Turn this on for unprefaced output from palacios_print
133 #define V3_PRINTK_OLD_STYLE_OUTPUT 0
134 // Maximum length output from palacios_print
135 #define V3_PRINTK_BUF_SIZE 1024
136 // Turn this on to check if new-style output for palacios_print  contains only 7-bit chars
137 #define V3_PRINTK_CHECK_7BIT 1
138
139 //
140 // The following macros are for printing in the linux module itself, even before
141 // Palacios is initialized and after it it deinitialized
142 // All printk's in linux_module use these macros, for easier control
143 #define ERROR(fmt, args...) printk((KERN_ERR "palacios (pcore %u): " fmt), palacios_get_cpu(), ##args)
144 #define WARNING(fmt, args...) printk((KERN_WARNING "palacios (pcore %u): " fmt), palacios_get_cpu(), ##args)
145 #define NOTICE(fmt, args...) printk((KERN_NOTICE "palacios (pcore %u): " fmt), palacios_get_cpu(), ##args)
146 #define INFO(fmt, args...) printk((KERN_INFO "palacios (pcore %u): " fmt), palacios_get_cpu(), ##args)
147 #define DEBUG(fmt, args...) printk((KERN_DEBUG "palacios (pcore %u): " fmt), palacios_get_cpu(), ##args)
148
149
150 #endif