ia64/xen-unstable

changeset 9747:de2dc4e7966a

[IA64] Add support to physdev_ops

Add support to physdev ops, and thus give IOSAPIC RTEs
managed by Xen now. Dom0 now issues hypercall to r/w
RTE entry. Another change is the irq vector allocation
which is also owned by xen now.

After this change, the IOSAPIC is almost owned by xen
with only exception as IOSAPIC EOI which is still issued
by dom0 directly. But that's OK since currently dom0
owns all external physical devices. Later full event
channel mechanism will provide necessary support for
driver domain, and at that time, dom0 instead issues
physdev_op (PHYSDEVOP_IRQ_UNMASK_NOTIFY) naturally as
replace of IOSAPIC EOI.

Signed-off-by Kevin Tian <kevin.tian@intel.com>
author awilliam@xenbuild.aw
date Fri Apr 21 09:03:19 2006 -0600 (2006-04-21)
parents eab6fd4949f0
children 2f86b84d0483
files linux-2.6-xen-sparse/arch/ia64/kernel/iosapic.c linux-2.6-xen-sparse/arch/ia64/kernel/irq_ia64.c linux-2.6-xen-sparse/include/asm-ia64/iosapic.h xen/arch/ia64/linux-xen/iosapic.c xen/arch/ia64/linux-xen/irq_ia64.c xen/arch/ia64/xen/acpi.c xen/arch/ia64/xen/hypercall.c xen/arch/ia64/xen/irq.c xen/include/asm-ia64/linux-xen/asm/iosapic.h
line diff
     1.1 --- a/linux-2.6-xen-sparse/arch/ia64/kernel/iosapic.c	Fri Apr 21 08:56:34 2006 -0600
     1.2 +++ b/linux-2.6-xen-sparse/arch/ia64/kernel/iosapic.c	Fri Apr 21 09:03:19 2006 -0600
     1.3 @@ -140,6 +140,68 @@ static unsigned char pcat_compat __devin
     1.4  static int iosapic_kmalloc_ok;
     1.5  static LIST_HEAD(free_rte_list);
     1.6  
     1.7 +#ifdef CONFIG_XEN
     1.8 +#include <xen/interface/xen.h>
     1.9 +#include <xen/interface/physdev.h>
    1.10 +#include <asm/hypervisor.h>
    1.11 +static inline unsigned int xen_iosapic_read(char __iomem *iosapic, unsigned int reg)
    1.12 +{
    1.13 +	physdev_op_t op;
    1.14 +	int ret;
    1.15 +
    1.16 +	op.cmd = PHYSDEVOP_APIC_READ;
    1.17 +	op.u.apic_op.apic_physbase = (unsigned long)iosapic -
    1.18 +					__IA64_UNCACHED_OFFSET;
    1.19 +	op.u.apic_op.reg = reg;
    1.20 +	ret = HYPERVISOR_physdev_op(&op);
    1.21 +	if (ret)
    1.22 +		return ret;
    1.23 +	return op.u.apic_op.value;
    1.24 +}
    1.25 +
    1.26 +static inline void xen_iosapic_write(char __iomem *iosapic, unsigned int reg, u32 val)
    1.27 +{
    1.28 +	physdev_op_t op;
    1.29 +
    1.30 +	op.cmd = PHYSDEVOP_APIC_WRITE;
    1.31 +	op.u.apic_op.apic_physbase = (unsigned long)iosapic - 
    1.32 +					__IA64_UNCACHED_OFFSET;
    1.33 +	op.u.apic_op.reg = reg;
    1.34 +	op.u.apic_op.value = val;
    1.35 +	HYPERVISOR_physdev_op(&op);
    1.36 +}
    1.37 +
    1.38 +static inline unsigned int iosapic_read(char __iomem *iosapic, unsigned int reg)
    1.39 +{
    1.40 +	if (!running_on_xen) {
    1.41 +		writel(reg, iosapic + IOSAPIC_REG_SELECT);
    1.42 +		return readl(iosapic + IOSAPIC_WINDOW);
    1.43 +	} else
    1.44 +		return xen_iosapic_read(iosapic, reg);
    1.45 +}
    1.46 +
    1.47 +static inline void iosapic_write(char __iomem *iosapic, unsigned int reg, u32 val)
    1.48 +{
    1.49 +	if (!running_on_xen) {
    1.50 +		writel(reg, iosapic + IOSAPIC_REG_SELECT);
    1.51 +		writel(val, iosapic + IOSAPIC_WINDOW);
    1.52 +	} else
    1.53 +		xen_iosapic_write(iosapic, reg, val);
    1.54 +}
    1.55 +
    1.56 +int xen_assign_irq_vector(int irq)
    1.57 +{
    1.58 +	physdev_op_t op;
    1.59 +
    1.60 +	op.cmd = PHYSDEVOP_ASSIGN_VECTOR;
    1.61 +	op.u.irq_op.irq = irq;
    1.62 +	if (HYPERVISOR_physdev_op(&op))
    1.63 +		return -ENOSPC;
    1.64 +
    1.65 +	return op.u.irq_op.vector;
    1.66 +}
    1.67 +#endif /* XEN */
    1.68 +
    1.69  /*
    1.70   * Find an IOSAPIC associated with a GSI
    1.71   */
    1.72 @@ -953,6 +1015,10 @@ iosapic_system_init (int system_pcat_com
    1.73  	}
    1.74  
    1.75  	pcat_compat = system_pcat_compat;
    1.76 +#ifdef CONFIG_XEN
    1.77 +	if (running_on_xen)
    1.78 +		return;
    1.79 +#endif
    1.80  	if (pcat_compat) {
    1.81  		/*
    1.82  		 * Disable the compatibility mode interrupts (8259 style), needs IN/OUT support
     2.1 --- a/linux-2.6-xen-sparse/arch/ia64/kernel/irq_ia64.c	Fri Apr 21 08:56:34 2006 -0600
     2.2 +++ b/linux-2.6-xen-sparse/arch/ia64/kernel/irq_ia64.c	Fri Apr 21 09:03:19 2006 -0600
     2.3 @@ -66,6 +66,11 @@ int
     2.4  assign_irq_vector (int irq)
     2.5  {
     2.6  	int pos, vector;
     2.7 +#ifdef CONFIG_XEN
     2.8 +	extern int xen_assign_irq_vector(int);
     2.9 +	if (running_on_xen)
    2.10 +		return xen_assign_irq_vector(irq);
    2.11 +#endif /* CONFIG_XEN */
    2.12   again:
    2.13  	pos = find_first_zero_bit(ia64_vector_mask, IA64_NUM_DEVICE_VECTORS);
    2.14  	vector = IA64_FIRST_DEVICE_VECTOR + pos;
     3.1 --- a/linux-2.6-xen-sparse/include/asm-ia64/iosapic.h	Fri Apr 21 08:56:34 2006 -0600
     3.2 +++ b/linux-2.6-xen-sparse/include/asm-ia64/iosapic.h	Fri Apr 21 09:03:19 2006 -0600
     3.3 @@ -53,6 +53,7 @@
     3.4  
     3.5  #define NR_IOSAPICS			256
     3.6  
     3.7 +#ifndef CONFIG_XEN
     3.8  static inline unsigned int iosapic_read(char __iomem *iosapic, unsigned int reg)
     3.9  {
    3.10  	writel(reg, iosapic + IOSAPIC_REG_SELECT);
    3.11 @@ -64,6 +65,7 @@ static inline void iosapic_write(char __
    3.12  	writel(reg, iosapic + IOSAPIC_REG_SELECT);
    3.13  	writel(val, iosapic + IOSAPIC_WINDOW);
    3.14  }
    3.15 +#endif
    3.16  
    3.17  static inline void iosapic_eoi(char __iomem *iosapic, u32 vector)
    3.18  {
     4.1 --- a/xen/arch/ia64/linux-xen/iosapic.c	Fri Apr 21 08:56:34 2006 -0600
     4.2 +++ b/xen/arch/ia64/linux-xen/iosapic.c	Fri Apr 21 09:03:19 2006 -0600
     4.3 @@ -1118,3 +1118,114 @@ static int __init iosapic_enable_kmalloc
     4.4  	return 0;
     4.5  }
     4.6  core_initcall (iosapic_enable_kmalloc);
     4.7 +
     4.8 +#ifdef XEN
     4.9 +/* nop for now */
    4.10 +void set_irq_affinity_info(unsigned int irq, int hwid, int redir) {}
    4.11 +
    4.12 +static int iosapic_physbase_to_id(unsigned long physbase)
    4.13 +{
    4.14 +	int i;
    4.15 +	unsigned long addr = physbase | __IA64_UNCACHED_OFFSET;
    4.16 +
    4.17 +	for (i = 0; i < NR_IOSAPICS; i++) {
    4.18 +	    if ((unsigned long)(iosapic_lists[i].addr) == addr)
    4.19 +		return i;
    4.20 +	}
    4.21 +
    4.22 +	return -1;
    4.23 +}
    4.24 +
    4.25 +int iosapic_guest_read(unsigned long physbase, unsigned int reg, u32 *pval)
    4.26 +{
    4.27 +	int id;
    4.28 +	unsigned long flags;
    4.29 +
    4.30 +	if ((id = (iosapic_physbase_to_id(physbase))) < 0)
    4.31 +	    return id;
    4.32 +
    4.33 +	spin_lock_irqsave(&iosapic_lock, flags);
    4.34 +	*pval = iosapic_read(iosapic_lists[id].addr, reg);
    4.35 +	spin_unlock_irqrestore(&iosapic_lock, flags);
    4.36 +
    4.37 +	return 0;
    4.38 +}
    4.39 +
    4.40 +int iosapic_guest_write(unsigned long physbase, unsigned int reg, u32 val)
    4.41 +{
    4.42 +	unsigned int id, gsi, vec, dest, high32;
    4.43 +	char rte_index;
    4.44 +	struct iosapic *ios;
    4.45 +	struct iosapic_intr_info *info;
    4.46 +	struct rte_entry rte;
    4.47 +	unsigned long flags;
    4.48 +
    4.49 +	if ((id = (iosapic_physbase_to_id(physbase))) < 0)
    4.50 +	    return -EINVAL;
    4.51 +	ios = &iosapic_lists[id];
    4.52 +
    4.53 +	/* Only handle first half of RTE update */
    4.54 +	if ((reg < 0x10) || (reg & 1))
    4.55 +	    return 0;
    4.56 +
    4.57 +	rte.val = val;
    4.58 +	rte_index = IOSAPIC_RTEINDEX(reg);
    4.59 +	vec = rte.lo.vector;
    4.60 +#if 0
    4.61 +	/* Take PMI/NMI/INIT/EXTINT handled by xen */ 
    4.62 +	if (rte.delivery_mode > IOSAPIC_LOWEST_PRIORITY) {
    4.63 +	    printk("Attempt to write IOSAPIC dest mode owned by xen!\n");
    4.64 +	    printk("IOSAPIC/PIN = (%d/%d), lo = 0x%x\n",
    4.65 +		id, rte_index, val);
    4.66 +	    return -EINVAL;
    4.67 +	}
    4.68 +#endif
    4.69 +
    4.70 +	/* Sanity check. Vector should be allocated before this update */
    4.71 +	if ((rte_index > ios->num_rte) ||
    4.72 +	    ((vec > IA64_FIRST_DEVICE_VECTOR) &&
    4.73 +	     (vec < IA64_LAST_DEVICE_VECTOR) &&
    4.74 +	     (!test_bit(vec - IA64_FIRST_DEVICE_VECTOR, ia64_vector_mask))))
    4.75 +	    return -EINVAL;
    4.76 +
    4.77 +	gsi = ios->gsi_base + rte_index;
    4.78 +	info = &iosapic_intr_info[vec];
    4.79 +	spin_lock_irqsave(&irq_descp(vec)->lock, flags);
    4.80 +	spin_lock(&iosapic_lock);
    4.81 +	if (!gsi_vector_to_rte(gsi, vec)) {
    4.82 +	    register_intr(gsi, vec, IOSAPIC_LOWEST_PRIORITY,
    4.83 +		rte.lo.polarity, rte.lo.trigger);
    4.84 +	} else if (vector_is_shared(vec)) {
    4.85 +	    if ((info->trigger != rte.lo.trigger) ||
    4.86 +		(info->polarity != rte.lo.polarity)) {
    4.87 +		printk("WARN: can't override shared interrupt vec\n");
    4.88 +	        printk("IOSAPIC/PIN = (%d/%d), ori = 0x%x, new = 0x%x\n",
    4.89 +			id, rte_index, info->low32, rte.val);
    4.90 +		spin_unlock(&iosapic_lock);
    4.91 +		spin_unlock_irqrestore(&irq_descp(vec)->lock, flags);
    4.92 +		return -EINVAL;
    4.93 +	    }
    4.94 +
    4.95 +	    /* If the vector is shared and already unmasked for other
    4.96 +	     * interrupt sources, don't mask it.
    4.97 +	     *
    4.98 +	     * Same check may also apply to single gsi pin, which may
    4.99 +	     * be shared by devices belonging to different domain. But
   4.100 +	     * let's see how to act later on demand.
   4.101 +	     */
   4.102 +	    if (!(info->low32 & IOSAPIC_MASK))
   4.103 +		rte.lo.mask = 0;
   4.104 +	}
   4.105 +
   4.106 +	/* time to update physical RTE */
   4.107 +	dest = cpu_physical_id(smp_processor_id());
   4.108 +	high32 = (dest << IOSAPIC_DEST_SHIFT);
   4.109 +	iosapic_write(iosapic_lists[id].addr, reg + 1, high32);
   4.110 +	iosapic_write(iosapic_lists[id].addr, reg, rte.val);
   4.111 +	info->low32 = rte.val;
   4.112 +	info->dest = dest;
   4.113 +	spin_unlock(&iosapic_lock);
   4.114 +	spin_unlock_irqrestore(&irq_descp(vec)->lock, flags);
   4.115 +	return 0;
   4.116 +}
   4.117 +#endif /* XEN */
     5.1 --- a/xen/arch/ia64/linux-xen/irq_ia64.c	Fri Apr 21 08:56:34 2006 -0600
     5.2 +++ b/xen/arch/ia64/linux-xen/irq_ia64.c	Fri Apr 21 09:03:19 2006 -0600
     5.3 @@ -60,7 +60,11 @@ void __iomem *ipi_base_addr = ((void __i
     5.4  };
     5.5  EXPORT_SYMBOL(isa_irq_to_vector_map);
     5.6  
     5.7 +#ifdef XEN
     5.8 +unsigned long ia64_vector_mask[BITS_TO_LONGS(IA64_NUM_DEVICE_VECTORS)];
     5.9 +#else
    5.10  static unsigned long ia64_vector_mask[BITS_TO_LONGS(IA64_NUM_DEVICE_VECTORS)];
    5.11 +#endif
    5.12  
    5.13  int
    5.14  assign_irq_vector (int irq)
     6.1 --- a/xen/arch/ia64/xen/acpi.c	Fri Apr 21 08:56:34 2006 -0600
     6.2 +++ b/xen/arch/ia64/xen/acpi.c	Fri Apr 21 09:03:19 2006 -0600
     6.3 @@ -44,7 +44,7 @@
     6.4  #include <linux/efi.h>
     6.5  #include <linux/mmzone.h>
     6.6  #include <asm/io.h>
     6.7 -//#include <asm/iosapic.h>
     6.8 +#include <asm/iosapic.h>
     6.9  #include <asm/machvec.h>
    6.10  #include <asm/page.h>
    6.11  #include <asm/system.h>
    6.12 @@ -121,9 +121,7 @@ acpi_get_sysname (void)
    6.13  #ifdef CONFIG_ACPI_BOOT
    6.14  
    6.15  #define ACPI_MAX_PLATFORM_INTERRUPTS	256
    6.16 -#define NR_IOSAPICS 4
    6.17  
    6.18 -#if 0
    6.19  /* Array to record platform interrupt vectors for generic interrupt routing. */
    6.20  int platform_intr_list[ACPI_MAX_PLATFORM_INTERRUPTS] = {
    6.21  	[0 ... ACPI_MAX_PLATFORM_INTERRUPTS - 1] = -1
    6.22 @@ -147,7 +145,7 @@ acpi_request_vector (u32 int_type)
    6.23  		printk(KERN_ERR "acpi_request_vector(): invalid interrupt type\n");
    6.24  	return vector;
    6.25  }
    6.26 -#endif
    6.27 +
    6.28  char *
    6.29  __acpi_map_table (unsigned long phys_addr, unsigned long size)
    6.30  {
    6.31 @@ -253,9 +251,7 @@ acpi_parse_iosapic (acpi_table_entry_hea
    6.32  
    6.33  	acpi_table_print_madt_entry(header);
    6.34  
    6.35 -#if 0
    6.36  	iosapic_init(iosapic->address, iosapic->global_irq_base);
    6.37 -#endif
    6.38  
    6.39  	return 0;
    6.40  }
    6.41 @@ -265,9 +261,7 @@ acpi_parse_plat_int_src (
    6.42  	acpi_table_entry_header *header, const unsigned long end)
    6.43  {
    6.44  	struct acpi_table_plat_int_src *plintsrc;
    6.45 -#if 0
    6.46  	int vector;
    6.47 -#endif
    6.48  
    6.49  	plintsrc = (struct acpi_table_plat_int_src *) header;
    6.50  
    6.51 @@ -276,7 +270,6 @@ acpi_parse_plat_int_src (
    6.52  
    6.53  	acpi_table_print_madt_entry(header);
    6.54  
    6.55 -#if 0
    6.56  	/*
    6.57  	 * Get vector assignment for this interrupt, set attributes,
    6.58  	 * and program the IOSAPIC routing table.
    6.59 @@ -290,7 +283,6 @@ acpi_parse_plat_int_src (
    6.60  						(plintsrc->flags.trigger == 1) ? IOSAPIC_EDGE : IOSAPIC_LEVEL);
    6.61  
    6.62  	platform_intr_list[plintsrc->type] = vector;
    6.63 -#endif
    6.64  	return 0;
    6.65  }
    6.66  
    6.67 @@ -308,11 +300,9 @@ acpi_parse_int_src_ovr (
    6.68  
    6.69  	acpi_table_print_madt_entry(header);
    6.70  
    6.71 -#if 0
    6.72  	iosapic_override_isa_irq(p->bus_irq, p->global_irq,
    6.73  				 (p->flags.polarity == 1) ? IOSAPIC_POL_HIGH : IOSAPIC_POL_LOW,
    6.74  				 (p->flags.trigger == 1) ? IOSAPIC_EDGE : IOSAPIC_LEVEL);
    6.75 -#endif
    6.76  	return 0;
    6.77  }
    6.78  
    6.79 @@ -364,9 +354,7 @@ acpi_parse_madt (unsigned long phys_addr
    6.80  #else
    6.81  	has_8259 = acpi_madt->flags.pcat_compat;
    6.82  #endif
    6.83 -#if 0
    6.84  	iosapic_system_init(has_8259);
    6.85 -#endif
    6.86  
    6.87  	/* Get base address of IPI Message Block */
    6.88  
     7.1 --- a/xen/arch/ia64/xen/hypercall.c	Fri Apr 21 08:56:34 2006 -0600
     7.2 +++ b/xen/arch/ia64/xen/hypercall.c	Fri Apr 21 09:03:19 2006 -0600
     7.3 @@ -21,8 +21,12 @@
     7.4  #include <public/event_channel.h>
     7.5  #include <public/memory.h>
     7.6  #include <public/sched.h>
     7.7 +#include <xen/irq.h>
     7.8 +#include <asm/hw_irq.h>
     7.9 +#include <public/physdev.h>
    7.10  
    7.11  extern unsigned long translate_domain_mpaddr(unsigned long);
    7.12 +static long do_physdev_op(GUEST_HANDLE(physdev_op_t) uop);
    7.13  /* FIXME: where these declarations should be there ? */
    7.14  extern int dump_privop_counts_to_user(char *, int);
    7.15  extern int zero_privop_counts_to_user(char *, int);
    7.16 @@ -51,7 +55,7 @@ hypercall_t ia64_hypercall_table[] =
    7.17  	(hypercall_t)do_event_channel_op,
    7.18  	(hypercall_t)do_xen_version,
    7.19  	(hypercall_t)do_console_io,
    7.20 -	(hypercall_t)do_ni_hypercall,           /* do_physdev_op */
    7.21 +	(hypercall_t)do_physdev_op,          	/* do_physdev_op */
    7.22  	(hypercall_t)do_grant_table_op,						/* 20 */
    7.23  	(hypercall_t)do_ni_hypercall,		/* do_vm_assist */
    7.24  	(hypercall_t)do_ni_hypercall,		/* do_update_va_mapping_otherdomain */
    7.25 @@ -89,6 +93,11 @@ xen_hypercall (struct pt_regs *regs)
    7.26  		regs->r8 = do_event_channel_op(guest_handle_from_ptr(regs->r14, evtchn_op_t));
    7.27  		break;
    7.28  
    7.29 +	    case __HYPERVISOR_physdev_op:
    7.30 +		regs->r8 = do_physdev_op(guest_handle_from_ptr(regs->r14,
    7.31 +			physdev_op_t));
    7.32 +		break;
    7.33 +
    7.34  	    case __HYPERVISOR_grant_table_op:
    7.35  		regs->r8 = do_grant_table_op((unsigned int) regs->r14,
    7.36  			guest_handle_from_ptr(regs->r15, void),
    7.37 @@ -282,3 +291,80 @@ ia64_hypercall (struct pt_regs *regs)
    7.38  	else
    7.39  	    return xen_hypercall (regs);
    7.40  }
    7.41 +
    7.42 +/* Need make this function common */
    7.43 +extern int
    7.44 +iosapic_guest_read(
    7.45 +    unsigned long physbase, unsigned int reg, u32 *pval);
    7.46 +extern int
    7.47 +iosapic_guest_write(
    7.48 +    unsigned long physbase, unsigned int reg, u32 pval);
    7.49 +
    7.50 +static long do_physdev_op(GUEST_HANDLE(physdev_op_t) uop)
    7.51 +{
    7.52 +    struct physdev_op op;
    7.53 +    long ret;
    7.54 +    int  irq;
    7.55 +
    7.56 +    if ( unlikely(copy_from_guest(&op, uop, 1) != 0) )
    7.57 +        return -EFAULT;
    7.58 +
    7.59 +    switch ( op.cmd )
    7.60 +    {
    7.61 +    case PHYSDEVOP_IRQ_UNMASK_NOTIFY:
    7.62 +        ret = pirq_guest_unmask(current->domain);
    7.63 +        break;
    7.64 +
    7.65 +    case PHYSDEVOP_IRQ_STATUS_QUERY:
    7.66 +        irq = op.u.irq_status_query.irq;
    7.67 +        ret = -EINVAL;
    7.68 +        if ( (irq < 0) || (irq >= NR_IRQS) )
    7.69 +            break;
    7.70 +        op.u.irq_status_query.flags = 0;
    7.71 +        /* Edge-triggered interrupts don't need an explicit unmask downcall. */
    7.72 +        if ( !strstr(irq_desc[irq_to_vector(irq)].handler->typename, "edge") )
    7.73 +            op.u.irq_status_query.flags |= PHYSDEVOP_IRQ_NEEDS_UNMASK_NOTIFY;
    7.74 +        ret = 0;
    7.75 +        break;
    7.76 +
    7.77 +    case PHYSDEVOP_APIC_READ:
    7.78 +        ret = -EPERM;
    7.79 +        if ( !IS_PRIV(current->domain) )
    7.80 +            break;
    7.81 +        ret = iosapic_guest_read(
    7.82 +            op.u.apic_op.apic_physbase,
    7.83 +            op.u.apic_op.reg,
    7.84 +            &op.u.apic_op.value);
    7.85 +        break;
    7.86 +
    7.87 +    case PHYSDEVOP_APIC_WRITE:
    7.88 +        ret = -EPERM;
    7.89 +        if ( !IS_PRIV(current->domain) )
    7.90 +            break;
    7.91 +        ret = iosapic_guest_write(
    7.92 +            op.u.apic_op.apic_physbase,
    7.93 +            op.u.apic_op.reg,
    7.94 +            op.u.apic_op.value);
    7.95 +        break;
    7.96 +
    7.97 +    case PHYSDEVOP_ASSIGN_VECTOR:
    7.98 +        if ( !IS_PRIV(current->domain) )
    7.99 +            return -EPERM;
   7.100 +
   7.101 +        if ( (irq = op.u.irq_op.irq) >= NR_IRQS )
   7.102 +            return -EINVAL;
   7.103 +        
   7.104 +        op.u.irq_op.vector = assign_irq_vector(irq);
   7.105 +        ret = 0;
   7.106 +        break;
   7.107 +
   7.108 +    default:
   7.109 +        ret = -EINVAL;
   7.110 +        break;
   7.111 +    }
   7.112 +
   7.113 +    if ( copy_to_guest(uop, &op, 1) )
   7.114 +        ret = -EFAULT;
   7.115 +
   7.116 +    return ret;
   7.117 +}
     8.1 --- a/xen/arch/ia64/xen/irq.c	Fri Apr 21 08:56:34 2006 -0600
     8.2 +++ b/xen/arch/ia64/xen/irq.c	Fri Apr 21 09:03:19 2006 -0600
     8.3 @@ -33,7 +33,6 @@
     8.4  #include <linux/slab.h>
     8.5  #include <linux/ctype.h>
     8.6  #include <linux/init.h>
     8.7 -#include <linux/irq.h>
     8.8  #include <linux/seq_file.h>
     8.9  
    8.10  #include <asm/atomic.h>
    8.11 @@ -44,11 +43,10 @@
    8.12  #include <asm/uaccess.h>
    8.13  #include <asm/pgalloc.h>
    8.14  #include <asm/delay.h>
    8.15 -#include <asm/irq.h>
    8.16 +#include <xen/irq.h>
    8.17 +#include <asm/hw_irq.h>
    8.18  
    8.19  #include <xen/event.h>
    8.20 -#define _irq_desc irq_desc
    8.21 -#define irq_descp(irq) &irq_desc[irq]
    8.22  #define apicid_to_phys_cpu_present(x)	1
    8.23  
    8.24  /*
    8.25 @@ -70,7 +68,7 @@
    8.26  /*
    8.27   * Controller mappings for all interrupt sources:
    8.28   */
    8.29 -irq_desc_t _irq_desc[NR_IRQS] __cacheline_aligned = {
    8.30 +irq_desc_t irq_desc[NR_IRQS] __cacheline_aligned = {
    8.31  	[0 ... NR_IRQS-1] = {
    8.32  		.status = IRQ_DISABLED | IRQ_GUEST,
    8.33  		.handler = &no_irq_type,
     9.1 --- a/xen/include/asm-ia64/linux-xen/asm/iosapic.h	Fri Apr 21 08:56:34 2006 -0600
     9.2 +++ b/xen/include/asm-ia64/linux-xen/asm/iosapic.h	Fri Apr 21 09:03:19 2006 -0600
     9.3 @@ -134,10 +134,30 @@ static inline void list_move(struct list
     9.4  #undef nop
     9.5  #endif
     9.6  
     9.7 -/* nop for now */
     9.8 -static inline void
     9.9 -set_irq_affinity_info(unsigned int irq, int hwid, int redir) {}
    9.10 +struct rte_entry {
    9.11 +    union {
    9.12 +	struct {
    9.13 +	u32	vector		: 8,
    9.14 +		delivery_mode	: 3,
    9.15 +		dest_mode	: 1,	/* always 0 for iosapic */
    9.16 +		delivery_status	: 1,
    9.17 +		polarity	: 1,
    9.18 +		__reserved0	: 1,
    9.19 +		trigger		: 1,
    9.20 +		mask		: 1,
    9.21 +		__reserved1	: 15;
    9.22 +	} lo;
    9.23 +	struct {
    9.24 +	u32	__reserved2	: 16,
    9.25 +		eid		: 8,
    9.26 +		id		: 8;
    9.27 +	} hi;
    9.28 +	u32 val;
    9.29 +    };
    9.30 +};
    9.31  
    9.32 +#define IOSAPIC_RTEINDEX(reg)	(((reg) - 0x10) >> 1)
    9.33 +extern unsigned long ia64_vector_mask[];
    9.34  #endif /* XEN */
    9.35  
    9.36  # endif /* !__ASSEMBLY__ */