x86/cpu/topology: Rework possible CPU management
authorThomas Gleixner <tglx@linutronix.de>
Tue, 13 Feb 2024 21:05:53 +0000 (22:05 +0100)
committerThomas Gleixner <tglx@linutronix.de>
Thu, 15 Feb 2024 21:07:43 +0000 (22:07 +0100)
commit7c0edad3643f4493c4dafa6f5dfcfb1a86432156
treeb6e88ee7e910a8933a16cd10e850c04e973e7743
parent0e53e7b656cf5aa67c08eca381cec858478195a7
x86/cpu/topology: Rework possible CPU management

Managing possible CPUs is an unreadable and uncomprehensible maze. Aside of
that it's backwards because it applies command line limits after
registering all APICs.

Rewrite it so that it:

  - Applies the command line limits upfront so that only the allowed amount
    of APIC IDs can be registered.

  - Applies eventual late restrictions in an understandable way

  - Uses simple min_t() calculations which are trivial to follow.

  - Provides a separate function for resetting to UP mode late in the
    bringup process.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Tested-by: Michael Kelley <mhklinux@outlook.com>
Tested-by: Sohil Mehta <sohil.mehta@intel.com>
Link: https://lore.kernel.org/r/20240213210252.290098853@linutronix.de
arch/x86/include/asm/apic.h
arch/x86/include/asm/cpu.h
arch/x86/include/asm/topology.h
arch/x86/kernel/cpu/topology.c
arch/x86/kernel/setup.c
arch/x86/kernel/smpboot.c