On 11 March 2016 at 02:26, Jean-Christophe DUBOIS <j...@tribudubois.net> wrote: > Le 10/03/2016 11:31, Peter Maydell a écrit : >> Calling qemu_set_irq() from a reset function is generally >> a bad idea. > > > Could I assume that all irq lines are set automatically to 0 on reset?
The way this works is that an irq line has two ends on it, and no internal state of its own. So on reset, the devices at each end reset themselves. For the device on the receiving end of the irq line, it will reset itself into the "assume this input of mine is at 0" state. (The reason not to call qemu_set_irq() on reset from the sending end is that there's no guarantee about which order the two devices reset themselves -- if you reset before the receiving end then your call would do nothing anyway because the subsequent reset in the receiver resets its state and it forgets about the inbound signal being high.) This is of course broken for the case where a device wants to assert a line to 1 when it resets, but we've basically been able to ignore this so far. Trying to clean up our reset handling would be a huge job and probably not back compatible either... thanks -- PMM