Received: by 2002:ab2:1c04:0:b0:1f7:53ba:1ebe with SMTP id f4csp50512lqg; Fri, 26 Apr 2024 08:29:36 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXN7PQRLusrPRjubnH4UpDETw7eY6A7I15xWq2r3n/XivB28QgRc/5KWY2cRsJwf0kpYFOzRJ+49JIyuyslAKDHp3yhbkk033fTNhpr/g== X-Google-Smtp-Source: AGHT+IH4uc7UcpCf5WQHdTupjECetEcUJm33H4jxiinOn0mN4FlMzXvj7re/mtSANtgkmIFFh86Z X-Received: by 2002:a17:90b:1208:b0:2a0:9b18:daf with SMTP id gl8-20020a17090b120800b002a09b180dafmr3054052pjb.42.1714145375828; Fri, 26 Apr 2024 08:29:35 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714145375; cv=pass; d=google.com; s=arc-20160816; b=mUhBglett8LfvdLojLi5lA47Sj08YL+pfU87U14Oa2vZX1BT26ERuFJNvzncIyd8Xc 1nW9MbjEdad882FXGtQZzK2UiouUGZG6Gf1ysxnFRNYHJYT6Ur2CzyRmoVVB8PBx0iM3 KNwt9+mg2FhLODGSQDeL04GwNmbMz6mstR8Puy/QMspN7ljH5jpNfvYtEHMQw3LwgO0T 6/vAciYYcQJC8GNpjktagEZGHJIHqfKLNVRPCjNLpGfEg2msTcvEM4rLYpzqHBrEZs3Y yfFYkxdNbB99mTMPP5T+mTn4x7ORIA8uoYS4t3nwgVNymi2QpXnH2Bzw0pFWNtjhSSGd Ougg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=e8YdpM+YP/IQAfqlhNTGMegoBzM0NjnG7hYQr/EmaOA=; fh=Vo4MxA0u7CmSKYL/GjcyKHwusyvU+nKR43bqJem+vcY=; b=Q2SWXlKAdxZyEfIQsBmjoC+etY+qWfWrQDR6Bcs8a02M2D0wP5WtPGyz31TuzI2S2T BL4O4i4SvDSLOsVSeK9seFKUh6nwLzYSb8CLTVarMBQgdBSFHOdhNINdxCLK0wU6A7Hu 9KgNhRwWwTjW0IcfEMC0ZeMq7E5zSEZWlxp9lLekr3cdKzl/JbrxIcS3rXPoA49aypW9 8791XxDaonpe+d5xQmgE9H413mKIaS7MOp+P5mns0QxxGKkj/IflmmuVzzGZyLJPDFT9 g11ATPa/OXCoTdxKVdVWGdtFXPhrh4O0tkkEFbNF4o8CmWbLQNAM7uSpjXG71SsITa77 261Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-160252-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-160252-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id v8-20020a17090a898800b002ad114c604fsi11194194pjn.123.2024.04.26.08.29.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Apr 2024 08:29:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-160252-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-160252-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-160252-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com 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 sy.mirrors.kernel.org (Postfix) with ESMTPS id E8F39B2742D for ; Fri, 26 Apr 2024 15:17:14 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9D79D17554A; Fri, 26 Apr 2024 15:10:58 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7AB85175541 for ; Fri, 26 Apr 2024 15:10:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714144258; cv=none; b=pLTUsknPsTstYaOZiHphFaTMCT+TevhVUf1LoBEEQIuug4HheH3AlSFDdDVMgPMkVV21Mzw9x1mHCQFozFmeZVz/xODKOvEsAZ4y5Re+renyVeU4ZR4CxlnVG6eypV06x97IJB499XU3WcpdumWlt7OcsStPR3ao74sofCbqdTg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714144258; c=relaxed/simple; bh=eqo9pDDGltWBh/jbE5OxwbESAse+eEPKEfKd/1qke4U=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=dslOfQ8zRWM1qCcnIu9AovOGBQLuB9zgyLyHrfrthR+ZiAxElOSj6oUByXvJnDh4yaX+tenWH/lN4DqURPQ1xUWvalXXDBc1Julh1SLQBJrVJL6KKhDNj2m2yd1YOoK3hAX3g3t9BtN7Lbs+pzhGJIw0zYLgNQ2PWjVn8w3ryhI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id D0AE01007; Fri, 26 Apr 2024 08:11:23 -0700 (PDT) Received: from e133380.cambridge.arm.com (e133380.arm.com [10.1.197.52]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id EBE3F3F73F; Fri, 26 Apr 2024 08:10:52 -0700 (PDT) From: Dave Martin To: x86@kernel.org, linux-kernel@vger.kernel.org Cc: James Morse , Fenghua Yu , Reinette Chatre , Thomas Gleixner , Ingo Molnar , Borislav Petkov , H Peter Anvin , Babu Moger , shameerali.kolothum.thodi@huawei.com, D Scott Phillips OS , carl@os.amperecomputing.com, lcherian@marvell.com, bobo.shaobowang@huawei.com, "Shaopeng Tan (Fujitsu)" , baolin.wang@linux.alibaba.com, Jamie Iles , Xin Hao , Peter Newman , dfustini@baylibre.com, amitsinght@marvell.com, David Hildenbrand , Rex Nie Subject: [PATCH v2 33/35] x86/resctrl: Move the filesystem bits to headers visible to fs/resctrl Date: Fri, 26 Apr 2024 16:09:02 +0100 Message-Id: <20240426150904.8854-33-Dave.Martin@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240426150904.8854-1-Dave.Martin@arm.com> References: <20240426150537.8094-1-Dave.Martin@arm.com> <20240426150904.8854-1-Dave.Martin@arm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: James Morse Once the filesystem parts of resctrl move to fs/resctrl, it cannot rely on definitions in x86's internal.h. Move definitions in internal.h that need to be shared between the filesystem and architecture code to header files that fs/resctrl can include. Doing this separately means the filesystem code only moves between files of the same name, instead of having these changes mixed in too. Signed-off-by: James Morse Signed-off-by: Dave Martin --- FYI: James Morse (et al.): * This patch needs review to see how many of the x86-specific definitions really ought to be exported... * The resctrl_types.h header should have a comment explaining its content and purpose (once we have that nailed down). Changes in v2: * Revert apparently unintentional duplication of a couple of variable declarations in . No functional change. --- arch/x86/include/asm/resctrl.h | 3 +++ arch/x86/kernel/cpu/resctrl/core.c | 5 ++++ arch/x86/kernel/cpu/resctrl/internal.h | 36 -------------------------- include/linux/resctrl_types.h | 30 +++++++++++++++++++++ 4 files changed, 38 insertions(+), 36 deletions(-) diff --git a/arch/x86/include/asm/resctrl.h b/arch/x86/include/asm/resctrl.h index a8bc1d68f889..506ecd04788b 100644 --- a/arch/x86/include/asm/resctrl.h +++ b/arch/x86/include/asm/resctrl.h @@ -218,6 +218,9 @@ int resctrl_arch_measure_l2_residency(void *_plr); int resctrl_arch_measure_l3_residency(void *_plr); void resctrl_cpu_detect(struct cpuinfo_x86 *c); +bool resctrl_arch_get_cdp_enabled(enum resctrl_res_level l); +int resctrl_arch_set_cdp_enabled(enum resctrl_res_level l, bool enable); + #else static inline void resctrl_arch_sched_in(struct task_struct *tsk) {} diff --git a/arch/x86/kernel/cpu/resctrl/core.c b/arch/x86/kernel/cpu/resctrl/core.c index f94ad04023c3..c0fb2e22e110 100644 --- a/arch/x86/kernel/cpu/resctrl/core.c +++ b/arch/x86/kernel/cpu/resctrl/core.c @@ -306,6 +306,11 @@ static void rdt_get_cdp_l2_config(void) rdt_get_cdp_config(RDT_RESOURCE_L2); } +bool resctrl_arch_get_cdp_enabled(enum resctrl_res_level l) +{ + return rdt_resources_all[l].cdp_enabled; +} + static void mba_wrmsr_amd(struct rdt_domain *d, struct msr_param *m, struct rdt_resource *r) { diff --git a/arch/x86/kernel/cpu/resctrl/internal.h b/arch/x86/kernel/cpu/resctrl/internal.h index 3707f5ccfeda..e4244e771ef6 100644 --- a/arch/x86/kernel/cpu/resctrl/internal.h +++ b/arch/x86/kernel/cpu/resctrl/internal.h @@ -14,12 +14,6 @@ #define L2_QOS_CDP_ENABLE 0x01ULL -#define CQM_LIMBOCHECK_INTERVAL 1000 - -#define MBM_CNTR_WIDTH_BASE 24 -#define MBM_OVERFLOW_INTERVAL 1000 -#define MAX_MBA_BW 100u -#define MBA_IS_LINEAR 0x4 #define MBM_CNTR_WIDTH_OFFSET_AMD 20 #define RMID_VAL_ERROR BIT_ULL(63) @@ -209,29 +203,6 @@ struct rdtgroup { struct pseudo_lock_region *plr; }; -/* rdtgroup.flags */ -#define RDT_DELETED 1 - -/* rftype.flags */ -#define RFTYPE_FLAGS_CPUS_LIST 1 - -/* - * Define the file type flags for base and info directories. - */ -#define RFTYPE_INFO BIT(0) -#define RFTYPE_BASE BIT(1) -#define RFTYPE_CTRL BIT(4) -#define RFTYPE_MON BIT(5) -#define RFTYPE_TOP BIT(6) -#define RFTYPE_RES_CACHE BIT(8) -#define RFTYPE_RES_MB BIT(9) -#define RFTYPE_DEBUG BIT(10) -#define RFTYPE_CTRL_INFO (RFTYPE_INFO | RFTYPE_CTRL) -#define RFTYPE_MON_INFO (RFTYPE_INFO | RFTYPE_MON) -#define RFTYPE_TOP_INFO (RFTYPE_INFO | RFTYPE_TOP) -#define RFTYPE_CTRL_BASE (RFTYPE_BASE | RFTYPE_CTRL) -#define RFTYPE_MON_BASE (RFTYPE_BASE | RFTYPE_MON) - /* List of all resource groups */ extern struct list_head rdt_all_groups; @@ -369,13 +340,6 @@ static inline struct rdt_resource *resctrl_inc(struct rdt_resource *res) return &hw_res->r_resctrl; } -static inline bool resctrl_arch_get_cdp_enabled(enum resctrl_res_level l) -{ - return rdt_resources_all[l].cdp_enabled; -} - -int resctrl_arch_set_cdp_enabled(enum resctrl_res_level l, bool enable); - /* * To return the common struct rdt_resource, which is contained in struct * rdt_hw_resource, walk the resctrl member of struct rdt_hw_resource. diff --git a/include/linux/resctrl_types.h b/include/linux/resctrl_types.h index 4788bd95dac6..fe0b10b589c0 100644 --- a/include/linux/resctrl_types.h +++ b/include/linux/resctrl_types.h @@ -7,6 +7,36 @@ #ifndef __LINUX_RESCTRL_TYPES_H #define __LINUX_RESCTRL_TYPES_H +#define CQM_LIMBOCHECK_INTERVAL 1000 + +#define MBM_CNTR_WIDTH_BASE 24 +#define MBM_OVERFLOW_INTERVAL 1000 +#define MAX_MBA_BW 100u +#define MBA_IS_LINEAR 0x4 + +/* rdtgroup.flags */ +#define RDT_DELETED 1 + +/* rftype.flags */ +#define RFTYPE_FLAGS_CPUS_LIST 1 + +/* + * Define the file type flags for base and info directories. + */ +#define RFTYPE_INFO BIT(0) +#define RFTYPE_BASE BIT(1) +#define RFTYPE_CTRL BIT(4) +#define RFTYPE_MON BIT(5) +#define RFTYPE_TOP BIT(6) +#define RFTYPE_RES_CACHE BIT(8) +#define RFTYPE_RES_MB BIT(9) +#define RFTYPE_DEBUG BIT(10) +#define RFTYPE_CTRL_INFO (RFTYPE_INFO | RFTYPE_CTRL) +#define RFTYPE_MON_INFO (RFTYPE_INFO | RFTYPE_MON) +#define RFTYPE_TOP_INFO (RFTYPE_INFO | RFTYPE_TOP) +#define RFTYPE_CTRL_BASE (RFTYPE_BASE | RFTYPE_CTRL) +#define RFTYPE_MON_BASE (RFTYPE_BASE | RFTYPE_MON) + /* Reads to Local DRAM Memory */ #define READS_TO_LOCAL_MEM BIT(0) -- 2.34.1