clear APIC IRR

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
dschatz
Member
Member
Posts: 61
Joined: Wed Nov 10, 2010 10:55 pm

clear APIC IRR

Post by dschatz »

I'm trying to poll interrupts. I can detect that an interrupt has come in on the IRR by reading it. I could service the interrupt right there without enabling interrupts in CFLAGS. However, I couldn't find a way to clear bits from the IRR. Is there any way to do this or am I going about this the wrong way?
FallenAvatar
Member
Member
Posts: 283
Joined: Mon Jan 03, 2011 6:58 pm

Re: clear APIC IRR

Post by FallenAvatar »

Why are you polling? o.O
Nable
Member
Member
Posts: 453
Joined: Tue Nov 08, 2011 11:35 am

Re: clear APIC IRR

Post by Nable »

Use EOI (End-Of-Interrupt) registers to acknowledge serviced interrupt, Luke.
dschatz
Member
Member
Posts: 61
Joined: Wed Nov 10, 2010 10:55 pm

Re: clear APIC IRR

Post by dschatz »

EOI only acks the ISR, not the IRR according to the intel manual. Can you point me to documentation that says otherwise?

Polling is nice because I only take interrupts at explicit points in time, so I would rather just call the corresponding handler than take an interrupt which causes a pipeline flush and other slowdown.
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: clear APIC IRR

Post by Combuster »

Then don't check the PIC, but rather the device itself you're interested in.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
dschatz
Member
Member
Posts: 61
Joined: Wed Nov 10, 2010 10:55 pm

Re: clear APIC IRR

Post by dschatz »

The issue is that it could be a number of devices. I think explicitly checking every potential interrupt generating device in the system doesn't scale.
gerryg400
Member
Member
Posts: 1801
Joined: Thu Mar 25, 2010 11:26 pm
Location: Melbourne, Australia

Re: clear APIC IRR

Post by gerryg400 »

dschatz wrote:The issue is that it could be a number of devices. I think explicitly checking every potential interrupt generating device in the system doesn't scale.
Do you think it's possible that interrupts are provided for that reason ?
If a trainstation is where trains stop, what is a workstation ?
dschatz
Member
Member
Posts: 61
Joined: Wed Nov 10, 2010 10:55 pm

Re: clear APIC IRR

Post by dschatz »

gerryg400 wrote:
dschatz wrote:The issue is that it could be a number of devices. I think explicitly checking every potential interrupt generating device in the system doesn't scale.
Do you think it's possible that interrupts are provided for that reason ?
First of all there are plenty of reasons why interrupts are provided that have nothing to do with the scalability of polling. Second of all, I'm asking how to clear the IRR on the APIC, not how to check every interrupt generating device in the system. I just want to know how I can poll for interrupts without talking to every device in the system. If its not possible or no one knows, thats fine.
gerryg400
Member
Member
Posts: 1801
Joined: Thu Mar 25, 2010 11:26 pm
Location: Melbourne, Australia

Re: clear APIC IRR

Post by gerryg400 »

dschatz wrote:
gerryg400 wrote:
dschatz wrote:The issue is that it could be a number of devices. I think explicitly checking every potential interrupt generating device in the system doesn't scale.
Do you think it's possible that interrupts are provided for that reason ?
First of all there are plenty of reasons why interrupts are provided that have nothing to do with the scalability of polling. Second of all, I'm asking how to clear the IRR on the APIC, not how to check every interrupt generating device in the system. I just want to know how I can poll for interrupts without talking to every device in the system. If its not possible or no one knows, thats fine.
Wait a minute. It was you that complained about having to explicitly check every interrupt generating device. And it was you that complained about it not scaling.

Anyway to answer your original question, you cannot write to the IRR. An EOI will clear the highest set ISR bit potentially making way for bit in the IRR to be transferred to the ISR. Bits in the IRR are not explicitly cleared, they are moved to the ISR. Let's say that IRR bit 100 is set. That bit will not be cleared (moved to ISR 100) until every bit of higher priority in the ISR is cleared by EOI.

I've not tried this with polling but I can't immediately see why it won't work.
If a trainstation is where trains stop, what is a workstation ?
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: clear APIC IRR

Post by Combuster »

ISR means in-service-register. To get a bit into the ISR, you need to accept an interrupt.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
Post Reply