ia64/xen-unstable

changeset 5793:c1a7ed266c7e

Catch up to xen-unstable.hg tip
author djm@kirby.fc.hp.com
date Sat Jul 09 06:54:10 2005 -0700 (2005-07-09)
parents 95f14bb8d220 215d8b2f3d94
children 40be48f67a33
files .hgignore Makefile buildconfigs/mk.linux-2.6-xen docs/misc/hg-cheatsheet.txt extras/mini-os/Makefile extras/mini-os/events.c extras/mini-os/hypervisor.c extras/mini-os/include/events.h extras/mini-os/include/hypervisor.h extras/mini-os/include/lib.h extras/mini-os/include/mm.h extras/mini-os/include/os.h extras/mini-os/include/time.h extras/mini-os/include/traps.h extras/mini-os/include/types.h extras/mini-os/kernel.c extras/mini-os/time.c extras/mini-os/traps.c extras/mini-os/x86_32.S linux-2.6.11-xen-sparse/arch/xen/configs/xen0_defconfig_x86_32 linux-2.6.11-xen-sparse/arch/xen/configs/xenU_defconfig_x86_32 linux-2.6.11-xen-sparse/arch/xen/configs/xen_defconfig_x86_32 linux-2.6.11-xen-sparse/arch/xen/configs/xen_defconfig_x86_64 linux-2.6.11-xen-sparse/arch/xen/i386/kernel/irq.c 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 linux-2.6.11-xen-sparse/drivers/xen/blkback/interface.c linux-2.6.11-xen-sparse/include/asm-xen/asm-i386/mach-xen/irq_vectors.h linux-2.6.11-xen-sparse/include/asm-xen/asm-x86_64/mach-xen/irq_vectors.h patches/linux-2.6.11/smp-alts.patch tools/Rules.mk tools/firmware/vmxassist/Makefile tools/libxc/xc.h tools/libxc/xc_domain.c tools/libxc/xc_linux_build.c tools/misc/cpuperf/Makefile tools/python/xen/lowlevel/xc/xc.c tools/python/xen/xend/XendDomainInfo.py tools/python/xen/xm/main.py tools/xenstore/Makefile xen/Makefile xen/arch/ia64/hyperprivop.S xen/arch/x86/traps.c xen/common/dom0_ops.c xen/common/event_channel.c xen/common/schedule.c xen/include/acm/acm_core.h xen/include/public/acm.h xen/include/public/dom0_ops.h xen/include/public/event_channel.h xen/include/public/io/domain_controller.h
line diff
     1.1 --- a/Makefile	Thu Jul 07 10:12:52 2005 -0700
     1.2 +++ b/Makefile	Sat Jul 09 06:54:10 2005 -0700
     1.3 @@ -177,10 +177,10 @@ uninstall:
     1.4  
     1.5  # Legacy targets for compatibility
     1.6  linux24:
     1.7 -	$(MAKE) 'KERNELS=linux-2.4*' dist
     1.8 +	$(MAKE) 'KERNELS=linux-2.4*' kernels
     1.9  
    1.10  linux26:
    1.11 -	$(MAKE) 'KERNELS=linux-2.6*' dist
    1.12 +	$(MAKE) 'KERNELS=linux-2.6*' kernels
    1.13  
    1.14  netbsd20:
    1.15  	$(MAKE) netbsd-2.0-xenU-build
     2.1 --- a/linux-2.6.11-xen-sparse/arch/xen/i386/kernel/irq.c	Thu Jul 07 10:12:52 2005 -0700
     2.2 +++ b/linux-2.6.11-xen-sparse/arch/xen/i386/kernel/irq.c	Sat Jul 09 06:54:10 2005 -0700
     2.3 @@ -274,7 +274,7 @@ void fixup_irqs(cpumask_t map)
     2.4  		}
     2.5  		if (irq_desc[irq].handler->set_affinity)
     2.6  			irq_desc[irq].handler->set_affinity(irq, mask);
     2.7 -		else if (irq_desc[irq].action && !(warned++))
     2.8 +		else if (irq_desc[irq].action)
     2.9  			printk("Cannot set affinity for irq %i\n", irq);
    2.10  	}
    2.11  
     3.1 --- a/linux-2.6.11-xen-sparse/arch/xen/i386/kernel/smpboot.c	Thu Jul 07 10:12:52 2005 -0700
     3.2 +++ b/linux-2.6.11-xen-sparse/arch/xen/i386/kernel/smpboot.c	Sat Jul 09 06:54:10 2005 -0700
     3.3 @@ -1312,7 +1312,7 @@ void __devinit smp_prepare_boot_cpu(void
     3.4  
     3.5  /* hotplug down/up funtion pointer and target vcpu */
     3.6  struct vcpu_hotplug_handler_t {
     3.7 -	void (*fn)();
     3.8 +	void (*fn)(int vcpu);
     3.9  	u32 vcpu;
    3.10  };
    3.11  static struct vcpu_hotplug_handler_t vcpu_hotplug_handler;
    3.12 @@ -1333,11 +1333,8 @@ static int __devinit cpu_enable(unsigned
    3.13  	while (!cpu_online(cpu))
    3.14  		cpu_relax();
    3.15  
    3.16 -   /* re-route bound IRQs 0 to cpu */
    3.17 -   rebind_evtchn_from_irq(0, cpu,  per_cpu(resched_irq, cpu));
    3.18 -   rebind_evtchn_from_irq(0, cpu, per_cpu(callfunc_irq, cpu));
    3.19 +	fixup_irqs(cpu_online_map);
    3.20  
    3.21 -	fixup_irqs(cpu_online_map);
    3.22  	/* counter the disable in fixup_irqs() */
    3.23  	local_irq_enable();
    3.24  	return 0;
    3.25 @@ -1359,18 +1356,9 @@ int __cpu_disable(void)
    3.26  	if (cpu == 0)
    3.27  		return -EBUSY;
    3.28  
    3.29 -	/* Allow any queued timer interrupts to get serviced */
    3.30 -	local_irq_enable();
    3.31 -	mdelay(1);
    3.32 -	local_irq_disable();
    3.33 -
    3.34  	cpu_clear(cpu, map);
    3.35  	fixup_irqs(map);
    3.36  
    3.37 -   /* re-route IRQs from dead vcpu to another */
    3.38 -   rebind_evtchn_from_irq(cpu, 0,  per_cpu(resched_irq, cpu));
    3.39 -   rebind_evtchn_from_irq(cpu, 0, per_cpu(callfunc_irq, cpu));
    3.40 -
    3.41  	/* It's now safe to remove this processor from the online map */
    3.42  	cpu_clear(cpu, cpu_online_map);
    3.43  
    3.44 @@ -1533,13 +1521,13 @@ void __init smp_intr_init(void)
    3.45  	int cpu = smp_processor_id();
    3.46  
    3.47  	per_cpu(resched_irq, cpu) =
    3.48 -		bind_ipi_on_cpu_to_irq(cpu, RESCHEDULE_VECTOR);
    3.49 +		bind_ipi_on_cpu_to_irq(RESCHEDULE_VECTOR);
    3.50  	sprintf(resched_name[cpu], "resched%d", cpu);
    3.51  	BUG_ON(request_irq(per_cpu(resched_irq, cpu), smp_reschedule_interrupt,
    3.52  	                   SA_INTERRUPT, resched_name[cpu], NULL));
    3.53  
    3.54  	per_cpu(callfunc_irq, cpu) =
    3.55 -		bind_ipi_on_cpu_to_irq(cpu, CALL_FUNCTION_VECTOR);
    3.56 +		bind_ipi_on_cpu_to_irq(CALL_FUNCTION_VECTOR);
    3.57  	sprintf(callfunc_name[cpu], "callfunc%d", cpu);
    3.58  	BUG_ON(request_irq(per_cpu(callfunc_irq, cpu),
    3.59  	                   smp_call_function_interrupt,
     4.1 --- a/linux-2.6.11-xen-sparse/arch/xen/kernel/ctrl_if.c	Thu Jul 07 10:12:52 2005 -0700
     4.2 +++ b/linux-2.6.11-xen-sparse/arch/xen/kernel/ctrl_if.c	Sat Jul 09 06:54:10 2005 -0700
     4.3 @@ -491,6 +491,8 @@ void ctrl_if_resume(void)
     4.4           * pick up its end of the event channel from 
     4.5           */
     4.6          evtchn_op_t op;
     4.7 +	extern void bind_evtchn_to_cpu(unsigned port, unsigned cpu);
     4.8 +
     4.9          op.cmd = EVTCHNOP_bind_interdomain;
    4.10          op.u.bind_interdomain.dom1 = DOMID_SELF;
    4.11          op.u.bind_interdomain.dom2 = DOMID_SELF;
    4.12 @@ -500,6 +502,7 @@ void ctrl_if_resume(void)
    4.13              BUG();
    4.14          xen_start_info.domain_controller_evtchn = op.u.bind_interdomain.port1;
    4.15          initdom_ctrlif_domcontroller_port   = op.u.bind_interdomain.port2;
    4.16 +	bind_evtchn_to_cpu(op.u.bind_interdomain.port1, 0);
    4.17      }
    4.18  
    4.19      /* Sync up with shared indexes. */
     5.1 --- a/linux-2.6.11-xen-sparse/arch/xen/kernel/evtchn.c	Thu Jul 07 10:12:52 2005 -0700
     5.2 +++ b/linux-2.6.11-xen-sparse/arch/xen/kernel/evtchn.c	Sat Jul 09 06:54:10 2005 -0700
     5.3 @@ -86,7 +86,7 @@ static u32 cpu_evtchn_mask[NR_CPUS][NR_E
     5.4       cpu_evtchn_mask[cpu][idx] &                \
     5.5       ~(sh)->evtchn_mask[idx])
     5.6  
     5.7 -static void bind_evtchn_to_cpu(unsigned int chn, unsigned int cpu)
     5.8 +void bind_evtchn_to_cpu(unsigned int chn, unsigned int cpu)
     5.9  {
    5.10      clear_bit(chn, (unsigned long *)cpu_evtchn_mask[cpu_evtchn[chn]]);
    5.11      set_bit(chn, (unsigned long *)cpu_evtchn_mask[cpu]);
    5.12 @@ -99,8 +99,9 @@ static void bind_evtchn_to_cpu(unsigned 
    5.13      ((sh)->evtchn_pending[idx] &                \
    5.14       ~(sh)->evtchn_mask[idx])
    5.15  
    5.16 -#define bind_evtchn_to_cpu(chn,cpu) ((void)0)
    5.17 -
    5.18 +void bind_evtchn_to_cpu(unsigned int chn, unsigned int cpu)
    5.19 +{
    5.20 +}
    5.21  #endif
    5.22  
    5.23  /* Upcall to generic IRQ layer. */
    5.24 @@ -228,6 +229,13 @@ void unbind_virq_from_irq(int virq)
    5.25          if ( HYPERVISOR_event_channel_op(&op) != 0 )
    5.26              panic("Failed to unbind virtual IRQ %d\n", virq);
    5.27  
    5.28 +	/* This is a slight hack.  Interdomain ports can be allocated
    5.29 +	   directly by userspace, and at that point they get bound by
    5.30 +	   Xen to vcpu 0.  We therefore need to make sure that if we
    5.31 +	   get an event on an event channel we don't know about vcpu 0
    5.32 +	   handles it.  Binding channels to vcpu 0 when closing them
    5.33 +	   achieves this. */
    5.34 +	bind_evtchn_to_cpu(evtchn, 0);
    5.35          evtchn_to_irq[evtchn] = -1;
    5.36          irq_to_evtchn[irq]    = -1;
    5.37          per_cpu(virq_to_irq, cpu)[virq]     = -1;
    5.38 @@ -236,17 +244,17 @@ void unbind_virq_from_irq(int virq)
    5.39      spin_unlock(&irq_mapping_update_lock);
    5.40  }
    5.41  
    5.42 -int bind_ipi_on_cpu_to_irq(int cpu, int ipi)
    5.43 +int bind_ipi_on_cpu_to_irq(int ipi)
    5.44  {
    5.45      evtchn_op_t op;
    5.46      int evtchn, irq;
    5.47 +    int cpu = smp_processor_id();
    5.48  
    5.49      spin_lock(&irq_mapping_update_lock);
    5.50  
    5.51      if ( (evtchn = per_cpu(ipi_to_evtchn, cpu)[ipi]) == 0 )
    5.52      {
    5.53 -        op.cmd                 = EVTCHNOP_bind_ipi;
    5.54 -        op.u.bind_ipi.ipi_vcpu = cpu;
    5.55 +        op.cmd = EVTCHNOP_bind_ipi;
    5.56          if ( HYPERVISOR_event_channel_op(&op) != 0 )
    5.57              panic("Failed to bind virtual IPI %d on cpu %d\n", ipi, cpu);
    5.58          evtchn = op.u.bind_ipi.port;
    5.59 @@ -271,41 +279,10 @@ int bind_ipi_on_cpu_to_irq(int cpu, int 
    5.60      return irq;
    5.61  }
    5.62  
    5.63 -void rebind_evtchn_from_ipi(int cpu, int newcpu, int ipi)
    5.64 +void unbind_ipi_from_irq(int ipi)
    5.65  {
    5.66      evtchn_op_t op;
    5.67 -    int evtchn = per_cpu(ipi_to_evtchn, cpu)[ipi];
    5.68 -
    5.69 -    spin_lock(&irq_mapping_update_lock);
    5.70 -
    5.71 -    op.cmd          = EVTCHNOP_rebind;
    5.72 -    op.u.rebind.port = evtchn;
    5.73 -    op.u.rebind.vcpu = newcpu;
    5.74 -    if ( HYPERVISOR_event_channel_op(&op) != 0 )
    5.75 -       printk(KERN_INFO "Failed to rebind IPI%d to CPU%d\n",ipi,newcpu);
    5.76 -
    5.77 -    spin_unlock(&irq_mapping_update_lock);
    5.78 -}
    5.79 -
    5.80 -void rebind_evtchn_from_irq(int cpu, int newcpu, int irq)
    5.81 -{
    5.82 -    evtchn_op_t op;
    5.83 -    int evtchn = irq_to_evtchn[irq];
    5.84 -
    5.85 -    spin_lock(&irq_mapping_update_lock);
    5.86 -
    5.87 -    op.cmd          = EVTCHNOP_rebind;
    5.88 -    op.u.rebind.port = evtchn;
    5.89 -    op.u.rebind.vcpu = newcpu;
    5.90 -    if ( HYPERVISOR_event_channel_op(&op) != 0 )
    5.91 -       printk(KERN_INFO "Failed to rebind IRQ%d to CPU%d\n",irq,newcpu);
    5.92 -
    5.93 -    spin_unlock(&irq_mapping_update_lock);
    5.94 -}
    5.95 -
    5.96 -void unbind_ipi_on_cpu_from_irq(int cpu, int ipi)
    5.97 -{
    5.98 -    evtchn_op_t op;
    5.99 +    int cpu    = smp_processor_id();
   5.100      int evtchn = per_cpu(ipi_to_evtchn, cpu)[ipi];
   5.101      int irq    = irq_to_evtchn[evtchn];
   5.102  
   5.103 @@ -319,6 +296,8 @@ void unbind_ipi_on_cpu_from_irq(int cpu,
   5.104  	if ( HYPERVISOR_event_channel_op(&op) != 0 )
   5.105  	    panic("Failed to unbind virtual IPI %d on cpu %d\n", ipi, cpu);
   5.106  
   5.107 +	/* See comments in unbind_virq_from_irq */
   5.108 +	bind_evtchn_to_cpu(evtchn, 0);
   5.109          evtchn_to_irq[evtchn] = -1;
   5.110          irq_to_evtchn[irq]    = -1;
   5.111  	per_cpu(ipi_to_evtchn, cpu)[ipi] = 0;
   5.112 @@ -362,6 +341,59 @@ void unbind_evtchn_from_irq(int evtchn)
   5.113      spin_unlock(&irq_mapping_update_lock);
   5.114  }
   5.115  
   5.116 +static void do_nothing_function(void *ign)
   5.117 +{
   5.118 +}
   5.119 +
   5.120 +/* Rebind an evtchn so that it gets delivered to a specific cpu */
   5.121 +static void rebind_irq_to_cpu(unsigned irq, unsigned tcpu)
   5.122 +{
   5.123 +    evtchn_op_t op;
   5.124 +    int evtchn;
   5.125 +
   5.126 +    spin_lock(&irq_mapping_update_lock);
   5.127 +    evtchn = irq_to_evtchn[irq];
   5.128 +    if (!VALID_EVTCHN(evtchn)) {
   5.129 +	spin_unlock(&irq_mapping_update_lock);
   5.130 +	return;
   5.131 +    }
   5.132 +
   5.133 +    /* Tell Xen to send future instances of this interrupt to the
   5.134 +       other vcpu */
   5.135 +    op.cmd = EVTCHNOP_bind_vcpu;
   5.136 +    op.u.bind_vcpu.port = evtchn;
   5.137 +    op.u.bind_vcpu.vcpu = tcpu;
   5.138 +
   5.139 +    /* If this fails, it usually just indicates that we're dealing
   5.140 +       with a virq or IPI channel, which don't actually need to be
   5.141 +       rebound.  Ignore it, but don't do the xenlinux-level rebind
   5.142 +       in that case. */
   5.143 +    if (HYPERVISOR_event_channel_op(&op) >= 0)
   5.144 +	bind_evtchn_to_cpu(evtchn, tcpu);
   5.145 +
   5.146 +    spin_unlock(&irq_mapping_update_lock);
   5.147 +
   5.148 +    /* Now send the new target processor a NOP IPI.  When this
   5.149 +       returns, it will check for any pending interrupts, and so
   5.150 +       service any that got delivered to the wrong processor by
   5.151 +       mistake. */
   5.152 +    /* XXX: The only time this is called with interrupts disabled is
   5.153 +       from the hotplug/hotunplug path.  In that case, all cpus are
   5.154 +       stopped with interrupts disabled, and the missed interrupts
   5.155 +       will be picked up when they start again.  This is kind of a
   5.156 +       hack.
   5.157 +    */
   5.158 +    if (!irqs_disabled()) {
   5.159 +	smp_call_function(do_nothing_function, NULL, 0, 0);
   5.160 +    }
   5.161 +}
   5.162 +
   5.163 +
   5.164 +static void set_affinity_irq(unsigned irq, cpumask_t dest)
   5.165 +{
   5.166 +    unsigned tcpu = first_cpu(dest);
   5.167 +    rebind_irq_to_cpu(irq, tcpu);
   5.168 +}
   5.169  
   5.170  /*
   5.171   * Interface to generic handling in irq.c
   5.172 @@ -424,7 +456,7 @@ static struct hw_interrupt_type dynirq_t
   5.173      disable_dynirq,
   5.174      ack_dynirq,
   5.175      end_dynirq,
   5.176 -    NULL
   5.177 +    set_affinity_irq
   5.178  };
   5.179  
   5.180  static inline void pirq_unmask_notify(int pirq)
   5.181 @@ -473,6 +505,7 @@ static unsigned int startup_pirq(unsigne
   5.182  
   5.183      pirq_query_unmask(irq_to_pirq(irq));
   5.184  
   5.185 +    bind_evtchn_to_cpu(evtchn, 0);
   5.186      evtchn_to_irq[evtchn] = irq;
   5.187      irq_to_evtchn[irq]    = evtchn;
   5.188  
   5.189 @@ -498,6 +531,7 @@ static void shutdown_pirq(unsigned int i
   5.190      if ( HYPERVISOR_event_channel_op(&op) != 0 )
   5.191          panic("Failed to unbind physical IRQ %d\n", irq);
   5.192  
   5.193 +    bind_evtchn_to_cpu(evtchn, 0);
   5.194      evtchn_to_irq[evtchn] = -1;
   5.195      irq_to_evtchn[irq]    = -1;
   5.196  }
   5.197 @@ -548,7 +582,7 @@ static struct hw_interrupt_type pirq_typ
   5.198      disable_pirq,
   5.199      ack_pirq,
   5.200      end_pirq,
   5.201 -    NULL
   5.202 +    set_affinity_irq
   5.203  };
   5.204  
   5.205  void irq_suspend(void)
   5.206 @@ -597,6 +631,7 @@ void irq_resume(void)
   5.207          evtchn = op.u.bind_virq.port;
   5.208          
   5.209          /* Record the new mapping. */
   5.210 +	bind_evtchn_to_cpu(evtchn, 0);
   5.211          evtchn_to_irq[evtchn] = irq;
   5.212          irq_to_evtchn[irq]    = evtchn;
   5.213  
     6.1 --- a/linux-2.6.11-xen-sparse/include/asm-xen/asm-i386/mach-xen/irq_vectors.h	Thu Jul 07 10:12:52 2005 -0700
     6.2 +++ b/linux-2.6.11-xen-sparse/include/asm-xen/asm-i386/mach-xen/irq_vectors.h	Sat Jul 09 06:54:10 2005 -0700
     6.3 @@ -128,8 +128,8 @@
     6.4  /* Dynamic binding of event channels and VIRQ sources to Linux IRQ space. */
     6.5  extern int  bind_virq_to_irq(int virq);
     6.6  extern void unbind_virq_from_irq(int virq);
     6.7 -extern int  bind_ipi_on_cpu_to_irq(int cpu, int ipi);
     6.8 -extern void unbind_ipi_on_cpu_from_irq(int cpu, int ipi);
     6.9 +extern int  bind_ipi_to_irq(int ipi);
    6.10 +extern void unbind_ipi_from_irq(int ipi);
    6.11  extern int  bind_evtchn_to_irq(int evtchn);
    6.12  extern void unbind_evtchn_from_irq(int evtchn);
    6.13  
     7.1 --- a/linux-2.6.11-xen-sparse/include/asm-xen/asm-x86_64/mach-xen/irq_vectors.h	Thu Jul 07 10:12:52 2005 -0700
     7.2 +++ b/linux-2.6.11-xen-sparse/include/asm-xen/asm-x86_64/mach-xen/irq_vectors.h	Sat Jul 09 06:54:10 2005 -0700
     7.3 @@ -126,8 +126,8 @@
     7.4  /* Dynamic binding of event channels and VIRQ sources to Linux IRQ space. */
     7.5  extern int  bind_virq_to_irq(int virq);
     7.6  extern void unbind_virq_from_irq(int virq);
     7.7 -extern int  bind_ipi_on_cpu_to_irq(int cpu, int ipi);
     7.8 -extern void unbind_ipi_on_cpu_from_irq(int cpu, int ipi);
     7.9 +extern int  bind_ipi_to_irq(int ipi);
    7.10 +extern void unbind_ipi_from_irq(int ipi);
    7.11  extern int  bind_evtchn_to_irq(int evtchn);
    7.12  extern void unbind_evtchn_from_irq(int evtchn);
    7.13  
     8.1 --- a/tools/libxc/xc.h	Thu Jul 07 10:12:52 2005 -0700
     8.2 +++ b/tools/libxc/xc.h	Sat Jul 09 06:54:10 2005 -0700
     8.3 @@ -192,6 +192,24 @@ int xc_domain_getinfo(int xc_handle,
     8.4                        xc_dominfo_t *info);
     8.5  
     8.6  /**
     8.7 + * This function will return information about one or more domains, using a
     8.8 + * single hypercall.  The domain information will be stored into the supplied
     8.9 + * array of xc_domaininfo_t structures.
    8.10 + *
    8.11 + * @parm xc_handle a handle to an open hypervisor interface
    8.12 + * @parm first_domain the first domain to enumerate information from.
    8.13 + *                    Domains are currently enumerate in order of creation.
    8.14 + * @parm max_domains the number of elements in info
    8.15 + * @parm info an array of max_doms size that will contain the information for
    8.16 + *            the enumerated domains.
    8.17 + * @return the number of domains enumerated or -1 on error
    8.18 + */
    8.19 +int xc_domain_getinfolist(int xc_handle,
    8.20 +                          u32 first_domain,
    8.21 +                          unsigned int max_domains,
    8.22 +                          xc_domaininfo_t *info);
    8.23 +
    8.24 +/**
    8.25   * This function returns information about one domain.  This information is
    8.26   * more detailed than the information from xc_domain_getinfo().
    8.27   *
     9.1 --- a/tools/libxc/xc_domain.c	Thu Jul 07 10:12:52 2005 -0700
     9.2 +++ b/tools/libxc/xc_domain.c	Sat Jul 09 06:54:10 2005 -0700
     9.3 @@ -125,6 +125,33 @@ int xc_domain_getinfo(int xc_handle,
     9.4      return nr_doms;
     9.5  }
     9.6  
     9.7 +int xc_domain_getinfolist(int xc_handle,
     9.8 +                          u32 first_domain,
     9.9 +                          unsigned int max_domains,
    9.10 +                          xc_domaininfo_t *info)
    9.11 +{
    9.12 +    int ret = 0;
    9.13 +    dom0_op_t op;
    9.14 +
    9.15 +    if(mlock(info, max_domains*sizeof(xc_domaininfo_t)) != 0)
    9.16 +        return -1;
    9.17 +    
    9.18 +    op.cmd = DOM0_GETDOMAININFOLIST;
    9.19 +    op.u.getdomaininfolist.first_domain = first_domain;
    9.20 +    op.u.getdomaininfolist.max_domains  = max_domains;
    9.21 +    op.u.getdomaininfolist.buffer       = info;
    9.22 +
    9.23 +    if(xc_dom0_op(xc_handle, &op) < 0)
    9.24 +        ret = -1;
    9.25 +    else
    9.26 +        ret = op.u.getdomaininfolist.num_domains;
    9.27 +    
    9.28 +    if(munlock(info, max_domains*sizeof(xc_domaininfo_t)) != 0)
    9.29 +        ret = -1;
    9.30 +    
    9.31 +    return ret;
    9.32 +}
    9.33 +
    9.34  int xc_domain_get_vcpu_context(int xc_handle,
    9.35                                 u32 domid,
    9.36                                 u32 vcpu,
    10.1 --- a/tools/python/xen/lowlevel/xc/xc.c	Thu Jul 07 10:12:52 2005 -0700
    10.2 +++ b/tools/python/xen/lowlevel/xc/xc.c	Sat Jul 09 06:54:10 2005 -0700
    10.3 @@ -688,7 +688,7 @@ static PyObject *pyxc_physinfo(PyObject 
    10.4      if ( xc_physinfo(xc->xc_handle, &info) != 0 )
    10.5          return PyErr_SetFromErrno(xc_error);
    10.6  
    10.7 -    return Py_BuildValue("{s:i,s:i,s:l,s:l,s:l}",
    10.8 +    return Py_BuildValue("{s:i,s:i,s:i,s:i,s:l,s:l,s:i}",
    10.9                           "threads_per_core", info.threads_per_core,
   10.10                           "cores_per_socket", info.cores_per_socket,
   10.11                           "sockets_per_node", info.sockets_per_node,
    11.1 --- a/xen/arch/x86/traps.c	Thu Jul 07 10:12:52 2005 -0700
    11.2 +++ b/xen/arch/x86/traps.c	Sat Jul 09 06:54:10 2005 -0700
    11.3 @@ -94,6 +94,9 @@ DECLARE_TRAP_HANDLER(alignment_check);
    11.4  DECLARE_TRAP_HANDLER(spurious_interrupt_bug);
    11.5  DECLARE_TRAP_HANDLER(machine_check);
    11.6  
    11.7 +long do_set_debugreg(int reg, unsigned long value);
    11.8 +unsigned long do_get_debugreg(int reg);
    11.9 +
   11.10  static int debug_stack_lines = 20;
   11.11  integer_param("debug_stack_lines", debug_stack_lines);
   11.12  
   11.13 @@ -568,8 +571,8 @@ static inline int admin_io_okay(
   11.14  static int emulate_privileged_op(struct cpu_user_regs *regs)
   11.15  {
   11.16      struct vcpu *v = current;
   11.17 -    unsigned long *reg, eip = regs->eip;
   11.18 -    u8 opcode, modrm_reg = 0, rep_prefix = 0;
   11.19 +    unsigned long *reg, eip = regs->eip, res;
   11.20 +    u8 opcode, modrm_reg = 0, modrm_rm = 0, rep_prefix = 0;
   11.21      unsigned int port, i, op_bytes = 4, data;
   11.22  
   11.23      /* Legacy prefixes. */
   11.24 @@ -604,7 +607,9 @@ static int emulate_privileged_op(struct 
   11.25      if ( (opcode & 0xf0) == 0x40 )
   11.26      {
   11.27          modrm_reg = (opcode & 4) << 1;  /* REX.R */
   11.28 -        /* REX.W, REX.B and REX.X do not need to be decoded. */
   11.29 +        modrm_rm  = (opcode & 1) << 3;  /* REX.B */
   11.30 +
   11.31 +        /* REX.W and REX.X do not need to be decoded. */
   11.32          opcode = insn_fetch(u8, 1, eip);
   11.33      }
   11.34  #endif
   11.35 @@ -782,11 +787,10 @@ static int emulate_privileged_op(struct 
   11.36  
   11.37      case 0x20: /* MOV CR?,<reg> */
   11.38          opcode = insn_fetch(u8, 1, eip);
   11.39 -        if ( (opcode & 0xc0) != 0xc0 )
   11.40 -            goto fail;
   11.41 -        modrm_reg |= opcode & 7;
   11.42 -        reg = decode_register(modrm_reg, regs, 0);
   11.43 -        switch ( (opcode >> 3) & 7 )
   11.44 +        modrm_reg |= (opcode >> 3) & 7;
   11.45 +        modrm_rm  |= (opcode >> 0) & 7;
   11.46 +        reg = decode_register(modrm_rm, regs, 0);
   11.47 +        switch ( modrm_reg )
   11.48          {
   11.49          case 0: /* Read CR0 */
   11.50              *reg = v->arch.guest_context.ctrlreg[0];
   11.51 @@ -805,13 +809,22 @@ static int emulate_privileged_op(struct 
   11.52          }
   11.53          break;
   11.54  
   11.55 +    case 0x21: /* MOV DR?,<reg> */
   11.56 +        opcode = insn_fetch(u8, 1, eip);
   11.57 +        modrm_reg |= (opcode >> 3) & 7;
   11.58 +        modrm_rm  |= (opcode >> 0) & 7;
   11.59 +        reg = decode_register(modrm_rm, regs, 0);
   11.60 +        if ( (res = do_get_debugreg(modrm_reg)) > (unsigned long)-256 )
   11.61 +            goto fail;
   11.62 +        *reg = res;
   11.63 +        break;
   11.64 +
   11.65      case 0x22: /* MOV <reg>,CR? */
   11.66          opcode = insn_fetch(u8, 1, eip);
   11.67 -        if ( (opcode & 0xc0) != 0xc0 )
   11.68 -            goto fail;
   11.69 -        modrm_reg |= opcode & 7;
   11.70 -        reg = decode_register(modrm_reg, regs, 0);
   11.71 -        switch ( (opcode >> 3) & 7 )
   11.72 +        modrm_reg |= (opcode >> 3) & 7;
   11.73 +        modrm_rm  |= (opcode >> 0) & 7;
   11.74 +        reg = decode_register(modrm_rm, regs, 0);
   11.75 +        switch ( modrm_reg )
   11.76          {
   11.77          case 0: /* Write CR0 */
   11.78              (void)do_fpu_taskswitch(!!(*reg & X86_CR0_TS));
   11.79 @@ -827,6 +840,15 @@ static int emulate_privileged_op(struct 
   11.80              UNLOCK_BIGLOCK(v->domain);
   11.81              break;
   11.82  
   11.83 +    case 0x23: /* MOV <reg>,DR? */
   11.84 +        opcode = insn_fetch(u8, 1, eip);
   11.85 +        modrm_reg |= (opcode >> 3) & 7;
   11.86 +        modrm_rm  |= (opcode >> 0) & 7;
   11.87 +        reg = decode_register(modrm_rm, regs, 0);
   11.88 +        if ( do_set_debugreg(modrm_reg, *reg) != 0 )
   11.89 +            goto fail;
   11.90 +        break;
   11.91 +
   11.92          default:
   11.93              goto fail;
   11.94          }
    12.1 --- a/xen/common/dom0_ops.c	Thu Jul 07 10:12:52 2005 -0700
    12.2 +++ b/xen/common/dom0_ops.c	Sat Jul 09 06:54:10 2005 -0700
    12.3 @@ -88,6 +88,60 @@ static int allocate_domid(domid_t *pdom)
    12.4      return err;
    12.5  }
    12.6  
    12.7 +static void getdomaininfo(struct domain *d, dom0_getdomaininfo_t *info)
    12.8 +{
    12.9 +    struct vcpu   *v;
   12.10 +    u64 cpu_time = 0;
   12.11 +    int vcpu_count = 0;
   12.12 +    int flags = DOMFLAGS_PAUSED | DOMFLAGS_BLOCKED;
   12.13 +    
   12.14 +    info->domain = d->domain_id;
   12.15 +    
   12.16 +    memset(&info->vcpu_to_cpu, -1, sizeof(info->vcpu_to_cpu));
   12.17 +    memset(&info->cpumap, 0, sizeof(info->cpumap));
   12.18 +    
   12.19 +    /* 
   12.20 +     * - domain is marked as paused or blocked only if all its vcpus 
   12.21 +     *   are paused or blocked 
   12.22 +     * - domain is marked as running if any of its vcpus is running
   12.23 +     * - only map vcpus that aren't down.  Note, at some point we may
   12.24 +     *   wish to demux the -1 value to indicate down vs. not-ever-booted
   12.25 +     *   
   12.26 +     */
   12.27 +    for_each_vcpu ( d, v ) {
   12.28 +        /* only map vcpus that are up */
   12.29 +        if ( !(test_bit(_VCPUF_down, &v->vcpu_flags)) )
   12.30 +            info->vcpu_to_cpu[v->vcpu_id] = v->processor;
   12.31 +        info->cpumap[v->vcpu_id] = v->cpumap;
   12.32 +        if ( !(v->vcpu_flags & VCPUF_ctrl_pause) )
   12.33 +            flags &= ~DOMFLAGS_PAUSED;
   12.34 +        if ( !(v->vcpu_flags & VCPUF_blocked) )
   12.35 +            flags &= ~DOMFLAGS_BLOCKED;
   12.36 +        if ( v->vcpu_flags & VCPUF_running )
   12.37 +            flags |= DOMFLAGS_RUNNING;
   12.38 +        if ( v->cpu_time > cpu_time )
   12.39 +            cpu_time += v->cpu_time;
   12.40 +        vcpu_count++;
   12.41 +    }
   12.42 +    
   12.43 +    info->cpu_time = cpu_time;
   12.44 +    info->n_vcpu = vcpu_count;
   12.45 +    
   12.46 +    info->flags = flags |
   12.47 +        ((d->domain_flags & DOMF_dying)    ? DOMFLAGS_DYING    : 0) |
   12.48 +        ((d->domain_flags & DOMF_shutdown) ? DOMFLAGS_SHUTDOWN : 0) |
   12.49 +        d->shutdown_code << DOMFLAGS_SHUTDOWNSHIFT;
   12.50 +
   12.51 +    if (d->ssid != NULL)
   12.52 +        info->ssidref = ((struct acm_ssid_domain *)d->ssid)->ssidref;
   12.53 +    else    
   12.54 +        info->ssidref = ACM_DEFAULT_SSID;
   12.55 +    
   12.56 +    info->tot_pages         = d->tot_pages;
   12.57 +    info->max_pages         = d->max_pages;
   12.58 +    info->shared_info_frame = __pa(d->shared_info) >> PAGE_SHIFT;
   12.59 +}
   12.60 +
   12.61  long do_dom0_op(dom0_op_t *u_dom0_op)
   12.62  {
   12.63      long ret = 0;
   12.64 @@ -306,10 +360,6 @@ long do_dom0_op(dom0_op_t *u_dom0_op)
   12.65      case DOM0_GETDOMAININFO:
   12.66      { 
   12.67          struct domain *d;
   12.68 -        struct vcpu   *v;
   12.69 -        u64 cpu_time = 0;
   12.70 -        int vcpu_count = 0;
   12.71 -        int flags = DOMFLAGS_PAUSED | DOMFLAGS_BLOCKED;
   12.72  
   12.73          read_lock(&domlist_lock);
   12.74  
   12.75 @@ -328,54 +378,7 @@ long do_dom0_op(dom0_op_t *u_dom0_op)
   12.76  
   12.77          read_unlock(&domlist_lock);
   12.78  
   12.79 -        op->u.getdomaininfo.domain = d->domain_id;
   12.80 -
   12.81 -        memset(&op->u.getdomaininfo.vcpu_to_cpu, -1,
   12.82 -               sizeof(op->u.getdomaininfo.vcpu_to_cpu));
   12.83 -        memset(&op->u.getdomaininfo.cpumap, 0,
   12.84 -               sizeof(op->u.getdomaininfo.cpumap));
   12.85 -
   12.86 -        /* 
   12.87 -         * - domain is marked as paused or blocked only if all its vcpus 
   12.88 -         *   are paused or blocked 
   12.89 -         * - domain is marked as running if any of its vcpus is running
   12.90 -         * - only map vcpus that aren't down.  Note, at some point we may
   12.91 -         *   wish to demux the -1 value to indicate down vs. not-ever-booted
   12.92 -         *   
   12.93 -         */
   12.94 -        for_each_vcpu ( d, v ) {
   12.95 -            /* only map vcpus that are up */
   12.96 -            if ( !(test_bit(_VCPUF_down, &v->vcpu_flags)) )
   12.97 -                op->u.getdomaininfo.vcpu_to_cpu[v->vcpu_id] = v->processor;
   12.98 -            op->u.getdomaininfo.cpumap[v->vcpu_id]      = v->cpumap;
   12.99 -            if ( !(v->vcpu_flags & VCPUF_ctrl_pause) )
  12.100 -                flags &= ~DOMFLAGS_PAUSED;
  12.101 -            if ( !(v->vcpu_flags & VCPUF_blocked) )
  12.102 -                flags &= ~DOMFLAGS_BLOCKED;
  12.103 -            if ( v->vcpu_flags & VCPUF_running )
  12.104 -                flags |= DOMFLAGS_RUNNING;
  12.105 -            if ( v->cpu_time > cpu_time )
  12.106 -                cpu_time += v->cpu_time;
  12.107 -            vcpu_count++;
  12.108 -        }
  12.109 -
  12.110 -        op->u.getdomaininfo.cpu_time = cpu_time;
  12.111 -        op->u.getdomaininfo.n_vcpu = vcpu_count;
  12.112 -
  12.113 -        op->u.getdomaininfo.flags = flags |
  12.114 -            ((d->domain_flags & DOMF_dying)    ? DOMFLAGS_DYING    : 0) |
  12.115 -            ((d->domain_flags & DOMF_shutdown) ? DOMFLAGS_SHUTDOWN : 0) |
  12.116 -            d->shutdown_code << DOMFLAGS_SHUTDOWNSHIFT;
  12.117 -
  12.118 -        if (d->ssid != NULL)
  12.119 -            op->u.getdomaininfo.ssidref = ((struct acm_ssid_domain *)d->ssid)->ssidref;
  12.120 -        else    
  12.121 -            op->u.getdomaininfo.ssidref = ACM_DEFAULT_SSID;
  12.122 -
  12.123 -        op->u.getdomaininfo.tot_pages   = d->tot_pages;
  12.124 -        op->u.getdomaininfo.max_pages   = d->max_pages;
  12.125 -        op->u.getdomaininfo.shared_info_frame = 
  12.126 -            __pa(d->shared_info) >> PAGE_SHIFT;
  12.127 +        getdomaininfo(d, &op->u.getdomaininfo);
  12.128  
  12.129          if ( copy_to_user(u_dom0_op, op, sizeof(*op)) )     
  12.130              ret = -EINVAL;
  12.131 @@ -384,6 +387,53 @@ long do_dom0_op(dom0_op_t *u_dom0_op)
  12.132      }
  12.133      break;
  12.134  
  12.135 +    case DOM0_GETDOMAININFOLIST:
  12.136 +    { 
  12.137 +        struct domain *d;
  12.138 +        dom0_getdomaininfo_t info;
  12.139 +        dom0_getdomaininfo_t *buffer = op->u.getdomaininfolist.buffer;
  12.140 +        u32 num_domains = 0;
  12.141 +
  12.142 +        read_lock(&domlist_lock);
  12.143 +
  12.144 +        for_each_domain ( d )
  12.145 +        {
  12.146 +            if ( d->domain_id < op->u.getdomaininfolist.first_domain )
  12.147 +                continue;
  12.148 +            if ( num_domains == op->u.getdomaininfolist.max_domains )
  12.149 +                break;
  12.150 +            if ( (d == NULL) || !get_domain(d) )
  12.151 +            {
  12.152 +                ret = -ESRCH;
  12.153 +                break;
  12.154 +            }
  12.155 +
  12.156 +            getdomaininfo(d, &info);
  12.157 +
  12.158 +            put_domain(d);
  12.159 +
  12.160 +            if ( copy_to_user(buffer, &info, sizeof(dom0_getdomaininfo_t)) )
  12.161 +            {
  12.162 +                ret = -EINVAL;
  12.163 +                break;
  12.164 +            }
  12.165 +            
  12.166 +            buffer++;
  12.167 +            num_domains++;
  12.168 +        }
  12.169 +        
  12.170 +        read_unlock(&domlist_lock);
  12.171 +        
  12.172 +        if ( ret != 0 )
  12.173 +            break;
  12.174 +        
  12.175 +        op->u.getdomaininfolist.num_domains = num_domains;
  12.176 +
  12.177 +        if ( copy_to_user(u_dom0_op, op, sizeof(*op)) )
  12.178 +            ret = -EINVAL;
  12.179 +    }
  12.180 +    break;
  12.181 +
  12.182      case DOM0_GETVCPUCONTEXT:
  12.183      { 
  12.184          struct vcpu_guest_context *c;
    13.1 --- a/xen/common/event_channel.c	Thu Jul 07 10:12:52 2005 -0700
    13.2 +++ b/xen/common/event_channel.c	Sat Jul 09 06:54:10 2005 -0700
    13.3 @@ -283,10 +283,7 @@ static long evtchn_bind_ipi(evtchn_bind_
    13.4  {
    13.5      struct evtchn *chn;
    13.6      struct domain *d = current->domain;
    13.7 -    int            port, ipi_vcpu = bind->ipi_vcpu;
    13.8 -
    13.9 -    if ( (ipi_vcpu >= MAX_VIRT_CPUS) || (d->vcpu[ipi_vcpu] == NULL) )
   13.10 -        return -EINVAL;
   13.11 +    int            port;
   13.12  
   13.13      spin_lock(&d->evtchn_lock);
   13.14  
   13.15 @@ -294,7 +291,7 @@ static long evtchn_bind_ipi(evtchn_bind_
   13.16      {
   13.17          chn = evtchn_from_port(d, port);
   13.18          chn->state          = ECS_IPI;
   13.19 -        chn->notify_vcpu_id = ipi_vcpu;
   13.20 +        chn->notify_vcpu_id = current->vcpu_id;
   13.21      }
   13.22  
   13.23      spin_unlock(&d->evtchn_lock);
   13.24 @@ -325,7 +322,7 @@ static long evtchn_bind_pirq(evtchn_bind
   13.25      chn = evtchn_from_port(d, port);
   13.26  
   13.27      d->pirq_to_evtchn[pirq] = port;
   13.28 -    rc = pirq_guest_bind(d->vcpu[chn->notify_vcpu_id], pirq, 
   13.29 +    rc = pirq_guest_bind(d->vcpu[0], pirq, 
   13.30                           !!(bind->flags & BIND_PIRQ__WILL_SHARE));
   13.31      if ( rc != 0 )
   13.32      {
   13.33 @@ -437,7 +434,9 @@ static long __evtchn_close(struct domain
   13.34          BUG();
   13.35      }
   13.36  
   13.37 -    chn1->state = ECS_FREE;
   13.38 +    /* Reset binding to vcpu0 when the channel is freed. */
   13.39 +    chn1->state          = ECS_FREE;
   13.40 +    chn1->notify_vcpu_id = 0;
   13.41  
   13.42   out:
   13.43      if ( d2 != NULL )
   13.44 @@ -566,37 +565,55 @@ static long evtchn_status(evtchn_status_
   13.45          status->u.virq = chn->u.virq;
   13.46          break;
   13.47      case ECS_IPI:
   13.48 -        status->status     = EVTCHNSTAT_ipi;
   13.49 -        status->u.ipi_vcpu = chn->notify_vcpu_id;
   13.50 +        status->status = EVTCHNSTAT_ipi;
   13.51          break;
   13.52      default:
   13.53          BUG();
   13.54      }
   13.55  
   13.56 +    status->vcpu = chn->notify_vcpu_id;
   13.57 +
   13.58   out:
   13.59      spin_unlock(&d->evtchn_lock);
   13.60      put_domain(d);
   13.61      return rc;
   13.62  }
   13.63  
   13.64 -static long evtchn_rebind(evtchn_rebind_t *bind) 
   13.65 +static long evtchn_bind_vcpu(evtchn_bind_vcpu_t *bind) 
   13.66  {
   13.67      struct domain *d    = current->domain;
   13.68      int            port = bind->port;
   13.69      int            vcpu = bind->vcpu;
   13.70      struct evtchn *chn;
   13.71 -    long             rc = 0;
   13.72 +    long           rc = 0;
   13.73 +
   13.74 +    if ( (vcpu >= MAX_VIRT_CPUS) || (d->vcpu[vcpu] == NULL) ) {
   13.75 +        printf("vcpu %d bad.\n", vcpu);
   13.76 +        return -EINVAL;
   13.77 +    }
   13.78  
   13.79      spin_lock(&d->evtchn_lock);
   13.80  
   13.81      if ( !port_is_valid(d, port) )
   13.82      {
   13.83 +        printf("port %d bad.\n", port);
   13.84          rc = -EINVAL;
   13.85          goto out;
   13.86      }
   13.87  
   13.88      chn = evtchn_from_port(d, port);
   13.89 -    chn->notify_vcpu_id = vcpu;
   13.90 +    switch ( chn->state )
   13.91 +    {
   13.92 +    case ECS_UNBOUND:
   13.93 +    case ECS_INTERDOMAIN:
   13.94 +    case ECS_PIRQ:
   13.95 +        chn->notify_vcpu_id = vcpu;
   13.96 +        break;
   13.97 +    default:
   13.98 +        printf("evtchn type %d can't be rebound.\n", chn->state);
   13.99 +        rc = -EINVAL;
  13.100 +        break;
  13.101 +    }
  13.102  
  13.103   out:
  13.104      spin_unlock(&d->evtchn_lock);
  13.105 @@ -660,10 +677,8 @@ long do_event_channel_op(evtchn_op_t *uo
  13.106              rc = -EFAULT;
  13.107          break;
  13.108  
  13.109 -    case EVTCHNOP_rebind:
  13.110 -        rc = evtchn_rebind(&op.u.rebind);
  13.111 -        if ( (rc == 0) && (copy_to_user(uop, &op, sizeof(op)) != 0) )
  13.112 -            rc = -EFAULT;
  13.113 +    case EVTCHNOP_bind_vcpu:
  13.114 +        rc = evtchn_bind_vcpu(&op.u.bind_vcpu);
  13.115          break;
  13.116  
  13.117      default:
    14.1 --- a/xen/include/acm/acm_core.h	Thu Jul 07 10:12:52 2005 -0700
    14.2 +++ b/xen/include/acm/acm_core.h	Sat Jul 09 06:54:10 2005 -0700
    14.3 @@ -20,6 +20,7 @@
    14.4  
    14.5  #include <xen/spinlock.h>
    14.6  #include <public/acm.h>
    14.7 +#include <xen/acm_policy.h>
    14.8  #include <public/policy_ops.h>
    14.9  
   14.10  /* Xen-internal representation of the binary policy */
    15.1 --- a/xen/include/public/acm.h	Thu Jul 07 10:12:52 2005 -0700
    15.2 +++ b/xen/include/public/acm.h	Sat Jul 09 06:54:10 2005 -0700
    15.3 @@ -1,157 +0,0 @@
    15.4 -/****************************************************************
    15.5 - * acm.h
    15.6 - * 
    15.7 - * Copyright (C) 2005 IBM Corporation
    15.8 - *
    15.9 - * Author:
   15.10 - * Reiner Sailer <sailer@watson.ibm.com>
   15.11 - *
   15.12 - * Contributors:
   15.13 - * Stefan Berger <stefanb@watson.ibm.com> 
   15.14 - *	added network byte order support for binary policies
   15.15 - *
   15.16 - * This program is free software; you can redistribute it and/or
   15.17 - * modify it under the terms of the GNU General Public License as
   15.18 - * published by the Free Software Foundation, version 2 of the
   15.19 - * License.
   15.20 - *
   15.21 - * sHype general access control module header file.
   15.22 - *     here are all definitions that are shared between
   15.23 - *     xen-core, guest-kernels, and applications.
   15.24 - *
   15.25 - * todo: move from static policy choice to compile option.
   15.26 - */
   15.27 -
   15.28 -#ifndef _XEN_PUBLIC_ACM_H
   15.29 -#define _XEN_PUBLIC_ACM_H
   15.30 -
   15.31 -#include "xen.h"
   15.32 -#include "sched_ctl.h"
   15.33 -
   15.34 -/* if ACM_DEBUG defined, all hooks should
   15.35 - * print a short trace message (comment it out
   15.36 - * when not in testing mode )
   15.37 - */
   15.38 -/* #define ACM_DEBUG */
   15.39 -
   15.40 -#ifdef ACM_DEBUG
   15.41 -#  define printkd(fmt, args...) printk(fmt,## args)
   15.42 -#else
   15.43 -#  define printkd(fmt, args...)
   15.44 -#endif
   15.45 -
   15.46 -/* default ssid reference value if not supplied */
   15.47 -#define ACM_DEFAULT_SSID 	0x0
   15.48 -#define ACM_DEFAULT_LOCAL_SSID  0x0
   15.49 -
   15.50 -/* Internal ACM ERROR types */
   15.51 -#define ACM_OK				 0
   15.52 -#define ACM_UNDEF			-1
   15.53 -#define ACM_INIT_SSID_ERROR		-2
   15.54 -#define ACM_INIT_SOID_ERROR		-3
   15.55 -#define ACM_ERROR		        -4
   15.56 -
   15.57 -/* External ACCESS DECISIONS */
   15.58 -#define ACM_ACCESS_PERMITTED		0
   15.59 -#define ACM_ACCESS_DENIED		-111
   15.60 -#define ACM_NULL_POINTER_ERROR		-200
   15.61 -
   15.62 -#define ACM_MAX_POLICY  3
   15.63 -
   15.64 -#define ACM_NULL_POLICY	0
   15.65 -#define ACM_CHINESE_WALL_POLICY	1
   15.66 -#define ACM_SIMPLE_TYPE_ENFORCEMENT_POLICY 2
   15.67 -#define ACM_CHINESE_WALL_AND_SIMPLE_TYPE_ENFORCEMENT_POLICY 3
   15.68 -
   15.69 -/* policy: */
   15.70 -#define ACM_POLICY_NAME(X) \
   15.71 -	(X == ACM_NULL_POLICY) ? "NULL policy" : \
   15.72 -	(X == ACM_CHINESE_WALL_POLICY) ? "CHINESE WALL policy" : \
   15.73 -	(X == ACM_SIMPLE_TYPE_ENFORCEMENT_POLICY) ? "SIMPLE TYPE ENFORCEMENT policy" : \
   15.74 -	(X == ACM_CHINESE_WALL_AND_SIMPLE_TYPE_ENFORCEMENT_POLICY) ? "CHINESE WALL AND SIMPLE TYPE ENFORCEMENT policy" : \
   15.75 -	"UNDEFINED policy"
   15.76 -
   15.77 -/* defines a ssid reference used by xen */
   15.78 -typedef u32 ssidref_t;
   15.79 -
   15.80 -/* -------security policy relevant type definitions-------- */
   15.81 -
   15.82 -/* type identifier; compares to "equal" or "not equal" */
   15.83 -typedef u16 domaintype_t;
   15.84 -
   15.85 -/* CHINESE WALL POLICY DATA STRUCTURES
   15.86 - *
   15.87 - * current accumulated conflict type set:
   15.88 - * When a domain is started and has a type that is in
   15.89 - * a conflict set, the conflicting types are incremented in
   15.90 - * the aggregate set. When a domain is destroyed, the 
   15.91 - * conflicting types to its type are decremented.
   15.92 - * If a domain has multiple types, this procedure works over
   15.93 - * all those types.
   15.94 - *
   15.95 - * conflict_aggregate_set[i] holds the number of
   15.96 - *   running domains that have a conflict with type i.
   15.97 - *
   15.98 - * running_types[i] holds the number of running domains
   15.99 - *        that include type i in their ssidref-referenced type set
  15.100 - *
  15.101 - * conflict_sets[i][j] is "0" if type j has no conflict
  15.102 - *    with type i and is "1" otherwise.
  15.103 - */
  15.104 -/* high-16 = version, low-16 = check magic */
  15.105 -#define ACM_MAGIC		0x0001debc
  15.106 -
  15.107 -/* each offset in bytes from start of the struct they
  15.108 - *   the are part of */
  15.109 -/* each buffer consists of all policy information for
  15.110 - * the respective policy given in the policy code
  15.111 - */
  15.112 -struct acm_policy_buffer {
  15.113 -        u32 magic;
  15.114 -	u32 policyversion;
  15.115 -	u32 len;
  15.116 -	u16 primary_policy_code;
  15.117 -	u16 primary_buffer_offset;
  15.118 -	u16 secondary_policy_code;
  15.119 -	u16 secondary_buffer_offset;
  15.120 -};
  15.121 -
  15.122 -struct acm_chwall_policy_buffer {
  15.123 -	u16 policy_code;
  15.124 -	u16 chwall_max_types;
  15.125 -	u16 chwall_max_ssidrefs;
  15.126 -	u16 chwall_max_conflictsets;
  15.127 -	u16 chwall_ssid_offset;
  15.128 -	u16 chwall_conflict_sets_offset;
  15.129 -	u16 chwall_running_types_offset;
  15.130 -	u16 chwall_conflict_aggregate_offset;
  15.131 -};
  15.132 -
  15.133 -struct acm_ste_policy_buffer {
  15.134 -	u16 policy_code;
  15.135 -	u16 ste_max_types;
  15.136 -	u16 ste_max_ssidrefs;
  15.137 -	u16 ste_ssid_offset;
  15.138 -};
  15.139 -
  15.140 -struct acm_stats_buffer {
  15.141 -        u32 magic;
  15.142 -	u32 policyversion;
  15.143 -	u32 len;
  15.144 -	u16 primary_policy_code;
  15.145 -	u16 primary_stats_offset;
  15.146 -	u16 secondary_policy_code;
  15.147 -	u16 secondary_stats_offset;
  15.148 -};
  15.149 -
  15.150 -struct acm_ste_stats_buffer {
  15.151 -	u32 ec_eval_count;
  15.152 -	u32 gt_eval_count;
  15.153 -	u32 ec_denied_count;
  15.154 -	u32 gt_denied_count; 
  15.155 -	u32 ec_cachehit_count;
  15.156 -	u32 gt_cachehit_count;
  15.157 -};
  15.158 -
  15.159 -
  15.160 -#endif
    16.1 --- a/xen/include/public/dom0_ops.h	Thu Jul 07 10:12:52 2005 -0700
    16.2 +++ b/xen/include/public/dom0_ops.h	Sat Jul 09 06:54:10 2005 -0700
    16.3 @@ -19,7 +19,7 @@
    16.4   * This makes sure that old versions of dom0 tools will stop working in a
    16.5   * well-defined way (rather than crashing the machine, for instance).
    16.6   */
    16.7 -#define DOM0_INTERFACE_VERSION   0xAAAA100C
    16.8 +#define DOM0_INTERFACE_VERSION   0xAAAA100E
    16.9  
   16.10  /************************************************************************/
   16.11  
   16.12 @@ -357,6 +357,16 @@ typedef struct {
   16.13      u64     cpu_time;                 
   16.14  } dom0_getvcpucontext_t;
   16.15  
   16.16 +#define DOM0_GETDOMAININFOLIST    38
   16.17 +typedef struct {
   16.18 +    /* IN variables. */
   16.19 +    domid_t               first_domain;
   16.20 +    memory_t              max_domains;
   16.21 +    dom0_getdomaininfo_t *buffer;
   16.22 +    /* OUT variables. */
   16.23 +    memory_t              num_domains;
   16.24 +} dom0_getdomaininfolist_t;
   16.25 +
   16.26  typedef struct {
   16.27      u32 cmd;
   16.28      u32 interface_version; /* DOM0_INTERFACE_VERSION */
   16.29 @@ -389,6 +399,7 @@ typedef struct {
   16.30          dom0_microcode_t         microcode;
   16.31          dom0_ioport_permission_t ioport_permission;
   16.32          dom0_getvcpucontext_t    getvcpucontext;
   16.33 +        dom0_getdomaininfolist_t getdomaininfolist;
   16.34      } u;
   16.35  } dom0_op_t;
   16.36  
    17.1 --- a/xen/include/public/event_channel.h	Thu Jul 07 10:12:52 2005 -0700
    17.2 +++ b/xen/include/public/event_channel.h	Sat Jul 09 06:54:10 2005 -0700
    17.3 @@ -89,8 +89,6 @@ typedef struct evtchn_bind_pirq {
    17.4   */
    17.5  #define EVTCHNOP_bind_ipi         7
    17.6  typedef struct evtchn_bind_ipi {
    17.7 -    /* IN parameters. */
    17.8 -    u32 ipi_vcpu;
    17.9      /* OUT parameters. */
   17.10      u32 port;
   17.11  } evtchn_bind_ipi_t;
   17.12 @@ -144,6 +142,7 @@ typedef struct evtchn_status {
   17.13  #define EVTCHNSTAT_virq         4  /* Channel is bound to a virtual IRQ line */
   17.14  #define EVTCHNSTAT_ipi          5  /* Channel is bound to a virtual IPI line */
   17.15      u32     status;
   17.16 +    u32     vcpu;                  /* VCPU to which this channel is bound.   */
   17.17      union {
   17.18          struct {
   17.19              domid_t dom;
   17.20 @@ -154,16 +153,25 @@ typedef struct evtchn_status {
   17.21          } interdomain; /* EVTCHNSTAT_interdomain */
   17.22          u32 pirq;      /* EVTCHNSTAT_pirq        */
   17.23          u32 virq;      /* EVTCHNSTAT_virq        */
   17.24 -        u32 ipi_vcpu;  /* EVTCHNSTAT_ipi         */
   17.25      } u;
   17.26  } evtchn_status_t;
   17.27  
   17.28 -#define EVTCHNOP_rebind        8
   17.29 -typedef struct {
   17.30 +/*
   17.31 + * EVTCHNOP_bind_vcpu: Specify which vcpu a channel should notify when an
   17.32 + * event is pending.
   17.33 + * NOTES:
   17.34 + *  1. IPI- and VIRQ-bound channels always notify the vcpu that initialised
   17.35 + *     the binding. This binding cannot be changed.
   17.36 + *  2. All other channels notify vcpu0 by default. This default is set when
   17.37 + *     the channel is allocated (a port that is freed and subsequently reused
   17.38 + *     has its binding reset to vcpu0).
   17.39 + */
   17.40 +#define EVTCHNOP_bind_vcpu        8
   17.41 +typedef struct evtchn_bind_vcpu {
   17.42      /* IN parameters. */
   17.43 -    u32 port;                         /*  0 */
   17.44 -    u32 vcpu;                         /*  4 */
   17.45 -} evtchn_rebind_t; /* 8 bytes */
   17.46 +    u32 port;
   17.47 +    u32 vcpu;
   17.48 +} evtchn_bind_vcpu_t;
   17.49  
   17.50  typedef struct evtchn_op {
   17.51      u32 cmd; /* EVTCHNOP_* */
   17.52 @@ -176,7 +184,7 @@ typedef struct evtchn_op {
   17.53          evtchn_close_t            close;
   17.54          evtchn_send_t             send;
   17.55          evtchn_status_t           status;
   17.56 -        evtchn_rebind_t           rebind;
   17.57 +        evtchn_bind_vcpu_t        bind_vcpu;
   17.58      } u;
   17.59  } evtchn_op_t;
   17.60  
    18.1 --- a/xen/include/public/io/domain_controller.h	Thu Jul 07 10:12:52 2005 -0700
    18.2 +++ b/xen/include/public/io/domain_controller.h	Sat Jul 09 06:54:10 2005 -0700
    18.3 @@ -577,11 +577,12 @@ typedef struct usbif_fe_interface_connec
    18.4  } usbif_fe_interface_connect_t;
    18.5  
    18.6  /*
    18.7 - * CMSG_BLKIF_FE_INTERFACE_DISCONNECT:
    18.8 + * CMSG_USBIF_FE_INTERFACE_DISCONNECT:
    18.9   *  If successful, the domain controller will acknowledge with a
   18.10   *  STATUS_DISCONNECTED message.
   18.11   */
   18.12  typedef struct usbif_fe_interface_disconnect {
   18.13 +    int dummy; /* make struct non-empty */
   18.14  } usbif_fe_interface_disconnect_t;
   18.15  
   18.16