From c45f5c6e2a86085dfcff908376ac7338b0488958 Mon Sep 17 00:00:00 2001 From: Undefine Date: Sun, 18 Oct 2026 12:59:49 +0200 Subject: [PATCH] Kernel: Disable MSI interrupts when IOAPIC is disabled MSI interrupts require the IOAPIC to be enabled, trying to run with `enable_ioapic=off` would cause a kernel panic. --- Kernel/Bus/PCI/Device.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Kernel/Bus/PCI/Device.cpp b/Kernel/Bus/PCI/Device.cpp index e1dd8a5c95a..fc1214a0d55 100644 --- a/Kernel/Bus/PCI/Device.cpp +++ b/Kernel/Bus/PCI/Device.cpp @@ -7,6 +7,9 @@ #include #include #include +#if ARCH(X86_64) +# include +#endif #include #include #include @@ -24,21 +27,33 @@ Device::Device(DeviceIdentifier const& pci_identifier) bool Device::is_msi_capable() const { + // FIXME: Move those checks to a better place // FIXME: Support MSI on aarch64 and riscv64 #if ARCH(AARCH64) || ARCH(RISCV64) return false; #endif +#if ARCH(X86_64) + if (!APIC::initialized()) + return false; +#endif + return m_pci_identifier->is_msi_capable(); } bool Device::is_msix_capable() const { + // FIXME: Move those checks to a better place // FIXME: Support MSIx on aarch64 and riscv64 #if ARCH(AARCH64) || ARCH(RISCV64) return false; #endif +#if ARCH(X86_64) + if (!APIC::initialized()) + return false; +#endif + return m_pci_identifier->is_msix_capable(); }