Octocontrabass wrote:Ethin wrote:What's odd is that it raised the MSI-x vector, which means I did everything correctly (I think) but the interrupt still wasn't ever raised by the APIC.
How are you checking whether the local APIC has received the IRQ? If your ISR is running, the LAPIC should say that it received the IRQ. (Make sure you're checking before you send the EOI.)
I'm using the LAPIC, yes. My rust code contains a list of functions to attach to each interrupt (interrupts 48-255 primarily). There'll be some interrupt sharing, sadly, but its not as though Intel or AMD are going to allow us to make the IDT an arbitrary size to handlean arbitrary number of interrupts because that would undoubtedly require huge architectural changes. Anyway.
When I initialize the controller I register a handler function for the given interrupt. I have the handler function set to log something if its called, and I'm never seeing the message I told it to print be printed. The IRQ is already in the IDT, and the function (should) be working, but the interrupt is either never being fired/never being received by the chipset or I've messed something up somewhere. According to the NVMe controller log I still have set up, the controller is definitely raising the interrupt ("pci_nvme_irq_msix raising MSI-X IRQ vector 0"). As a side note, my controller config is 0x460001 and my AQA is set to 0x7ff07ff. My ASQ is located at 0x18f8b000 and the ACQ is at 0x154461000, if that's of any help. I'm honestly not really sure what's wrong here.
Edit: Yeah, definitely confused. I added trace events for the PIC, APIC and IOAPIC, and its definitely being received and (I believe)delivered:
[email protected]:apic_deliver_irq dest 255 dest_mode 1 delivery_mode 1 vector 231 trigger_mode 0
Here's how I set the bits when I was configuring my interrupts:
- Destination ID: 0xFF (all processors)
- Redirection hint indication: yes
- Destination mode: logical
- Vector: Randomly assigned (to prevent overuse of interrupts as best as possible)
- Delivery mode: lowest priority
- Level: reserved
- Trigger mode: Edge sensitive
I'm trying a different interrupt configuration (with RH and DM clear and delivery mode set to fixed). I'm not going to try any of the other modes because I don't think any of those would actually work.
Edit: Okay, so just tried. And it failed. Again, the IRQ is definitely being delivered:
However, the IRQ is never actually being fired.
Edit: Okay, so I... Had another idiot moment again.
I seem to be having a lot of those. XD
Anyway, my error was really simple -- I was registering the handler *after* the controller had been set up. Everything's working fine, its just that there's no handler for that interrupt yet. So nevermind -- I got everything working (I think) and thanks for the help!