Skip to content

Commit 3e5bedc

Browse files
KAGA-KOKOIngo Molnar
authored andcommitted
x86/apic: Fix arch_dynirq_lower_bound() bug for DT enabled machines
Rahul Tanwar reported the following bug on DT systems: > 'ioapic_dynirq_base' contains the virtual IRQ base number. Presently, it is > updated to the end of hardware IRQ numbers but this is done only when IOAPIC > configuration type is IOAPIC_DOMAIN_LEGACY or IOAPIC_DOMAIN_STRICT. There is > a third type IOAPIC_DOMAIN_DYNAMIC which applies when IOAPIC configuration > comes from devicetree. > > See dtb_add_ioapic() in arch/x86/kernel/devicetree.c > > In case of IOAPIC_DOMAIN_DYNAMIC (DT/OF based system), 'ioapic_dynirq_base' > remains to zero initialized value. This means that for OF based systems, > virtual IRQ base will get set to zero. Such systems will very likely not even boot. For DT enabled machines ioapic_dynirq_base is irrelevant and not updated, so simply map the IRQ base 1:1 instead. Reported-by: Rahul Tanwar <[email protected]> Tested-by: Rahul Tanwar <[email protected]> Tested-by: Andy Shevchenko <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Ingo Molnar <[email protected]>
1 parent b63f20a commit 3e5bedc

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

arch/x86/kernel/apic/io_apic.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2438,7 +2438,13 @@ unsigned int arch_dynirq_lower_bound(unsigned int from)
24382438
* dmar_alloc_hwirq() may be called before setup_IO_APIC(), so use
24392439
* gsi_top if ioapic_dynirq_base hasn't been initialized yet.
24402440
*/
2441-
return ioapic_initialized ? ioapic_dynirq_base : gsi_top;
2441+
if (!ioapic_initialized)
2442+
return gsi_top;
2443+
/*
2444+
* For DT enabled machines ioapic_dynirq_base is irrelevant and not
2445+
* updated. So simply return @from if ioapic_dynirq_base == 0.
2446+
*/
2447+
return ioapic_dynirq_base ? : from;
24422448
}
24432449

24442450
#ifdef CONFIG_X86_32

0 commit comments

Comments
 (0)