Received: by 2002:a89:48b:0:b0:1f5:f2ab:c469 with SMTP id a11csp370617lqd; Wed, 24 Apr 2024 05:13:05 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCU+hmHxVg93TZgQrQysDUfQjxeM5C14LVzcCorXW1mQ5Zp9Zp/wSM50OI2NdZHawB5rDU9QmIkbdmEuZ8PGtI6utgr2zBUFtd3OQAmrlA== X-Google-Smtp-Source: AGHT+IEiKKiH4gPoEjo6yzB0ESGHw9Bmiz7LLs106v8Dvrq6IpnDWy7JTfQhXndVTI374dLPBX53 X-Received: by 2002:a17:907:7792:b0:a55:b021:c0b1 with SMTP id ky18-20020a170907779200b00a55b021c0b1mr1451061ejc.9.1713960785674; Wed, 24 Apr 2024 05:13:05 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713960785; cv=pass; d=google.com; s=arc-20160816; b=Ggtbe5fl5yO6Ci9nwW/gWHD8PA49Xhlv3T5G7+VRtqgoJgLRl23Zy1R2AQHaRxbDcg BcKMnn+3SLhgyP0GIkpAjKGd3+e2gnknQxXNN9U8hF0zOftQSgroY4MZESA/7h1+/QFC 12mIqDl55KPf63LzIitREVPahSgIperZMcIeUcCa/Ab/Owjim+osdj6L5LUYYd4d8ZGe dAM1oe4xaxzzeudmC6ABc9wofdEpGHNgqjP3ANTOOjnjhMFrJqwimEMDZW6B2YVAdJYq h48K2jkuD7phFjYCcuagNSod2u4VXdDsHsqMyIpoGL+lz9wKBZLNMwl3Ieg+0xzY0Ntn KkIg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:precedence:robot-unsubscribe:robot-id :message-id:mime-version:list-unsubscribe:list-subscribe:list-id :precedence:references:in-reply-to:cc:subject:to:reply-to:sender :from:dkim-signature:dkim-signature:date; bh=4b8Ew+3Lxiu7qiq1mb7rXGCKfr+q/WtObVJghToldxw=; fh=uPaMlHrKzAyRJxrwCbsb2aaoyZFeuBpKfH+A3wbUdG0=; b=yQ0rtXY0fQnJGPE1l1fxTBdTPCE0MAcMe7z61fMJKUGuxGArQR/5x3s3gSljaZH17S XLWlbwogZ7owv5lrFZHuUmTjUb6XUZMvNvTKwvGI9Che32PlRAVlRkP+2n3lYIDvtck7 2jxMpQfjfKVtC+lSanM0O6CrGLIbZInd8UUvXmdUmkkvHkmjzSGTaeCA7Sog1rQ84C/P 7nVFgexk3EEhvSPD7mmfcFAY8xKRD7Oan16Dx/7P+Py7RW5QfdjnyloGOWQY2Wkg03uy 7fBzp8TrKOjv5HAoUSUs4/dSSI5Vq3CpryNti4zcwIqxKBltIRSbzeVIX61zr//p76N0 T7BQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b="B8M7xj/Y"; 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-156828-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-156828-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id gs19-20020a1709072d1300b00a519d6027a0si8880593ejc.542.2024.04.24.05.13.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 05:13:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-156828-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b="B8M7xj/Y"; 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-156828-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-156828-linux.lists.archive=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 am.mirrors.kernel.org (Postfix) with ESMTPS id C1C171F21A3E for ; Wed, 24 Apr 2024 12:01:49 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DF6C015ADA3; Wed, 24 Apr 2024 12:01:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="B8M7xj/Y"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="G7ppjG9o" 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 C146D15AAA7; Wed, 24 Apr 2024 12:01:34 +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=1713960098; cv=none; b=TydSkfC4NkAyun03/ms+o/yFei+0MTG1JRMYEHMMnH27W2qzFmq8QTcDPWo+mRUiCPgHrxhNSmK8AfRLc3lo8xVcXu23yljOD53na7HVIOwxY2yFkIi8PRg4TF0IUMAPQ6OQnIRLai68u6ZPCy//wH10UogKR4DQwJCITOVF3jA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713960098; c=relaxed/simple; bh=gK3wp21w/k0oVq1YDzRBOiUQn+4aHYCTIeO8DoUi090=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=U3n7fOG1NvXGFdIfI9Nz3kHnft0js1JMnzzGLOZX9V7TqCh7RjRDO8PhHMgbfi0HqlHGzWruEyITWi4L40nep27iLiJ8i2PpZ/LzZlNW+ifAHVUHDoNxrFQ5ZjV0rZNdMxH9vC1gmHr1PvUnK9XGaIfYbhJbFpB4iK2dmCbG8nc= 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=B8M7xj/Y; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=G7ppjG9o; 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 Date: Wed, 24 Apr 2024 12:01:25 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1713960087; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4b8Ew+3Lxiu7qiq1mb7rXGCKfr+q/WtObVJghToldxw=; b=B8M7xj/YzrI13sLPsKTbtPf9E2IgWgDPf3hGkObG2u3BAYHLtvgogjjzMpbtNZd5oLTUjy znwtok7+HVfb7d70Wm2bBaMxd2NJy3kSrT0GWHJOodx6npgV2UC4+qIG32rGR98zGD1ccX XfSbwwBPvgNgK5b0RDNPaiS09QTBHnp4cN5SZ3B56XSmMADEOqLfsqkSSCKkBLYAfxf5Lg 1FC1wpTobx84CrCa1zc04ExpoDJ9MFfYlBCfTZNYbIukFzOlL/W5bhJ0xUzXJmEdJeQFoS u+pEYaSj1rZ5JMmnpYYl+YzNd1kdyxCmGSARRWXChXEZANAgb2Sio9ObUR3lLQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1713960087; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4b8Ew+3Lxiu7qiq1mb7rXGCKfr+q/WtObVJghToldxw=; b=G7ppjG9oGmJB1giyOq+FsnK0OIs+qIb0EjWK8WgFTRurohlJLS2v/xpEe5mGPxEUJxBmEZ r0/C61or3u2rMZAw== From: "tip-bot2 for Tony Luck" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/cache] x86/resctrl: Simplify call convention for MSR update functions Cc: Reinette Chatre , Tony Luck , "Borislav Petkov (AMD)" , Babu Moger , "Maciej Wieczor-Retman" , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20240308213846.77075-3-tony.luck@intel.com> References: <20240308213846.77075-3-tony.luck@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <171396008598.10875.1036187242067626064.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit The following commit has been merged into the x86/cache branch of tip: Commit-ID: bd4955d4bc2182ccb660c9c30a4dd7f36feaf943 Gitweb: https://git.kernel.org/tip/bd4955d4bc2182ccb660c9c30a4dd7f36feaf943 Author: Tony Luck AuthorDate: Fri, 08 Mar 2024 13:38:46 -08:00 Committer: Borislav Petkov (AMD) CommitterDate: Wed, 24 Apr 2024 13:47:00 +02:00 x86/resctrl: Simplify call convention for MSR update functions The per-resource MSR update functions cat_wrmsr(), mba_wrmsr_intel(), and mba_wrmsr_amd() all take three arguments: (struct rdt_domain *d, struct msr_param *m, struct rdt_resource *r) struct msr_param contains pointers to both struct rdt_resource and struct rdt_domain, thus only struct msr_param is necessary. Pass struct msr_param as a single parameter. Clean up formatting and fix some fir tree declaration ordering. No functional change. Suggested-by: Reinette Chatre Signed-off-by: Tony Luck Signed-off-by: Borislav Petkov (AMD) Reviewed-by: Reinette Chatre Reviewed-by: Babu Moger Tested-by: Maciej Wieczor-Retman Link: https://lore.kernel.org/r/20240308213846.77075-3-tony.luck@intel.com --- arch/x86/kernel/cpu/resctrl/core.c | 40 ++++++++-------------- arch/x86/kernel/cpu/resctrl/ctrlmondata.c | 2 +- arch/x86/kernel/cpu/resctrl/internal.h | 3 +-- 3 files changed, 18 insertions(+), 27 deletions(-) diff --git a/arch/x86/kernel/cpu/resctrl/core.c b/arch/x86/kernel/cpu/resctrl/core.c index acf52aa..7751eea 100644 --- a/arch/x86/kernel/cpu/resctrl/core.c +++ b/arch/x86/kernel/cpu/resctrl/core.c @@ -56,14 +56,9 @@ int max_name_width, max_data_width; */ bool rdt_alloc_capable; -static void -mba_wrmsr_intel(struct rdt_domain *d, struct msr_param *m, - struct rdt_resource *r); -static void -cat_wrmsr(struct rdt_domain *d, struct msr_param *m, struct rdt_resource *r); -static void -mba_wrmsr_amd(struct rdt_domain *d, struct msr_param *m, - struct rdt_resource *r); +static void mba_wrmsr_intel(struct msr_param *m); +static void cat_wrmsr(struct msr_param *m); +static void mba_wrmsr_amd(struct msr_param *m); #define domain_init(id) LIST_HEAD_INIT(rdt_resources_all[id].r_resctrl.domains) @@ -309,12 +304,11 @@ static void rdt_get_cdp_l2_config(void) rdt_get_cdp_config(RDT_RESOURCE_L2); } -static void -mba_wrmsr_amd(struct rdt_domain *d, struct msr_param *m, struct rdt_resource *r) +static void mba_wrmsr_amd(struct msr_param *m) { + struct rdt_hw_resource *hw_res = resctrl_to_arch_res(m->res); + struct rdt_hw_domain *hw_dom = resctrl_to_arch_dom(m->dom); unsigned int i; - struct rdt_hw_domain *hw_dom = resctrl_to_arch_dom(d); - struct rdt_hw_resource *hw_res = resctrl_to_arch_res(r); for (i = m->low; i < m->high; i++) wrmsrl(hw_res->msr_base + i, hw_dom->ctrl_val[i]); @@ -334,25 +328,22 @@ static u32 delay_bw_map(unsigned long bw, struct rdt_resource *r) return r->default_ctrl; } -static void -mba_wrmsr_intel(struct rdt_domain *d, struct msr_param *m, - struct rdt_resource *r) +static void mba_wrmsr_intel(struct msr_param *m) { + struct rdt_hw_resource *hw_res = resctrl_to_arch_res(m->res); + struct rdt_hw_domain *hw_dom = resctrl_to_arch_dom(m->dom); unsigned int i; - struct rdt_hw_domain *hw_dom = resctrl_to_arch_dom(d); - struct rdt_hw_resource *hw_res = resctrl_to_arch_res(r); /* Write the delay values for mba. */ for (i = m->low; i < m->high; i++) - wrmsrl(hw_res->msr_base + i, delay_bw_map(hw_dom->ctrl_val[i], r)); + wrmsrl(hw_res->msr_base + i, delay_bw_map(hw_dom->ctrl_val[i], m->res)); } -static void -cat_wrmsr(struct rdt_domain *d, struct msr_param *m, struct rdt_resource *r) +static void cat_wrmsr(struct msr_param *m) { + struct rdt_hw_resource *hw_res = resctrl_to_arch_res(m->res); + struct rdt_hw_domain *hw_dom = resctrl_to_arch_dom(m->dom); unsigned int i; - struct rdt_hw_domain *hw_dom = resctrl_to_arch_dom(d); - struct rdt_hw_resource *hw_res = resctrl_to_arch_res(r); for (i = m->low; i < m->high; i++) wrmsrl(hw_res->msr_base + i, hw_dom->ctrl_val[i]); @@ -384,7 +375,7 @@ void rdt_ctrl_update(void *arg) struct msr_param *m = arg; hw_res = resctrl_to_arch_res(m->res); - hw_res->msr_update(m->dom, m, m->res); + hw_res->msr_update(m); } /* @@ -457,10 +448,11 @@ static int domain_setup_ctrlval(struct rdt_resource *r, struct rdt_domain *d) hw_dom->ctrl_val = dc; setup_default_ctrlval(r, dc); + m.res = r; m.dom = d; m.low = 0; m.high = hw_res->num_closid; - hw_res->msr_update(d, &m, r); + hw_res->msr_update(&m); return 0; } diff --git a/arch/x86/kernel/cpu/resctrl/ctrlmondata.c b/arch/x86/kernel/cpu/resctrl/ctrlmondata.c index 165d8d4..b7291f6 100644 --- a/arch/x86/kernel/cpu/resctrl/ctrlmondata.c +++ b/arch/x86/kernel/cpu/resctrl/ctrlmondata.c @@ -289,7 +289,7 @@ int resctrl_arch_update_one(struct rdt_resource *r, struct rdt_domain *d, msr_param.dom = d; msr_param.low = idx; msr_param.high = idx + 1; - hw_res->msr_update(d, &msr_param, r); + hw_res->msr_update(&msr_param); return 0; } diff --git a/arch/x86/kernel/cpu/resctrl/internal.h b/arch/x86/kernel/cpu/resctrl/internal.h index ab2d315..f1d9268 100644 --- a/arch/x86/kernel/cpu/resctrl/internal.h +++ b/arch/x86/kernel/cpu/resctrl/internal.h @@ -445,8 +445,7 @@ struct rdt_hw_resource { struct rdt_resource r_resctrl; u32 num_closid; unsigned int msr_base; - void (*msr_update) (struct rdt_domain *d, struct msr_param *m, - struct rdt_resource *r); + void (*msr_update)(struct msr_param *m); unsigned int mon_scale; unsigned int mbm_width; unsigned int mbm_cfg_mask;