Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp4808487rwr; Mon, 8 May 2023 13:02:43 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5oPqSSn5qtjQ4BPGBubw0RZzpB4YR8kl8n4ZaMCsdFZI4rAeVdNwEo+xE1ky2P1cUC+v0l X-Received: by 2002:a17:902:e745:b0:1ab:1b9d:50bf with SMTP id p5-20020a170902e74500b001ab1b9d50bfmr13355611plf.64.1683576163081; Mon, 08 May 2023 13:02:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683576163; cv=none; d=google.com; s=arc-20160816; b=MaZbN225B01Rq6F7SDwLRWgROQsIbdH54Tc71p7cyAfcsIG9PyaOHkTL704azAh79f lk6ZnlNUzLltcoJM4atbUljcgrQPDi972bFYTkm1CcVdLoZHxfy/+X4884bea5JYPvUR JlEQCywu+R+J4CYE3z3IvGCOy5OIMGAQvFfpu+JmwmXbuJaeHGMNiLN2jMWLZf1J6C7B FFR0uBfjE0Vkob5BfwZma3peERajrU+Q1V1FOMm87x8E7BOUISs3+Ai9yJ2KQmevRAUM 5VrF3u2ZLTM5hTfaEn5dOVNA53Zm/2BV5G06sdArKkxFfmjB8EQ6WKG4cyKetsjLILIl NSog== 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=rNSjycztoby2JMftnREWdlBREDazVhJLVJwM8M2fPkk=; b=ipjkw/8I0Du+ZLxjKOiZlHtD2AAONdvLAUEW+eRE2rymHfBumvpHSsprz/+I0dPfAH sbD1Lzqc4GpWJecCuF8jIHvNgF8oaRY51NHX3g37UXfyha7vQwL2yMjgV1pCTiSB5VDt lI2G5ByT+2FUy8kpzZACjv1hd32FoHg6F8bSN1glbRuwq/z2Po9MdpFp7vlJ4i0ZTn/3 NFhNwjrV7nZruEFT0TZy87MlMWsjzxGhDU4tidLSHYNGexw93cv4olCZ0iA2Iy+rcXzw P0WsG5Q+OPesNVsj3EttN44FpmiarRnPvcCDBTo1WPIueBcQ2oV/brHiAiExIPYz8j9Z 1Bsg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=OpZe9lLK; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=L+J15yNA; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u17-20020a170902e81100b001aae82caf71si9544490plg.211.2023.05.08.13.02.24; Mon, 08 May 2023 13:02:43 -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=OpZe9lLK; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=L+J15yNA; 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 S233775AbjEHTqW (ORCPT + 99 others); Mon, 8 May 2023 15:46:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58044 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232084AbjEHTpR (ORCPT ); Mon, 8 May 2023 15:45: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 B976076BD; Mon, 8 May 2023 12:44:33 -0700 (PDT) Message-ID: <20230508185219.070274100@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1683575061; 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=rNSjycztoby2JMftnREWdlBREDazVhJLVJwM8M2fPkk=; b=OpZe9lLKyKO6h5IfhQv2j9WvmIn2yf65zqaHV7y3wQleqSqr+f6etMGdIS9Efc2LFhQWS0 5ftRjwED05+6AZBpiAUMBSD+9Bs4XI7ErbN7ZPJB/dWcAHVXO0162v680HbB1xi5BIj6b6 2VmnddYXWQAy5QrMp52rjUb0ug4Nu5d4+araY9u5t682iYzuMEwChigCf9eS54/VMeAbyp FHpBHrvUOTNlGmggxAiWaYQoqPnvlTGipZEoQY9ETwz7wg7cLp6+qhnkF8oJI3QMQlbXXd MwefEeZHkRCA3XHukRzDC06izW3/O9wI5c+MU2Y7YPlYsyj6psxCoZFPmRCp2g== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1683575061; 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=rNSjycztoby2JMftnREWdlBREDazVhJLVJwM8M2fPkk=; b=L+J15yNAu9kuVnMklFhkCkOJaiMb9jA+tCWcI3g0yk74oGzDCt/9UexPGrZp3cttAT1h/e UE8ijpRbZRAquYDA== From: Thomas Gleixner To: LKML Cc: x86@kernel.org, David Woodhouse , Andrew Cooper , Brian Gerst , Arjan van de Veen , Paolo Bonzini , Paul McKenney , Tom Lendacky , Sean Christopherson , Oleksandr Natalenko , Paul Menzel , "Guilherme G. Piccoli" , Piotr Gorski , Usama Arif , Juergen Gross , Boris Ostrovsky , xen-devel@lists.xenproject.org, Russell King , Arnd Bergmann , linux-arm-kernel@lists.infradead.org, Catalin Marinas , Will Deacon , Guo Ren , linux-csky@vger.kernel.org, Thomas Bogendoerfer , linux-mips@vger.kernel.org, "James E.J. Bottomley" , Helge Deller , linux-parisc@vger.kernel.org, Paul Walmsley , Palmer Dabbelt , linux-riscv@lists.infradead.org, Mark Rutland , Sabin Rapan , "Michael Kelley (LINUX)" Subject: [patch v3 33/36] x86/apic: Save the APIC virtual base address References: <20230508181633.089804905@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Date: Mon, 8 May 2023 21:44:20 +0200 (CEST) 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 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 From: Thomas Gleixner 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 dues 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 Tested-by: Michael Kelley --- arch/x86/include/asm/smp.h | 1 + arch/x86/kernel/apic/apic.c | 4 ++++ 2 files changed, 5 insertions(+) --- --- 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__ */ --- 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 = */ 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(unsig 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); }