From patchwork Wed Aug 9 20:36:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tip-bot2 for Thomas Gleixner X-Patchwork-Id: 133558 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b824:0:b0:3f2:4152:657d with SMTP id z4csp31787vqi; Wed, 9 Aug 2023 15:01:20 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEp26IUb5O7MuGPpjzufAo9J4HfkTFuUj2MPi/fx5H4TnylCVtMqtYfnOT4o2rx1/XMNKvE X-Received: by 2002:a05:6a21:3285:b0:13a:3bd6:2530 with SMTP id yt5-20020a056a21328500b0013a3bd62530mr268262pzb.1.1691618479783; Wed, 09 Aug 2023 15:01:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691618479; cv=none; d=google.com; s=arc-20160816; b=m+GZBZIQk0jjXGqlRtMpO0RWzxEUjTo+anhNS/u0w+MMO9Ry+oDKrXBwgetwSITgR8 8l7twXd5kk7EyStgrdItoEZA4W13/+WcwfEkk80NNFcYqF5UV9SU4vl3liE44Hi63ZxS RpnwOSNAGr0ftt8+4/SyuYqQhcEJKdwavla+vxcpYsRwG1GKDc1EwIZTkdNWX36KZALc mNJyHFKKaP2lTk8xhMxitpnz0iAWXs4lmgVEW8RTYZiHO6d7ILF/p9VFhrZGwuZ8B3vd tD8eV4pGJbHe3QJcF0iJ4VdToGihQS7cmN7RkthmvoT5cv2HO0dH+Ge72CbM2CAMXqWx kGuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:cc:subject:to:reply-to:sender:from :dkim-signature:dkim-signature:date; bh=L4/E+IllbdMPEZagDIc603Uq48zuXbP57pSztKeeOwQ=; fh=3EEdffVO1u57bPhyZ2turqC7dCZjpAIo7dhi9N7YQPE=; b=wpl0aY56oCv+Lu5zy0UIMA06bEPXV/YRD7dSR14mH6CMRLNyX/g6hwURfvq8LmKnur V/JxOGe5XFhh9+RditRibAA6dF7hgTaek4dkFbPrv+GSA/J0CL/OONadNbjSr+kn7oH4 hd8lJcHfh1smCc8i9qQcc394fjgTLGKjaps+Jhr7kJa1zeqf5p6v52SfXBTnHCKs1xc3 nfdsi7XMFtiD9DWNRSO57qiA7YoBDlho4pxheQr3z8xkLWRkV2lHB9pZ1upxB586P+Nm qWqE+PD7ubwjbdXlPG8z6R6iTh01RI9Dr4RO/FdKyoWYxxHeuOhS3RtJecljmNssqhRk u9zQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=IF1925lY; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e12-20020a65678c000000b005633498bbf3si132669pgr.290.2023.08.09.15.01.05; Wed, 09 Aug 2023 15:01:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=IF1925lY; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234611AbjHIUgW (ORCPT + 99 others); Wed, 9 Aug 2023 16:36:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53300 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234535AbjHIUgJ (ORCPT ); Wed, 9 Aug 2023 16:36:09 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9F7A42112; Wed, 9 Aug 2023 13:36:08 -0700 (PDT) Date: Wed, 09 Aug 2023 20:36:06 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1691613367; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=L4/E+IllbdMPEZagDIc603Uq48zuXbP57pSztKeeOwQ=; b=IF1925lYp2t43P4rIvwwdEDX/KLBB2TQ6Vvks7VD7eZ9z2CQiub6z9ZmVdTltmBec/rfyf lewy7hwZWn+1jXV80OjFVF4LFvQaJK/sVxeYL9elSF+12VY4Z1eCXZhe9awQmzCvyij1UM XNEmv4OdTfEamP1ecAOeM7RHEFSXxMmq5i1jS9r0FIRBO00AI3bxqAK876t+v0pg7Xx3Al DPxgIMNFjh+CRC2/OxSfFNpqwA9LEPey06/Fbf32hXNlNZN4awp1roAYeG26tx1zPsdjkg 5ukuOWNCo9r4r9bQMu2BaqSoEjJnjijUhdXzZ07JfTILfjDAq/bBlZ3Af5Tz6w== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1691613367; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=L4/E+IllbdMPEZagDIc603Uq48zuXbP57pSztKeeOwQ=; b=/UM5qqh3eCmfTihR2WKpA2NzeJtgHTF5FZfYsXWiMn+LM488eV5LKx6e88+J0ZZvU6JTr6 UlcKICZqGavhfPCA== From: "tip-bot2 for Thomas Gleixner" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/apic] x86/apic: Replace acpi_wake_cpu_handler_update() and apic_set_eoi_cb() Cc: Thomas Gleixner , Dave Hansen , Wei Liu , "Peter Zijlstra (Intel)" , Michael Kelley , Sohil Mehta , Juergen Gross , x86@kernel.org, linux-kernel@vger.kernel.org MIME-Version: 1.0 Message-ID: <169161336670.27769.11370854432317500189.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773790539375634282 X-GMAIL-MSGID: 1773790539375634282 The following commit has been merged into the x86/apic branch of tip: Commit-ID: 2744a7ce34a776444225f20ae11ead6e980a129a Gitweb: https://git.kernel.org/tip/2744a7ce34a776444225f20ae11ead6e980a129a Author: Thomas Gleixner AuthorDate: Tue, 08 Aug 2023 15:04:20 -07:00 Committer: Dave Hansen CommitterDate: Wed, 09 Aug 2023 12:00:46 -07:00 x86/apic: Replace acpi_wake_cpu_handler_update() and apic_set_eoi_cb() Switch them over to apic_update_callback() and remove the code. Signed-off-by: Thomas Gleixner Signed-off-by: Dave Hansen Reviewed-by: Wei Liu Acked-by: Peter Zijlstra (Intel) Tested-by: Michael Kelley Tested-by: Sohil Mehta Tested-by: Juergen Gross # Xen PV (dom0 and unpriv. guest) --- 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(-) diff --git a/arch/x86/hyperv/hv_apic.c b/arch/x86/hyperv/hv_apic.c index 5513f60..bfb02f6 100644 --- 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 = hv_apic_read; apic->write = hv_apic_write; diff --git a/arch/x86/hyperv/hv_vtl.c b/arch/x86/hyperv/hv_vtl.c index 85d38b9..9976b77 100644 --- 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"); real_mode_header = &hv_vtl_real_mode_header; - apic->wakeup_secondary_cpu_64 = hv_vtl_wakeup_secondary_cpu; + apic_update_callback(wakeup_secondary_cpu_64, hv_vtl_wakeup_secondary_cpu); return 0; } diff --git a/arch/x86/include/asm/apic.h b/arch/x86/include/asm/apic.h index 6e279c1..1742f97 100644 --- 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 apic_id) return apic_id <= apic->max_apic_id; } -extern void __init apic_set_eoi_cb(void (*eoi)(void)); - #else /* CONFIG_X86_LOCAL_APIC */ static inline u32 apic_read(u32 reg) { return 0; } @@ -478,7 +476,6 @@ static inline unsigned int read_apic_id(void) #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 diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c index 7f5b257..2374989 100644 --- 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(union acpi_subtable_headers *header, acpi_mp_wake_mailbox_paddr = mp_wake->base_address; - acpi_wake_cpu_handler_update(acpi_wakeup_cpu); + apic_update_callback(wakeup_secondary_cpu_64, acpi_wakeup_cpu); return 0; } diff --git a/arch/x86/kernel/apic/init.c b/arch/x86/kernel/apic/init.c index dab3afa..d7f4aca 100644 --- a/arch/x86/kernel/apic/init.c +++ b/arch/x86/kernel/apic/init.c @@ -55,30 +55,3 @@ void __init apic_install_driver(struct apic *driver) 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 = __apicdrivers; drv < __apicdrivers_end; drv++) - (*drv)->wakeup_secondary_cpu_64 = 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 driver - * use. - */ -void __init apic_set_eoi_cb(void (*eoi)(void)) -{ - struct apic **drv; - - for (drv = __apicdrivers; drv < __apicdrivers_end; drv++) { - /* Should happen once for each apic */ - WARN_ON((*drv)->eoi == eoi); - (*drv)->eoi = eoi; - } -} diff --git a/arch/x86/kernel/kvm.c b/arch/x86/kernel/kvm.c index 54625a4..c86cedb 100644 --- a/arch/x86/kernel/kvm.c +++ b/arch/x86/kernel/kvm.c @@ -332,7 +332,7 @@ static void kvm_register_steal_time(void) static DEFINE_PER_CPU_DECRYPTED(unsigned long, kvm_apic_eoi) = KVM_PV_EOI_DISABLED; -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) } 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); if (kvm_para_has_feature(KVM_FEATURE_ASYNC_PF_INT) && kvmapf) { static_branch_enable(&kvm_async_pf_enabled);