On 12-10-21, 11:16, Arnd Bergmann wrote:
I don't see a problem with the flexibility, but I find the inconsistency slightly annoying: if disabling the interrupt line has the side-effect of masking it, it should not be possible to unmask it before enabling.
I agree, this doesn't look consistent here.
To have it more consistent, it would seem better to do one of two things:
a) require disabled interrupts to always be masked, only allowing the unmask to happen after enable, while forcing a mask during disable.
or
b) separate the 'mask' from the 'disable' operation, leaving the event descriptor queued if you disable it, but adding another operation for an explicit mask (i.e. return the event descriptor) that is separate from 'disable'.
I would prefer a) here since I think that makes a nicer virtio spec, but b) would make it more similar to hardware gpio controllers.
In the end, I don't think any of the combinations would cause problems, this is just a matter of personal taste.
I also like option A to be a better (easier) choice here, though it may make the Linux implementation a bit inefficient (maybe few extra if/else blocks while enabling/disabling irqs). I will update this in the next version then.