From 026b18e6314879a07fa585f7f861827e4892668d Mon Sep 17 00:00:00 2001 From: Vladimir Serbinenko Date: Mon, 24 Feb 2025 17:58:14 +0300 Subject: [PATCH] Don't assume that BSP has lapicid 0 On Meteor LAke it has ID 0x20 and results in missing interrupts --- arch/x86_pc.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/x86_pc.cpp b/arch/x86_pc.cpp index 0cf4cda..bd489f7 100644 --- a/arch/x86_pc.cpp +++ b/arch/x86_pc.cpp @@ -42,6 +42,7 @@ uint32_t bootloaderID; uintptr_t bootloaderInformationOffset; bool x2apic = false; +uint32_t bootstrapLapicID; // Spinlock since some drivers need to access it in IRQs (e.g. ACPICA). KSpinlock pciConfigSpinlock; @@ -736,7 +737,7 @@ void ArchInitialise() { x2apic = !!(rdmsr(0x1b) & (1 << 10)); - uint8_t bootstrapLapicID = x2apic ? LapicReadRegister(0x20 >> 2) : (LapicReadRegister(0x20 >> 2) >> 24); + bootstrapLapicID = x2apic ? LapicReadRegister(0x20 >> 2) : (LapicReadRegister(0x20 >> 2) >> 24); ArchCPU *currentCPU = nullptr; @@ -1003,7 +1004,7 @@ KMSIInformation KRegisterMSI(KIRQHandler handler, void *context, const char *cOw INTERRUPT_VECTOR_MSI_START + i, cOwnerName); return { - .address = 0xFEE00000, + .address = 0xFEE00000 | (bootstrapLapicID << 12), .data = INTERRUPT_VECTOR_MSI_START + i, .tag = i, };