Received: by 2002:a89:413:0:b0:1fd:dba5:e537 with SMTP id m19csp883264lqs; Fri, 14 Jun 2024 08:17:29 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUtVebcHpztDxe6iXo2J4T+wX1sgBWkAZYI97rAn/E8KWwo1bBT0SmWsH2Jg6QpLWDZtR6Bwvt+BMLDsKVmOjdyT94v37DGuDRxhgSgyg== X-Google-Smtp-Source: AGHT+IHH8aurdvM6vGF8oeN/mlJWxABw3JAk+vVhEgm2QH6XOxAqhn6obPxH6megJamol4shqDSF X-Received: by 2002:a05:6a20:9189:b0:1b7:bdb3:7bb7 with SMTP id adf61e73a8af0-1bae7f14565mr3647243637.35.1718378249352; Fri, 14 Jun 2024 08:17:29 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718378249; cv=pass; d=google.com; s=arc-20160816; b=D79i8pPBqYlBgXgNLt4VDz/XlztHLDG7OVnbbNxhOXS9/kjsJnXifqmytlNw/DxYlH Gw3VTfykkwmZ7dbBrhJFNVRnGqofWRCpnjZnaAWzH01w1OOXBnGax7qZFaKR8GgpXaKU D++JphakwE9seEDI7OjWNnk/vjDV+uO5EC1JJJey8iYsqCxBIXVdXUE0DDKJaR0Bh6/T JlS5yk3yzs9JwElQD5mxwUq48lEGihQhT7jQBxul3kmubY5gh+fTiCAfXnY8PLuh83ak KOD+guOE4D59y3Kf+/Y8505tGedwMcpotJtgxe9d7FQO/otDqv5JIwhdgPb4rvTMwto0 mQ/g== 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=K7bxNwIrSw39HMNJKOEq8T3ZxQBb4yl/zmxJXqTzWtA=; fh=AQRRtkmHyvZI0LQ5UvExX7X5tmBE1F1lr2MH+s0Lwao=; b=A9M7pP6PhVjEiC1PyC2LsDr9bUjLjXloUAt0d++xbLIZ1NHsIpnm1WQ/nxoq9+Gp0E Mbj6lFbmCzENVKqT3OskE7r7DLUuCmDX+APCoeCS+PnG5+bnzS3g/gEtxYMDlJOWGUFp +hTDJ5qpvd1BGqjF8VRdipV+C1F0EPzetbWiFQfzO2of66qtbMrXch1aZYKnIHGfrMdV troaIVjwhvc4Z6MHRSIjmIB/GtGgPiVi8UZ/Mgi8HyTEYWPbfsijHZZX4BuA1koclKpl 6OmsrmGc7+mEcmz3HZAnZ7uS0+QDZS8a8iJeeUz3bPzppf6+lEP+iLz2xO14pSeA1DJ2 6tVA==; 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-215105-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-215105-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id 41be03b00d2f7-70380fd3445si1195643a12.547.2024.06.14.08.17.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Jun 2024 08:17:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-215105-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; 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-215105-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-215105-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 92ABB28CBBE for ; Fri, 14 Jun 2024 15:09:28 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B27241B010E; Fri, 14 Jun 2024 15:03:15 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3CA50181B84 for ; Fri, 14 Jun 2024 15:03:13 +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=1718377395; cv=none; b=l8kpFlUYAoMzNgRI0FB8YG349DGhbafSoTH5l8aNhKBKka9mFBBBX0YCsqeuP2mlcoM+epG5IV2b5Ieud+BAW+joKEeCA24zA7u4gXTaQSpeg4gmQB/Pv0c5PL9H1Ojt4sowZ50NTVoRolYFSmxxrBYHShS2LR58sHRxnrn+uwg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718377395; c=relaxed/simple; bh=vvq7PgOlZmsbGlHC21TeGpD/uH1GRSIrOX5XJ1/VWcg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=r1XWRp6AeucAFFqRVDnKGZEnajUs43BCIeszu2fMs8dIqJFXBDDGjMeQ4jMZqgnHK+Hm2/4S5DjSczyyVYhi8WIZO9QSrZPGyY4/2+/ALXdmPTOsbU58RH+o4gmvX+BlYlxShnEkCzsLgRiG20O/nLhcesM+jrQvbBy9nK2N4vk= 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 3D49B1C25; Fri, 14 Jun 2024 08:03:37 -0700 (PDT) Received: from merodach.members.linode.com (usa-sjc-mx-foss1.foss.arm.com [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 703DA3F5A1; Fri, 14 Jun 2024 08:03:09 -0700 (PDT) From: James Morse To: x86@kernel.org, linux-kernel@vger.kernel.org Cc: Fenghua Yu , Reinette Chatre , Thomas Gleixner , Ingo Molnar , Borislav Petkov , H Peter Anvin , Babu Moger , James Morse , shameerali.kolothum.thodi@huawei.com, D Scott Phillips OS , carl@os.amperecomputing.com, lcherian@marvell.com, bobo.shaobowang@huawei.com, tan.shaopeng@fujitsu.com, baolin.wang@linux.alibaba.com, Jamie Iles , Xin Hao , peternewman@google.com, dfustini@baylibre.com, amitsinght@marvell.com, David Hildenbrand , Rex Nie , Dave Martin , Dave Martin , Shaopeng Tan Subject: [PATCH v3 37/38] x86/resctrl: Move the filesystem bits to headers visible to fs/resctrl Date: Fri, 14 Jun 2024 15:00:32 +0000 Message-Id: <20240614150033.10454-38-james.morse@arm.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20240614150033.10454-1-james.morse@arm.com> References: <20240614150033.10454-1-james.morse@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 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. Co-developed-by: Dave Martin Signed-off-by: Dave Martin Signed-off-by: James Morse Tested-by: Peter Newman Tested-by: Shaopeng Tan ---- Changes since v2: * Dropped the rfflags and some other defines from being moved. Changes since v1: * 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 | 9 --------- include/linux/resctrl_types.h | 3 +++ 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/arch/x86/include/asm/resctrl.h b/arch/x86/include/asm/resctrl.h index 491342f56811..746431c66fc4 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 cb8119d58c30..b8e4a7a2ebb8 100644 --- a/arch/x86/kernel/cpu/resctrl/core.c +++ b/arch/x86/kernel/cpu/resctrl/core.c @@ -283,6 +283,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 msr_param *m) { struct rdt_hw_resource *hw_res = resctrl_to_arch_res(m->res); diff --git a/arch/x86/kernel/cpu/resctrl/internal.h b/arch/x86/kernel/cpu/resctrl/internal.h index 6f6785a31efe..40704445ac38 100644 --- a/arch/x86/kernel/cpu/resctrl/internal.h +++ b/arch/x86/kernel/cpu/resctrl/internal.h @@ -17,8 +17,6 @@ #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 @@ -371,13 +369,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 70226f5ab3e3..b84a6e0834a7 100644 --- a/include/linux/resctrl_types.h +++ b/include/linux/resctrl_types.h @@ -7,6 +7,9 @@ #ifndef __LINUX_RESCTRL_TYPES_H #define __LINUX_RESCTRL_TYPES_H +#define MAX_MBA_BW 100u +#define MBM_OVERFLOW_INTERVAL 1000 + /* Reads to Local DRAM Memory */ #define READS_TO_LOCAL_MEM BIT(0) -- 2.39.2