diff -r 20204db0891b xen/arch/x86/hvm/hvm.c --- a/xen/arch/x86/hvm/hvm.c Thu Nov 02 18:52:04 2006 +0000 +++ b/xen/arch/x86/hvm/hvm.c Fri Nov 03 12:13:40 2006 +0800 @@ -102,8 +102,7 @@ void hvm_do_resume(struct vcpu *v) } p = &get_vio(v->domain, v->vcpu_id)->vp_ioreq; - wait_on_xen_event_channel(v->arch.hvm_vcpu.xen_port, - p->state != STATE_IOREQ_READY && + wait_on_xen_event_channel(p->state != STATE_IOREQ_READY && p->state != STATE_IOREQ_INPROCESS); switch ( p->state ) { diff -r 20204db0891b xen/arch/x86/hvm/platform.c --- a/xen/arch/x86/hvm/platform.c Thu Nov 02 18:52:04 2006 +0000 +++ b/xen/arch/x86/hvm/platform.c Fri Nov 03 12:14:00 2006 +0800 @@ -735,7 +735,7 @@ static void hvm_send_assist_req(struct v return; } - prepare_wait_on_xen_event_channel(v->arch.hvm_vcpu.xen_port); + prepare_wait_on_xen_event_channel(); p->state = STATE_IOREQ_READY; notify_via_xen_event_channel(v->arch.hvm_vcpu.xen_port); } diff -r 20204db0891b xen/include/asm-x86/shadow.h --- a/xen/include/asm-x86/shadow.h Thu Nov 02 18:52:04 2006 +0000 +++ b/xen/include/asm-x86/shadow.h Fri Nov 03 12:17:52 2006 +0800 @@ -1,20 +1,20 @@ /****************************************************************************** * include/asm-x86/shadow.h - * + * * Parts of this code are Copyright (c) 2006 by XenSource Inc. * Parts of this code are Copyright (c) 2006 by Michael A Fetterman * Parts based on earlier work by Michael A Fetterman, Ian Pratt et al. - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA @@ -23,14 +23,14 @@ #ifndef _XEN_SHADOW_H #define _XEN_SHADOW_H -#include +#include #include #include #include #include /* How to make sure a page is not referred to in a shadow PT */ -/* This will need to be a for_each_vcpu if we go to per-vcpu shadows */ +/* This will need to be a for_each_vcpu if we go to per-vcpu shadows */ #define shadow_drop_references(_d, _p) \ shadow_remove_all_mappings((_d)->vcpu[0], _mfn(page_to_mfn(_p))) #define shadow_sync_and_drop_references(_d, _p) \ @@ -84,11 +84,11 @@ * * This lock is per-domain. It is intended to allow us to make atomic * updates to the software TLB that the shadow tables provide. - * + * * Specifically, it protects: * - all changes to shadow page table pages * - the shadow hash table - * - the shadow page allocator + * - the shadow page allocator * - all changes to guest page table pages; if/when the notion of * out-of-sync pages is added to this code, then the shadow lock is * protecting all guest page table pages which are not listed as @@ -103,41 +103,41 @@ #error shadow.h currently requires CONFIG_SMP #endif -#define shadow_lock_init(_d) \ - do { \ - spin_lock_init(&(_d)->arch.shadow.lock); \ - (_d)->arch.shadow.locker = -1; \ - (_d)->arch.shadow.locker_function = "nobody"; \ +#define shadow_lock_init(_d) \ + do { \ + spin_lock_init(&(_d)->arch.shadow.lock); \ + (_d)->arch.shadow.locker = -1; \ + (_d)->arch.shadow.locker_function = "nobody"; \ } while (0) -#define shadow_lock_is_acquired(_d) \ +#define shadow_lock_is_acquired(_d) \ (current->processor == (_d)->arch.shadow.locker) #define shadow_lock(_d) \ - do { \ + do { \ if ( unlikely((_d)->arch.shadow.locker == current->processor) ) \ - { \ + { \ printk("Error: shadow lock held by %s\n", \ (_d)->arch.shadow.locker_function); \ - BUG(); \ - } \ + BUG(); \ + } \ spin_lock(&(_d)->arch.shadow.lock); \ ASSERT((_d)->arch.shadow.locker == -1); \ (_d)->arch.shadow.locker = current->processor; \ (_d)->arch.shadow.locker_function = __func__; \ } while (0) -#define shadow_unlock(_d) \ +#define shadow_unlock(_d) \ do { \ - ASSERT((_d)->arch.shadow.locker == current->processor); \ - (_d)->arch.shadow.locker = -1; \ - (_d)->arch.shadow.locker_function = "nobody"; \ - spin_unlock(&(_d)->arch.shadow.lock); \ + ASSERT((_d)->arch.shadow.locker == current->processor); \ + (_d)->arch.shadow.locker = -1; \ + (_d)->arch.shadow.locker_function = "nobody"; \ + spin_unlock(&(_d)->arch.shadow.lock); \ } while (0) -/* +/* * Levels of self-test and paranoia - * XXX should go in config files somewhere? + * XXX should go in config files somewhere? */ #define SHADOW_AUDIT_HASH 0x01 /* Check current hash bucket */ #define SHADOW_AUDIT_HASH_FULL 0x02 /* Check every hash bucket */ @@ -155,9 +155,9 @@ extern int shadow_audit_enable; extern int shadow_audit_enable; #endif -/* +/* * Levels of optimization - * XXX should go in config files somewhere? + * XXX should go in config files somewhere? */ #define SHOPT_WRITABLE_HEURISTIC 0x01 /* Guess at RW PTEs via linear maps */ #define SHOPT_EARLY_UNSHADOW 0x02 /* Unshadow l1s on fork or exit */ @@ -167,21 +167,21 @@ extern int shadow_audit_enable; #define SHADOW_OPTIMIZATIONS 0x0f -/* With shadow pagetables, the different kinds of address start +/* With shadow pagetables, the different kinds of address start * to get get confusing. - * - * Virtual addresses are what they usually are: the addresses that are used - * to accessing memory while the guest is running. The MMU translates from - * virtual addresses to machine addresses. - * + * + * Virtual addresses are what they usually are: the addresses that are used + * to accessing memory while the guest is running. The MMU translates from + * virtual addresses to machine addresses. + * * (Pseudo-)physical addresses are the abstraction of physical memory the - * guest uses for allocation and so forth. For the purposes of this code, + * guest uses for allocation and so forth. For the purposes of this code, * we can largely ignore them. * * Guest frame numbers (gfns) are the entries that the guest puts in its * pagetables. For normal paravirtual guests, they are actual frame numbers, - * with the translation done by the guest. - * + * with the translation done by the guest. + * * Machine frame numbers (mfns) are the entries that the hypervisor puts * in the shadow page tables. * @@ -195,10 +195,10 @@ extern int shadow_audit_enable; /* With this defined, we do some ugly things to force the compiler to * give us type safety between mfns and gfns and other integers. - * TYPE_SAFE(int foo) defines a foo_t, and _foo() and foo_x() functions + * TYPE_SAFE(int foo) defines a foo_t, and _foo() and foo_x() functions * that translate beween int and foo_t. - * - * It does have some performance cost because the types now have + * + * It does have some performance cost because the types now have * a different storage attribute, so may not want it on all the time. */ #ifndef NDEBUG #define TYPE_SAFETY 1 @@ -279,13 +279,13 @@ struct shadow_paging_mode { void *src, u32 bytes, struct x86_emulate_ctxt *ctxt); int (*x86_emulate_cmpxchg )(struct vcpu *v, unsigned long va, - unsigned long old, + unsigned long old, unsigned long new, unsigned int bytes, struct x86_emulate_ctxt *ctxt); int (*x86_emulate_cmpxchg8b )(struct vcpu *v, unsigned long va, - unsigned long old_lo, - unsigned long old_hi, + unsigned long old_lo, + unsigned long old_hi, unsigned long new_lo, unsigned long new_hi, struct x86_emulate_ctxt *ctxt); @@ -296,7 +296,7 @@ struct shadow_paging_mode { void (*guest_get_eff_l1e )(struct vcpu *v, unsigned long va, void *eff_l1e); #if SHADOW_OPTIMIZATIONS & SHOPT_WRITABLE_HEURISTIC - int (*guess_wrmap )(struct vcpu *v, + int (*guess_wrmap )(struct vcpu *v, unsigned long vaddr, mfn_t gmfn); #endif /* For outsiders to tell what mode we're in */ @@ -319,9 +319,9 @@ int shadow_enable(struct domain *d, u32 /* Turning on shadow test mode */ int shadow_test_enable(struct domain *d); -/* Handler for shadow control ops: enabling and disabling shadow modes, +/* Handler for shadow control ops: enabling and disabling shadow modes, * and log-dirty bitmap ops all happen through here. */ -int shadow_domctl(struct domain *d, +int shadow_domctl(struct domain *d, xen_domctl_shadow_op_t *sc, XEN_GUEST_HANDLE(xen_domctl_t) u_domctl); @@ -395,7 +395,7 @@ shadow_gva_to_gfn(struct vcpu *v, unsign static inline void shadow_update_cr3(struct vcpu *v) -/* Updates all the things that are derived from the guest's CR3. +/* Updates all the things that are derived from the guest's CR3. * Called when the guest changes CR3. */ { shadow_lock(v->domain); @@ -406,7 +406,7 @@ shadow_update_cr3(struct vcpu *v) /* Should be called after CR3 is updated. * Updates vcpu->arch.cr3 and, for HVM guests, vcpu->arch.hvm_vcpu.cpu_cr3. - * + * * Also updates other state derived from CR3 (vcpu->arch.guest_vtable, * shadow_vtable, etc). * @@ -474,12 +474,12 @@ guest_map_l1e(struct vcpu *v, unsigned l l2_pgentry_t l2e; ASSERT(!shadow_mode_external(v->domain)); /* Find this l1e and its enclosing l1mfn in the linear map */ - if ( __copy_from_user(&l2e, + if ( __copy_from_user(&l2e, &__linear_l2_table[l2_linear_offset(addr)], sizeof(l2_pgentry_t)) != 0 ) return NULL; /* Check flags that it will be safe to read the l1e */ - if ( (l2e_get_flags(l2e) & (_PAGE_PRESENT | _PAGE_PSE)) + if ( (l2e_get_flags(l2e) & (_PAGE_PRESENT | _PAGE_PSE)) != _PAGE_PRESENT ) return NULL; *gl1mfn = l2e_get_pfn(l2e); @@ -502,13 +502,13 @@ guest_get_eff_l1e(struct vcpu *v, unsign if ( likely(!shadow_mode_translate(v->domain)) ) { ASSERT(!shadow_mode_external(v->domain)); - if ( __copy_from_user(eff_l1e, + if ( __copy_from_user(eff_l1e, &__linear_l1_table[l1_linear_offset(addr)], sizeof(l1_pgentry_t)) != 0 ) *(l1_pgentry_t *)eff_l1e = l1e_empty(); return; } - + v->arch.shadow.mode->guest_get_eff_l1e(v, addr, eff_l1e); } @@ -531,22 +531,22 @@ guest_get_eff_kern_l1e(struct vcpu *v, u /* Validate a pagetable change from the guest and update the shadows. */ extern int shadow_validate_guest_entry(struct vcpu *v, mfn_t gmfn, void *new_guest_entry); -extern int __shadow_validate_guest_entry(struct vcpu *v, mfn_t gmfn, +extern int __shadow_validate_guest_entry(struct vcpu *v, mfn_t gmfn, void *entry, u32 size); /* Update the shadows in response to a pagetable write from a HVM guest */ -extern void shadow_validate_guest_pt_write(struct vcpu *v, mfn_t gmfn, +extern void shadow_validate_guest_pt_write(struct vcpu *v, mfn_t gmfn, void *entry, u32 size); /* Remove all writeable mappings of a guest frame from the shadows. - * Returns non-zero if we need to flush TLBs. + * Returns non-zero if we need to flush TLBs. * level and fault_addr desribe how we found this to be a pagetable; * level==0 means we have some other reason for revoking write access. */ extern int shadow_remove_write_access(struct vcpu *v, mfn_t readonly_mfn, unsigned int level, unsigned long fault_addr); -/* Remove all mappings of the guest mfn from the shadows. +/* Remove all mappings of the guest mfn from the shadows. * Returns non-zero if we need to flush TLBs. */ extern int shadow_remove_all_mappings(struct vcpu *v, mfn_t target_mfn); @@ -603,8 +603,8 @@ shadow_guest_physmap_remove_page(struct /* Used for hysteresis when automatically unhooking mappings on fork/exit */ #define SHF_unhooked_mappings (1u<<31) -/* - * Allocation of shadow pages +/* + * Allocation of shadow pages */ /* Return the minumum acceptable number of shadow pages a domain needs */ @@ -613,7 +613,7 @@ unsigned int shadow_min_acceptable_pages /* Set the pool of shadow pages to the required number of MB. * Input will be rounded up to at least min_acceptable_shadow_pages(). * Returns 0 for success, 1 for failure. */ -unsigned int shadow_set_allocation(struct domain *d, +unsigned int shadow_set_allocation(struct domain *d, unsigned int megabytes, int *preempted); @@ -626,7 +626,7 @@ static inline unsigned int shadow_get_al } /* - * Linked list for chaining entries in the shadow hash table. + * Linked list for chaining entries in the shadow hash table. */ struct shadow_hash_entry { struct shadow_hash_entry *next; @@ -651,8 +651,8 @@ struct shadow_hash_entry { #define SH_WALK_CACHE_ENTRIES 4 -/* Rather than cache a guest walk, which would include mapped pointers - * to pages, we cache what a TLB would remember about the walk: the +/* Rather than cache a guest walk, which would include mapped pointers + * to pages, we cache what a TLB would remember about the walk: the * permissions and the l1 gfn */ struct shadow_walk_cache { unsigned long va; /* The virtual address (or 0 == unused) */ @@ -710,4 +710,3 @@ gl1e_to_ml1e(struct domain *d, l1_pgentr * indent-tabs-mode: nil * End: */ - diff -r 20204db0891b xen/include/xen/event.h --- a/xen/include/xen/event.h Thu Nov 02 18:52:04 2006 +0000 +++ b/xen/include/xen/event.h Fri Nov 03 12:12:48 2006 +0800 @@ -55,7 +55,7 @@ void notify_via_xen_event_channel(int lp void notify_via_xen_event_channel(int lport); /* Wait on a Xen-attached event channel. */ -#define wait_on_xen_event_channel(port, condition) \ +#define wait_on_xen_event_channel(condition) \ do { \ if ( condition ) \ break; \ @@ -70,7 +70,7 @@ void notify_via_xen_event_channel(int lp do_softirq(); \ } while ( 0 ) -#define prepare_wait_on_xen_event_channel(port) \ +#define prepare_wait_on_xen_event_channel() \ do { \ set_bit(_VCPUF_blocked_in_xen, ¤t->vcpu_flags); \ raise_softirq(SCHEDULE_SOFTIRQ); \