ia64/xen-unstable

changeset 4967:b0242ba5318a

bitkeeper revision 1.1439 (428a6cf5pJzUJXByrppn04a8boHuAw)

Fix virq delivery in Xend.
xcs.c:
Fix binding to virq's -- setup evtchn binding.
channel.py:
Use VIRQ_DOM_EXC as exported from xc. Also don't bind to virq's we
don't care for or which won't get delivered to us anyway.
xc.c:
Export VIRQ_DOM_EXC to python.
Signed-off-by: Christian Limpach <Christian.Limpach@cl.cam.ac.uk>
author cl349@firebug.cl.cam.ac.uk
date Tue May 17 22:15:17 2005 +0000 (2005-05-17)
parents b1edecef79f8
children 6866a8788b06
files tools/python/xen/lowlevel/xc/xc.c tools/python/xen/xend/server/channel.py tools/xcs/xcs.c
line diff
     1.1 --- a/tools/python/xen/lowlevel/xc/xc.c	Tue May 17 22:14:19 2005 +0000
     1.2 +++ b/tools/python/xen/lowlevel/xc/xc.c	Tue May 17 22:15:17 2005 +0000
     1.3 @@ -1279,6 +1279,7 @@ PyMODINIT_FUNC initxc(void)
     1.4      d = PyModule_GetDict(m);
     1.5      xc_error = PyErr_NewException(XENPKG ".error", NULL, NULL);
     1.6      PyDict_SetItemString(d, "error", xc_error);
     1.7 +    PyDict_SetItemString(d, "VIRQ_DOM_EXC", PyInt_FromLong(VIRQ_DOM_EXC));
     1.8  
     1.9      zero = PyInt_FromLong(0);
    1.10  
     2.1 --- a/tools/python/xen/xend/server/channel.py	Tue May 17 22:14:19 2005 +0000
     2.2 +++ b/tools/python/xen/xend/server/channel.py	Tue May 17 22:15:17 2005 +0000
     2.3 @@ -10,12 +10,6 @@ from xen.xend.XendLogging import log
     2.4  
     2.5  from messages import *
     2.6  
     2.7 -VIRQ_MISDIRECT  = 0  # Catch-all interrupt for unbound VIRQs.
     2.8 -VIRQ_TIMER      = 1  # Timebase update, and/or requested timeout.
     2.9 -VIRQ_DEBUG      = 2  # Request guest to dump debug info.
    2.10 -VIRQ_CONSOLE    = 3  # (DOM0) bytes received on emergency console.
    2.11 -VIRQ_DOM_EXC    = 4  # (DOM0) Exceptional event for some domain.
    2.12 -
    2.13  DEBUG = 0
    2.14  
    2.15  RESPONSE_TIMEOUT = 20.0
    2.16 @@ -66,13 +60,8 @@ class ChannelFactory:
    2.17      def __init__(self):
    2.18          """Constructor - do not use. Use the channelFactory function."""
    2.19          self.notifier = xu.notifier()
    2.20 -        # Register interest in all virqs.
    2.21 -        # Unfortunately virqs do not seem to be delivered.
    2.22 -        self.bind_virq(VIRQ_MISDIRECT)
    2.23 -        self.bind_virq(VIRQ_TIMER)
    2.24 -        self.bind_virq(VIRQ_DEBUG)
    2.25 -        self.bind_virq(VIRQ_CONSOLE)
    2.26 -        self.bind_virq(VIRQ_DOM_EXC)
    2.27 +        # Register interest in virqs.
    2.28 +        self.bind_virq(xen.lowlevel.xc.VIRQ_DOM_EXC)
    2.29          self.virqHandler = None
    2.30  
    2.31      def bind_virq(self, virq):
    2.32 @@ -81,6 +70,7 @@ class ChannelFactory:
    2.33          log.info("Virq %s on port %s", virq, port)
    2.34  
    2.35      def virq(self):
    2.36 +        log.error("virq")
    2.37          self.notifier.virq_send(self.virqPort)
    2.38  
    2.39      def start(self):
     3.1 --- a/tools/xcs/xcs.c	Tue May 17 22:14:19 2005 +0000
     3.2 +++ b/tools/xcs/xcs.c	Tue May 17 22:15:17 2005 +0000
     3.3 @@ -192,10 +192,21 @@ control_channel_t *add_virq(int virq)
     3.4      cc = (control_channel_t *)malloc(sizeof(control_channel_t));
     3.5      if ( cc == NULL ) return NULL;
     3.6  
     3.7 +    memset(cc, 0, sizeof(control_channel_t));
     3.8      cc->type       = CC_TYPE_VIRQ;
     3.9      cc->local_port = virq_port;
    3.10      cc->virq       = virq;
    3.11 +    cc->ref_count  = 1;
    3.12      
    3.13 +    if (evtchn_bind(cc->local_port) != 0)
    3.14 +    {
    3.15 +        DPRINTF("Got control interface, but couldn't bind evtchan!\n");
    3.16 +        free(cc);
    3.17 +        return NULL;
    3.18 +    }
    3.19 +
    3.20 +    cc_list[cc->local_port] = cc;
    3.21 +
    3.22      return cc;
    3.23  }
    3.24