I want to know if I should use Message Signaled Interrupts as my primary way of handling interrupts, instead of IO APIC.
Is this the right solution?
How common is MSI support among devices? Among the classic x86-64 PC devices.
Can MSI be the only way to handle interrupts or do I still have to configure the IO APIC?
How do LAPIC, IO APIC and MSI fit together?
Will it be more straightforward than the IO APIC?
In general, I would like someone to explain to me whether it is worth messing around with MSI and whether it is worth replacing IO APIC with it.
Using MSI instead of APIC?
Re: Using MSI instead of APIC?
Basically all modern PCI devices support either MSI or MSI-X or both. This includes USB 3 controllers, network controllers, HD audio, AHCI and NVMe.
It's only for various legacy devices, like PS/2 keyboard & mouse, serial ports, IDE and floppies that you need to use legacy interrupts and the IO-APIC. These are all uncommon in modern hardware.
You still need to configure the local APIC, but you don't need to mess with details of various legacy strangeness. For most legacy devices, you can assume they always use the same IRQs, so ACPI is generally not needed. The only exceptions are dated USB controllers, which people writing new OSes shouldn't need to bother with.
It's only for various legacy devices, like PS/2 keyboard & mouse, serial ports, IDE and floppies that you need to use legacy interrupts and the IO-APIC. These are all uncommon in modern hardware.
You still need to configure the local APIC, but you don't need to mess with details of various legacy strangeness. For most legacy devices, you can assume they always use the same IRQs, so ACPI is generally not needed. The only exceptions are dated USB controllers, which people writing new OSes shouldn't need to bother with.
Re: Using MSI instead of APIC?
Started xHCI months ago specifically for USB keyboard, VirtualBox on Windows 11 (host) deploying MSI, no worries with obtaining its descriptors etc... but stuck on how to implement 4ms-duration for MSI to check the keyboard buffer for user input, using HPET ?
Would deeply appreciate your guidance, thank you and Happy New Year.
Would deeply appreciate your guidance, thank you and Happy New Year.
Re: Using MSI instead of APIC?
When you send the Configure Endpoint command, you set the interval field correctly. For full speed/low speed devices, you set it to the interval you want in milliseconds, and for high speed or higher devices, you set it to the correct bit shift for 125 µs. Then you create a TD with the IOC bit set. Then the xHC will notify you when the interrupt completes, and you can read out the keyboard event and, if appropriate, wake up. And you should probably re-introduce the same TD once you are done.
Carpe diem!