From nobody Mon Feb 9 10:28:29 2026 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 38E0019CC34 for ; Fri, 17 Jan 2025 15:10:59 +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=1737126660; cv=none; b=CsHubqAYv80nx/Egry77wCpSXHEMEPs+d0+w0x6wgAItLfrQbKsyoFOlTI1KrgBlst01gl4RU1EvC2Eu2QMzWoEt1vU9Y6FZB+TIbBJusnuYqC1VS//ZzRx/Tf9QAnhslx6mNALgmU0PccG7JdbU82ScOuG9fk36jgsyGVp8cfo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737126660; c=relaxed/simple; bh=fIuCnYK4bCJnW09v72TjNYnl6E8ZSIOKNVkIUP/Rsh4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=eLT+qLuCC/YE1GhUPgP1wzFpW/caVU7gL7/QL2H8v4uMAj5u3b9d7PPvG+N1wtYM3QjKBkE5RVG6EgnUMwBRYTjzbH0Dw+uI72JejYf12jwG4VokWt+WDL6UnCG3480+tf4NrEGJmekek4qcY5xzHnheSA+zZysliXHPLJdG64E= 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 6D1E41691; Fri, 17 Jan 2025 07:11:27 -0800 (PST) Received: from e133380.cambridge.arm.com (e133380.arm.com [10.1.197.43]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 4EA0C3F73F; Fri, 17 Jan 2025 07:10:58 -0800 (PST) From: Dave Martin To: linux-kernel@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, Zeng Heng , Shaopeng Tan , James Morse Subject: [RFC PATCH v2 07/11] arm_mpam: [NFU] Rework ID remapping to use a kernel command-line argument Date: Fri, 17 Jan 2025 15:10:17 +0000 Message-Id: <20250117151033.1517882-8-Dave.Martin@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250117151033.1517882-1-Dave.Martin@arm.com> References: <20250117151033.1517882-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: quoted-printable Content-Type: text/plain; charset="utf-8" Hacking the source is an acceptable interface for experimentation, but not very convenient. Instead, add a kernel command-line parameter mpam_partid_per_closid=3D to specify how many PARTIDs are used to provide monitoring groups for each resctrl CLOSID. This change is not intended for upstream. Signed-off-by: Dave Martin --- drivers/platform/arm64/mpam/mpam_resctrl.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/drivers/platform/arm64/mpam/mpam_resctrl.c b/drivers/platform/= arm64/mpam/mpam_resctrl.c index f834753a3274..eb1ef5d2bc57 100644 --- a/drivers/platform/arm64/mpam/mpam_resctrl.c +++ b/drivers/platform/arm64/mpam/mpam_resctrl.c @@ -3,6 +3,9 @@ =20 #define pr_fmt(fmt) "mpam: resctrl: " fmt =20 +#undef KBUILD_MODNAME +#define KBUILD_MODNAME "mpam" + #include #include #include @@ -10,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -158,6 +162,24 @@ static bool mpam_resctrl_hide_cdp(enum resctrl_res_lev= el rid) =20 static unsigned int partid_per_closid =3D 1; =20 +static int mpam_resctrl_partid_per_closid_set(const char *val, + const struct kernel_param *kp) +{ + /* + * 16 in an arbitrary maximum, sufficient for experimentation + * but not ridiculously large: + */ + return param_set_uint_minmax(val, kp, 1, 16); +} + +static const struct kernel_param_ops mpam_resctrl_partid_per_closid_ops = =3D { + .set =3D mpam_resctrl_partid_per_closid_set, + .get =3D param_get_uint, +}; + +device_param_cb(partid_per_closid, &mpam_resctrl_partid_per_closid_ops, + &partid_per_closid, 0444); + static unsigned int mpam_num_pmg(void) { return mpam_pmg_max + 1; --=20 2.34.1