direct-io.hg

changeset 5704:9b73afea874e

Certain types of event channel are now auto-bound to vcpu0 by Xen.
Make sure that xenolinux agrees with this.
author sos22@douglas.cl.cam.ac.uk
date Fri Jul 08 15:35:43 2005 +0000 (2005-07-08)
parents 1d375ce8e0e0
children 05b63285047c
files linux-2.6.11-xen-sparse/arch/xen/i386/kernel/smpboot.c linux-2.6.11-xen-sparse/arch/xen/kernel/ctrl_if.c linux-2.6.11-xen-sparse/arch/xen/kernel/evtchn.c
line diff
     1.1 --- a/linux-2.6.11-xen-sparse/arch/xen/i386/kernel/smpboot.c	Fri Jul 08 14:17:54 2005 +0000
     1.2 +++ b/linux-2.6.11-xen-sparse/arch/xen/i386/kernel/smpboot.c	Fri Jul 08 15:35:43 2005 +0000
     1.3 @@ -1533,13 +1533,13 @@ void __init smp_intr_init(void)
     1.4  	int cpu = smp_processor_id();
     1.5  
     1.6  	per_cpu(resched_irq, cpu) =
     1.7 -		bind_ipi_to_irq(RESCHEDULE_VECTOR);
     1.8 +		bind_ipi_on_cpu_to_irq(RESCHEDULE_VECTOR);
     1.9  	sprintf(resched_name[cpu], "resched%d", cpu);
    1.10  	BUG_ON(request_irq(per_cpu(resched_irq, cpu), smp_reschedule_interrupt,
    1.11  	                   SA_INTERRUPT, resched_name[cpu], NULL));
    1.12  
    1.13  	per_cpu(callfunc_irq, cpu) =
    1.14 -		bind_ipi_to_irq(CALL_FUNCTION_VECTOR);
    1.15 +		bind_ipi_on_cpu_to_irq(CALL_FUNCTION_VECTOR);
    1.16  	sprintf(callfunc_name[cpu], "callfunc%d", cpu);
    1.17  	BUG_ON(request_irq(per_cpu(callfunc_irq, cpu),
    1.18  	                   smp_call_function_interrupt,
     2.1 --- a/linux-2.6.11-xen-sparse/arch/xen/kernel/ctrl_if.c	Fri Jul 08 14:17:54 2005 +0000
     2.2 +++ b/linux-2.6.11-xen-sparse/arch/xen/kernel/ctrl_if.c	Fri Jul 08 15:35:43 2005 +0000
     2.3 @@ -491,6 +491,8 @@ void ctrl_if_resume(void)
     2.4           * pick up its end of the event channel from 
     2.5           */
     2.6          evtchn_op_t op;
     2.7 +	extern void bind_evtchn_to_cpu(unsigned port, unsigned cpu);
     2.8 +
     2.9          op.cmd = EVTCHNOP_bind_interdomain;
    2.10          op.u.bind_interdomain.dom1 = DOMID_SELF;
    2.11          op.u.bind_interdomain.dom2 = DOMID_SELF;
    2.12 @@ -500,6 +502,7 @@ void ctrl_if_resume(void)
    2.13              BUG();
    2.14          xen_start_info.domain_controller_evtchn = op.u.bind_interdomain.port1;
    2.15          initdom_ctrlif_domcontroller_port   = op.u.bind_interdomain.port2;
    2.16 +	bind_evtchn_to_cpu(op.u.bind_interdomain.port1, 0);
    2.17      }
    2.18  
    2.19      /* Sync up with shared indexes. */
     3.1 --- a/linux-2.6.11-xen-sparse/arch/xen/kernel/evtchn.c	Fri Jul 08 14:17:54 2005 +0000
     3.2 +++ b/linux-2.6.11-xen-sparse/arch/xen/kernel/evtchn.c	Fri Jul 08 15:35:43 2005 +0000
     3.3 @@ -86,7 +86,7 @@ static u32 cpu_evtchn_mask[NR_CPUS][NR_E
     3.4       cpu_evtchn_mask[cpu][idx] &                \
     3.5       ~(sh)->evtchn_mask[idx])
     3.6  
     3.7 -static void bind_evtchn_to_cpu(unsigned int chn, unsigned int cpu)
     3.8 +void bind_evtchn_to_cpu(unsigned int chn, unsigned int cpu)
     3.9  {
    3.10      clear_bit(chn, (unsigned long *)cpu_evtchn_mask[cpu_evtchn[chn]]);
    3.11      set_bit(chn, (unsigned long *)cpu_evtchn_mask[cpu]);
    3.12 @@ -99,8 +99,9 @@ static void bind_evtchn_to_cpu(unsigned 
    3.13      ((sh)->evtchn_pending[idx] &                \
    3.14       ~(sh)->evtchn_mask[idx])
    3.15  
    3.16 -#define bind_evtchn_to_cpu(chn,cpu) ((void)0)
    3.17 -
    3.18 +void bind_evtchn_to_cpu(unsigned int chn, unsigned int cpu)
    3.19 +{
    3.20 +}
    3.21  #endif
    3.22  
    3.23  /* Upcall to generic IRQ layer. */
    3.24 @@ -228,6 +229,13 @@ void unbind_virq_from_irq(int virq)
    3.25          if ( HYPERVISOR_event_channel_op(&op) != 0 )
    3.26              panic("Failed to unbind virtual IRQ %d\n", virq);
    3.27  
    3.28 +	/* This is a slight hack.  Interdomain ports can be allocated
    3.29 +	   directly by userspace, and at that point they get bound by
    3.30 +	   Xen to vcpu 0.  We therefore need to make sure that if we
    3.31 +	   get an event on an event channel we don't know about vcpu 0
    3.32 +	   handles it.  Binding channels to vcpu 0 when closing them
    3.33 +	   achieves this. */
    3.34 +	bind_evtchn_to_cpu(evtchn, 0);
    3.35          evtchn_to_irq[evtchn] = -1;
    3.36          irq_to_evtchn[irq]    = -1;
    3.37          per_cpu(virq_to_irq, cpu)[virq]     = -1;
    3.38 @@ -320,6 +328,8 @@ void unbind_ipi_from_irq(int ipi)
    3.39  	if ( HYPERVISOR_event_channel_op(&op) != 0 )
    3.40  	    panic("Failed to unbind virtual IPI %d on cpu %d\n", ipi, cpu);
    3.41  
    3.42 +	/* See comments in unbind_virq_from_irq */
    3.43 +	bind_evtchn_to_cpu(evtchn, 0);
    3.44          evtchn_to_irq[evtchn] = -1;
    3.45          irq_to_evtchn[irq]    = -1;
    3.46  	per_cpu(ipi_to_evtchn, cpu)[ipi] = 0;
    3.47 @@ -474,6 +484,7 @@ static unsigned int startup_pirq(unsigne
    3.48  
    3.49      pirq_query_unmask(irq_to_pirq(irq));
    3.50  
    3.51 +    bind_evtchn_to_cpu(evtchn, 0);
    3.52      evtchn_to_irq[evtchn] = irq;
    3.53      irq_to_evtchn[irq]    = evtchn;
    3.54  
    3.55 @@ -499,6 +510,7 @@ static void shutdown_pirq(unsigned int i
    3.56      if ( HYPERVISOR_event_channel_op(&op) != 0 )
    3.57          panic("Failed to unbind physical IRQ %d\n", irq);
    3.58  
    3.59 +    bind_evtchn_to_cpu(evtchn, 0);
    3.60      evtchn_to_irq[evtchn] = -1;
    3.61      irq_to_evtchn[irq]    = -1;
    3.62  }
    3.63 @@ -598,6 +610,7 @@ void irq_resume(void)
    3.64          evtchn = op.u.bind_virq.port;
    3.65          
    3.66          /* Record the new mapping. */
    3.67 +	bind_evtchn_to_cpu(evtchn, 0);
    3.68          evtchn_to_irq[evtchn] = irq;
    3.69          irq_to_evtchn[irq]    = evtchn;
    3.70