From nobody Fri Dec 19 07:47:12 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 179B7C0015E for ; Mon, 24 Jul 2023 13:36:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231558AbjGXNf7 (ORCPT ); Mon, 24 Jul 2023 09:35:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36792 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231694AbjGXNf3 (ORCPT ); Mon, 24 Jul 2023 09:35:29 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8938DE70 for ; Mon, 24 Jul 2023 06:34:58 -0700 (PDT) Message-ID: <20230724132046.389025869@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1690205676; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: references:references; bh=VD8E0eWfITI3SqlQ5XFWHaHK77hHBGW1xMWiR2dsiXE=; b=M2dLAaFXgp43yWBh16JkrUS29uxgkJYLWVGWpJsccbZV5E0PwwMqtLlJlIYG0uKHx0wVKv scmGC9A+eZqjNaG4J3f7pUIr5zfLUe+FHGl2ZGlqc/7/IPX8mxruPWmcqGu/1YuDQ1F4Yp P9Pq8O3006dKIMbmDEkmsEzmfq2v6maR7qBWUG3jxK7rt1h8n/4gjTAxDNTBr7VSEzjYyU Ovd4AuSQxpSUVETbQia97fDtW6j5ojq9nK8KoLCu1ux0hs/djb83bIuG2gSeE0/LIFwkJg D3bkT77bQ/I8MaYciFogvun1Sc1ieSmqJDm5ypOAtIN3SSdPbnPw4GgESnxiyQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1690205676; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: references:references; bh=VD8E0eWfITI3SqlQ5XFWHaHK77hHBGW1xMWiR2dsiXE=; b=CVkXArHxb05JiM2QxCbKQdGHwwDdmrr9SqbSKTTleIkOkVQloKwy4GJw4yKQoxAz5j8D5k zoQr72/ZryQW8aDw== From: Thomas Gleixner To: LKML Cc: x86@kernel.org, Andrew Cooper , Tom Lendacky , Paolo Bonzini , Wei Liu , Arjan van de Ven , Juergen Gross , Michael Kelley , Peter Keresztes Schmidt , "Peter Zijlstra (Intel)" Subject: [patch V2 30/58] x86/apic: Mop up *setup_apic_routing() References: <20230724131206.500814398@linutronix.de> MIME-Version: 1.0 Date: Mon, 24 Jul 2023 15:34:36 +0200 (CEST) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" default_setup_apic_routing() is a complete misnomer. On 64bit it does the actual APIC probing and on 32bit it is used to force select the bigsmp APIC and to emit a redundant message in the apic::setup_apic_routing() callback. Rename the 64bit and 32bit function so they reflect what they are doing and remove the useless APIC callback. Signed-off-by: Thomas Gleixner Acked-by: Peter Zijlstra (Intel) --- arch/x86/include/asm/apic.h | 10 ++++------ arch/x86/kernel/apic/apic.c | 4 +++- arch/x86/kernel/apic/apic_flat_64.c | 2 -- arch/x86/kernel/apic/apic_noop.c | 1 - arch/x86/kernel/apic/apic_numachip.c | 2 -- arch/x86/kernel/apic/bigsmp_32.c | 8 -------- arch/x86/kernel/apic/local.h | 2 ++ arch/x86/kernel/apic/probe_32.c | 17 ++--------------- arch/x86/kernel/apic/probe_64.c | 2 +- arch/x86/kernel/apic/x2apic_cluster.c | 1 - arch/x86/kernel/apic/x2apic_phys.c | 1 - arch/x86/kernel/apic/x2apic_uv_x.c | 1 - arch/x86/kernel/setup.c | 2 +- arch/x86/xen/apic.c | 1 - 14 files changed, 13 insertions(+), 41 deletions(-) --- a/arch/x86/include/asm/apic.h +++ b/arch/x86/include/asm/apic.h @@ -40,11 +40,9 @@ =20 =20 #if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_X86_32) -extern void generic_apic_probe(void); +extern void x86_32_probe_apic(void); #else -static inline void generic_apic_probe(void) -{ -} +static inline void x86_32_probe_apic(void) { } #endif =20 #ifdef CONFIG_X86_LOCAL_APIC @@ -302,7 +300,6 @@ struct apic { bool (*check_apicid_used)(physid_mask_t *map, int apicid); void (*init_apic_ldr)(void); void (*ioapic_phys_id_map)(physid_mask_t *phys_map, physid_mask_t *retmap= ); - void (*setup_apic_routing)(void); int (*cpu_present_to_apicid)(int mps_cpu); int (*phys_pkg_id)(int cpuid_apic, int index_msb); =20 @@ -457,12 +454,13 @@ static inline unsigned int read_apic_id( typedef int (*wakeup_cpu_handler)(int apicid, unsigned long start_eip); extern void acpi_wake_cpu_handler_update(wakeup_cpu_handler handler); extern int default_acpi_madt_oem_check(char *, char *); +extern void x86_64_probe_apic(void); #else static inline int default_acpi_madt_oem_check(char *a, char *b) { return 0= ; } +static inline void x86_64_probe_apic(void) { } #endif =20 extern int default_apic_id_valid(u32 apicid); -extern void default_setup_apic_routing(void); =20 extern u32 apic_default_calc_apicid(unsigned int cpu); extern u32 apic_flat_calc_apicid(unsigned int cpu); --- a/arch/x86/kernel/apic/apic.c +++ b/arch/x86/kernel/apic/apic.c @@ -1419,7 +1419,9 @@ void __init apic_intr_mode_init(void) break; } =20 - default_setup_apic_routing(); + x86_64_probe_apic(); + + x86_32_install_bigsmp(); =20 if (x86_platform.apic_post_init) x86_platform.apic_post_init(); --- a/arch/x86/kernel/apic/apic_flat_64.c +++ b/arch/x86/kernel/apic/apic_flat_64.c @@ -101,7 +101,6 @@ static struct apic apic_flat __ro_after_ .check_apicid_used =3D NULL, .init_apic_ldr =3D default_init_apic_ldr, .ioapic_phys_id_map =3D NULL, - .setup_apic_routing =3D NULL, .cpu_present_to_apicid =3D default_cpu_present_to_apicid, .phys_pkg_id =3D flat_phys_pkg_id, =20 @@ -178,7 +177,6 @@ static struct apic apic_physflat __ro_af =20 .check_apicid_used =3D NULL, .ioapic_phys_id_map =3D NULL, - .setup_apic_routing =3D NULL, .cpu_present_to_apicid =3D default_cpu_present_to_apicid, .phys_pkg_id =3D flat_phys_pkg_id, =20 --- a/arch/x86/kernel/apic/apic_noop.c +++ b/arch/x86/kernel/apic/apic_noop.c @@ -94,7 +94,6 @@ struct apic apic_noop __ro_after_init =3D =20 .check_apicid_used =3D default_check_apicid_used, .ioapic_phys_id_map =3D default_ioapic_phys_id_map, - .setup_apic_routing =3D NULL, .cpu_present_to_apicid =3D default_cpu_present_to_apicid, =20 .phys_pkg_id =3D noop_phys_pkg_id, --- a/arch/x86/kernel/apic/apic_numachip.c +++ b/arch/x86/kernel/apic/apic_numachip.c @@ -253,7 +253,6 @@ static const struct apic apic_numachip1 =20 .check_apicid_used =3D NULL, .ioapic_phys_id_map =3D NULL, - .setup_apic_routing =3D NULL, .cpu_present_to_apicid =3D default_cpu_present_to_apicid, .phys_pkg_id =3D numachip_phys_pkg_id, =20 @@ -296,7 +295,6 @@ static const struct apic apic_numachip2 =20 .check_apicid_used =3D NULL, .ioapic_phys_id_map =3D NULL, - .setup_apic_routing =3D NULL, .cpu_present_to_apicid =3D default_cpu_present_to_apicid, .phys_pkg_id =3D numachip_phys_pkg_id, =20 --- a/arch/x86/kernel/apic/bigsmp_32.c +++ b/arch/x86/kernel/apic/bigsmp_32.c @@ -28,13 +28,6 @@ static bool bigsmp_check_apicid_used(phy return false; } =20 -static void bigsmp_setup_apic_routing(void) -{ - printk(KERN_INFO - "Enabling APIC mode: Physflat. Using %d I/O APICs\n", - nr_ioapics); -} - static void bigsmp_ioapic_phys_id_map(physid_mask_t *phys_map, physid_mask= _t *retmap) { /* For clustered we don't have a good way to do this yet - hack */ @@ -101,7 +94,6 @@ static struct apic apic_bigsmp __ro_afte =20 .check_apicid_used =3D bigsmp_check_apicid_used, .ioapic_phys_id_map =3D bigsmp_ioapic_phys_id_map, - .setup_apic_routing =3D bigsmp_setup_apic_routing, .cpu_present_to_apicid =3D default_cpu_present_to_apicid, .phys_pkg_id =3D bigsmp_phys_pkg_id, =20 --- a/arch/x86/kernel/apic/local.h +++ b/arch/x86/kernel/apic/local.h @@ -66,8 +66,10 @@ void default_send_IPI_mask_sequence_logi void default_send_IPI_mask_allbutself_logical(const struct cpumask *mask, = int vector); void default_send_IPI_mask_logical(const struct cpumask *mask, int vector); void x86_32_probe_bigsmp_early(void); +void x86_32_install_bigsmp(void); #else static inline void x86_32_probe_bigsmp_early(void) { } +static inline void x86_32_install_bigsmp(void) { } #endif =20 #ifdef CONFIG_X86_BIGSMP --- a/arch/x86/kernel/apic/probe_32.c +++ b/arch/x86/kernel/apic/probe_32.c @@ -18,15 +18,6 @@ =20 #include "local.h" =20 -static void setup_apic_flat_routing(void) -{ -#ifdef CONFIG_X86_IO_APIC - printk(KERN_INFO - "Enabling APIC mode: Flat. Using %d I/O APICs\n", - nr_ioapics); -#endif -} - static int default_apic_id_registered(void) { return physid_isset(read_apic_id(), phys_cpu_present_map); @@ -58,7 +49,6 @@ static struct apic apic_default __ro_aft .check_apicid_used =3D default_check_apicid_used, .init_apic_ldr =3D default_init_apic_ldr, .ioapic_phys_id_map =3D default_ioapic_phys_id_map, - .setup_apic_routing =3D setup_apic_flat_routing, .cpu_present_to_apicid =3D default_cpu_present_to_apicid, .phys_pkg_id =3D default_phys_pkg_id, =20 @@ -132,16 +122,13 @@ void __init x86_32_probe_bigsmp_early(vo set_nr_cpu_ids(8); } =20 -void __init default_setup_apic_routing(void) +void __init x86_32_install_bigsmp(void) { if (nr_cpu_ids >=3D 8 && !xen_pv_domain()) apic_bigsmp_force(); - - if (apic->setup_apic_routing) - apic->setup_apic_routing(); } =20 -void __init generic_apic_probe(void) +void __init x86_32_probe_apic(void) { if (!cmdline_apic) { struct apic **drv; --- a/arch/x86/kernel/apic/probe_64.c +++ b/arch/x86/kernel/apic/probe_64.c @@ -14,7 +14,7 @@ #include "local.h" =20 /* Select the appropriate APIC driver */ -void __init default_setup_apic_routing(void) +void __init x86_64_probe_apic(void) { struct apic **drv; =20 --- a/arch/x86/kernel/apic/x2apic_cluster.c +++ b/arch/x86/kernel/apic/x2apic_cluster.c @@ -247,7 +247,6 @@ static struct apic apic_x2apic_cluster _ .check_apicid_used =3D NULL, .init_apic_ldr =3D init_x2apic_ldr, .ioapic_phys_id_map =3D NULL, - .setup_apic_routing =3D NULL, .cpu_present_to_apicid =3D default_cpu_present_to_apicid, .phys_pkg_id =3D x2apic_phys_pkg_id, =20 --- a/arch/x86/kernel/apic/x2apic_phys.c +++ b/arch/x86/kernel/apic/x2apic_phys.c @@ -166,7 +166,6 @@ static struct apic apic_x2apic_phys __ro =20 .check_apicid_used =3D NULL, .ioapic_phys_id_map =3D NULL, - .setup_apic_routing =3D NULL, .cpu_present_to_apicid =3D default_cpu_present_to_apicid, .phys_pkg_id =3D x2apic_phys_pkg_id, =20 --- a/arch/x86/kernel/apic/x2apic_uv_x.c +++ b/arch/x86/kernel/apic/x2apic_uv_x.c @@ -838,7 +838,6 @@ static struct apic apic_x2apic_uv_x __ro =20 .check_apicid_used =3D NULL, .ioapic_phys_id_map =3D NULL, - .setup_apic_routing =3D NULL, .cpu_present_to_apicid =3D default_cpu_present_to_apicid, .phys_pkg_id =3D uv_phys_pkg_id, =20 --- a/arch/x86/kernel/setup.c +++ b/arch/x86/kernel/setup.c @@ -1253,7 +1253,7 @@ void __init setup_arch(char **cmdline_p) =20 map_vsyscall(); =20 - generic_apic_probe(); + x86_32_probe_apic(); =20 early_quirks(); =20 --- a/arch/x86/xen/apic.c +++ b/arch/x86/xen/apic.c @@ -150,7 +150,6 @@ static struct apic xen_pv_apic =3D { =20 .check_apicid_used =3D default_check_apicid_used, /* Used on 32-bit */ .ioapic_phys_id_map =3D default_ioapic_phys_id_map, /* Used on 32-bit */ - .setup_apic_routing =3D NULL, .cpu_present_to_apicid =3D xen_cpu_present_to_apicid, .phys_pkg_id =3D xen_phys_pkg_id, /* detect_ht */