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 πŸ”’ ⚠
Safety
count_processors πŸ”’ ⚠
Counts the number of processors. Safety: This function needs to be called after the OS initializes the ACPI table.
fill_boot_info_ptr πŸ”’ ⚠
Safety
fill_boot_pt_ptr πŸ”’ ⚠
Safety
reclaimable_memory_region πŸ”’
send_boot_ipis πŸ”’ ⚠
Sends IPIs to notify all application processors to boot.
send_init_deassert πŸ”’ ⚠
Safety
send_init_to_all_aps πŸ”’ ⚠
Safety
send_startup_to_all_aps πŸ”’ ⚠
Safety
spin_wait_cycles πŸ”’
Spin wait approximately c cycles.
wake_up_aps_via_mailbox πŸ”’ ⚠
Wakes up all application processors via the ACPI multiprocessor mailbox structure.