Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1313914rwd; Thu, 15 Jun 2023 08:57:55 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7WwDE2dtM3EAbbZUmjLwW6OS+TtiqlMHxQTeaDiEJxhf2Z5O7gopSPfcLDSUr967jAY4pA X-Received: by 2002:a05:6a20:a10d:b0:105:b75e:9df6 with SMTP id q13-20020a056a20a10d00b00105b75e9df6mr5504720pzk.26.1686844674985; Thu, 15 Jun 2023 08:57:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686844674; cv=none; d=google.com; s=arc-20160816; b=iHozEvugXaaWf+Pxfvcr1rgotr+AbvDtUIuEygrMT0ncLXfgisSgTFJmzumB6hFy/7 qXoX5ybygmP++eoz/p3il0dhbNDcNs22NCnn0Lht7vzgtZgyMLNbcdOqWwiuAuGGHz2g DO/kpaSONOf8EZ5AL2d/UJQpASoMVqFw3eT3TJqpypdunve3BfCAaHbNpjOlaNf7ZNQ1 lNzAYepdYVcYeX+PWrRBvgWszW6KCP2szGWZKtLudTwiVKttrIYvPffeipyZeHz6zJ5U cGWZ+Zkko10N9rWvpVz5Q/Y9Zp7wvXJVQUtvmDA0dplrpaf3GfkhSMKxnMXYK0EgWRPM OhNw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=vAESfYiUgFlG0VehISjUQT1kTyQXfPi8wsTE9qOj1f4=; b=lMpFKV9EgpRmNsLpeVjPlGI5YhzQTF7kqKHKXY4ygzD1tuFl2YGH6KcbRMn/N0RsNN RbyUE/F7FlQwWACVCOcVFhJpImhRiPUwV1GRZLXk7or328SpYiEPLBLDydP03l6DZJQ2 kFCqiiRNqsL9d320NwmYwRtBuWuKTQbwubP3UWNcvdJEngjIGRGXe52W7Wm4QTmjCV+6 HhdRrm0ijftHT3S/xDDrEPg/Cu5xkv4Po95nvaka6o9A31K+GcjNc/6MQVHc2yT9/d34 uME5fuo93APS4ItHMG8xikungDv/RaL1R/L+ZrtWEi79HY5195DsQkanfBZ41KwpOhEX 9Ywg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=VzYOIwlo; 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=REJECT sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j12-20020a170902da8c00b001b231cb6f22si10785493plx.111.2023.06.15.08.57.43; Thu, 15 Jun 2023 08:57:54 -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=@ibm.com header.s=pp1 header.b=VzYOIwlo; 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=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343755AbjFOPth (ORCPT + 99 others); Thu, 15 Jun 2023 11:49:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41898 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241506AbjFOPtK (ORCPT ); Thu, 15 Jun 2023 11:49:10 -0400 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7CE4410F6; Thu, 15 Jun 2023 08:49:06 -0700 (PDT) Received: from pps.filterd (m0353722.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 35FFHRua017986; Thu, 15 Jun 2023 15:48:43 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=vAESfYiUgFlG0VehISjUQT1kTyQXfPi8wsTE9qOj1f4=; b=VzYOIwlocaTsGY8UYypIyZK4oYoRKxVzFQPdahLtTECYYJCKxzJg2hhmM8A77VzxJO07 Uh8bvMvBILmtBSdR1Wd+kVMI/iJBWyz0MuwssI1m6ReL4UpYbcDN2D2Elt3k59bOI30m JBbYEB7c6PapgLpV/fEfMdCYvpL6f8808eMK30+uRr+Fany7kAps9E55fzr83+k0fOHT QbZqqUPbd2MPyKTNDClJevoJri/u2l/HLUnBxJvl2tpnAcYlxsBZtA4XCKvEueaEENEz +IZQpfLqVsJ4ein4Vtt+wBulFdySWaiEEus6kOgRP7kHB+RsSEm5/XFWwL1rJbJ/M57W SA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3r855fh84b-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 15 Jun 2023 15:48:41 +0000 Received: from m0353722.ppops.net (m0353722.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 35FFfvra004653; Thu, 15 Jun 2023 15:47:29 GMT Received: from ppma05fra.de.ibm.com (6c.4a.5195.ip4.static.sl-reverse.com [149.81.74.108]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3r855fh3up-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 15 Jun 2023 15:47:29 +0000 Received: from pps.filterd (ppma05fra.de.ibm.com [127.0.0.1]) by ppma05fra.de.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 35F7rvKr012019; Thu, 15 Jun 2023 15:46:39 GMT Received: from smtprelay01.fra02v.mail.ibm.com ([9.218.2.227]) by ppma05fra.de.ibm.com (PPS) with ESMTPS id 3r4gt4tqne-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 15 Jun 2023 15:46:39 +0000 Received: from smtpav05.fra02v.mail.ibm.com (smtpav05.fra02v.mail.ibm.com [10.20.54.104]) by smtprelay01.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 35FFkbW164291220 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 15 Jun 2023 15:46:37 GMT Received: from smtpav05.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3F4A920040; Thu, 15 Jun 2023 15:46:37 +0000 (GMT) Received: from smtpav05.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B9AF32004B; Thu, 15 Jun 2023 15:46:36 +0000 (GMT) Received: from localhost.localdomain (unknown [9.144.159.119]) by smtpav05.fra02v.mail.ibm.com (Postfix) with ESMTP; Thu, 15 Jun 2023 15:46:36 +0000 (GMT) From: Laurent Dufour To: linux-kernel@vger.kernel.org Cc: linux-arch@vger.kernel.org, x86@kernel.org, linuxppc-dev@lists.ozlabs.org, mpe@ellerman.id.au, npiggin@gmail.com, christophe.leroy@csgroup.eu, tglx@linutronix.de, dave.hansen@linux.intel.com, mingo@redhat.com, bp@alien8.de Subject: [PATCH 01/10] cpu/SMT: Move SMT prototypes into cpu_smt.h Date: Thu, 15 Jun 2023 17:46:26 +0200 Message-ID: <20230615154635.13660-2-ldufour@linux.ibm.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230615154635.13660-1-ldufour@linux.ibm.com> References: <20230615154635.13660-1-ldufour@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-GUID: uCAd7BX21IwQmzyAFF9xULLhr02GPa4z X-Proofpoint-ORIG-GUID: FKW92goDgVVNvWMKCg7WMpvOK6hqDALH X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-06-15_12,2023-06-15_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 phishscore=0 spamscore=0 malwarescore=0 impostorscore=0 suspectscore=0 lowpriorityscore=0 bulkscore=0 mlxlogscore=671 priorityscore=1501 clxscore=1015 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2306150136 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 From: Michael Ellerman A subsequent patch would like to use the cpuhp_smt_control enum as part of the interface between generic and arch code. Currently that leads to circular header dependencies. So split the enum and related declarations into a separate header. Signed-off-by: Michael Ellerman --- arch/x86/include/asm/topology.h | 2 ++ include/linux/cpu.h | 25 +------------------------ include/linux/cpu_smt.h | 29 +++++++++++++++++++++++++++++ kernel/cpu.c | 1 + 4 files changed, 33 insertions(+), 24 deletions(-) create mode 100644 include/linux/cpu_smt.h diff --git a/arch/x86/include/asm/topology.h b/arch/x86/include/asm/topology.h index 458c891a8273..66927a59e822 100644 --- a/arch/x86/include/asm/topology.h +++ b/arch/x86/include/asm/topology.h @@ -136,6 +136,8 @@ static inline int topology_max_smt_threads(void) return __max_smt_threads; } +#include + int topology_update_package_map(unsigned int apicid, unsigned int cpu); int topology_update_die_map(unsigned int dieid, unsigned int cpu); int topology_phys_to_logical_pkg(unsigned int pkg); diff --git a/include/linux/cpu.h b/include/linux/cpu.h index 8582a7142623..40548f3c201c 100644 --- a/include/linux/cpu.h +++ b/include/linux/cpu.h @@ -18,6 +18,7 @@ #include #include #include +#include struct device; struct device_node; @@ -202,30 +203,6 @@ void cpuhp_report_idle_dead(void); static inline void cpuhp_report_idle_dead(void) { } #endif /* #ifdef CONFIG_HOTPLUG_CPU */ -enum cpuhp_smt_control { - CPU_SMT_ENABLED, - CPU_SMT_DISABLED, - CPU_SMT_FORCE_DISABLED, - CPU_SMT_NOT_SUPPORTED, - CPU_SMT_NOT_IMPLEMENTED, -}; - -#if defined(CONFIG_SMP) && defined(CONFIG_HOTPLUG_SMT) -extern enum cpuhp_smt_control cpu_smt_control; -extern void cpu_smt_disable(bool force); -extern void cpu_smt_check_topology(void); -extern bool cpu_smt_possible(void); -extern int cpuhp_smt_enable(void); -extern int cpuhp_smt_disable(enum cpuhp_smt_control ctrlval); -#else -# define cpu_smt_control (CPU_SMT_NOT_IMPLEMENTED) -static inline void cpu_smt_disable(bool force) { } -static inline void cpu_smt_check_topology(void) { } -static inline bool cpu_smt_possible(void) { return false; } -static inline int cpuhp_smt_enable(void) { return 0; } -static inline int cpuhp_smt_disable(enum cpuhp_smt_control ctrlval) { return 0; } -#endif - extern bool cpu_mitigations_off(void); extern bool cpu_mitigations_auto_nosmt(void); diff --git a/include/linux/cpu_smt.h b/include/linux/cpu_smt.h new file mode 100644 index 000000000000..722c2e306fef --- /dev/null +++ b/include/linux/cpu_smt.h @@ -0,0 +1,29 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _LINUX_CPU_SMT_H_ +#define _LINUX_CPU_SMT_H_ + +enum cpuhp_smt_control { + CPU_SMT_ENABLED, + CPU_SMT_DISABLED, + CPU_SMT_FORCE_DISABLED, + CPU_SMT_NOT_SUPPORTED, + CPU_SMT_NOT_IMPLEMENTED, +}; + +#if defined(CONFIG_SMP) && defined(CONFIG_HOTPLUG_SMT) +extern enum cpuhp_smt_control cpu_smt_control; +extern void cpu_smt_disable(bool force); +extern void cpu_smt_check_topology(void); +extern bool cpu_smt_possible(void); +extern int cpuhp_smt_enable(void); +extern int cpuhp_smt_disable(enum cpuhp_smt_control ctrlval); +#else +# define cpu_smt_control (CPU_SMT_NOT_IMPLEMENTED) +static inline void cpu_smt_disable(bool force) { } +static inline void cpu_smt_check_topology(void) { } +static inline bool cpu_smt_possible(void) { return false; } +static inline int cpuhp_smt_enable(void) { return 0; } +static inline int cpuhp_smt_disable(enum cpuhp_smt_control ctrlval) { return 0; } +#endif + +#endif /* _LINUX_CPU_SMT_H_ */ diff --git a/kernel/cpu.c b/kernel/cpu.c index f4a2c5845bcb..237394e0574a 100644 --- a/kernel/cpu.c +++ b/kernel/cpu.c @@ -413,6 +413,7 @@ static void lockdep_release_cpus_lock(void) void __weak arch_smt_update(void) { } #ifdef CONFIG_HOTPLUG_SMT + enum cpuhp_smt_control cpu_smt_control __read_mostly = CPU_SMT_ENABLED; void __init cpu_smt_disable(bool force) -- 2.41.0