From 026bac6de7154c5c529c260bfef462eb735b38f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20=C5=BBygowski?= Date: Mon, 6 Oct 2025 10:52:32 +0200 Subject: [PATCH] arch/x86/ioapic: Add Kconfig option to keep pre-allocated IOAPIC ID MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Introduce IOAPIC_USE_PRESET_ID Kconfig option to instruct coreboot to keep the IOAPIC ID programmed in the silicon initialization modules. For example, OpenSIL already programs the IOAPIC IDs. TEST=See IOAPIC IDs are starting with 240 on Gigabyte MZ33-AR1 as set by OpenSIL. Change-Id: Idb44c1aa663d7e351b011f4dd13f0b6b426566bb Signed-off-by: Michał Żygowski Reviewed-on: https://review.coreboot.org/c/coreboot/+/89477 Tested-by: build bot (Jenkins) Reviewed-by: Matt DeVillier --- src/arch/x86/Kconfig | 8 ++++++++ src/arch/x86/ioapic.c | 6 ++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/arch/x86/Kconfig b/src/arch/x86/Kconfig index 7f10f9a20f..e7328b6375 100644 --- a/src/arch/x86/Kconfig +++ b/src/arch/x86/Kconfig @@ -478,4 +478,12 @@ config IOAPIC_8BIT_ID help Select this option if the hardware support 8bit long IOAPIC IDs. +config IOAPIC_USE_PRESET_ID + bool + default n + depends on IOAPIC + help + Select this option if coreboot should keep IOAPIC IDs programmed + by silicon vendor initialization code. + endif diff --git a/src/arch/x86/ioapic.c b/src/arch/x86/ioapic.c index 792ba3e65e..b90ba94fcb 100644 --- a/src/arch/x86/ioapic.c +++ b/src/arch/x86/ioapic.c @@ -230,13 +230,15 @@ void setup_ioapic(uintptr_t ioapic_base, u8 ioapic_id) void register_new_ioapic_gsi0(uintptr_t ioapic_base) { - setup_ioapic(ioapic_base, 0); + setup_ioapic(ioapic_base, CONFIG(IOAPIC_USE_PRESET_ID) ? + get_ioapic_id(ioapic_base) : 0); } void register_new_ioapic(uintptr_t ioapic_base) { static u8 ioapic_id; ioapic_id++; - set_ioapic_id(ioapic_base, ioapic_id); + set_ioapic_id(ioapic_base, CONFIG(IOAPIC_USE_PRESET_ID) ? + get_ioapic_id(ioapic_base) : ioapic_id); clear_vectors(ioapic_base, 0, ioapic_get_max_vectors(ioapic_base) - 1); }