x86/mpparse: Use new APIC registration function
authorThomas Gleixner <tglx@linutronix.de>
Tue, 13 Feb 2024 21:05:42 +0000 (22:05 +0100)
committerThomas Gleixner <tglx@linutronix.de>
Thu, 15 Feb 2024 21:07:42 +0000 (22:07 +0100)
Aside of switching over to the new interface, record the number of
registered CPUs locally, which allows to make num_processors and
disabled_cpus confined to the topology code.

No functional change intended.

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/20240213210251.830955273@linutronix.de
arch/x86/include/asm/mpspec.h
arch/x86/kernel/cpu/topology.c
arch/x86/kernel/mpparse.c

index 1b79d0ee95dfabbcfbdc9d661b84c2ec4014cddf..c72c7ff78fcdc141e965910a89565a06a2a13027 100644 (file)
@@ -61,8 +61,6 @@ static inline void e820__memblock_alloc_reserved_mpc_new(void) { }
 #define mpparse_parse_smp_config       x86_init_noop
 #endif
 
-int generic_processor_info(int apicid);
-
 extern DECLARE_BITMAP(phys_cpu_present_map, MAX_LOCAL_APIC);
 
 static inline void reset_phys_cpu_present_map(u32 apicid)
index 3dd7e6c08cb58bea14a844164ea76444d6419e01..669e258b9e0b490e995a7a4861df9bc2c6b38012 100644 (file)
@@ -133,7 +133,7 @@ static void cpu_update_apic(int cpu, u32 apicid)
                cpu_mark_primary_thread(cpu, apicid);
 }
 
-int generic_processor_info(int apicid)
+static int generic_processor_info(int apicid)
 {
        int cpu, max = nr_cpu_ids;
 
index 9c000c409eb1df0ce4775ef7572bb78fae9cee89..1ccd30c8246faad1a2322081d030681ea8578288 100644 (file)
@@ -36,6 +36,8 @@
  * Checksum an MP configuration block.
  */
 
+static unsigned int num_procs __initdata;
+
 static int __init mpf_checksum(unsigned char *mp, int len)
 {
        int sum = 0;
@@ -50,16 +52,15 @@ static void __init MP_processor_info(struct mpc_cpu *m)
 {
        char *bootup_cpu = "";
 
-       if (!(m->cpuflag & CPU_ENABLED)) {
-               disabled_cpus++;
+       topology_register_apic(m->apicid, CPU_ACPIID_INVALID, m->cpuflag & CPU_ENABLED);
+       if (!(m->cpuflag & CPU_ENABLED))
                return;
-       }
 
        if (m->cpuflag & CPU_BOOTPROCESSOR)
                bootup_cpu = " (Bootup-CPU)";
 
        pr_info("Processor #%d%s\n", m->apicid, bootup_cpu);
-       generic_processor_info(m->apicid);
+       num_procs++;
 }
 
 #ifdef CONFIG_X86_IO_APIC
@@ -236,9 +237,9 @@ static int __init smp_read_mpc(struct mpc_table *mpc, unsigned early)
                }
        }
 
-       if (!num_processors)
+       if (!num_procs && !acpi_lapic)
                pr_err("MPTABLE: no processors registered!\n");
-       return num_processors;
+       return num_procs || acpi_lapic;
 }
 
 #ifdef CONFIG_X86_IO_APIC
@@ -529,8 +530,8 @@ static __init void mpparse_get_smp_config(unsigned int early)
        } else
                BUG();
 
-       if (!early)
-               pr_info("Processors: %d\n", num_processors);
+       if (!early && !acpi_lapic)
+               pr_info("Processors: %d\n", num_procs);
        /*
         * Only use the first configuration found.
         */