ia64/xen-unstable

changeset 9896:42a8e3101c6c

Define new event-channel and physdev hypercalls with a more extensible
interface (the legacy hypercalls would break if subcommands with large
argument structures were added, as it would grow the size of the
union of all argument structures).

Also, based on a patch from Kevin Tian, add a new physdev op to
signal EOI for a particular irq.

Signed-off-by: Keir Fraser <keir@xensource.com>
author kaf24@firebug.cl.cam.ac.uk
date Sun Apr 30 09:16:15 2006 +0100 (2006-04-30)
parents e0e68942b205
children 0ee104bd6557
files linux-2.6-xen-sparse/arch/i386/kernel/io_apic-xen.c linux-2.6-xen-sparse/arch/i386/kernel/ioport-xen.c linux-2.6-xen-sparse/arch/i386/kernel/process-xen.c linux-2.6-xen-sparse/arch/i386/kernel/setup-xen.c linux-2.6-xen-sparse/arch/ia64/Kconfig linux-2.6-xen-sparse/arch/ia64/kernel/iosapic.c linux-2.6-xen-sparse/arch/ia64/xen/drivers/evtchn_ia64.c linux-2.6-xen-sparse/arch/x86_64/kernel/io_apic-xen.c linux-2.6-xen-sparse/arch/x86_64/kernel/ioport-xen.c linux-2.6-xen-sparse/arch/x86_64/kernel/process-xen.c linux-2.6-xen-sparse/arch/x86_64/kernel/setup-xen.c linux-2.6-xen-sparse/drivers/xen/Kconfig linux-2.6-xen-sparse/drivers/xen/blkback/interface.c linux-2.6-xen-sparse/drivers/xen/blktap/interface.c linux-2.6-xen-sparse/drivers/xen/core/evtchn.c linux-2.6-xen-sparse/drivers/xen/evtchn/evtchn.c linux-2.6-xen-sparse/drivers/xen/netback/interface.c linux-2.6-xen-sparse/drivers/xen/privcmd/privcmd.c linux-2.6-xen-sparse/drivers/xen/tpmback/interface.c linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_client.c linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/hypercall.h linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/hypervisor.h linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/processor.h linux-2.6-xen-sparse/include/asm-ia64/hypercall.h linux-2.6-xen-sparse/include/asm-ia64/hypervisor.h linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/hypercall.h linux-2.6-xen-sparse/include/xen/evtchn.h tools/libxc/xc_evtchn.c xen/arch/ia64/vmx/vmx_hypercall.c xen/arch/ia64/vmx/vmx_ivt.S xen/arch/ia64/xen/hypercall.c xen/arch/ia64/xen/irq.c xen/arch/x86/Makefile xen/arch/x86/compat.c xen/arch/x86/irq.c xen/arch/x86/physdev.c xen/arch/x86/x86_32/entry.S xen/arch/x86/x86_64/entry.S xen/common/event_channel.c xen/include/acm/acm_hooks.h xen/include/asm-ia64/hypercall.h xen/include/asm-x86/hypercall.h xen/include/public/event_channel.h xen/include/public/physdev.h xen/include/public/xen-compat.h xen/include/public/xen.h xen/include/xen/hypercall.h xen/include/xen/irq.h
line diff
     1.1 --- a/linux-2.6-xen-sparse/arch/i386/kernel/io_apic-xen.c	Fri Apr 28 16:44:00 2006 +0100
     1.2 +++ b/linux-2.6-xen-sparse/arch/i386/kernel/io_apic-xen.c	Sun Apr 30 09:16:15 2006 +0100
     1.3 @@ -57,27 +57,25 @@ unsigned long io_apic_irqs;
     1.4  
     1.5  static inline unsigned int xen_io_apic_read(unsigned int apic, unsigned int reg)
     1.6  {
     1.7 -	physdev_op_t op;
     1.8 +	struct physdev_apic apic_op;
     1.9  	int ret;
    1.10  
    1.11 -	op.cmd = PHYSDEVOP_APIC_READ;
    1.12 -	op.u.apic_op.apic_physbase = mp_ioapics[apic].mpc_apicaddr;
    1.13 -	op.u.apic_op.reg = reg;
    1.14 -	ret = HYPERVISOR_physdev_op(&op);
    1.15 +	apic_op.apic_physbase = mp_ioapics[apic].mpc_apicaddr;
    1.16 +	apic_op.reg = reg;
    1.17 +	ret = HYPERVISOR_physdev_op(PHYSDEVOP_apic_read, &apic_op);
    1.18  	if (ret)
    1.19  		return ret;
    1.20 -	return op.u.apic_op.value;
    1.21 +	return apic_op.value;
    1.22  }
    1.23  
    1.24  static inline void xen_io_apic_write(unsigned int apic, unsigned int reg, unsigned int value)
    1.25  {
    1.26 -	physdev_op_t op;
    1.27 -
    1.28 -	op.cmd = PHYSDEVOP_APIC_WRITE;
    1.29 -	op.u.apic_op.apic_physbase = mp_ioapics[apic].mpc_apicaddr;
    1.30 -	op.u.apic_op.reg = reg;
    1.31 -	op.u.apic_op.value = value;
    1.32 -	HYPERVISOR_physdev_op(&op);
    1.33 +	struct physdev_apic apic_op;
    1.34 +
    1.35 +	apic_op.apic_physbase = mp_ioapics[apic].mpc_apicaddr;
    1.36 +	apic_op.reg = reg;
    1.37 +	apic_op.value = value;
    1.38 +	HYPERVISOR_physdev_op(PHYSDEVOP_apic_write, &apic_op);
    1.39  }
    1.40  
    1.41  #define io_apic_read(a,r)    xen_io_apic_read(a,r)
    1.42 @@ -1205,22 +1203,21 @@ u8 irq_vector[NR_IRQ_VECTORS] __read_mos
    1.43  
    1.44  int assign_irq_vector(int irq)
    1.45  {
    1.46 -	physdev_op_t op;
    1.47 +	struct physdev_irq irq_op;
    1.48  
    1.49  	BUG_ON(irq >= NR_IRQ_VECTORS);
    1.50  	if (irq != AUTO_ASSIGN && IO_APIC_VECTOR(irq) > 0)
    1.51  		return IO_APIC_VECTOR(irq);
    1.52  
    1.53 -	op.cmd = PHYSDEVOP_ASSIGN_VECTOR;
    1.54 -	op.u.irq_op.irq = irq;
    1.55 -	if (HYPERVISOR_physdev_op(&op))
    1.56 +	irq_op.irq = irq;
    1.57 +	if (HYPERVISOR_physdev_op(PHYSDEVOP_alloc_irq_vector, &irq_op))
    1.58  		return -ENOSPC;
    1.59  
    1.60 -	vector_irq[op.u.irq_op.vector] = irq;
    1.61 +	vector_irq[irq_op.vector] = irq;
    1.62  	if (irq != AUTO_ASSIGN)
    1.63 -		IO_APIC_VECTOR(irq) = op.u.irq_op.vector;
    1.64 -
    1.65 -	return op.u.irq_op.vector;
    1.66 +		IO_APIC_VECTOR(irq) = irq_op.vector;
    1.67 +
    1.68 +	return irq_op.vector;
    1.69  }
    1.70  
    1.71  #ifndef CONFIG_XEN
     2.1 --- a/linux-2.6-xen-sparse/arch/i386/kernel/ioport-xen.c	Fri Apr 28 16:44:00 2006 +0100
     2.2 +++ b/linux-2.6-xen-sparse/arch/i386/kernel/ioport-xen.c	Sun Apr 30 09:16:15 2006 +0100
     2.3 @@ -60,7 +60,7 @@ asmlinkage long sys_ioperm(unsigned long
     2.4  {
     2.5  	struct thread_struct * t = &current->thread;
     2.6  	unsigned long *bitmap;
     2.7 -	physdev_op_t op;
     2.8 +	struct physdev_set_iobitmap set_iobitmap;
     2.9  
    2.10  	if ((from + num <= from) || (from + num > IO_BITMAP_BITS))
    2.11  		return -EINVAL;
    2.12 @@ -80,10 +80,9 @@ asmlinkage long sys_ioperm(unsigned long
    2.13  		memset(bitmap, 0xff, IO_BITMAP_BYTES);
    2.14  		t->io_bitmap_ptr = bitmap;
    2.15  
    2.16 -		op.cmd = PHYSDEVOP_SET_IOBITMAP;
    2.17 -		op.u.set_iobitmap.bitmap   = (char *)bitmap;
    2.18 -		op.u.set_iobitmap.nr_ports = IO_BITMAP_BITS;
    2.19 -		HYPERVISOR_physdev_op(&op);
    2.20 +		set_iobitmap.bitmap   = (char *)bitmap;
    2.21 +		set_iobitmap.nr_ports = IO_BITMAP_BITS;
    2.22 +		HYPERVISOR_physdev_op(PHYSDEVOP_set_iobitmap, &set_iobitmap);
    2.23  	}
    2.24  
    2.25  	set_bitmap(t->io_bitmap_ptr, from, num, !turn_on);
     3.1 --- a/linux-2.6-xen-sparse/arch/i386/kernel/process-xen.c	Fri Apr 28 16:44:00 2006 +0100
     3.2 +++ b/linux-2.6-xen-sparse/arch/i386/kernel/process-xen.c	Sun Apr 30 09:16:15 2006 +0100
     3.3 @@ -297,9 +297,8 @@ void exit_thread(void)
     3.4  
     3.5  	/* The process may have allocated an io port bitmap... nuke it. */
     3.6  	if (unlikely(NULL != t->io_bitmap_ptr)) {
     3.7 -		physdev_op_t op = { 0 };
     3.8 -		op.cmd = PHYSDEVOP_SET_IOBITMAP;
     3.9 -		HYPERVISOR_physdev_op(&op);
    3.10 +		struct physdev_set_iobitmap set_iobitmap = { 0 };
    3.11 +		HYPERVISOR_physdev_op(PHYSDEVOP_set_iobitmap, &set_iobitmap);
    3.12  		kfree(t->io_bitmap_ptr);
    3.13  		t->io_bitmap_ptr = NULL;
    3.14  	}
    3.15 @@ -521,7 +520,8 @@ struct task_struct fastcall * __switch_t
    3.16  #ifndef CONFIG_X86_NO_TSS
    3.17  	struct tss_struct *tss = &per_cpu(init_tss, cpu);
    3.18  #endif
    3.19 -	physdev_op_t iopl_op, iobmp_op;
    3.20 +	struct physdev_set_iopl iopl_op;
    3.21 +	struct physdev_set_iobitmap iobmp_op;
    3.22  	multicall_entry_t _mcl[8], *mcl = _mcl;
    3.23  
    3.24  	/* XEN NOTE: FS/GS saved in switch_mm(), not here. */
    3.25 @@ -568,23 +568,19 @@ struct task_struct fastcall * __switch_t
    3.26  #undef C
    3.27  
    3.28  	if (unlikely(prev->iopl != next->iopl)) {
    3.29 -		iopl_op.cmd             = PHYSDEVOP_SET_IOPL;
    3.30 -		iopl_op.u.set_iopl.iopl = (next->iopl == 0) ? 1 :
    3.31 -			(next->iopl >> 12) & 3;
    3.32 +		iopl_op.iopl = (next->iopl == 0) ? 1 : (next->iopl >> 12) & 3;
    3.33  		mcl->op      = __HYPERVISOR_physdev_op;
    3.34 -		mcl->args[0] = (unsigned long)&iopl_op;
    3.35 +		mcl->args[0] = PHYSDEVOP_set_iopl;
    3.36 +		mcl->args[1] = (unsigned long)&iopl_op;
    3.37  		mcl++;
    3.38  	}
    3.39  
    3.40  	if (unlikely(prev->io_bitmap_ptr || next->io_bitmap_ptr)) {
    3.41 -		iobmp_op.cmd                     =
    3.42 -			PHYSDEVOP_SET_IOBITMAP;
    3.43 -		iobmp_op.u.set_iobitmap.bitmap   =
    3.44 -			(char *)next->io_bitmap_ptr;
    3.45 -		iobmp_op.u.set_iobitmap.nr_ports =
    3.46 -			next->io_bitmap_ptr ? IO_BITMAP_BITS : 0;
    3.47 +		iobmp_op.bitmap   = (char *)next->io_bitmap_ptr;
    3.48 +		iobmp_op.nr_ports = next->io_bitmap_ptr ? IO_BITMAP_BITS : 0;
    3.49  		mcl->op      = __HYPERVISOR_physdev_op;
    3.50 -		mcl->args[0] = (unsigned long)&iobmp_op;
    3.51 +		mcl->args[0] = PHYSDEVOP_set_iobitmap;
    3.52 +		mcl->args[1] = (unsigned long)&iobmp_op;
    3.53  		mcl++;
    3.54  	}
    3.55  
     4.1 --- a/linux-2.6-xen-sparse/arch/i386/kernel/setup-xen.c	Fri Apr 28 16:44:00 2006 +0100
     4.2 +++ b/linux-2.6-xen-sparse/arch/i386/kernel/setup-xen.c	Sun Apr 30 09:16:15 2006 +0100
     4.3 @@ -1630,7 +1630,7 @@ static void set_mca_bus(int x) { }
     4.4  void __init setup_arch(char **cmdline_p)
     4.5  {
     4.6  	int i, j, k, fpp;
     4.7 -	physdev_op_t op;
     4.8 +	struct physdev_set_iopl set_iopl;
     4.9  	unsigned long max_low_pfn;
    4.10  
    4.11  	/* Force a quick death if the kernel panics (not domain 0). */
    4.12 @@ -1815,9 +1815,8 @@ void __init setup_arch(char **cmdline_p)
    4.13  	if (efi_enabled)
    4.14  		efi_map_memmap();
    4.15  
    4.16 -	op.cmd             = PHYSDEVOP_SET_IOPL;
    4.17 -	op.u.set_iopl.iopl = 1;
    4.18 -	HYPERVISOR_physdev_op(&op);
    4.19 +	set_iopl.iopl = 1;
    4.20 +	HYPERVISOR_physdev_op(PHYSDEVOP_set_iopl, &set_iopl);
    4.21  
    4.22  #ifdef CONFIG_X86_IO_APIC
    4.23  	check_acpi_pci();	/* Checks more than just ACPI actually */
     5.1 --- a/linux-2.6-xen-sparse/arch/ia64/Kconfig	Fri Apr 28 16:44:00 2006 +0100
     5.2 +++ b/linux-2.6-xen-sparse/arch/ia64/Kconfig	Sun Apr 30 09:16:15 2006 +0100
     5.3 @@ -106,7 +106,7 @@ config XEN_SYSFS
     5.4  config XEN_INTERFACE_VERSION
     5.5  	hex
     5.6  	depends on XEN
     5.7 -	default 0x00030201
     5.8 +	default 0x00030202
     5.9  
    5.10  config SCHED_NO_NO_OMIT_FRAME_POINTER
    5.11  	bool
     6.1 --- a/linux-2.6-xen-sparse/arch/ia64/kernel/iosapic.c	Fri Apr 28 16:44:00 2006 +0100
     6.2 +++ b/linux-2.6-xen-sparse/arch/ia64/kernel/iosapic.c	Sun Apr 30 09:16:15 2006 +0100
     6.3 @@ -146,29 +146,27 @@ static LIST_HEAD(free_rte_list);
     6.4  #include <asm/hypervisor.h>
     6.5  static inline unsigned int xen_iosapic_read(char __iomem *iosapic, unsigned int reg)
     6.6  {
     6.7 -	physdev_op_t op;
     6.8 +	struct physdev_apic apic_op;
     6.9  	int ret;
    6.10  
    6.11 -	op.cmd = PHYSDEVOP_APIC_READ;
    6.12 -	op.u.apic_op.apic_physbase = (unsigned long)iosapic -
    6.13 +	apic_op.apic_physbase = (unsigned long)iosapic -
    6.14  					__IA64_UNCACHED_OFFSET;
    6.15 -	op.u.apic_op.reg = reg;
    6.16 -	ret = HYPERVISOR_physdev_op(&op);
    6.17 +	apic_op.reg = reg;
    6.18 +	ret = HYPERVISOR_physdev_op(PHYSDEVOP_apic_read, &apic_op);
    6.19  	if (ret)
    6.20  		return ret;
    6.21 -	return op.u.apic_op.value;
    6.22 +	return apic_op.value;
    6.23  }
    6.24  
    6.25  static inline void xen_iosapic_write(char __iomem *iosapic, unsigned int reg, u32 val)
    6.26  {
    6.27 -	physdev_op_t op;
    6.28 +	struct physdev_apic apic_op;
    6.29  
    6.30 -	op.cmd = PHYSDEVOP_APIC_WRITE;
    6.31 -	op.u.apic_op.apic_physbase = (unsigned long)iosapic - 
    6.32 +	apic_op.apic_physbase = (unsigned long)iosapic - 
    6.33  					__IA64_UNCACHED_OFFSET;
    6.34 -	op.u.apic_op.reg = reg;
    6.35 -	op.u.apic_op.value = val;
    6.36 -	HYPERVISOR_physdev_op(&op);
    6.37 +	apic_op.reg = reg;
    6.38 +	apic_op.value = val;
    6.39 +	HYPERVISOR_physdev_op(PHYSDEVOP_apic_write, &apic_op);
    6.40  }
    6.41  
    6.42  static inline unsigned int iosapic_read(char __iomem *iosapic, unsigned int reg)
    6.43 @@ -191,14 +189,13 @@ static inline void iosapic_write(char __
    6.44  
    6.45  int xen_assign_irq_vector(int irq)
    6.46  {
    6.47 -	physdev_op_t op;
    6.48 +	struct physdev_irq irq_op;
    6.49  
    6.50 -	op.cmd = PHYSDEVOP_ASSIGN_VECTOR;
    6.51 -	op.u.irq_op.irq = irq;
    6.52 -	if (HYPERVISOR_physdev_op(&op))
    6.53 +	irq_op.irq = irq;
    6.54 +	if (HYPERVISOR_physdev_op(PHYSDEVOP_alloc_irq_vector, &irq_op))
    6.55  		return -ENOSPC;
    6.56  
    6.57 -	return op.u.irq_op.vector;
    6.58 +	return irq_op.vector;
    6.59  }
    6.60  #endif /* XEN */
    6.61  
     7.1 --- a/linux-2.6-xen-sparse/arch/ia64/xen/drivers/evtchn_ia64.c	Fri Apr 28 16:44:00 2006 +0100
     7.2 +++ b/linux-2.6-xen-sparse/arch/ia64/xen/drivers/evtchn_ia64.c	Sun Apr 30 09:16:15 2006 +0100
     7.3 @@ -61,9 +61,8 @@ void unmask_evtchn(int port)
     7.4  #if 0	// FIXME: diverged from x86 evtchn.c
     7.5  	/* Slow path (hypercall) if this is a non-local port. */
     7.6  	if (unlikely(cpu != cpu_from_evtchn(port))) {
     7.7 -		evtchn_op_t op = { .cmd = EVTCHNOP_unmask,
     7.8 -				   .u.unmask.port = port };
     7.9 -		(void)HYPERVISOR_event_channel_op(&op);
    7.10 +		struct evtchn_unmask op = { .port = port };
    7.11 +		(void)HYPERVISOR_event_channel_op(EVTCHNOP_unmask, &op);
    7.12  		return;
    7.13  	}
    7.14  #endif
    7.15 @@ -95,16 +94,16 @@ int bind_virq_to_irqhandler(
    7.16  	const char *devname,
    7.17  	void *dev_id)
    7.18  {
    7.19 -    evtchn_op_t op;
    7.20 +    struct evtchn_bind_virq bind_virq;
    7.21      int evtchn;
    7.22  
    7.23      spin_lock(&irq_mapping_update_lock);
    7.24  
    7.25 -    op.cmd = EVTCHNOP_bind_virq;
    7.26 -    op.u.bind_virq.virq = virq;
    7.27 -    op.u.bind_virq.vcpu = cpu;
    7.28 -    BUG_ON(HYPERVISOR_event_channel_op(&op) != 0 );
    7.29 -    evtchn = op.u.bind_virq.port;
    7.30 +    bind_virq.virq = virq;
    7.31 +    bind_virq.vcpu = cpu;
    7.32 +    if (HYPERVISOR_event_channel_op(EVTCHNOP_bind_virq, &bind_virq) != 0)
    7.33 +        BUG();
    7.34 +    evtchn = bind_virq.port;
    7.35  
    7.36      if (!unbound_irq(evtchn)) {
    7.37          evtchn = -EINVAL;
    7.38 @@ -158,7 +157,7 @@ int bind_ipi_to_irqhandler(
    7.39  
    7.40  void unbind_from_irqhandler(unsigned int irq, void *dev_id)
    7.41  {
    7.42 -    evtchn_op_t op;
    7.43 +    struct evtchn_close close;
    7.44      int evtchn = evtchn_from_irq(irq);
    7.45  
    7.46      spin_lock(&irq_mapping_update_lock);
    7.47 @@ -166,9 +165,9 @@ void unbind_from_irqhandler(unsigned int
    7.48      if (unbound_irq(irq))
    7.49          goto out;
    7.50  
    7.51 -    op.cmd = EVTCHNOP_close;
    7.52 -    op.u.close.port = evtchn;
    7.53 -    BUG_ON(HYPERVISOR_event_channel_op(&op) != 0);
    7.54 +    close.port = evtchn;
    7.55 +    if (HYPERVISOR_event_channel_op(EVTCHNOP_close, &close) != 0)
    7.56 +        BUG();
    7.57  
    7.58      switch (type_from_irq(irq)) {
    7.59  	case IRQT_VIRQ:
     8.1 --- a/linux-2.6-xen-sparse/arch/x86_64/kernel/io_apic-xen.c	Fri Apr 28 16:44:00 2006 +0100
     8.2 +++ b/linux-2.6-xen-sparse/arch/x86_64/kernel/io_apic-xen.c	Sun Apr 30 09:16:15 2006 +0100
     8.3 @@ -104,27 +104,25 @@ unsigned long io_apic_irqs;
     8.4  
     8.5  static inline unsigned int xen_io_apic_read(unsigned int apic, unsigned int reg)
     8.6  {
     8.7 -	physdev_op_t op;
     8.8 +	struct physdev_apic apic_op;
     8.9  	int ret;
    8.10  
    8.11 -	op.cmd = PHYSDEVOP_APIC_READ;
    8.12 -	op.u.apic_op.apic_physbase = mp_ioapics[apic].mpc_apicaddr;
    8.13 -	op.u.apic_op.reg = reg;
    8.14 -	ret = HYPERVISOR_physdev_op(&op);
    8.15 +	apic_op.apic_physbase = mp_ioapics[apic].mpc_apicaddr;
    8.16 +	apic_op.reg = reg;
    8.17 +	ret = HYPERVISOR_physdev_op(PHYSDEVOP_apic_read, &apic_op);
    8.18  	if (ret)
    8.19  		return ret;
    8.20 -	return op.u.apic_op.value;
    8.21 +	return apic_op.value;
    8.22  }
    8.23  
    8.24  static inline void xen_io_apic_write(unsigned int apic, unsigned int reg, unsigned int value)
    8.25  {
    8.26 -	physdev_op_t op;
    8.27 +	struct physdev_apic apic_op;
    8.28  
    8.29 -	op.cmd = PHYSDEVOP_APIC_WRITE;
    8.30 -	op.u.apic_op.apic_physbase = mp_ioapics[apic].mpc_apicaddr;
    8.31 -	op.u.apic_op.reg = reg;
    8.32 -	op.u.apic_op.value = value;
    8.33 -	HYPERVISOR_physdev_op(&op);
    8.34 +	apic_op.apic_physbase = mp_ioapics[apic].mpc_apicaddr;
    8.35 +	apic_op.reg = reg;
    8.36 +	apic_op.value = value;
    8.37 +	HYPERVISOR_physdev_op(PHYSDEVOP_apic_write, &apic_op);
    8.38  }
    8.39  
    8.40  #define io_apic_read(a,r)    xen_io_apic_read(a,r)
    8.41 @@ -869,22 +867,21 @@ u8 irq_vector[NR_IRQ_VECTORS] __read_mos
    8.42  
    8.43  int assign_irq_vector(int irq)
    8.44  {
    8.45 -	physdev_op_t op;
    8.46 +	struct physdev_irq irq_op;
    8.47    
    8.48    	BUG_ON(irq != AUTO_ASSIGN && (unsigned)irq >= NR_IRQ_VECTORS);
    8.49    	if (irq != AUTO_ASSIGN && IO_APIC_VECTOR(irq) > 0)
    8.50    		return IO_APIC_VECTOR(irq);
    8.51  
    8.52 -	op.cmd = PHYSDEVOP_ASSIGN_VECTOR;
    8.53 -	op.u.irq_op.irq = irq;
    8.54 -	if (HYPERVISOR_physdev_op(&op))
    8.55 +	irq_op.irq = irq;
    8.56 +	if (HYPERVISOR_physdev_op(PHYSDEVOP_alloc_irq_vector, &irq_op))
    8.57  		return -ENOSPC;
    8.58  
    8.59 -	vector_irq[op.u.irq_op.vector] = irq;
    8.60 +	vector_irq[irq_op.vector] = irq;
    8.61  	if (irq != AUTO_ASSIGN)
    8.62 -		IO_APIC_VECTOR(irq) = op.u.irq_op.vector;
    8.63 +		IO_APIC_VECTOR(irq) = irq_op.vector;
    8.64  
    8.65 -	return op.u.irq_op.vector;
    8.66 +	return irq_op.vector;
    8.67  }
    8.68  
    8.69  extern void (*interrupt[NR_IRQS])(void);
     9.1 --- a/linux-2.6-xen-sparse/arch/x86_64/kernel/ioport-xen.c	Fri Apr 28 16:44:00 2006 +0100
     9.2 +++ b/linux-2.6-xen-sparse/arch/x86_64/kernel/ioport-xen.c	Sun Apr 30 09:16:15 2006 +0100
     9.3 @@ -28,8 +28,8 @@
     9.4  
     9.5  asmlinkage long sys_iopl(unsigned int new_iopl, struct pt_regs *regs)
     9.6  {
     9.7 -        unsigned int old_iopl = current->thread.iopl;
     9.8 -        physdev_op_t op;
     9.9 +	unsigned int old_iopl = current->thread.iopl;
    9.10 +	struct physdev_set_iopl set_iopl;
    9.11  
    9.12  	if (new_iopl > 3)
    9.13  		return -EINVAL;
    9.14 @@ -42,9 +42,8 @@ asmlinkage long sys_iopl(unsigned int ne
    9.15  	current->thread.iopl = new_iopl;
    9.16  
    9.17  	/* Force the change at ring 0. */
    9.18 -	op.cmd             = PHYSDEVOP_SET_IOPL;
    9.19 -	op.u.set_iopl.iopl = (new_iopl == 0) ? 1 : new_iopl;
    9.20 -	HYPERVISOR_physdev_op(&op);
    9.21 +	set_iopl.iopl = (new_iopl == 0) ? 1 : new_iopl;
    9.22 +	HYPERVISOR_physdev_op(PHYSDEVOP_set_iopl, &set_iopl);
    9.23  
    9.24  	return 0;
    9.25  }
    10.1 --- a/linux-2.6-xen-sparse/arch/x86_64/kernel/process-xen.c	Fri Apr 28 16:44:00 2006 +0100
    10.2 +++ b/linux-2.6-xen-sparse/arch/x86_64/kernel/process-xen.c	Sun Apr 30 09:16:15 2006 +0100
    10.3 @@ -293,9 +293,7 @@ void exit_thread(void)
    10.4  		struct tss_struct *tss = &per_cpu(init_tss, get_cpu());
    10.5  #endif
    10.6  #ifdef CONFIG_XEN
    10.7 -		static physdev_op_t iobmp_op = {
    10.8 -			.cmd = PHYSDEVOP_SET_IOBITMAP
    10.9 -		};
   10.10 +		struct physdev_set_iobitmap iobmp_op = { 0 };
   10.11  #endif
   10.12  
   10.13  		kfree(t->io_bitmap_ptr);
   10.14 @@ -308,7 +306,7 @@ void exit_thread(void)
   10.15  		put_cpu();
   10.16  #endif
   10.17  #ifdef CONFIG_XEN
   10.18 -		HYPERVISOR_physdev_op(&iobmp_op);
   10.19 +		HYPERVISOR_physdev_op(PHYSDEVOP_set_iobitmap, &iobmp_op);
   10.20  #endif
   10.21  		t->io_bitmap_max = 0;
   10.22  	}
   10.23 @@ -478,7 +476,8 @@ static inline void __save_init_fpu( stru
   10.24  #ifndef CONFIG_X86_NO_TSS
   10.25  	struct tss_struct *tss = &per_cpu(init_tss, cpu);
   10.26  #endif
   10.27 -	physdev_op_t iopl_op, iobmp_op;
   10.28 +	struct physdev_set_iopl iopl_op;
   10.29 +	struct physdev_set_iobitmap iobmp_op;
   10.30  	multicall_entry_t _mcl[8], *mcl = _mcl;
   10.31  
   10.32  	/*
   10.33 @@ -518,22 +517,19 @@ static inline void __save_init_fpu( stru
   10.34  #undef C
   10.35  
   10.36  	if (unlikely(prev->iopl != next->iopl)) {
   10.37 -		iopl_op.cmd             = PHYSDEVOP_SET_IOPL;
   10.38 -		iopl_op.u.set_iopl.iopl = (next->iopl == 0) ? 1 : next->iopl;
   10.39 +		iopl_op.iopl = (next->iopl == 0) ? 1 : next->iopl;
   10.40  		mcl->op      = __HYPERVISOR_physdev_op;
   10.41 -		mcl->args[0] = (unsigned long)&iopl_op;
   10.42 +		mcl->args[0] = PHYSDEVOP_set_iopl;
   10.43 +		mcl->args[1] = (unsigned long)&iopl_op;
   10.44  		mcl++;
   10.45  	}
   10.46  
   10.47  	if (unlikely(prev->io_bitmap_ptr || next->io_bitmap_ptr)) {
   10.48 -		iobmp_op.cmd                     =
   10.49 -			PHYSDEVOP_SET_IOBITMAP;
   10.50 -		iobmp_op.u.set_iobitmap.bitmap   =
   10.51 -			(char *)next->io_bitmap_ptr;
   10.52 -		iobmp_op.u.set_iobitmap.nr_ports =
   10.53 -			next->io_bitmap_ptr ? IO_BITMAP_BITS : 0;
   10.54 +		iobmp_op.bitmap   = (char *)next->io_bitmap_ptr;
   10.55 +		iobmp_op.nr_ports = next->io_bitmap_ptr ? IO_BITMAP_BITS : 0;
   10.56  		mcl->op      = __HYPERVISOR_physdev_op;
   10.57 -		mcl->args[0] = (unsigned long)&iobmp_op;
   10.58 +		mcl->args[0] = PHYSDEVOP_set_iobitmap;
   10.59 +		mcl->args[1] = (unsigned long)&iobmp_op;
   10.60  		mcl++;
   10.61  	}
   10.62  
    11.1 --- a/linux-2.6-xen-sparse/arch/x86_64/kernel/setup-xen.c	Fri Apr 28 16:44:00 2006 +0100
    11.2 +++ b/linux-2.6-xen-sparse/arch/x86_64/kernel/setup-xen.c	Sun Apr 30 09:16:15 2006 +0100
    11.3 @@ -959,11 +959,10 @@ void __init setup_arch(char **cmdline_p)
    11.4  
    11.5  #ifdef CONFIG_XEN
    11.6  	{
    11.7 -		physdev_op_t op;
    11.8 +		struct physdev_set_iopl set_iopl;
    11.9  
   11.10 -		op.cmd             = PHYSDEVOP_SET_IOPL;
   11.11 -		op.u.set_iopl.iopl = 1;
   11.12 -		HYPERVISOR_physdev_op(&op);
   11.13 +		set_iopl.iopl = 1;
   11.14 +		HYPERVISOR_physdev_op(PHYSDEVOP_set_iopl, &set_iopl);
   11.15  
   11.16  		if (xen_start_info->flags & SIF_INITDOMAIN) {
   11.17  			if (!(xen_start_info->flags & SIF_PRIVILEGED))
    12.1 --- a/linux-2.6-xen-sparse/drivers/xen/Kconfig	Fri Apr 28 16:44:00 2006 +0100
    12.2 +++ b/linux-2.6-xen-sparse/drivers/xen/Kconfig	Sun Apr 30 09:16:15 2006 +0100
    12.3 @@ -13,7 +13,7 @@ config XEN
    12.4  if XEN
    12.5  config XEN_INTERFACE_VERSION
    12.6  	hex
    12.7 -	default 0x00030201
    12.8 +	default 0x00030202
    12.9  
   12.10  menu "XEN"
   12.11  
    13.1 --- a/linux-2.6-xen-sparse/drivers/xen/blkback/interface.c	Fri Apr 28 16:44:00 2006 +0100
    13.2 +++ b/linux-2.6-xen-sparse/drivers/xen/blkback/interface.c	Sun Apr 30 09:16:15 2006 +0100
    13.3 @@ -101,10 +101,7 @@ int blkif_map(blkif_t *blkif, unsigned l
    13.4  {
    13.5  	blkif_sring_t *sring;
    13.6  	int err;
    13.7 -	evtchn_op_t op = {
    13.8 -		.cmd = EVTCHNOP_bind_interdomain,
    13.9 -		.u.bind_interdomain.remote_dom = blkif->domid,
   13.10 -		.u.bind_interdomain.remote_port = evtchn };
   13.11 +	struct evtchn_bind_interdomain bind_interdomain;
   13.12  
   13.13  	/* Already connected through? */
   13.14  	if (blkif->irq)
   13.15 @@ -119,14 +116,18 @@ int blkif_map(blkif_t *blkif, unsigned l
   13.16  		return err;
   13.17  	}
   13.18  
   13.19 -	err = HYPERVISOR_event_channel_op(&op);
   13.20 +	bind_interdomain.remote_dom  = blkif->domid;
   13.21 +	bind_interdomain.remote_port = evtchn;
   13.22 +
   13.23 +	err = HYPERVISOR_event_channel_op(EVTCHNOP_bind_interdomain,
   13.24 +					  &bind_interdomain);
   13.25  	if (err) {
   13.26  		unmap_frontend_page(blkif);
   13.27  		free_vm_area(blkif->blk_ring_area);
   13.28  		return err;
   13.29  	}
   13.30  
   13.31 -	blkif->evtchn = op.u.bind_interdomain.local_port;
   13.32 +	blkif->evtchn = bind_interdomain.local_port;
   13.33  
   13.34  	sring = (blkif_sring_t *)blkif->blk_ring_area->addr;
   13.35  	BACK_RING_INIT(&blkif->blk_ring, sring, PAGE_SIZE);
    14.1 --- a/linux-2.6-xen-sparse/drivers/xen/blktap/interface.c	Fri Apr 28 16:44:00 2006 +0100
    14.2 +++ b/linux-2.6-xen-sparse/drivers/xen/blktap/interface.c	Sun Apr 30 09:16:15 2006 +0100
    14.3 @@ -70,10 +70,7 @@ int blkif_map(blkif_t *blkif, unsigned l
    14.4  {
    14.5  	blkif_sring_t *sring;
    14.6  	int err;
    14.7 -	evtchn_op_t op = {
    14.8 -		.cmd = EVTCHNOP_bind_interdomain,
    14.9 -		.u.bind_interdomain.remote_dom  = blkif->domid,
   14.10 -		.u.bind_interdomain.remote_port = evtchn };
   14.11 +	struct evtchn_bind_interdomain bind_interdomain;
   14.12  
   14.13  	if ((blkif->blk_ring_area = alloc_vm_area(PAGE_SIZE)) == NULL)
   14.14  		return -ENOMEM;
   14.15 @@ -84,14 +81,18 @@ int blkif_map(blkif_t *blkif, unsigned l
   14.16  		return err;
   14.17  	}
   14.18  
   14.19 -	err = HYPERVISOR_event_channel_op(&op);
   14.20 +	bind_interdomain.remote_dom  = blkif->domid;
   14.21 +	bind_interdomain.remote_port = evtchn;
   14.22 +
   14.23 +	err = HYPERVISOR_event_channel_op(EVTCHNOP_bind_interdomain,
   14.24 +					  &bind_interdomain);
   14.25  	if (err) {
   14.26  		unmap_frontend_page(blkif);
   14.27  		free_vm_area(blkif->blk_ring_area);
   14.28  		return err;
   14.29  	}
   14.30  
   14.31 -	blkif->evtchn = op.u.bind_interdomain.local_port;
   14.32 +	blkif->evtchn = bind_interdomain.local_port;
   14.33  
   14.34  	sring = (blkif_sring_t *)blkif->blk_ring_area->addr;
   14.35  	BACK_RING_INIT(&blkif->blk_ring, sring, PAGE_SIZE);
    15.1 --- a/linux-2.6-xen-sparse/drivers/xen/core/evtchn.c	Fri Apr 28 16:44:00 2006 +0100
    15.2 +++ b/linux-2.6-xen-sparse/drivers/xen/core/evtchn.c	Sun Apr 30 09:16:15 2006 +0100
    15.3 @@ -103,7 +103,7 @@ DEFINE_PER_CPU(int, ipi_to_irq[NR_IPIS])
    15.4  static int irq_bindcount[NR_IRQS];
    15.5  
    15.6  /* Bitmap indicating which PIRQs require Xen to be notified on unmask. */
    15.7 -static unsigned long pirq_needs_unmask_notify[NR_PIRQS/sizeof(unsigned long)];
    15.8 +static unsigned long pirq_needs_eoi[NR_PIRQS/sizeof(unsigned long)];
    15.9  
   15.10  #ifdef CONFIG_SMP
   15.11  
   15.12 @@ -258,16 +258,18 @@ static int bind_evtchn_to_irq(unsigned i
   15.13  
   15.14  static int bind_virq_to_irq(unsigned int virq, unsigned int cpu)
   15.15  {
   15.16 -	evtchn_op_t op = { .cmd = EVTCHNOP_bind_virq };
   15.17 +	struct evtchn_bind_virq bind_virq;
   15.18  	int evtchn, irq;
   15.19  
   15.20  	spin_lock(&irq_mapping_update_lock);
   15.21  
   15.22  	if ((irq = per_cpu(virq_to_irq, cpu)[virq]) == -1) {
   15.23 -		op.u.bind_virq.virq = virq;
   15.24 -		op.u.bind_virq.vcpu = cpu;
   15.25 -		BUG_ON(HYPERVISOR_event_channel_op(&op) != 0);
   15.26 -		evtchn = op.u.bind_virq.port;
   15.27 +		bind_virq.virq = virq;
   15.28 +		bind_virq.vcpu = cpu;
   15.29 +		if (HYPERVISOR_event_channel_op(EVTCHNOP_bind_virq,
   15.30 +						&bind_virq) != 0)
   15.31 +			BUG();
   15.32 +		evtchn = bind_virq.port;
   15.33  
   15.34  		irq = find_unbound_irq();
   15.35  		evtchn_to_irq[evtchn] = irq;
   15.36 @@ -287,15 +289,17 @@ static int bind_virq_to_irq(unsigned int
   15.37  
   15.38  static int bind_ipi_to_irq(unsigned int ipi, unsigned int cpu)
   15.39  {
   15.40 -	evtchn_op_t op = { .cmd = EVTCHNOP_bind_ipi };
   15.41 +	struct evtchn_bind_ipi bind_ipi;
   15.42  	int evtchn, irq;
   15.43  
   15.44  	spin_lock(&irq_mapping_update_lock);
   15.45  
   15.46  	if ((irq = per_cpu(ipi_to_irq, cpu)[ipi]) == -1) {
   15.47 -		op.u.bind_ipi.vcpu = cpu;
   15.48 -		BUG_ON(HYPERVISOR_event_channel_op(&op) != 0);
   15.49 -		evtchn = op.u.bind_ipi.port;
   15.50 +		bind_ipi.vcpu = cpu;
   15.51 +		if (HYPERVISOR_event_channel_op(EVTCHNOP_bind_ipi,
   15.52 +						&bind_ipi) != 0)
   15.53 +			BUG();
   15.54 +		evtchn = bind_ipi.port;
   15.55  
   15.56  		irq = find_unbound_irq();
   15.57  		evtchn_to_irq[evtchn] = irq;
   15.58 @@ -315,14 +319,15 @@ static int bind_ipi_to_irq(unsigned int 
   15.59  
   15.60  static void unbind_from_irq(unsigned int irq)
   15.61  {
   15.62 -	evtchn_op_t op = { .cmd = EVTCHNOP_close };
   15.63 +	struct evtchn_close close;
   15.64  	int evtchn = evtchn_from_irq(irq);
   15.65  
   15.66  	spin_lock(&irq_mapping_update_lock);
   15.67  
   15.68  	if ((--irq_bindcount[irq] == 0) && VALID_EVTCHN(evtchn)) {
   15.69 -		op.u.close.port = evtchn;
   15.70 -		BUG_ON(HYPERVISOR_event_channel_op(&op) != 0);
   15.71 +		close.port = evtchn;
   15.72 +		if (HYPERVISOR_event_channel_op(EVTCHNOP_close, &close) != 0)
   15.73 +			BUG();
   15.74  
   15.75  		switch (type_from_irq(irq)) {
   15.76  		case IRQT_VIRQ:
   15.77 @@ -428,7 +433,7 @@ static void do_nothing_function(void *ig
   15.78  /* Rebind an evtchn so that it gets delivered to a specific cpu */
   15.79  static void rebind_irq_to_cpu(unsigned irq, unsigned tcpu)
   15.80  {
   15.81 -	evtchn_op_t op = { .cmd = EVTCHNOP_bind_vcpu };
   15.82 +	struct evtchn_bind_vcpu bind_vcpu;
   15.83  	int evtchn;
   15.84  
   15.85  	spin_lock(&irq_mapping_update_lock);
   15.86 @@ -440,15 +445,15 @@ static void rebind_irq_to_cpu(unsigned i
   15.87  	}
   15.88  
   15.89  	/* Send future instances of this interrupt to other vcpu. */
   15.90 -	op.u.bind_vcpu.port = evtchn;
   15.91 -	op.u.bind_vcpu.vcpu = tcpu;
   15.92 +	bind_vcpu.port = evtchn;
   15.93 +	bind_vcpu.vcpu = tcpu;
   15.94  
   15.95  	/*
   15.96  	 * If this fails, it usually just indicates that we're dealing with a 
   15.97  	 * virq or IPI channel, which don't actually need to be rebound. Ignore
   15.98  	 * it, but don't do the xenlinux-level rebind in that case.
   15.99  	 */
  15.100 -	if (HYPERVISOR_event_channel_op(&op) >= 0)
  15.101 +	if (HYPERVISOR_event_channel_op(EVTCHNOP_bind_vcpu, &bind_vcpu) >= 0)
  15.102  		bind_evtchn_to_cpu(evtchn, tcpu);
  15.103  
  15.104  	spin_unlock(&irq_mapping_update_lock);
  15.105 @@ -544,22 +549,19 @@ static struct hw_interrupt_type dynirq_t
  15.106  
  15.107  static inline void pirq_unmask_notify(int pirq)
  15.108  {
  15.109 -	physdev_op_t op;
  15.110 -	if (unlikely(test_bit(pirq, &pirq_needs_unmask_notify[0]))) {
  15.111 -		op.cmd = PHYSDEVOP_IRQ_UNMASK_NOTIFY;
  15.112 -		(void)HYPERVISOR_physdev_op(&op);
  15.113 -	}
  15.114 +	struct physdev_eoi eoi = { .irq = pirq };
  15.115 +	if (unlikely(test_bit(pirq, &pirq_needs_eoi[0])))
  15.116 +		(void)HYPERVISOR_physdev_op(PHYSDEVOP_eoi, &eoi);
  15.117  }
  15.118  
  15.119  static inline void pirq_query_unmask(int pirq)
  15.120  {
  15.121 -	physdev_op_t op;
  15.122 -	op.cmd = PHYSDEVOP_IRQ_STATUS_QUERY;
  15.123 -	op.u.irq_status_query.irq = pirq;
  15.124 -	(void)HYPERVISOR_physdev_op(&op);
  15.125 -	clear_bit(pirq, &pirq_needs_unmask_notify[0]);
  15.126 -	if (op.u.irq_status_query.flags & PHYSDEVOP_IRQ_NEEDS_UNMASK_NOTIFY)
  15.127 -		set_bit(pirq, &pirq_needs_unmask_notify[0]);
  15.128 +	struct physdev_irq_status_query irq_status;
  15.129 +	irq_status.irq = pirq;
  15.130 +	(void)HYPERVISOR_physdev_op(PHYSDEVOP_irq_status_query, &irq_status);
  15.131 +	clear_bit(pirq, &pirq_needs_eoi[0]);
  15.132 +	if (irq_status.flags & XENIRQSTAT_needs_eoi)
  15.133 +		set_bit(pirq, &pirq_needs_eoi[0]);
  15.134  }
  15.135  
  15.136  /*
  15.137 @@ -570,22 +572,22 @@ static inline void pirq_query_unmask(int
  15.138  
  15.139  static unsigned int startup_pirq(unsigned int irq)
  15.140  {
  15.141 -	evtchn_op_t op = { .cmd = EVTCHNOP_bind_pirq };
  15.142 +	struct evtchn_bind_pirq bind_pirq;
  15.143  	int evtchn = evtchn_from_irq(irq);
  15.144  
  15.145  	if (VALID_EVTCHN(evtchn))
  15.146  		goto out;
  15.147  
  15.148 -	op.u.bind_pirq.pirq  = irq;
  15.149 +	bind_pirq.pirq  = irq;
  15.150  	/* NB. We are happy to share unless we are probing. */
  15.151 -	op.u.bind_pirq.flags = probing_irq(irq) ? 0 : BIND_PIRQ__WILL_SHARE;
  15.152 -	if (HYPERVISOR_event_channel_op(&op) != 0) {
  15.153 +	bind_pirq.flags = probing_irq(irq) ? 0 : BIND_PIRQ__WILL_SHARE;
  15.154 +	if (HYPERVISOR_event_channel_op(EVTCHNOP_bind_pirq, &bind_pirq) != 0) {
  15.155  		if (!probing_irq(irq))
  15.156  			printk(KERN_INFO "Failed to obtain physical IRQ %d\n",
  15.157  			       irq);
  15.158  		return 0;
  15.159  	}
  15.160 -	evtchn = op.u.bind_pirq.port;
  15.161 +	evtchn = bind_pirq.port;
  15.162  
  15.163  	pirq_query_unmask(irq_to_pirq(irq));
  15.164  
  15.165 @@ -602,7 +604,7 @@ static unsigned int startup_pirq(unsigne
  15.166  
  15.167  static void shutdown_pirq(unsigned int irq)
  15.168  {
  15.169 -	evtchn_op_t op = { .cmd = EVTCHNOP_close };
  15.170 +	struct evtchn_close close;
  15.171  	int evtchn = evtchn_from_irq(irq);
  15.172  
  15.173  	if (!VALID_EVTCHN(evtchn))
  15.174 @@ -610,8 +612,9 @@ static void shutdown_pirq(unsigned int i
  15.175  
  15.176  	mask_evtchn(evtchn);
  15.177  
  15.178 -	op.u.close.port = evtchn;
  15.179 -	BUG_ON(HYPERVISOR_event_channel_op(&op) != 0);
  15.180 +	close.port = evtchn;
  15.181 +	if (HYPERVISOR_event_channel_op(EVTCHNOP_close, &close) != 0)
  15.182 +		BUG();
  15.183  
  15.184  	bind_evtchn_to_cpu(evtchn, 0);
  15.185  	evtchn_to_irq[evtchn] = -1;
  15.186 @@ -703,9 +706,8 @@ void unmask_evtchn(int port)
  15.187  
  15.188  	/* Slow path (hypercall) if this is a non-local port. */
  15.189  	if (unlikely(cpu != cpu_from_evtchn(port))) {
  15.190 -		evtchn_op_t op = { .cmd = EVTCHNOP_unmask,
  15.191 -				   .u.unmask.port = port };
  15.192 -		(void)HYPERVISOR_event_channel_op(&op);
  15.193 +		struct evtchn_unmask unmask = { .port = port };
  15.194 +		(void)HYPERVISOR_event_channel_op(EVTCHNOP_unmask, &unmask);
  15.195  		return;
  15.196  	}
  15.197  
  15.198 @@ -728,8 +730,9 @@ EXPORT_SYMBOL_GPL(unmask_evtchn);
  15.199  
  15.200  void irq_resume(void)
  15.201  {
  15.202 -	evtchn_op_t op;
  15.203 -	int         cpu, pirq, virq, ipi, irq, evtchn;
  15.204 +	struct evtchn_bind_virq bind_virq;
  15.205 +	struct evtchn_bind_ipi  bind_ipi;
  15.206 +	int cpu, pirq, virq, ipi, irq, evtchn;
  15.207  
  15.208  	init_evtchn_cpu_bindings();
  15.209  
  15.210 @@ -763,12 +766,12 @@ void irq_resume(void)
  15.211  		BUG_ON(irq_info[irq] != mk_irq_info(IRQT_VIRQ, virq, 0));
  15.212  
  15.213  		/* Get a new binding from Xen. */
  15.214 -		memset(&op, 0, sizeof(op));
  15.215 -		op.cmd              = EVTCHNOP_bind_virq;
  15.216 -		op.u.bind_virq.virq = virq;
  15.217 -		op.u.bind_virq.vcpu = 0;
  15.218 -		BUG_ON(HYPERVISOR_event_channel_op(&op) != 0);
  15.219 -		evtchn = op.u.bind_virq.port;
  15.220 +		bind_virq.virq = virq;
  15.221 +		bind_virq.vcpu = 0;
  15.222 +		if (HYPERVISOR_event_channel_op(EVTCHNOP_bind_virq,
  15.223 +						&bind_virq) != 0)
  15.224 +			BUG();
  15.225 +		evtchn = bind_virq.port;
  15.226  
  15.227  		/* Record the new mapping. */
  15.228  		evtchn_to_irq[evtchn] = irq;
  15.229 @@ -786,11 +789,11 @@ void irq_resume(void)
  15.230  		BUG_ON(irq_info[irq] != mk_irq_info(IRQT_IPI, ipi, 0));
  15.231  
  15.232  		/* Get a new binding from Xen. */
  15.233 -		memset(&op, 0, sizeof(op));
  15.234 -		op.cmd = EVTCHNOP_bind_ipi;
  15.235 -		op.u.bind_ipi.vcpu = 0;
  15.236 -		BUG_ON(HYPERVISOR_event_channel_op(&op) != 0);
  15.237 -		evtchn = op.u.bind_ipi.port;
  15.238 +		bind_ipi.vcpu = 0;
  15.239 +		if (HYPERVISOR_event_channel_op(EVTCHNOP_bind_ipi,
  15.240 +						&bind_ipi) != 0)
  15.241 +			BUG();
  15.242 +		evtchn = bind_ipi.port;
  15.243  
  15.244  		/* Record the new mapping. */
  15.245  		evtchn_to_irq[evtchn] = irq;
    16.1 --- a/linux-2.6-xen-sparse/drivers/xen/evtchn/evtchn.c	Fri Apr 28 16:44:00 2006 +0100
    16.2 +++ b/linux-2.6-xen-sparse/drivers/xen/evtchn/evtchn.c	Sun Apr 30 09:16:15 2006 +0100
    16.3 @@ -206,68 +206,71 @@ static int evtchn_ioctl(struct inode *in
    16.4  	int rc;
    16.5  	struct per_user_data *u = file->private_data;
    16.6  	void __user *uarg = (void __user *) arg;
    16.7 -	evtchn_op_t op = { 0 };
    16.8  
    16.9  	switch (cmd) {
   16.10  	case IOCTL_EVTCHN_BIND_VIRQ: {
   16.11  		struct ioctl_evtchn_bind_virq bind;
   16.12 +		struct evtchn_bind_virq bind_virq;
   16.13  
   16.14  		rc = -EFAULT;
   16.15  		if (copy_from_user(&bind, uarg, sizeof(bind)))
   16.16  			break;
   16.17  
   16.18 -		op.cmd = EVTCHNOP_bind_virq;
   16.19 -		op.u.bind_virq.virq = bind.virq;
   16.20 -		op.u.bind_virq.vcpu = 0;
   16.21 -		rc = HYPERVISOR_event_channel_op(&op);
   16.22 +		bind_virq.virq = bind.virq;
   16.23 +		bind_virq.vcpu = 0;
   16.24 +		rc = HYPERVISOR_event_channel_op(EVTCHNOP_bind_virq,
   16.25 +						 &bind_virq);
   16.26  		if (rc != 0)
   16.27  			break;
   16.28  
   16.29 -		rc = op.u.bind_virq.port;
   16.30 +		rc = bind_virq.port;
   16.31  		evtchn_bind_to_user(u, rc);
   16.32  		break;
   16.33  	}
   16.34  
   16.35  	case IOCTL_EVTCHN_BIND_INTERDOMAIN: {
   16.36  		struct ioctl_evtchn_bind_interdomain bind;
   16.37 +		struct evtchn_bind_interdomain bind_interdomain;
   16.38  
   16.39  		rc = -EFAULT;
   16.40  		if (copy_from_user(&bind, uarg, sizeof(bind)))
   16.41  			break;
   16.42  
   16.43 -		op.cmd = EVTCHNOP_bind_interdomain;
   16.44 -		op.u.bind_interdomain.remote_dom  = bind.remote_domain;
   16.45 -		op.u.bind_interdomain.remote_port = bind.remote_port;
   16.46 -		rc = HYPERVISOR_event_channel_op(&op);
   16.47 +		bind_interdomain.remote_dom  = bind.remote_domain;
   16.48 +		bind_interdomain.remote_port = bind.remote_port;
   16.49 +		rc = HYPERVISOR_event_channel_op(EVTCHNOP_bind_interdomain,
   16.50 +						 &bind_interdomain);
   16.51  		if (rc != 0)
   16.52  			break;
   16.53  
   16.54 -		rc = op.u.bind_interdomain.local_port;
   16.55 +		rc = bind_interdomain.local_port;
   16.56  		evtchn_bind_to_user(u, rc);
   16.57  		break;
   16.58  	}
   16.59  
   16.60  	case IOCTL_EVTCHN_BIND_UNBOUND_PORT: {
   16.61  		struct ioctl_evtchn_bind_unbound_port bind;
   16.62 +		struct evtchn_alloc_unbound alloc_unbound;
   16.63  
   16.64  		rc = -EFAULT;
   16.65  		if (copy_from_user(&bind, uarg, sizeof(bind)))
   16.66  			break;
   16.67  
   16.68 -		op.cmd = EVTCHNOP_alloc_unbound;
   16.69 -		op.u.alloc_unbound.dom        = DOMID_SELF;
   16.70 -		op.u.alloc_unbound.remote_dom = bind.remote_domain;
   16.71 -		rc = HYPERVISOR_event_channel_op(&op);
   16.72 +		alloc_unbound.dom        = DOMID_SELF;
   16.73 +		alloc_unbound.remote_dom = bind.remote_domain;
   16.74 +		rc = HYPERVISOR_event_channel_op(EVTCHNOP_alloc_unbound,
   16.75 +						 &alloc_unbound);
   16.76  		if (rc != 0)
   16.77  			break;
   16.78  
   16.79 -		rc = op.u.alloc_unbound.port;
   16.80 +		rc = alloc_unbound.port;
   16.81  		evtchn_bind_to_user(u, rc);
   16.82  		break;
   16.83  	}
   16.84  
   16.85  	case IOCTL_EVTCHN_UNBIND: {
   16.86  		struct ioctl_evtchn_unbind unbind;
   16.87 +		struct evtchn_close close;
   16.88  		int ret;
   16.89  
   16.90  		rc = -EFAULT;
   16.91 @@ -291,9 +294,8 @@ static int evtchn_ioctl(struct inode *in
   16.92  
   16.93  		spin_unlock_irq(&port_user_lock);
   16.94  
   16.95 -		op.cmd = EVTCHNOP_close;
   16.96 -		op.u.close.port = unbind.port;
   16.97 -		ret = HYPERVISOR_event_channel_op(&op);
   16.98 +		close.port = unbind.port;
   16.99 +		ret = HYPERVISOR_event_channel_op(EVTCHNOP_close, &close);
  16.100  		BUG_ON(ret);
  16.101  
  16.102  		rc = 0;
  16.103 @@ -379,7 +381,7 @@ static int evtchn_release(struct inode *
  16.104  {
  16.105  	int i;
  16.106  	struct per_user_data *u = filp->private_data;
  16.107 -	evtchn_op_t op = { 0 };
  16.108 +	struct evtchn_close close;
  16.109  
  16.110  	spin_lock_irq(&port_user_lock);
  16.111  
  16.112 @@ -393,9 +395,8 @@ static int evtchn_release(struct inode *
  16.113  		port_user[i] = NULL;
  16.114  		mask_evtchn(i);
  16.115  
  16.116 -		op.cmd = EVTCHNOP_close;
  16.117 -		op.u.close.port = i;
  16.118 -		ret = HYPERVISOR_event_channel_op(&op);
  16.119 +		close.port = i;
  16.120 +		ret = HYPERVISOR_event_channel_op(EVTCHNOP_close, &close);
  16.121  		BUG_ON(ret);
  16.122  	}
  16.123  
    17.1 --- a/linux-2.6-xen-sparse/drivers/xen/netback/interface.c	Fri Apr 28 16:44:00 2006 +0100
    17.2 +++ b/linux-2.6-xen-sparse/drivers/xen/netback/interface.c	Sun Apr 30 09:16:15 2006 +0100
    17.3 @@ -213,10 +213,7 @@ int netif_map(netif_t *netif, unsigned l
    17.4  	int err = -ENOMEM;
    17.5  	netif_tx_sring_t *txs;
    17.6  	netif_rx_sring_t *rxs;
    17.7 -	evtchn_op_t op = {
    17.8 -		.cmd = EVTCHNOP_bind_interdomain,
    17.9 -		.u.bind_interdomain.remote_dom = netif->domid,
   17.10 -		.u.bind_interdomain.remote_port = evtchn };
   17.11 +	struct evtchn_bind_interdomain bind_interdomain;
   17.12  
   17.13  	/* Already connected through? */
   17.14  	if (netif->irq)
   17.15 @@ -233,11 +230,15 @@ int netif_map(netif_t *netif, unsigned l
   17.16  	if (err)
   17.17  		goto err_map;
   17.18  
   17.19 -	err = HYPERVISOR_event_channel_op(&op);
   17.20 +	bind_interdomain.remote_dom = netif->domid;
   17.21 +	bind_interdomain.remote_port = evtchn;
   17.22 +
   17.23 +	err = HYPERVISOR_event_channel_op(EVTCHNOP_bind_interdomain,
   17.24 +					  &bind_interdomain);
   17.25  	if (err)
   17.26  		goto err_hypervisor;
   17.27  
   17.28 -	netif->evtchn = op.u.bind_interdomain.local_port;
   17.29 +	netif->evtchn = bind_interdomain.local_port;
   17.30  
   17.31  	netif->irq = bind_evtchn_to_irqhandler(
   17.32  		netif->evtchn, netif_be_int, 0, netif->dev->name, netif);
    18.1 --- a/linux-2.6-xen-sparse/drivers/xen/privcmd/privcmd.c	Fri Apr 28 16:44:00 2006 +0100
    18.2 +++ b/linux-2.6-xen-sparse/drivers/xen/privcmd/privcmd.c	Sun Apr 30 09:16:15 2006 +0100
    18.3 @@ -35,7 +35,7 @@
    18.4  static struct proc_dir_entry *privcmd_intf;
    18.5  static struct proc_dir_entry *capabilities_intf;
    18.6  
    18.7 -#define NR_HYPERCALLS 32
    18.8 +#define NR_HYPERCALLS 64
    18.9  static DECLARE_BITMAP(hypercall_permission_map, NR_HYPERCALLS);
   18.10  
   18.11  static int privcmd_ioctl(struct inode *inode, struct file *file,
    19.1 --- a/linux-2.6-xen-sparse/drivers/xen/tpmback/interface.c	Fri Apr 28 16:44:00 2006 +0100
    19.2 +++ b/linux-2.6-xen-sparse/drivers/xen/tpmback/interface.c	Sun Apr 30 09:16:15 2006 +0100
    19.3 @@ -112,11 +112,7 @@ static void unmap_frontend_page(tpmif_t 
    19.4  int tpmif_map(tpmif_t *tpmif, unsigned long shared_page, unsigned int evtchn)
    19.5  {
    19.6  	int err;
    19.7 -	evtchn_op_t op = {
    19.8 -		.cmd = EVTCHNOP_bind_interdomain,
    19.9 -		.u.bind_interdomain.remote_dom = tpmif->domid,
   19.10 -		.u.bind_interdomain.remote_port = evtchn,
   19.11 -	};
   19.12 +	struct evtchn_bind_interdomain bind_interdomain;
   19.13  
   19.14  	if (tpmif->irq) {
   19.15  		return 0;
   19.16 @@ -131,14 +127,19 @@ int tpmif_map(tpmif_t *tpmif, unsigned l
   19.17  		return err;
   19.18  	}
   19.19  
   19.20 -	err = HYPERVISOR_event_channel_op(&op);
   19.21 +
   19.22 +	bind_interdomain.remote_dom  = tpmif->domid;
   19.23 +	bind_interdomain.remote_port = evtchn;
   19.24 +
   19.25 +	err = HYPERVISOR_event_channel_op(EVTCHNOP_bind_interdomain,
   19.26 +					  &bind_interdomain);
   19.27  	if (err) {
   19.28  		unmap_frontend_page(tpmif);
   19.29  		free_vm_area(tpmif->tx_area);
   19.30  		return err;
   19.31  	}
   19.32  
   19.33 -	tpmif->evtchn = op.u.bind_interdomain.local_port;
   19.34 +	tpmif->evtchn = bind_interdomain.local_port;
   19.35  
   19.36  	tpmif->tx = (tpmif_tx_interface_t *)tpmif->tx_area->addr;
   19.37  
    20.1 --- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_client.c	Fri Apr 28 16:44:00 2006 +0100
    20.2 +++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_client.c	Sun Apr 30 09:16:15 2006 +0100
    20.3 @@ -214,16 +214,19 @@ EXPORT_SYMBOL_GPL(xenbus_grant_ring);
    20.4  
    20.5  int xenbus_alloc_evtchn(struct xenbus_device *dev, int *port)
    20.6  {
    20.7 -	evtchn_op_t op = {
    20.8 -		.cmd = EVTCHNOP_alloc_unbound,
    20.9 -		.u.alloc_unbound.dom = DOMID_SELF,
   20.10 -		.u.alloc_unbound.remote_dom = dev->otherend_id
   20.11 -	};
   20.12 -	int err = HYPERVISOR_event_channel_op(&op);
   20.13 +	struct evtchn_alloc_unbound alloc_unbound;
   20.14 +	int err;
   20.15 +
   20.16 +	alloc_unbound.dom        = DOMID_SELF;
   20.17 +	alloc_unbound.remote_dom = dev->otherend_id;
   20.18 +
   20.19 +	err = HYPERVISOR_event_channel_op(EVTCHNOP_alloc_unbound,
   20.20 +					  &alloc_unbound);
   20.21  	if (err)
   20.22  		xenbus_dev_fatal(dev, err, "allocating event channel");
   20.23  	else
   20.24 -		*port = op.u.alloc_unbound.port;
   20.25 +		*port = alloc_unbound.port;
   20.26 +
   20.27  	return err;
   20.28  }
   20.29  EXPORT_SYMBOL_GPL(xenbus_alloc_evtchn);
   20.30 @@ -231,18 +234,21 @@ EXPORT_SYMBOL_GPL(xenbus_alloc_evtchn);
   20.31  
   20.32  int xenbus_bind_evtchn(struct xenbus_device *dev, int remote_port, int *port)
   20.33  {
   20.34 -	evtchn_op_t op = {
   20.35 -		.cmd = EVTCHNOP_bind_interdomain,
   20.36 -		.u.bind_interdomain.remote_dom = dev->otherend_id,
   20.37 -		.u.bind_interdomain.remote_port = remote_port,
   20.38 -	};
   20.39 -	int err = HYPERVISOR_event_channel_op(&op);
   20.40 +	struct evtchn_bind_interdomain bind_interdomain;
   20.41 +	int err;
   20.42 +
   20.43 +	bind_interdomain.remote_dom  = dev->otherend_id;
   20.44 +	bind_interdomain.remote_port = remote_port,
   20.45 +
   20.46 +	err = HYPERVISOR_event_channel_op(EVTCHNOP_bind_interdomain,
   20.47 +					  &bind_interdomain);
   20.48  	if (err)
   20.49  		xenbus_dev_fatal(dev, err,
   20.50  				 "binding to event channel %d from domain %d",
   20.51  				 remote_port, dev->otherend_id);
   20.52  	else
   20.53 -		*port = op.u.bind_interdomain.local_port;
   20.54 +		*port = bind_interdomain.local_port;
   20.55 +
   20.56  	return err;
   20.57  }
   20.58  EXPORT_SYMBOL_GPL(xenbus_bind_evtchn);
   20.59 @@ -250,13 +256,15 @@ EXPORT_SYMBOL_GPL(xenbus_bind_evtchn);
   20.60  
   20.61  int xenbus_free_evtchn(struct xenbus_device *dev, int port)
   20.62  {
   20.63 -	evtchn_op_t op = {
   20.64 -		.cmd = EVTCHNOP_close,
   20.65 -		.u.close.port = port,
   20.66 -	};
   20.67 -	int err = HYPERVISOR_event_channel_op(&op);
   20.68 +	struct evtchn_close close;
   20.69 +	int err;
   20.70 +
   20.71 +	close.port = port;
   20.72 +
   20.73 +	err = HYPERVISOR_event_channel_op(EVTCHNOP_close, &close);
   20.74  	if (err)
   20.75  		xenbus_dev_error(dev, err, "freeing event channel %d", port);
   20.76 +
   20.77  	return err;
   20.78  }
   20.79  
    21.1 --- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c	Fri Apr 28 16:44:00 2006 +0100
    21.2 +++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c	Sun Apr 30 09:16:15 2006 +0100
    21.3 @@ -981,7 +981,7 @@ static int __init xenbus_probe_init(void
    21.4  	dom0 = (xen_start_info->store_evtchn == 0);
    21.5  
    21.6  	if (dom0) {
    21.7 -		evtchn_op_t op = { 0 };
    21.8 +		struct evtchn_alloc_unbound alloc_unbound;
    21.9  
   21.10  		/* Allocate page. */
   21.11  		page = get_zeroed_page(GFP_KERNEL);
   21.12 @@ -993,15 +993,15 @@ static int __init xenbus_probe_init(void
   21.13  				   PAGE_SHIFT);
   21.14  
   21.15  		/* Next allocate a local port which xenstored can bind to */
   21.16 -		op.cmd = EVTCHNOP_alloc_unbound;
   21.17 -		op.u.alloc_unbound.dom        = DOMID_SELF;
   21.18 -		op.u.alloc_unbound.remote_dom = 0;
   21.19 +		alloc_unbound.dom        = DOMID_SELF;
   21.20 +		alloc_unbound.remote_dom = 0;
   21.21  
   21.22 -		err = HYPERVISOR_event_channel_op(&op);
   21.23 +		err = HYPERVISOR_event_channel_op(EVTCHNOP_alloc_unbound,
   21.24 +						  &alloc_unbound);
   21.25  		if (err == -ENOSYS)
   21.26  			goto err;
   21.27  		BUG_ON(err);
   21.28 -		xen_start_info->store_evtchn = op.u.alloc_unbound.port;
   21.29 +		xen_start_info->store_evtchn = alloc_unbound.port;
   21.30  
   21.31  		/* And finally publish the above info in /proc/xen */
   21.32  		xsd_kva_intf = create_xen_proc_entry("xsd_kva", 0600);
    22.1 --- a/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/hypercall.h	Fri Apr 28 16:44:00 2006 +0100
    22.2 +++ b/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/hypercall.h	Sun Apr 30 09:16:15 2006 +0100
    22.3 @@ -245,9 +245,16 @@ HYPERVISOR_update_va_mapping(
    22.4  
    22.5  static inline int
    22.6  HYPERVISOR_event_channel_op(
    22.7 -	void *op)
    22.8 +	int cmd, void *arg)
    22.9  {
   22.10 -	return _hypercall1(int, event_channel_op, op);
   22.11 +	int rc = _hypercall2(int, event_channel_op, cmd, arg);
   22.12 +	if (unlikely(rc == -ENOSYS)) {
   22.13 +		struct evtchn_op op;
   22.14 +		op.cmd = cmd;
   22.15 +		memcpy(&op.u, arg, sizeof(op.u));
   22.16 +		rc = _hypercall1(int, event_channel_op_compat, &op);
   22.17 +	}
   22.18 +	return rc;
   22.19  }
   22.20  
   22.21  static inline int
   22.22 @@ -266,9 +273,16 @@ HYPERVISOR_console_io(
   22.23  
   22.24  static inline int
   22.25  HYPERVISOR_physdev_op(
   22.26 -	void *physdev_op)
   22.27 +	int cmd, void *arg)
   22.28  {
   22.29 -	return _hypercall1(int, physdev_op, physdev_op);
   22.30 +	int rc = _hypercall2(int, physdev_op, cmd, arg);
   22.31 +	if (unlikely(rc == -ENOSYS)) {
   22.32 +		struct physdev_op op;
   22.33 +		op.cmd = cmd;
   22.34 +		memcpy(&op.u, arg, sizeof(op.u));
   22.35 +		rc = _hypercall1(int, physdev_op_compat, &op);
   22.36 +	}
   22.37 +	return rc;
   22.38  }
   22.39  
   22.40  static inline int
    23.1 --- a/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/hypervisor.h	Fri Apr 28 16:44:00 2006 +0100
    23.2 +++ b/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/hypervisor.h	Sun Apr 30 09:16:15 2006 +0100
    23.3 @@ -40,6 +40,8 @@
    23.4  #include <linux/errno.h>
    23.5  #include <xen/interface/xen.h>
    23.6  #include <xen/interface/dom0_ops.h>
    23.7 +#include <xen/interface/event_channel.h>
    23.8 +#include <xen/interface/physdev.h>
    23.9  #include <xen/interface/sched.h>
   23.10  #include <xen/interface/nmi.h>
   23.11  #include <asm/ptrace.h>
    24.1 --- a/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/processor.h	Fri Apr 28 16:44:00 2006 +0100
    24.2 +++ b/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/processor.h	Sun Apr 30 09:16:15 2006 +0100
    24.3 @@ -534,12 +534,11 @@ static inline void __load_esp0(struct ts
    24.4   */
    24.5  static inline void set_iopl_mask(unsigned mask)
    24.6  {
    24.7 -	physdev_op_t op;
    24.8 +	struct physdev_set_iopl set_iopl;
    24.9  
   24.10  	/* Force the change at ring 0. */
   24.11 -	op.cmd = PHYSDEVOP_SET_IOPL;
   24.12 -	op.u.set_iopl.iopl = (mask == 0) ? 1 : (mask >> 12) & 3;
   24.13 -	HYPERVISOR_physdev_op(&op);
   24.14 +	set_iopl.iopl = (mask == 0) ? 1 : (mask >> 12) & 3;
   24.15 +	HYPERVISOR_physdev_op(PHYSDEVOP_set_iopl, &set_iopl);
   24.16  }
   24.17  
   24.18  /* Forward declaration, a strange C thing */
    25.1 --- a/linux-2.6-xen-sparse/include/asm-ia64/hypercall.h	Fri Apr 28 16:44:00 2006 +0100
    25.2 +++ b/linux-2.6-xen-sparse/include/asm-ia64/hypercall.h	Sun Apr 30 09:16:15 2006 +0100
    25.3 @@ -202,9 +202,16 @@ HYPERVISOR_memory_op(
    25.4  
    25.5  static inline int
    25.6  HYPERVISOR_event_channel_op(
    25.7 -    void *op)
    25.8 +    int cmd, void *arg)
    25.9  {
   25.10 -    return _hypercall1(int, event_channel_op, op);
   25.11 +    int rc = _hypercall2(int, event_channel_op, cmd, arg);
   25.12 +    if (unlikely(rc == -ENOSYS)) {
   25.13 +        struct evtchn_op op;
   25.14 +        op.cmd = cmd;
   25.15 +        memcpy(&op.u, arg, sizeof(op.u));
   25.16 +        rc = _hypercall1(int, event_channel_op_compat, &op);
   25.17 +    }
   25.18 +    return rc;
   25.19  }
   25.20  
   25.21  static inline int
   25.22 @@ -223,9 +230,16 @@ HYPERVISOR_console_io(
   25.23  
   25.24  static inline int
   25.25  HYPERVISOR_physdev_op(
   25.26 -    void *physdev_op)
   25.27 +    int cmd, void *arg)
   25.28  {
   25.29 -    return _hypercall1(int, physdev_op, physdev_op);
   25.30 +    int rc = _hypercall2(int, physdev_op, cmd, arg);
   25.31 +    if (unlikely(rc == -ENOSYS)) {
   25.32 +        struct physdev_op op;
   25.33 +        op.cmd = cmd;
   25.34 +        memcpy(&op.u, arg, sizeof(op.u));
   25.35 +        rc = _hypercall1(int, physdev_op_compat, &op);
   25.36 +    }
   25.37 +    return rc;
   25.38  }
   25.39  
   25.40  static inline int
    26.1 --- a/linux-2.6-xen-sparse/include/asm-ia64/hypervisor.h	Fri Apr 28 16:44:00 2006 +0100
    26.2 +++ b/linux-2.6-xen-sparse/include/asm-ia64/hypervisor.h	Sun Apr 30 09:16:15 2006 +0100
    26.3 @@ -40,6 +40,8 @@
    26.4  #include <linux/errno.h>
    26.5  #include <xen/interface/xen.h>
    26.6  #include <xen/interface/dom0_ops.h>
    26.7 +#include <xen/interface/event_channel.h>
    26.8 +#include <xen/interface/physdev.h>
    26.9  #include <xen/interface/sched.h>
   26.10  #include <asm/hypercall.h>
   26.11  #include <asm/ptrace.h>
    27.1 --- a/linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/hypercall.h	Fri Apr 28 16:44:00 2006 +0100
    27.2 +++ b/linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/hypercall.h	Sun Apr 30 09:16:15 2006 +0100
    27.3 @@ -243,9 +243,16 @@ HYPERVISOR_update_va_mapping(
    27.4  
    27.5  static inline int
    27.6  HYPERVISOR_event_channel_op(
    27.7 -	void *op)
    27.8 +	int cmd, void *arg)
    27.9  {
   27.10 -	return _hypercall1(int, event_channel_op, op);
   27.11 +	int rc = _hypercall2(int, event_channel_op, cmd, arg);
   27.12 +	if (unlikely(rc == -ENOSYS)) {
   27.13 +		struct evtchn_op op;
   27.14 +		op.cmd = cmd;
   27.15 +		memcpy(&op.u, arg, sizeof(op.u));
   27.16 +		rc = _hypercall1(int, event_channel_op_compat, &op);
   27.17 +	}
   27.18 +	return rc;
   27.19  }
   27.20  
   27.21  static inline int
   27.22 @@ -264,9 +271,16 @@ HYPERVISOR_console_io(
   27.23  
   27.24  static inline int
   27.25  HYPERVISOR_physdev_op(
   27.26 -	void *physdev_op)
   27.27 +	int cmd, void *arg)
   27.28  {
   27.29 -	return _hypercall1(int, physdev_op, physdev_op);
   27.30 +	int rc = _hypercall2(int, physdev_op, cmd, arg);
   27.31 +	if (unlikely(rc == -ENOSYS)) {
   27.32 +		struct physdev_op op;
   27.33 +		op.cmd = cmd;
   27.34 +		memcpy(&op.u, arg, sizeof(op.u));
   27.35 +		rc = _hypercall1(int, physdev_op_compat, &op);
   27.36 +	}
   27.37 +	return rc;
   27.38  }
   27.39  
   27.40  static inline int
    28.1 --- a/linux-2.6-xen-sparse/include/xen/evtchn.h	Fri Apr 28 16:44:00 2006 +0100
    28.2 +++ b/linux-2.6-xen-sparse/include/xen/evtchn.h	Sun Apr 30 09:16:15 2006 +0100
    28.3 @@ -101,10 +101,8 @@ static inline void clear_evtchn(int port
    28.4  
    28.5  static inline void notify_remote_via_evtchn(int port)
    28.6  {
    28.7 -	evtchn_op_t op;
    28.8 -	op.cmd         = EVTCHNOP_send,
    28.9 -	op.u.send.port = port;
   28.10 -	(void)HYPERVISOR_event_channel_op(&op);
   28.11 +	struct evtchn_send send = { .port = port };
   28.12 +	(void)HYPERVISOR_event_channel_op(EVTCHNOP_send, &send);
   28.13  }
   28.14  
   28.15  /*
    29.1 --- a/tools/libxc/xc_evtchn.c	Fri Apr 28 16:44:00 2006 +0100
    29.2 +++ b/tools/libxc/xc_evtchn.c	Sun Apr 30 09:16:15 2006 +0100
    29.3 @@ -9,24 +9,25 @@
    29.4  #include "xc_private.h"
    29.5  
    29.6  
    29.7 -static int do_evtchn_op(int xc_handle, evtchn_op_t *op)
    29.8 +static int do_evtchn_op(int xc_handle, int cmd, void *arg, size_t arg_size)
    29.9  {
   29.10      int ret = -1;
   29.11      DECLARE_HYPERCALL;
   29.12  
   29.13      hypercall.op     = __HYPERVISOR_event_channel_op;
   29.14 -    hypercall.arg[0] = (unsigned long)op;
   29.15 +    hypercall.arg[0] = cmd;
   29.16 +    hypercall.arg[1] = (unsigned long)arg;
   29.17  
   29.18 -    if ( mlock(op, sizeof(*op)) != 0 )
   29.19 +    if ( mlock(arg, arg_size) != 0 )
   29.20      {
   29.21 -        PERROR("do_evtchn_op: op mlock failed");
   29.22 +        PERROR("do_evtchn_op: arg mlock failed");
   29.23          goto out;
   29.24      }
   29.25  
   29.26      if ((ret = do_xen_hypercall(xc_handle, &hypercall)) < 0)
   29.27          ERROR("do_evtchn_op: HYPERVISOR_event_channel_op failed: %d", ret);
   29.28  
   29.29 -    safe_munlock(op, sizeof(*op));
   29.30 +    safe_munlock(arg, arg_size);
   29.31   out:
   29.32      return ret;
   29.33  }
   29.34 @@ -37,13 +38,14 @@ int xc_evtchn_alloc_unbound(int xc_handl
   29.35                              uint32_t remote_dom)
   29.36  {
   29.37      int         rc;
   29.38 -    evtchn_op_t op = {
   29.39 -        .cmd = EVTCHNOP_alloc_unbound,
   29.40 -        .u.alloc_unbound.dom = (domid_t)dom,
   29.41 -        .u.alloc_unbound.remote_dom = (domid_t)remote_dom };
   29.42 +    struct evtchn_alloc_unbound arg = {
   29.43 +        .dom = (domid_t)dom,
   29.44 +        .remote_dom = (domid_t)remote_dom
   29.45 +    };
   29.46  
   29.47 -    if ( (rc = do_evtchn_op(xc_handle, &op)) == 0 )
   29.48 -        rc = op.u.alloc_unbound.port;
   29.49 +    rc = do_evtchn_op(xc_handle, EVTCHNOP_alloc_unbound, &arg, sizeof(arg));
   29.50 +    if ( rc == 0 )
   29.51 +        rc = arg.port;
   29.52  
   29.53      return rc;
   29.54  }
   29.55 @@ -54,14 +56,7 @@ int xc_evtchn_status(int xc_handle,
   29.56                       evtchn_port_t port,
   29.57                       xc_evtchn_status_t *status)
   29.58  {
   29.59 -    int         rc;
   29.60 -    evtchn_op_t op = {
   29.61 -        .cmd           = EVTCHNOP_status,
   29.62 -        .u.status.dom  = (domid_t)dom,
   29.63 -        .u.status.port = port };
   29.64 -
   29.65 -    if ( (rc = do_evtchn_op(xc_handle, &op)) == 0 )
   29.66 -        memcpy(status, &op.u.status, sizeof(*status));
   29.67 -
   29.68 -    return rc;
   29.69 +    status->dom  = (domid_t)dom;
   29.70 +    status->port = port;
   29.71 +    return do_evtchn_op(xc_handle, EVTCHNOP_status, status, sizeof(*status));
   29.72  }
    30.1 --- a/xen/arch/ia64/vmx/vmx_hypercall.c	Fri Apr 28 16:44:00 2006 +0100
    30.2 +++ b/xen/arch/ia64/vmx/vmx_hypercall.c	Sun Apr 30 09:16:15 2006 +0100
    30.3 @@ -106,12 +106,12 @@ void hyper_dom0_op(void)
    30.4      vmx_vcpu_increment_iip(vcpu);
    30.5  }
    30.6  
    30.7 -void hyper_event_channel_op(void)
    30.8 +void hyper_event_channel_op_compat(void)
    30.9  {
   30.10      VCPU *vcpu=current;
   30.11      u64 r32,ret;
   30.12      vcpu_get_gr_nat(vcpu,16,&r32);
   30.13 -    ret=do_event_channel_op(guest_handle_from_ptr(r32, evtchn_op_t));
   30.14 +    ret=do_event_channel_op_compat(guest_handle_from_ptr(r32, evtchn_op_t));
   30.15      vcpu_set_gr(vcpu, 8, ret, 0);
   30.16      vmx_vcpu_increment_iip(vcpu);
   30.17  }
    31.1 --- a/xen/arch/ia64/vmx/vmx_ivt.S	Fri Apr 28 16:44:00 2006 +0100
    31.2 +++ b/xen/arch/ia64/vmx/vmx_ivt.S	Sun Apr 30 09:16:15 2006 +0100
    31.3 @@ -1154,7 +1154,7 @@ hyper_call_table:
    31.4      data8 hyper_not_support     //hyper_multicall
    31.5      data8 hyper_not_support     //hyper_update_va_mapping
    31.6      data8 hyper_not_support     //hyper_set_timer_op       /* 15 */
    31.7 -    data8 hyper_event_channel_op
    31.8 +    data8 hyper_event_channel_op_compat
    31.9      data8 hyper_xen_version
   31.10      data8 hyper_not_support     //hyper_console_io
   31.11      data8 hyper_not_support     //hyper_physdev_op
    32.1 --- a/xen/arch/ia64/xen/hypercall.c	Fri Apr 28 16:44:00 2006 +0100
    32.2 +++ b/xen/arch/ia64/xen/hypercall.c	Sun Apr 30 09:16:15 2006 +0100
    32.3 @@ -27,6 +27,7 @@
    32.4  #include <xen/domain.h>
    32.5  
    32.6  extern unsigned long translate_domain_mpaddr(unsigned long);
    32.7 +static long do_physdev_op_compat(int cmd, XEN_GUEST_HANDLE(void) arg);
    32.8  static long do_physdev_op(XEN_GUEST_HANDLE(physdev_op_t) uop);
    32.9  /* FIXME: where these declarations should be there ? */
   32.10  extern int dump_privop_counts_to_user(char *, int);
   32.11 @@ -53,10 +54,10 @@ hypercall_t ia64_hypercall_table[] =
   32.12  	(hypercall_t)do_multicall,
   32.13  	(hypercall_t)do_ni_hypercall,		/* do_update_va_mapping */
   32.14  	(hypercall_t)do_ni_hypercall,		/* do_set_timer_op */		/* 15 */
   32.15 -	(hypercall_t)do_event_channel_op,
   32.16 +	(hypercall_t)do_event_channel_op_compat,
   32.17  	(hypercall_t)do_xen_version,
   32.18  	(hypercall_t)do_console_io,
   32.19 -	(hypercall_t)do_physdev_op,
   32.20 +	(hypercall_t)do_physdev_op_compat,
   32.21  	(hypercall_t)do_grant_table_op,						/* 20 */
   32.22  	(hypercall_t)do_ni_hypercall,		/* do_vm_assist */
   32.23  	(hypercall_t)do_ni_hypercall,		/* do_update_va_mapping_otherdomain */
   32.24 @@ -68,7 +69,9 @@ hypercall_t ia64_hypercall_table[] =
   32.25  	(hypercall_t)do_ni_hypercall,		/* do_nmi_op */
   32.26  	(hypercall_t)do_sched_op,
   32.27  	(hypercall_t)do_ni_hypercall,		/*  */				/* 30 */
   32.28 -	(hypercall_t)do_ni_hypercall		/*  */
   32.29 +	(hypercall_t)do_ni_hypercall,		/*  */
   32.30 +	(hypercall_t)do_event_channel_op,
   32.31 +	(hypercall_t)do_physdev_op
   32.32  	};
   32.33  
   32.34  uint32_t nr_hypercalls =
   32.35 @@ -330,71 +333,117 @@ extern int
   32.36  iosapic_guest_write(
   32.37      unsigned long physbase, unsigned int reg, u32 pval);
   32.38  
   32.39 -static long do_physdev_op(XEN_GUEST_HANDLE(physdev_op_t) uop)
   32.40 +static long do_physdev_op(int cmd, XEN_GUEST_HANDLE(void) arg)
   32.41  {
   32.42 -    struct physdev_op op;
   32.43 +    int irq;
   32.44      long ret;
   32.45 -    int  irq;
   32.46  
   32.47 -    if ( unlikely(copy_from_guest(&op, uop, 1) != 0) )
   32.48 -        return -EFAULT;
   32.49 +    switch ( cmd )
   32.50 +    {
   32.51 +    case PHYSDEVOP_eoi: {
   32.52 +        struct physdev_eoi eoi;
   32.53 +        ret = -EFAULT;
   32.54 +        if ( copy_from_guest(&eoi, arg, 1) != 0 )
   32.55 +            break;
   32.56 +        ret = pirq_guest_eoi(current->domain, eoi.irq);
   32.57 +        break;
   32.58 +    }
   32.59  
   32.60 -    switch ( op.cmd )
   32.61 -    {
   32.62 -    case PHYSDEVOP_IRQ_UNMASK_NOTIFY:
   32.63 +    /* Legacy since 0x00030202. */
   32.64 +    case PHYSDEVOP_IRQ_UNMASK_NOTIFY: {
   32.65          ret = pirq_guest_unmask(current->domain);
   32.66          break;
   32.67 +    }
   32.68  
   32.69 -    case PHYSDEVOP_IRQ_STATUS_QUERY:
   32.70 -        irq = op.u.irq_status_query.irq;
   32.71 +    case PHYSDEVOP_irq_status_query: {
   32.72 +        struct physdev_irq_status_query irq_status_query;
   32.73 +        ret = -EFAULT;
   32.74 +        if ( copy_from_guest(&irq_status_query, arg, 1) != 0 )
   32.75 +            break;
   32.76 +        irq = irq_status_query.irq;
   32.77          ret = -EINVAL;
   32.78          if ( (irq < 0) || (irq >= NR_IRQS) )
   32.79              break;
   32.80 -        op.u.irq_status_query.flags = 0;
   32.81 +        irq_status_query.flags = 0;
   32.82          /* Edge-triggered interrupts don't need an explicit unmask downcall. */
   32.83          if ( !strstr(irq_desc[irq_to_vector(irq)].handler->typename, "edge") )
   32.84 -            op.u.irq_status_query.flags |= PHYSDEVOP_IRQ_NEEDS_UNMASK_NOTIFY;
   32.85 -        ret = 0;
   32.86 +            irq_status_query.flags |= XENIRQSTAT_needs_eoi;
   32.87 +        ret = copy_to_guest(arg, &irq_status_query, 1) ? -EFAULT : 0;
   32.88          break;
   32.89 +    }
   32.90  
   32.91 -    case PHYSDEVOP_APIC_READ:
   32.92 +    case PHYSDEVOP_apic_read: {
   32.93 +        struct physdev_apic apic;
   32.94 +        ret = -EFAULT;
   32.95 +        if ( copy_from_guest(&apic, arg, 1) != 0 )
   32.96 +            break;
   32.97          ret = -EPERM;
   32.98          if ( !IS_PRIV(current->domain) )
   32.99              break;
  32.100 -        ret = iosapic_guest_read(
  32.101 -            op.u.apic_op.apic_physbase,
  32.102 -            op.u.apic_op.reg,
  32.103 -            &op.u.apic_op.value);
  32.104 +        ret = iosapic_guest_read(apic.apic_physbase, apic.reg, &apic.value);
  32.105 +        if ( copy_to_guest(arg, &apic, 1) != 0 )
  32.106 +            ret = -EFAULT;
  32.107          break;
  32.108 +    }
  32.109  
  32.110 -    case PHYSDEVOP_APIC_WRITE:
  32.111 +    case PHYSDEVOP_apic_write: {
  32.112 +        struct physdev_apic apic;
  32.113 +        ret = -EFAULT;
  32.114 +        if ( copy_from_guest(&apic, arg, 1) != 0 )
  32.115 +            break;
  32.116          ret = -EPERM;
  32.117          if ( !IS_PRIV(current->domain) )
  32.118              break;
  32.119 -        ret = iosapic_guest_write(
  32.120 -            op.u.apic_op.apic_physbase,
  32.121 -            op.u.apic_op.reg,
  32.122 -            op.u.apic_op.value);
  32.123 +        ret = iosapic_guest_write(apic.apic_physbase, apic.reg, apic.value);
  32.124          break;
  32.125 +    }
  32.126  
  32.127 -    case PHYSDEVOP_ASSIGN_VECTOR:
  32.128 +    case PHYSDEVOP_alloc_irq_vector: {
  32.129 +        struct physdev_irq irq_op;
  32.130 +
  32.131 +        ret = -EFAULT;
  32.132 +        if ( copy_from_guest(&irq_op, arg, 1) != 0 )
  32.133 +            break;
  32.134 +
  32.135 +        ret = -EPERM;
  32.136          if ( !IS_PRIV(current->domain) )
  32.137 -            return -EPERM;
  32.138 +            break;
  32.139  
  32.140 -        if ( (irq = op.u.irq_op.irq) >= NR_IRQS )
  32.141 -            return -EINVAL;
  32.142 +        ret = -EINVAL;
  32.143 +        if ( (irq = irq_op.irq) >= NR_IRQS )
  32.144 +            break;
  32.145          
  32.146 -        op.u.irq_op.vector = assign_irq_vector(irq);
  32.147 -        ret = 0;
  32.148 +        irq_op.vector = assign_irq_vector(irq);
  32.149 +        ret = copy_to_guest(arg, &irq_op, 1) ? -EFAULT : 0;
  32.150          break;
  32.151 +    }
  32.152  
  32.153      default:
  32.154          ret = -EINVAL;
  32.155          break;
  32.156      }
  32.157  
  32.158 -    if ( copy_to_guest(uop, &op, 1) )
  32.159 -        ret = -EFAULT;
  32.160 -
  32.161      return ret;
  32.162  }
  32.163 +
  32.164 +/* Legacy hypercall (as of 0x00030202). */
  32.165 +static long do_physdev_op_compat(XEN_GUEST_HANDLE(physdev_op_t) uop)
  32.166 +{
  32.167 +    struct physdev_op op;
  32.168 +
  32.169 +    if ( unlikely(copy_from_guest(&op, uop, 1) != 0) )
  32.170 +        return -EFAULT;
  32.171 +
  32.172 +    return do_physdev_op(op.cmd, guest_handle_from_ptr(&uop.p->u, void));
  32.173 +}
  32.174 +
  32.175 +/* Legacy hypercall (as of 0x00030202). */
  32.176 +long do_event_channel_op_compat(XEN_GUEST_HANDLE(evtchn_op_t) uop)
  32.177 +{
  32.178 +    struct evtchn_op op;
  32.179 +
  32.180 +    if ( unlikely(copy_from_guest(&op, uop, 1) != 0) )
  32.181 +        return -EFAULT;
  32.182 +
  32.183 +    return do_event_channel_op(op.cmd, guest_handle_from_ptr(&uop.p->u, void));
  32.184 +}
    33.1 --- a/xen/arch/ia64/xen/irq.c	Fri Apr 28 16:44:00 2006 +0100
    33.2 +++ b/xen/arch/ia64/xen/irq.c	Sun Apr 30 09:16:15 2006 +0100
    33.3 @@ -411,22 +411,40 @@ void __do_IRQ_guest(int irq)
    33.4      }
    33.5  }
    33.6  
    33.7 +int pirq_guest_eoi(struct domain *d, int irq)
    33.8 +{
    33.9 +    irq_desc_t *desc;
   33.10 +
   33.11 +    if ( (irq < 0) || (irq >= NR_IRQS) )
   33.12 +        return -EINVAL;
   33.13 +
   33.14 +    desc = &irq_desc[irq];
   33.15 +    spin_lock_irq(&desc->lock);
   33.16 +    if ( test_and_clear_bit(irq, &d->pirq_mask) &&
   33.17 +         (--((irq_guest_action_t *)desc->action)->in_flight == 0) )
   33.18 +        desc->handler->end(irq);
   33.19 +    spin_unlock_irq(&desc->lock);
   33.20 +
   33.21 +    return 0;
   33.22 +
   33.23 +}
   33.24 +
   33.25  int pirq_guest_unmask(struct domain *d)
   33.26  {
   33.27      irq_desc_t    *desc;
   33.28 -    int            pirq;
   33.29 +    int            irq;
   33.30      shared_info_t *s = d->shared_info;
   33.31  
   33.32 -    for ( pirq = find_first_bit(d->pirq_mask, NR_PIRQS);
   33.33 -          pirq < NR_PIRQS;
   33.34 -          pirq = find_next_bit(d->pirq_mask, NR_PIRQS, pirq+1) )
   33.35 +    for ( irq = find_first_bit(d->pirq_mask, NR_PIRQS);
   33.36 +          irq < NR_PIRQS;
   33.37 +          irq = find_next_bit(d->pirq_mask, NR_PIRQS, irq+1) )
   33.38      {
   33.39 -        desc = &irq_desc[pirq];
   33.40 +        desc = &irq_desc[irq];
   33.41          spin_lock_irq(&desc->lock);
   33.42 -        if ( !test_bit(d->pirq_to_evtchn[pirq], &s->evtchn_mask[0]) &&
   33.43 -             test_and_clear_bit(pirq, &d->pirq_mask) &&
   33.44 +        if ( !test_bit(d->pirq_to_evtchn[irq], &s->evtchn_mask[0]) &&
   33.45 +             test_and_clear_bit(irq, &d->pirq_mask) &&
   33.46               (--((irq_guest_action_t *)desc->action)->in_flight == 0) )
   33.47 -            desc->handler->end(pirq);
   33.48 +            desc->handler->end(irq);
   33.49          spin_unlock_irq(&desc->lock);
   33.50      }
   33.51  
    34.1 --- a/xen/arch/x86/Makefile	Fri Apr 28 16:44:00 2006 +0100
    34.2 +++ b/xen/arch/x86/Makefile	Sun Apr 30 09:16:15 2006 +0100
    34.3 @@ -10,6 +10,7 @@ subdir-$(x86_64) += x86_64
    34.4  obj-y += apic.o
    34.5  obj-y += audit.o
    34.6  obj-y += bitops.o
    34.7 +obj-y += compat.o
    34.8  obj-y += delay.o
    34.9  obj-y += dmi_scan.o
   34.10  obj-y += dom0_ops.o
    35.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    35.2 +++ b/xen/arch/x86/compat.c	Sun Apr 30 09:16:15 2006 +0100
    35.3 @@ -0,0 +1,32 @@
    35.4 +/******************************************************************************
    35.5 + * compat.c
    35.6 + * 
    35.7 + * Implementations of legacy hypercalls. These call through to the new
    35.8 + * hypercall after doing necessary argument munging.
    35.9 + */
   35.10 +
   35.11 +#include <xen/config.h>
   35.12 +#include <xen/guest_access.h>
   35.13 +#include <xen/hypercall.h>
   35.14 +
   35.15 +/* Legacy hypercall (as of 0x00030202). */
   35.16 +long do_physdev_op_compat(XEN_GUEST_HANDLE(physdev_op_t) uop)
   35.17 +{
   35.18 +    struct physdev_op op;
   35.19 +
   35.20 +    if ( unlikely(copy_from_guest(&op, uop, 1) != 0) )
   35.21 +        return -EFAULT;
   35.22 +
   35.23 +    return do_physdev_op(op.cmd, (XEN_GUEST_HANDLE(void)) { &uop.p->u });
   35.24 +}
   35.25 +
   35.26 +/* Legacy hypercall (as of 0x00030202). */
   35.27 +long do_event_channel_op_compat(XEN_GUEST_HANDLE(evtchn_op_t) uop)
   35.28 +{
   35.29 +    struct evtchn_op op;
   35.30 +
   35.31 +    if ( unlikely(copy_from_guest(&op, uop, 1) != 0) )
   35.32 +        return -EFAULT;
   35.33 +
   35.34 +    return do_event_channel_op(op.cmd, (XEN_GUEST_HANDLE(void)) {&uop.p->u });
   35.35 +}
    36.1 --- a/xen/arch/x86/irq.c	Fri Apr 28 16:44:00 2006 +0100
    36.2 +++ b/xen/arch/x86/irq.c	Sun Apr 30 09:16:15 2006 +0100
    36.3 @@ -293,52 +293,75 @@ static void flush_all_pending_eoi(void *
    36.4      flush_ready_eoi(NULL);
    36.5  }
    36.6  
    36.7 -int pirq_guest_unmask(struct domain *d)
    36.8 +static void __pirq_guest_eoi(struct domain *d, int irq)
    36.9  {
   36.10      irq_desc_t         *desc;
   36.11      irq_guest_action_t *action;
   36.12 -    cpumask_t           cpu_eoi_map = CPU_MASK_NONE;
   36.13 -    unsigned int        pirq, cpu = smp_processor_id();
   36.14 -    shared_info_t      *s = d->shared_info;
   36.15 -
   36.16 -    for ( pirq = find_first_bit(d->pirq_mask, NR_PIRQS);
   36.17 -          pirq < NR_PIRQS;
   36.18 -          pirq = find_next_bit(d->pirq_mask, NR_PIRQS, pirq+1) )
   36.19 -    {
   36.20 -        desc   = &irq_desc[irq_to_vector(pirq)];
   36.21 -        action = (irq_guest_action_t *)desc->action;
   36.22 -
   36.23 -        spin_lock_irq(&desc->lock);
   36.24 +    cpumask_t           cpu_eoi_map;
   36.25  
   36.26 -        if ( !test_bit(d->pirq_to_evtchn[pirq], s->evtchn_mask) &&
   36.27 -             test_and_clear_bit(pirq, d->pirq_mask) )
   36.28 -        {
   36.29 -            ASSERT(action->ack_type != ACKTYPE_NONE);
   36.30 -            if ( --action->in_flight == 0 )
   36.31 -            {
   36.32 -                if ( action->ack_type == ACKTYPE_UNMASK )
   36.33 -                    desc->handler->end(irq_to_vector(pirq));
   36.34 -                cpu_eoi_map = action->cpu_eoi_map;
   36.35 -            }
   36.36 -        }
   36.37 +    desc   = &irq_desc[irq_to_vector(irq)];
   36.38 +    action = (irq_guest_action_t *)desc->action;
   36.39  
   36.40 -        if ( cpu_test_and_clear(cpu, cpu_eoi_map) )
   36.41 -        {
   36.42 -            __set_eoi_ready(desc);
   36.43 -            spin_unlock(&desc->lock);
   36.44 -            flush_ready_eoi(NULL);
   36.45 -            local_irq_enable();
   36.46 -        }
   36.47 -        else
   36.48 -        {
   36.49 -            spin_unlock_irq(&desc->lock);
   36.50 -        }
   36.51 +    spin_lock_irq(&desc->lock);
   36.52  
   36.53 -        if ( !cpus_empty(cpu_eoi_map) )
   36.54 -        {
   36.55 -            on_selected_cpus(cpu_eoi_map, set_eoi_ready, desc, 1, 0);
   36.56 -            cpu_eoi_map = CPU_MASK_NONE;
   36.57 -        }
   36.58 +    ASSERT(!test_bit(irq, d->pirq_mask) ||
   36.59 +           (action->ack_type != ACKTYPE_NONE));
   36.60 +
   36.61 +    if ( unlikely(!test_and_clear_bit(irq, d->pirq_mask)) ||
   36.62 +         unlikely(--action->in_flight != 0) )
   36.63 +    {
   36.64 +        spin_unlock_irq(&desc->lock);
   36.65 +        return;
   36.66 +    }
   36.67 +
   36.68 +    if ( action->ack_type == ACKTYPE_UNMASK )
   36.69 +    {
   36.70 +        ASSERT(cpus_empty(action->cpu_eoi_map));
   36.71 +        desc->handler->end(irq_to_vector(irq));
   36.72 +        return;
   36.73 +    }
   36.74 +
   36.75 +    ASSERT(action->ack_type == ACKTYPE_EOI);
   36.76 +        
   36.77 +    cpu_eoi_map = action->cpu_eoi_map;
   36.78 +
   36.79 +    if ( cpu_test_and_clear(smp_processor_id(), cpu_eoi_map) )
   36.80 +    {
   36.81 +        __set_eoi_ready(desc);
   36.82 +        spin_unlock(&desc->lock);
   36.83 +        flush_ready_eoi(NULL);
   36.84 +        local_irq_enable();
   36.85 +    }
   36.86 +    else
   36.87 +    {
   36.88 +        spin_unlock_irq(&desc->lock);
   36.89 +    }
   36.90 +
   36.91 +    if ( !cpus_empty(cpu_eoi_map) )
   36.92 +        on_selected_cpus(cpu_eoi_map, set_eoi_ready, desc, 1, 0);
   36.93 +}
   36.94 +
   36.95 +int pirq_guest_eoi(struct domain *d, int irq)
   36.96 +{
   36.97 +    if ( (irq < 0) || (irq >= NR_IRQS) )
   36.98 +        return -EINVAL;
   36.99 +
  36.100 +    __pirq_guest_eoi(d, irq);
  36.101 +
  36.102 +    return 0;
  36.103 +}
  36.104 +
  36.105 +int pirq_guest_unmask(struct domain *d)
  36.106 +{
  36.107 +    unsigned int   irq;
  36.108 +    shared_info_t *s = d->shared_info;
  36.109 +
  36.110 +    for ( irq = find_first_bit(d->pirq_mask, NR_PIRQS);
  36.111 +          irq < NR_PIRQS;
  36.112 +          irq = find_next_bit(d->pirq_mask, NR_PIRQS, irq+1) )
  36.113 +    {
  36.114 +        if ( !test_bit(d->pirq_to_evtchn[irq], s->evtchn_mask) )
  36.115 +            __pirq_guest_eoi(d, irq);
  36.116      }
  36.117  
  36.118      return 0;
    37.1 --- a/xen/arch/x86/physdev.c	Fri Apr 28 16:44:00 2006 +0100
    37.2 +++ b/xen/arch/x86/physdev.c	Sun Apr 30 09:16:15 2006 +0100
    37.3 @@ -22,91 +22,123 @@ extern int
    37.4  pirq_acktype(
    37.5      int irq);
    37.6  
    37.7 -/*
    37.8 - * Demuxing hypercall.
    37.9 - */
   37.10 -long do_physdev_op(XEN_GUEST_HANDLE(physdev_op_t) uop)
   37.11 +long do_physdev_op(int cmd, XEN_GUEST_HANDLE(void) arg)
   37.12  {
   37.13 -    struct physdev_op op;
   37.14 +    int irq;
   37.15      long ret;
   37.16 -    int  irq;
   37.17  
   37.18 -    if ( unlikely(copy_from_guest(&op, uop, 1) != 0) )
   37.19 -        return -EFAULT;
   37.20 +    switch ( cmd )
   37.21 +    {
   37.22 +    case PHYSDEVOP_eoi: {
   37.23 +        struct physdev_eoi eoi;
   37.24 +        ret = -EFAULT;
   37.25 +        if ( copy_from_guest(&eoi, arg, 1) != 0 )
   37.26 +            break;
   37.27 +        ret = pirq_guest_eoi(current->domain, eoi.irq);
   37.28 +        break;
   37.29 +    }
   37.30  
   37.31 -    switch ( op.cmd )
   37.32 -    {
   37.33 -    case PHYSDEVOP_IRQ_UNMASK_NOTIFY:
   37.34 +    /* Legacy since 0x00030202. */
   37.35 +    case PHYSDEVOP_IRQ_UNMASK_NOTIFY: {
   37.36          ret = pirq_guest_unmask(current->domain);
   37.37          break;
   37.38 +    }
   37.39  
   37.40 -    case PHYSDEVOP_IRQ_STATUS_QUERY:
   37.41 -        irq = op.u.irq_status_query.irq;
   37.42 +    case PHYSDEVOP_irq_status_query: {
   37.43 +        struct physdev_irq_status_query irq_status_query;
   37.44 +        ret = -EFAULT;
   37.45 +        if ( copy_from_guest(&irq_status_query, arg, 1) != 0 )
   37.46 +            break;
   37.47 +        irq = irq_status_query.irq;
   37.48          ret = -EINVAL;
   37.49          if ( (irq < 0) || (irq >= NR_IRQS) )
   37.50              break;
   37.51 -        op.u.irq_status_query.flags = 0;
   37.52 +        irq_status_query.flags = 0;
   37.53          if ( pirq_acktype(irq) != 0 )
   37.54 -            op.u.irq_status_query.flags |= PHYSDEVOP_IRQ_NEEDS_UNMASK_NOTIFY;
   37.55 -        ret = 0;
   37.56 +            irq_status_query.flags |= XENIRQSTAT_needs_eoi;
   37.57 +        ret = copy_to_guest(arg, &irq_status_query, 1) ? -EFAULT : 0;
   37.58          break;
   37.59 +    }
   37.60  
   37.61 -    case PHYSDEVOP_APIC_READ:
   37.62 +    case PHYSDEVOP_apic_read: {
   37.63 +        struct physdev_apic apic;
   37.64 +        ret = -EFAULT;
   37.65 +        if ( copy_from_guest(&apic, arg, 1) != 0 )
   37.66 +            break;
   37.67          ret = -EPERM;
   37.68          if ( !IS_PRIV(current->domain) )
   37.69              break;
   37.70 -        ret = ioapic_guest_read(
   37.71 -            op.u.apic_op.apic_physbase,
   37.72 -            op.u.apic_op.reg,
   37.73 -            &op.u.apic_op.value);
   37.74 +        ret = ioapic_guest_read(apic.apic_physbase, apic.reg, &apic.value);
   37.75 +        if ( copy_to_guest(arg, &apic, 1) != 0 )
   37.76 +            ret = -EFAULT;
   37.77          break;
   37.78 +    }
   37.79  
   37.80 -    case PHYSDEVOP_APIC_WRITE:
   37.81 +    case PHYSDEVOP_apic_write: {
   37.82 +        struct physdev_apic apic;
   37.83 +        ret = -EFAULT;
   37.84 +        if ( copy_from_guest(&apic, arg, 1) != 0 )
   37.85 +            break;
   37.86          ret = -EPERM;
   37.87          if ( !IS_PRIV(current->domain) )
   37.88              break;
   37.89 -        ret = ioapic_guest_write(
   37.90 -            op.u.apic_op.apic_physbase,
   37.91 -            op.u.apic_op.reg,
   37.92 -            op.u.apic_op.value);
   37.93 +        ret = ioapic_guest_write(apic.apic_physbase, apic.reg, apic.value);
   37.94          break;
   37.95 -
   37.96 -    case PHYSDEVOP_ASSIGN_VECTOR:
   37.97 -        if ( !IS_PRIV(current->domain) )
   37.98 -            return -EPERM;
   37.99 +    }
  37.100  
  37.101 -        if ( (irq = op.u.irq_op.irq) >= NR_IRQS )
  37.102 -            return -EINVAL;
  37.103 +    case PHYSDEVOP_alloc_irq_vector: {
  37.104 +        struct physdev_irq irq_op;
  37.105 +
  37.106 +        ret = -EFAULT;
  37.107 +        if ( copy_from_guest(&irq_op, arg, 1) != 0 )
  37.108 +            break;
  37.109 +
  37.110 +        ret = -EPERM;
  37.111 +        if ( !IS_PRIV(current->domain) )
  37.112 +            break;
  37.113 +
  37.114 +        ret = -EINVAL;
  37.115 +        if ( (irq = irq_op.irq) >= NR_IRQS )
  37.116 +            break;
  37.117          
  37.118 -        op.u.irq_op.vector = assign_irq_vector(irq);
  37.119 -        ret = 0;
  37.120 +        irq_op.vector = assign_irq_vector(irq);
  37.121 +        ret = copy_to_guest(arg, &irq_op, 1) ? -EFAULT : 0;
  37.122          break;
  37.123 +    }
  37.124  
  37.125 -    case PHYSDEVOP_SET_IOPL:
  37.126 +    case PHYSDEVOP_set_iopl: {
  37.127 +        struct physdev_set_iopl set_iopl;
  37.128 +        ret = -EFAULT;
  37.129 +        if ( copy_from_guest(&set_iopl, arg, 1) != 0 )
  37.130 +            break;
  37.131          ret = -EINVAL;
  37.132 -        if ( op.u.set_iopl.iopl > 3 )
  37.133 +        if ( set_iopl.iopl > 3 )
  37.134              break;
  37.135          ret = 0;
  37.136 -        current->arch.iopl = op.u.set_iopl.iopl;
  37.137 +        current->arch.iopl = set_iopl.iopl;
  37.138          break;
  37.139 +    }
  37.140  
  37.141 -    case PHYSDEVOP_SET_IOBITMAP:
  37.142 +    case PHYSDEVOP_set_iobitmap: {
  37.143 +        struct physdev_set_iobitmap set_iobitmap;
  37.144 +        ret = -EFAULT;
  37.145 +        if ( copy_from_guest(&set_iobitmap, arg, 1) != 0 )
  37.146 +            break;
  37.147          ret = -EINVAL;
  37.148 -        if ( !access_ok(op.u.set_iobitmap.bitmap, IOBMP_BYTES) ||
  37.149 -             (op.u.set_iobitmap.nr_ports > 65536) )
  37.150 +        if ( !access_ok(set_iobitmap.bitmap, IOBMP_BYTES) ||
  37.151 +             (set_iobitmap.nr_ports > 65536) )
  37.152              break;
  37.153          ret = 0;
  37.154 -        current->arch.iobmp       = op.u.set_iobitmap.bitmap;
  37.155 -        current->arch.iobmp_limit = op.u.set_iobitmap.nr_ports;
  37.156 +        current->arch.iobmp       = set_iobitmap.bitmap;
  37.157 +        current->arch.iobmp_limit = set_iobitmap.nr_ports;
  37.158          break;
  37.159 +    }
  37.160 +
  37.161      default:
  37.162          ret = -EINVAL;
  37.163          break;
  37.164      }
  37.165  
  37.166 -    if ( copy_to_guest(uop, &op, 1) )
  37.167 -        ret = -EFAULT;
  37.168 -
  37.169      return ret;
  37.170  }
  37.171  
    38.1 --- a/xen/arch/x86/x86_32/entry.S	Fri Apr 28 16:44:00 2006 +0100
    38.2 +++ b/xen/arch/x86/x86_32/entry.S	Sun Apr 30 09:16:15 2006 +0100
    38.3 @@ -630,10 +630,10 @@ ENTRY(hypercall_table)
    38.4          .long do_multicall
    38.5          .long do_update_va_mapping
    38.6          .long do_set_timer_op       /* 15 */
    38.7 -        .long do_event_channel_op
    38.8 +        .long do_event_channel_op_compat
    38.9          .long do_xen_version
   38.10          .long do_console_io
   38.11 -        .long do_physdev_op
   38.12 +        .long do_physdev_op_compat
   38.13          .long do_grant_table_op     /* 20 */
   38.14          .long do_vm_assist
   38.15          .long do_update_va_mapping_otherdomain
   38.16 @@ -646,6 +646,8 @@ ENTRY(hypercall_table)
   38.17          .long do_arch_sched_op
   38.18          .long do_callback_op        /* 30 */
   38.19          .long do_xenoprof_op
   38.20 +        .long do_event_channel_op
   38.21 +        .long do_physdev_op
   38.22          .rept NR_hypercalls-((.-hypercall_table)/4)
   38.23          .long do_ni_hypercall
   38.24          .endr
   38.25 @@ -667,10 +669,10 @@ ENTRY(hypercall_args_table)
   38.26          .byte 2 /* do_multicall         */
   38.27          .byte 4 /* do_update_va_mapping */
   38.28          .byte 2 /* do_set_timer_op      */  /* 15 */
   38.29 -        .byte 1 /* do_event_channel_op  */
   38.30 +        .byte 1 /* do_event_channel_op_compat */
   38.31          .byte 2 /* do_xen_version       */
   38.32          .byte 3 /* do_console_io        */
   38.33 -        .byte 1 /* do_physdev_op        */
   38.34 +        .byte 1 /* do_physdev_op_compat */
   38.35          .byte 3 /* do_grant_table_op    */  /* 20 */
   38.36          .byte 2 /* do_vm_assist         */
   38.37          .byte 5 /* do_update_va_mapping_otherdomain */
   38.38 @@ -683,6 +685,8 @@ ENTRY(hypercall_args_table)
   38.39          .byte 2 /* do_arch_sched_op     */
   38.40          .byte 2 /* do_callback_op       */  /* 30 */
   38.41          .byte 2 /* do_xenoprof_op       */
   38.42 +        .byte 2 /* do_event_channel_op  */
   38.43 +        .byte 2 /* do_physdev_op        */
   38.44          .rept NR_hypercalls-(.-hypercall_args_table)
   38.45          .byte 0 /* do_ni_hypercall      */
   38.46          .endr
    39.1 --- a/xen/arch/x86/x86_64/entry.S	Fri Apr 28 16:44:00 2006 +0100
    39.2 +++ b/xen/arch/x86/x86_64/entry.S	Sun Apr 30 09:16:15 2006 +0100
    39.3 @@ -538,10 +538,10 @@ ENTRY(hypercall_table)
    39.4          .quad do_multicall
    39.5          .quad do_update_va_mapping
    39.6          .quad do_set_timer_op       /* 15 */
    39.7 -        .quad do_event_channel_op
    39.8 +        .quad do_event_channel_op_compat
    39.9          .quad do_xen_version
   39.10          .quad do_console_io
   39.11 -        .quad do_physdev_op
   39.12 +        .quad do_physdev_op_compat
   39.13          .quad do_grant_table_op     /* 20 */
   39.14          .quad do_vm_assist
   39.15          .quad do_update_va_mapping_otherdomain
   39.16 @@ -554,6 +554,8 @@ ENTRY(hypercall_table)
   39.17          .quad do_arch_sched_op
   39.18          .quad do_callback_op        /* 30 */
   39.19          .quad do_xenoprof_op
   39.20 +        .quad do_event_channel_op
   39.21 +        .quad do_physdev_op
   39.22          .rept NR_hypercalls-((.-hypercall_table)/8)
   39.23          .quad do_ni_hypercall
   39.24          .endr
   39.25 @@ -575,10 +577,10 @@ ENTRY(hypercall_args_table)
   39.26          .byte 2 /* do_multicall         */
   39.27          .byte 3 /* do_update_va_mapping */
   39.28          .byte 1 /* do_set_timer_op      */  /* 15 */
   39.29 -        .byte 1 /* do_event_channel_op  */
   39.30 +        .byte 1 /* do_event_channel_op_compat */
   39.31          .byte 2 /* do_xen_version       */
   39.32          .byte 3 /* do_console_io        */
   39.33 -        .byte 1 /* do_physdev_op        */
   39.34 +        .byte 1 /* do_physdev_op_compat */
   39.35          .byte 3 /* do_grant_table_op    */  /* 20 */
   39.36          .byte 2 /* do_vm_assist         */
   39.37          .byte 4 /* do_update_va_mapping_otherdomain */
   39.38 @@ -591,6 +593,8 @@ ENTRY(hypercall_args_table)
   39.39          .byte 2 /* do_arch_sched_op     */
   39.40          .byte 2 /* do_callback_op       */  /* 30 */
   39.41          .byte 2 /* do_xenoprof_op       */
   39.42 +        .byte 2 /* do_event_channel_op  */
   39.43 +        .byte 2 /* do_physdev_op        */
   39.44          .rept NR_hypercalls-(.-hypercall_args_table)
   39.45          .byte 0 /* do_ni_hypercall      */
   39.46          .endr
    40.1 --- a/xen/common/event_channel.c	Fri Apr 28 16:44:00 2006 +0100
    40.2 +++ b/xen/common/event_channel.c	Sun Apr 30 09:16:15 2006 +0100
    40.3 @@ -97,7 +97,10 @@ static long evtchn_alloc_unbound(evtchn_
    40.4      struct domain *d;
    40.5      int            port;
    40.6      domid_t        dom = alloc->dom;
    40.7 -    long           rc = 0;
    40.8 +    long           rc;
    40.9 +
   40.10 +    if ( (rc = acm_pre_eventchannel_unbound(dom, alloc->remote_dom)) != 0 )
   40.11 +        return rc;
   40.12  
   40.13      if ( dom == DOMID_SELF )
   40.14          dom = current->domain->domain_id;
   40.15 @@ -134,7 +137,10 @@ static long evtchn_bind_interdomain(evtc
   40.16      struct domain *ld = current->domain, *rd;
   40.17      int            lport, rport = bind->remote_port;
   40.18      domid_t        rdom = bind->remote_dom;
   40.19 -    long           rc = 0;
   40.20 +    long           rc;
   40.21 +
   40.22 +    if ( (rc = acm_pre_eventchannel_interdomain(rdom)) != 0 )
   40.23 +        return rc;
   40.24  
   40.25      if ( rdom == DOMID_SELF )
   40.26          rdom = current->domain->domain_id;
   40.27 @@ -201,13 +207,14 @@ static long evtchn_bind_virq(evtchn_bind
   40.28      int            port, virq = bind->virq, vcpu = bind->vcpu;
   40.29      long           rc = 0;
   40.30  
   40.31 -    if ( virq >= ARRAY_SIZE(v->virq_to_evtchn) )
   40.32 +    if ( (virq < 0) || (virq >= ARRAY_SIZE(v->virq_to_evtchn)) )
   40.33          return -EINVAL;
   40.34  
   40.35      if ( virq_is_global(virq) && (vcpu != 0) )
   40.36          return -EINVAL;
   40.37  
   40.38 -    if ( (vcpu >= ARRAY_SIZE(d->vcpu)) || ((v = d->vcpu[vcpu]) == NULL) )
   40.39 +    if ( (vcpu < 0) || (vcpu >= ARRAY_SIZE(d->vcpu)) ||
   40.40 +         ((v = d->vcpu[vcpu]) == NULL) )
   40.41          return -ENOENT;
   40.42  
   40.43      spin_lock(&d->evtchn_lock);
   40.44 @@ -239,7 +246,8 @@ static long evtchn_bind_ipi(evtchn_bind_
   40.45      int            port, vcpu = bind->vcpu;
   40.46      long           rc = 0;
   40.47  
   40.48 -    if ( (vcpu >= ARRAY_SIZE(d->vcpu)) || (d->vcpu[vcpu] == NULL) )
   40.49 +    if ( (vcpu < 0) || (vcpu >= ARRAY_SIZE(d->vcpu)) ||
   40.50 +         (d->vcpu[vcpu] == NULL) )
   40.51          return -ENOENT;
   40.52  
   40.53      spin_lock(&d->evtchn_lock);
   40.54 @@ -267,7 +275,7 @@ static long evtchn_bind_pirq(evtchn_bind
   40.55      int            port, pirq = bind->pirq;
   40.56      long           rc;
   40.57  
   40.58 -    if ( pirq >= ARRAY_SIZE(d->pirq_to_evtchn) )
   40.59 +    if ( (pirq < 0) || (pirq >= ARRAY_SIZE(d->pirq_to_evtchn)) )
   40.60          return -EINVAL;
   40.61  
   40.62      if ( !irq_access_permitted(d, pirq) )
   40.63 @@ -683,70 +691,103 @@ static long evtchn_unmask(evtchn_unmask_
   40.64  }
   40.65  
   40.66  
   40.67 -long do_event_channel_op(XEN_GUEST_HANDLE(evtchn_op_t) uop)
   40.68 +long do_event_channel_op(int cmd, XEN_GUEST_HANDLE(void) arg)
   40.69  {
   40.70      long rc;
   40.71 -    struct evtchn_op op;
   40.72  
   40.73 -    if ( copy_from_guest(&op, uop, 1) != 0 )
   40.74 -        return -EFAULT;
   40.75 -
   40.76 -    if (acm_pre_event_channel(&op))
   40.77 -        return -EACCES;
   40.78 -
   40.79 -    switch ( op.cmd )
   40.80 +    switch ( cmd )
   40.81      {
   40.82 -    case EVTCHNOP_alloc_unbound:
   40.83 -        rc = evtchn_alloc_unbound(&op.u.alloc_unbound);
   40.84 -        if ( (rc == 0) && (copy_to_guest(uop, &op, 1) != 0) )
   40.85 -            rc = -EFAULT; /* Cleaning up here would be a mess! */
   40.86 -        break;
   40.87 -
   40.88 -    case EVTCHNOP_bind_interdomain:
   40.89 -        rc = evtchn_bind_interdomain(&op.u.bind_interdomain);
   40.90 -        if ( (rc == 0) && (copy_to_guest(uop, &op, 1) != 0) )
   40.91 -            rc = -EFAULT; /* Cleaning up here would be a mess! */
   40.92 -        break;
   40.93 -
   40.94 -    case EVTCHNOP_bind_virq:
   40.95 -        rc = evtchn_bind_virq(&op.u.bind_virq);
   40.96 -        if ( (rc == 0) && (copy_to_guest(uop, &op, 1) != 0) )
   40.97 +    case EVTCHNOP_alloc_unbound: {
   40.98 +        struct evtchn_alloc_unbound alloc_unbound;
   40.99 +        if ( copy_from_guest(&alloc_unbound, arg, 1) != 0 )
  40.100 +            return -EFAULT;
  40.101 +        rc = evtchn_alloc_unbound(&alloc_unbound);
  40.102 +        if ( (rc == 0) && (copy_to_guest(arg, &alloc_unbound, 1) != 0) )
  40.103              rc = -EFAULT; /* Cleaning up here would be a mess! */
  40.104          break;
  40.105 +    }
  40.106  
  40.107 -    case EVTCHNOP_bind_ipi:
  40.108 -        rc = evtchn_bind_ipi(&op.u.bind_ipi);
  40.109 -        if ( (rc == 0) && (copy_to_guest(uop, &op, 1) != 0) )
  40.110 -            rc = -EFAULT; /* Cleaning up here would be a mess! */
  40.111 -        break;
  40.112 -
  40.113 -    case EVTCHNOP_bind_pirq:
  40.114 -        rc = evtchn_bind_pirq(&op.u.bind_pirq);
  40.115 -        if ( (rc == 0) && (copy_to_guest(uop, &op, 1) != 0) )
  40.116 +    case EVTCHNOP_bind_interdomain: {
  40.117 +        struct evtchn_bind_interdomain bind_interdomain;
  40.118 +        if ( copy_from_guest(&bind_interdomain, arg, 1) != 0 )
  40.119 +            return -EFAULT;
  40.120 +        rc = evtchn_bind_interdomain(&bind_interdomain);
  40.121 +        if ( (rc == 0) && (copy_to_guest(arg, &bind_interdomain, 1) != 0) )
  40.122              rc = -EFAULT; /* Cleaning up here would be a mess! */
  40.123          break;
  40.124 -
  40.125 -    case EVTCHNOP_close:
  40.126 -        rc = evtchn_close(&op.u.close);
  40.127 -        break;
  40.128 +    }
  40.129  
  40.130 -    case EVTCHNOP_send:
  40.131 -        rc = evtchn_send(op.u.send.port);
  40.132 +    case EVTCHNOP_bind_virq: {
  40.133 +        struct evtchn_bind_virq bind_virq;
  40.134 +        if ( copy_from_guest(&bind_virq, arg, 1) != 0 )
  40.135 +            return -EFAULT;
  40.136 +        rc = evtchn_bind_virq(&bind_virq);
  40.137 +        if ( (rc == 0) && (copy_to_guest(arg, &bind_virq, 1) != 0) )
  40.138 +            rc = -EFAULT; /* Cleaning up here would be a mess! */
  40.139          break;
  40.140 +    }
  40.141  
  40.142 -    case EVTCHNOP_status:
  40.143 -        rc = evtchn_status(&op.u.status);
  40.144 -        if ( (rc == 0) && (copy_to_guest(uop, &op, 1) != 0) )
  40.145 +    case EVTCHNOP_bind_ipi: {
  40.146 +        struct evtchn_bind_ipi bind_ipi;
  40.147 +        if ( copy_from_guest(&bind_ipi, arg, 1) != 0 )
  40.148 +            return -EFAULT;
  40.149 +        rc = evtchn_bind_ipi(&bind_ipi);
  40.150 +        if ( (rc == 0) && (copy_to_guest(arg, &bind_ipi, 1) != 0) )
  40.151 +            rc = -EFAULT; /* Cleaning up here would be a mess! */
  40.152 +        break;
  40.153 +    }
  40.154 +
  40.155 +    case EVTCHNOP_bind_pirq: {
  40.156 +        struct evtchn_bind_pirq bind_pirq;
  40.157 +        if ( copy_from_guest(&bind_pirq, arg, 1) != 0 )
  40.158 +            return -EFAULT;
  40.159 +        rc = evtchn_bind_pirq(&bind_pirq);
  40.160 +        if ( (rc == 0) && (copy_to_guest(arg, &bind_pirq, 1) != 0) )
  40.161 +            rc = -EFAULT; /* Cleaning up here would be a mess! */
  40.162 +        break;
  40.163 +    }
  40.164 +
  40.165 +    case EVTCHNOP_close: {
  40.166 +        struct evtchn_close close;
  40.167 +        if ( copy_from_guest(&close, arg, 1) != 0 )
  40.168 +            return -EFAULT;
  40.169 +        rc = evtchn_close(&close);
  40.170 +        break;
  40.171 +    }
  40.172 +
  40.173 +    case EVTCHNOP_send: {
  40.174 +        struct evtchn_send send;
  40.175 +        if ( copy_from_guest(&send, arg, 1) != 0 )
  40.176 +            return -EFAULT;
  40.177 +        rc = evtchn_send(send.port);
  40.178 +        break;
  40.179 +    }
  40.180 +
  40.181 +    case EVTCHNOP_status: {
  40.182 +        struct evtchn_status status;
  40.183 +        if ( copy_from_guest(&status, arg, 1) != 0 )
  40.184 +            return -EFAULT;
  40.185 +        rc = evtchn_status(&status);
  40.186 +        if ( (rc == 0) && (copy_to_guest(arg, &status, 1) != 0) )
  40.187              rc = -EFAULT;
  40.188          break;
  40.189 +    }
  40.190  
  40.191 -    case EVTCHNOP_bind_vcpu:
  40.192 -        rc = evtchn_bind_vcpu(op.u.bind_vcpu.port, op.u.bind_vcpu.vcpu);
  40.193 +    case EVTCHNOP_bind_vcpu: {
  40.194 +        struct evtchn_bind_vcpu bind_vcpu;
  40.195 +        if ( copy_from_guest(&bind_vcpu, arg, 1) != 0 )
  40.196 +            return -EFAULT;
  40.197 +        rc = evtchn_bind_vcpu(bind_vcpu.port, bind_vcpu.vcpu);
  40.198          break;
  40.199 +    }
  40.200  
  40.201 -    case EVTCHNOP_unmask:
  40.202 -        rc = evtchn_unmask(&op.u.unmask);
  40.203 +    case EVTCHNOP_unmask: {
  40.204 +        struct evtchn_unmask unmask;
  40.205 +        if ( copy_from_guest(&unmask, arg, 1) != 0 )
  40.206 +            return -EFAULT;
  40.207 +        rc = evtchn_unmask(&unmask);
  40.208          break;
  40.209 +    }
  40.210  
  40.211      default:
  40.212          rc = -ENOSYS;
    41.1 --- a/xen/include/acm/acm_hooks.h	Fri Apr 28 16:44:00 2006 +0100
    41.2 +++ b/xen/include/acm/acm_hooks.h	Sun Apr 30 09:16:15 2006 +0100
    41.3 @@ -135,7 +135,9 @@ static inline void acm_post_dom0_op(stru
    41.4  { return; }
    41.5  static inline void acm_fail_dom0_op(struct dom0_op *op, void *ssid) 
    41.6  { return; }
    41.7 -static inline int acm_pre_event_channel(struct evtchn_op *op) 
    41.8 +static inline int acm_pre_eventchannel_unbound(domid_t id1, domid_t id2)
    41.9 +{ return 0; }
   41.10 +static inline int acm_pre_eventchannel_interdomain(domid_t id)
   41.11  { return 0; }
   41.12  static inline int acm_pre_grant_map_ref(domid_t id) 
   41.13  { return 0; }
   41.14 @@ -289,26 +291,6 @@ static inline void acm_fail_dom0_op(stru
   41.15      }
   41.16  }
   41.17  
   41.18 -static inline int acm_pre_event_channel(struct evtchn_op *op) 
   41.19 -{
   41.20 -    int ret = -EACCES;
   41.21 -
   41.22 -    switch(op->cmd) {
   41.23 -    case EVTCHNOP_alloc_unbound:
   41.24 -        ret = acm_pre_eventchannel_unbound(
   41.25 -                  op->u.alloc_unbound.dom,
   41.26 -                  op->u.alloc_unbound.remote_dom);
   41.27 -        break;
   41.28 -    case EVTCHNOP_bind_interdomain:
   41.29 -        ret = acm_pre_eventchannel_interdomain(
   41.30 -                  op->u.bind_interdomain.remote_dom);
   41.31 -        break;
   41.32 -    default:
   41.33 -        ret = 0; /* ok */
   41.34 -    }
   41.35 -    return ret;
   41.36 -}
   41.37 -
   41.38  static inline int acm_pre_grant_map_ref(domid_t id)
   41.39  {
   41.40      if ( (acm_primary_ops->pre_grant_map_ref != NULL) &&
    42.1 --- a/xen/include/asm-ia64/hypercall.h	Fri Apr 28 16:44:00 2006 +0100
    42.2 +++ b/xen/include/asm-ia64/hypercall.h	Sun Apr 30 09:16:15 2006 +0100
    42.3 @@ -9,6 +9,10 @@
    42.4  #include <asm/types.h>
    42.5  #include <asm/vcpu.h>
    42.6  
    42.7 +extern long
    42.8 +do_event_channel_op_compat(
    42.9 +    XEN_GUEST_HANDLE(evtchn_op_t) uop);
   42.10 +
   42.11  extern int
   42.12  vmx_do_mmu_update(
   42.13      mmu_update_t *ureqs,
    43.1 --- a/xen/include/asm-x86/hypercall.h	Fri Apr 28 16:44:00 2006 +0100
    43.2 +++ b/xen/include/asm-x86/hypercall.h	Sun Apr 30 09:16:15 2006 +0100
    43.3 @@ -8,6 +8,14 @@
    43.4  #include <public/physdev.h>
    43.5  
    43.6  extern long
    43.7 +do_event_channel_op_compat(
    43.8 +    XEN_GUEST_HANDLE(evtchn_op_t) uop);
    43.9 +
   43.10 +extern long
   43.11 +do_physdev_op_compat(
   43.12 +    XEN_GUEST_HANDLE(physdev_op_t) uop);
   43.13 +
   43.14 +extern long
   43.15  do_set_trap_table(
   43.16      XEN_GUEST_HANDLE(trap_info_t) traps);
   43.17  
   43.18 @@ -54,7 +62,7 @@ do_update_va_mapping(
   43.19  
   43.20  extern long
   43.21  do_physdev_op(
   43.22 -    XEN_GUEST_HANDLE(physdev_op_t) uop);
   43.23 +    int cmd, XEN_GUEST_HANDLE(void) arg);
   43.24  
   43.25  extern int
   43.26  do_update_va_mapping_otherdomain(
    44.1 --- a/xen/include/public/event_channel.h	Fri Apr 28 16:44:00 2006 +0100
    44.2 +++ b/xen/include/public/event_channel.h	Sun Apr 30 09:16:15 2006 +0100
    44.3 @@ -9,6 +9,13 @@
    44.4  #ifndef __XEN_PUBLIC_EVENT_CHANNEL_H__
    44.5  #define __XEN_PUBLIC_EVENT_CHANNEL_H__
    44.6  
    44.7 +/*
    44.8 + * Prototype for this hypercall is:
    44.9 + *  int event_channel_op(int cmd, void *args)
   44.10 + * @cmd  == EVTCHNOP_??? (event-channel operation).
   44.11 + * @args == Operation-specific extra arguments (NULL if none).
   44.12 + */
   44.13 +
   44.14  typedef uint32_t evtchn_port_t;
   44.15  DEFINE_XEN_GUEST_HANDLE(evtchn_port_t);
   44.16  
   44.17 @@ -181,6 +188,10 @@ typedef struct evtchn_unmask {
   44.18      evtchn_port_t port;
   44.19  } evtchn_unmask_t;
   44.20  
   44.21 +/*
   44.22 + * Argument to event_channel_op_compat() hypercall. Superceded by new
   44.23 + * event_channel_op() hypercall since 0x00030202.
   44.24 + */
   44.25  typedef struct evtchn_op {
   44.26      uint32_t cmd; /* EVTCHNOP_* */
   44.27      union {
    45.1 --- a/xen/include/public/physdev.h	Fri Apr 28 16:44:00 2006 +0100
    45.2 +++ b/xen/include/public/physdev.h	Sun Apr 30 09:16:15 2006 +0100
    45.3 @@ -2,62 +2,128 @@
    45.4  #ifndef __XEN_PUBLIC_PHYSDEV_H__
    45.5  #define __XEN_PUBLIC_PHYSDEV_H__
    45.6  
    45.7 -/* Commands to HYPERVISOR_physdev_op() */
    45.8 -#define PHYSDEVOP_IRQ_UNMASK_NOTIFY     4
    45.9 -#define PHYSDEVOP_IRQ_STATUS_QUERY      5
   45.10 -#define PHYSDEVOP_SET_IOPL              6
   45.11 -#define PHYSDEVOP_SET_IOBITMAP          7
   45.12 -#define PHYSDEVOP_APIC_READ             8
   45.13 -#define PHYSDEVOP_APIC_WRITE            9
   45.14 -#define PHYSDEVOP_ASSIGN_VECTOR         10
   45.15 +/*
   45.16 + * Prototype for this hypercall is:
   45.17 + *  int physdev_op(int cmd, void *args)
   45.18 + * @cmd  == PHYSDEVOP_??? (physdev operation).
   45.19 + * @args == Operation-specific extra arguments (NULL if none).
   45.20 + */
   45.21  
   45.22 -typedef struct physdevop_irq_status_query {
   45.23 +/*
   45.24 + * Notify end-of-interrupt (EOI) for the specified IRQ.
   45.25 + * @arg == pointer to physdev_eoi structure.
   45.26 + */
   45.27 +#define PHYSDEVOP_eoi                   12
   45.28 +typedef struct physdev_eoi {
   45.29 +    /* IN */
   45.30 +    uint32_t irq;
   45.31 +} physdev_eoi_t;
   45.32 +DEFINE_XEN_GUEST_HANDLE(physdev_eoi_t);
   45.33 +
   45.34 +/*
   45.35 + * Query the status of an IRQ line.
   45.36 + * @arg == pointer to physdev_irq_status_query structure.
   45.37 + */
   45.38 +#define PHYSDEVOP_irq_status_query       5
   45.39 +typedef struct physdev_irq_status_query {
   45.40      /* IN */
   45.41      uint32_t irq;
   45.42      /* OUT */
   45.43 -/* Need to call PHYSDEVOP_IRQ_UNMASK_NOTIFY when the IRQ has been serviced? */
   45.44 -#define PHYSDEVOP_IRQ_NEEDS_UNMASK_NOTIFY (1<<0)
   45.45 -    uint32_t flags;
   45.46 -} physdevop_irq_status_query_t;
   45.47 +    uint32_t flags; /* XENIRQSTAT_* */
   45.48 +} physdev_irq_status_query_t;
   45.49 +DEFINE_XEN_GUEST_HANDLE(physdev_irq_status_query_t);
   45.50  
   45.51 -typedef struct physdevop_set_iopl {
   45.52 +/* Need to call PHYSDEVOP_eoi when the IRQ has been serviced? */
   45.53 +#define _XENIRQSTAT_needs_eoi   (0)
   45.54 +#define  XENIRQSTAT_needs_eoi   (1<<_XENIRQSTAT_needs_eoi)
   45.55 +
   45.56 +/*
   45.57 + * Set the current VCPU's I/O privilege level.
   45.58 + * @arg == pointer to physdev_set_iopl structure.
   45.59 + */
   45.60 +#define PHYSDEVOP_set_iopl               6
   45.61 +typedef struct physdev_set_iopl {
   45.62      /* IN */
   45.63      uint32_t iopl;
   45.64 -} physdevop_set_iopl_t;
   45.65 +} physdev_set_iopl_t;
   45.66 +DEFINE_XEN_GUEST_HANDLE(physdev_set_iopl_t);
   45.67  
   45.68 -typedef struct physdevop_set_iobitmap {
   45.69 +/*
   45.70 + * Set the current VCPU's I/O-port permissions bitmap.
   45.71 + * @arg == pointer to physdev_set_iobitmap structure.
   45.72 + */
   45.73 +#define PHYSDEVOP_set_iobitmap           7
   45.74 +typedef struct physdev_set_iobitmap {
   45.75      /* IN */
   45.76      uint8_t *bitmap;
   45.77      uint32_t nr_ports;
   45.78 -} physdevop_set_iobitmap_t;
   45.79 +} physdev_set_iobitmap_t;
   45.80 +DEFINE_XEN_GUEST_HANDLE(physdev_set_iobitmap_t);
   45.81  
   45.82 -typedef struct physdevop_apic {
   45.83 +/*
   45.84 + * Read or write an IO-APIC register.
   45.85 + * @arg == pointer to physdev_apic structure.
   45.86 + */
   45.87 +#define PHYSDEVOP_apic_read              8
   45.88 +#define PHYSDEVOP_apic_write             9
   45.89 +typedef struct physdev_apic {
   45.90      /* IN */
   45.91      unsigned long apic_physbase;
   45.92      uint32_t reg;
   45.93      /* IN or OUT */
   45.94      uint32_t value;
   45.95 -} physdevop_apic_t;
   45.96 +} physdev_apic_t;
   45.97 +DEFINE_XEN_GUEST_HANDLE(physdev_apic_t);
   45.98  
   45.99 -typedef struct physdevop_irq {
  45.100 +/*
  45.101 + * Allocate or free a physical upcall vector for the specified IRQ line.
  45.102 + * @arg == pointer to physdev_irq structure.
  45.103 + */
  45.104 +#define PHYSDEVOP_alloc_irq_vector      10
  45.105 +#define PHYSDEVOP_free_irq_vector       11
  45.106 +typedef struct physdev_irq {
  45.107      /* IN */
  45.108      uint32_t irq;
  45.109 -    /* OUT */
  45.110 +    /* IN or OUT */
  45.111      uint32_t vector;
  45.112 -} physdevop_irq_t;
  45.113 +} physdev_irq_t;
  45.114 +DEFINE_XEN_GUEST_HANDLE(physdev_irq_t);
  45.115  
  45.116 +/*
  45.117 + * Argument to physdev_op_compat() hypercall. Superceded by new physdev_op()
  45.118 + * hypercall since 0x00030202.
  45.119 + */
  45.120  typedef struct physdev_op {
  45.121      uint32_t cmd;
  45.122      union {
  45.123 -        physdevop_irq_status_query_t      irq_status_query;
  45.124 -        physdevop_set_iopl_t              set_iopl;
  45.125 -        physdevop_set_iobitmap_t          set_iobitmap;
  45.126 -        physdevop_apic_t                  apic_op;
  45.127 -        physdevop_irq_t                   irq_op;
  45.128 +        physdev_irq_status_query_t      irq_status_query;
  45.129 +        physdev_set_iopl_t              set_iopl;
  45.130 +        physdev_set_iobitmap_t          set_iobitmap;
  45.131 +        physdev_apic_t                  apic_op;
  45.132 +        physdev_irq_t                   irq_op;
  45.133      } u;
  45.134  } physdev_op_t;
  45.135  DEFINE_XEN_GUEST_HANDLE(physdev_op_t);
  45.136  
  45.137 +/*
  45.138 + * Notify that some PIRQ-bound event channels have been unmasked.
  45.139 + * ** This command is obsolete since interface version 0x00030202 and is **
  45.140 + * ** unsupported by newer versions of Xen.                              **
  45.141 + */
  45.142 +#define PHYSDEVOP_IRQ_UNMASK_NOTIFY      4
  45.143 +
  45.144 +/*
  45.145 + * These all-capitals physdev operation names are superceded by the new names
  45.146 + * (defined above) since interface version 0x00030202.
  45.147 + */
  45.148 +#define PHYSDEVOP_IRQ_STATUS_QUERY       PHYSDEVOP_irq_status_query
  45.149 +#define PHYSDEVOP_SET_IOPL               PHYSDEVOP_set_iopl
  45.150 +#define PHYSDEVOP_SET_IOBITMAP           PHYSDEVOP_set_iobitmap
  45.151 +#define PHYSDEVOP_APIC_READ              PHYSDEVOP_apic_read
  45.152 +#define PHYSDEVOP_APIC_WRITE             PHYSDEVOP_apic_write
  45.153 +#define PHYSDEVOP_ASSIGN_VECTOR          PHYSDEVOP_alloc_irq_vector
  45.154 +#define PHYSDEVOP_IRQ_NEEDS_UNMASK_NOTIFY XENIRQSTAT_needs_eoi
  45.155 +
  45.156  #endif /* __XEN_PUBLIC_PHYSDEV_H__ */
  45.157  
  45.158  /*
    46.1 --- a/xen/include/public/xen-compat.h	Fri Apr 28 16:44:00 2006 +0100
    46.2 +++ b/xen/include/public/xen-compat.h	Sun Apr 30 09:16:15 2006 +0100
    46.3 @@ -9,7 +9,7 @@
    46.4  #ifndef __XEN_PUBLIC_XEN_COMPAT_H__
    46.5  #define __XEN_PUBLIC_XEN_COMPAT_H__
    46.6  
    46.7 -#define __XEN_LATEST_INTERFACE_VERSION__ 0x00030201
    46.8 +#define __XEN_LATEST_INTERFACE_VERSION__ 0x00030202
    46.9  
   46.10  #if defined(__XEN__) || defined(__XEN_TOOLS__)
   46.11  /* Xen is built with matching headers and implements the latest interface. */
   46.12 @@ -36,4 +36,12 @@
   46.13      typedef type * __guest_handle_ ## name
   46.14  #endif
   46.15  
   46.16 +/* New event-channel and physdev hypercalls introduced in 0x00030202. */
   46.17 +#if __XEN_INTERFACE_VERSION__ < 0x00030202
   46.18 +#undef __HYPERVISOR_event_channel_op
   46.19 +#define __HYPERVISOR_event_channel_op __HYPERVISOR_event_channel_op_compat
   46.20 +#undef __HYPERVISOR_physdev_op
   46.21 +#define __HYPERVISOR_physdev_op __HYPERVISOR_physdev_op_compat
   46.22 +#endif
   46.23 +
   46.24  #endif /* __XEN_PUBLIC_XEN_COMPAT_H__ */
    47.1 --- a/xen/include/public/xen.h	Fri Apr 28 16:44:00 2006 +0100
    47.2 +++ b/xen/include/public/xen.h	Sun Apr 30 09:16:15 2006 +0100
    47.3 @@ -37,7 +37,7 @@
    47.4  #define __HYPERVISOR_stack_switch          3
    47.5  #define __HYPERVISOR_set_callbacks         4
    47.6  #define __HYPERVISOR_fpu_taskswitch        5
    47.7 -#define __HYPERVISOR_sched_op_compat       6 /* compat as of 0x00030101 */
    47.8 +#define __HYPERVISOR_sched_op_compat       6 /* compat since 0x00030101 */
    47.9  #define __HYPERVISOR_dom0_op               7
   47.10  #define __HYPERVISOR_set_debugreg          8
   47.11  #define __HYPERVISOR_get_debugreg          9
   47.12 @@ -46,10 +46,10 @@
   47.13  #define __HYPERVISOR_multicall            13
   47.14  #define __HYPERVISOR_update_va_mapping    14
   47.15  #define __HYPERVISOR_set_timer_op         15
   47.16 -#define __HYPERVISOR_event_channel_op     16
   47.17 +#define __HYPERVISOR_event_channel_op_compat 16 /* compat since 0x00030202 */
   47.18  #define __HYPERVISOR_xen_version          17
   47.19  #define __HYPERVISOR_console_io           18
   47.20 -#define __HYPERVISOR_physdev_op           19
   47.21 +#define __HYPERVISOR_physdev_op_compat    19 /* compat since 0x00030202 */
   47.22  #define __HYPERVISOR_grant_table_op       20
   47.23  #define __HYPERVISOR_vm_assist            21
   47.24  #define __HYPERVISOR_update_va_mapping_otherdomain 22
   47.25 @@ -62,6 +62,8 @@
   47.26  #define __HYPERVISOR_sched_op             29
   47.27  #define __HYPERVISOR_callback_op          30
   47.28  #define __HYPERVISOR_xenoprof_op          31
   47.29 +#define __HYPERVISOR_event_channel_op     32
   47.30 +#define __HYPERVISOR_physdev_op           33
   47.31  
   47.32  /* Architecture-specific hypercall definitions. */
   47.33  #define __HYPERVISOR_arch_0               48
    48.1 --- a/xen/include/xen/hypercall.h	Fri Apr 28 16:44:00 2006 +0100
    48.2 +++ b/xen/include/xen/hypercall.h	Sun Apr 30 09:16:15 2006 +0100
    48.3 @@ -9,6 +9,7 @@
    48.4  #include <xen/types.h>
    48.5  #include <xen/time.h>
    48.6  #include <public/xen.h>
    48.7 +#include <public/dom0_ops.h>
    48.8  #include <public/acm_ops.h>
    48.9  #include <public/event_channel.h>
   48.10  #include <asm/hypercall.h>
   48.11 @@ -47,7 +48,7 @@ do_set_timer_op(
   48.12  
   48.13  extern long
   48.14  do_event_channel_op(
   48.15 -    XEN_GUEST_HANDLE(evtchn_op_t) uop);
   48.16 +    int cmd, XEN_GUEST_HANDLE(void) arg);
   48.17  
   48.18  extern long
   48.19  do_xen_version(
    49.1 --- a/xen/include/xen/irq.h	Fri Apr 28 16:44:00 2006 +0100
    49.2 +++ b/xen/include/xen/irq.h	Sun Apr 30 09:16:15 2006 +0100
    49.3 @@ -68,8 +68,9 @@ extern void no_action(int cpl, void *dev
    49.4  
    49.5  struct domain;
    49.6  struct vcpu;
    49.7 -extern int pirq_guest_unmask(struct domain *p);
    49.8 -extern int pirq_guest_bind(struct vcpu *p, int irq, int will_share);
    49.9 -extern int pirq_guest_unbind(struct domain *p, int irq);
   49.10 +extern int pirq_guest_eoi(struct domain *d, int irq);
   49.11 +extern int pirq_guest_unmask(struct domain *d);
   49.12 +extern int pirq_guest_bind(struct vcpu *v, int irq, int will_share);
   49.13 +extern int pirq_guest_unbind(struct domain *d, int irq);
   49.14  
   49.15  #endif /* __XEN_IRQ_H__ */