From nobody Fri Dec 19 07:47:12 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 B0816C001E0 for ; Mon, 24 Jul 2023 13:34:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231500AbjGXNep (ORCPT ); Mon, 24 Jul 2023 09:34:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37334 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231488AbjGXNe3 (ORCPT ); Mon, 24 Jul 2023 09:34:29 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2EC17E4F for ; Mon, 24 Jul 2023 06:34:07 -0700 (PDT) Message-ID: <20230724132045.302673759@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1690205645; 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=0iz4gOQLk9YymQJzW0sXfBIS7q8+WXoqEL26ZlioJL4=; b=Xz0CBr9Lx/F97q60oo2TJl/rIh4wp9YR5yDt/NzlEfhRyvG/k4hkwGXHbqIttOltxjkIIE n1NkEPszq+IY2E8Xbm9vUVFXkGWCb+8sMgSSloBoq6E7sYsPjhe/vtsttHB7i3gteDeKUy Q0cTfsroCBBfhLgteNdOHF6liK2nkP4yWgVNcMQMchyAghfrqgrKeh9srmx/jXiOz6hLh0 XXhjm56aXF/3S3njp6ikNTj5teGShCU/yINPNqgd7U0z+QTs8pYU9c2Tg1RLYeaugNCN2N LwJHgKYBc9p9jW91OsOfh4/TsrkQJRjPuI7nnLuIoks07T0Gs41RPQDaR3AErQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1690205645; 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=0iz4gOQLk9YymQJzW0sXfBIS7q8+WXoqEL26ZlioJL4=; b=IPIJ1OB6vHgbYWZ+wbD/Ea5C0pKjCuU9X5VMxMh6DCl6Y9WA26t9nP8HXWg466VLBFHFeL uL2M/9ZnvgHii2Aw== From: Thomas Gleixner To: LKML Cc: x86@kernel.org, Andrew Cooper , Tom Lendacky , Paolo Bonzini , Wei Liu , Arjan van de Ven , Juergen Gross , Michael Kelley , Peter Keresztes Schmidt , "Peter Zijlstra (Intel)" Subject: [patch V2 12/58] x86/of: Fix the APIC address registration References: <20230724131206.500814398@linutronix.de> MIME-Version: 1.0 Date: Mon, 24 Jul 2023 15:34:04 +0200 (CEST) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 Acked-by: Peter Zijlstra (Intel) --- arch/x86/kernel/devicetree.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) --- 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 */