From: Lei Xia Date: Thu, 5 May 2011 23:48:57 +0000 (-0500) Subject: more fix on VNET X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=commitdiff_plain;h=457148fd9d25d45b8048ae558adbc607512b5fbf;p=palacios.git more fix on VNET --- diff --git a/palacios/include/vnet/vnet_host.h b/palacios/include/vnet/vnet_host.h index 47f6481..f237417 100644 --- a/palacios/include/vnet/vnet_host.h +++ b/palacios/include/vnet/vnet_host.h @@ -30,21 +30,21 @@ struct vnet_timer { void * host_timer; }; -typedef addr_t vnet_lock_t; +typedef unsigned long vnet_lock_t; struct vnet_host_hooks { void *(*thread_start)(int (*fn)(void * arg), void * arg, char * thread_name); - void (*thread_sleep)(int timeout); + void (*thread_sleep)(long timeout); void (*thread_wakeup)(void * thread); void (*thread_stop)(void * thread); - int (*thread_should_stop)(); + int (*thread_should_stop)(void); void *(*timer_create)(unsigned long interval, void (* timer_fun)(void * priv_data), void * data); void (*timer_del)(void * timer); - int (*timer_start)(void * timer); - int (*timer_stop)(void * timer); + void (*timer_start)(void * timer); + void (*timer_stop)(void * timer); void (*timer_reset)(void * timer, unsigned long interval); void (*udelay)(unsigned long usecs); @@ -71,6 +71,8 @@ struct vnet_host_hooks { +#ifdef __V3VEE__ + extern struct vnet_host_hooks * host_hooks; @@ -101,7 +103,7 @@ static inline void * Vnet_VAddr(void * addr) { return NULL; } -static inline void * Vnet_PAddr(void *addr) { +static inline void * Vnet_PAddr(void * addr) { if ((host_hooks) && host_hooks->vaddr_to_paddr) { return host_hooks->vaddr_to_paddr(addr); } @@ -124,15 +126,14 @@ static inline void Vnet_Free(void * addr){ } -static inline void Vnet_Yield(){ +static inline void Vnet_Yield(void){ if ((host_hooks) && (host_hooks)->yield_cpu) { host_hooks->yield_cpu(); } } /* THREAD FUNCTIONS */ -struct vnet_thread * vnet_start_thread(int (*func)(void *), - void *arg, char * name); +struct vnet_thread * vnet_start_thread(int (*func)(void *), void * arg, char * name); static inline void vnet_thread_sleep(long timeout){ if((host_hooks) && host_hooks->thread_sleep){ @@ -153,7 +154,7 @@ static inline void vnet_thread_stop(struct vnet_thread * thread){ } } -static inline int vnet_thread_should_stop(){ +static inline int vnet_thread_should_stop(void){ if((host_hooks) && host_hooks->thread_should_stop){ return host_hooks->thread_should_stop(); } @@ -169,9 +170,7 @@ static inline void vnet_udelay(unsigned long usecs){ /* TIMER FUNCTIONS */ /* interval, in jittes */ -struct vnet_timer * vnet_create_timer(unsigned long interval, - void (* timer_fun)(void * priv_data), - void * pri_data); +struct vnet_timer * vnet_create_timer(unsigned long interval, void (* timer_fun)(void * priv_data), void * pri_data); static inline void vnet_del_timer(struct vnet_timer * timer){ if((host_hooks) && host_hooks->timer_del){ @@ -180,20 +179,16 @@ static inline void vnet_del_timer(struct vnet_timer * timer){ } } -static inline int vnet_start_timer(struct vnet_timer * timer){ +static inline void vnet_start_timer(struct vnet_timer * timer){ if((host_hooks) && host_hooks->timer_start){ - return host_hooks->timer_start(timer->host_timer); + host_hooks->timer_start(timer->host_timer); } - - return -1; } -static inline int vnet_stop_timer(struct vnet_timer * timer){ +static inline void vnet_stop_timer(struct vnet_timer * timer){ if((host_hooks) && host_hooks->timer_stop){ - return host_hooks->timer_stop(timer->host_timer); + host_hooks->timer_stop(timer->host_timer); } - - return -1; } static inline void vnet_reset_timer(struct vnet_timer * timer, unsigned long new_interval){ @@ -205,27 +200,28 @@ static inline void vnet_reset_timer(struct vnet_timer * timer, unsigned long new #define Vnet_Print(level, fmt, args...) \ - do { \ - extern int vnet_debug; \ - if(level <= vnet_debug) { \ + do { \ + extern int vnet_debug; \ + if(level <= vnet_debug) { \ extern struct vnet_host_hooks * host_hooks; \ if ((host_hooks) && (host_hooks)->print) { \ (host_hooks)->print((fmt), ##args); \ - } \ - } \ + } \ + } \ } while (0) #define Vnet_Debug(fmt, args...) \ - do { \ - extern struct vnet_host_hooks * host_hooks; \ - if ((host_hooks) && (host_hooks)->print) { \ - (host_hooks)->print((fmt), ##args); \ - } \ + do { \ + extern struct vnet_host_hooks * host_hooks; \ + if ((host_hooks) && (host_hooks)->print) { \ + (host_hooks)->print((fmt), ##args); \ + } \ } while (0) + /* Lock Utilities */ int vnet_lock_init(vnet_lock_t * lock); @@ -242,19 +238,20 @@ static inline void vnet_unlock(vnet_lock_t lock) { host_hooks->mutex_unlock((void *)lock); } -static inline addr_t vnet_lock_irqsave(vnet_lock_t lock) { - addr_t irq_state = v3_irq_save(); +static inline unsigned long vnet_lock_irqsave(vnet_lock_t lock) { + //addr_t irq_state = v3_irq_save(); host_hooks->mutex_lock((void *)lock, 1); - return irq_state; + return 0; } static inline void vnet_unlock_irqrestore(vnet_lock_t lock, addr_t irq_state) { host_hooks->mutex_unlock((void *)lock); - v3_irq_restore(irq_state); + //v3_irq_restore(irq_state); } - +#endif + void init_vnet(struct vnet_host_hooks * hooks); diff --git a/palacios/include/vnet/vnet_vmm.h b/palacios/include/vnet/vnet_vmm.h index ed94e70..054cff2 100644 --- a/palacios/include/vnet/vnet_vmm.h +++ b/palacios/include/vnet/vnet_vmm.h @@ -23,7 +23,6 @@ #include #include #include -#include