Davis,
EOIing before running the ISR eems like an odd implementation for level-triggered interrupts,
You would have to mask IRQ at IOAPIC in your stub - otherwise, you may well get into “interrupt storm” with level-triggered interrupts ( line is still asserted, but local APIC claims that it has already handled it)…
But even then, the processor decides if an interrupt is serviceable by checking the vector number >against the PPR. So if you set the IRQL of a processor to x by writing the TPR (which then changes the >PPR), this automatically masks interrupts at some vectors and not the interrupts at other vectors.
Sure…
To completely separate the concepts you’d have to never use the TPR for prioritization.
Not really More on it below…
But you are right - you could probably design a system that completely disconnected software
priority >(IRQL) from implied IDT vector priority by EOIing immediately, and never writing the TPR.
Actually, you can still make use of TPR. What you have to do is to process ISRs in context of a software interrupt (or, if you want to maintain the concept of IRQL at the level Windows currently does, which, IMHO, is a bit to the extreme, even define multiple software interrupts for this purpose ) - the only requirement is that all *actual* hardware interrupts map to vectors that numerically imply priority above the one(s) that actually handle(s) ISRs. IMHO, processing all ISRs in context of the same interrupt could be a better idea. More on it below …
This system would have to deal with a bunch of issues like a ton of spurious interrupts,
Well, it would have to disable IRQ at IOAPIC…
…but could have advantages I can’t think of.
Well, the most obvious advantage is flexibility . It is not so easy to decide in advance whether device X should have any interrupt priority to device Y, in the first place. Consider the scenario when the target machine has multiple identical devices that can be handled by the same driver that are mechanically connected to different IRQs plus happen to share their IRQs with other devices. For example, on my machine IRQ21 is shared by EHCI, one instance of UHCI, SATA controller and NIC, IRQ 20 is shared by another instance of UHCI and 1394controller, and yet two more instances of UHCI have dedicated IRQs.
Which of them should be of higher priority??? Furthermore, it may well happen that, from the logical standpoint, the same device may have various operational priorities, depending on operation ( for example, data receipt acknowledging send completion on by NIC). Therefore, probably, it makes sense not to prioritize interrupts against one another, but make all ISRs equal, and, instead, let them decicd at which priority level they want to queue their DPCs in a given situation. In other words, probably it makes sense to make IRQL software-only concept …
Anton Bassov