Received: by 2002:a05:6358:701b:b0:131:369:b2a3 with SMTP id 27csp3135090rwo; Mon, 24 Jul 2023 06:50:36 -0700 (PDT) X-Google-Smtp-Source: APBJJlHZAPyrAIjV+Fg8UeIoOOlDCBjaBUYK0mKQDHRfuI7XVK0fpRFl80MrLg5GScGs/Ff50e9Q X-Received: by 2002:a17:906:10c:b0:98f:3485:9c44 with SMTP id 12-20020a170906010c00b0098f34859c44mr10780324eje.72.1690206636260; Mon, 24 Jul 2023 06:50:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690206636; cv=none; d=google.com; s=arc-20160816; b=nQBTdAQkxnHVwO2iUIY0rS83vrQB42OlZJyIiDyoFSr4uN8cvMDZKwBBMpDuJP9TZF QdDk7/RSh3dTzaAr/O9pF9erWknbK//ipk7qiKQ++1YsVXwE+3eXoh0obBGdMejtmyC8 ambsQ0aHkBuz4swV+fNokslg9Fvz3gYmncnG9iW3TbGxTfb3swvv+W8hL53coEpc/tgi SbtpEqOVPUt9Io/8zimBQqAfrqeNAyFKHDYk0iszTwhddzI0zDhr35rT9TgKNsUaWGV7 jjxjX8QW9a8c8iOpkPmsz6bF4jQI/DZByIWChH2FDeizB+1FlM3vY1TGF2zLdQ73DiaU JEvw== 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=0iz4gOQLk9YymQJzW0sXfBIS7q8+WXoqEL26ZlioJL4=; fh=mE3iieUIZLcDfOLIULj9X6/p0bMDPZGFSVRsnyRUnTc=; b=Kx+GiHwlW99/SdvTBrJj72/hn0Cw72cYG/RhmH51Oni9ly1/Lt6nXQ66MUXW9EbN5/ pG+9ZF8spQ0s3N6H2VfSgSAyTOJ50e/162ZJbqDCU84AK+B23TuBoanysiWO7fChVFne E+qRsxQr/k7/ODEdTBVRgzhrMEnG0znvr1hVX6IpQy8+yaK31qom8tZJ8B+/retwqhoy W/7OQ7A6rMtRPiZGkNgfdRPyjePs0R5LqpkfotAnsviHkK4Hh1Mje/b1CURUv6ugM27u xWoB0qvnG81P7o+Y6t8bbLC/PBuI8PISaNx+QiNcd2RzHijX3JaubL2aEuWkv6mtf6qy WvwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=Xz0CBr9L; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id rk14-20020a170907214e00b0098e1c7a62casi6863969ejb.334.2023.07.24.06.50.11; Mon, 24 Jul 2023 06:50: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=Xz0CBr9L; 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 S231343AbjGXNeo (ORCPT + 99 others); Mon, 24 Jul 2023 09:34:44 -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 Content-Type: text/plain; charset=UTF-8 Date: Mon, 24 Jul 2023 15:34:04 +0200 (CEST) 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,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 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) /* 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 = 1; - if (of_property_read_bool(dn, "intel,virtual-wire-mode")) { - pr_info("Virtual Wire compatibility mode.\n"); - pic_mode = 0; } else { - pr_info("IMCR and PIC compatibility mode.\n"); - pic_mode = 1; + register_lapic_address(lapic_addr); } - - register_lapic_address(lapic_addr); + smp_found_config = 1; + pic_mode = !of_property_read_bool(dn, "intel,virtual-wire-mode"); + pr_info("%s compatibility mode.\n", pic_mode ? "IMCR and PIC" : "Virtual Wire"); } #endif /* CONFIG_X86_LOCAL_APIC */