From patchwork Wed Aug 9 20:36:16 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: 133612 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b824:0:b0:3f2:4152:657d with SMTP id z4csp61812vqi; Wed, 9 Aug 2023 16:08:26 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFc7Zxu3CtFvnCNhRxKsrO7e8TPkwJ3MyP7xw34PG8hCEEAuETdnolaQ33SayMUSYQFGPzo X-Received: by 2002:a05:6a21:7807:b0:137:23f1:4281 with SMTP id be7-20020a056a21780700b0013723f14281mr638514pzc.12.1691622506529; Wed, 09 Aug 2023 16:08:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691622506; cv=none; d=google.com; s=arc-20160816; b=JpG6budOIx0Fsa5/NAt3oJsoSRuY7BgWNd1rwWROG96gcIzELwEaAdp6JUNe5lRVQM F1eUV7alRiLE5JU3bDCIUq29DfftQq4Mi85OWR/kTbE6DUpOmG0tqZfBsnfRQ8LD0m3D Dw/Tf//MyawP9b8ScmrRlZRfJOx296cCYJfH4XPswSQxAzz5pC8JvCX6f8atAF0Xvil8 cTbv3+BiW4veIap5akpGfY4CfU4WNkrE9rFlpv5DMYKUnc7nybQLSxbmTGYCyc245DYi zUlEVYSu9owPWY0uBgoDDW65QAtfJavqnurEfa8dYPF+rlxTGzq2uO8nhp9Sd5BSNGv3 XeSA== 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=6V2eda6tSDiMcWu3bB/es9oPxcHTEiZuS6QOtH2lPkc=; fh=jBwjuriIPWA1lnCf5oMMiNAPpgGE0iGPmBzZMsd85oQ=; b=lkKt7DcInlwCMOpiOmVgRZogfoyR50+C8xPmd8gt/7H83bGNNAT9kENN0Dimtj/wvA GEyDgwIe8rUN8vo6snuNfQdDMV2GWRjMca3gtqY3mi2SYx1nx2RDuIGnX8/aBDMMfsjJ kzGXylAcB+QKtKATZB28CSCqWC6Dsgd+hTotjOdqixIQjkO0Z5qbPYCOawQq0hbME8AG Sy+UlMwn9goIQA9JrqKDpA6nYs4eXVfuDhQ12iTngC3L4tICN9xos8jwvIH/plkvcz2s scEhR2UebsfcnAKeAzczKglKKcNltDV1+uaeoYFAixnr7eNxZUDo6EnOjZqTm+qCkgwJ yZfA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=h2GsWi1v; 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 t184-20020a6381c1000000b00563dde13953si222691pgd.739.2023.08.09.16.08.13; Wed, 09 Aug 2023 16:08:26 -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=h2GsWi1v; 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 S234808AbjHIUhO (ORCPT + 99 others); Wed, 9 Aug 2023 16:37:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55396 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234645AbjHIUg2 (ORCPT ); Wed, 9 Aug 2023 16:36:28 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E1EDD211D; Wed, 9 Aug 2023 13:36:18 -0700 (PDT) Date: Wed, 09 Aug 2023 20:36:16 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1691613377; 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=6V2eda6tSDiMcWu3bB/es9oPxcHTEiZuS6QOtH2lPkc=; b=h2GsWi1v++Y+0otWpeISvuUh/Hqj9K8oh4UMNOjyCdBU6VYRr3Lij7SVjaNupOCLvX8xNL ys/7oB8A7pLyeFhoxJryfAi7RJSvlVdFYB2Sd6YhdxmclKBfQ5R/Qx3CXk0lz7naYT2Sij cSwHOaV95aKYGLxb4HSfibJSpX38y+1v+PX8TeJ4HWsOQhVPsqvQ8XitM9Uk8jj3LmvsY2 AN4eGKeNxraQp9iCOpV42rz4Zr1ynRJOy7gRnWE3rSR0LaeymS1m7gcbYnswK5vUv/a8Iw MYohAF0f+0n23ozSeeblxn8I1t7Dlhav7b2kt4twpw4LCHVE2H9rBSSZ2QvPhw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1691613377; 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=6V2eda6tSDiMcWu3bB/es9oPxcHTEiZuS6QOtH2lPkc=; b=dybyrnWG5L+Q+SdHDt6UAOSG84mN1LytkGouJDWzlBpVcAVzggNK3yQ4tr1NPvnXjDXvF8 Eh3dceAhOF4BzTDQ== 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: Consolidate wait_icr_idle() implementations Cc: Thomas Gleixner , Dave Hansen , "Peter Zijlstra (Intel)" , Michael Kelley , Sohil Mehta , Juergen Gross , x86@kernel.org, linux-kernel@vger.kernel.org MIME-Version: 1.0 Message-ID: <169161337651.27769.15560408419021834767.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: 1773775418310548061 X-GMAIL-MSGID: 1773794761881152814 The following commit has been merged into the x86/apic branch of tip: Commit-ID: cfebd0077f3fc083cc139d7851e2068d058a89dd Gitweb: https://git.kernel.org/tip/cfebd0077f3fc083cc139d7851e2068d058a89dd Author: Thomas Gleixner AuthorDate: Tue, 08 Aug 2023 15:04:04 -07:00 Committer: Dave Hansen CommitterDate: Wed, 09 Aug 2023 11:58:28 -07:00 x86/apic: Consolidate wait_icr_idle() implementations Two copies and also needlessly public. Move it into ipi.c so it can be inlined. Rename it to apic_mem_wait_icr_idle(). Signed-off-by: Thomas Gleixner Signed-off-by: Dave Hansen 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/include/asm/apic.h | 1 - arch/x86/kernel/apic/apic.c | 6 ------ arch/x86/kernel/apic/apic_flat_64.c | 4 ++-- arch/x86/kernel/apic/bigsmp_32.c | 2 +- arch/x86/kernel/apic/ipi.c | 6 +++--- arch/x86/kernel/apic/local.h | 2 ++ arch/x86/kernel/apic/probe_32.c | 2 +- 7 files changed, 9 insertions(+), 14 deletions(-) diff --git a/arch/x86/include/asm/apic.h b/arch/x86/include/asm/apic.h index 4fb71b7..1499865 100644 --- a/arch/x86/include/asm/apic.h +++ b/arch/x86/include/asm/apic.h @@ -98,7 +98,6 @@ static inline u32 native_apic_mem_read(u32 reg) return *((volatile u32 *)(APIC_BASE + reg)); } -extern void native_apic_wait_icr_idle(void); extern u32 native_safe_apic_wait_icr_idle(void); extern void native_apic_icr_write(u32 low, u32 id); extern u64 native_apic_icr_read(void); diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c index 4ee95cb..ab26a61 100644 --- a/arch/x86/kernel/apic/apic.c +++ b/arch/x86/kernel/apic/apic.c @@ -240,12 +240,6 @@ static void __init apic_disable(void) apic = &apic_noop; } -void native_apic_wait_icr_idle(void) -{ - while (apic_read(APIC_ICR) & APIC_ICR_BUSY) - cpu_relax(); -} - u32 native_safe_apic_wait_icr_idle(void) { u32 send_status; diff --git a/arch/x86/kernel/apic/apic_flat_64.c b/arch/x86/kernel/apic/apic_flat_64.c index a0c875d..57d3afb 100644 --- a/arch/x86/kernel/apic/apic_flat_64.c +++ b/arch/x86/kernel/apic/apic_flat_64.c @@ -111,7 +111,7 @@ static struct apic apic_flat __ro_after_init = { .eoi_write = native_apic_mem_write, .icr_read = native_apic_icr_read, .icr_write = native_apic_icr_write, - .wait_icr_idle = native_apic_wait_icr_idle, + .wait_icr_idle = apic_mem_wait_icr_idle, .safe_wait_icr_idle = native_safe_apic_wait_icr_idle, }; @@ -187,7 +187,7 @@ static struct apic apic_physflat __ro_after_init = { .eoi_write = native_apic_mem_write, .icr_read = native_apic_icr_read, .icr_write = native_apic_icr_write, - .wait_icr_idle = native_apic_wait_icr_idle, + .wait_icr_idle = apic_mem_wait_icr_idle, .safe_wait_icr_idle = native_safe_apic_wait_icr_idle, }; diff --git a/arch/x86/kernel/apic/bigsmp_32.c b/arch/x86/kernel/apic/bigsmp_32.c index ffff294..57077fc 100644 --- a/arch/x86/kernel/apic/bigsmp_32.c +++ b/arch/x86/kernel/apic/bigsmp_32.c @@ -108,7 +108,7 @@ static struct apic apic_bigsmp __ro_after_init = { .eoi_write = native_apic_mem_write, .icr_read = native_apic_icr_read, .icr_write = native_apic_icr_write, - .wait_icr_idle = native_apic_wait_icr_idle, + .wait_icr_idle = apic_mem_wait_icr_idle, .safe_wait_icr_idle = native_safe_apic_wait_icr_idle, }; diff --git a/arch/x86/kernel/apic/ipi.c b/arch/x86/kernel/apic/ipi.c index 614ac55..e0e0567 100644 --- a/arch/x86/kernel/apic/ipi.c +++ b/arch/x86/kernel/apic/ipi.c @@ -102,7 +102,7 @@ static inline int __prepare_ICR2(unsigned int mask) return SET_XAPIC_DEST_FIELD(mask); } -static inline void __xapic_wait_icr_idle(void) +void apic_mem_wait_icr_idle(void) { while (native_apic_mem_read(APIC_ICR) & APIC_ICR_BUSY) cpu_relax(); @@ -137,7 +137,7 @@ static void __default_send_IPI_shortcut(unsigned int shortcut, int vector) if (unlikely(vector == NMI_VECTOR)) safe_apic_wait_icr_idle(); else - __xapic_wait_icr_idle(); + apic_mem_wait_icr_idle(); /* Destination field (ICR2) and the destination mode are ignored */ native_apic_mem_write(APIC_ICR, __prepare_ICR(shortcut, vector, 0)); @@ -154,7 +154,7 @@ void __default_send_IPI_dest_field(unsigned int dest_mask, int vector, if (unlikely(vector == NMI_VECTOR)) safe_apic_wait_icr_idle(); else - __xapic_wait_icr_idle(); + apic_mem_wait_icr_idle(); /* Set the IPI destination field in the ICR */ native_apic_mem_write(APIC_ICR2, __prepare_ICR2(dest_mask)); diff --git a/arch/x86/kernel/apic/local.h b/arch/x86/kernel/apic/local.h index 5b0a0e7..2eb49d4 100644 --- a/arch/x86/kernel/apic/local.h +++ b/arch/x86/kernel/apic/local.h @@ -44,6 +44,8 @@ static inline unsigned int __prepare_ICR(unsigned int shortcut, int vector, void default_init_apic_ldr(void); +void apic_mem_wait_icr_idle(void); + /* * This is used to send an IPI with no shorthand notation (the destination is * specified in bits 56 to 63 of the ICR). diff --git a/arch/x86/kernel/apic/probe_32.c b/arch/x86/kernel/apic/probe_32.c index 81c69d7..52f3c6f 100644 --- a/arch/x86/kernel/apic/probe_32.c +++ b/arch/x86/kernel/apic/probe_32.c @@ -64,7 +64,7 @@ static struct apic apic_default __ro_after_init = { .eoi_write = native_apic_mem_write, .icr_read = native_apic_icr_read, .icr_write = native_apic_icr_write, - .wait_icr_idle = native_apic_wait_icr_idle, + .wait_icr_idle = apic_mem_wait_icr_idle, .safe_wait_icr_idle = native_safe_apic_wait_icr_idle, };