Open
Conversation
Add try_enable_x2apic() which reads IA32_APIC_BASE, sets bits 10+11 (x2APIC enable + global enable), writes back, and verifies via readback. Must be called before init_apic_mode() so the mode cache sees x2APIC. The dispatch layer (local_apic_read/write/eoi/id) already handled x2APIC via x2apic_read/x2apic_write MSR helpers — this activates that path. Verified in QEMU (-cpu max): x2APIC enabled, APIC mode: x2apic, LAPIC timer interrupt received successfully, full boot completes. Also update x2apic-prep.md: all four phases now complete.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds
try_enable_x2apic()which enables x2APIC mode at boot if CPUID reports support.Called before
init_apic_mode()so the mode cache sees x2APIC, not xAPIC.How it works
CpuFeatures::get().x2apic— early-return with log if unsupportedIA32_APIC_BASE(MSR 0x1B) — early-return if already enabled (idempotent)init_apic_mode()then cachesApicAccessMode::X2ApicThe dispatch layer (
local_apic_read/write/eoi/id) already handled x2APIC via MSR paths — this activates that path.Verified in QEMU
Full boot completes including ACPI, PCI scan, USB/xHCI keyboard enumeration.
Docs
docs/plans/x2apic-prep.mdupdated — all four phases now marked complete.Changes
kernel/src/interrupts/apic.rs:try_enable_x2apic()+log_error!importkernel/src/interrupts/mod.rs: re-exporttry_enable_x2apickernel/src/environment.rs: calltry_enable_x2apic()beforeinit_apic_mode()docs/plans/x2apic-prep.md: all phases marked IMPLEMENTED