In summary, there is no easy way for device_* interface to know who called. So registering a notification port is a simple and sane way, We only need to move device_intr_register/ack to irq_register/ack into something like irq.defs, so that other devices are freed from having to implement these two device_* called that are only meant for the irq device.
Best, Junling > On Aug 4, 2020, at 3:58 PM, Samuel Thibault <samuel.thiba...@gnu.org> wrote: > > Junling Ma, le mar. 04 août 2020 14:47:09 -0700, a ecrit: >> The tot_num_intr field is a count of how many deliverable interrupts across >> all lines. When we move >> to the scheme of blocking read for request and write for acking, it is >> possible that an interrupt >> can happen during a small period that the interrupt is acked, but the read >> has not happended yet. > > As discussed on IRC, this is rather a problem of the device_read/write > concept, that would require device_read() to be called before the > interrupt raises, just because on the kernel side the mach_device_t is > the same for all userland processes sharing the IRQ. I don't think it's > a path we want to follow, and we'd rather use register/ack IPC like we > have now. > > Samuel