From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CA5EC48097A; Fri, 15 May 2026 14:06:34 +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=1778853996; cv=none; b=G1eN4zi4yA057QcaOLlrCU9bSyL9Rlqq5QX4BruCz810TvhL3nDnFOCn/djMMciG90z63uwEWVi7T3Nlz4gbSz4js3U2mSM5mEmSzzDo9YCgYqiDFXrNciiGuQ6kcU1wY4kqHPWRBU0n78mNAg5ePTtT6vmZuQL2Z19bj9npnCY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778853996; c=relaxed/simple; bh=fT5zpgH8sZLDiwtCzmI9hNrpGxEbBAiElP2J+OjSfBE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=H+vT844VnH6yOcMmKmQLzSRMJ3wFLkvI6y4sWTWANLPd6Q3wxyOv7mtimduBTOgPaqoytjJ9IjfH50M4EqB/lWUce1GmSpMSIcuXfNinI/6rz/QzhKeMa6M8fubKgSfW4nnqwvikq1P0n1q1P4It03fx8XiCQHvJRi+HhQ5ojUE= 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; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.b=pD2IjQeB; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.b="pD2IjQeB" 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 9E05B35A5; Fri, 15 May 2026 07:06:27 -0700 (PDT) Received: from e134344.cambridge.arm.com (e134344.arm.com [10.1.196.46]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 8EBAC3F836; Fri, 15 May 2026 07:06:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arm.com; s=foss; t=1778853992; bh=fT5zpgH8sZLDiwtCzmI9hNrpGxEbBAiElP2J+OjSfBE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pD2IjQeBH+1GQ1NS2tAG1aYTe2GJEqgOTjSK1cL2ERK5RsOOOk4Ll68ip1x7JFrJ1 H9B+MEkAITgwj1AqjcpcDvRiHU3hC3BkR71JfhskWPmgFhjZjH288M2boxDj9rO8+x UcJlhirlQwuDw2SYY5qHidF0AjIaTvCUaO+ZewX8= From: Ben Horgan To: ben.horgan@arm.com Cc: james.morse@arm.com, reinette.chatre@intel.com, fenghuay@nvidia.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, hpa@zytor.com, corbet@lwn.net, x86@kernel.org, linux-doc@vger.kernel.org, dave.martin@arm.com Subject: [PATCH v3 2/3] arm_mpam: resctrl: Add pass-through resctrl_arch_preconvert_bw() Date: Fri, 15 May 2026 15:06:11 +0100 Message-ID: <20260515140612.1205251-3-ben.horgan@arm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260515140612.1205251-1-ben.horgan@arm.com> References: <20260515140612.1205251-1-ben.horgan@arm.com> Precedence: bulk X-Mailing-List: linux-doc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit resctrl rounds up the percentage value of the MBA based on the bw_gran. As MPAM uses a binary fixed point fraction format for MBA rather than a decimal percentage, this introduces rounding errors. Without this additional rounding, if the user reads the value in an MB schema and then writes it back to the schema, the value in hardware won't change. However, with this additional rounding, this guarantee is broken for systems with mbw_wd < 7. resctrl is introducing resctrl_arch_preconvert_bw() to allow the arch code to specify the conversion resctrl does to the user-provided bandwidth value. Add the MPAM version of resctrl_arch_preconvert_bw(). This does no conversion. Signed-off-by: Ben Horgan --- drivers/resctrl/mpam_resctrl.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/resctrl/mpam_resctrl.c b/drivers/resctrl/mpam_resctrl.c index 226ff6f532fa..5a2104af22cc 100644 --- a/drivers/resctrl/mpam_resctrl.c +++ b/drivers/resctrl/mpam_resctrl.c @@ -167,6 +167,11 @@ bool resctrl_arch_get_cdp_enabled(enum resctrl_res_level rid) return mpam_resctrl_controls[rid].cdp_enabled; } +u32 resctrl_arch_preconvert_bw(u32 val, const struct rdt_resource *r) +{ + return val; +} + /** * resctrl_reset_task_closids() - Reset the PARTID/PMG values for all tasks. * -- 2.43.0