Module smp

Source
Expand description

Multiprocessor Boot Support

The MP initialization protocol defines two classes of processors: the bootstrap processor (BSP) and the application processors (APs). Following a power-up or RESET of an MP system, system hardware dynamically selects one of the processors on the system bus as the BSP. The remaining processors are designated as APs.

The BSP executes the BIOS’s boot-strap code to configure the APIC environment, sets up system-wide data structures. Up to now, BSP has completed most of the initialization of the OS, but APs has not been awakened.

Following a power-up or reset, the APs complete a minimal self-configuration, then wait for a startup signal (a SIPI message) from the BSP processor.

The wake-up of AP follows SNIT-SIPI-SIPI IPI sequence:

  • Broadcast INIT IPI (Initialize the APs to the wait-for-SIPI state)
  • Wait
  • Broadcast De-assert INIT IPI (Only older processors need this step)
  • Wait
  • Broadcast SIPI IPI (APs exits the wait-for-SIPI state and starts executing code)
  • Wait
  • Broadcast SIPI IPI (If an AP fails to start)

This sequence does not need to be strictly followed, and there may be different considerations in different systems.

ConstantsΒ§

AP_BOOT_START_PA πŸ”’
This is where the linker load the symbols in the .ap_boot section. The BSP would copy the AP boot code to this address.

FunctionsΒ§

__ap_boot_end πŸ”’ ⚠
__ap_boot_start πŸ”’ ⚠
ap_boot_code_size πŸ”’
The size of the AP boot code (the .ap_boot section).
bringup_all_aps πŸ”’ ⚠
Brings up all application processors.
copy_ap_boot_code πŸ”’ ⚠
AP_BOOT_START_PA should be valid for writing AP boot code.
count_processors πŸ”’ ⚠
Counts the number of processors.
fill_boot_info_ptr πŸ”’ ⚠
info_ptr should be valid for writing.
fill_boot_pt_ptr πŸ”’ ⚠
pt_ptr should be valid for writing.
reclaimable_memory_region πŸ”’
send_boot_ipis πŸ”’ ⚠
Sends IPIs to notify all application processors to boot.
send_init_deassert πŸ”’ ⚠
Deasserting INIT IPIs for all CPUs excluding self should be valid.
send_init_to_all_aps πŸ”’ ⚠
Sending INIT IPIs to all CPUs excluding self should be valid.
send_startup_to_all_aps πŸ”’ ⚠
Sending STARTUP IPIs to all CPUs excluding self should be valid.
spin_wait_cycles πŸ”’
Spin wait approximately c cycles.
wake_up_aps_via_mailbox πŸ”’ ⚠
Wakes up all application processors via the ACPI multiprocessor mailbox structure.