From patchwork Mon Jul 17 23:15:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Gleixner X-Patchwork-Id: 121653 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c923:0:b0:3e4:2afc:c1 with SMTP id j3csp1400806vqt; Mon, 17 Jul 2023 16:21:47 -0700 (PDT) X-Google-Smtp-Source: APBJJlGFu/K2t0NyrfN85gUSj0IwFQ2InkH54t7vMJ1Q/IN7vMJHXXQzdhp8c1LCm8LgkZin6KcS X-Received: by 2002:a9d:6219:0:b0:6b9:a6ef:2709 with SMTP id g25-20020a9d6219000000b006b9a6ef2709mr1169358otj.8.1689636107731; Mon, 17 Jul 2023 16:21:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689636107; cv=none; d=google.com; s=arc-20160816; b=Dsv0xaSnv9DvFFt1cPN9j46u9LxGuc4PSTBBnVkragUiFG51YZShtj/j2AVZ+e1lWT bYtXNCql32aIvnMjEIxQKcjCHsynO4pWlrmXqAlJXskjmftuC3p6OSYO+iBqydvniNNC vNbfFSTjA6i1QrFfkdQz6qSCX36q/UQMqqqjG/JUxNc20wEQ6vs5wv3bs/5Qs3RmL/NA 2SUds7HW8UcVqsUJImG/nHYEMzN6f+GVomKwbSwLOb79855FRtGKZXcZvR/KuR+7q4ae 8Th3FX9ODINm6ordbvz+INkq0RzP+dcwYnpF/KiDgdnqPoXblheU/zotbSJ/Y8vkg3ks SDDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:date:mime-version:references:subject:cc:to:from :dkim-signature:dkim-signature:message-id; bh=X34cmveL8Me/hBK02cEFeh6qWm49lBpmvG/a5va6nks=; fh=MJzvnywV9/WrN/ASipmGkNx/7jKFHnq83nsgXe/obdc=; b=DgK5WH/iadzc8t5KMlHgmBKJwkCR7NfJtWJZjDxvep28bhjGmH2pPPHtuOCbQp0n31 InWWpF7O2oaj7Qn2RwuBlMp+XB4vFvkxulkooA8UBqUZv0ynnkVk/nu0CzP4eqDaY5J0 yAOMzE0KuJsJK3WWu+xVtQFNfjdpVqOjy+vRS/pbGjEcHg4aKEuf/+c44xLXBOlI4AuY +WS0kd8SqlRNBLJMf9SnqQ3ZMTW4S9ujM+BLCrdeZ50b7NsGy/L+hFWvWnc5z7Mf+BCr QEjwT8aNiD8UF9rt4S7tXAxwHkJ1dF2HyVuqoxTV2iUMq8awwnsdZ9ZZ5NXq+WOycgVh E5/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=tcurvsLO; 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 k25-20020a6568d9000000b0055727399652si511007pgt.577.2023.07.17.16.21.34; Mon, 17 Jul 2023 16:21:47 -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=tcurvsLO; 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 S231487AbjGQXST (ORCPT + 99 others); Mon, 17 Jul 2023 19:18:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37540 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231496AbjGQXSR (ORCPT ); Mon, 17 Jul 2023 19:18:17 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 309D7172A for ; Mon, 17 Jul 2023 16:17:23 -0700 (PDT) Message-ID: <20230717223225.156587052@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1689635729; 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=X34cmveL8Me/hBK02cEFeh6qWm49lBpmvG/a5va6nks=; b=tcurvsLO1Z2sDkcBbbOc40m0poc21jDMJnyhGRIczV4CuIdgr4zYf33u+9rQutqDfIAofd TpIxSPWbW7z1GS2p9YahX+v7n+8hVXaqzJCkgP7OfblUwP/zlGxcnvnAHkDiRXuNpcPmKP /H2Cet1v8UouW9r2CehjOE56QyDMxrP53QqfTcIxD2oRqUdh2+RHbPl97y7lBvlG//QPCP 6exmGfO4U7YgaddsJOxT2hW1o66TWFvwLTeb9e3ViKChP9OmKMscjF2kSYfum+buLg8fQh cGw5siSoB+4bNNzY7UhmP/KPpSfASMaiM8WVauuOkDRpq6ei0uMNGgnEExh3lQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1689635729; 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=X34cmveL8Me/hBK02cEFeh6qWm49lBpmvG/a5va6nks=; b=DpW4Ja5T5hp5CfsVhrAqaGt+QRZyT1Bdijwy2WeaP87aHEYHESUPwwXwPxf9AlxWGVO1+g ch7z4ToBXjLKBnCg== From: Thomas Gleixner To: LKML Cc: x86@kernel.org, Linus Torvalds , Andrew Cooper , Tom Lendacky , Paolo Bonzini , Wei Liu , Arjan van de Ven , Juergen Gross Subject: [patch 35/58] x86/apic: Allow apic::safe_wait_icr_idle() to be NULL References: <20230717223049.327865981@linutronix.de> MIME-Version: 1.0 Date: Tue, 18 Jul 2023 01:15:28 +0200 (CEST) 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,T_SCC_BODY_TEXT_LINE 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: 1771711870967143521 X-GMAIL-MSGID: 1771711870967143521 Remove tons of NOOP callbacks by making the invocation of safe_wait_icr_idle() conditional in the inline wrapper. Will be replaced by a static_call_cond() later. Signed-off-by: Thomas Gleixner --- arch/x86/include/asm/apic.h | 8 +------- arch/x86/kernel/apic/apic_noop.c | 6 ------ arch/x86/kernel/apic/apic_numachip.c | 8 -------- 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/xen/apic.c | 6 ------ 7 files changed, 1 insertion(+), 30 deletions(-) --- a/arch/x86/include/asm/apic.h +++ b/arch/x86/include/asm/apic.h @@ -206,12 +206,6 @@ static inline u32 native_apic_msr_read(u return (u32)msr; } -static inline u32 native_safe_x2apic_wait_icr_idle(void) -{ - /* no need to wait for icr idle in x2apic */ - return 0; -} - static inline void native_x2apic_icr_write(u32 low, u32 id) { wrmsrl(APIC_BASE_MSR + (APIC_ICR >> 4), ((__u64) id) << 32 | low); @@ -376,7 +370,7 @@ static inline void apic_wait_icr_idle(vo static inline u32 safe_apic_wait_icr_idle(void) { - return apic->safe_wait_icr_idle(); + return apic->safe_wait_icr_idle ? apic->safe_wait_icr_idle() : 0; } extern void __init apic_set_eoi_write(void (*eoi_write)(u32 reg, u32 v)); --- a/arch/x86/kernel/apic/apic_noop.c +++ b/arch/x86/kernel/apic/apic_noop.c @@ -27,11 +27,6 @@ static int noop_wakeup_secondary_cpu(int return -1; } -static u32 noop_safe_apic_wait_icr_idle(void) -{ - return 0; -} - static u64 noop_apic_icr_read(void) { return 0; @@ -104,5 +99,4 @@ struct apic apic_noop __ro_after_init = .eoi_write = noop_apic_write, .icr_read = noop_apic_icr_read, .icr_write = noop_apic_icr_write, - .safe_wait_icr_idle = noop_safe_apic_wait_icr_idle, }; --- a/arch/x86/kernel/apic/apic_numachip.c +++ b/arch/x86/kernel/apic/apic_numachip.c @@ -223,12 +223,6 @@ static int numachip2_acpi_madt_oem_check return 1; } -/* APIC NMI IPIs are queued */ -static u32 numachip_safe_apic_wait_icr_idle(void) -{ - return 0; -} - static const struct apic apic_numachip1 __refconst = { .name = "NumaConnect system", .probe = numachip1_probe, @@ -264,7 +258,6 @@ static const struct apic apic_numachip1 .eoi_write = native_apic_mem_write, .icr_read = native_apic_icr_read, .icr_write = native_apic_icr_write, - .safe_wait_icr_idle = numachip_safe_apic_wait_icr_idle, }; apic_driver(apic_numachip1); @@ -304,7 +297,6 @@ static const struct apic apic_numachip2 .eoi_write = native_apic_mem_write, .icr_read = native_apic_icr_read, .icr_write = native_apic_icr_write, - .safe_wait_icr_idle = numachip_safe_apic_wait_icr_idle, }; apic_driver(apic_numachip2); --- a/arch/x86/kernel/apic/x2apic_cluster.c +++ b/arch/x86/kernel/apic/x2apic_cluster.c @@ -266,7 +266,6 @@ static struct apic apic_x2apic_cluster _ .eoi_write = native_apic_msr_eoi_write, .icr_read = native_x2apic_icr_read, .icr_write = native_x2apic_icr_write, - .safe_wait_icr_idle = native_safe_x2apic_wait_icr_idle, }; apic_driver(apic_x2apic_cluster); --- a/arch/x86/kernel/apic/x2apic_phys.c +++ b/arch/x86/kernel/apic/x2apic_phys.c @@ -180,7 +180,6 @@ static struct apic apic_x2apic_phys __ro .eoi_write = native_apic_msr_eoi_write, .icr_read = native_x2apic_icr_read, .icr_write = native_x2apic_icr_write, - .safe_wait_icr_idle = native_safe_x2apic_wait_icr_idle, }; apic_driver(apic_x2apic_phys); --- a/arch/x86/kernel/apic/x2apic_uv_x.c +++ b/arch/x86/kernel/apic/x2apic_uv_x.c @@ -854,7 +854,6 @@ static struct apic apic_x2apic_uv_x __ro .eoi_write = native_apic_msr_eoi_write, .icr_read = native_x2apic_icr_read, .icr_write = native_x2apic_icr_write, - .safe_wait_icr_idle = native_safe_x2apic_wait_icr_idle, }; #define UVH_RH_GAM_ALIAS210_REDIRECT_CONFIG_LENGTH 3 --- a/arch/x86/xen/apic.c +++ b/arch/x86/xen/apic.c @@ -92,11 +92,6 @@ static void xen_apic_icr_write(u32 low, WARN_ON(1); } -static u32 xen_safe_apic_wait_icr_idle(void) -{ - return 0; -} - static int xen_apic_probe_pv(void) { if (xen_pv_domain()) @@ -161,7 +156,6 @@ static struct apic xen_pv_apic = { .icr_read = xen_apic_icr_read, .icr_write = xen_apic_icr_write, - .safe_wait_icr_idle = xen_safe_apic_wait_icr_idle, }; static void __init xen_apic_check(void)