implement x2APIC support #3
Open
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.
this patch implements x2APIC support. it changes the order of processor initialization bringing up multiprocessor and calling
mpmainmuch earlier and moving some peripheral initialization intopostinitwhich still runs on CPU 0. it's more of an FYI at this point. there are a couple of ancillaries changes included in the branch such as addingsudoto the loop filesystem setup and adding-ptomkdiras they were required to getmake binariesto work locally. there is also a change to make usetypedef long long uint64otherwiselongcompiles as a 32-bit type with-m32.irq_register_handlerandget_registered_handlerwere made to subtractT_IRQ0so that they are consistent with the use of IRQ numbers in the other interrupt APIs. it was necessary to changeget_registered_handleras otherwise, it would not find traps, noting that dynamic IRQs were not in use. this small patch can be added on top of this branch to test IPI support by creating a dynamic IRQ function and sending some IPIs inmpmain.identcpuandlapicinithave been modified to log CPU model and APIC details together during processor initialization. TSC frequency is detected on bare metal, in VMWare and KVM but it may be necessary to manually provide the TSC frequency with KVM.microdelayhas been updated to use the TSC base frequency.note
run.shhas been changed to add a-xflag which passes-machine pc,accel=kvm,kernel-irqchip=on -cpu host,vmware-cpuid-freq=on,tsc-frequency=2600000000to qemu which will enable the KVM kernel module x2APIC support.here is the boot log after applying the patches in this branch (tested with and without x2APIC):