From patchwork Tue Feb 13 21:04:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Gleixner X-Patchwork-Id: 200598 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:bc8a:b0:106:860b:bbdd with SMTP id dn10csp807344dyb; Tue, 13 Feb 2024 13:05:17 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUxrSMVYR8Okxd/4oVncIWALNjCX2McYt4UPLR0jSEX5021zBQXQxM4mhwED9ZShRuLcgpHS1P8RX4jVjF5LLzzBVBdag== X-Google-Smtp-Source: AGHT+IEUPmSpAPzW5GtFUpPI5u50tRaar3KUIYnaJTfg3Iie4BNh3Q/eAXZdJYJQzRfTBwByJvg6 X-Received: by 2002:a05:620a:1a0e:b0:785:a2ac:a50c with SMTP id bk14-20020a05620a1a0e00b00785a2aca50cmr1087300qkb.54.1707858317190; Tue, 13 Feb 2024 13:05:17 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707858317; cv=pass; d=google.com; s=arc-20160816; b=eRkPnV45GOtiB0qFvYj+UByYW4dyD7P0N9VmF0YUUsuUKGkE6Wq2R3KOH3Uc3I9wnX WPFNtXZg8/7os4tc7WoeKVdNSvOV+spEfOJLSj2sQrAlRaHAAN7mLyNFCNzXzwwpUumT bq3AzzhRCKUvM+OuAmAhjls4o5QMWQqPM7NxPNdGtqOt0fCBZyfMbWWeceehxjk33ZKU 4SE87DbgBsk5vwhX6qaZzNpw4Ex5fAyj+CMKLRhw/PJA2hvdftgxjUc20ytq4cqTQEkE rqri8FVphzndcPGjyJm4JjN9lQPFyc/h/TAFHITnm7UnAxBpMUZlirAAWF7AZcDhk57T xgww== 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=z/2utW/eab7c/d43I2wk7KTcIRtO+0FmA0sU6rsMN3s=; fh=IEk6oHazuhnmryYSe5jKXKDPGd+BxkGz1+TL7FNEdzc=; b=UWyeXiEGrn1PMy3bELfcRJfJyovmyUqJkWbLhDaQJRdoI3MxwZy+zXEH7cI2ezo+hk rrTI7B3QEekmGYL/hNHRjDrNI3LzrLiy8dCcii2d68Ln/JM8Mf7FH68xtGOFIxzEGMUm RC6pN7aLJZA2sISvSkUJ7t+IRfv7RyUY2I+gBMcVhPs7izCLd7VH7cbzTZe64Px1pyca /Ifkvnks7of9GAEBsUtsOk9zrIgIsnRuBB3iX7MWUGH57IwJwwyMjy4AiYF4iDW/g9CV m8xD6IuPKAo1yrBoJMkbtnGgHx1KnRoZGRllrnUBgWR0OAVUjr75ZgIy7NzGW1AVuiNX +n3Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=4eAnK4JW; 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-64243-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-64243-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de X-Forwarded-Encrypted: i=2; AJvYcCV86bSP4pWw9lhEu/nQuzBMISWyIt31kN/flVntpgOy9okD1y1BKiXuFhHvA+1X8Ov90up5lQbjpEjz2EH+gx34i80nEA== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id y14-20020a05620a09ce00b00785d9d11421si4514571qky.727.2024.02.13.13.05.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Feb 2024 13:05:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-64243-ouuuleilei=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=4eAnK4JW; 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-64243-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-64243-ouuuleilei=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 B1D591C223B2 for ; Tue, 13 Feb 2024 21:05:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 769D7627E5; Tue, 13 Feb 2024 21:04:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="4eAnK4JW"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="GzM1rkYV" 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 45C2E62145 for ; Tue, 13 Feb 2024 21:04: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=1707858248; cv=none; b=PwdLoa5v+5co9OFAV4Og9Z+mWhSOkmfuJG+s9HdxR1ZUO3cGyz59eLrVAk6f6W7DHtmS4K4s5baztl8MSPAM+W3oYt6xTx5gdxbqg0vdJHnddSb2QjLtR3quqd+JxHuNGGcvAIOenstwnAeXUydVt97rVLMAGC6LGKquq+leXOo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707858248; c=relaxed/simple; bh=vVMaaZa/gDKoCoSidPyHPqMNGJI6wBZu/Y6hGssq/dk=; h=Message-ID:From:To:Cc:Subject:References:MIME-Version: Content-Type:Date; b=uyM4U5zo21xB4qXGo5d4BV5UDyoipBxNcngQ+YQ4RtArFfmM/fjaHs9b5PA87Hj55KIFgjDLZ0n4mjQeT76RFAYkzMkt4pAkKSwFYqq0PdbAtw/FTaDeFjv7GIy0cmQk7d6fxrpDUcr3c5RaNhfKwOuoMXOdJNEC6ePF9FY1mdc= 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=4eAnK4JW; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=GzM1rkYV; 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: <20240212153624.706794189@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1707858245; 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=z/2utW/eab7c/d43I2wk7KTcIRtO+0FmA0sU6rsMN3s=; b=4eAnK4JWNmX5xl460AybW40H4SzD8SyJe/Tj90QL7VUy4DEe/9or5bTgGtquS/6Mv6uW/m gCguqdG0Og7+3ewT8v0zBsCLkwvyENN8sKSFC1sev/Ubq9gX6KJRmnMH8atWZdHPLU5jsD c7FpFI2iPUj6Rf+iUT13uLK1ER8fRmTI8n0seM9V+E17ax9ZABBIAVIeSm+/GBtq1NcUqD UoxC01iAZXfguv/G7a3JZi6cJ6ui19U4UHCGcY0s8V4sDx4sELkT0zsl59P/avFXckJf3Q uLdmAUqAGDH0bDKaIX6ABxN/oOhmhEPnhxp2HgMtYTkXhat7oaJG0Jcis0xuoA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1707858245; 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=z/2utW/eab7c/d43I2wk7KTcIRtO+0FmA0sU6rsMN3s=; b=GzM1rkYV0UXW8yunt+VoXNJys3Rdgc+2x+saH8CvkfvE7CWc8a9BCcLlQ15HOhSaKCl+/y 2vFFdcLNUDKhedBA== 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)" , Wang Wendy Subject: [patch V6 04/19] x86/cpu: Use common topology code for Centaur and Zhaoxin References: <20240212153109.330805450@linutronix.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Date: Tue, 13 Feb 2024 22:04:04 +0100 (CET) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790819242850483124 X-GMAIL-MSGID: 1790819242850483124 From: Thomas Gleixner Centaur and Zhaoxin CPUs use only the legacy SMP detection. Remove the invocations from their 32bit path and exclude them from the 64-bit call path. No functional change intended. Signed-off-by: Thomas Gleixner Tested-by: Juergen Gross Tested-by: Sohil Mehta Tested-by: Michael Kelley Tested-by: Zhang Rui Tested-by: Wang Wendy --- V6: Fixup changelog - Borislav --- arch/x86/kernel/cpu/centaur.c | 4 ---- arch/x86/kernel/cpu/topology_common.c | 11 ++++++++--- arch/x86/kernel/cpu/zhaoxin.c | 4 ---- 3 files changed, 8 insertions(+), 11 deletions(-) --- --- a/arch/x86/kernel/cpu/centaur.c +++ b/arch/x86/kernel/cpu/centaur.c @@ -128,10 +128,6 @@ static void init_centaur(struct cpuinfo_ #endif early_init_centaur(c); init_intel_cacheinfo(c); - detect_num_cpu_cores(c); -#ifdef CONFIG_X86_32 - detect_ht(c); -#endif if (c->cpuid_level > 9) { unsigned int eax = cpuid_eax(10); --- a/arch/x86/kernel/cpu/topology_common.c +++ b/arch/x86/kernel/cpu/topology_common.c @@ -42,7 +42,7 @@ static unsigned int parse_num_cores(stru return eax.ncores + 1; } -static void __maybe_unused parse_legacy(struct topo_scan *tscan) +static void parse_legacy(struct topo_scan *tscan) { unsigned int cores, core_shift, smt_shift = 0; struct cpuinfo_x86 *c = tscan->c; @@ -71,10 +71,8 @@ bool topo_is_converted(struct cpuinfo_x8 /* Temporary until everything is converted over. */ switch (boot_cpu_data.x86_vendor) { case X86_VENDOR_AMD: - case X86_VENDOR_CENTAUR: case X86_VENDOR_INTEL: case X86_VENDOR_HYGON: - case X86_VENDOR_ZHAOXIN: return false; default: /* Let all UP systems use the below */ @@ -132,6 +130,13 @@ static void parse_topology(struct topo_s return; tscan->ebx1_nproc_shift = get_count_order(ebx.nproc); + + switch (c->x86_vendor) { + case X86_VENDOR_CENTAUR: + case X86_VENDOR_ZHAOXIN: + parse_legacy(tscan); + break; + } } static void topo_set_ids(struct topo_scan *tscan) --- a/arch/x86/kernel/cpu/zhaoxin.c +++ b/arch/x86/kernel/cpu/zhaoxin.c @@ -71,10 +71,6 @@ static void init_zhaoxin(struct cpuinfo_ { early_init_zhaoxin(c); init_intel_cacheinfo(c); - detect_num_cpu_cores(c); -#ifdef CONFIG_X86_32 - detect_ht(c); -#endif if (c->cpuid_level > 9) { unsigned int eax = cpuid_eax(10);