From patchwork Wed Aug 9 19:12:25 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: 133469 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c44e:0:b0:3f2:4152:657d with SMTP id w14csp3039718vqr; Wed, 9 Aug 2023 13:00:12 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH46KD7VShbNCoHHUN7VuXQECC/iZOpJy13lulvvSnkTS24UHRH3lYtQhWDo01rqJVPOGgQ X-Received: by 2002:a17:906:2922:b0:993:eef2:5d61 with SMTP id v2-20020a170906292200b00993eef25d61mr105498ejd.27.1691611212103; Wed, 09 Aug 2023 13:00:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691611212; cv=none; d=google.com; s=arc-20160816; b=Kvpcv97RhKj5YAl/oOJJkDJVQ/4Qe33ZUntIx/DcV6F27J8LH1BxBQ9+H/xpYT9dZk VVJnPKo8eExHvk3lhW5cffntgJO2jQlOdsiybjow4tlCFEZHycFXEOw/xDXKYYDipMtL fCQHR09OgvmHqh+d/yCoy7AfjefXcr51iA3yiMwfjMoFwXwEH6yfDWLm9bHmb0cl7jmp PUCoYl7GHujdjblJrGRJHfye5dHk9enPRxm6GWytXf/m3DiC69qQTGuX5mM4hVSNdMVs EQmSnNZyEftSpdHBcL2CuR6wLhutE/4J65VL0Aqo9r6/yDIyHyT3Xp28Sce6LJqVRlpH 8X0w== 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=fJ0OYFuKv7/VhR4WNvEypz1rwyj+na07BQdaWK7QByc=; fh=jBwjuriIPWA1lnCf5oMMiNAPpgGE0iGPmBzZMsd85oQ=; b=sIzqMpXveLIiS/1NDghWMOSYNEk9O0yKBWCb+HWF3iX98l+bDMrPDmMDhN69liTauL x7lyrs4y6d/jlU7T7h7hc7Q1x/0IDnmztSDKx4WhYlOLvxfmCTu4r7ZCc5Z1xeCVtjMJ /oUn21tY6k4aBIvVwvlr0G0pjqVF+dKnKo2yBt2r5yEnXLB1Cr5VQ9S2iSbXlURpu1ty dCE/UcXk26vORLIEnHKLAFqc7CLOsjKl5ZLuHkyipmL8HbHeoHT1+UTGyl7ODol2j/aN FogIZcW6ZQp9bieZACHzIz26b9WJ+y5569Aundssacl5UZ6F+2BCVDIEjX6FWHQh0Ufr yKUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=wZqZt38H; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bx1-20020a170906a1c100b0099cbc7832dasi7458500ejb.358.2023.08.09.12.59.47; Wed, 09 Aug 2023 13:00:12 -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=wZqZt38H; 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 S231223AbjHITNs (ORCPT + 99 others); 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 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,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: 1773782918244482360 The following commit has been merged into the x86/apic branch of tip: Commit-ID: 2906a67ac83b06b874b32bf6413a8d5e186fc33e Gitweb: https://git.kernel.org/tip/2906a67ac83b06b874b32bf6413a8d5e186fc33e 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) /* 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 */