Personally I find this error message to be misleading.
What it says: IRQ remapping doesn't support X2APIC mode, disable x2apic.
What it actually means: IRQ remapping isn't enabled, so x2APIC was disabled.
The solution is to turn on IRQ remapping. Set CONFIG_IRQ_REMAP=y
in your kernel config and recompile it.
x2APIC requires that the IOMMU be enabled and that IRQ remapping is enabled.
- Enable IOMMU in the BIOS. (It's disabled by default on many systems. Even on my brand new (July 2020) Gigabyte R282-Z93 with EPYC 7742 CPUs!)
- Enable x2APIC in the BIOS.
- Enable IOMMU support in the kernel:
- For Intel CPUs:
CONFIG_INTEL_IOMMU=y
- For AMD CPUs:
CONFIG_AMD_IOMMU=y
and CONFIG_AMD_IOMMU_V2=y
- Enable x2APIC support in the kernel:
CONFIG_X86_X2APIC=y
- Enable IRQ remapping in the kernel:
CONFIG_IRQ_REMAP=y
So if x2APIC requires IRQ remapping then how exactly does one end up with a kernel that has x2APIC support but no IRQ remapping? Well, if you look at the dependencies for CONFIG_X86_X2APIC you'll see that it requires X86_LOCAL_APIC && X86_64 && (IRQ_REMAP || HYPERVISOR_GUEST)
So if your kernel was built to support running under a hypervisor then you could very well fail to enable the option for IRQ remapping. (I did exactly this. Oops! It was very confusing to figure out what went wrong until I grepped the kernel source for the "IRQ remapping doesn't support X2APIC mode, disable x2apic" message, at which point it became relatively straightforward to figure out the problem.)