From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1BC33C43458 for ; Thu, 9 Jul 2026 09:31:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=HuYv96UQ0eLooIb+Z4uofPGyThS3w4yBK5HBQsW7Jcg=; b=Rn17jUr5E3DTvd9U4RhFT0qqEg HEJBtJPenh06cR6DidGo4w6VfZNDkzDIQBO6QjmJmVfIzXTuur0tsK6w8QFA1c/fYNH6bGmBS6DLB us92v/U/hAB3lYJih4QOxACojYmjUeIG4XhUOT7Utct7UM9Ul0zPGkdPZvZ752C2Y7OLebF7xmKJS OnubnnWa1iopXUkIQZGl0564pFzfEZFnpeYcH5hWwAN0Gx+eQZojTvCKkQ26f3LaAvucvmvwVEfk+ vTKSZtQn7dL5lqISz1EtOeOFRyvxiRjTf4wsz/Ta49MgBgH/dAVpqZbb2cfjLD1nC+5JTZVJuwtO2 F7O3O5Gw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1whl6R-00000001lkM-0Gd0; Thu, 09 Jul 2026 09:31:31 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1whl6N-00000001liA-3vA8 for linux-arm-kernel@lists.infradead.org; Thu, 09 Jul 2026 09:31:30 +0000 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 BD847357C; Thu, 9 Jul 2026 02:31:22 -0700 (PDT) Received: from e134344.cambridge.arm.com (e134344.arm.com [10.2.212.8]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id EC6A63F915; Thu, 9 Jul 2026 02:31:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arm.com; s=foss; t=1783589487; bh=cpp/A+DZWQ2h7wV3fHsPCvRwuYk8Gl08eO0UIRdy47Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HxtoqgcfjnoiHTJcU9STSOTUu5d/hcsh4441q8eajVC89Y2DRmSJrXGQCqYrToY2O ATu9lbfpBgIVF04HDx2DHvIYFMGdXdmKHldUNKVgMyIdtX8KZ56SqKMpMVlq8duv2+ qve4UEsKBk05NVa5DltD9rrGAIzhwRVwjl9APO8E= 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 v5 2/3] arm_mpam: resctrl: Add pass-through resctrl_arch_preconvert_bw() Date: Thu, 9 Jul 2026 10:31:10 +0100 Message-ID: <20260709093111.367851-3-ben.horgan@arm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260709093111.367851-1-ben.horgan@arm.com> References: <20260709093111.367851-1-ben.horgan@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20260709_023128_028245_3FD89A3F X-CRM114-Status: UNSURE ( 9.39 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 Reviewed-by: Reinette Chatre --- Changes since v3: Parameter order switch (Reinette) Add Reinette's R-b Changes since v4: Add missing tearoff divider, --- --- 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..e9dea8c40265 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(const struct rdt_resource *r, u32 val) +{ + return val; +} + /** * resctrl_reset_task_closids() - Reset the PARTID/PMG values for all tasks. * -- 2.43.0