From nobody Fri Dec 19 15:48:02 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 125D6C001DB for ; Mon, 7 Aug 2023 13:52:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234499AbjHGNwp (ORCPT ); Mon, 7 Aug 2023 09:52:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40390 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234474AbjHGNwj (ORCPT ); Mon, 7 Aug 2023 09:52:39 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4C51092 for ; Mon, 7 Aug 2023 06:52:38 -0700 (PDT) Message-ID: <20230807135026.528433010@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1691416356; 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=WJi6X1yIC43zDH6zaMpRD9ZckoH8t1jG0FLDTsc9drE=; b=vo8ZSYrGigDW+lveybRcUyoE0yAeso3KJgDMtkzOSoevZeD5daxgFasvS4bc6pCVEqppTr VteiTr5e90OtQrLsi7jNkfxlmZDyBNXISJFX7RBpB2r5mhMYoYppkaPkNzaUeJPO2Clb6A E/VEXGrCELg2Ml6T/A20LUvB3cTV3RY+cpm4/28ewHz0D3GZFk7pagLSTq3qPRhmu1pEtA I9RgA6vM2ykefyTF9enJ6VPnbXlNwnunhfxTZ3j3SMjrHCOPr58gIxKd5gNmLUuh14LAfi UDi3FRmtYSksJBHdm4BNuNN+NJckBX/yiuPfP22/PxKs5ihH8zSPBNAVWMh5LQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1691416356; 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=WJi6X1yIC43zDH6zaMpRD9ZckoH8t1jG0FLDTsc9drE=; b=WiPf0GwyvOudYS7HOskUAYOK5noAXwaKrsCmKYnyR9v5PzbkCyCsNziXLWouPJiLHSPYiG gUwxUfmw3Pe9DnBQ== From: Thomas Gleixner To: LKML Cc: x86@kernel.org, Tom Lendacky , Andrew Cooper , Arjan van de Ven , Huang Rui , Juergen Gross , Dimitri Sivanich , Michael Kelley , Sohil Mehta , K Prateek Nayak , Kan Liang , Zhang Rui , "Paul E. McKenney" , Feng Tang , Andy Shevchenko Subject: [patch 02/53] x86/cpu/topology: Make the APIC mismatch warnings complete References: <20230807130108.853357011@linutronix.de> MIME-Version: 1.0 Date: Mon, 7 Aug 2023 15:52:36 +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" Detect all possible combinations of mismatch right in the CPUID evaluation code. Signed-off-by: Thomas Gleixner --- arch/x86/kernel/cpu/common.c | 15 ++------------- arch/x86/kernel/cpu/topology_common.c | 10 ++++++++++ 2 files changed, 12 insertions(+), 13 deletions(-) --- a/arch/x86/kernel/cpu/common.c +++ b/arch/x86/kernel/cpu/common.c @@ -1676,22 +1676,11 @@ static void generic_identify(struct cpui #endif } =20 -/* - * Validate that ACPI/mptables have the same information about the - * effective APIC id and update the package map. - */ -static void validate_apic_and_package_id(struct cpuinfo_x86 *c) +static void update_package_map(struct cpuinfo_x86 *c) { #ifdef CONFIG_SMP unsigned int cpu =3D smp_processor_id(); - u32 apicid; =20 - apicid =3D apic->cpu_present_to_apicid(cpu); - - if (apicid !=3D c->topo.apicid) { - pr_err(FW_BUG "CPU%u: APIC id mismatch. Firmware: %x APIC: %x\n", - cpu, apicid, c->topo.initial_apicid); - } BUG_ON(topology_update_package_map(c->topo.pkg_id, cpu)); BUG_ON(topology_update_die_map(c->topo.die_id, cpu)); #else @@ -1876,7 +1865,7 @@ void identify_secondary_cpu(struct cpuin #ifdef CONFIG_X86_32 enable_sep_cpu(); #endif - validate_apic_and_package_id(c); + update_package_map(c); x86_spec_ctrl_setup_ap(); update_srbds_msr(); =20 --- a/arch/x86/kernel/cpu/topology_common.c +++ b/arch/x86/kernel/cpu/topology_common.c @@ -176,6 +176,16 @@ void cpu_parse_topology(struct cpuinfo_x =20 parse_topology(&tscan, false); =20 + if (c->topo.initial_apicid !=3D c->topo.apicid) { + pr_err(FW_BUG "CPU%4u: APIC ID mismatch. CPUID: 0x%04x APIC: 0x%04x\n", + cpu, c->topo.initial_apicid, c->topo.apicid); + } + + if (c->topo.apicid !=3D cpuid_to_apicid[cpu]) { + pr_err(FW_BUG "CPU%4u: APIC ID mismatch. Firmware: 0x%04x APIC: 0x%04x\n= ", + cpu, cpuid_to_apicid[cpu], c->topo.apicid); + } + for (dom =3D TOPO_SMT_DOMAIN; dom < TOPO_MAX_DOMAIN; dom++) { if (tscan.dom_shifts[dom] =3D=3D x86_topo_system.dom_shifts[dom]) continue;