From patchwork Wed Aug 9 15:34:15 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: 133332 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c44e:0:b0:3f2:4152:657d with SMTP id w14csp2909496vqr; Wed, 9 Aug 2023 09:18:48 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE/Ij3/5LLIwPOpBiwTGN3z+3QYVEhe66SEsGQBYy0Y+CPiMwU0oxGcW4GgxroCi+UdKz3l X-Received: by 2002:a17:907:2c4a:b0:999:37ff:be94 with SMTP id hf10-20020a1709072c4a00b0099937ffbe94mr2204258ejc.71.1691597928131; Wed, 09 Aug 2023 09:18:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691597928; cv=none; d=google.com; s=arc-20160816; b=vo4JptcMhZDbZhHUlwpWlLGPn3UZowKuyL+ZUGfqcNN4xFcU/kByTPeIyfqKjlTnnd V+GZLrZNBWX+zbw8cEegeErxIFq9L16Yzwa/+EghWpatxc/OQARt6LC8VNDjJbpU3FE7 nkzdCCT1jVhS6BNKFuZEnJ31hDKu+WH8DYctRzL3HeYzf1NBols8AIciG28lWranz7OO sPy46yrGd01MrygbmB8/EoewR7yZ/A7dDBsNWO3Oz2gqlXwf1b1lTV/izGSiffm3kWIb mBAEuKrX9r4FpUkcQsQ4Mhelq2hq84gVs5btfJ6tdJEmkOZGGget8PoJ1DaFQveaM93u Sk+A== 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:cc:subject:to:reply-to:sender:from :dkim-signature:dkim-signature:date; bh=1mzk4Fdmg7OF78bNSPalC8kY4+GX6IXg5KmZsj2z7GE=; fh=xeBNGOuZM5vy4okdFvBNsMTGHQ6tdBlFPaNKCUScG5A=; b=zSs0Z1ODB967CMVgPE5CYzn+1NHnWF0fGZQL91CmLHDZkCpxVUldXSSSxordhKUO6n xQeOsvaGN0Ycsh9WR+9Me78MwVa7IkiAK7y7cnXpT5KBRDIFOigf2S4SecUgIrOtgb08 +2dBQU1Jk33+vHx955pbN5ss1Pp3j0mIFlyiOYrmQKgypve/j1W0Yv1kFeLeoapWwZag 79xmn38O4ZvQRi44cGPZjO6AF5B7glgb+U3RjZJaJx9vUEk8SFzmBdQCOdHZgAPrZYLV p4hzBZdPG6TiNexVOBnzOp1sKWWc/nZPcmsCPdspXhuSuuou0YQrgVY1lV+PKXa9yCxf +GpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=H7+A70KV; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=F7Lkyrmh; 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 m16-20020a1709062b9000b009888aa1da13si3991316ejg.752.2023.08.09.09.18.24; Wed, 09 Aug 2023 09:18:48 -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=H7+A70KV; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=F7Lkyrmh; 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 S234401AbjHIPeh (ORCPT + 99 others); Wed, 9 Aug 2023 11:34:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37854 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233624AbjHIPeR (ORCPT ); Wed, 9 Aug 2023 11:34: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 373E8E7F; Wed, 9 Aug 2023 08:34:17 -0700 (PDT) Date: Wed, 09 Aug 2023 15:34:15 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1691595255; 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=1mzk4Fdmg7OF78bNSPalC8kY4+GX6IXg5KmZsj2z7GE=; b=H7+A70KVpSPYGJKs4rkYdnCQclVSnPFedGO6rtjVsg/wYQhYJcrd7Q+dYajgTeWFc7myjY OtinjrHqBE75XYopwa4AcNXl7XmEaiABN3BG56dlCd3DR9e4Cjpy0pLGl+CbtHH2C4Vfzs Q1sGDPkoRKVD4y4XD1bk3y8rU4zTk2IiKuTZb+sRDywkCWDKH/U3oq1Y8CdjXVqV0f7GRv yIOfjiVzJmpCeoUa8Bt0IJ/F9Xp2qcr3UwTa5Jzn7tjT/Q0McgLusnDK6PuUEoRI34WW9Z JRAAO5EQBam+QQo6GownXA8VcL7YTAWAUaXML4imPio4trdqewNYiaCAZf/lvg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1691595255; 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=1mzk4Fdmg7OF78bNSPalC8kY4+GX6IXg5KmZsj2z7GE=; b=F7Lkyrmh+55cMCaBiu8+x2HFRK+5/Q9K3JEV8kTVm0/vlq5V4mkf8DNYxlaZMhyKQ2x3xX 3NQqaAER+MIMWhDg== 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)" , x86@kernel.org, linux-kernel@vger.kernel.org MIME-Version: 1.0 Message-ID: <169159525531.27769.1178775004292207939.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,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: INBOX X-GMAIL-THRID: 1773768989010131590 X-GMAIL-MSGID: 1773768989010131590 The following commit has been merged into the x86/apic branch of tip: Commit-ID: b735dd86b7c75df0863065ae5ab154be2dcf2a9d Gitweb: https://git.kernel.org/tip/b735dd86b7c75df0863065ae5ab154be2dcf2a9d Author: Thomas Gleixner AuthorDate: Tue, 08 Aug 2023 15:03:47 -07:00 Committer: Dave Hansen CommitterDate: Wed, 09 Aug 2023 08:10:11 -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) --- 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) /* 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 */