ia64/xen-unstable

changeset 2929:b12c5094e28c

bitkeeper revision 1.1159.1.400 (4192268botrLPEWBvExDtqcSivVN3g)

Move virq to evtchn mapping to exec_domain.
author cl349@freefall.cl.cam.ac.uk
date Wed Nov 10 14:32:43 2004 +0000 (2004-11-10)
parents e8a2c91dfc4f
children cbdc0480194e
files xen/common/event_channel.c xen/common/keyhandler.c xen/include/xen/event.h xen/include/xen/sched.h
line diff
     1.1 --- a/xen/common/event_channel.c	Wed Nov 10 11:00:27 2004 +0000
     1.2 +++ b/xen/common/event_channel.c	Wed Nov 10 14:32:43 2004 +0000
     1.3 @@ -239,10 +239,11 @@ static long evtchn_bind_interdomain(evtc
     1.4  
     1.5  static long evtchn_bind_virq(evtchn_bind_virq_t *bind)
     1.6  {
     1.7 -    struct domain *d = current->domain;
     1.8 +    struct exec_domain *ed = current;
     1.9 +    struct domain *d = ed->domain;
    1.10      int            port, virq = bind->virq;
    1.11  
    1.12 -    if ( virq >= ARRAY_SIZE(d->virq_to_evtchn) )
    1.13 +    if ( virq >= ARRAY_SIZE(ed->virq_to_evtchn) )
    1.14          return -EINVAL;
    1.15  
    1.16      spin_lock(&d->event_channel_lock);
    1.17 @@ -252,7 +253,7 @@ static long evtchn_bind_virq(evtchn_bind
    1.18       * bound yet. The exception is the 'misdirect VIRQ', which is permanently 
    1.19       * bound to port 0.
    1.20       */
    1.21 -    if ( ((port = d->virq_to_evtchn[virq]) != 0) ||
    1.22 +    if ( ((port = ed->virq_to_evtchn[virq]) != 0) ||
    1.23           (virq == VIRQ_MISDIRECT) ||
    1.24           ((port = get_free_port(d)) < 0) )
    1.25          goto out;
    1.26 @@ -260,7 +261,7 @@ static long evtchn_bind_virq(evtchn_bind
    1.27      d->event_channel[port].state  = ECS_VIRQ;
    1.28      d->event_channel[port].u.virq = virq;
    1.29  
    1.30 -    d->virq_to_evtchn[virq] = port;
    1.31 +    ed->virq_to_evtchn[virq] = port;
    1.32  
    1.33   out:
    1.34      spin_unlock(&d->event_channel_lock);
    1.35 @@ -313,6 +314,7 @@ static long evtchn_bind_pirq(evtchn_bind
    1.36  static long __evtchn_close(struct domain *d1, int port1)
    1.37  {
    1.38      struct domain   *d2 = NULL;
    1.39 +    struct exec_domain *ed;
    1.40      event_channel_t *chn1, *chn2;
    1.41      int              port2;
    1.42      long             rc = 0;
    1.43 @@ -344,7 +346,10 @@ static long __evtchn_close(struct domain
    1.44          break;
    1.45  
    1.46      case ECS_VIRQ:
    1.47 -        d1->virq_to_evtchn[chn1[port1].u.virq] = 0;
    1.48 +        /* XXX could store exec_domain in chn1[port1].u */
    1.49 +        for_each_exec_domain(d1, ed)
    1.50 +            if (ed->virq_to_evtchn[chn1[port1].u.virq] == port1)
    1.51 +                ed->virq_to_evtchn[chn1[port1].u.virq] = 0;
    1.52          break;
    1.53  
    1.54      case ECS_INTERDOMAIN:
     2.1 --- a/xen/common/keyhandler.c	Wed Nov 10 11:00:27 2004 +0000
     2.2 +++ b/xen/common/keyhandler.c	Wed Nov 10 14:32:43 2004 +0000
     2.3 @@ -111,10 +111,10 @@ void do_task_queues(unsigned char key)
     2.4          ed = d->exec_domain[0];
     2.5          printk("Notifying guest... %d/%d\n", d->id, ed->eid); 
     2.6          printk("port %d/%d stat %d %d %d\n",
     2.7 -               VIRQ_DEBUG, d->virq_to_evtchn[VIRQ_DEBUG],
     2.8 -               test_bit(d->virq_to_evtchn[VIRQ_DEBUG], &d->shared_info->evtchn_pending[0]),
     2.9 -               test_bit(d->virq_to_evtchn[VIRQ_DEBUG], &d->shared_info->evtchn_mask[0]),
    2.10 -               test_bit(d->virq_to_evtchn[VIRQ_DEBUG]>>5, &ed->vcpu_info->evtchn_pending_sel));
    2.11 +               VIRQ_DEBUG, ed->virq_to_evtchn[VIRQ_DEBUG],
    2.12 +               test_bit(ed->virq_to_evtchn[VIRQ_DEBUG], &d->shared_info->evtchn_pending[0]),
    2.13 +               test_bit(ed->virq_to_evtchn[VIRQ_DEBUG], &d->shared_info->evtchn_mask[0]),
    2.14 +               test_bit(ed->virq_to_evtchn[VIRQ_DEBUG]>>5, &ed->vcpu_info->evtchn_pending_sel));
    2.15          send_guest_virq(d->exec_domain[0], VIRQ_DEBUG);
    2.16      }
    2.17  
     3.1 --- a/xen/include/xen/event.h	Wed Nov 10 11:00:27 2004 +0000
     3.2 +++ b/xen/include/xen/event.h	Wed Nov 10 14:32:43 2004 +0000
     3.3 @@ -57,7 +57,7 @@ static inline void evtchn_set_pending(st
     3.4   */
     3.5  static inline void send_guest_virq(struct exec_domain *ed, int virq)
     3.6  {
     3.7 -    evtchn_set_pending(ed, ed->domain->virq_to_evtchn[virq]);
     3.8 +    evtchn_set_pending(ed, ed->virq_to_evtchn[virq]);
     3.9  }
    3.10  
    3.11  /*
     4.1 --- a/xen/include/xen/sched.h	Wed Nov 10 11:00:27 2004 +0000
     4.2 +++ b/xen/include/xen/sched.h	Wed Nov 10 14:32:43 2004 +0000
     4.3 @@ -98,6 +98,8 @@ struct exec_domain
     4.4  
     4.5      unsigned long ed_flags;
     4.6  
     4.7 +    u16 virq_to_evtchn[NR_VIRQS];
     4.8 +
     4.9      atomic_t pausecnt;
    4.10  
    4.11  };
    4.12 @@ -136,7 +138,6 @@ struct domain {
    4.13       */
    4.14  #define NR_PIRQS 128 /* Put this somewhere sane! */
    4.15      u16 pirq_to_evtchn[NR_PIRQS];
    4.16 -    u16 virq_to_evtchn[NR_VIRQS];
    4.17      u32 pirq_mask[NR_PIRQS/32];
    4.18  
    4.19      /* Physical I/O */