From patchwork Mon Feb 17 03:18:49 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zeng Heng X-Patchwork-Id: 13977027 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 701ACC02198 for ; Mon, 17 Feb 2025 03:10:58 +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-Type: Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID:Date :Subject:CC:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=Ou5GaBpzpum3afXoxpvGAImJ7izyNAtwjteF7zSL0Ik=; b=3XGugeOzMxNElebU1YGOZ77u1T FbMQagQj7c1oX6XAY6TFm5QODCZXEPV2rk5EnvujlyXCAgpxrWFl6J7DEJ0tgunVcE64MCNZ8rmCy 3gOy5IzMK1S6aIXK+qaepiBozS/xfhRSF1JHGZkeWMYD1dlmdVSIpEP7BPm2KS50geaZY6zu4/xDK LkXM8/15w+Q/Jvz3MHhxoWUVhDkxJApTm5BqqTLKJveQl5dL78ROoR/4PZofbkpwu94lqFCdmde+c 1Cu1sDC3q8kECk11ajGqzPPAavl1eKgBiXAqFtvwTq7iK4QutOp2QhnX0DtTNrKfjxAlBA5uC048P eLehtr6g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tjrWu-000000036b4-3vAY; Mon, 17 Feb 2025 03:10:44 +0000 Received: from szxga08-in.huawei.com ([45.249.212.255]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tjrVR-000000036MM-0MTp for linux-arm-kernel@lists.infradead.org; Mon, 17 Feb 2025 03:09:14 +0000 Received: from mail.maildlp.com (unknown [172.19.163.252]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4Yx6vN4T9xz1Y1q7; Mon, 17 Feb 2025 11:04:32 +0800 (CST) Received: from kwepemf100008.china.huawei.com (unknown [7.202.181.222]) by mail.maildlp.com (Postfix) with ESMTPS id A50F11800EC; Mon, 17 Feb 2025 11:09:05 +0800 (CST) Received: from huawei.com (10.175.103.91) by kwepemf100008.china.huawei.com (7.202.181.222) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Mon, 17 Feb 2025 11:09:04 +0800 From: Zeng Heng To: , CC: , , , Subject: [PATCH mpam mpam/snapshot/v6.14-rc1 2/5] arm_mpam: Add limitation for the Narrow-PARTID feature Date: Mon, 17 Feb 2025 11:18:49 +0800 Message-ID: <20250217031852.2014939-3-zengheng4@huawei.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20250217031852.2014939-1-zengheng4@huawei.com> References: <20250217031852.2014939-1-zengheng4@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.103.91] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To kwepemf100008.china.huawei.com (7.202.181.222) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250216_190913_281772_3D9BAE34 X-CRM114-Status: GOOD ( 14.53 ) 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 Because it needs to support mixed systems that include MSCs with and without Narrow-PARTID support, there are the following incompatible control issues. If an MSC does not support Narrow-PARTID and its control method is not of the "partition bitmap" type, then delivering the resctrl control group configuration across multiple PARTIDs will change the user's expected behavior. Currently, there is no way to solve this problem by programming different control values simply, so here decide to restrict the usage scenarios of this feature. When we find that the MATA MSC does not support the Narrow-PARTID feature, the driver will disable the feature, which means get_num_reqpartid() directly returns the number of intPARTIDs. Signed-off-by: Zeng Heng --- drivers/platform/arm64/mpam/mpam_resctrl.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/drivers/platform/arm64/mpam/mpam_resctrl.c b/drivers/platform/arm64/mpam/mpam_resctrl.c index eedd308d9c88..f3f8fb0ff421 100644 --- a/drivers/platform/arm64/mpam/mpam_resctrl.c +++ b/drivers/platform/arm64/mpam/mpam_resctrl.c @@ -168,6 +168,21 @@ u32 resctrl_arch_get_num_closid(struct rdt_resource *ignored) static u32 get_num_reqpartid(void) { + struct mpam_resctrl_res *res; + struct rdt_resource *r_mba; + struct mpam_props *cprops; + + r_mba = resctrl_arch_get_resource(RDT_RESOURCE_MBA); + res = container_of(r_mba, struct mpam_resctrl_res, resctrl_res); + cprops = &res->class->props; + + /* + * If the MBA does not support Narrow-PARTID, + * then the feature should be disabled at the system level. + */ + if (!mpam_has_feature(mpam_feat_partid_nrw, cprops)) + return resctrl_arch_get_num_closid(NULL); + return mpam_partid_max + 1; }