From patchwork Tue May 16 09:09:54 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: 94576 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp287071vqo; Tue, 16 May 2023 02:19:12 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7x0rizASKa/kggLu2mnIb2I1Qvat+BaovBHBiQbf4sepAji/w7jyCzn4mL+Sd8qLknqkab X-Received: by 2002:a05:6a00:4305:b0:64a:e8a2:bb26 with SMTP id cb5-20020a056a00430500b0064ae8a2bb26mr15553400pfb.0.1684228751727; Tue, 16 May 2023 02:19:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684228751; cv=none; d=google.com; s=arc-20160816; b=b5rHdizq5KwiOef5fg/copo2q3qs1v5XaB1cYUEoV09wdz3OUEXKVmvhrrxPdpDoKB FTBJbXL8pOMGNnTeFrC1yuzmi1tWpLSabAkTYBVywQBsy2BWtBU6jJLkJjSiU3Iuq9oT A9RGkJ26cYir+e8HhI6srZfiYfyK7yO8Oob7Tu1Ndcffxi3k/aOEhVO+t3njiyXyBoXz pu7Il36B/JLED4BHkqNMHGeTzbHIo56H2p5kI5EepfQHY2aHG1X1Ta4gbJncYaWZDLSU o+SPq/nuOe7MNF5q4yIJ08OMC2vFKs6Cr1OmdYdYeUxyBMWxMZl9XCG1hKHjM+jla3Ix U1vQ== 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:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=mtlhvL39diIsHoEJEeHi/4xzRIVFTtzXhH36aRuQsIc=; b=V1+XIfLx/AZxi7UfY300Hl0agiigdgBQmBR8CBNs5IYxRI53h/2UKr/NEyTaTYvbEB eQlXAut+3qMPunuugOHb2xLyNYCchXkOPrLTk7eXJcf0Ln/Y40hrRVdckdPPJMRJ8nBg 6191nrAQkhzckRcBoUM51o7R0QEVe+Roid8z54jaJBbYU1nnZgC1R6ZyeIusv12YEAHF NcCtw9LtrwkQ4pxsdRjmwZWvFYCaefyj4f4GHldMD0ZeOydnqRVFE75mGgXcOEzQymlm 0tYlqJN8Su4nuD0m3RSLnl6SmYrA0sHXjMh6nbHLcHJ6VGzh6oHhk6P28n79UF+FsA1p Osmg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=298a2DrE; dkim=neutral (no key) header.i=@linutronix.de; 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 m24-20020a637118000000b00525048cb4dasi17910057pgc.555.2023.05.16.02.18.59; Tue, 16 May 2023 02:19:11 -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=298a2DrE; dkim=neutral (no key) header.i=@linutronix.de; 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 S231807AbjEPJKF (ORCPT + 99 others); Tue, 16 May 2023 05:10:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45906 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229510AbjEPJJ6 (ORCPT ); Tue, 16 May 2023 05:09:58 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0E05030CF; Tue, 16 May 2023 02:09:56 -0700 (PDT) Date: Tue, 16 May 2023 09:09:54 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1684228194; 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: in-reply-to:in-reply-to:references:references; bh=mtlhvL39diIsHoEJEeHi/4xzRIVFTtzXhH36aRuQsIc=; b=298a2DrEuTwk7HVjGyp2vWepEfugPTdMAUTU523dTeQ59Rph9GS3+j9UufrjUlassdryhN 3txvxwQA5A7wqbk3Hw9NRj/oNCLZ3gduLBI5UwPhxMY4QFMEUtb5CKu873rV/xvZwhr/BN npjvJvCysua2AEyCiW6NkuvFbQ4NSTteA5UOYSAsZHFkllrpUxT/+RW4HbOr6Y7A3nKjNg SC4CJHVeRA+7HiKd5zknus++MT70XteIHBBKa7FgMBqeIS2/wL8zrNRRfBBxoFj1764IN3 q4+ly9M4KFTTY9MqmFqyLT+aBuKdrvfH0VpHcMqi/8nGm/WiP/27xpsY921S5A== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1684228194; 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: in-reply-to:in-reply-to:references:references; bh=mtlhvL39diIsHoEJEeHi/4xzRIVFTtzXhH36aRuQsIc=; b=c6r1QdGUbJmFLpvWdCvOl8JnlxvMXvHzBFOyxR0xpvsMwKAC99DJMj9r5q+aWRny6ecZEZ BAu4SLtu8pi458AA== 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: smp/core] x86/apic: Save the APIC virtual base address Cc: Thomas Gleixner , "Peter Zijlstra (Intel)" , Michael Kelley , Oleksandr Natalenko , Helge Deller , "Guilherme G. Piccoli" , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20230512205257.299231005@linutronix.de> References: <20230512205257.299231005@linutronix.de> MIME-Version: 1.0 Message-ID: <168422819438.404.10533112303979170137.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,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: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1765724820961072445?= X-GMAIL-MSGID: =?utf-8?q?1766041847585319183?= The following commit has been merged into the smp/core branch of tip: Commit-ID: bea629d57d006733d155bdb65ba4867788da69b6 Gitweb: https://git.kernel.org/tip/bea629d57d006733d155bdb65ba4867788da69b6 Author: Thomas Gleixner AuthorDate: Fri, 12 May 2023 23:07:51 +02:00 Committer: Peter Zijlstra CommitterDate: Mon, 15 May 2023 13:45:03 +02:00 x86/apic: Save the APIC virtual base address For parallel CPU brinugp it's required to read the APIC ID in the low level startup code. The virtual APIC base address is a constant because its a fix-mapped address. Exposing that constant which is composed via macros to assembly code is non-trivial due to header inclusion hell. Aside of that it's constant only because of the vsyscall ABI requirement. Once vsyscall is out of the picture the fixmap can be placed at runtime. Avoid header hell, stay flexible and store the address in a variable which can be exposed to the low level startup code. Signed-off-by: Thomas Gleixner Signed-off-by: Peter Zijlstra (Intel) Tested-by: Michael Kelley Tested-by: Oleksandr Natalenko Tested-by: Helge Deller # parisc Tested-by: Guilherme G. Piccoli # Steam Deck Link: https://lore.kernel.org/r/20230512205257.299231005@linutronix.de --- arch/x86/include/asm/smp.h | 1 + arch/x86/kernel/apic/apic.c | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/arch/x86/include/asm/smp.h b/arch/x86/include/asm/smp.h index 726c2a2..c6d5b65 100644 --- a/arch/x86/include/asm/smp.h +++ b/arch/x86/include/asm/smp.h @@ -196,6 +196,7 @@ extern void nmi_selftest(void); #endif extern unsigned int smpboot_control; +extern unsigned long apic_mmio_base; #endif /* !__ASSEMBLY__ */ diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c index e17600d..d3f6c18 100644 --- a/arch/x86/kernel/apic/apic.c +++ b/arch/x86/kernel/apic/apic.c @@ -101,6 +101,9 @@ static int apic_extnmi __ro_after_init = APIC_EXTNMI_BSP; */ static bool virt_ext_dest_id __ro_after_init; +/* For parallel bootup. */ +unsigned long apic_mmio_base __ro_after_init; + /* * Map cpu index to physical APIC ID */ @@ -2163,6 +2166,7 @@ void __init register_lapic_address(unsigned long address) if (!x2apic_mode) { 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); }