ia64/xen-unstable
changeset 8362:050333773f09
Merged.
author | emellor@leeni.uk.xensource.com |
---|---|
date | Wed Dec 14 12:04:40 2005 +0000 (2005-12-14) |
parents | 52916bfbfa35 6691252943d1 |
children | 57ceee48a0e5 |
files |
line diff
1.1 --- a/linux-2.6-xen-sparse/arch/xen/kernel/evtchn.c Wed Dec 14 12:03:40 2005 +0000 1.2 +++ b/linux-2.6-xen-sparse/arch/xen/kernel/evtchn.c Wed Dec 14 12:04:40 2005 +0000 1.3 @@ -639,6 +639,44 @@ void notify_remote_via_irq(int irq) 1.4 } 1.5 EXPORT_SYMBOL(notify_remote_via_irq); 1.6 1.7 +void mask_evtchn(int port) 1.8 +{ 1.9 + shared_info_t *s = HYPERVISOR_shared_info; 1.10 + synch_set_bit(port, &s->evtchn_mask[0]); 1.11 +} 1.12 +EXPORT_SYMBOL(mask_evtchn); 1.13 + 1.14 +void unmask_evtchn(int port) 1.15 +{ 1.16 + shared_info_t *s = HYPERVISOR_shared_info; 1.17 + unsigned int cpu = smp_processor_id(); 1.18 + vcpu_info_t *vcpu_info = &s->vcpu_info[cpu]; 1.19 + 1.20 + /* Slow path (hypercall) if this is a non-local port. */ 1.21 + if (unlikely(cpu != cpu_from_evtchn(port))) { 1.22 + evtchn_op_t op = { .cmd = EVTCHNOP_unmask, 1.23 + .u.unmask.port = port }; 1.24 + (void)HYPERVISOR_event_channel_op(&op); 1.25 + return; 1.26 + } 1.27 + 1.28 + synch_clear_bit(port, &s->evtchn_mask[0]); 1.29 + 1.30 + /* 1.31 + * The following is basically the equivalent of 'hw_resend_irq'. Just 1.32 + * like a real IO-APIC we 'lose the interrupt edge' if the channel is 1.33 + * masked. 1.34 + */ 1.35 + if (synch_test_bit(port, &s->evtchn_pending[0]) && 1.36 + !synch_test_and_set_bit(port / BITS_PER_LONG, 1.37 + &vcpu_info->evtchn_pending_sel)) { 1.38 + vcpu_info->evtchn_upcall_pending = 1; 1.39 + if (!vcpu_info->evtchn_upcall_mask) 1.40 + force_evtchn_callback(); 1.41 + } 1.42 +} 1.43 +EXPORT_SYMBOL(unmask_evtchn); 1.44 + 1.45 void irq_resume(void) 1.46 { 1.47 evtchn_op_t op;
2.1 --- a/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c Wed Dec 14 12:03:40 2005 +0000 2.2 +++ b/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c Wed Dec 14 12:04:40 2005 +0000 2.3 @@ -10,8 +10,11 @@ 2.4 * Copyright (c) 2005, Christopher Clark 2.5 * Copyright (c) 2005, XenSource Ltd 2.6 * 2.7 - * This file may be distributed separately from the Linux kernel, or 2.8 - * incorporated into other software packages, subject to the following license: 2.9 + * This program is free software; you can redistribute it and/or 2.10 + * modify it under the terms of the GNU General Public License version 2 2.11 + * as published by the Free Software Foundation; or, when distributed 2.12 + * separately from the Linux kernel or incorporated into other 2.13 + * software packages, subject to the following license: 2.14 * 2.15 * Permission is hereby granted, free of charge, to any person obtaining a copy 2.16 * of this source file (the "Software"), to deal in the Software without 2.17 @@ -820,7 +823,7 @@ static void xlblk_exit(void) 2.18 } 2.19 module_exit(xlblk_exit); 2.20 2.21 -MODULE_LICENSE("BSD"); 2.22 +MODULE_LICENSE("Dual BSD/GPL"); 2.23 2.24 2.25 /*
3.1 --- a/linux-2.6-xen-sparse/drivers/xen/console/console.c Wed Dec 14 12:03:40 2005 +0000 3.2 +++ b/linux-2.6-xen-sparse/drivers/xen/console/console.c Wed Dec 14 12:04:40 2005 +0000 3.3 @@ -168,7 +168,7 @@ static void kcons_write_dom0( 3.4 3.5 static struct tty_driver *kcons_device(struct console *c, int *index) 3.6 { 3.7 - *index = c->index; 3.8 + *index = 0; 3.9 return xencons_driver; 3.10 } 3.11
4.1 --- a/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c Wed Dec 14 12:03:40 2005 +0000 4.2 +++ b/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c Wed Dec 14 12:04:40 2005 +0000 4.3 @@ -4,8 +4,11 @@ 4.4 * Copyright (c) 2002-2005, K A Fraser 4.5 * Copyright (c) 2005, XenSource Ltd 4.6 * 4.7 - * This file may be distributed separately from the Linux kernel, or 4.8 - * incorporated into other software packages, subject to the following license: 4.9 + * This program is free software; you can redistribute it and/or 4.10 + * modify it under the terms of the GNU General Public License version 2 4.11 + * as published by the Free Software Foundation; or, when distributed 4.12 + * separately from the Linux kernel or incorporated into other 4.13 + * software packages, subject to the following license: 4.14 * 4.15 * Permission is hereby granted, free of charge, to any person obtaining a copy 4.16 * of this source file (the "Software"), to deal in the Software without 4.17 @@ -1294,7 +1297,7 @@ static void netif_exit(void) 4.18 } 4.19 module_exit(netif_exit); 4.20 4.21 -MODULE_LICENSE("BSD"); 4.22 +MODULE_LICENSE("Dual BSD/GPL"); 4.23 4.24 4.25 /* ** /proc **/
5.1 --- a/linux-2.6-xen-sparse/include/asm-xen/asm-i386/pgtable-2level.h Wed Dec 14 12:03:40 2005 +0000 5.2 +++ b/linux-2.6-xen-sparse/include/asm-xen/asm-i386/pgtable-2level.h Wed Dec 14 12:04:40 2005 +0000 5.3 @@ -15,26 +15,19 @@ 5.4 */ 5.5 #define set_pte(pteptr, pteval) (*(pteptr) = pteval) 5.6 5.7 -inline static void set_pte_at(struct mm_struct *mm, unsigned long addr, 5.8 - pte_t *ptep, pte_t val ) 5.9 -{ 5.10 - if ( ((mm != current->mm) && (mm != &init_mm)) || 5.11 - HYPERVISOR_update_va_mapping( (addr), (val), 0 ) ) 5.12 - { 5.13 - set_pte(ptep, val); 5.14 - } 5.15 -} 5.16 +#define set_pte_at(_mm,addr,ptep,pteval) do { \ 5.17 + if (((_mm) != current->mm && (_mm) != &init_mm) || \ 5.18 + HYPERVISOR_update_va_mapping((addr), (pteval), 0)) \ 5.19 + set_pte((ptep), (pteval)); \ 5.20 +} while (0) 5.21 5.22 -inline static void set_pte_at_sync(struct mm_struct *mm, unsigned long addr, 5.23 - pte_t *ptep, pte_t val ) 5.24 -{ 5.25 - if ( ((mm != current->mm) && (mm != &init_mm)) || 5.26 - HYPERVISOR_update_va_mapping( (addr), (val), UVMF_INVLPG ) ) 5.27 - { 5.28 - set_pte(ptep, val); 5.29 - xen_invlpg(addr); 5.30 - } 5.31 -} 5.32 +#define set_pte_at_sync(_mm,addr,ptep,pteval) do { \ 5.33 + if (((_mm) != current->mm && (_mm) != &init_mm) || \ 5.34 + HYPERVISOR_update_va_mapping((addr), (pteval), UVMF_INVLPG)) { \ 5.35 + set_pte((ptep), (pteval)); \ 5.36 + xen_invlpg((addr)); \ 5.37 + } \ 5.38 +} while (0) 5.39 5.40 #define set_pte_atomic(pteptr, pteval) set_pte(pteptr,pteval) 5.41
6.1 --- a/linux-2.6-xen-sparse/include/asm-xen/asm-i386/pgtable-3level.h Wed Dec 14 12:03:40 2005 +0000 6.2 +++ b/linux-2.6-xen-sparse/include/asm-xen/asm-i386/pgtable-3level.h Wed Dec 14 12:04:40 2005 +0000 6.3 @@ -69,26 +69,19 @@ static inline void set_pte(pte_t *ptep, 6.4 # define set_pte_atomic(pteptr,pteval) set_pte(pteptr,pteval) 6.5 #endif 6.6 6.7 -inline static void set_pte_at(struct mm_struct *mm, unsigned long addr, 6.8 - pte_t *ptep, pte_t val ) 6.9 -{ 6.10 - if ( ((mm != current->mm) && (mm != &init_mm)) || 6.11 - HYPERVISOR_update_va_mapping( (addr), (val), 0 ) ) 6.12 - { 6.13 - set_pte(ptep, val); 6.14 - } 6.15 -} 6.16 +#define set_pte_at(_mm,addr,ptep,pteval) do { \ 6.17 + if (((_mm) != current->mm && (_mm) != &init_mm) || \ 6.18 + HYPERVISOR_update_va_mapping((addr), (pteval), 0)) \ 6.19 + set_pte((ptep), (pteval)); \ 6.20 +} while (0) 6.21 6.22 -inline static void set_pte_at_sync(struct mm_struct *mm, unsigned long addr, 6.23 - pte_t *ptep, pte_t val ) 6.24 -{ 6.25 - if ( ((mm != current->mm) && (mm != &init_mm)) || 6.26 - HYPERVISOR_update_va_mapping( (addr), (val), UVMF_INVLPG ) ) 6.27 - { 6.28 - set_pte(ptep, val); 6.29 - xen_invlpg(addr); 6.30 - } 6.31 -} 6.32 +#define set_pte_at_sync(_mm,addr,ptep,pteval) do { \ 6.33 + if (((_mm) != current->mm && (_mm) != &init_mm) || \ 6.34 + HYPERVISOR_update_va_mapping((addr), (pteval), UVMF_INVLPG)) { \ 6.35 + set_pte((ptep), (pteval)); \ 6.36 + xen_invlpg((addr)); \ 6.37 + } \ 6.38 +} while (0) 6.39 6.40 #ifdef CONFIG_XEN_SHADOW_MODE 6.41 # define set_pmd(pmdptr,pmdval) \
7.1 --- a/linux-2.6-xen-sparse/include/asm-xen/asm-x86_64/pgtable.h Wed Dec 14 12:03:40 2005 +0000 7.2 +++ b/linux-2.6-xen-sparse/include/asm-xen/asm-x86_64/pgtable.h Wed Dec 14 12:04:40 2005 +0000 7.3 @@ -266,15 +266,11 @@ static inline unsigned long pud_bad(pud_ 7.4 return val & ~(_PAGE_PRESENT | _PAGE_RW | _PAGE_ACCESSED); 7.5 } 7.6 7.7 -inline static void set_pte_at(struct mm_struct *mm, unsigned long addr, 7.8 - pte_t *ptep, pte_t val ) 7.9 -{ 7.10 - if ( ((mm != current->mm) && (mm != &init_mm)) || 7.11 - HYPERVISOR_update_va_mapping( (addr), (val), 0 ) ) 7.12 - { 7.13 - set_pte(ptep, val); 7.14 - } 7.15 -} 7.16 +#define set_pte_at(_mm,addr,ptep,pteval) do { \ 7.17 + if (((_mm) != current->mm && (_mm) != &init_mm) || \ 7.18 + HYPERVISOR_update_va_mapping((addr), (pteval), 0)) \ 7.19 + set_pte((ptep), (pteval)); \ 7.20 +} while (0) 7.21 7.22 #define pte_none(x) (!(x).pte) 7.23 #define pte_present(x) ((x).pte & (_PAGE_PRESENT | _PAGE_PROTNONE))
8.1 --- a/linux-2.6-xen-sparse/include/asm-xen/evtchn.h Wed Dec 14 12:03:40 2005 +0000 8.2 +++ b/linux-2.6-xen-sparse/include/asm-xen/evtchn.h Wed Dec 14 12:04:40 2005 +0000 8.3 @@ -79,46 +79,16 @@ extern int bind_ipi_to_irqhandler( 8.4 */ 8.5 extern void unbind_from_irqhandler(unsigned int irq, void *dev_id); 8.6 8.7 -/* 8.8 - * Unlike notify_remote_via_evtchn(), this is safe to use across 8.9 - * save/restore. Notifications on a broken connection are silently dropped. 8.10 - */ 8.11 -void notify_remote_via_irq(int irq); 8.12 - 8.13 extern void irq_resume(void); 8.14 8.15 /* Entry point for notifications into Linux subsystems. */ 8.16 asmlinkage void evtchn_do_upcall(struct pt_regs *regs); 8.17 8.18 /* Entry point for notifications into the userland character device. */ 8.19 -void evtchn_device_upcall(int port); 8.20 - 8.21 -static inline void mask_evtchn(int port) 8.22 -{ 8.23 - shared_info_t *s = HYPERVISOR_shared_info; 8.24 - synch_set_bit(port, &s->evtchn_mask[0]); 8.25 -} 8.26 - 8.27 -static inline void unmask_evtchn(int port) 8.28 -{ 8.29 - shared_info_t *s = HYPERVISOR_shared_info; 8.30 - vcpu_info_t *vcpu_info = &s->vcpu_info[smp_processor_id()]; 8.31 +extern void evtchn_device_upcall(int port); 8.32 8.33 - synch_clear_bit(port, &s->evtchn_mask[0]); 8.34 - 8.35 - /* 8.36 - * The following is basically the equivalent of 'hw_resend_irq'. Just 8.37 - * like a real IO-APIC we 'lose the interrupt edge' if the channel is 8.38 - * masked. 8.39 - */ 8.40 - if (synch_test_bit(port, &s->evtchn_pending[0]) && 8.41 - !synch_test_and_set_bit(port / BITS_PER_LONG, 8.42 - &vcpu_info->evtchn_pending_sel)) { 8.43 - vcpu_info->evtchn_upcall_pending = 1; 8.44 - if (!vcpu_info->evtchn_upcall_mask) 8.45 - force_evtchn_callback(); 8.46 - } 8.47 -} 8.48 +extern void mask_evtchn(int port); 8.49 +extern void unmask_evtchn(int port); 8.50 8.51 static inline void clear_evtchn(int port) 8.52 { 8.53 @@ -134,6 +104,12 @@ static inline void notify_remote_via_evt 8.54 (void)HYPERVISOR_event_channel_op(&op); 8.55 } 8.56 8.57 +/* 8.58 + * Unlike notify_remote_via_evtchn(), this is safe to use across 8.59 + * save/restore. Notifications on a broken connection are silently dropped. 8.60 + */ 8.61 +extern void notify_remote_via_irq(int irq); 8.62 + 8.63 #endif /* __ASM_EVTCHN_H__ */ 8.64 8.65 /*
9.1 --- a/xen/common/event_channel.c Wed Dec 14 12:03:40 2005 +0000 9.2 +++ b/xen/common/event_channel.c Wed Dec 14 12:04:40 2005 +0000 9.3 @@ -3,7 +3,7 @@ 9.4 * 9.5 * Event notifications from VIRQs, PIRQs, and other domains. 9.6 * 9.7 - * Copyright (c) 2003-2004, K A Fraser. 9.8 + * Copyright (c) 2003-2005, K A Fraser. 9.9 * 9.10 * This program is distributed in the hope that it will be useful, 9.11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 9.12 @@ -541,6 +541,41 @@ static long evtchn_bind_vcpu(evtchn_bind 9.13 return rc; 9.14 } 9.15 9.16 +static long evtchn_unmask(evtchn_unmask_t *unmask) 9.17 +{ 9.18 + struct domain *d = current->domain; 9.19 + shared_info_t *s = d->shared_info; 9.20 + int port = unmask->port; 9.21 + struct vcpu *v; 9.22 + 9.23 + spin_lock(&d->evtchn_lock); 9.24 + 9.25 + if ( unlikely(!port_is_valid(d, port)) ) 9.26 + { 9.27 + spin_unlock(&d->evtchn_lock); 9.28 + return -EINVAL; 9.29 + } 9.30 + 9.31 + v = d->vcpu[evtchn_from_port(d, port)->notify_vcpu_id]; 9.32 + 9.33 + /* 9.34 + * These operations must happen in strict order. Based on 9.35 + * include/xen/event.h:evtchn_set_pending(). 9.36 + */ 9.37 + if ( test_and_clear_bit(port, &s->evtchn_mask[0]) && 9.38 + test_bit (port, &s->evtchn_pending[0]) && 9.39 + !test_and_set_bit (port / BITS_PER_LONG, 9.40 + &v->vcpu_info->evtchn_pending_sel) && 9.41 + !test_and_set_bit (0, &v->vcpu_info->evtchn_upcall_pending) ) 9.42 + { 9.43 + evtchn_notify(v); 9.44 + } 9.45 + 9.46 + spin_unlock(&d->evtchn_lock); 9.47 + 9.48 + return 0; 9.49 +} 9.50 + 9.51 long do_event_channel_op(evtchn_op_t *uop) 9.52 { 9.53 long rc; 9.54 @@ -602,6 +637,10 @@ long do_event_channel_op(evtchn_op_t *uo 9.55 rc = evtchn_bind_vcpu(&op.u.bind_vcpu); 9.56 break; 9.57 9.58 + case EVTCHNOP_unmask: 9.59 + rc = evtchn_unmask(&op.u.unmask); 9.60 + break; 9.61 + 9.62 default: 9.63 rc = -ENOSYS; 9.64 break;
10.1 --- a/xen/include/public/event_channel.h Wed Dec 14 12:03:40 2005 +0000 10.2 +++ b/xen/include/public/event_channel.h Wed Dec 14 12:04:40 2005 +0000 10.3 @@ -164,6 +164,16 @@ typedef struct evtchn_bind_vcpu { 10.4 uint32_t vcpu; 10.5 } evtchn_bind_vcpu_t; 10.6 10.7 +/* 10.8 + * EVTCHNOP_unmask: Unmask the specified local event-channel port and deliver 10.9 + * a notification to the appropriate VCPU if an event is pending. 10.10 + */ 10.11 +#define EVTCHNOP_unmask 9 10.12 +typedef struct evtchn_unmask { 10.13 + /* IN parameters. */ 10.14 + evtchn_port_t port; 10.15 +} evtchn_unmask_t; 10.16 + 10.17 typedef struct evtchn_op { 10.18 uint32_t cmd; /* EVTCHNOP_* */ 10.19 union { 10.20 @@ -176,6 +186,7 @@ typedef struct evtchn_op { 10.21 evtchn_send_t send; 10.22 evtchn_status_t status; 10.23 evtchn_bind_vcpu_t bind_vcpu; 10.24 + evtchn_unmask_t unmask; 10.25 } u; 10.26 } evtchn_op_t; 10.27
11.1 --- a/xen/include/xen/event.h Wed Dec 14 12:03:40 2005 +0000 11.2 +++ b/xen/include/xen/event.h Wed Dec 14 12:04:40 2005 +0000 11.3 @@ -3,7 +3,7 @@ 11.4 * 11.5 * A nice interface for passing asynchronous events to guest OSes. 11.6 * 11.7 - * Copyright (c) 2002, K A Fraser 11.8 + * Copyright (c) 2002-2005, K A Fraser 11.9 */ 11.10 11.11 #ifndef __XEN_EVENT_H__