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
     2.1 --- a/Makefile	Thu Jul 07 10:12:52 2005 -0700
     2.2 +++ b/Makefile	Sat Jul 09 06:54:10 2005 -0700
     2.3 @@ -177,10 +177,10 @@ uninstall:
     2.4  
     2.5  # Legacy targets for compatibility
     2.6  linux24:
     2.7 -	$(MAKE) 'KERNELS=linux-2.4*' dist
     2.8 +	$(MAKE) 'KERNELS=linux-2.4*' kernels
     2.9  
    2.10  linux26:
    2.11 -	$(MAKE) 'KERNELS=linux-2.6*' dist
    2.12 +	$(MAKE) 'KERNELS=linux-2.6*' kernels
    2.13  
    2.14  netbsd20:
    2.15  	$(MAKE) netbsd-2.0-xenU-build
    24.1 --- a/linux-2.6.11-xen-sparse/arch/xen/i386/kernel/irq.c	Thu Jul 07 10:12:52 2005 -0700
    24.2 +++ b/linux-2.6.11-xen-sparse/arch/xen/i386/kernel/irq.c	Sat Jul 09 06:54:10 2005 -0700
    24.3 @@ -274,7 +274,7 @@ void fixup_irqs(cpumask_t map)
    24.4  		}
    24.5  		if (irq_desc[irq].handler->set_affinity)
    24.6  			irq_desc[irq].handler->set_affinity(irq, mask);
    24.7 -		else if (irq_desc[irq].action && !(warned++))
    24.8 +		else if (irq_desc[irq].action)
    24.9  			printk("Cannot set affinity for irq %i\n", irq);
   24.10  	}
   24.11  
    25.1 --- a/linux-2.6.11-xen-sparse/arch/xen/i386/kernel/smpboot.c	Thu Jul 07 10:12:52 2005 -0700
    25.2 +++ b/linux-2.6.11-xen-sparse/arch/xen/i386/kernel/smpboot.c	Sat Jul 09 06:54:10 2005 -0700
    25.3 @@ -1312,7 +1312,7 @@ void __devinit smp_prepare_boot_cpu(void
    25.4  
    25.5  /* hotplug down/up funtion pointer and target vcpu */
    25.6  struct vcpu_hotplug_handler_t {
    25.7 -	void (*fn)();
    25.8 +	void (*fn)(int vcpu);
    25.9  	u32 vcpu;
   25.10  };
   25.11  static struct vcpu_hotplug_handler_t vcpu_hotplug_handler;
   25.12 @@ -1333,11 +1333,8 @@ static int __devinit cpu_enable(unsigned
   25.13  	while (!cpu_online(cpu))
   25.14  		cpu_relax();
   25.15  
   25.16 -   /* re-route bound IRQs 0 to cpu */
   25.17 -   rebind_evtchn_from_irq(0, cpu,  per_cpu(resched_irq, cpu));
   25.18 -   rebind_evtchn_from_irq(0, cpu, per_cpu(callfunc_irq, cpu));
   25.19 +	fixup_irqs(cpu_online_map);
   25.20  
   25.21 -	fixup_irqs(cpu_online_map);
   25.22  	/* counter the disable in fixup_irqs() */
   25.23  	local_irq_enable();
   25.24  	return 0;
   25.25 @@ -1359,18 +1356,9 @@ int __cpu_disable(void)
   25.26  	if (cpu == 0)
   25.27  		return -EBUSY;
   25.28  
   25.29 -	/* Allow any queued timer interrupts to get serviced */
   25.30 -	local_irq_enable();
   25.31 -	mdelay(1);
   25.32 -	local_irq_disable();
   25.33 -
   25.34  	cpu_clear(cpu, map);
   25.35  	fixup_irqs(map);
   25.36  
   25.37 -   /* re-route IRQs from dead vcpu to another */
   25.38 -   rebind_evtchn_from_irq(cpu, 0,  per_cpu(resched_irq, cpu));
   25.39 -   rebind_evtchn_from_irq(cpu, 0, per_cpu(callfunc_irq, cpu));
   25.40 -
   25.41  	/* It's now safe to remove this processor from the online map */
   25.42  	cpu_clear(cpu, cpu_online_map);
   25.43  
   25.44 @@ -1533,13 +1521,13 @@ void __init smp_intr_init(void)
   25.45  	int cpu = smp_processor_id();
   25.46  
   25.47  	per_cpu(resched_irq, cpu) =
   25.48 -		bind_ipi_on_cpu_to_irq(cpu, RESCHEDULE_VECTOR);
   25.49 +		bind_ipi_on_cpu_to_irq(RESCHEDULE_VECTOR);
   25.50  	sprintf(resched_name[cpu], "resched%d", cpu);
   25.51  	BUG_ON(request_irq(per_cpu(resched_irq, cpu), smp_reschedule_interrupt,
   25.52  	                   SA_INTERRUPT, resched_name[cpu], NULL));
   25.53  
   25.54  	per_cpu(callfunc_irq, cpu) =
   25.55 -		bind_ipi_on_cpu_to_irq(cpu, CALL_FUNCTION_VECTOR);
   25.56 +		bind_ipi_on_cpu_to_irq(CALL_FUNCTION_VECTOR);
   25.57  	sprintf(callfunc_name[cpu], "callfunc%d", cpu);
   25.58  	BUG_ON(request_irq(per_cpu(callfunc_irq, cpu),
   25.59  	                   smp_call_function_interrupt,
    26.1 --- a/linux-2.6.11-xen-sparse/arch/xen/kernel/ctrl_if.c	Thu Jul 07 10:12:52 2005 -0700
    26.2 +++ b/linux-2.6.11-xen-sparse/arch/xen/kernel/ctrl_if.c	Sat Jul 09 06:54:10 2005 -0700
    26.3 @@ -491,6 +491,8 @@ void ctrl_if_resume(void)
    26.4           * pick up its end of the event channel from 
    26.5           */
    26.6          evtchn_op_t op;
    26.7 +	extern void bind_evtchn_to_cpu(unsigned port, unsigned cpu);
    26.8 +
    26.9          op.cmd = EVTCHNOP_bind_interdomain;
   26.10          op.u.bind_interdomain.dom1 = DOMID_SELF;
   26.11          op.u.bind_interdomain.dom2 = DOMID_SELF;
   26.12 @@ -500,6 +502,7 @@ void ctrl_if_resume(void)
   26.13              BUG();
   26.14          xen_start_info.domain_controller_evtchn = op.u.bind_interdomain.port1;
   26.15          initdom_ctrlif_domcontroller_port   = op.u.bind_interdomain.port2;
   26.16 +	bind_evtchn_to_cpu(op.u.bind_interdomain.port1, 0);
   26.17      }
   26.18  
   26.19      /* Sync up with shared indexes. */
    27.1 --- a/linux-2.6.11-xen-sparse/arch/xen/kernel/evtchn.c	Thu Jul 07 10:12:52 2005 -0700
    27.2 +++ b/linux-2.6.11-xen-sparse/arch/xen/kernel/evtchn.c	Sat Jul 09 06:54:10 2005 -0700
    27.3 @@ -86,7 +86,7 @@ static u32 cpu_evtchn_mask[NR_CPUS][NR_E
    27.4       cpu_evtchn_mask[cpu][idx] &                \
    27.5       ~(sh)->evtchn_mask[idx])
    27.6  
    27.7 -static void bind_evtchn_to_cpu(unsigned int chn, unsigned int cpu)
    27.8 +void bind_evtchn_to_cpu(unsigned int chn, unsigned int cpu)
    27.9  {
   27.10      clear_bit(chn, (unsigned long *)cpu_evtchn_mask[cpu_evtchn[chn]]);
   27.11      set_bit(chn, (unsigned long *)cpu_evtchn_mask[cpu]);
   27.12 @@ -99,8 +99,9 @@ static void bind_evtchn_to_cpu(unsigned 
   27.13      ((sh)->evtchn_pending[idx] &                \
   27.14       ~(sh)->evtchn_mask[idx])
   27.15  
   27.16 -#define bind_evtchn_to_cpu(chn,cpu) ((void)0)
   27.17 -
   27.18 +void bind_evtchn_to_cpu(unsigned int chn, unsigned int cpu)
   27.19 +{
   27.20 +}
   27.21  #endif
   27.22  
   27.23  /* Upcall to generic IRQ layer. */
   27.24 @@ -228,6 +229,13 @@ void unbind_virq_from_irq(int virq)
   27.25          if ( HYPERVISOR_event_channel_op(&op) != 0 )
   27.26              panic("Failed to unbind virtual IRQ %d\n", virq);
   27.27  
   27.28 +	/* This is a slight hack.  Interdomain ports can be allocated
   27.29 +	   directly by userspace, and at that point they get bound by
   27.30 +	   Xen to vcpu 0.  We therefore need to make sure that if we
   27.31 +	   get an event on an event channel we don't know about vcpu 0
   27.32 +	   handles it.  Binding channels to vcpu 0 when closing them
   27.33 +	   achieves this. */
   27.34 +	bind_evtchn_to_cpu(evtchn, 0);
   27.35          evtchn_to_irq[evtchn] = -1;
   27.36          irq_to_evtchn[irq]    = -1;
   27.37          per_cpu(virq_to_irq, cpu)[virq]     = -1;
   27.38 @@ -236,17 +244,17 @@ void unbind_virq_from_irq(int virq)
   27.39      spin_unlock(&irq_mapping_update_lock);
   27.40  }
   27.41  
   27.42 -int bind_ipi_on_cpu_to_irq(int cpu, int ipi)
   27.43 +int bind_ipi_on_cpu_to_irq(int ipi)
   27.44  {
   27.45      evtchn_op_t op;
   27.46      int evtchn, irq;
   27.47 +    int cpu = smp_processor_id();
   27.48  
   27.49      spin_lock(&irq_mapping_update_lock);
   27.50  
   27.51      if ( (evtchn = per_cpu(ipi_to_evtchn, cpu)[ipi]) == 0 )
   27.52      {
   27.53 -        op.cmd                 = EVTCHNOP_bind_ipi;
   27.54 -        op.u.bind_ipi.ipi_vcpu = cpu;
   27.55 +        op.cmd = EVTCHNOP_bind_ipi;
   27.56          if ( HYPERVISOR_event_channel_op(&op) != 0 )
   27.57              panic("Failed to bind virtual IPI %d on cpu %d\n", ipi, cpu);
   27.58          evtchn = op.u.bind_ipi.port;
   27.59 @@ -271,41 +279,10 @@ int bind_ipi_on_cpu_to_irq(int cpu, int 
   27.60      return irq;
   27.61  }
   27.62  
   27.63 -void rebind_evtchn_from_ipi(int cpu, int newcpu, int ipi)
   27.64 +void unbind_ipi_from_irq(int ipi)
   27.65  {
   27.66      evtchn_op_t op;
   27.67 -    int evtchn = per_cpu(ipi_to_evtchn, cpu)[ipi];
   27.68 -
   27.69 -    spin_lock(&irq_mapping_update_lock);
   27.70 -
   27.71 -    op.cmd          = EVTCHNOP_rebind;
   27.72 -    op.u.rebind.port = evtchn;
   27.73 -    op.u.rebind.vcpu = newcpu;
   27.74 -    if ( HYPERVISOR_event_channel_op(&op) != 0 )
   27.75 -       printk(KERN_INFO "Failed to rebind IPI%d to CPU%d\n",ipi,newcpu);
   27.76 -
   27.77 -    spin_unlock(&irq_mapping_update_lock);
   27.78 -}
   27.79 -
   27.80 -void rebind_evtchn_from_irq(int cpu, int newcpu, int irq)
   27.81 -{
   27.82 -    evtchn_op_t op;
   27.83 -    int evtchn = irq_to_evtchn[irq];
   27.84 -
   27.85 -    spin_lock(&irq_mapping_update_lock);
   27.86 -
   27.87 -    op.cmd          = EVTCHNOP_rebind;
   27.88 -    op.u.rebind.port = evtchn;
   27.89 -    op.u.rebind.vcpu = newcpu;
   27.90 -    if ( HYPERVISOR_event_channel_op(&op) != 0 )
   27.91 -       printk(KERN_INFO "Failed to rebind IRQ%d to CPU%d\n",irq,newcpu);
   27.92 -
   27.93 -    spin_unlock(&irq_mapping_update_lock);
   27.94 -}
   27.95 -
   27.96 -void unbind_ipi_on_cpu_from_irq(int cpu, int ipi)
   27.97 -{
   27.98 -    evtchn_op_t op;
   27.99 +    int cpu    = smp_processor_id();
  27.100      int evtchn = per_cpu(ipi_to_evtchn, cpu)[ipi];
  27.101      int irq    = irq_to_evtchn[evtchn];
  27.102  
  27.103 @@ -319,6 +296,8 @@ void unbind_ipi_on_cpu_from_irq(int cpu,
  27.104  	if ( HYPERVISOR_event_channel_op(&op) != 0 )
  27.105  	    panic("Failed to unbind virtual IPI %d on cpu %d\n", ipi, cpu);
  27.106  
  27.107 +	/* See comments in unbind_virq_from_irq */
  27.108 +	bind_evtchn_to_cpu(evtchn, 0);
  27.109          evtchn_to_irq[evtchn] = -1;
  27.110          irq_to_evtchn[irq]    = -1;
  27.111  	per_cpu(ipi_to_evtchn, cpu)[ipi] = 0;
  27.112 @@ -362,6 +341,59 @@ void unbind_evtchn_from_irq(int evtchn)
  27.113      spin_unlock(&irq_mapping_update_lock);
  27.114  }
  27.115  
  27.116 +static void do_nothing_function(void *ign)
  27.117 +{
  27.118 +}
  27.119 +
  27.120 +/* Rebind an evtchn so that it gets delivered to a specific cpu */
  27.121 +static void rebind_irq_to_cpu(unsigned irq, unsigned tcpu)
  27.122 +{
  27.123 +    evtchn_op_t op;
  27.124 +    int evtchn;
  27.125 +
  27.126 +    spin_lock(&irq_mapping_update_lock);
  27.127 +    evtchn = irq_to_evtchn[irq];
  27.128 +    if (!VALID_EVTCHN(evtchn)) {
  27.129 +	spin_unlock(&irq_mapping_update_lock);
  27.130 +	return;
  27.131 +    }
  27.132 +
  27.133 +    /* Tell Xen to send future instances of this interrupt to the
  27.134 +       other vcpu */
  27.135 +    op.cmd = EVTCHNOP_bind_vcpu;
  27.136 +    op.u.bind_vcpu.port = evtchn;
  27.137 +    op.u.bind_vcpu.vcpu = tcpu;
  27.138 +
  27.139 +    /* If this fails, it usually just indicates that we're dealing
  27.140 +       with a virq or IPI channel, which don't actually need to be
  27.141 +       rebound.  Ignore it, but don't do the xenlinux-level rebind
  27.142 +       in that case. */
  27.143 +    if (HYPERVISOR_event_channel_op(&op) >= 0)
  27.144 +	bind_evtchn_to_cpu(evtchn, tcpu);
  27.145 +
  27.146 +    spin_unlock(&irq_mapping_update_lock);
  27.147 +
  27.148 +    /* Now send the new target processor a NOP IPI.  When this
  27.149 +       returns, it will check for any pending interrupts, and so
  27.150 +       service any that got delivered to the wrong processor by
  27.151 +       mistake. */
  27.152 +    /* XXX: The only time this is called with interrupts disabled is
  27.153 +       from the hotplug/hotunplug path.  In that case, all cpus are
  27.154 +       stopped with interrupts disabled, and the missed interrupts
  27.155 +       will be picked up when they start again.  This is kind of a
  27.156 +       hack.
  27.157 +    */
  27.158 +    if (!irqs_disabled()) {
  27.159 +	smp_call_function(do_nothing_function, NULL, 0, 0);
  27.160 +    }
  27.161 +}
  27.162 +
  27.163 +
  27.164 +static void set_affinity_irq(unsigned irq, cpumask_t dest)
  27.165 +{
  27.166 +    unsigned tcpu = first_cpu(dest);
  27.167 +    rebind_irq_to_cpu(irq, tcpu);
  27.168 +}
  27.169  
  27.170  /*
  27.171   * Interface to generic handling in irq.c
  27.172 @@ -424,7 +456,7 @@ static struct hw_interrupt_type dynirq_t
  27.173      disable_dynirq,
  27.174      ack_dynirq,
  27.175      end_dynirq,
  27.176 -    NULL
  27.177 +    set_affinity_irq
  27.178  };
  27.179  
  27.180  static inline void pirq_unmask_notify(int pirq)
  27.181 @@ -473,6 +505,7 @@ static unsigned int startup_pirq(unsigne
  27.182  
  27.183      pirq_query_unmask(irq_to_pirq(irq));
  27.184  
  27.185 +    bind_evtchn_to_cpu(evtchn, 0);
  27.186      evtchn_to_irq[evtchn] = irq;
  27.187      irq_to_evtchn[irq]    = evtchn;
  27.188  
  27.189 @@ -498,6 +531,7 @@ static void shutdown_pirq(unsigned int i
  27.190      if ( HYPERVISOR_event_channel_op(&op) != 0 )
  27.191          panic("Failed to unbind physical IRQ %d\n", irq);
  27.192  
  27.193 +    bind_evtchn_to_cpu(evtchn, 0);
  27.194      evtchn_to_irq[evtchn] = -1;
  27.195      irq_to_evtchn[irq]    = -1;
  27.196  }
  27.197 @@ -548,7 +582,7 @@ static struct hw_interrupt_type pirq_typ
  27.198      disable_pirq,
  27.199      ack_pirq,
  27.200      end_pirq,
  27.201 -    NULL
  27.202 +    set_affinity_irq
  27.203  };
  27.204  
  27.205  void irq_suspend(void)
  27.206 @@ -597,6 +631,7 @@ void irq_resume(void)
  27.207          evtchn = op.u.bind_virq.port;
  27.208          
  27.209          /* Record the new mapping. */
  27.210 +	bind_evtchn_to_cpu(evtchn, 0);
  27.211          evtchn_to_irq[evtchn] = irq;
  27.212          irq_to_evtchn[irq]    = evtchn;
  27.213  
    29.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
    29.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
    29.3 @@ -128,8 +128,8 @@
    29.4  /* Dynamic binding of event channels and VIRQ sources to Linux IRQ space. */
    29.5  extern int  bind_virq_to_irq(int virq);
    29.6  extern void unbind_virq_from_irq(int virq);
    29.7 -extern int  bind_ipi_on_cpu_to_irq(int cpu, int ipi);
    29.8 -extern void unbind_ipi_on_cpu_from_irq(int cpu, int ipi);
    29.9 +extern int  bind_ipi_to_irq(int ipi);
   29.10 +extern void unbind_ipi_from_irq(int ipi);
   29.11  extern int  bind_evtchn_to_irq(int evtchn);
   29.12  extern void unbind_evtchn_from_irq(int evtchn);
   29.13  
    30.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
    30.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
    30.3 @@ -126,8 +126,8 @@
    30.4  /* Dynamic binding of event channels and VIRQ sources to Linux IRQ space. */
    30.5  extern int  bind_virq_to_irq(int virq);
    30.6  extern void unbind_virq_from_irq(int virq);
    30.7 -extern int  bind_ipi_on_cpu_to_irq(int cpu, int ipi);
    30.8 -extern void unbind_ipi_on_cpu_from_irq(int cpu, int ipi);
    30.9 +extern int  bind_ipi_to_irq(int ipi);
   30.10 +extern void unbind_ipi_from_irq(int ipi);
   30.11  extern int  bind_evtchn_to_irq(int evtchn);
   30.12  extern void unbind_evtchn_from_irq(int evtchn);
   30.13  
    34.1 --- a/tools/libxc/xc.h	Thu Jul 07 10:12:52 2005 -0700
    34.2 +++ b/tools/libxc/xc.h	Sat Jul 09 06:54:10 2005 -0700
    34.3 @@ -192,6 +192,24 @@ int xc_domain_getinfo(int xc_handle,
    34.4                        xc_dominfo_t *info);
    34.5  
    34.6  /**
    34.7 + * This function will return information about one or more domains, using a
    34.8 + * single hypercall.  The domain information will be stored into the supplied
    34.9 + * array of xc_domaininfo_t structures.
   34.10 + *
   34.11 + * @parm xc_handle a handle to an open hypervisor interface
   34.12 + * @parm first_domain the first domain to enumerate information from.
   34.13 + *                    Domains are currently enumerate in order of creation.
   34.14 + * @parm max_domains the number of elements in info
   34.15 + * @parm info an array of max_doms size that will contain the information for
   34.16 + *            the enumerated domains.
   34.17 + * @return the number of domains enumerated or -1 on error
   34.18 + */
   34.19 +int xc_domain_getinfolist(int xc_handle,
   34.20 +                          u32 first_domain,
   34.21 +                          unsigned int max_domains,
   34.22 +                          xc_domaininfo_t *info);
   34.23 +
   34.24 +/**
   34.25   * This function returns information about one domain.  This information is
   34.26   * more detailed than the information from xc_domain_getinfo().
   34.27   *
    35.1 --- a/tools/libxc/xc_domain.c	Thu Jul 07 10:12:52 2005 -0700
    35.2 +++ b/tools/libxc/xc_domain.c	Sat Jul 09 06:54:10 2005 -0700
    35.3 @@ -125,6 +125,33 @@ int xc_domain_getinfo(int xc_handle,
    35.4      return nr_doms;
    35.5  }
    35.6  
    35.7 +int xc_domain_getinfolist(int xc_handle,
    35.8 +                          u32 first_domain,
    35.9 +                          unsigned int max_domains,
   35.10 +                          xc_domaininfo_t *info)
   35.11 +{
   35.12 +    int ret = 0;
   35.13 +    dom0_op_t op;
   35.14 +
   35.15 +    if(mlock(info, max_domains*sizeof(xc_domaininfo_t)) != 0)
   35.16 +        return -1;
   35.17 +    
   35.18 +    op.cmd = DOM0_GETDOMAININFOLIST;
   35.19 +    op.u.getdomaininfolist.first_domain = first_domain;
   35.20 +    op.u.getdomaininfolist.max_domains  = max_domains;
   35.21 +    op.u.getdomaininfolist.buffer       = info;
   35.22 +
   35.23 +    if(xc_dom0_op(xc_handle, &op) < 0)
   35.24 +        ret = -1;
   35.25 +    else
   35.26 +        ret = op.u.getdomaininfolist.num_domains;
   35.27 +    
   35.28 +    if(munlock(info, max_domains*sizeof(xc_domaininfo_t)) != 0)
   35.29 +        ret = -1;
   35.30 +    
   35.31 +    return ret;
   35.32 +}
   35.33 +
   35.34  int xc_domain_get_vcpu_context(int xc_handle,
   35.35                                 u32 domid,
   35.36                                 u32 vcpu,
    38.1 --- a/tools/python/xen/lowlevel/xc/xc.c	Thu Jul 07 10:12:52 2005 -0700
    38.2 +++ b/tools/python/xen/lowlevel/xc/xc.c	Sat Jul 09 06:54:10 2005 -0700
    38.3 @@ -688,7 +688,7 @@ static PyObject *pyxc_physinfo(PyObject 
    38.4      if ( xc_physinfo(xc->xc_handle, &info) != 0 )
    38.5          return PyErr_SetFromErrno(xc_error);
    38.6  
    38.7 -    return Py_BuildValue("{s:i,s:i,s:l,s:l,s:l}",
    38.8 +    return Py_BuildValue("{s:i,s:i,s:i,s:i,s:l,s:l,s:i}",
    38.9                           "threads_per_core", info.threads_per_core,
   38.10                           "cores_per_socket", info.cores_per_socket,
   38.11                           "sockets_per_node", info.sockets_per_node,
    44.1 --- a/xen/arch/x86/traps.c	Thu Jul 07 10:12:52 2005 -0700
    44.2 +++ b/xen/arch/x86/traps.c	Sat Jul 09 06:54:10 2005 -0700
    44.3 @@ -94,6 +94,9 @@ DECLARE_TRAP_HANDLER(alignment_check);
    44.4  DECLARE_TRAP_HANDLER(spurious_interrupt_bug);
    44.5  DECLARE_TRAP_HANDLER(machine_check);
    44.6  
    44.7 +long do_set_debugreg(int reg, unsigned long value);
    44.8 +unsigned long do_get_debugreg(int reg);
    44.9 +
   44.10  static int debug_stack_lines = 20;
   44.11  integer_param("debug_stack_lines", debug_stack_lines);
   44.12  
   44.13 @@ -568,8 +571,8 @@ static inline int admin_io_okay(
   44.14  static int emulate_privileged_op(struct cpu_user_regs *regs)
   44.15  {
   44.16      struct vcpu *v = current;
   44.17 -    unsigned long *reg, eip = regs->eip;
   44.18 -    u8 opcode, modrm_reg = 0, rep_prefix = 0;
   44.19 +    unsigned long *reg, eip = regs->eip, res;
   44.20 +    u8 opcode, modrm_reg = 0, modrm_rm = 0, rep_prefix = 0;
   44.21      unsigned int port, i, op_bytes = 4, data;
   44.22  
   44.23      /* Legacy prefixes. */
   44.24 @@ -604,7 +607,9 @@ static int emulate_privileged_op(struct 
   44.25      if ( (opcode & 0xf0) == 0x40 )
   44.26      {
   44.27          modrm_reg = (opcode & 4) << 1;  /* REX.R */
   44.28 -        /* REX.W, REX.B and REX.X do not need to be decoded. */
   44.29 +        modrm_rm  = (opcode & 1) << 3;  /* REX.B */
   44.30 +
   44.31 +        /* REX.W and REX.X do not need to be decoded. */
   44.32          opcode = insn_fetch(u8, 1, eip);
   44.33      }
   44.34  #endif
   44.35 @@ -782,11 +787,10 @@ static int emulate_privileged_op(struct 
   44.36  
   44.37      case 0x20: /* MOV CR?,<reg> */
   44.38          opcode = insn_fetch(u8, 1, eip);
   44.39 -        if ( (opcode & 0xc0) != 0xc0 )
   44.40 -            goto fail;
   44.41 -        modrm_reg |= opcode & 7;
   44.42 -        reg = decode_register(modrm_reg, regs, 0);
   44.43 -        switch ( (opcode >> 3) & 7 )
   44.44 +        modrm_reg |= (opcode >> 3) & 7;
   44.45 +        modrm_rm  |= (opcode >> 0) & 7;
   44.46 +        reg = decode_register(modrm_rm, regs, 0);
   44.47 +        switch ( modrm_reg )
   44.48          {
   44.49          case 0: /* Read CR0 */
   44.50              *reg = v->arch.guest_context.ctrlreg[0];
   44.51 @@ -805,13 +809,22 @@ static int emulate_privileged_op(struct 
   44.52          }
   44.53          break;
   44.54  
   44.55 +    case 0x21: /* MOV DR?,<reg> */
   44.56 +        opcode = insn_fetch(u8, 1, eip);
   44.57 +        modrm_reg |= (opcode >> 3) & 7;
   44.58 +        modrm_rm  |= (opcode >> 0) & 7;
   44.59 +        reg = decode_register(modrm_rm, regs, 0);
   44.60 +        if ( (res = do_get_debugreg(modrm_reg)) > (unsigned long)-256 )
   44.61 +            goto fail;
   44.62 +        *reg = res;
   44.63 +        break;
   44.64 +
   44.65      case 0x22: /* MOV <reg>,CR? */
   44.66          opcode = insn_fetch(u8, 1, eip);
   44.67 -        if ( (opcode & 0xc0) != 0xc0 )
   44.68 -            goto fail;
   44.69 -        modrm_reg |= opcode & 7;
   44.70 -        reg = decode_register(modrm_reg, regs, 0);
   44.71 -        switch ( (opcode >> 3) & 7 )
   44.72 +        modrm_reg |= (opcode >> 3) & 7;
   44.73 +        modrm_rm  |= (opcode >> 0) & 7;
   44.74 +        reg = decode_register(modrm_rm, regs, 0);
   44.75 +        switch ( modrm_reg )
   44.76          {
   44.77          case 0: /* Write CR0 */
   44.78              (void)do_fpu_taskswitch(!!(*reg & X86_CR0_TS));
   44.79 @@ -827,6 +840,15 @@ static int emulate_privileged_op(struct 
   44.80              UNLOCK_BIGLOCK(v->domain);
   44.81              break;
   44.82  
   44.83 +    case 0x23: /* MOV <reg>,DR? */
   44.84 +        opcode = insn_fetch(u8, 1, eip);
   44.85 +        modrm_reg |= (opcode >> 3) & 7;
   44.86 +        modrm_rm  |= (opcode >> 0) & 7;
   44.87 +        reg = decode_register(modrm_rm, regs, 0);
   44.88 +        if ( do_set_debugreg(modrm_reg, *reg) != 0 )
   44.89 +            goto fail;
   44.90 +        break;
   44.91 +
   44.92          default:
   44.93              goto fail;
   44.94          }
    45.1 --- a/xen/common/dom0_ops.c	Thu Jul 07 10:12:52 2005 -0700
    45.2 +++ b/xen/common/dom0_ops.c	Sat Jul 09 06:54:10 2005 -0700
    45.3 @@ -88,6 +88,60 @@ static int allocate_domid(domid_t *pdom)
    45.4      return err;
    45.5  }
    45.6  
    45.7 +static void getdomaininfo(struct domain *d, dom0_getdomaininfo_t *info)
    45.8 +{
    45.9 +    struct vcpu   *v;
   45.10 +    u64 cpu_time = 0;
   45.11 +    int vcpu_count = 0;
   45.12 +    int flags = DOMFLAGS_PAUSED | DOMFLAGS_BLOCKED;
   45.13 +    
   45.14 +    info->domain = d->domain_id;
   45.15 +    
   45.16 +    memset(&info->vcpu_to_cpu, -1, sizeof(info->vcpu_to_cpu));
   45.17 +    memset(&info->cpumap, 0, sizeof(info->cpumap));
   45.18 +    
   45.19 +    /* 
   45.20 +     * - domain is marked as paused or blocked only if all its vcpus 
   45.21 +     *   are paused or blocked 
   45.22 +     * - domain is marked as running if any of its vcpus is running
   45.23 +     * - only map vcpus that aren't down.  Note, at some point we may
   45.24 +     *   wish to demux the -1 value to indicate down vs. not-ever-booted
   45.25 +     *   
   45.26 +     */
   45.27 +    for_each_vcpu ( d, v ) {
   45.28 +        /* only map vcpus that are up */
   45.29 +        if ( !(test_bit(_VCPUF_down, &v->vcpu_flags)) )
   45.30 +            info->vcpu_to_cpu[v->vcpu_id] = v->processor;
   45.31 +        info->cpumap[v->vcpu_id] = v->cpumap;
   45.32 +        if ( !(v->vcpu_flags & VCPUF_ctrl_pause) )
   45.33 +            flags &= ~DOMFLAGS_PAUSED;
   45.34 +        if ( !(v->vcpu_flags & VCPUF_blocked) )
   45.35 +            flags &= ~DOMFLAGS_BLOCKED;
   45.36 +        if ( v->vcpu_flags & VCPUF_running )
   45.37 +            flags |= DOMFLAGS_RUNNING;
   45.38 +        if ( v->cpu_time > cpu_time )
   45.39 +            cpu_time += v->cpu_time;
   45.40 +        vcpu_count++;
   45.41 +    }
   45.42 +    
   45.43 +    info->cpu_time = cpu_time;
   45.44 +    info->n_vcpu = vcpu_count;
   45.45 +    
   45.46 +    info->flags = flags |
   45.47 +        ((d->domain_flags & DOMF_dying)    ? DOMFLAGS_DYING    : 0) |
   45.48 +        ((d->domain_flags & DOMF_shutdown) ? DOMFLAGS_SHUTDOWN : 0) |
   45.49 +        d->shutdown_code << DOMFLAGS_SHUTDOWNSHIFT;
   45.50 +
   45.51 +    if (d->ssid != NULL)
   45.52 +        info->ssidref = ((struct acm_ssid_domain *)d->ssid)->ssidref;
   45.53 +    else    
   45.54 +        info->ssidref = ACM_DEFAULT_SSID;
   45.55 +    
   45.56 +    info->tot_pages         = d->tot_pages;
   45.57 +    info->max_pages         = d->max_pages;
   45.58 +    info->shared_info_frame = __pa(d->shared_info) >> PAGE_SHIFT;
   45.59 +}
   45.60 +
   45.61  long do_dom0_op(dom0_op_t *u_dom0_op)
   45.62  {
   45.63      long ret = 0;
   45.64 @@ -306,10 +360,6 @@ long do_dom0_op(dom0_op_t *u_dom0_op)
   45.65      case DOM0_GETDOMAININFO:
   45.66      { 
   45.67          struct domain *d;
   45.68 -        struct vcpu   *v;
   45.69 -        u64 cpu_time = 0;
   45.70 -        int vcpu_count = 0;
   45.71 -        int flags = DOMFLAGS_PAUSED | DOMFLAGS_BLOCKED;
   45.72  
   45.73          read_lock(&domlist_lock);
   45.74  
   45.75 @@ -328,54 +378,7 @@ long do_dom0_op(dom0_op_t *u_dom0_op)
   45.76  
   45.77          read_unlock(&domlist_lock);
   45.78  
   45.79 -        op->u.getdomaininfo.domain = d->domain_id;
   45.80 -
   45.81 -        memset(&op->u.getdomaininfo.vcpu_to_cpu, -1,
   45.82 -               sizeof(op->u.getdomaininfo.vcpu_to_cpu));
   45.83 -        memset(&op->u.getdomaininfo.cpumap, 0,
   45.84 -               sizeof(op->u.getdomaininfo.cpumap));
   45.85 -
   45.86 -        /* 
   45.87 -         * - domain is marked as paused or blocked only if all its vcpus 
   45.88 -         *   are paused or blocked 
   45.89 -         * - domain is marked as running if any of its vcpus is running
   45.90 -         * - only map vcpus that aren't down.  Note, at some point we may
   45.91 -         *   wish to demux the -1 value to indicate down vs. not-ever-booted
   45.92 -         *   
   45.93 -         */
   45.94 -        for_each_vcpu ( d, v ) {
   45.95 -            /* only map vcpus that are up */
   45.96 -            if ( !(test_bit(_VCPUF_down, &v->vcpu_flags)) )
   45.97 -                op->u.getdomaininfo.vcpu_to_cpu[v->vcpu_id] = v->processor;
   45.98 -            op->u.getdomaininfo.cpumap[v->vcpu_id]      = v->cpumap;
   45.99 -            if ( !(v->vcpu_flags & VCPUF_ctrl_pause) )
  45.100 -                flags &= ~DOMFLAGS_PAUSED;
  45.101 -            if ( !(v->vcpu_flags & VCPUF_blocked) )
  45.102 -                flags &= ~DOMFLAGS_BLOCKED;
  45.103 -            if ( v->vcpu_flags & VCPUF_running )
  45.104 -                flags |= DOMFLAGS_RUNNING;
  45.105 -            if ( v->cpu_time > cpu_time )
  45.106 -                cpu_time += v->cpu_time;
  45.107 -            vcpu_count++;
  45.108 -        }
  45.109 -
  45.110 -        op->u.getdomaininfo.cpu_time = cpu_time;
  45.111 -        op->u.getdomaininfo.n_vcpu = vcpu_count;
  45.112 -
  45.113 -        op->u.getdomaininfo.flags = flags |
  45.114 -            ((d->domain_flags & DOMF_dying)    ? DOMFLAGS_DYING    : 0) |
  45.115 -            ((d->domain_flags & DOMF_shutdown) ? DOMFLAGS_SHUTDOWN : 0) |
  45.116 -            d->shutdown_code << DOMFLAGS_SHUTDOWNSHIFT;
  45.117 -
  45.118 -        if (d->ssid != NULL)
  45.119 -            op->u.getdomaininfo.ssidref = ((struct acm_ssid_domain *)d->ssid)->ssidref;
  45.120 -        else    
  45.121 -            op->u.getdomaininfo.ssidref = ACM_DEFAULT_SSID;
  45.122 -
  45.123 -        op->u.getdomaininfo.tot_pages   = d->tot_pages;
  45.124 -        op->u.getdomaininfo.max_pages   = d->max_pages;
  45.125 -        op->u.getdomaininfo.shared_info_frame = 
  45.126 -            __pa(d->shared_info) >> PAGE_SHIFT;
  45.127 +        getdomaininfo(d, &op->u.getdomaininfo);
  45.128  
  45.129          if ( copy_to_user(u_dom0_op, op, sizeof(*op)) )     
  45.130              ret = -EINVAL;
  45.131 @@ -384,6 +387,53 @@ long do_dom0_op(dom0_op_t *u_dom0_op)
  45.132      }
  45.133      break;
  45.134  
  45.135 +    case DOM0_GETDOMAININFOLIST:
  45.136 +    { 
  45.137 +        struct domain *d;
  45.138 +        dom0_getdomaininfo_t info;
  45.139 +        dom0_getdomaininfo_t *buffer = op->u.getdomaininfolist.buffer;
  45.140 +        u32 num_domains = 0;
  45.141 +
  45.142 +        read_lock(&domlist_lock);
  45.143 +
  45.144 +        for_each_domain ( d )
  45.145 +        {
  45.146 +            if ( d->domain_id < op->u.getdomaininfolist.first_domain )
  45.147 +                continue;
  45.148 +            if ( num_domains == op->u.getdomaininfolist.max_domains )
  45.149 +                break;
  45.150 +            if ( (d == NULL) || !get_domain(d) )
  45.151 +            {
  45.152 +                ret = -ESRCH;
  45.153 +                break;
  45.154 +            }
  45.155 +
  45.156 +            getdomaininfo(d, &info);
  45.157 +
  45.158 +            put_domain(d);
  45.159 +
  45.160 +            if ( copy_to_user(buffer, &info, sizeof(dom0_getdomaininfo_t)) )
  45.161 +            {
  45.162 +                ret = -EINVAL;
  45.163 +                break;
  45.164 +            }
  45.165 +            
  45.166 +            buffer++;
  45.167 +            num_domains++;
  45.168 +        }
  45.169 +        
  45.170 +        read_unlock(&domlist_lock);
  45.171 +        
  45.172 +        if ( ret != 0 )
  45.173 +            break;
  45.174 +        
  45.175 +        op->u.getdomaininfolist.num_domains = num_domains;
  45.176 +
  45.177 +        if ( copy_to_user(u_dom0_op, op, sizeof(*op)) )
  45.178 +            ret = -EINVAL;
  45.179 +    }
  45.180 +    break;
  45.181 +
  45.182      case DOM0_GETVCPUCONTEXT:
  45.183      { 
  45.184          struct vcpu_guest_context *c;
    46.1 --- a/xen/common/event_channel.c	Thu Jul 07 10:12:52 2005 -0700
    46.2 +++ b/xen/common/event_channel.c	Sat Jul 09 06:54:10 2005 -0700
    46.3 @@ -283,10 +283,7 @@ static long evtchn_bind_ipi(evtchn_bind_
    46.4  {
    46.5      struct evtchn *chn;
    46.6      struct domain *d = current->domain;
    46.7 -    int            port, ipi_vcpu = bind->ipi_vcpu;
    46.8 -
    46.9 -    if ( (ipi_vcpu >= MAX_VIRT_CPUS) || (d->vcpu[ipi_vcpu] == NULL) )
   46.10 -        return -EINVAL;
   46.11 +    int            port;
   46.12  
   46.13      spin_lock(&d->evtchn_lock);
   46.14  
   46.15 @@ -294,7 +291,7 @@ static long evtchn_bind_ipi(evtchn_bind_
   46.16      {
   46.17          chn = evtchn_from_port(d, port);
   46.18          chn->state          = ECS_IPI;
   46.19 -        chn->notify_vcpu_id = ipi_vcpu;
   46.20 +        chn->notify_vcpu_id = current->vcpu_id;
   46.21      }
   46.22  
   46.23      spin_unlock(&d->evtchn_lock);
   46.24 @@ -325,7 +322,7 @@ static long evtchn_bind_pirq(evtchn_bind
   46.25      chn = evtchn_from_port(d, port);
   46.26  
   46.27      d->pirq_to_evtchn[pirq] = port;
   46.28 -    rc = pirq_guest_bind(d->vcpu[chn->notify_vcpu_id], pirq, 
   46.29 +    rc = pirq_guest_bind(d->vcpu[0], pirq, 
   46.30                           !!(bind->flags & BIND_PIRQ__WILL_SHARE));
   46.31      if ( rc != 0 )
   46.32      {
   46.33 @@ -437,7 +434,9 @@ static long __evtchn_close(struct domain
   46.34          BUG();
   46.35      }
   46.36  
   46.37 -    chn1->state = ECS_FREE;
   46.38 +    /* Reset binding to vcpu0 when the channel is freed. */
   46.39 +    chn1->state          = ECS_FREE;
   46.40 +    chn1->notify_vcpu_id = 0;
   46.41  
   46.42   out:
   46.43      if ( d2 != NULL )
   46.44 @@ -566,37 +565,55 @@ static long evtchn_status(evtchn_status_
   46.45          status->u.virq = chn->u.virq;
   46.46          break;
   46.47      case ECS_IPI:
   46.48 -        status->status     = EVTCHNSTAT_ipi;
   46.49 -        status->u.ipi_vcpu = chn->notify_vcpu_id;
   46.50 +        status->status = EVTCHNSTAT_ipi;
   46.51          break;
   46.52      default:
   46.53          BUG();
   46.54      }
   46.55  
   46.56 +    status->vcpu = chn->notify_vcpu_id;
   46.57 +
   46.58   out:
   46.59      spin_unlock(&d->evtchn_lock);
   46.60      put_domain(d);
   46.61      return rc;
   46.62  }
   46.63  
   46.64 -static long evtchn_rebind(evtchn_rebind_t *bind) 
   46.65 +static long evtchn_bind_vcpu(evtchn_bind_vcpu_t *bind) 
   46.66  {
   46.67      struct domain *d    = current->domain;
   46.68      int            port = bind->port;
   46.69      int            vcpu = bind->vcpu;
   46.70      struct evtchn *chn;
   46.71 -    long             rc = 0;
   46.72 +    long           rc = 0;
   46.73 +
   46.74 +    if ( (vcpu >= MAX_VIRT_CPUS) || (d->vcpu[vcpu] == NULL) ) {
   46.75 +        printf("vcpu %d bad.\n", vcpu);
   46.76 +        return -EINVAL;
   46.77 +    }
   46.78  
   46.79      spin_lock(&d->evtchn_lock);
   46.80  
   46.81      if ( !port_is_valid(d, port) )
   46.82      {
   46.83 +        printf("port %d bad.\n", port);
   46.84          rc = -EINVAL;
   46.85          goto out;
   46.86      }
   46.87  
   46.88      chn = evtchn_from_port(d, port);
   46.89 -    chn->notify_vcpu_id = vcpu;
   46.90 +    switch ( chn->state )
   46.91 +    {
   46.92 +    case ECS_UNBOUND:
   46.93 +    case ECS_INTERDOMAIN:
   46.94 +    case ECS_PIRQ:
   46.95 +        chn->notify_vcpu_id = vcpu;
   46.96 +        break;
   46.97 +    default:
   46.98 +        printf("evtchn type %d can't be rebound.\n", chn->state);
   46.99 +        rc = -EINVAL;
  46.100 +        break;
  46.101 +    }
  46.102  
  46.103   out:
  46.104      spin_unlock(&d->evtchn_lock);
  46.105 @@ -660,10 +677,8 @@ long do_event_channel_op(evtchn_op_t *uo
  46.106              rc = -EFAULT;
  46.107          break;
  46.108  
  46.109 -    case EVTCHNOP_rebind:
  46.110 -        rc = evtchn_rebind(&op.u.rebind);
  46.111 -        if ( (rc == 0) && (copy_to_user(uop, &op, sizeof(op)) != 0) )
  46.112 -            rc = -EFAULT;
  46.113 +    case EVTCHNOP_bind_vcpu:
  46.114 +        rc = evtchn_bind_vcpu(&op.u.bind_vcpu);
  46.115          break;
  46.116  
  46.117      default:
    48.1 --- a/xen/include/acm/acm_core.h	Thu Jul 07 10:12:52 2005 -0700
    48.2 +++ b/xen/include/acm/acm_core.h	Sat Jul 09 06:54:10 2005 -0700
    48.3 @@ -20,6 +20,7 @@
    48.4  
    48.5  #include <xen/spinlock.h>
    48.6  #include <public/acm.h>
    48.7 +#include <xen/acm_policy.h>
    48.8  #include <public/policy_ops.h>
    48.9  
   48.10  /* Xen-internal representation of the binary policy */
    49.1 --- a/xen/include/public/acm.h	Thu Jul 07 10:12:52 2005 -0700
    49.2 +++ b/xen/include/public/acm.h	Sat Jul 09 06:54:10 2005 -0700
    49.3 @@ -1,157 +0,0 @@
    49.4 -/****************************************************************
    49.5 - * acm.h
    49.6 - * 
    49.7 - * Copyright (C) 2005 IBM Corporation
    49.8 - *
    49.9 - * Author:
   49.10 - * Reiner Sailer <sailer@watson.ibm.com>
   49.11 - *
   49.12 - * Contributors:
   49.13 - * Stefan Berger <stefanb@watson.ibm.com> 
   49.14 - *	added network byte order support for binary policies
   49.15 - *
   49.16 - * This program is free software; you can redistribute it and/or
   49.17 - * modify it under the terms of the GNU General Public License as
   49.18 - * published by the Free Software Foundation, version 2 of the
   49.19 - * License.
   49.20 - *
   49.21 - * sHype general access control module header file.
   49.22 - *     here are all definitions that are shared between
   49.23 - *     xen-core, guest-kernels, and applications.
   49.24 - *
   49.25 - * todo: move from static policy choice to compile option.
   49.26 - */
   49.27 -
   49.28 -#ifndef _XEN_PUBLIC_ACM_H
   49.29 -#define _XEN_PUBLIC_ACM_H
   49.30 -
   49.31 -#include "xen.h"
   49.32 -#include "sched_ctl.h"
   49.33 -
   49.34 -/* if ACM_DEBUG defined, all hooks should
   49.35 - * print a short trace message (comment it out
   49.36 - * when not in testing mode )
   49.37 - */
   49.38 -/* #define ACM_DEBUG */
   49.39 -
   49.40 -#ifdef ACM_DEBUG
   49.41 -#  define printkd(fmt, args...) printk(fmt,## args)
   49.42 -#else
   49.43 -#  define printkd(fmt, args...)
   49.44 -#endif
   49.45 -
   49.46 -/* default ssid reference value if not supplied */
   49.47 -#define ACM_DEFAULT_SSID 	0x0
   49.48 -#define ACM_DEFAULT_LOCAL_SSID  0x0
   49.49 -
   49.50 -/* Internal ACM ERROR types */
   49.51 -#define ACM_OK				 0
   49.52 -#define ACM_UNDEF			-1
   49.53 -#define ACM_INIT_SSID_ERROR		-2
   49.54 -#define ACM_INIT_SOID_ERROR		-3
   49.55 -#define ACM_ERROR		        -4
   49.56 -
   49.57 -/* External ACCESS DECISIONS */
   49.58 -#define ACM_ACCESS_PERMITTED		0
   49.59 -#define ACM_ACCESS_DENIED		-111
   49.60 -#define ACM_NULL_POINTER_ERROR		-200
   49.61 -
   49.62 -#define ACM_MAX_POLICY  3
   49.63 -
   49.64 -#define ACM_NULL_POLICY	0
   49.65 -#define ACM_CHINESE_WALL_POLICY	1
   49.66 -#define ACM_SIMPLE_TYPE_ENFORCEMENT_POLICY 2
   49.67 -#define ACM_CHINESE_WALL_AND_SIMPLE_TYPE_ENFORCEMENT_POLICY 3
   49.68 -
   49.69 -/* policy: */
   49.70 -#define ACM_POLICY_NAME(X) \
   49.71 -	(X == ACM_NULL_POLICY) ? "NULL policy" : \
   49.72 -	(X == ACM_CHINESE_WALL_POLICY) ? "CHINESE WALL policy" : \
   49.73 -	(X == ACM_SIMPLE_TYPE_ENFORCEMENT_POLICY) ? "SIMPLE TYPE ENFORCEMENT policy" : \
   49.74 -	(X == ACM_CHINESE_WALL_AND_SIMPLE_TYPE_ENFORCEMENT_POLICY) ? "CHINESE WALL AND SIMPLE TYPE ENFORCEMENT policy" : \
   49.75 -	"UNDEFINED policy"
   49.76 -
   49.77 -/* defines a ssid reference used by xen */
   49.78 -typedef u32 ssidref_t;
   49.79 -
   49.80 -/* -------security policy relevant type definitions-------- */
   49.81 -
   49.82 -/* type identifier; compares to "equal" or "not equal" */
   49.83 -typedef u16 domaintype_t;
   49.84 -
   49.85 -/* CHINESE WALL POLICY DATA STRUCTURES
   49.86 - *
   49.87 - * current accumulated conflict type set:
   49.88 - * When a domain is started and has a type that is in
   49.89 - * a conflict set, the conflicting types are incremented in
   49.90 - * the aggregate set. When a domain is destroyed, the 
   49.91 - * conflicting types to its type are decremented.
   49.92 - * If a domain has multiple types, this procedure works over
   49.93 - * all those types.
   49.94 - *
   49.95 - * conflict_aggregate_set[i] holds the number of
   49.96 - *   running domains that have a conflict with type i.
   49.97 - *
   49.98 - * running_types[i] holds the number of running domains
   49.99 - *        that include type i in their ssidref-referenced type set
  49.100 - *
  49.101 - * conflict_sets[i][j] is "0" if type j has no conflict
  49.102 - *    with type i and is "1" otherwise.
  49.103 - */
  49.104 -/* high-16 = version, low-16 = check magic */
  49.105 -#define ACM_MAGIC		0x0001debc
  49.106 -
  49.107 -/* each offset in bytes from start of the struct they
  49.108 - *   the are part of */
  49.109 -/* each buffer consists of all policy information for
  49.110 - * the respective policy given in the policy code
  49.111 - */
  49.112 -struct acm_policy_buffer {
  49.113 -        u32 magic;
  49.114 -	u32 policyversion;
  49.115 -	u32 len;
  49.116 -	u16 primary_policy_code;
  49.117 -	u16 primary_buffer_offset;
  49.118 -	u16 secondary_policy_code;
  49.119 -	u16 secondary_buffer_offset;
  49.120 -};
  49.121 -
  49.122 -struct acm_chwall_policy_buffer {
  49.123 -	u16 policy_code;
  49.124 -	u16 chwall_max_types;
  49.125 -	u16 chwall_max_ssidrefs;
  49.126 -	u16 chwall_max_conflictsets;
  49.127 -	u16 chwall_ssid_offset;
  49.128 -	u16 chwall_conflict_sets_offset;
  49.129 -	u16 chwall_running_types_offset;
  49.130 -	u16 chwall_conflict_aggregate_offset;
  49.131 -};
  49.132 -
  49.133 -struct acm_ste_policy_buffer {
  49.134 -	u16 policy_code;
  49.135 -	u16 ste_max_types;
  49.136 -	u16 ste_max_ssidrefs;
  49.137 -	u16 ste_ssid_offset;
  49.138 -};
  49.139 -
  49.140 -struct acm_stats_buffer {
  49.141 -        u32 magic;
  49.142 -	u32 policyversion;
  49.143 -	u32 len;
  49.144 -	u16 primary_policy_code;
  49.145 -	u16 primary_stats_offset;
  49.146 -	u16 secondary_policy_code;
  49.147 -	u16 secondary_stats_offset;
  49.148 -};
  49.149 -
  49.150 -struct acm_ste_stats_buffer {
  49.151 -	u32 ec_eval_count;
  49.152 -	u32 gt_eval_count;
  49.153 -	u32 ec_denied_count;
  49.154 -	u32 gt_denied_count; 
  49.155 -	u32 ec_cachehit_count;
  49.156 -	u32 gt_cachehit_count;
  49.157 -};
  49.158 -
  49.159 -
  49.160 -#endif
    50.1 --- a/xen/include/public/dom0_ops.h	Thu Jul 07 10:12:52 2005 -0700
    50.2 +++ b/xen/include/public/dom0_ops.h	Sat Jul 09 06:54:10 2005 -0700
    50.3 @@ -19,7 +19,7 @@
    50.4   * This makes sure that old versions of dom0 tools will stop working in a
    50.5   * well-defined way (rather than crashing the machine, for instance).
    50.6   */
    50.7 -#define DOM0_INTERFACE_VERSION   0xAAAA100C
    50.8 +#define DOM0_INTERFACE_VERSION   0xAAAA100E
    50.9  
   50.10  /************************************************************************/
   50.11  
   50.12 @@ -357,6 +357,16 @@ typedef struct {
   50.13      u64     cpu_time;                 
   50.14  } dom0_getvcpucontext_t;
   50.15  
   50.16 +#define DOM0_GETDOMAININFOLIST    38
   50.17 +typedef struct {
   50.18 +    /* IN variables. */
   50.19 +    domid_t               first_domain;
   50.20 +    memory_t              max_domains;
   50.21 +    dom0_getdomaininfo_t *buffer;
   50.22 +    /* OUT variables. */
   50.23 +    memory_t              num_domains;
   50.24 +} dom0_getdomaininfolist_t;
   50.25 +
   50.26  typedef struct {
   50.27      u32 cmd;
   50.28      u32 interface_version; /* DOM0_INTERFACE_VERSION */
   50.29 @@ -389,6 +399,7 @@ typedef struct {
   50.30          dom0_microcode_t         microcode;
   50.31          dom0_ioport_permission_t ioport_permission;
   50.32          dom0_getvcpucontext_t    getvcpucontext;
   50.33 +        dom0_getdomaininfolist_t getdomaininfolist;
   50.34      } u;
   50.35  } dom0_op_t;
   50.36  
    51.1 --- a/xen/include/public/event_channel.h	Thu Jul 07 10:12:52 2005 -0700
    51.2 +++ b/xen/include/public/event_channel.h	Sat Jul 09 06:54:10 2005 -0700
    51.3 @@ -89,8 +89,6 @@ typedef struct evtchn_bind_pirq {
    51.4   */
    51.5  #define EVTCHNOP_bind_ipi         7
    51.6  typedef struct evtchn_bind_ipi {
    51.7 -    /* IN parameters. */
    51.8 -    u32 ipi_vcpu;
    51.9      /* OUT parameters. */
   51.10      u32 port;
   51.11  } evtchn_bind_ipi_t;
   51.12 @@ -144,6 +142,7 @@ typedef struct evtchn_status {
   51.13  #define EVTCHNSTAT_virq         4  /* Channel is bound to a virtual IRQ line */
   51.14  #define EVTCHNSTAT_ipi          5  /* Channel is bound to a virtual IPI line */
   51.15      u32     status;
   51.16 +    u32     vcpu;                  /* VCPU to which this channel is bound.   */
   51.17      union {
   51.18          struct {
   51.19              domid_t dom;
   51.20 @@ -154,16 +153,25 @@ typedef struct evtchn_status {
   51.21          } interdomain; /* EVTCHNSTAT_interdomain */
   51.22          u32 pirq;      /* EVTCHNSTAT_pirq        */
   51.23          u32 virq;      /* EVTCHNSTAT_virq        */
   51.24 -        u32 ipi_vcpu;  /* EVTCHNSTAT_ipi         */
   51.25      } u;
   51.26  } evtchn_status_t;
   51.27  
   51.28 -#define EVTCHNOP_rebind        8
   51.29 -typedef struct {
   51.30 +/*
   51.31 + * EVTCHNOP_bind_vcpu: Specify which vcpu a channel should notify when an
   51.32 + * event is pending.
   51.33 + * NOTES:
   51.34 + *  1. IPI- and VIRQ-bound channels always notify the vcpu that initialised
   51.35 + *     the binding. This binding cannot be changed.
   51.36 + *  2. All other channels notify vcpu0 by default. This default is set when
   51.37 + *     the channel is allocated (a port that is freed and subsequently reused
   51.38 + *     has its binding reset to vcpu0).
   51.39 + */
   51.40 +#define EVTCHNOP_bind_vcpu        8
   51.41 +typedef struct evtchn_bind_vcpu {
   51.42      /* IN parameters. */
   51.43 -    u32 port;                         /*  0 */
   51.44 -    u32 vcpu;                         /*  4 */
   51.45 -} evtchn_rebind_t; /* 8 bytes */
   51.46 +    u32 port;
   51.47 +    u32 vcpu;
   51.48 +} evtchn_bind_vcpu_t;
   51.49  
   51.50  typedef struct evtchn_op {
   51.51      u32 cmd; /* EVTCHNOP_* */
   51.52 @@ -176,7 +184,7 @@ typedef struct evtchn_op {
   51.53          evtchn_close_t            close;
   51.54          evtchn_send_t             send;
   51.55          evtchn_status_t           status;
   51.56 -        evtchn_rebind_t           rebind;
   51.57 +        evtchn_bind_vcpu_t        bind_vcpu;
   51.58      } u;
   51.59  } evtchn_op_t;
   51.60  
    52.1 --- a/xen/include/public/io/domain_controller.h	Thu Jul 07 10:12:52 2005 -0700
    52.2 +++ b/xen/include/public/io/domain_controller.h	Sat Jul 09 06:54:10 2005 -0700
    52.3 @@ -577,11 +577,12 @@ typedef struct usbif_fe_interface_connec
    52.4  } usbif_fe_interface_connect_t;
    52.5  
    52.6  /*
    52.7 - * CMSG_BLKIF_FE_INTERFACE_DISCONNECT:
    52.8 + * CMSG_USBIF_FE_INTERFACE_DISCONNECT:
    52.9   *  If successful, the domain controller will acknowledge with a
   52.10   *  STATUS_DISCONNECTED message.
   52.11   */
   52.12  typedef struct usbif_fe_interface_disconnect {
   52.13 +    int dummy; /* make struct non-empty */
   52.14  } usbif_fe_interface_disconnect_t;
   52.15  
   52.16