Received: by 2002:a05:7412:5112:b0:fa:6e18:a558 with SMTP id fm18csp461441rdb; Tue, 23 Jan 2024 05:13:18 -0800 (PST) X-Google-Smtp-Source: AGHT+IGtj1pBWu5Wj/CipzwOLdPQ0BZR/ebBuk7oroVHq7vtEvIoEdJqaJjQ7ijv67p/O8x4wYuO X-Received: by 2002:ac8:5949:0:b0:42a:37b7:4adc with SMTP id 9-20020ac85949000000b0042a37b74adcmr1188713qtz.27.1706015597939; Tue, 23 Jan 2024 05:13:17 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706015597; cv=pass; d=google.com; s=arc-20160816; b=bzOKC36tBpiNOTv98QuDuYst1aRqRnYJ+4P4YSVWRZNbregTS5u6QaDksjBlqXP1/e LxDIUdEOZ+V96Vs+muRboNCfc0S6Ymq0VRe2XNRkNyb5bvK0yxjxUzY6pBe021UHNTqD 2jbeY0rrPCdxvV8aLj3eHy/YIBwHOj1LFfQL+x2rOgyyvgS2SVx8x1/yCsIB5330hpwT ZmwRWUNF76jcIt5FtWT4xDVUF3+bU4u7trxJobzUyi06OYZVtTiG/LmFk00pIAiVkWoy igD7a8qFNLxMtwMjdFKrjd/XZ6dTdt8YUVC5kQF/NcXaah+GaSYUjr79H5bpl9nKZZW8 Jx8g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=date:mime-version:list-unsubscribe:list-subscribe:list-id :precedence:references:subject:cc:to:from:dkim-signature :dkim-signature:message-id; bh=ZOO7+NN4xzTqgEXoDn63w0a/IxQXntDYLCJ8J9cgjBU=; fh=FCQyBsGyK8ELfIRvcrNSjETg/eJNjzUYemIkEO1t5RA=; b=HvAQlM7DT6pudPWzU+L+7MQoTXauLq9XW5m3LL343AfJvDutYOY2ZJuWPuiMl/ZRko cUGQqnrNxrPSlUizCi6QxSI7gImlgqqbnX5Q3WPUD/IVPXcrZTflHFDNWtW8ZiUlE7iu bj2by/CXjtsx50Nr1c+W5q8/kNJhMXwQmV7ANyKbxiwEFl7DXjy8VlAXOubuY8DRvvMk QqUGKBAqgXl+QcfXqThh5p0yV6JaoZW6K2a+rMDLLoMEPuvm/cN1xu5+h2DdxtJibeph AgtmDniJbrViKVgfCRpqau/9g677S3b46xiZXHOzePzDQo6a/VHjyT8jtZKVx+ZLp0e/ 5Baw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=DAySKzRV; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-35319-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-35319-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id y16-20020a05622a005000b00429a53d6f6dsi1572859qtw.308.2024.01.23.05.13.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jan 2024 05:13:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-35319-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=DAySKzRV; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-35319-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-35319-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 00BAC1C2764D for ; Tue, 23 Jan 2024 13:10:26 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3546E5EE85; Tue, 23 Jan 2024 13:10:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="DAySKzRV"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="IK7kKJTs" Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DDBE15D8E7 for ; Tue, 23 Jan 2024 13:10:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706015408; cv=none; b=ACAlLpZLF4PobCkavgfRTCpH062elaRpwAoEr0wbC05bwCXQVwh3I5ztYTe5ZbirMFNJKZpA64cRZoAXvOzj00gE5hgv/VlfD99X/uU7oYF/G7U73rjNCnPG62dAd2kd4rXQ3hAPXZtlv8WFmmWniV0zPe9ejE7891TIBPVmpoU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706015408; c=relaxed/simple; bh=zithzGkCqNJB367BBEWSiQ+4P2EA2zr/ipn8U2Vqt8I=; h=Message-ID:From:To:Cc:Subject:References:MIME-Version: Content-Type:Date; b=bvyQog/fQvvoqWbL2Wl5MneB7rFM5OSU9bvxSU8hpqhAR2lyZFXs6RZjBhrrNWdnLZyOLKBvnhtcJaGz77wJd1pJQpds9Hvl/kgjj5vHpLQOElryNlPtdP6okVSbjzOJjFMz3I/euCcBtSILYTrDfv1iF0u3Fds1LIuXqyiPjJo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=DAySKzRV; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=IK7kKJTs; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Message-ID: <20240117124902.403342409@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1706015405; 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=ZOO7+NN4xzTqgEXoDn63w0a/IxQXntDYLCJ8J9cgjBU=; b=DAySKzRV6HdCuyIWpx3teGuiU1+Q8+fx+b0nIMVtBOfkHLu0WB3CaXPW3Z9rvpNZUrJVd+ uHSDW/kByB2GmXgEHtmYSdCeYkP3YReZY/1gWExxNCrQr0zP4PHi3sSRql5IHQjMxlUYle rHC5LyuG70WNldFVrKh4rDHkG1hrKns0rsaMY/pIe2JBg6NBW/7x6M9Rx4xrRqM0D1w5vY tYW6MjlxRw+aPg+DEcH0b07QwOdOIOr4zn25IdPIUcUIdDQFMcnei3Ag0DJ8M0Bs8CDBuN ApEpzJo3w5fjkgePKYCkORUOfb4P+V8NpazoxMGXtOmpU0I+2VtgEskKqcY7tg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1706015405; 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=ZOO7+NN4xzTqgEXoDn63w0a/IxQXntDYLCJ8J9cgjBU=; b=IK7kKJTsuqNf/N1XYkVczeHUEcBTOF2eVmOgXn4Umvkgt8LUIprMBMlDEqTXFauZ3UuYb3 7yirfshHrah3+ECQ== From: Thomas Gleixner To: LKML Cc: x86@kernel.org, Tom Lendacky , Andrew Cooper , Arjan van de Ven , Huang Rui , Juergen Gross , Dimitri Sivanich , Sohil Mehta , K Prateek Nayak , Kan Liang , Zhang Rui , "Paul E. McKenney" , Feng Tang , Andy Shevchenko , Michael Kelley , "Peter Zijlstra (Intel)" , Andy Shevchenko , Wei Liu Subject: [patch V2 01/22] x86/cpu/topology: Make the APIC mismatch warnings complete References: <20240117124704.044462658@linutronix.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Date: Tue, 23 Jan 2024 14:10:04 +0100 (CET) From: Thomas Gleixner Detect all possible combinations of mismatch right in the CPUID evaluation code. Signed-off-by: Thomas Gleixner --- arch/x86/include/asm/apic.h | 5 ++--- arch/x86/kernel/cpu/common.c | 15 ++------------- arch/x86/kernel/cpu/topology_common.c | 12 ++++++++++++ 3 files changed, 16 insertions(+), 16 deletions(-) --- --- a/arch/x86/include/asm/apic.h +++ b/arch/x86/include/asm/apic.h @@ -46,16 +46,15 @@ extern void x86_32_probe_apic(void); static inline void x86_32_probe_apic(void) { } #endif -#ifdef CONFIG_X86_LOCAL_APIC +extern u32 cpuid_to_apicid[]; +#ifdef CONFIG_X86_LOCAL_APIC extern int apic_verbosity; extern int local_apic_timer_c2_ok; extern bool apic_is_disabled; extern unsigned int lapic_timer_period; -extern u32 cpuid_to_apicid[]; - extern enum apic_intr_mode_id apic_intr_mode; enum apic_intr_mode_id { APIC_PIC, --- a/arch/x86/kernel/cpu/common.c +++ b/arch/x86/kernel/cpu/common.c @@ -1715,22 +1715,11 @@ static void generic_identify(struct cpui #endif } -/* - * 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 = smp_processor_id(); - u32 apicid; - apicid = apic->cpu_present_to_apicid(cpu); - - if (apicid != 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 @@ -1921,7 +1910,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(); if (boot_cpu_has_bug(X86_BUG_GDS)) --- a/arch/x86/kernel/cpu/topology_common.c +++ b/arch/x86/kernel/cpu/topology_common.c @@ -177,6 +177,18 @@ void cpu_parse_topology(struct cpuinfo_x parse_topology(&tscan, false); + if (IS_ENABLED(CONFIG_X86_LOCAL_APIC)) { + if (c->topo.initial_apicid != 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 != 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 = TOPO_SMT_DOMAIN; dom < TOPO_MAX_DOMAIN; dom++) { if (tscan.dom_shifts[dom] == x86_topo_system.dom_shifts[dom]) continue;