Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp18986223rwd; Wed, 28 Jun 2023 03:33:30 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7K1j8kPcNT59MT9S7Zc+0IyzMoHdH46sF5WjPnRXFiJ5hDuJ2EcLpm/C2jpivPrf+TErgp X-Received: by 2002:a17:907:2d90:b0:992:581a:4682 with SMTP id gt16-20020a1709072d9000b00992581a4682mr1010534ejc.32.1687948410135; Wed, 28 Jun 2023 03:33:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687948410; cv=none; d=google.com; s=arc-20160816; b=h13WL+uS2Re6+E9YnakC8vn4MONmBJNer3FW4PX3YoDIDca14RL31MAtUxvXscgwRv LUTsbwDgGo6kOSvJxf9hHUlLsE+1Jqm70SbQirmsooHQhmQZQlARB/BV7AKqPF2sjdvz h7JmCxPEuViF6fT5Lc32BVSmxEVk5TgneiS1m7qeCSTYiq8Ldkw11l3BGpYha9cnhunp zGiFVp2O03xPb5Wm9xDMwKXIoLrMXXxrgpCNx7APk4gfGvx9xBtLH4tqtGfYo4y+haeX QrlbSj1WkMflBxR4ez26XjRSMyI16rQB/opjO07u5aS8U89yXdAmMvJcrkymc9gpJJPY acLw== 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=41nfk7hVKk/WvuSxvNTVdQGB0w7rWokALwy7vmRvjrs=; fh=8cYd2FlVZORVk636/TRZSjcpEkmtW92vhqoVMGOqVio=; b=a60P2u7Pgcyhv3hWzUBx0uVaIDz0D7lySjQKF49blJAySQMRsddLdXo4TPfZLA0v7r FwTNOSp825ITlgXLncU9UBuxneNH7ll3AZzvCq3v1LVhjv5+bExoITWXxsPh+etwf3kw wAkJx92nquL4S1dHFiUiIy6LYUVI/JP/BfKhrmdmhnUgW7aTYWsq6p2aHohg2quFT3DZ FDm48N1P5rlk2FA18sO2rkXTznQzgFuWchudSFYZCsPs64p3B6+t8aCz7JMZEyfjedn7 6ItEBkrfWPeTihgVXe9cuz6Dm5YTGtUc/O/921f+JGPRR4mJLZo6mjaY+imEX0/+GfLz Y4sw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=NFeYH0zu; 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 lm15-20020a170906980f00b00991ece4c961si2699879ejb.267.2023.06.28.03.33.05; Wed, 28 Jun 2023 03:33:30 -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=NFeYH0zu; 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 S233240AbjF1KJx (ORCPT + 99 others); Wed, 28 Jun 2023 06:09:53 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:38668 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231607AbjF1KGc (ORCPT ); Wed, 28 Jun 2023 06:06:32 -0400 Received: from pps.filterd (m0353726.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 35S9vpQj020594; Wed, 28 Jun 2023 10:06:08 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=41nfk7hVKk/WvuSxvNTVdQGB0w7rWokALwy7vmRvjrs=; b=NFeYH0zuxRGvfinKx/7D+eC2WUPXmVTwDstTkLH1s5p+RaMXgOnuEHL+FULl0t9L3BAW YYjQk1jVpGuIS92Zm5wYlQYueaBTNFTBjSD/LXM800ewINcLzfA2V5ih4U2fcInVXeyl iWd5HJNQtZ+ZXi16nsyQRQXdUtsgu/uPhLsDT1oL6TrJgI+dAc6nVVHkG/gYPiDBDGE7 8mOkChGfEabjx7qqwxZTfC1AlweuhGKA9eocSLru1tritkt9laUE9/6anx3yKowA4dyd e0Aoi30cEWutLpb6k3ws5j6rDmKO1nRu7bVbFviKoNSMGS/WFJXcHhuYfE8sUOywonja rg== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3rgjpq04u0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 28 Jun 2023 10:06:08 +0000 Received: from m0353726.ppops.net (m0353726.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 35SA5Z3f008617; Wed, 28 Jun 2023 10:06:07 GMT Received: from ppma01fra.de.ibm.com (46.49.7a9f.ip4.static.sl-reverse.com [159.122.73.70]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3rgjpq04r3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 28 Jun 2023 10:06:07 +0000 Received: from pps.filterd (ppma01fra.de.ibm.com [127.0.0.1]) by ppma01fra.de.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 35S4nr78031028; Wed, 28 Jun 2023 10:06:03 GMT Received: from smtprelay06.fra02v.mail.ibm.com ([9.218.2.230]) by ppma01fra.de.ibm.com (PPS) with ESMTPS id 3rdr451w60-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 28 Jun 2023 10:06:03 +0000 Received: from smtpav07.fra02v.mail.ibm.com (smtpav07.fra02v.mail.ibm.com [10.20.54.106]) by smtprelay06.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 35SA61ac42140214 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 28 Jun 2023 10:06:01 GMT Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 15AB52006A; Wed, 28 Jun 2023 10:06:01 +0000 (GMT) Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3FF7D20043; Wed, 28 Jun 2023 10:06:00 +0000 (GMT) Received: from localhost.localdomain (unknown [9.171.41.43]) by smtpav07.fra02v.mail.ibm.com (Postfix) with ESMTP; Wed, 28 Jun 2023 10:06:00 +0000 (GMT) From: Laurent Dufour To: linuxppc-dev@lists.ozlabs.org Cc: linux-kernel@vger.kernel.org, linux-arch@vger.kernel.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 v2 1/9] cpu/SMT: Move SMT prototypes into cpu_smt.h Date: Wed, 28 Jun 2023 12:05:50 +0200 Message-ID: <20230628100558.43482-2-ldufour@linux.ibm.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230628100558.43482-1-ldufour@linux.ibm.com> References: <20230628100558.43482-1-ldufour@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-GUID: KDTOaJTgfVuK_vNgo7AerV5pAP2AiqL6 X-Proofpoint-ORIG-GUID: Zx9JcONn37NdEngDFEJyyxZs09rknecH 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-28_06,2023-06-27_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 bulkscore=0 priorityscore=1501 spamscore=0 suspectscore=0 phishscore=0 impostorscore=0 mlxscore=0 lowpriorityscore=0 mlxlogscore=843 adultscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2306280088 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Michael Ellerman In order to export the cpuhp_smt_control enum as part of the interface between generic and architecture code, the architecture code needs to include asm/topology.h. But that leads to circular header dependencies. So split the enum and related declarations into a separate header. Signed-off-by: Michael Ellerman [ldufour: rewording the commit's description] Signed-off-by: Laurent Dufour --- 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