From nobody Fri Dec 19 07:46:22 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 D8053C001DF for ; Mon, 24 Jul 2023 13:38:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231791AbjGXNiH (ORCPT ); Mon, 24 Jul 2023 09:38:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37452 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231153AbjGXNhf (ORCPT ); Mon, 24 Jul 2023 09:37:35 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6C71F30EC for ; Mon, 24 Jul 2023 06:36:13 -0700 (PDT) Message-ID: <20230724132047.667644433@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1690205715; 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=Nbvmnz+q7lfNjTCb/pF8Ed6DjVtg5/qR2ISN11UnuKc=; b=x/TM2AVlAMspr0k4XPiVpGv4qqKGxWAjwzMtqbvdQoC2PCngvuwEH76vwlPhu8NcQ0MMT1 iY+btmzfOwI7dLoIZdZweSfdmCPNfY/YX+8NWhWm2Dnv1zzJb+pVoW0umR4+Nze2knnofU vggEtvf7r4ruXT63hnFPbcqtwMLO1BoNawaI0phRZ9XTOm+FpugEBohMe7eqWUFmtlT89Y qGRq5jQSwPB9Kxma0DZqow6CX3klJsijOhvIPk7vpxMdzp0ZFmtRIJrZzUCFXffB668HBP WTMknH9qbOyrVBg/4qCm+U0em5oyrmTiq2ebCkhD3FDC7+45W2oG+lt93MQL6Q== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1690205715; 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=Nbvmnz+q7lfNjTCb/pF8Ed6DjVtg5/qR2ISN11UnuKc=; b=RvrRRYAZAKmZUkQxtFTZwGYvaOYPJoNVkt9p8f/9Fsh7RpaCVa5arWT6SYxcme0ukB5qti 7x6c7Nj1Z4FUYjAA== 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 52/58] x86/apic: Replace acpi_wake_cpu_handler_update() and apic_set_eoi_cb() References: <20230724131206.500814398@linutronix.de> MIME-Version: 1.0 Date: Mon, 24 Jul 2023 15:35:14 +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" Switch them over to apic_update_callback() and remove the code. Signed-off-by: Thomas Gleixner Reviewed-by: Wei Liu Acked-by: Peter Zijlstra (Intel) --- arch/x86/hyperv/hv_apic.c | 2 +- arch/x86/hyperv/hv_vtl.c | 2 +- arch/x86/include/asm/apic.h | 3 --- arch/x86/kernel/acpi/boot.c | 2 +- arch/x86/kernel/apic/init.c | 27 --------------------------- arch/x86/kernel/kvm.c | 4 ++-- 6 files changed, 5 insertions(+), 35 deletions(-) --- a/arch/x86/hyperv/hv_apic.c +++ b/arch/x86/hyperv/hv_apic.c @@ -310,7 +310,7 @@ void __init hv_apic_init(void) * lazy EOI when available, but the same accessor works for * both xapic and x2apic because the field layout is the same. */ - apic_set_eoi_cb(hv_apic_eoi_write); + apic_update_callback(eoi, hv_apic_eoi_write); if (!x2apic_enabled()) { apic->read =3D hv_apic_read; apic->write =3D hv_apic_write; --- a/arch/x86/hyperv/hv_vtl.c +++ b/arch/x86/hyperv/hv_vtl.c @@ -222,7 +222,7 @@ static int __init hv_vtl_early_init(void "Please add 'noxsave' to the kernel command line.\n"); =20 real_mode_header =3D &hv_vtl_real_mode_header; - apic->wakeup_secondary_cpu_64 =3D hv_vtl_wakeup_secondary_cpu; + apic_update_callback(wakeup_secondary_cpu_64, hv_vtl_wakeup_secondary_cpu= ); =20 return 0; } --- a/arch/x86/include/asm/apic.h +++ b/arch/x86/include/asm/apic.h @@ -417,8 +417,6 @@ static inline bool apic_id_valid(u32 api return apic_id <=3D apic->max_apic_id; } =20 -extern void __init apic_set_eoi_cb(void (*eoi)(void)); - #else /* CONFIG_X86_LOCAL_APIC */ =20 static inline u32 apic_read(u32 reg) { return 0; } @@ -478,7 +476,6 @@ static inline unsigned int read_apic_id( =20 #ifdef CONFIG_X86_64 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 --- a/arch/x86/kernel/acpi/boot.c +++ b/arch/x86/kernel/acpi/boot.c @@ -1174,7 +1174,7 @@ static int __init acpi_parse_mp_wake(uni =20 acpi_mp_wake_mailbox_paddr =3D mp_wake->base_address; =20 - acpi_wake_cpu_handler_update(acpi_wakeup_cpu); + apic_update_callback(wakeup_secondary_cpu_64, acpi_wakeup_cpu); =20 return 0; } --- a/arch/x86/kernel/apic/init.c +++ b/arch/x86/kernel/apic/init.c @@ -55,30 +55,3 @@ void __init apic_install_driver(struct a =20 pr_info("Switched APIC routing to: %s\n", driver->name); } - -#ifdef CONFIG_X86_64 -void __init acpi_wake_cpu_handler_update(wakeup_cpu_handler handler) -{ - struct apic **drv; - - for (drv =3D __apicdrivers; drv < __apicdrivers_end; drv++) - (*drv)->wakeup_secondary_cpu_64 =3D handler; -} -#endif - -/* - * Override the generic EOI implementation with an optimized version. - * Only called during early boot when only one CPU is active and with - * interrupts disabled, so we know this does not race with actual APIC dri= ver - * use. - */ -void __init apic_set_eoi_cb(void (*eoi)(void)) -{ - struct apic **drv; - - for (drv =3D __apicdrivers; drv < __apicdrivers_end; drv++) { - /* Should happen once for each apic */ - WARN_ON((*drv)->eoi =3D=3D eoi); - (*drv)->eoi =3D eoi; - } -} --- a/arch/x86/kernel/kvm.c +++ b/arch/x86/kernel/kvm.c @@ -332,7 +332,7 @@ static void kvm_register_steal_time(void =20 static DEFINE_PER_CPU_DECRYPTED(unsigned long, kvm_apic_eoi) =3D KVM_PV_EO= I_DISABLED; =20 -static notrace void kvm_guest_apic_eoi_write(void) +static notrace __maybe_unused void kvm_guest_apic_eoi_write(void) { /** * This relies on __test_and_clear_bit to modify the memory @@ -825,7 +825,7 @@ static void __init kvm_guest_init(void) } =20 if (kvm_para_has_feature(KVM_FEATURE_PV_EOI)) - apic_set_eoi_cb(kvm_guest_apic_eoi_write); + apic_update_callback(eoi, kvm_guest_apic_eoi_write); =20 if (kvm_para_has_feature(KVM_FEATURE_ASYNC_PF_INT) && kvmapf) { static_branch_enable(&kvm_async_pf_enabled);