On Sun, Sep 4, 2011 at 3:31 PM, Anthony Liguori <anth...@codemonkey.ws> wrote: > On 09/04/2011 10:20 AM, Blue Swirl wrote: >> >> On Sun, Sep 4, 2011 at 2:37 PM, Anthony Liguori<anth...@codemonkey.ws> >> wrote: >>> >>> On 09/04/2011 08:57 AM, Anthony Liguori wrote: >>>> >>>> On 09/04/2011 08:49 AM, Jan Kiszka wrote: >>>>> >>>>> On 2011-09-04 15:41, Anthony Liguori wrote: >>>>>> >>>>>> On 09/04/2011 08:36 AM, Jan Kiszka wrote: >>>>>> Having some sort of global interrupt routing table is just going to >>>>>> add >>>>>> a layer of complexity for very little obvious gain. >>>>> >>>>> It's not yet decided how the problem is solved. A global interrupt >>>>> matrix is just one proposal, another option is to extend the pin model >>>>> in a way that supports routing change notifiers and backward polling. >>>> >>>> If that's all you need, then you really just want notification on socket >>>> changes. Backwards polling can be achieved by just adding state to the >>>> Pin (which I full heartedly support). >>>> >>>> If that's all you're proposing, than I'm entirely happy with it :-) >>> >>> It's not that simple. >>> >>> Routing paths can change because of device changes, not just socket >>> changes. >> >> Yes, that's why callbacks are needed to let the device inform global >> matrix. >> >>> I think you would need an interface for irq routing. Something like: >>> >>> struct IrqRouter { >>> Interface parent; >>> >>> void (*foreach_output)(IrqRouter *obj, >>> void (*fn)(const char *out, void *opaque), >>> void *opaque); >>> >>> void (*foreach_input)(IrqRouter *obj, >>> void (*fn)(const char *in, void *opaque), >>> void *opaque); >> >> Are the above a way for a parent to tell this device that its inputs >> are changed? > > No... there really isn't a notion of parent/children. > > If something is interested in the routing path, it needs to listen for > mapping changes at every IrqRouter point. I neglected to add an interface > for registering for mapping changes so there would also need to be a > notification registration interface here.
With that change I think we're 100% in agreement. >> >>> const char *(*get_mapping)(IrqRouter *obj, const char *in); >> >> This would be useful for the matrix too, the matrix would use this to >> query for initial routing, maybe also for later changes if the change >> callback didn't tell the mapping directly. > > I think the main difference is, do you try to solve the problem everywhere, > or do you just allow for certain paths to be introspected. And then who is > reasonable for maintaining the full path. The matrix should take full responsibility for the devices (and the connections of those devices) that are under its control. Other devices can continue to do as before, they can be converted to matrix if needed. The benefit from the matrix would be performance and that would come from lazy update of the devices in addition to the fast direct path from source to final destination. If all the intermediate devices are probed by the OS (if there are no vectored interrupts etc. to determine the IRQ from PC), the lazy updates will not help and benefit will be lower. >> >>> }; >>> >>> You could then implement this interface in I440FX or any other controller >>> where we want to be able to support device passthrough. >>> >>> Representing endpoints as strings means that you can correlate inputs to >>> outputs throughout the chain provided that you understand how >>> inputs/outputs >>> relate to plugs/sockets. >> >> The string format assumes that there is a reliable way to convert Pin >> to string and vice versa. Why can't they be array of pointers to Pins? > > Yes, all Pins are devices and all devices have unique names. You could just > as easily use Pin *s. > > It's not clear to me whether you want to make the strings device names or > just property names though. I think either would work if the string->Pin conversion works. >> >> String representation (e.g. "/i440fx/pci-bridge@2,0/serial@3fc:2") >> could be useful for debugging and 'info qtree' ('info irqtree'?) >> though. > > IIUC, then this would be (in QOM) > > i440fx::piix3::serial[0]::irq > > This is the unique name the device would get. That's because the PIIX3 and > Serial devices are created via composition. You could indirectly reference > it multiple ways: > > /i440fx/slot[2]/serial[0]/irq > /i440fx/piix3/serial[0]/irq > > Regards, > > Anthony Liguori >