ia64/xen-unstable

changeset 1235:d2c1f58f2edd

bitkeeper revision 1.825.4.3 (40642185aZwwgLwBAies8HKAne40aw)

Many files:
Adding physirq support to new Xen upcall interface.
.del-physirq.c~e02f2ea038df07fa:
Delete: xenolinux-2.4.25-sparse/arch/xen/kernel/physirq.c
author kaf24@scramble.cl.cam.ac.uk
date Fri Mar 26 12:26:45 2004 +0000 (2004-03-26)
parents 01aaaa1d5d17
children b651279526f3 ebfb82dc24e2
files .rootkeys xen/common/event_channel.c xen/common/physdev.c xen/include/hypervisor-ifs/dom0_ops.h xen/include/hypervisor-ifs/event_channel.h xen/include/hypervisor-ifs/physdev.h xenolinux-2.4.25-sparse/arch/xen/kernel/Makefile xenolinux-2.4.25-sparse/arch/xen/kernel/evtchn.c xenolinux-2.4.25-sparse/arch/xen/kernel/physirq.c xenolinux-2.4.25-sparse/include/asm-xen/irq.h
line diff
     1.1 --- a/.rootkeys	Fri Mar 26 09:50:35 2004 +0000
     1.2 +++ b/.rootkeys	Fri Mar 26 12:26:45 2004 +0000
     1.3 @@ -641,7 +641,6 @@ 4051db89iiHs38tWGkoW_RukNyaBHw xenolinux
     1.4  4051db8dJYX86ZCLA-WfTW2dAyrehw xenolinux-2.4.25-sparse/arch/xen/kernel/pci-i386.h
     1.5  4051db91BenvDZEMZxQCGkQyJYoG5w xenolinux-2.4.25-sparse/arch/xen/kernel/pci-irq.c
     1.6  4051db95N9N99FjsRwi49YKUNHWI8A xenolinux-2.4.25-sparse/arch/xen/kernel/pci-pc.c
     1.7 -4051db99fbdTHgCpjywPCp7vjLCe7Q xenolinux-2.4.25-sparse/arch/xen/kernel/physirq.c
     1.8  3e5a4e65IGt3WwQDNiL4h-gYWgNTWQ xenolinux-2.4.25-sparse/arch/xen/kernel/process.c
     1.9  3e5a4e66tR-qJMLj3MppcKqmvuI2XQ xenolinux-2.4.25-sparse/arch/xen/kernel/setup.c
    1.10  3e5a4e66fWSTagLGU2P8BGFGRjhDiw xenolinux-2.4.25-sparse/arch/xen/kernel/signal.c
     2.1 --- a/xen/common/event_channel.c	Fri Mar 26 09:50:35 2004 +0000
     2.2 +++ b/xen/common/event_channel.c	Fri Mar 26 12:26:45 2004 +0000
     2.3 @@ -146,7 +146,7 @@ static long evtchn_bind_virq(evtchn_bind
     2.4      int virq = bind->virq;
     2.5      int port;
     2.6  
     2.7 -    if ( virq >= NR_VIRQS )
     2.8 +    if ( virq >= ARRAY_SIZE(p->virq_to_evtchn) )
     2.9          return -EINVAL;
    2.10  
    2.11      spin_lock(&p->event_channel_lock);
    2.12 @@ -177,6 +177,37 @@ static long evtchn_bind_virq(evtchn_bind
    2.13  }
    2.14  
    2.15  
    2.16 +static long evtchn_bind_pirq(evtchn_bind_pirq_t *bind)
    2.17 +{
    2.18 +    struct task_struct *p = current;
    2.19 +    int pirq = bind->pirq;
    2.20 +    int port;
    2.21 +
    2.22 +    if ( pirq >= ARRAY_SIZE(p->pirq_to_evtchn) )
    2.23 +        return -EINVAL;
    2.24 +
    2.25 +    spin_lock(&p->event_channel_lock);
    2.26 +
    2.27 +    if ( ((port = p->pirq_to_evtchn[pirq]) != 0) ||
    2.28 +         ((port = get_free_port(p)) < 0) )
    2.29 +        goto out;
    2.30 +
    2.31 +    p->event_channel[port].state  = ECS_PIRQ;
    2.32 +    p->event_channel[port].u.pirq = pirq;
    2.33 +
    2.34 +    p->pirq_to_evtchn[pirq] = port;
    2.35 +
    2.36 + out:
    2.37 +    spin_unlock(&p->event_channel_lock);
    2.38 +
    2.39 +    if ( port < 0 )
    2.40 +        return port;
    2.41 +
    2.42 +    bind->port = port;
    2.43 +    return 0;
    2.44 +}
    2.45 +
    2.46 +
    2.47  static long __evtchn_close(struct task_struct *p1, int port1)
    2.48  {
    2.49      struct task_struct *p2 = NULL;
    2.50 @@ -396,13 +427,19 @@ long do_event_channel_op(evtchn_op_t *uo
    2.51      {
    2.52      case EVTCHNOP_bind_interdomain:
    2.53          rc = evtchn_bind_interdomain(&op.u.bind_interdomain);
    2.54 -        if ( copy_to_user(uop, &op, sizeof(op)) != 0 )
    2.55 +        if ( (rc == 0) && (copy_to_user(uop, &op, sizeof(op)) != 0) )
    2.56              rc = -EFAULT; /* Cleaning up here would be a mess! */
    2.57          break;
    2.58  
    2.59      case EVTCHNOP_bind_virq:
    2.60          rc = evtchn_bind_virq(&op.u.bind_virq);
    2.61 -        if ( copy_to_user(uop, &op, sizeof(op)) != 0 )
    2.62 +        if ( (rc == 0) && (copy_to_user(uop, &op, sizeof(op)) != 0) )
    2.63 +            rc = -EFAULT; /* Cleaning up here would be a mess! */
    2.64 +        break;
    2.65 +
    2.66 +    case EVTCHNOP_bind_pirq:
    2.67 +        rc = evtchn_bind_pirq(&op.u.bind_pirq);
    2.68 +        if ( (rc == 0) && (copy_to_user(uop, &op, sizeof(op)) != 0) )
    2.69              rc = -EFAULT; /* Cleaning up here would be a mess! */
    2.70          break;
    2.71  
    2.72 @@ -416,7 +453,7 @@ long do_event_channel_op(evtchn_op_t *uo
    2.73  
    2.74      case EVTCHNOP_status:
    2.75          rc = evtchn_status(&op.u.status);
    2.76 -        if ( copy_to_user(uop, &op, sizeof(op)) != 0 )
    2.77 +        if ( (rc == 0) && (copy_to_user(uop, &op, sizeof(op)) != 0) )
    2.78              rc = -EFAULT;
    2.79          break;
    2.80  
     3.1 --- a/xen/common/physdev.c	Fri Mar 26 09:50:35 2004 +0000
     3.2 +++ b/xen/common/physdev.c	Fri Mar 26 12:26:45 2004 +0000
     3.3 @@ -601,7 +601,7 @@ static void end_virt_irq (unsigned int i
     3.4   * - shared interrupts are not allowed for now
     3.5   * - we change the hw_irq handler to something else
     3.6   */
     3.7 -static long pci_request_irq(int irq)
     3.8 +static long pirq_request(int irq)
     3.9  {
    3.10      int err;
    3.11      phys_dev_t *pdev = NULL, *t;
    3.12 @@ -685,7 +685,7 @@ static long pci_request_irq(int irq)
    3.13      return 0;
    3.14  }
    3.15  
    3.16 -static long pci_free_irq(int irq)
    3.17 +long pirq_free(int irq)
    3.18  {
    3.19      phys_dev_t *pdev;
    3.20  
    3.21 @@ -719,55 +719,12 @@ static long pci_free_irq(int irq)
    3.22      return 0;
    3.23  }
    3.24  
    3.25 -static long pci_enable_irq(int irq)
    3.26 -{
    3.27 -    /* XXX not sure we need this */
    3.28 -    /* guest can enable phys_irq event for now */
    3.29 -    return 0;
    3.30 -}
    3.31 -
    3.32 -static long pci_disable_irq(int irq)
    3.33 -{
    3.34 -    /* XXX not sure we need this */
    3.35 -    /* guest can disable phys_irq event for now */
    3.36 -    return 0;
    3.37 -}
    3.38 -
    3.39 -static long pci_finished_irq(int irq)
    3.40 +static long pci_unmask_irq(void)
    3.41  {
    3.42 -    phys_dev_t *pdev;
    3.43 -    
    3.44 -    if ( !(pdev = irqs[irq]) )
    3.45 -    {
    3.46 -        printk("finished_irq called for unregistered irq %d\n", irq);
    3.47 -        return -EINVAL;
    3.48 -    }
    3.49 -   
    3.50 -    if ( pdev->owner != current )
    3.51 -    {
    3.52 -        printk("finished_irq called dom not owning irq %d\n", irq);
    3.53 -        return -EPERM;
    3.54 -    }
    3.55 -
    3.56 -    if ( !test_bit(ST_IRQ_DELIVERED, &pdev->state) )
    3.57 -    {
    3.58 -        printk("finished_irq called for undelivered irq %d\n", irq);
    3.59 -        return -EINVAL;
    3.60 -    }
    3.61 -
    3.62 -#if 0 /* XXX KAF: do we need this? */
    3.63 -    if ( test_bit(irq, &current->shared_info->physirq_pend) )
    3.64 -    {
    3.65 -        printk("finished_irq called for un-acknowleged irq %d\n", irq);        
    3.66 -        return -EINVAL;
    3.67 -    }
    3.68 +#if 0
    3.69 +    clear_bit(ST_IRQ_DELIVERED, &pdev->state);
    3.70 +    pdev->orig_handler->end(irq);
    3.71  #endif
    3.72 -
    3.73 -    clear_bit(ST_IRQ_DELIVERED, &pdev->state);
    3.74 -
    3.75 -    /* call original end handler */
    3.76 -    pdev->orig_handler->end(irq);
    3.77 -
    3.78      return 0;
    3.79  }
    3.80  
    3.81 @@ -786,43 +743,27 @@ long do_physdev_op(physdev_op_t *uop)
    3.82      switch ( op.cmd )
    3.83      {
    3.84      case PHYSDEVOP_CFGREG_READ:
    3.85 -        ret = pci_cfgreg_read (op.u.cfg_read.seg, op.u.cfg_read.bus,
    3.86 -                               op.u.cfg_read.dev, op.u.cfg_read.func,
    3.87 -                               op.u.cfg_read.reg, op.u.cfg_read.len,
    3.88 -                               &op.u.cfg_read.value);
    3.89 +        ret = pci_cfgreg_read(op.u.cfg_read.seg, op.u.cfg_read.bus,
    3.90 +                              op.u.cfg_read.dev, op.u.cfg_read.func,
    3.91 +                              op.u.cfg_read.reg, op.u.cfg_read.len,
    3.92 +                              &op.u.cfg_read.value);
    3.93          break;
    3.94  
    3.95      case PHYSDEVOP_CFGREG_WRITE:
    3.96 -        ret = pci_cfgreg_write (op.u.cfg_write.seg, op.u.cfg_write.bus,
    3.97 -                                op.u.cfg_write.dev, op.u.cfg_write.func,
    3.98 -                                op.u.cfg_write.reg, op.u.cfg_write.len,
    3.99 -                                op.u.cfg_write.value);
   3.100 +        ret = pci_cfgreg_write(op.u.cfg_write.seg, op.u.cfg_write.bus,
   3.101 +                               op.u.cfg_write.dev, op.u.cfg_write.func,
   3.102 +                               op.u.cfg_write.reg, op.u.cfg_write.len,
   3.103 +                               op.u.cfg_write.value);
   3.104          break;
   3.105  
   3.106      case PHYSDEVOP_FIND_IRQ:
   3.107 -        ret = pci_find_irq (op.u.find_irq.seg, op.u.find_irq.bus,
   3.108 -                            op.u.find_irq.dev, op.u.find_irq.func,
   3.109 -                            &op.u.find_irq.irq);
   3.110 -        break;
   3.111 -
   3.112 -    case PHYSDEVOP_REQUEST_IRQ:
   3.113 -        ret = pci_request_irq (op.u.request_irq.irq);
   3.114 +        ret = pci_find_irq(op.u.find_irq.seg, op.u.find_irq.bus,
   3.115 +                           op.u.find_irq.dev, op.u.find_irq.func,
   3.116 +                           &op.u.find_irq.irq);
   3.117          break;
   3.118  
   3.119 -    case PHYSDEVOP_FREE_IRQ:
   3.120 -        ret = pci_free_irq (op.u.free_irq.irq);
   3.121 -        break;
   3.122 -
   3.123 -    case PHYSDEVOP_ENABLE_IRQ:
   3.124 -        ret = pci_enable_irq (op.u.enable_irq.irq);
   3.125 -        break;
   3.126 -
   3.127 -    case PHYSDEVOP_DISABLE_IRQ:
   3.128 -        ret = pci_disable_irq (op.u.disable_irq.irq);
   3.129 -        break;
   3.130 -
   3.131 -    case PHYSDEVOP_FINISHED_IRQ:
   3.132 -        ret = pci_finished_irq (op.u.finished_irq.irq);
   3.133 +    case PHYSDEVOP_UNMASK_IRQ:
   3.134 +        ret = pci_unmask_irq();
   3.135          break;
   3.136  
   3.137      default:
     4.1 --- a/xen/include/hypervisor-ifs/dom0_ops.h	Fri Mar 26 09:50:35 2004 +0000
     4.2 +++ b/xen/include/hypervisor-ifs/dom0_ops.h	Fri Mar 26 12:26:45 2004 +0000
     4.3 @@ -18,7 +18,7 @@
     4.4   * This makes sure that old versions of dom0 tools will stop working in a
     4.5   * well-defined way (rather than crashing the machine, for instance).
     4.6   */
     4.7 -#define DOM0_INTERFACE_VERSION   0xAAAA0009
     4.8 +#define DOM0_INTERFACE_VERSION   0xAAAA000A
     4.9  
    4.10  #define MAX_CMD_LEN       256
    4.11  #define MAX_DOMAIN_NAME    16
     5.1 --- a/xen/include/hypervisor-ifs/event_channel.h	Fri Mar 26 09:50:35 2004 +0000
     5.2 +++ b/xen/include/hypervisor-ifs/event_channel.h	Fri Mar 26 12:26:45 2004 +0000
     5.3 @@ -30,7 +30,7 @@ typedef struct evtchn_bind_interdomain
     5.4   * NOTES:
     5.5   *  1. A virtual IRQ may be bound to at most one event channel per domain.
     5.6   */
     5.7 -#define EVTCHNOP_bind_virq    1
     5.8 +#define EVTCHNOP_bind_virq        1
     5.9  typedef struct evtchn_bind_virq
    5.10  {
    5.11      /* IN parameters. */
    5.12 @@ -40,6 +40,21 @@ typedef struct evtchn_bind_virq
    5.13  } evtchn_bind_virq_t;
    5.14  
    5.15  /*
    5.16 + * EVTCHNOP_bind_pirq: Bind a local event channel to IRQ <irq>.
    5.17 + * NOTES:
    5.18 + *  1. A physical IRQ may be bound to at most one event channel per domain.
    5.19 + *  2. Only a sufficiently-privileged domain may bind to a physical IRQ.
    5.20 + */
    5.21 +#define EVTCHNOP_bind_pirq        2
    5.22 +typedef struct evtchn_bind_pirq
    5.23 +{
    5.24 +    /* IN parameters. */
    5.25 +    int pirq;
    5.26 +    /* OUT parameters. */
    5.27 +    int port;
    5.28 +} evtchn_bind_pirq_t;
    5.29 +
    5.30 +/*
    5.31   * EVTCHNOP_close: Close the communication channel which has an endpoint at
    5.32   * <dom, port>.
    5.33   * NOTES:
    5.34 @@ -47,7 +62,7 @@ typedef struct evtchn_bind_virq
    5.35   *  2. Only a sufficiently-privileged domain may close an event channel
    5.36   *     for which <dom> is not DOMID_SELF.
    5.37   */
    5.38 -#define EVTCHNOP_close            2
    5.39 +#define EVTCHNOP_close            3
    5.40  typedef struct evtchn_close
    5.41  {
    5.42      /* IN parameters. */
    5.43 @@ -60,7 +75,7 @@ typedef struct evtchn_close
    5.44   * EVTCHNOP_send: Send an event to the remote end of the channel whose local
    5.45   * endpoint is <DOMID_SELF, local_port>.
    5.46   */
    5.47 -#define EVTCHNOP_send             3
    5.48 +#define EVTCHNOP_send             4
    5.49  typedef struct evtchn_send
    5.50  {
    5.51      /* IN parameters. */
    5.52 @@ -76,7 +91,7 @@ typedef struct evtchn_send
    5.53   *  2. Only a sufficiently-privileged domain may obtain the status of an event
    5.54   *     channel for which <dom> is not DOMID_SELF.
    5.55   */
    5.56 -#define EVTCHNOP_status           4
    5.57 +#define EVTCHNOP_status           5
    5.58  typedef struct evtchn_status
    5.59  {
    5.60      /* IN parameters */
    5.61 @@ -86,8 +101,8 @@ typedef struct evtchn_status
    5.62  #define EVTCHNSTAT_closed       0  /* Chennel is not in use.                 */
    5.63  #define EVTCHNSTAT_unbound      1  /* Channel is not bound to a source.      */
    5.64  #define EVTCHNSTAT_interdomain  2  /* Channel is connected to remote domain. */
    5.65 -#define EVTCHNSTAT_pirq     3      /* Channel is bound to a phys IRQ line.   */
    5.66 -#define EVTCHNSTAT_virq     4      /* Channel is bound to a virtual IRQ line */
    5.67 +#define EVTCHNSTAT_pirq         3  /* Channel is bound to a phys IRQ line.   */
    5.68 +#define EVTCHNSTAT_virq         4  /* Channel is bound to a virtual IRQ line */
    5.69      int     status;
    5.70      union {
    5.71          int __none;    /* EVTCHNSTAT_closed, EVTCHNSTAT_unbound */
    5.72 @@ -106,6 +121,7 @@ typedef struct evtchn_op
    5.73      union {
    5.74          evtchn_bind_interdomain_t bind_interdomain;
    5.75          evtchn_bind_virq_t        bind_virq;
    5.76 +        evtchn_bind_pirq_t        bind_pirq;
    5.77          evtchn_close_t            close;
    5.78          evtchn_send_t             send;
    5.79          evtchn_status_t           status;
     6.1 --- a/xen/include/hypervisor-ifs/physdev.h	Fri Mar 26 09:50:35 2004 +0000
     6.2 +++ b/xen/include/hypervisor-ifs/physdev.h	Fri Mar 26 12:26:45 2004 +0000
     6.3 @@ -19,11 +19,7 @@
     6.4  #define PHYSDEVOP_CFGREG_READ   0
     6.5  #define PHYSDEVOP_CFGREG_WRITE  1
     6.6  #define PHYSDEVOP_FIND_IRQ      2
     6.7 -#define PHYSDEVOP_REQUEST_IRQ   3
     6.8 -#define PHYSDEVOP_FREE_IRQ      4
     6.9 -#define PHYSDEVOP_ENABLE_IRQ    5
    6.10 -#define PHYSDEVOP_DISABLE_IRQ   6
    6.11 -#define PHYSDEVOP_FINISHED_IRQ  7
    6.12 +#define PHYSDEVOP_UNMASK_IRQ    3
    6.13  
    6.14  /* read pci config */
    6.15  typedef struct physdevop_cfgreg_read_st
    6.16 @@ -32,8 +28,8 @@ typedef struct physdevop_cfgreg_read_st
    6.17      int bus;        /* IN */
    6.18      int dev;        /* IN */
    6.19      int func;       /* IN */
    6.20 -    int reg;        /* IN  */
    6.21 -    int len;        /* IN  */
    6.22 +    int reg;        /* IN */
    6.23 +    int len;        /* IN */
    6.24      u32 value;      /* OUT */
    6.25  } physdevop_cfgreg_read_t;
    6.26  
    6.27 @@ -59,36 +55,6 @@ typedef struct physdevop_find_irq_st
    6.28      u32 irq;      /* OUT */
    6.29  } physdevop_find_irq_t;
    6.30  
    6.31 -/* request physical IRQ to be routed to guest */
    6.32 -typedef struct physdevop_request_irq_st
    6.33 -{
    6.34 -    u32 irq;      /* IN */
    6.35 -} physdevop_request_irq_t;
    6.36 -
    6.37 -/* stop routing physical interrupts to guest */
    6.38 -typedef struct physdevop_free_irq_st
    6.39 -{
    6.40 -    u32 irq;      /* IN */
    6.41 -} physdevop_free_irq_t;
    6.42 -
    6.43 -/* enable IRQ for the caller  */
    6.44 -typedef struct physdevop_enable_irq_st
    6.45 -{
    6.46 -    u32 irq;      /* IN */
    6.47 -} physdevop_enable_irq_t;
    6.48 -
    6.49 -/* disable interrupts */
    6.50 -typedef struct physdevop_disable_irq_st
    6.51 -{
    6.52 -    u32 irq;      /* IN */
    6.53 -} physdevop_disable_irq_t;
    6.54 -
    6.55 -typedef struct physdevop_finished_irq_st
    6.56 -{
    6.57 -    u32 irq;      /* IN */
    6.58 -} physdevop_finished_irq_t;
    6.59 -
    6.60 -
    6.61  typedef struct _physdev_op_st 
    6.62  {
    6.63      unsigned long cmd;
    6.64 @@ -99,11 +65,6 @@ typedef struct _physdev_op_st
    6.65          physdevop_cfgreg_read_t  cfg_read;
    6.66          physdevop_cfgreg_write_t cfg_write;
    6.67          physdevop_find_irq_t     find_irq;
    6.68 -        physdevop_request_irq_t  request_irq;
    6.69 -        physdevop_free_irq_t     free_irq;
    6.70 -        physdevop_enable_irq_t   enable_irq;
    6.71 -        physdevop_disable_irq_t  disable_irq;
    6.72 -        physdevop_finished_irq_t finished_irq;
    6.73      } u;
    6.74  } physdev_op_t;
    6.75  
     7.1 --- a/xenolinux-2.4.25-sparse/arch/xen/kernel/Makefile	Fri Mar 26 09:50:35 2004 +0000
     7.2 +++ b/xenolinux-2.4.25-sparse/arch/xen/kernel/Makefile	Fri Mar 26 12:26:45 2004 +0000
     7.3 @@ -10,7 +10,7 @@ export-objs     := i386_ksyms.o
     7.4  
     7.5  obj-y	:= process.o semaphore.o signal.o entry.o traps.o irq.o  \
     7.6  		ptrace.o ioport.o ldt.o setup.o time.o sys_i386.o \
     7.7 -		i386_ksyms.o i387.o evtchn.o physirq.o pci-dma.o
     7.8 +		i386_ksyms.o i387.o evtchn.o pci-dma.o
     7.9  
    7.10  ifdef CONFIG_PCI
    7.11  obj-y	+= pci-i386.o pci-pc.o pci-irq.o
     8.1 --- a/xenolinux-2.4.25-sparse/arch/xen/kernel/evtchn.c	Fri Mar 26 09:50:35 2004 +0000
     8.2 +++ b/xenolinux-2.4.25-sparse/arch/xen/kernel/evtchn.c	Fri Mar 26 12:26:45 2004 +0000
     8.3 @@ -17,20 +17,23 @@
     8.4  #include <asm/synch_bitops.h>
     8.5  #include <asm/hypervisor.h>
     8.6  #include <asm/hypervisor-ifs/event_channel.h>
     8.7 -
     8.8 -/* Dynamic IRQ <-> event-channel mappings. */
     8.9 -static int evtchn_to_dynirq[1024];
    8.10 -static int dynirq_to_evtchn[NR_IRQS];
    8.11 -
    8.12 -/* Dynamic IRQ <-> VIRQ mapping. */
    8.13 -static int virq_to_dynirq[NR_VIRQS];
    8.14 +#include <asm/hypervisor-ifs/physdev.h>
    8.15  
    8.16  /*
    8.17 - * Reference counts for bindings to dynamic IRQs.
    8.18 - * NB. This array is referenced with respect to DYNIRQ_BASE!
    8.19 + * This lock protects updates to the following mapping and reference-count
    8.20 + * arrays. The lock does not need to be acquired to read the mapping tables.
    8.21   */
    8.22 -static int dynirq_bindcount[NR_DYNIRQS];
    8.23 -static spinlock_t dynirq_lock;
    8.24 +static spinlock_t irq_mapping_update_lock;
    8.25 +
    8.26 +/* IRQ <-> event-channel mappings. */
    8.27 +static int evtchn_to_irq[NR_EVENT_CHANNELS];
    8.28 +static int irq_to_evtchn[NR_IRQS];
    8.29 +
    8.30 +/* IRQ <-> VIRQ mapping. */
    8.31 +static int virq_to_irq[NR_VIRQS];
    8.32 +
    8.33 +/* Reference counts for bindings to IRQs. */
    8.34 +static int irq_bindcount[NR_IRQS];
    8.35  
    8.36  /* Upcall to generic IRQ layer. */
    8.37  extern asmlinkage unsigned int do_IRQ(int irq, struct pt_regs *regs);
    8.38 @@ -39,7 +42,7 @@ static void evtchn_handle_normal(shared_
    8.39  {
    8.40      unsigned long l1, l2;
    8.41      unsigned int  l1i, l2i, port;
    8.42 -    int           dynirq;
    8.43 +    int           irq;
    8.44  
    8.45      l1 = xchg(&s->evtchn_pending_sel, 0);
    8.46      while ( (l1i = ffs(l1)) != 0 )
    8.47 @@ -54,8 +57,8 @@ static void evtchn_handle_normal(shared_
    8.48              l2 &= ~(1 << l2i);
    8.49              
    8.50              port = (l1i << 5) + l2i;
    8.51 -            if ( (dynirq = evtchn_to_dynirq[port]) != -1 )
    8.52 -                do_IRQ(dynirq + DYNIRQ_BASE, regs);
    8.53 +            if ( (irq = evtchn_to_irq[port]) != -1 )
    8.54 +                do_IRQ(irq, regs);
    8.55              else
    8.56                  evtchn_device_upcall(port, 0);
    8.57          }
    8.58 @@ -66,7 +69,7 @@ static void evtchn_handle_exceptions(sha
    8.59  {
    8.60      unsigned long l1, l2;
    8.61      unsigned int  l1i, l2i, port;
    8.62 -    int           dynirq;
    8.63 +    int           irq;
    8.64  
    8.65      l1 = xchg(&s->evtchn_exception_sel, 0);
    8.66      while ( (l1i = ffs(l1)) != 0 )
    8.67 @@ -81,10 +84,9 @@ static void evtchn_handle_exceptions(sha
    8.68              l2 &= ~(1 << l2i);
    8.69              
    8.70              port = (l1i << 5) + l2i;
    8.71 -            if ( (dynirq = evtchn_to_dynirq[port]) != -1 )
    8.72 +            if ( (irq = evtchn_to_irq[port]) != -1 )
    8.73              {
    8.74 -                printk(KERN_ALERT "Error on IRQ line %d!\n", 
    8.75 -                       dynirq + DYNIRQ_BASE);
    8.76 +                printk(KERN_ALERT "Error on IRQ line %d!\n", irq);
    8.77                  synch_clear_bit(port, &s->evtchn_exception[0]);
    8.78              }
    8.79              else
    8.80 @@ -112,28 +114,28 @@ void evtchn_do_upcall(struct pt_regs *re
    8.81  }
    8.82  
    8.83  
    8.84 -static int find_unbound_dynirq(void)
    8.85 +static int find_unbound_irq(void)
    8.86  {
    8.87 -    int i;
    8.88 +    int irq;
    8.89  
    8.90 -    for ( i = 0; i < NR_DYNIRQS; i++ )
    8.91 -        if ( dynirq_bindcount[i] == 0 )
    8.92 +    for ( irq = 0; irq < NR_IRQS; irq++ )
    8.93 +        if ( irq_bindcount[irq] == 0 )
    8.94              break;
    8.95  
    8.96 -    if ( i == NR_DYNIRQS )
    8.97 +    if ( irq == NR_IRQS )
    8.98          BUG();
    8.99  
   8.100 -    return i;
   8.101 +    return irq;
   8.102  }
   8.103  
   8.104  int bind_virq_to_irq(int virq)
   8.105  {
   8.106      evtchn_op_t op;
   8.107 -    int evtchn, dynirq;
   8.108 +    int evtchn, irq;
   8.109  
   8.110 -    spin_lock(&dynirq_lock);
   8.111 +    spin_lock(&irq_mapping_update_lock);
   8.112  
   8.113 -    if ( (dynirq = virq_to_dynirq[virq]) == -1 )
   8.114 +    if ( (irq = virq_to_irq[virq]) == -1 )
   8.115      {
   8.116          op.cmd              = EVTCHNOP_bind_virq;
   8.117          op.u.bind_virq.virq = virq;
   8.118 @@ -141,29 +143,29 @@ int bind_virq_to_irq(int virq)
   8.119              BUG();
   8.120          evtchn = op.u.bind_virq.port;
   8.121  
   8.122 -        dynirq = find_unbound_dynirq();
   8.123 -        evtchn_to_dynirq[evtchn] = dynirq;
   8.124 -        dynirq_to_evtchn[dynirq] = evtchn;
   8.125 +        irq = find_unbound_irq();
   8.126 +        evtchn_to_irq[evtchn] = irq;
   8.127 +        irq_to_evtchn[irq]    = evtchn;
   8.128  
   8.129 -        virq_to_dynirq[virq] = dynirq;
   8.130 +        virq_to_irq[virq] = irq;
   8.131      }
   8.132  
   8.133 -    dynirq_bindcount[dynirq]++;
   8.134 +    irq_bindcount[irq]++;
   8.135  
   8.136 -    spin_unlock(&dynirq_lock);
   8.137 +    spin_unlock(&irq_mapping_update_lock);
   8.138      
   8.139 -    return dynirq + DYNIRQ_BASE;
   8.140 +    return irq;
   8.141  }
   8.142  
   8.143  void unbind_virq_from_irq(int virq)
   8.144  {
   8.145      evtchn_op_t op;
   8.146 -    int dynirq = virq_to_dynirq[virq];
   8.147 -    int evtchn = dynirq_to_evtchn[dynirq];
   8.148 +    int irq    = virq_to_irq[virq];
   8.149 +    int evtchn = irq_to_evtchn[irq];
   8.150  
   8.151 -    spin_lock(&dynirq_lock);
   8.152 +    spin_lock(&irq_mapping_update_lock);
   8.153  
   8.154 -    if ( --dynirq_bindcount[dynirq] == 0 )
   8.155 +    if ( --irq_bindcount[irq] == 0 )
   8.156      {
   8.157          op.cmd          = EVTCHNOP_close;
   8.158          op.u.close.dom  = DOMID_SELF;
   8.159 @@ -171,47 +173,47 @@ void unbind_virq_from_irq(int virq)
   8.160          if ( HYPERVISOR_event_channel_op(&op) != 0 )
   8.161              BUG();
   8.162  
   8.163 -        evtchn_to_dynirq[evtchn] = -1;
   8.164 -        dynirq_to_evtchn[dynirq] = -1;
   8.165 -        virq_to_dynirq[virq]     = -1;
   8.166 +        evtchn_to_irq[evtchn] = -1;
   8.167 +        irq_to_evtchn[irq]    = -1;
   8.168 +        virq_to_irq[virq]     = -1;
   8.169      }
   8.170  
   8.171 -    spin_unlock(&dynirq_lock);
   8.172 +    spin_unlock(&irq_mapping_update_lock);
   8.173  }
   8.174  
   8.175  int bind_evtchn_to_irq(int evtchn)
   8.176  {
   8.177 -    int dynirq;
   8.178 +    int irq;
   8.179  
   8.180 -    spin_lock(&dynirq_lock);
   8.181 +    spin_lock(&irq_mapping_update_lock);
   8.182  
   8.183 -    if ( (dynirq = evtchn_to_dynirq[evtchn]) == -1 )
   8.184 +    if ( (irq = evtchn_to_irq[evtchn]) == -1 )
   8.185      {
   8.186 -        dynirq = find_unbound_dynirq();
   8.187 -        evtchn_to_dynirq[evtchn] = dynirq;
   8.188 -        dynirq_to_evtchn[dynirq] = evtchn;
   8.189 +        irq = find_unbound_irq();
   8.190 +        evtchn_to_irq[evtchn] = irq;
   8.191 +        irq_to_evtchn[irq]    = evtchn;
   8.192      }
   8.193  
   8.194 -    dynirq_bindcount[dynirq]++;
   8.195 +    irq_bindcount[irq]++;
   8.196  
   8.197 -    spin_unlock(&dynirq_lock);
   8.198 +    spin_unlock(&irq_mapping_update_lock);
   8.199      
   8.200 -    return dynirq + DYNIRQ_BASE;
   8.201 +    return irq;
   8.202  }
   8.203  
   8.204  void unbind_evtchn_from_irq(int evtchn)
   8.205  {
   8.206 -    int dynirq = evtchn_to_dynirq[evtchn];
   8.207 +    int irq = evtchn_to_irq[evtchn];
   8.208  
   8.209 -    spin_lock(&dynirq_lock);
   8.210 +    spin_lock(&irq_mapping_update_lock);
   8.211  
   8.212 -    if ( --dynirq_bindcount[dynirq] == 0 )
   8.213 +    if ( --irq_bindcount[irq] == 0 )
   8.214      {
   8.215 -        evtchn_to_dynirq[evtchn] = -1;
   8.216 -        dynirq_to_evtchn[dynirq] = -1;
   8.217 +        evtchn_to_irq[evtchn] = -1;
   8.218 +        irq_to_evtchn[irq]    = -1;
   8.219      }
   8.220  
   8.221 -    spin_unlock(&dynirq_lock);
   8.222 +    spin_unlock(&irq_mapping_update_lock);
   8.223  }
   8.224  
   8.225  
   8.226 @@ -221,41 +223,35 @@ void unbind_evtchn_from_irq(int evtchn)
   8.227  
   8.228  static unsigned int startup_dynirq(unsigned int irq)
   8.229  {
   8.230 -    int dynirq = irq - DYNIRQ_BASE;
   8.231 -    unmask_evtchn(dynirq_to_evtchn[dynirq]);
   8.232 +    unmask_evtchn(irq_to_evtchn[irq]);
   8.233      return 0;
   8.234  }
   8.235  
   8.236  static void shutdown_dynirq(unsigned int irq)
   8.237  {
   8.238 -    int dynirq = irq - DYNIRQ_BASE;
   8.239 -    mask_evtchn(dynirq_to_evtchn[dynirq]);
   8.240 +    mask_evtchn(irq_to_evtchn[irq]);
   8.241  }
   8.242  
   8.243  static void enable_dynirq(unsigned int irq)
   8.244  {
   8.245 -    int dynirq = irq - DYNIRQ_BASE;
   8.246 -    unmask_evtchn(dynirq_to_evtchn[dynirq]);
   8.247 +    unmask_evtchn(irq_to_evtchn[irq]);
   8.248  }
   8.249  
   8.250  static void disable_dynirq(unsigned int irq)
   8.251  {
   8.252 -    int dynirq = irq - DYNIRQ_BASE;
   8.253 -    mask_evtchn(dynirq_to_evtchn[dynirq]);
   8.254 +    mask_evtchn(irq_to_evtchn[irq]);
   8.255  }
   8.256  
   8.257  static void ack_dynirq(unsigned int irq)
   8.258  {
   8.259 -    int dynirq = irq - DYNIRQ_BASE;
   8.260 -    mask_evtchn(dynirq_to_evtchn[dynirq]);
   8.261 -    clear_evtchn(dynirq_to_evtchn[dynirq]);
   8.262 +    mask_evtchn(irq_to_evtchn[irq]);
   8.263 +    clear_evtchn(irq_to_evtchn[irq]);
   8.264  }
   8.265  
   8.266  static void end_dynirq(unsigned int irq)
   8.267  {
   8.268 -    int dynirq = irq - DYNIRQ_BASE;
   8.269      if ( !(irq_desc[irq].status & IRQ_DISABLED) )
   8.270 -        unmask_evtchn(dynirq_to_evtchn[dynirq]);
   8.271 +        unmask_evtchn(irq_to_evtchn[irq]);
   8.272  }
   8.273  
   8.274  static struct hw_interrupt_type dynirq_type = {
   8.275 @@ -269,6 +265,87 @@ static struct hw_interrupt_type dynirq_t
   8.276      NULL
   8.277  };
   8.278  
   8.279 +static inline void pirq_unmask_notify(int pirq)
   8.280 +{
   8.281 +    physdev_op_t op;
   8.282 +    op.cmd = PHYSDEVOP_UNMASK_IRQ;
   8.283 +    (void)HYPERVISOR_physdev_op(&op);
   8.284 +}
   8.285 +
   8.286 +static unsigned int startup_pirq(unsigned int irq)
   8.287 +{
   8.288 +    evtchn_op_t op;
   8.289 +    int evtchn;
   8.290 +
   8.291 +    op.cmd              = EVTCHNOP_bind_pirq;
   8.292 +    op.u.bind_pirq.pirq = irq;
   8.293 +    if ( HYPERVISOR_event_channel_op(&op) != 0 )
   8.294 +        BUG();
   8.295 +    evtchn = op.u.bind_virq.port;
   8.296 +
   8.297 +    evtchn_to_irq[evtchn] = irq;
   8.298 +    irq_to_evtchn[irq]    = evtchn;
   8.299 +
   8.300 +    unmask_evtchn(evtchn);
   8.301 +    pirq_unmask_notify(irq_to_pirq(irq));
   8.302 +
   8.303 +    return 0;
   8.304 +}
   8.305 +
   8.306 +static void shutdown_pirq(unsigned int irq)
   8.307 +{
   8.308 +    evtchn_op_t op;
   8.309 +    int evtchn = irq_to_evtchn[irq];
   8.310 +
   8.311 +    mask_evtchn(evtchn);
   8.312 +
   8.313 +    op.cmd          = EVTCHNOP_close;
   8.314 +    op.u.close.dom  = DOMID_SELF;
   8.315 +    op.u.close.port = evtchn;
   8.316 +    if ( HYPERVISOR_event_channel_op(&op) != 0 )
   8.317 +        BUG();
   8.318 +
   8.319 +    evtchn_to_irq[evtchn] = -1;
   8.320 +    irq_to_evtchn[irq]    = -1;
   8.321 +}
   8.322 +
   8.323 +static void enable_pirq(unsigned int irq)
   8.324 +{
   8.325 +    unmask_evtchn(irq_to_evtchn[irq]);
   8.326 +    pirq_unmask_notify(irq_to_pirq(irq));
   8.327 +}
   8.328 +
   8.329 +static void disable_pirq(unsigned int irq)
   8.330 +{
   8.331 +    mask_evtchn(irq_to_evtchn[irq]);
   8.332 +}
   8.333 +
   8.334 +static void ack_pirq(unsigned int irq)
   8.335 +{
   8.336 +    mask_evtchn(irq_to_evtchn[irq]);
   8.337 +    clear_evtchn(irq_to_evtchn[irq]);
   8.338 +}
   8.339 +
   8.340 +static void end_pirq(unsigned int irq)
   8.341 +{
   8.342 +    if ( !(irq_desc[irq].status & IRQ_DISABLED) )
   8.343 +    {
   8.344 +        unmask_evtchn(irq_to_evtchn[irq]);
   8.345 +        pirq_unmask_notify(irq_to_pirq(irq));
   8.346 +    }
   8.347 +}
   8.348 +
   8.349 +static struct hw_interrupt_type pirq_type = {
   8.350 +    "Phys-irq",
   8.351 +    startup_pirq,
   8.352 +    shutdown_pirq,
   8.353 +    enable_pirq,
   8.354 +    disable_pirq,
   8.355 +    ack_pirq,
   8.356 +    end_pirq,
   8.357 +    NULL
   8.358 +};
   8.359 +
   8.360  static void error_interrupt(int irq, void *dev_id, struct pt_regs *regs)
   8.361  {
   8.362      printk(KERN_ALERT "unexpected VIRQ_ERROR trap to vector %d\n", irq);
   8.363 @@ -287,32 +364,41 @@ void __init init_IRQ(void)
   8.364  {
   8.365      int i;
   8.366  
   8.367 +    spin_lock_init(&irq_mapping_update_lock);
   8.368 +
   8.369 +    /* No VIRQ -> IRQ mappings. */
   8.370      for ( i = 0; i < NR_VIRQS; i++ )
   8.371 -        virq_to_dynirq[i] = -1;
   8.372 +        virq_to_irq[i] = -1;
   8.373  
   8.374 -    for ( i = 0; i < 1024; i++ )
   8.375 -        evtchn_to_dynirq[i] = -1;
   8.376 +    /* No event-channel -> IRQ mappings. */
   8.377 +    for ( i = 0; i < NR_EVENT_CHANNELS; i++ )
   8.378 +        evtchn_to_irq[i] = -1;
   8.379 +
   8.380 +    /* No IRQ -> event-channel mappings. */
   8.381 +    for ( i = 0; i < NR_IRQS; i++ )
   8.382 +        irq_to_evtchn[i] = -1;
   8.383  
   8.384      for ( i = 0; i < NR_DYNIRQS; i++ )
   8.385      {
   8.386 -        dynirq_to_evtchn[i] = -1;
   8.387 -        dynirq_bindcount[i] = 0;
   8.388 +        /* Dynamic IRQ space is currently unbound. Zero the refcnts. */
   8.389 +        irq_bindcount[dynirq_to_irq(i)] = 0;
   8.390 +
   8.391 +        irq_desc[dynirq_to_irq(i)].status  = IRQ_DISABLED;
   8.392 +        irq_desc[dynirq_to_irq(i)].action  = 0;
   8.393 +        irq_desc[dynirq_to_irq(i)].depth   = 1;
   8.394 +        irq_desc[dynirq_to_irq(i)].handler = &dynirq_type;
   8.395      }
   8.396  
   8.397 -    spin_lock_init(&dynirq_lock);
   8.398 -
   8.399 -    for ( i = 0; i < NR_DYNIRQS; i++ )
   8.400 +    for ( i = 0; i < NR_PIRQS; i++ )
   8.401      {
   8.402 -        irq_desc[i + DYNIRQ_BASE].status  = IRQ_DISABLED;
   8.403 -        irq_desc[i + DYNIRQ_BASE].action  = 0;
   8.404 -        irq_desc[i + DYNIRQ_BASE].depth   = 1;
   8.405 -        irq_desc[i + DYNIRQ_BASE].handler = &dynirq_type;
   8.406 +        /* Phys IRQ space is statically bound (1:1 mapping). Nail refcnts. */
   8.407 +        irq_bindcount[pirq_to_irq(i)] = 1;
   8.408 +
   8.409 +        irq_desc[pirq_to_irq(i)].status  = IRQ_DISABLED;
   8.410 +        irq_desc[pirq_to_irq(i)].action  = 0;
   8.411 +        irq_desc[pirq_to_irq(i)].depth   = 1;
   8.412 +        irq_desc[pirq_to_irq(i)].handler = &pirq_type;
   8.413      }
   8.414  
   8.415      (void)setup_irq(bind_virq_to_irq(VIRQ_ERROR), &error_action);
   8.416 -    
   8.417 -#ifdef CONFIG_PCI
   8.418 -    /* Also initialise the physical IRQ handlers. */
   8.419 -    physirq_init();
   8.420 -#endif
   8.421  }
     9.1 --- a/xenolinux-2.4.25-sparse/arch/xen/kernel/physirq.c	Fri Mar 26 09:50:35 2004 +0000
     9.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.3 @@ -1,175 +0,0 @@
     9.4 -/* -*-  Mode:C; c-basic-offset:4; tab-width:4 -*-
     9.5 - ****************************************************************************
     9.6 - * (C) 2004 - Rolf Neugebauer - Intel Research Cambridge
     9.7 - ****************************************************************************
     9.8 - *
     9.9 - *        File: physirq.c
    9.10 - *      Author: Rolf Neugebauer (rolf.neugebauer@intel.com)
    9.11 - *        Date: Mar 2004
    9.12 - * 
    9.13 - * Description: guests may receive virtual interrupts directly 
    9.14 - *              corresponding to physical interrupts. these virtual
    9.15 - *              interrupts require special handling provided 
    9.16 - *              by the virq irq type.
    9.17 - */
    9.18 -
    9.19 -#ifdef CONFIG_PCI
    9.20 -
    9.21 -#include <linux/config.h>
    9.22 -#include <asm/atomic.h>
    9.23 -#include <asm/irq.h>
    9.24 -#include <asm/hypervisor.h>
    9.25 -#include <asm/system.h>
    9.26 -
    9.27 -#include <linux/irq.h>
    9.28 -#include <linux/sched.h>
    9.29 -
    9.30 -#include <asm/hypervisor-ifs/hypervisor-if.h>
    9.31 -#include <asm/hypervisor-ifs/physdev.h>
    9.32 -
    9.33 -static void physirq_interrupt(int irq, void *unused, struct pt_regs *ptregs);
    9.34 -
    9.35 -static int setup_event_handler = 0;
    9.36 -
    9.37 -static unsigned int startup_physirq_event(unsigned int irq)
    9.38 -{
    9.39 -    physdev_op_t op;
    9.40 -    int err;
    9.41 -
    9.42 -    printk("startup_physirq_event %d\n", irq);
    9.43 -
    9.44 -    /*
    9.45 -     * install a interrupt handler for physirq event when called first time
    9.46 -     * we actually are never executing the handler as _EVENT_PHYSIRQ is 
    9.47 -     * handled specially in hypervisor.c But we need to enable the event etc.
    9.48 -     */
    9.49 -    if ( !setup_event_handler )
    9.50 -    {
    9.51 -        printk("startup_physirq_event %d: setup event handler\n", irq);
    9.52 -        /* set up a event handler to demux virtualised physical interrupts */
    9.53 -        err = request_irq(IRQ_FROM_XEN_VIRQ(VIRQ_PHYSIRQ), physirq_interrupt, 
    9.54 -                          SA_SAMPLE_RANDOM, "physirq", NULL);
    9.55 -        if ( err )
    9.56 -        {
    9.57 -            printk(KERN_WARNING "Could not allocate physirq interrupt\n");
    9.58 -            return err;
    9.59 -        }
    9.60 -        setup_event_handler = 1;
    9.61 -    }
    9.62 -
    9.63 -    /*
    9.64 -     * request the irq from hypervisor
    9.65 -     */
    9.66 -    op.cmd = PHYSDEVOP_REQUEST_IRQ;
    9.67 -    op.u.request_irq.irq   = irq;
    9.68 -    if ( (err = HYPERVISOR_physdev_op(&op)) != 0 )
    9.69 -    {
    9.70 -        printk(KERN_ALERT "could not get IRQ %d from Xen\n", irq);
    9.71 -        return err;
    9.72 -    }
    9.73 -    return 0;
    9.74 -}
    9.75 -/*
    9.76 - * This is a dummy interrupt handler.
    9.77 - * It should never be called. events for physical interrupts are handled
    9.78 - * differently in hypervisor.c
    9.79 - */
    9.80 -static void physirq_interrupt(int irq, void *unused, struct pt_regs *ptregs)
    9.81 -{
    9.82 -    printk("XXX This should never be called!");
    9.83 -}
    9.84 -
    9.85 -
    9.86 -/*
    9.87 - * IRQ is not needed anymore.
    9.88 - */
    9.89 -static void shutdown_physirq_event(unsigned int irq)
    9.90 -{
    9.91 -    physdev_op_t op;
    9.92 -    int err;
    9.93 -
    9.94 -    printk("shutdown_phys_irq called.");
    9.95 -
    9.96 -    /*
    9.97 -     * tell hypervisor
    9.98 -     */
    9.99 -    op.cmd = PHYSDEVOP_FREE_IRQ;
   9.100 -    op.u.free_irq.irq   = irq;
   9.101 -    if ( (err = HYPERVISOR_physdev_op(&op)) != 0 )
   9.102 -    {
   9.103 -        printk(KERN_ALERT "could not free IRQ %d\n", irq);
   9.104 -        return;
   9.105 -    }
   9.106 -    return;
   9.107 -}
   9.108 -
   9.109 -
   9.110 -static void enable_physirq_event(unsigned int irq)
   9.111 -{
   9.112 -    /* XXX just enable all phys interrupts for now */
   9.113 -    enable_irq(IRQ_FROM_XEN_VIRQ(VIRQ_PHYSIRQ));
   9.114 -}
   9.115 -
   9.116 -static void disable_physirq_event(unsigned int irq)
   9.117 -{
   9.118 -    /* XXX just disable all phys interrupts for now */
   9.119 -    disable_irq(IRQ_FROM_XEN_VIRQ(VIRQ_PHYSIRQ));
   9.120 -}
   9.121 -
   9.122 -static void ack_physirq_event(unsigned int irq)
   9.123 -{
   9.124 -    /* clear bit */
   9.125 -    if ( irq <= 0 || irq >= 32 )
   9.126 -    {
   9.127 -        printk("wrong irq %d\n", irq);
   9.128 -    }
   9.129 -
   9.130 -    clear_bit(irq, &HYPERVISOR_shared_info->physirq_pend);
   9.131 -}
   9.132 -
   9.133 -static void end_physirq_event(unsigned int irq)
   9.134 -{
   9.135 -    int err;
   9.136 -    physdev_op_t op;
   9.137 -
   9.138 -    /* call hypervisor */
   9.139 -    op.cmd = PHYSDEVOP_FINISHED_IRQ;
   9.140 -    op.u.finished_irq.irq   = irq;
   9.141 -    if ( (err = HYPERVISOR_physdev_op(&op)) != 0 )
   9.142 -    {
   9.143 -        printk(KERN_ALERT "could not finish IRQ %d\n", irq);
   9.144 -        return;
   9.145 -    }
   9.146 -    return;
   9.147 -}
   9.148 -
   9.149 -static struct hw_interrupt_type physirq_irq_type = {
   9.150 -    "physical-irq",
   9.151 -    startup_physirq_event,
   9.152 -    shutdown_physirq_event,
   9.153 -    enable_physirq_event,
   9.154 -    disable_physirq_event,
   9.155 -    ack_physirq_event,
   9.156 -    end_physirq_event,
   9.157 -    NULL
   9.158 -};
   9.159 -
   9.160 -
   9.161 -
   9.162 -void __init physirq_init(void)
   9.163 -{
   9.164 -    int i;
   9.165 -
   9.166 -    printk("Initialise irq handlers [%d-%d] for physical interrupts.\n",
   9.167 -           PHYS_IRQ_BASE, PHYS_IRQ_BASE+NR_PHYS_IRQS-1);
   9.168 -
   9.169 -    for ( i = 0; i < NR_PHYS_IRQS; i++ )
   9.170 -    {
   9.171 -        irq_desc[i + PHYS_IRQ_BASE].status  = IRQ_DISABLED;
   9.172 -        irq_desc[i + PHYS_IRQ_BASE].action  = 0;
   9.173 -        irq_desc[i + PHYS_IRQ_BASE].depth   = 1;
   9.174 -        irq_desc[i + PHYS_IRQ_BASE].handler = &physirq_irq_type;
   9.175 -    }
   9.176 -}
   9.177 -
   9.178 -#endif
    10.1 --- a/xenolinux-2.4.25-sparse/include/asm-xen/irq.h	Fri Mar 26 09:50:35 2004 +0000
    10.2 +++ b/xenolinux-2.4.25-sparse/include/asm-xen/irq.h	Fri Mar 26 12:26:45 2004 +0000
    10.3 @@ -32,7 +32,11 @@
    10.4  
    10.5  #define NR_IRQS   (NR_PIRQS + NR_DYNIRQS)
    10.6  
    10.7 -extern void physirq_init(void);
    10.8 +#define pirq_to_irq(_x)   ((_x) + PIRQ_BASE)
    10.9 +#define irq_to_pirq(_x)   ((_x) - PIRQ_BASE)
   10.10 +
   10.11 +#define dynirq_to_irq(_x) ((_x) + DYNIRQ_BASE)
   10.12 +#define irq_to_dynirq(_x) ((_x) - DYNIRQ_BASE)
   10.13  
   10.14  /* Dynamic binding of event channels and VIRQ sources to Linux IRQ space. */
   10.15  extern int  bind_virq_to_irq(int virq);
   10.16 @@ -40,14 +44,13 @@ extern void unbind_virq_from_irq(int vir
   10.17  extern int  bind_evtchn_to_irq(int evtchn);
   10.18  extern void unbind_evtchn_from_irq(int evtchn);
   10.19  
   10.20 -#define irq_cannonicalize(_irq) (_irq)
   10.21 +static __inline__ int irq_cannonicalize(int irq)
   10.22 +{
   10.23 +    return (irq == 2) ? 9 : irq;
   10.24 +}
   10.25  
   10.26  extern void disable_irq(unsigned int);
   10.27  extern void disable_irq_nosync(unsigned int);
   10.28  extern void enable_irq(unsigned int);
   10.29  
   10.30 -#ifdef CONFIG_X86_LOCAL_APIC
   10.31 -#define ARCH_HAS_NMI_WATCHDOG		/* See include/linux/nmi.h */
   10.32 -#endif
   10.33 -
   10.34  #endif /* _ASM_IRQ_H */