linux/arch/x86/kernel/apic
Saurabh Sengar 3df8a87394 x86/ioapic: Don't return 0 from arch_dynirq_lower_bound()
[ Upstream commit 5af507bef9 ]

arch_dynirq_lower_bound() is invoked by the core interrupt code to
retrieve the lowest possible Linux interrupt number for dynamically
allocated interrupts like MSI.

The x86 implementation uses this to exclude the IO/APIC GSI space.
This works correctly as long as there is an IO/APIC registered, but
returns 0 if not. This has been observed in VMs where the BIOS does
not advertise an IO/APIC.

0 is an invalid interrupt number except for the legacy timer interrupt
on x86. The return value is unchecked in the core code, so it ends up
to allocate interrupt number 0 which is subsequently considered to be
invalid by the caller, e.g. the MSI allocation code.

The function has already a check for 0 in the case that an IO/APIC is
registered, as ioapic_dynirq_base is 0 in case of device tree setups.

Consolidate this and zero check for both ioapic_dynirq_base and gsi_top,
which is used in the case that no IO/APIC is registered.

Fixes: 3e5bedc2c2 ("x86/apic: Fix arch_dynirq_lower_bound() bug for DT enabled machines")
Signed-off-by: Saurabh Sengar <ssengar@linux.microsoft.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/r/1679988604-20308-1-git-send-email-ssengar@linux.microsoft.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-05-11 23:03:16 +09:00
..
apic_common.c
apic_flat_64.c
apic_noop.c
apic_numachip.c
apic.c x86/apic: Fix atomic update of offset in reserve_eilvt_offset() 2023-05-11 23:03:13 +09:00
bigsmp_32.c
hw_nmi.c
io_apic.c x86/ioapic: Don't return 0 from arch_dynirq_lower_bound() 2023-05-11 23:03:16 +09:00
ipi.c KVM: x86: lapic: Rename [GET/SET]_APIC_DEST_FIELD to [GET/SET]_XAPIC_DEST_FIELD 2022-06-24 12:44:34 -04:00
local.h
Makefile
msi.c x86/apic/msi: Use PCI device MSI property 2021-12-16 22:16:37 +01:00
probe_32.c
probe_64.c
vector.c Replace for_each_*_bit_from() with for_each_*_bit() where appropriate 2022-01-15 08:47:31 -08:00
x2apic_cluster.c x86/apic: Reduce cache line misses in __x2apic_send_IPI_mask() 2021-10-29 10:02:17 +02:00
x2apic_phys.c x86/apic: Add extra serialization for non-serializing MSRs 2021-02-04 19:36:31 +01:00
x2apic_uv_x.c x86/platform/uv: Log gap hole end size 2022-04-07 17:25:15 +02:00