ia64/xen-unstable

changeset 12797:4f1a3ae07dbc

[IA64] implement free_irq_vector() paravirtualization

This avoids a double free error message since dom0 isn't
actually using the ia64_vector_mask.

Signed-off-by: Akio Takebe <takebe_akio@jp.fujitsu.com>
author awilliam@xenbuild2.aw
date Thu Dec 07 04:15:54 2006 -0700 (2006-12-07)
parents d901f2fe8c25
children 3bd97b4fe77d
files linux-2.6-xen-sparse/arch/ia64/kernel/iosapic.c linux-2.6-xen-sparse/arch/ia64/kernel/irq_ia64.c xen/arch/ia64/xen/hypercall.c xen/include/public/physdev.h
line diff
     1.1 --- a/linux-2.6-xen-sparse/arch/ia64/kernel/iosapic.c	Wed Dec 06 02:34:46 2006 -0700
     1.2 +++ b/linux-2.6-xen-sparse/arch/ia64/kernel/iosapic.c	Thu Dec 07 04:15:54 2006 -0700
     1.3 @@ -197,6 +197,16 @@ int xen_assign_irq_vector(int irq)
     1.4  
     1.5  	return irq_op.vector;
     1.6  }
     1.7 +
     1.8 +void xen_free_irq_vector(int vector)
     1.9 +{
    1.10 +	struct physdev_irq irq_op;
    1.11 +
    1.12 +	irq_op.vector = vector;
    1.13 +	if (HYPERVISOR_physdev_op(PHYSDEVOP_free_irq_vector, &irq_op))
    1.14 +		printk(KERN_WARNING "%s: xen_free_irq_vecotr fail vector=%d\n",
    1.15 +		       __FUNCTION__, vector);
    1.16 +}
    1.17  #endif /* XEN */
    1.18  
    1.19  /*
     2.1 --- a/linux-2.6-xen-sparse/arch/ia64/kernel/irq_ia64.c	Wed Dec 06 02:34:46 2006 -0700
     2.2 +++ b/linux-2.6-xen-sparse/arch/ia64/kernel/irq_ia64.c	Thu Dec 07 04:15:54 2006 -0700
     2.3 @@ -94,6 +94,13 @@ free_irq_vector (int vector)
     2.4  	if (vector < IA64_FIRST_DEVICE_VECTOR || vector > IA64_LAST_DEVICE_VECTOR)
     2.5  		return;
     2.6  
     2.7 +#ifdef CONFIG_XEN
     2.8 +	if (is_running_on_xen()) {
     2.9 +		extern void xen_free_irq_vector(int);
    2.10 +		xen_free_irq_vector(vector);
    2.11 +		return;
    2.12 +	}
    2.13 +#endif
    2.14  	pos = vector - IA64_FIRST_DEVICE_VECTOR;
    2.15  	if (!test_and_clear_bit(pos, ia64_vector_mask))
    2.16  		printk(KERN_WARNING "%s: double free!\n", __FUNCTION__);
     3.1 --- a/xen/arch/ia64/xen/hypercall.c	Wed Dec 06 02:34:46 2006 -0700
     3.2 +++ b/xen/arch/ia64/xen/hypercall.c	Thu Dec 07 04:15:54 2006 -0700
     3.3 @@ -454,6 +454,29 @@ static long do_physdev_op(int cmd, XEN_G
     3.4          break;
     3.5      }
     3.6  
     3.7 +    case PHYSDEVOP_free_irq_vector: {
     3.8 +        struct physdev_irq irq_op;
     3.9 +        int vector;
    3.10 +
    3.11 +        ret = -EFAULT;
    3.12 +        if ( copy_from_guest(&irq_op, arg, 1) != 0 )
    3.13 +            break;
    3.14 +
    3.15 +        ret = -EPERM;
    3.16 +        if ( !IS_PRIV(current->domain) )
    3.17 +            break;
    3.18 +
    3.19 +        ret = -EINVAL;
    3.20 +        vector = irq_op.vector;
    3.21 +        if (vector < IA64_FIRST_DEVICE_VECTOR ||
    3.22 +            vector > IA64_LAST_DEVICE_VECTOR)
    3.23 +            break;
    3.24 +        
    3.25 +        free_irq_vector(vector);
    3.26 +        ret = 0;
    3.27 +        break;
    3.28 +    }
    3.29 +
    3.30      default:
    3.31          ret = -ENOSYS;
    3.32          break;
     4.1 --- a/xen/include/public/physdev.h	Wed Dec 06 02:34:46 2006 -0700
     4.2 +++ b/xen/include/public/physdev.h	Thu Dec 07 04:15:54 2006 -0700
     4.3 @@ -152,6 +152,7 @@ DEFINE_XEN_GUEST_HANDLE(physdev_op_t);
     4.4  #define PHYSDEVOP_APIC_READ              PHYSDEVOP_apic_read
     4.5  #define PHYSDEVOP_APIC_WRITE             PHYSDEVOP_apic_write
     4.6  #define PHYSDEVOP_ASSIGN_VECTOR          PHYSDEVOP_alloc_irq_vector
     4.7 +#define PHYSDEVOP_FREE_VECTOR            PHYSDEVOP_free_irq_vector
     4.8  #define PHYSDEVOP_IRQ_NEEDS_UNMASK_NOTIFY XENIRQSTAT_needs_eoi
     4.9  #define PHYSDEVOP_IRQ_SHARED             XENIRQSTAT_shared
    4.10