7 typedef unsigned int *uintptr_t;
10 #define LOCKCHECK_ALLOC(x)
11 #define LOCKCHECK_LOCK_PRE(x)
12 #define LOCKCHECK_LOCK_POST(x)
13 #define LOCKCHECK_LOCK_IRQSAVE_PRE(x,y)
14 #define LOCKCHECK_LOCK_IRQSAVE_POST(x,y)
15 #define LOCKCHECK_UNLOCK_PRE(x)
16 #define LOCKCHECK_UNLOCK_POST(x)
17 #define LOCKCHECK_UNLOCK_IRQRESTORE_PRE(x,y)
18 #define LOCKCHECK_UNLOCK_IRQRESTORE_POST(x,y)
19 #define LOCKCHECK_FREE(x)
27 int palacios_vmm_init( uint64_t memsize, char * options );
28 int palacios_vmm_exit( void );
31 struct v3_resource_control;
33 // Selected exported stubs, for use in other palacios components, like vnet
34 // The idea is that everything uses the same stubs
35 void palacios_print_scoped(void *vm, int vcore, const char *fmt, ...);
36 #define palacios_print(...) palacios_print_scoped(0,-1, __VA_ARGS__)
37 // node_id=-1 => no node constraint
38 void *palacios_allocate_pages(int num_pages, unsigned int alignment, int node_id, int (*filter_func)(void *paddr, void *filter_state), void *filter_state);
39 void palacios_free_pages(void *page_addr, int num_pages);
40 void *palacios_alloc(unsigned int size);
41 // node_id=-1 => no node constraint
42 void *palacios_alloc_extended(unsigned int size, unsigned int flags, int node_id);
43 void palacios_free(void *);
44 void *palacios_valloc(unsigned int size); // use instead of vmalloc
45 void palacios_vfree(void *); // use instead of vfree
46 void *palacios_vaddr_to_paddr(void *vaddr);
47 void *palacios_paddr_to_vaddr(void *paddr);
48 void palacios_xcall(int cpu_id, void (*fn)(void *arg), void *arg);
49 void *palacios_create_and_start_kernel_thread(int (*fn)(void * arg), void *arg, char *thread_name, struct v3_resource_control *rctl);
50 void *palacios_create_thread_on_cpu(int cpu_id, int (*fn)(void * arg), void *arg, char *thread_name, struct v3_resource_control *rctl);
51 void palacios_start_thread(void *thread_ptr);
52 void *palacios_creeate_and_start_thread_on_cpu(int cpu_id, int (*fn)(void * arg), void *arg, char *thread_name, struct v3_resource_control *rctl);
53 int palacios_move_thread_to_cpu(int new_cpu_id, void *thread_ptr);
54 void palacios_yield_cpu(void);
55 void palacios_sleep_cpu(unsigned int us);
56 unsigned int palacios_get_cpu(void);
57 unsigned int palacios_get_cpu_khz(void);
58 void palacios_used_fpu(void);
59 void palacios_need_fpu(void);
60 void *palacios_mutex_alloc(void); // allocates and inits a lock
61 void palacios_mutex_init(void *mutex); // only inits a lock
62 void palacios_mutex_deinit(void *mutex); // only deinits a lock
63 void palacios_mutex_free(void *mutex); // deinits and frees a lock
64 void palacios_mutex_lock(void *mutex, int must_spin);
65 void palacios_mutex_unlock(void *mutex);
66 void *palacios_mutex_lock_irqsave(void *mutex, int must_spin);
67 void palacios_mutex_unlock_irqrestore(void *mutex, void *flags);
68 // Macros for spin-locks in the module code
69 // By using these macros, the lock checker will be able
70 // to see the module code as well as the core VMM
71 #define palacios_spinlock_init(l) palacios_mutex_init(l)
72 #define palacios_spinlock_deinit(l) palacios_mutex_deinit(l)
73 #define palacios_spinlock_lock(l) palacios_mutex_lock(l,0)
74 #define palacios_spinlock_unlock(l) palacios_mutex_unlock(l)
75 #define palacios_spinlock_lock_irqsave(l,f) do { f=(unsigned long)palacios_mutex_lock_irqsave(l,0); } while (0)
76 #define palacios_spinlock_unlock_irqrestore(l,f) palacios_mutex_unlock_irqrestore(l,(void*)f)
79 // Palacios Printing Support
81 // These macros affect how palacios_print will generate output
82 // Turn this on for unprefaced output from palacios_print
83 #define V3_PRINTK_OLD_STYLE_OUTPUT 0
84 // Maximum length output from palacios_print
85 #define V3_PRINTK_BUF_SIZE 1024
86 // Turn this on to check if new-style output for palacios_print contains only 7-bit chars
87 #define V3_PRINTK_CHECK_7BIT 1
90 // The following macros are for printing in the linux module itself, even before
91 // Palacios is initialized and after it it deinitialized
92 // All printk's in linux_module use these macros, for easier control
94 #define KERN_WARNING ""
95 #define KERN_NOTICE ""
98 #define ERROR(fmt, args...) printk((KERN_ERR "palacios (pcore %u) %s(%d): " fmt), palacios_get_cpu(), __FILE__, __LINE__, ##args)
99 #define WARNING(fmt, args...) printk((KERN_WARNING "palacios (pcore %u): " fmt), palacios_get_cpu(), ##args)
100 #define NOTICE(fmt, args...) printk((KERN_NOTICE "palacios (pcore %u): " fmt), palacios_get_cpu(), ##args)
101 #define INFO(fmt, args...) printk((KERN_INFO "palacios (pcore %u): " fmt), palacios_get_cpu(), ##args)
102 #define DEBUG(fmt, args...) printk((KERN_DEBUG "palacios (pcore %u): " fmt), palacios_get_cpu(), ##args)