4 #include <linux/cdev.h>
5 #include <linux/list.h>
6 #include <linux/sched.h>
7 #include <linux/slab.h>
10 /* Global Control IOCTLs */
11 #define V3_CREATE_GUEST 12
12 #define V3_FREE_GUEST 13
14 #define V3_ADD_MEMORY 50
16 /* VM Specific IOCTLs */
17 #define V3_VM_CONSOLE_CONNECT 20
18 #define V3_VM_STREAM_CONNECT 21
20 #define V3_VM_PAUSE 23
21 #define V3_VM_CONTINUE 24
23 #define V3_VM_LAUNCH 25
27 #define V3_VM_SIMULATE 29
29 #define V3_VM_INSPECT 30
30 #define V3_VM_DEBUG 31
32 #define V3_VM_MOVE_CORE 33
34 #define V3_VM_FB_INPUT 257
35 #define V3_VM_FB_QUERY 258
37 #define V3_VM_HOST_DEV_CONNECT 10245
39 #define V3_VM_KSTREAM_USER_CONNECT 11245
43 unsigned long long size;
46 } __attribute__((packed));
48 struct v3_mem_region {
49 unsigned long long base_addr;
50 unsigned long long num_pages;
51 } __attribute__((packed));
56 } __attribute__((packed));
58 struct v3_core_move_cmd {
59 unsigned short vcore_id;
60 unsigned short pcore_id;
61 } __attribute__((packed));
63 struct v3_chkpt_info {
65 char url[256]; /* This might need to be bigger... */
66 } __attribute__((packed));
71 void * trace_malloc(size_t size, gfp_t flags);
72 void trace_free(const void * objp);
84 struct rb_root vm_ctrls;
85 struct list_head exts;
91 // For now MAX_VMS must be a multiple of 8
92 // This is due to the minor number bitmap
97 int palacios_vmm_init( void );
98 int palacios_vmm_exit( void );
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);
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);
129 // Palacios Printing Support
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
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)