From nobody Fri Sep 12 03:18:50 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EEABFC001E0 for ; Wed, 9 Aug 2023 19:13:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233361AbjHITNs (ORCPT ); Wed, 9 Aug 2023 15:13:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42018 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233493AbjHITM7 (ORCPT ); Wed, 9 Aug 2023 15:12:59 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CA838212C; Wed, 9 Aug 2023 12:12:37 -0700 (PDT) Date: Wed, 09 Aug 2023 19:12:25 -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=fJ0OYFuKv7/VhR4WNvEypz1rwyj+na07BQdaWK7QByc=; b=wZqZt38HrOeSeGWUag0tFZNGvEaFKr11dYxYgkDW3l5+dPSFocuKtLmRoVEoGMzFQXqtkb h2+Nk3JKTEZXJw52o9fpeMPb1OdqPSr94jXdLw5c/ERRm4sHgY/p0nxxkskVK9qcMzex1c 6n8HtRbFbFZuWlcgoCVW9aEh6zVBuyOdhfwvSysCF5NPIM5GPf/fQnvZcy0znYrB1xpWwF iSThwOD7fa0VMsygU70hyOZItOTQckwCvJcDsjOL4wc0xp8HVRLcnq8kctA/3XFAUKbXB0 3z5OGSaCC9dgp3/HFe9afTySyeu+fzT5vOiCznYUYCHuBbsUyFL4QSlJl1Dpyg== 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=fJ0OYFuKv7/VhR4WNvEypz1rwyj+na07BQdaWK7QByc=; b=bjqEwHqqo1MPh81fzV3Ptv3A7Kj1o68QqO7ogPwpn+lbLpxypT7ClFGepWeawoJ+qfpe8N 9FHaGmA+bLl17oCQ== 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/of: Fix the APIC address registration 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: <169160834528.27769.7010023693541059077.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the x86/apic branch of tip: Commit-ID: 2906a67ac83b06b874b32bf6413a8d5e186fc33e Gitweb: https://git.kernel.org/tip/2906a67ac83b06b874b32bf6413a8d5e1= 86fc33e Author: Thomas Gleixner AuthorDate: Tue, 08 Aug 2023 15:03:47 -07:00 Committer: Dave Hansen CommitterDate: Wed, 09 Aug 2023 11:58:19 -07:00 x86/of: Fix the APIC address registration The device tree APIC parser tries to force-enable the local APIC when it is not set in CPUID. apic_force_enable() registers the boot CPU apic on success. If that succeeds then dtb_lapic_setup() registers the local APIC again eventually with a different address. Rewrite the code so that it only registers it once. 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/devicetree.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/arch/x86/kernel/devicetree.c b/arch/x86/kernel/devicetree.c index 56f6d59..8f94eb6 100644 --- a/arch/x86/kernel/devicetree.c +++ b/arch/x86/kernel/devicetree.c @@ -157,19 +157,15 @@ static void __init dtb_lapic_setup(void) =20 /* Did the boot loader setup the local APIC ? */ if (!boot_cpu_has(X86_FEATURE_APIC)) { + /* Try force enabling, which registers the APIC address */ if (apic_force_enable(lapic_addr)) return; - } - smp_found_config =3D 1; - if (of_property_read_bool(dn, "intel,virtual-wire-mode")) { - pr_info("Virtual Wire compatibility mode.\n"); - pic_mode =3D 0; } else { - pr_info("IMCR and PIC compatibility mode.\n"); - pic_mode =3D 1; + register_lapic_address(lapic_addr); } - - register_lapic_address(lapic_addr); + smp_found_config =3D 1; + pic_mode =3D !of_property_read_bool(dn, "intel,virtual-wire-mode"); + pr_info("%s compatibility mode.\n", pic_mode ? "IMCR and PIC" : "Virtual = Wire"); } =20 #endif /* CONFIG_X86_LOCAL_APIC */