From patchwork Wed Aug 9 19:12:24 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: 133473 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c44e:0:b0:3f2:4152:657d with SMTP id w14csp3043074vqr; Wed, 9 Aug 2023 13:05:36 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHwHBGfDO8QLPIMVtNPOMLyPFU5mHrgJxmjxSljSPxJcOhwSx/zhLqtmek8+JkERWi/jTDv X-Received: by 2002:a17:907:2ced:b0:99b:627b:e96d with SMTP id hz13-20020a1709072ced00b0099b627be96dmr108322ejc.44.1691611536098; Wed, 09 Aug 2023 13:05:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691611536; cv=none; d=google.com; s=arc-20160816; b=dwQHcRmiWsEtF/8w6UvoTtPmPYG3uMrg0ulLQY1jsuhXOo0LMcDxE1wb9P6TJvA96L e8aIwfmz2ifgNLLiNlu3a2R/iuXRpoIQmXXe+AdXbpmyFm5ev1dft1JtLtmeoi3Q5Xk4 zV/bxjSnsRy2ucVH/svDfCHq4zZNDPB2fnz8U+0ro8NdIH6s0mujIcCVHHCQF9yE8b2K Br0C3zqMKIukn1JjUMggu5ZJN7XPCqGRAd9Fpl5Tugz1/kmJfbMQN5gVOTNHU7DK+u4N uIzKIwhkVYiBx9qhLB++lXMv9Fc6YURI0oG++W988K1kXvd6537BzTYgTFTa7UGPIhgQ Ks1A== 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=4YEWXcifivVg86UmH2c6Xpd661pLlI0IsER53UddTuk=; fh=jBwjuriIPWA1lnCf5oMMiNAPpgGE0iGPmBzZMsd85oQ=; b=ZD9vLPlmPzHH66NYRDmGPQnV4XrooD5IaF7/Up9s/rXpuhbfL7ZyEkfK7tI9bcnH1O llvDjaDqP6+7apeqKZ/JlcdttYMQNg7mPaGAonSS9cXb+fB04/KdODoLPP9MWt1+5+PC LzPfDQE+1m39nn1It7pWd8DFyEel+2qDaXZ2IgaOviwjrrQ4/lSwL04MKVxQVhqpSxbi r+oSbmixDZ2E0+8I38UnaLz596uzwboNtH61cNi4qn3kCwZDwSui4h6J2WFD0ci0TgHa JYIz9iKBwQA/ZB1BohReniSICdRUC9Yov2GIOOPU7nsVWvpv/uK+g6nHetWd1+FFuBV+ Pf1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=QvduAGBg; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=59bLDVV0; 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 r10-20020a170906c28a00b0099bc91da959si8144116ejz.944.2023.08.09.13.05.08; Wed, 09 Aug 2023 13:05:36 -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=QvduAGBg; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=59bLDVV0; 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 S233448AbjHITNi (ORCPT + 99 others); Wed, 9 Aug 2023 15:13:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42152 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233379AbjHITM7 (ORCPT ); Wed, 9 Aug 2023 15:12:59 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D0A0B2D5D; Wed, 9 Aug 2023 12:12:35 -0700 (PDT) Date: Wed, 09 Aug 2023 19:12:24 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1691608345; 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=4YEWXcifivVg86UmH2c6Xpd661pLlI0IsER53UddTuk=; b=QvduAGBgkSz0ceDN27YYH35/C5aGCnaVNA2h2/mvslUHOJUyEeQs2eVNEIW8yocSmT4+Eg pci15o45OyM9wyMoWv97zi89mS+ljKZ0nBVRg9hEXaaEuew+OdTzBGjyX1vk5ldosHCeTs 5RtHH9GoylO9ZW0PT5LdDkIJIBwga6TGIfmH/PKTdITGdF3JfJ/zUDwWQEgWNuAnIZWus0 dJKopS25EQowAwnZYzhvAA2x6dgB6hjpTk57kpMDfBqzpFsUjaLT7rDKDogYV3/RhFxsso wXVLd4RzxkT8HUlVqK3PxQ8PXBKthamRXlqvIYJX+y3RlLb/fmYanmrNtGBdFw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1691608345; 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=4YEWXcifivVg86UmH2c6Xpd661pLlI0IsER53UddTuk=; b=59bLDVV0nrsyhvdKlFv6fvE1fGyjWZlqEwq6ZZK6v8FtNHre3ot+IJlcLaXIKQoAARWrZM BHnH0rTq7v4kZhDA== 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: Split register_apic_address() 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: <169160834444.27769.11587842002054923417.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: 1773768815499720592 X-GMAIL-MSGID: 1773783257980851376 The following commit has been merged into the x86/apic branch of tip: Commit-ID: 5a88f354dcd8f19436bbda52f075276a5c70424f Gitweb: https://git.kernel.org/tip/5a88f354dcd8f19436bbda52f075276a5c70424f Author: Thomas Gleixner AuthorDate: Tue, 08 Aug 2023 15:03:48 -07:00 Committer: Dave Hansen CommitterDate: Wed, 09 Aug 2023 11:58:20 -07:00 x86/apic: Split register_apic_address() Split the fixmap setup out of register_lapic_address() and reuse it when the X2APIC is disabled during setup. This avoids registering the APIC ID (setting 'mp_lapic_addr') twice. [ dhansen: changelog wording tweak ] 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/kernel/apic/apic.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c index d0f4cca..45ae178 100644 --- a/arch/x86/kernel/apic/apic.c +++ b/arch/x86/kernel/apic/apic.c @@ -1852,6 +1852,8 @@ void x2apic_setup(void) __x2apic_enable(); } +static __init void apic_set_fixmap(void); + static __init void x2apic_disable(void) { u32 x2apic_id, state = x2apic_state; @@ -1872,7 +1874,7 @@ static __init void x2apic_disable(void) } __x2apic_disable(); - register_lapic_address(mp_lapic_addr); + apic_set_fixmap(); } static __init void x2apic_enable(void) @@ -2145,17 +2147,21 @@ void __init init_apic_mappings(void) } } +static __init void apic_set_fixmap(void) +{ + set_fixmap_nocache(FIX_APIC_BASE, mp_lapic_addr); + apic_mmio_base = APIC_BASE; + apic_printk(APIC_VERBOSE, "mapped APIC to %16lx (%16lx)\n", + apic_mmio_base, mp_lapic_addr); + apic_read_boot_cpu_id(false); +} + void __init register_lapic_address(unsigned long address) { mp_lapic_addr = address; - if (x2apic_mode) - return; - - set_fixmap_nocache(FIX_APIC_BASE, address); - apic_mmio_base = APIC_BASE; - apic_printk(APIC_VERBOSE, "mapped APIC to %16lx (%16lx)\n", APIC_BASE, address); - apic_read_boot_cpu_id(false); + if (!x2apic_mode) + apic_set_fixmap(); } /*