From nobody Thu Dec 18 00:08:15 2025 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0C820C04FDF for ; Tue, 15 Aug 2023 15:29:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237993AbjHOP2l (ORCPT ); Tue, 15 Aug 2023 11:28:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48356 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237962AbjHOP2I (ORCPT ); Tue, 15 Aug 2023 11:28:08 -0400 Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C63C59C for ; Tue, 15 Aug 2023 08:28:07 -0700 (PDT) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 37FEFVPe008845; Tue, 15 Aug 2023 08:27:44 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=Uk3A5P7WfGa23MOhtDO8rNOCRZXqtO0eZxiTOWLUHWc=; b=CjalgO9dVZ0Yyei/AVn7TJJjGpMTbCUTAC7AwC1tc0Mg8mYbgYTknV6HsbsAkYNiEmKP q2J9u6xwNJyFq7Ne5C4fZ89ocrpWtkDePvLYrPsWKJzqKLJYRDIs60tO9jyuv210MJu5 QGLZZSMooMy2ObpMsvGMbMdx08ihJouetiHwGA+h6pifh5iOYLbn7Gt4u4PN5W6YQy6B 3qIjhLA1ef+/1nRVID+8DmYe7/o7KbtwLrG4oxW5d8bYG3CGsfEM9VlbT8W09RTKtI6J qICidWddCr6WtXnVWyPeU8sGd6rqIskghfdQpCXWY1UxTtBU1V+su3oSe7uDxisIji5N iw== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3sgaydr89a-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Tue, 15 Aug 2023 08:27:44 -0700 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Tue, 15 Aug 2023 08:27:42 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Tue, 15 Aug 2023 08:27:42 -0700 Received: from localhost.localdomain (unknown [10.28.36.167]) by maili.marvell.com (Postfix) with ESMTP id D33C43F704D; Tue, 15 Aug 2023 08:27:39 -0700 (PDT) From: Amit Singh Tomar To: , CC: , , , , , , Amit Singh Tomar Subject: [RFC 01/12] arm_mpam: Handle resource instances mapped to different controls Date: Tue, 15 Aug 2023 20:57:01 +0530 Message-ID: <20230815152712.1760046-2-amitsinght@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230815152712.1760046-1-amitsinght@marvell.com> References: <20230815152712.1760046-1-amitsinght@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-GUID: EDEfHLYgAD4deGl_cpTtBhjtMuOQekxK X-Proofpoint-ORIG-GUID: EDEfHLYgAD4deGl_cpTtBhjtMuOQekxK X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.601,FMLib:17.11.176.26 definitions=2023-08-15_16,2023-08-15_02,2023-05-22_02 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" At the moment, configuring multiple resource instances (mapped to same control) under a resource class is not supported. For instance, on MARVELL SoC MPAMF_IDR_NS[RIS_MAX] (under LLC MSC) is 0x2, and there are three different resource at index 0,1,2. These are enumerated in TAD_CMN_MPAM_RIS_E: 0: MSC 1: LTG 2: DTG LLC MSC resource at index 1, and 2 have cache portion partitioning feature, i.e., If MPAMCFG_PART_SEL_NS[RIS] is set to 1 (LTG) or to 2 (DTG), then MPAMF_IDR_NS[HAS_CPOR_PART] is set to 1. LTG resource has 16 portion bitmap, and DTG has 18 portion bitmap (mapped to same CPOR control), and only one can be configured. LLC MSC resource at index 0 has the Priority partitioning features. If MPAMCFG_PART_SEL_NS[RIS] is set to 0 (MSC), then MPAMF_IDR_NS[HAS_PRI_PA= RT] is set to 1, leaving HAS_CPOR_PART bit to 0. CPOR and PRI_PART are mutually exclusive resources as far configuration is concerned. With this change, multiple resource instances that maps to different control, say LTG for CPOR, and MSC for PRI_PART is handled properly. Signed-off-by: Amit Singh Tomar --- drivers/platform/mpam/mpam_devices.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/drivers/platform/mpam/mpam_devices.c b/drivers/platform/mpam/m= pam_devices.c index 589ff1ef2b6b..137cbff925ba 100644 --- a/drivers/platform/mpam/mpam_devices.c +++ b/drivers/platform/mpam/mpam_devices.c @@ -1829,6 +1829,19 @@ static void mpam_enable_init_class_features(struct m= pam_class *class) class->props =3D ris->props; } =20 +/* Club different resource properties under a class that resctrl uses, + * for instance, L3 cache that supports both CPOR, and DSPRI need to have + * knowledge of both cpbm_wd and dspri_wd. + */ +static void mpam_enable_club_class_features(struct mpam_class *class, + struct mpam_msc_ris *ris) +{ + class->props.features |=3D ris->props.features; + class->props.cpbm_wd |=3D ris->props.cpbm_wd; + class->props.dspri_wd |=3D ris->props.dspri_wd; + class->props.num_csu_mon |=3D ris->props.num_csu_mon; +} + /* Merge all the common resource features into class. */ static void mpam_enable_merge_features(void) { @@ -1843,7 +1856,16 @@ static void mpam_enable_merge_features(void) =20 list_for_each_entry(comp, &class->components, class_list) { list_for_each_entry(ris, &comp->ris, comp_list) { - __resource_props_mismatch(ris, class); + /* There can be multiple resources under a class which is + * mapped to different controls, for instance L3 cache + * can have both CPOR and DSPRI implemented, and following + * would avoid property mismatch later on when different + * resources are present. + */ + if (class->props.features !=3D ris->props.features) + mpam_enable_club_class_features(class, ris); + else + __resource_props_mismatch(ris, class); =20 class->nrdy_usec =3D max(class->nrdy_usec, ris->msc->nrdy_usec); --=20 2.25.1 From nobody Thu Dec 18 00:08:15 2025 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1B1B6C04E69 for ; Tue, 15 Aug 2023 15:29:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238001AbjHOP2n (ORCPT ); Tue, 15 Aug 2023 11:28:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48372 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237959AbjHOP2I (ORCPT ); Tue, 15 Aug 2023 11:28:08 -0400 Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0F09BE5 for ; Tue, 15 Aug 2023 08:28:08 -0700 (PDT) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 37FEFUMl008839; Tue, 15 Aug 2023 08:27:48 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=2AcGndNsb0mA20+rk92QjaYDMCbdWb3nhdSfrUTAJqc=; b=evhp6I1Sum2FPwRGJl/w7xslgmMPLdEO+EM/Iqjdf6zqNXw/8/V/WsAeLFVsLRsP4n0F G8wpMhnppdCzXzhbjbv25fhbn3ih5uWJW04HqLZ3dI/lhfC+M0dWhgxZ5BnsOnYAXnrZ AbD/NBhOfCd/C9FoAF5mkMb02JG3oS7/tTn121vqbvtQ82g2zZEw/IMlmAx4w+wvonCB gbhQDOntpsc9GZEaTbuC4jcLNz5bOwRiCP+1PRTPtTtyLsb2RCH48kn2Cqg8vflOY6lN t15dhq2XpdtkQf6QC7M66ftTVFZAtt2GH87Sn/r03wDxyzvITNqL2Hs3VcbwE+y/iTw1 BA== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3sgaydr89c-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Tue, 15 Aug 2023 08:27:47 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Tue, 15 Aug 2023 08:27:46 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Tue, 15 Aug 2023 08:27:46 -0700 Received: from localhost.localdomain (unknown [10.28.36.167]) by maili.marvell.com (Postfix) with ESMTP id 5D6833F703F; Tue, 15 Aug 2023 08:27:43 -0700 (PDT) From: Amit Singh Tomar To: , CC: , , , , , , Amit Singh Tomar Subject: [RFC 02/12] arm_mpam: resctrl: Detect priority partitioning capability Date: Tue, 15 Aug 2023 20:57:02 +0530 Message-ID: <20230815152712.1760046-3-amitsinght@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230815152712.1760046-1-amitsinght@marvell.com> References: <20230815152712.1760046-1-amitsinght@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-GUID: LytoDMRjzmYmG-5KbYRh7H8fMQPZWMAY X-Proofpoint-ORIG-GUID: LytoDMRjzmYmG-5KbYRh7H8fMQPZWMAY X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.601,FMLib:17.11.176.26 definitions=2023-08-15_16,2023-08-15_02,2023-05-22_02 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" ARM MPAM supports different control that can be applied to different resources in the system, for instance priority partitioning control where priority value is generated from one MSC, propagates over interconnect to other MSC (known as downstream priority), or can be applied within an MSC for internal operations. This change lets the resctrl know the about MSC's priority partitioning capability. Signed-off-by: Amit Singh Tomar --- drivers/platform/mpam/mpam_resctrl.c | 14 ++++++++++++++ include/linux/resctrl.h | 4 ++++ 2 files changed, 18 insertions(+) diff --git a/drivers/platform/mpam/mpam_resctrl.c b/drivers/platform/mpam/m= pam_resctrl.c index 1dbfb6f6dd34..09618d9ceb1d 100644 --- a/drivers/platform/mpam/mpam_resctrl.c +++ b/drivers/platform/mpam/mpam_resctrl.c @@ -435,6 +435,16 @@ static bool cache_has_usable_cpor(struct mpam_class *c= lass) return (class->props.cpbm_wd <=3D RESCTRL_MAX_CBM); } =20 +static bool cache_has_usable_priority_part(struct mpam_class *class) +{ + struct mpam_props *cprops =3D &class->props; + + if (!mpam_has_feature(mpam_feat_dspri_part, cprops)) + return false; + + return (class->props.dspri_wd <=3D RESCTRL_MAX_DSPRI); +} + static bool cache_has_usable_csu(struct mpam_class *class) { struct mpam_props *cprops; @@ -691,6 +701,7 @@ static int mpam_resctrl_resource_init(struct mpam_resct= rl_res *res) res->resctrl_res.rid =3D=3D RDT_RESOURCE_L3) { bool has_csu =3D cache_has_usable_csu(class); bool has_mbwu =3D class_has_usable_mbwu(class); + bool has_ppart =3D cache_has_usable_priority_part(class); =20 /* TODO: Scaling is not yet supported */ r->cache.cbm_len =3D class->props.cpbm_wd; @@ -718,6 +729,9 @@ static int mpam_resctrl_resource_init(struct mpam_resct= rl_res *res) exposed_alloc_capable =3D true; } =20 + if (has_ppart) + r->priority_cap =3D true; + /* * MBWU counters may be 'local' or 'total' depending on where * they are in the topology. If The counter is on the L3, its diff --git a/include/linux/resctrl.h b/include/linux/resctrl.h index 3ad308e9e226..a98ba5828211 100644 --- a/include/linux/resctrl.h +++ b/include/linux/resctrl.h @@ -38,6 +38,8 @@ int proc_resctrl_show(struct seq_file *m, */ #define RESCTRL_MAX_CBM 32 =20 +#define RESCTRL_MAX_DSPRI 63 + /* The format for packing fields into the u64 'id' exposed to user-space */ #define RESCTRL_ID_CLOSID GENMASK_ULL(31, 0) #define RESCTRL_ID_RMID GENMASK_ULL(63, 32) @@ -195,6 +197,7 @@ struct resctrl_membw { * @rid: The index of the resource * @alloc_capable: Is allocation available on this machine * @mon_capable: Is monitor feature available on this machine + * @priority_capable: Is priority partitioning feature available on this= machine * @num_rmid: Number of RMIDs available * @cache_level: Which cache level defines scope of this resource * @cache: Cache allocation related data @@ -212,6 +215,7 @@ struct rdt_resource { int rid; bool alloc_capable; bool mon_capable; + bool priority_cap; int num_rmid; int cache_level; struct resctrl_cache cache; --=20 2.25.1 From nobody Thu Dec 18 00:08:15 2025 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9B791C04FE1 for ; Tue, 15 Aug 2023 15:28:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237969AbjHOP2J (ORCPT ); Tue, 15 Aug 2023 11:28:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48342 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237961AbjHOP2H (ORCPT ); Tue, 15 Aug 2023 11:28:07 -0400 Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1843F1980 for ; Tue, 15 Aug 2023 08:28:06 -0700 (PDT) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 37FAXQ1G003906; Tue, 15 Aug 2023 08:27:52 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=DETGQIxwT57vHR/twWLuXydvnHEcnwHAYSDGPy/HrsA=; b=PtN6IRRYyJXjS8V8V9d5ML98DddlqH04g/4SWGITiftWMJtxVm2ioR08mNlfROPU9Cgr T2G76CgFcflESllHcx4qt4aYiLZNBe3KOGqnZUetG8/DXyCq8PmKMtL/6BAqC2hU/Gw+ Y6me/aGNT96tCcNHj9++Jli5QVAj1EuXx73ksuVQjGcsgN6WOatGRv5TFs7JmP+TrcVo aYSr/3oI1HjQ6sF4XlY/mrzRHD5Rgm85ydoIrM8JThrnT/RPNZbMZDQsE91URqU3oRFy Tdnxa1RjBvd/ozPcpR5b6FHjEZCgW5fGW+urMB2WJgzCpIVevUqzMafrvOiAXfaaJ3ME kw== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3se9kjajup-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Tue, 15 Aug 2023 08:27:52 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Tue, 15 Aug 2023 08:27:49 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Tue, 15 Aug 2023 08:27:49 -0700 Received: from localhost.localdomain (unknown [10.28.36.167]) by maili.marvell.com (Postfix) with ESMTP id DE0043F704D; Tue, 15 Aug 2023 08:27:46 -0700 (PDT) From: Amit Singh Tomar To: , CC: , , , , , , Amit Singh Tomar Subject: [RFC 03/12] arm_mpam: resctrl: Define new schemata format for priority partition Date: Tue, 15 Aug 2023 20:57:03 +0530 Message-ID: <20230815152712.1760046-4-amitsinght@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230815152712.1760046-1-amitsinght@marvell.com> References: <20230815152712.1760046-1-amitsinght@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-GUID: F1CvY0tOobqxZ8jV9wcP6oHBXQH31a6J X-Proofpoint-ORIG-GUID: F1CvY0tOobqxZ8jV9wcP6oHBXQH31a6J X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.601,FMLib:17.11.176.26 definitions=2023-08-15_16,2023-08-15_02,2023-05-22_02 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" At the moment, "schemata" file contains information about cache portion bitmap (CPBM), and memory bandwidth allocation (MBA) in the following format. MB:0=3D0100 L3:0=3Dffff Lets' update the "schemata" file to accommodate information about priority partition control that indicates downstream priority value. For instance: L3:0=3Dffff,f CPBM is separated from downstream priority value using delimiter ",". Signed-off-by: Amit Singh Tomar --- drivers/platform/mpam/mpam_resctrl.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/platform/mpam/mpam_resctrl.c b/drivers/platform/mpam/m= pam_resctrl.c index 09618d9ceb1d..1081ceac41a8 100644 --- a/drivers/platform/mpam/mpam_resctrl.c +++ b/drivers/platform/mpam/mpam_resctrl.c @@ -711,7 +711,11 @@ static int mpam_resctrl_resource_init(struct mpam_resc= trl_res *res) r->cache.min_cbm_bits =3D 1; =20 /* TODO: kill these properties off as they are derivatives */ - r->format_str =3D "%d=3D%0*x"; + if (mpam_has_feature(mpam_feat_dspri_part, &class->props)) + r->format_str =3D "%d=3D%0*x,%0*x"; + else + r->format_str =3D "%d=3D%0*x"; + r->fflags =3D RFTYPE_RES_CACHE; r->default_ctrl =3D BIT_MASK(class->props.cpbm_wd) - 1; r->data_width =3D (class->props.cpbm_wd + 3) / 4; --=20 2.25.1 From nobody Thu Dec 18 00:08:15 2025 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6A9E6C04A94 for ; Tue, 15 Aug 2023 15:28:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237963AbjHOP2I (ORCPT ); Tue, 15 Aug 2023 11:28:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48316 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237959AbjHOP2G (ORCPT ); Tue, 15 Aug 2023 11:28:06 -0400 Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B49FDE5 for ; Tue, 15 Aug 2023 08:28:05 -0700 (PDT) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 37FAH7rf003857; Tue, 15 Aug 2023 08:27:55 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=p/OcC2JAIbZW0kg2Ug7j+/hs6aTTsB0s76/sSxAMZqM=; b=ZWZsCyi2lyn/kqnHQfCov/v8UFejV/8GF9jhgrxEndYn96R63U3DOMXmzDABUv4hJ0bn P3HF6MrX5zQfHXzujUcRWGS6zJEXL32xEMxRLn0T6RRcTrwMjxtLypKMIUJBT0uZYoTJ DVCupRSYJ3y1Bn5/ZdNSa4eet4651ezGgXh92VX+1q65IYKfOKLU0HrSdnhJngdpddD1 N6FsCdXoRaR+TThfS2ja6QcnqGGZNnfIpxOL6Tk6z405d/g7aUHBSoIq6Rean4nC+GwY qYSgGqaqP+zXC/RCyWG9rvMHgASqodvef1KsVDj74cnXBxYeHCwsxhKYNPox92/WLfvX mA== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3se9kjajuu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Tue, 15 Aug 2023 08:27:55 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Tue, 15 Aug 2023 08:27:53 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Tue, 15 Aug 2023 08:27:53 -0700 Received: from localhost.localdomain (unknown [10.28.36.167]) by maili.marvell.com (Postfix) with ESMTP id 6FF1A3F703F; Tue, 15 Aug 2023 08:27:50 -0700 (PDT) From: Amit Singh Tomar To: , CC: , , , , , , Amit Singh Tomar Subject: [RFC 04/12] fs/resctrl: Obtain CPBM upon priority partition presence Date: Tue, 15 Aug 2023 20:57:04 +0530 Message-ID: <20230815152712.1760046-5-amitsinght@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230815152712.1760046-1-amitsinght@marvell.com> References: <20230815152712.1760046-1-amitsinght@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-GUID: 1_wlpT1GBG-hMikF_Phai7NmtANMrjKb X-Proofpoint-ORIG-GUID: 1_wlpT1GBG-hMikF_Phai7NmtANMrjKb X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.601,FMLib:17.11.176.26 definitions=2023-08-15_16,2023-08-15_02,2023-05-22_02 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Resource control group's "schemata" file represents the cache portion bit map (XXXX), parsed from buffer with "L3:0=3DXXXX" format. Now, with the introduction of priority control, "schemata" file format has changed to "L3:0=3DXXXX,X", where cpbm (XXXX) is split from priority mask(X) using using delimiter ",". With this change, CPBM is properly fetched from schemata file when priority partition support is present. Signed-off-by: Amit Singh Tomar --- fs/resctrl/ctrlmondata.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fs/resctrl/ctrlmondata.c b/fs/resctrl/ctrlmondata.c index 27d8bc25a4cb..b19ac2509e38 100644 --- a/fs/resctrl/ctrlmondata.c +++ b/fs/resctrl/ctrlmondata.c @@ -108,6 +108,9 @@ static bool cbm_validate(char *buf, u32 *data, struct r= dt_resource *r) unsigned int cbm_len =3D r->cache.cbm_len; int ret; =20 + if (r->priority_cap) + buf =3D strsep(&buf, ","); + ret =3D kstrtoul(buf, 16, &val); if (ret) { rdt_last_cmd_printf("Non-hex character in the mask %s\n", buf); --=20 2.25.1 From nobody Thu Dec 18 00:08:15 2025 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 38D10C04FE1 for ; Tue, 15 Aug 2023 15:29:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238010AbjHOP2q (ORCPT ); Tue, 15 Aug 2023 11:28:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55124 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237960AbjHOP2L (ORCPT ); Tue, 15 Aug 2023 11:28:11 -0400 Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3B97EE5 for ; Tue, 15 Aug 2023 08:28:10 -0700 (PDT) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 37FEFVPf008845; Tue, 15 Aug 2023 08:27:58 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=QpHIOHGP5iCgR5XpTWXZwTOBtb2YGEhP4AC2OvY5k1g=; b=RNHdf+jpJw4t3LHQfQ2POwShgqMtdKZ8GNz0zUa1DyDVRObRJLRlUOX+SpQNhnHdU5gi CJgQ74Vb7TIFFAJqOAOtIU/qZpwpKnofrUIplVDSciGIhfNYaoP1IdDbuL1oTqnIVSD5 OdayeHATVLFZ0iJ2hvBqhctAB2cEroY2LWUe7bkfccmc7HTW5aIxi3ms1mhJh8plgvan v6emCMH3pUiuFhrZEBe/xonVe9tQDr/LVk1932BMC0dRiFbhPjO2YqkREzW2INNwlZd8 pbkrVOxWChXE5PCEuL+f/7GoQS1C/eeCO4DsTRuo3s3cK2KjB2REnylI8FYvFGP3XpQc Eg== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3sgaydr89s-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Tue, 15 Aug 2023 08:27:58 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Tue, 15 Aug 2023 08:27:56 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Tue, 15 Aug 2023 08:27:56 -0700 Received: from localhost.localdomain (unknown [10.28.36.167]) by maili.marvell.com (Postfix) with ESMTP id 01ECC3F704D; Tue, 15 Aug 2023 08:27:53 -0700 (PDT) From: Amit Singh Tomar To: , CC: , , , , , , Amit Singh Tomar Subject: [RFC 05/12] fs/resctrl: Set-up downstream priority partition resources Date: Tue, 15 Aug 2023 20:57:05 +0530 Message-ID: <20230815152712.1760046-6-amitsinght@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230815152712.1760046-1-amitsinght@marvell.com> References: <20230815152712.1760046-1-amitsinght@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-GUID: mB1E9UfRmfxlx-F-JVpPYRgQOdmSoHik X-Proofpoint-ORIG-GUID: mB1E9UfRmfxlx-F-JVpPYRgQOdmSoHik X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.601,FMLib:17.11.176.26 definitions=2023-08-15_16,2023-08-15_02,2023-05-22_02 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Upon resource control group creation, Cache portion bitmap, and Memory bandwidth allocation gets initialized to the default/maximum values, obtained from resource control code. Let's replicate it for priority partition resource, and setup the default downstream priority value. Signed-off-by: Amit Singh Tomar --- drivers/platform/mpam/mpam_resctrl.c | 4 +++- fs/resctrl/rdtgroup.c | 30 ++++++++++++++++++++++++++++ include/linux/resctrl.h | 4 ++++ 3 files changed, 37 insertions(+), 1 deletion(-) diff --git a/drivers/platform/mpam/mpam_resctrl.c b/drivers/platform/mpam/m= pam_resctrl.c index 1081ceac41a8..cc843f1b0fb7 100644 --- a/drivers/platform/mpam/mpam_resctrl.c +++ b/drivers/platform/mpam/mpam_resctrl.c @@ -733,8 +733,10 @@ static int mpam_resctrl_resource_init(struct mpam_resc= trl_res *res) exposed_alloc_capable =3D true; } =20 - if (has_ppart) + if (has_ppart) { r->priority_cap =3D true; + r->dspri_default_ctrl =3D BIT_MASK(class->props.dspri_wd) - 1; + } =20 /* * MBWU counters may be 'local' or 'total' depending on where diff --git a/fs/resctrl/rdtgroup.c b/fs/resctrl/rdtgroup.c index 9c5dfaaa7fa2..bc5fb246ba68 100644 --- a/fs/resctrl/rdtgroup.c +++ b/fs/resctrl/rdtgroup.c @@ -3045,6 +3045,21 @@ static int rdtgroup_init_cat(struct resctrl_schema *= s, u32 closid) return 0; } =20 +static int rdtgroup_init_dspri(struct rdt_resource *r, u32 closid) +{ + struct resctrl_staged_config *cfg; + struct rdt_domain *d; + + list_for_each_entry(d, &r->domains, list) { + cfg =3D &d->staged_config[CDP_NONE]; + cfg->new_ctrl =3D r->dspri_default_ctrl; + cfg->have_new_ctrl =3D true; + r->dspri_store =3D true; + } + + return 0; +} + /* Initialize MBA resource with default values. */ static void rdtgroup_init_mba(struct rdt_resource *r, u32 closid) { @@ -3082,12 +3097,27 @@ static int rdtgroup_init_alloc(struct rdtgroup *rdt= grp) return ret; } =20 + if (r->priority_cap) + r->dspri_store =3D false; + ret =3D resctrl_arch_update_domains(r, rdtgrp->closid); if (ret < 0) { rdt_last_cmd_puts("Failed to initialize allocations\n"); return ret; } =20 + if (r->priority_cap) { + ret =3D rdtgroup_init_dspri(r, rdtgrp->closid); + if (ret < 0) + return ret; + + ret =3D resctrl_arch_update_domains(r, rdtgrp->closid); + if (ret < 0) { + rdt_last_cmd_puts("Failed to initialize allocations\n"); + return ret; + } + r->dspri_store =3D false; + } } =20 rdtgrp->mode =3D RDT_MODE_SHAREABLE; diff --git a/include/linux/resctrl.h b/include/linux/resctrl.h index a98ba5828211..d5b0661c0f70 100644 --- a/include/linux/resctrl.h +++ b/include/linux/resctrl.h @@ -198,6 +198,7 @@ struct resctrl_membw { * @alloc_capable: Is allocation available on this machine * @mon_capable: Is monitor feature available on this machine * @priority_capable: Is priority partitioning feature available on this= machine + * @dspri_store: * @num_rmid: Number of RMIDs available * @cache_level: Which cache level defines scope of this resource * @cache: Cache allocation related data @@ -206,6 +207,7 @@ struct resctrl_membw { * @name: Name to use in "schemata" file. * @data_width: Character width of data when displaying * @default_ctrl: Specifies default cache cbm or memory B/W percent. + * @dspri_default_ctrl: Specifies default downstream priority value. * @format_str: Per resource format string to show domain value * @evt_list: List of monitoring events * @fflags: flags to choose base and info files @@ -216,6 +218,7 @@ struct rdt_resource { bool alloc_capable; bool mon_capable; bool priority_cap; + bool dspri_store; int num_rmid; int cache_level; struct resctrl_cache cache; @@ -224,6 +227,7 @@ struct rdt_resource { char *name; int data_width; u32 default_ctrl; + u32 dspri_default_ctrl; const char *format_str; struct list_head evt_list; unsigned long fflags; --=20 2.25.1 From nobody Thu Dec 18 00:08:15 2025 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4D5D3C04FE0 for ; Tue, 15 Aug 2023 15:29:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238026AbjHOP2s (ORCPT ); Tue, 15 Aug 2023 11:28:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55136 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237976AbjHOP2R (ORCPT ); Tue, 15 Aug 2023 11:28:17 -0400 Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 51985E5 for ; Tue, 15 Aug 2023 08:28:16 -0700 (PDT) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 37FEFiP7008910; Tue, 15 Aug 2023 08:28:02 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=7VqvIZ5Kw60KAdQqYaseDlv9dFqfiOw23a8I9hkx92I=; b=E2M9DngD/Rmv8OUgqjF5lomP4SrwtBnguQUDbCW1e50WJDG+ikp9IfwkAmpBga+TaB5r Mtrj2Ay/qd3zGMIBtjpXuBMsK1BzuGr/hIEEhJfYBxcrR2SDZvYmn3KK9kTE7q2bR1zD tpJcAp8BtAQIezIHOq9l1YjRXEZ68ptoXjKysEWSPxjwSyrChSzkZdis03UrBW2Wkg+h k2NmK00qDcEFsE0lzGpnTj6iRyg65twHKHEJAvSPSYfVnUXamBVFQrTZ61Md2QnbTKJo KH7kx8c28EB+IDw7zYD7ABHAqUiDdScvnV+5X45PC0vaPBQ2hsl5WOWT+KeMJp5urqR0 vA== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3sgaydr8a1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Tue, 15 Aug 2023 08:28:02 -0700 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Tue, 15 Aug 2023 08:28:00 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Tue, 15 Aug 2023 08:28:00 -0700 Received: from localhost.localdomain (unknown [10.28.36.167]) by maili.marvell.com (Postfix) with ESMTP id 7EC783F703F; Tue, 15 Aug 2023 08:27:57 -0700 (PDT) From: Amit Singh Tomar To: , CC: , , , , , , Amit Singh Tomar Subject: [RFC 06/12] fs/resctrl: Extend schemata read for priority partition control Date: Tue, 15 Aug 2023 20:57:06 +0530 Message-ID: <20230815152712.1760046-7-amitsinght@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230815152712.1760046-1-amitsinght@marvell.com> References: <20230815152712.1760046-1-amitsinght@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-GUID: pYw_XwpvMpH1BeJ9R0vvSqmdqsVVQ3z2 X-Proofpoint-ORIG-GUID: pYw_XwpvMpH1BeJ9R0vvSqmdqsVVQ3z2 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.601,FMLib:17.11.176.26 definitions=2023-08-15_16,2023-08-15_02,2023-05-22_02 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" At present, "schemata" file under resource control group reveals information about Cache portion bitmap and Memory Bandwidth allocation. With the introduction of priority partition control "schemata" is updated to adopt priority value. Let's enable support for reading the priority values for "schemata" file. Signed-off-by: Amit Singh Tomar --- drivers/platform/mpam/mpam_resctrl.c | 4 ++++ fs/resctrl/ctrlmondata.c | 15 ++++++++++++--- include/linux/resctrl.h | 4 ++++ 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/drivers/platform/mpam/mpam_resctrl.c b/drivers/platform/mpam/m= pam_resctrl.c index cc843f1b0fb7..b491a0f897fd 100644 --- a/drivers/platform/mpam/mpam_resctrl.c +++ b/drivers/platform/mpam/mpam_resctrl.c @@ -735,7 +735,11 @@ static int mpam_resctrl_resource_init(struct mpam_resc= trl_res *res) =20 if (has_ppart) { r->priority_cap =3D true; + if (class->props.dspri_wd > 0x10) + class->props.dspri_wd =3D 0x10; + r->dspri_default_ctrl =3D BIT_MASK(class->props.dspri_wd) - 1; + r->dspri_data_width =3D (class->props.dspri_wd + 3) / 4; } =20 /* diff --git a/fs/resctrl/ctrlmondata.c b/fs/resctrl/ctrlmondata.c index b19ac2509e38..8c8a4d09d22c 100644 --- a/fs/resctrl/ctrlmondata.c +++ b/fs/resctrl/ctrlmondata.c @@ -379,7 +379,7 @@ static void show_doms(struct seq_file *s, struct resctr= l_schema *schema, int clo struct rdt_resource *r =3D schema->res; struct rdt_domain *dom; bool sep =3D false; - u32 ctrl_val; + u32 ctrl_val, dspri_ctrl_val; =20 /* Walking r->domains, ensure it can't race with cpuhp */ lockdep_assert_cpus_held(); @@ -395,9 +395,18 @@ static void show_doms(struct seq_file *s, struct resct= rl_schema *schema, int clo ctrl_val =3D resctrl_arch_get_config(r, dom, closid, schema->conf_type); =20 - seq_printf(s, r->format_str, dom->id, max_data_width, - ctrl_val); + if (r->priority_cap) { + r->dspri_show =3D true; + dspri_ctrl_val =3D resctrl_arch_get_config(r, dom, closid, + CDP_NONE); + seq_printf(s, r->format_str, dom->id, max_data_width, ctrl_val, + r->dspri_data_width, dspri_ctrl_val); + } else + seq_printf(s, r->format_str, dom->id, max_data_width, + ctrl_val); + sep =3D true; + r->dspri_show =3D false; } seq_puts(s, "\n"); } diff --git a/include/linux/resctrl.h b/include/linux/resctrl.h index d5b0661c0f70..d7100c330945 100644 --- a/include/linux/resctrl.h +++ b/include/linux/resctrl.h @@ -199,12 +199,14 @@ struct resctrl_membw { * @mon_capable: Is monitor feature available on this machine * @priority_capable: Is priority partitioning feature available on this= machine * @dspri_store: + * @dspri_show: flag to indicate downstream priority read * @num_rmid: Number of RMIDs available * @cache_level: Which cache level defines scope of this resource * @cache: Cache allocation related data * @membw: If the component has bandwidth controls, their properties. * @domains: RCU list of all domains for this resource * @name: Name to use in "schemata" file. + * @dspri_data_width Character width of dspri value when displaying * @data_width: Character width of data when displaying * @default_ctrl: Specifies default cache cbm or memory B/W percent. * @dspri_default_ctrl: Specifies default downstream priority value. @@ -219,6 +221,7 @@ struct rdt_resource { bool mon_capable; bool priority_cap; bool dspri_store; + bool dspri_show; int num_rmid; int cache_level; struct resctrl_cache cache; @@ -226,6 +229,7 @@ struct rdt_resource { struct list_head domains; char *name; int data_width; + int dspri_data_width; u32 default_ctrl; u32 dspri_default_ctrl; const char *format_str; --=20 2.25.1 From nobody Thu Dec 18 00:08:15 2025 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 61803C04FE2 for ; Tue, 15 Aug 2023 15:29:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238034AbjHOP2t (ORCPT ); Tue, 15 Aug 2023 11:28:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55150 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237977AbjHOP2R (ORCPT ); Tue, 15 Aug 2023 11:28:17 -0400 Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 961C4172A for ; Tue, 15 Aug 2023 08:28:16 -0700 (PDT) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 37FAXQ1H003906; Tue, 15 Aug 2023 08:28:06 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=14mdTkkbewJtr+++SfUne9QWQCLp6Yk4HKCHhy3bbis=; b=bE2jccDgOQadwNuB+w53hfjvRSIuVwqO+UTJNa05EZX6pnd0q0gVifMRcELQGmPEC8NZ 2trVVKqEGptUKy8qfo5dCnEVRjhlHpheH+Kxp/WHfDhQF0eYezk5+Mo3XgenwA8fHsAr m88pLtd0vruCpv+ID6yu/gyK8GSpqNw5VoqhPo4pZko6dAo1K7VZquJQeeWMCxVvrbhW 1XiXexnVGSxV0NXnwza5zG+aIP6mdITgfEWWtUJDg5k1O2Y50RbYF5CEtzydDEbfc7RG 7WQi/Gu6qk2ZEKTbG8xazO08+LoO5hdcWfzqF7rY4ecjw8PGWCImIfCszD+B0A4SI0hR vA== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3se9kjajvb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Tue, 15 Aug 2023 08:28:05 -0700 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Tue, 15 Aug 2023 08:28:04 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Tue, 15 Aug 2023 08:28:04 -0700 Received: from localhost.localdomain (unknown [10.28.36.167]) by maili.marvell.com (Postfix) with ESMTP id 06E0B3F704D; Tue, 15 Aug 2023 08:28:00 -0700 (PDT) From: Amit Singh Tomar To: , CC: , , , , , , Amit Singh Tomar Subject: [RFC 07/12] arm_mpam: resctrl: Retrieve priority values from arch code Date: Tue, 15 Aug 2023 20:57:07 +0530 Message-ID: <20230815152712.1760046-8-amitsinght@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230815152712.1760046-1-amitsinght@marvell.com> References: <20230815152712.1760046-1-amitsinght@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-GUID: DKSk5JJsr6hJjIbXHEPrzC0C1NPYmTVZ X-Proofpoint-ORIG-GUID: DKSk5JJsr6hJjIbXHEPrzC0C1NPYmTVZ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.601,FMLib:17.11.176.26 definitions=2023-08-15_16,2023-08-15_02,2023-05-22_02 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Downstream priority values can be read from the "schemata" file, which is fetched from mpam_config structure. This change does the necessary modifications in arch specific code to facilitate reading priority values. Signed-off-by: Amit Singh Tomar --- drivers/platform/mpam/mpam_internal.h | 1 + drivers/platform/mpam/mpam_resctrl.c | 11 ++++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/platform/mpam/mpam_internal.h b/drivers/platform/mpam/= mpam_internal.h index 30e32389d394..45552ae6548b 100644 --- a/drivers/platform/mpam/mpam_internal.h +++ b/drivers/platform/mpam/mpam_internal.h @@ -160,6 +160,7 @@ struct mpam_config { u32 cpbm; u32 mbw_pbm; u16 mbw_max; + u16 dspri; }; =20 struct mpam_component diff --git a/drivers/platform/mpam/mpam_resctrl.c b/drivers/platform/mpam/m= pam_resctrl.c index b491a0f897fd..dc710c90cfc2 100644 --- a/drivers/platform/mpam/mpam_resctrl.c +++ b/drivers/platform/mpam/mpam_resctrl.c @@ -864,7 +864,7 @@ u32 resctrl_arch_get_config(struct rdt_resource *r, str= uct rdt_domain *d, lockdep_assert_cpus_held(); =20 if (!mpam_is_enabled()) - return r->default_ctrl; + return r->dspri_show ? r->dspri_default_ctrl : r->default_ctrl; =20 res =3D container_of(r, struct mpam_resctrl_res, resctrl_res); dom =3D container_of(d, struct mpam_resctrl_dom, resctrl_dom); @@ -876,7 +876,10 @@ u32 resctrl_arch_get_config(struct rdt_resource *r, st= ruct rdt_domain *d, switch (r->rid) { case RDT_RESOURCE_L2: case RDT_RESOURCE_L3: - configured_by =3D mpam_feat_cpor_part; + if (r->dspri_show) + configured_by =3D mpam_feat_dspri_part; + else + configured_by =3D mpam_feat_cpor_part; break; case RDT_RESOURCE_MBA: if (mba_class_use_mbw_part(cprops)) { @@ -893,12 +896,14 @@ u32 resctrl_arch_get_config(struct rdt_resource *r, s= truct rdt_domain *d, =20 if (!r->alloc_capable || partid >=3D resctrl_arch_get_num_closid(r) || !mpam_has_feature(configured_by, cfg)) - return r->default_ctrl; + return r->dspri_show ? r->dspri_default_ctrl : r->default_ctrl; =20 switch (configured_by) { case mpam_feat_cpor_part: /* TODO: Scaling is not yet supported */ return cfg->cpbm; + case mpam_feat_dspri_part: + return cfg->dspri; case mpam_feat_mbw_part: /* TODO: Scaling is not yet supported */ return mbw_pbm_to_percent(cfg->mbw_pbm, cprops); --=20 2.25.1 From nobody Thu Dec 18 00:08:15 2025 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 92D05C07E8B for ; Tue, 15 Aug 2023 15:29:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238064AbjHOP2x (ORCPT ); Tue, 15 Aug 2023 11:28:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40392 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237981AbjHOP2W (ORCPT ); Tue, 15 Aug 2023 11:28:22 -0400 Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7EB6C1980 for ; Tue, 15 Aug 2023 08:28:21 -0700 (PDT) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 37FEGDav009581; Tue, 15 Aug 2023 08:28:09 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=asH4VG1rGKa6TkvnGN1MYErwMVnT8I4Q1dhZqaGW3dU=; b=g2Ii2jy5x61i2oHXlwBBc9VBl7svxA5Sn1n9uRk+QvGBjwuF5l5kuFlbTaA/LMqM7y5/ xF3n4DiQqsLkaTjVzA+NgIxyXcu8VYIQ7Skmx19YLoP8c02I9NPq/azc/qJXN9m4gK15 +2U9AKt+MQbGNkJ6mwTGcI06/5sMdE6Lvy3Ej+RAeJDcsYt4eyzXPBdncNaj991p5WEh FHoV9oTBMbnbLqGrgPuIyF4BbGxsCubxnRnrEIyf2R2WGxtBOAMfk7diwvj4csKX1cV5 Ufaj9Z6y9SAov93MXd7iOx0DdJqCiuvJuaeR7l5PdtPya+QT6fngpFp5D1WzMEwiwgmH +g== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3sgaydr8ag-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Tue, 15 Aug 2023 08:28:09 -0700 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Tue, 15 Aug 2023 08:28:07 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Tue, 15 Aug 2023 08:28:07 -0700 Received: from localhost.localdomain (unknown [10.28.36.167]) by maili.marvell.com (Postfix) with ESMTP id 838203F7063; Tue, 15 Aug 2023 08:28:04 -0700 (PDT) From: Amit Singh Tomar To: , CC: , , , , , , Amit Singh Tomar Subject: [RFC 08/12] fs/resctrl: Schemata write only for intended resource Date: Tue, 15 Aug 2023 20:57:08 +0530 Message-ID: <20230815152712.1760046-9-amitsinght@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230815152712.1760046-1-amitsinght@marvell.com> References: <20230815152712.1760046-1-amitsinght@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-GUID: cKQIw9HIp8d4U9z8Dm66O8f6HbV9_9Br X-Proofpoint-ORIG-GUID: cKQIw9HIp8d4U9z8Dm66O8f6HbV9_9Br X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.601,FMLib:17.11.176.26 definitions=2023-08-15_16,2023-08-15_02,2023-05-22_02 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" At present, schemata write (for Cache Portion Bit Map or Memory Bandwidth Allocation) goes through list of all the resources (supported by schemata), and regardless of write for one resource, it attempts to write for all other resources. As an example, When the intended write is for only MBA resource, it attempts (by calling resctrl_arch_update_domains) to write for CPBM as well. Fix it, by doing schemata write based on input schemata supplied from user. Signed-off-by: Amit Singh Tomar --- fs/resctrl/ctrlmondata.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/fs/resctrl/ctrlmondata.c b/fs/resctrl/ctrlmondata.c index 8c8a4d09d22c..ffeb68270968 100644 --- a/fs/resctrl/ctrlmondata.c +++ b/fs/resctrl/ctrlmondata.c @@ -354,9 +354,11 @@ ssize_t rdtgroup_schemata_write(struct kernfs_open_fil= e *of, if (is_mba_sc(r)) continue; =20 - ret =3D resctrl_arch_update_domains(r, rdtgrp->closid); - if (ret) - goto out; + if (!strcmp(resname, s->name)) { + ret =3D resctrl_arch_update_domains(r, rdtgrp->closid); + if (ret) + goto out; + } } =20 if (rdtgrp->mode =3D=3D RDT_MODE_PSEUDO_LOCKSETUP) { --=20 2.25.1 From nobody Thu Dec 18 00:08:15 2025 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A6CD1C07E8D for ; Tue, 15 Aug 2023 15:29:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238077AbjHOP2z (ORCPT ); Tue, 15 Aug 2023 11:28:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40404 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237983AbjHOP2Y (ORCPT ); Tue, 15 Aug 2023 11:28:24 -0400 Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B07AD9C for ; Tue, 15 Aug 2023 08:28:23 -0700 (PDT) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 37F9DiUO003900; Tue, 15 Aug 2023 08:28:13 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=7g4+T3VrbKvrDF/q+3ydyFkkXGyTeBrP+Mv/4SWekxU=; b=Tqn6K5V8P16ak84ms58h15To+QY01SFFcMmZlL2pPQJZgBNl29PD2whXHEU2XLs0IbiE JkSeNRBAfmHZZVw0OcldnBCAurcaaAeyPpU+PWBCXw8uuHcDgLCvsyBtmfzNmqs6ACi+ tEP7KRHb5tanGUEZ1mFtS7uZ0naO0Ey/+D9f2i8fZAHO/tP7S6X1hMEMtAFio7nj0vmT vTplYtdgusg76RfEitwQMkzLDyxOMOx5y8X7J0kyhO00353Dx5hck9kqEYmZmOsgXhQX NoBTwUp6/9APBoQW4I+lSYr1tm33c2r7Yv2/Vb3DSwgdeOTmbY2eYhV2gMis5eQiE56v YA== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3se9kjajvw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Tue, 15 Aug 2023 08:28:13 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Tue, 15 Aug 2023 08:28:11 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Tue, 15 Aug 2023 08:28:11 -0700 Received: from localhost.localdomain (unknown [10.28.36.167]) by maili.marvell.com (Postfix) with ESMTP id 1593B3F7060; Tue, 15 Aug 2023 08:28:07 -0700 (PDT) From: Amit Singh Tomar To: , CC: , , , , , , Amit Singh Tomar Subject: [RFC 09/12] fs/resctrl: Extend schemata write for priority partition control Date: Tue, 15 Aug 2023 20:57:09 +0530 Message-ID: <20230815152712.1760046-10-amitsinght@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230815152712.1760046-1-amitsinght@marvell.com> References: <20230815152712.1760046-1-amitsinght@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-GUID: fFgMh3GFlFwCheWTmJoCQ-WhZaWvuvaL X-Proofpoint-ORIG-GUID: fFgMh3GFlFwCheWTmJoCQ-WhZaWvuvaL X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.601,FMLib:17.11.176.26 definitions=2023-08-15_16,2023-08-15_02,2023-05-22_02 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Currently, Users can pass the configurations for CPBM, and MBA through schemata file. For instance, CPBM can be passed using: echo L3:0=3Dffff > schemata This change allows, users to pass a new configuration for downstream priority along with CPBM. For instance, dspri value of "0xa" can be passed as: echo L3:0=3Dffff,a > schemata Signed-off-by: Amit Singh Tomar --- fs/resctrl/ctrlmondata.c | 92 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) diff --git a/fs/resctrl/ctrlmondata.c b/fs/resctrl/ctrlmondata.c index ffeb68270968..b444adee2002 100644 --- a/fs/resctrl/ctrlmondata.c +++ b/fs/resctrl/ctrlmondata.c @@ -30,6 +30,74 @@ typedef int (ctrlval_parser_t)(struct rdt_parse_data *da= ta, struct resctrl_schema *s, struct rdt_domain *d); =20 +static bool dspri_validate(char *buf, unsigned long *data, struct rdt_reso= urce *r) +{ + + char *dup_buf, *dspri_token; + unsigned long dspri_val; + bool success =3D true; + int ret; + + dup_buf =3D kstrdup(buf, GFP_KERNEL); + if (!dup_buf) { + rdt_last_cmd_printf("Failed to allocate buffer %s\n", + __func__); + success =3D false; + goto out; + } + + strsep(&dup_buf, ","); + if (!dup_buf) { + rdt_last_cmd_printf("Unable to find priority value token %s\n", + __func__); + success =3D false; + goto out; + } + + dspri_token =3D strsep(&dup_buf, ","); + ret =3D kstrtoul(dspri_token, 16, &dspri_val); + if (ret) { + rdt_last_cmd_printf("Non-hex character in the mask %s\n", buf); + success =3D false; + goto out; + } + + if (dspri_val > r->dspri_default_ctrl) { + rdt_last_cmd_printf("dspri value %ld out of range [%d-%d]\n", dspri_val, + 0, r->dspri_default_ctrl); + success =3D false; + goto out; + } + + *data =3D dspri_val; + +out: + kfree(dup_buf); + return success; +} + +static int parse_dspri(struct rdt_parse_data *data, struct resctrl_schema = *s, + struct rdt_domain *d) +{ + struct resctrl_staged_config *cfg; + struct rdt_resource *r =3D s->res; + unsigned long pri_val; + + cfg =3D &d->staged_config[s->conf_type]; + if (cfg->have_new_ctrl) { + rdt_last_cmd_printf("Duplicate domain %d\n", d->id); + return -EINVAL; + } + + if (!dspri_validate(data->buf, &pri_val, r)) + return -EINVAL; + + cfg->new_ctrl =3D pri_val; + cfg->have_new_ctrl =3D true; + + return 0; +} + /* * Check whether MBA bandwidth percentage value is correct. The value is * checked against the minimum and max bandwidth values specified by the @@ -293,6 +361,8 @@ static int rdtgroup_parse_resource(char *resname, char = *tok, ssize_t rdtgroup_schemata_write(struct kernfs_open_file *of, char *buf, size_t nbytes, loff_t off) { + char *dup_buf =3D kstrdup(buf, GFP_KERNEL); + struct rdt_parse_data data; struct resctrl_schema *s; struct rdtgroup *rdtgrp; struct rdt_domain *dom; @@ -354,10 +424,32 @@ ssize_t rdtgroup_schemata_write(struct kernfs_open_fi= le *of, if (is_mba_sc(r)) continue; =20 + if (r->priority_cap) + r->dspri_store =3D false; + if (!strcmp(resname, s->name)) { ret =3D resctrl_arch_update_domains(r, rdtgrp->closid); if (ret) goto out; + + if (r->priority_cap) { + r->dspri_store =3D true; + list_for_each_entry(dom, &r->domains, list) { + ctrlval_parser_t *parse_ctrlval =3D &parse_dspri; + char *dom_data =3D NULL; + + dom_data =3D strsep(&dup_buf, ";"); + dom_data =3D strim(dom_data); + data.buf =3D dom_data; + data.rdtgrp =3D rdtgrp; + if (parse_ctrlval(&data, s, dom)) + return -EINVAL; + } + + ret =3D resctrl_arch_update_domains(r, rdtgrp->closid); + if (ret) + goto out; + } } } =20 --=20 2.25.1 From nobody Thu Dec 18 00:08:15 2025 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B5947C07E8C for ; Tue, 15 Aug 2023 15:29:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238086AbjHOP26 (ORCPT ); Tue, 15 Aug 2023 11:28:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40414 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237984AbjHOP22 (ORCPT ); Tue, 15 Aug 2023 11:28:28 -0400 Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7211C9C for ; Tue, 15 Aug 2023 08:28:27 -0700 (PDT) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 37FA8Olj003829; Tue, 15 Aug 2023 08:28:16 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=ndl9VeZw0l4vQTDQTqKf66NByql2cT6+zlyYa1ZDAgE=; b=hnLcpIZODnRUEjXiCiHmvKsZ4MAFb7Tpj9z7DogGjsht03bRlOlUDdOk4DEnzoH7gkJx I2Z9FmuS+0muMUokSU1NQAmCpW5JBOY0XwzHbv5b7xiL12CWCrf06cX6V+s3Qaij/61L 9ZpcLdX3T9yHSGB3sGQbRM2l07lixnrGvn9B/Yyu+ofCAFE/u/aM+XgEICE78q4arP/I Md2l4SFJ/6p2QUhB84UO78GArDiaKdnA44UFK0UliNOq/LkC2AVvIAW5BaVBVWGFiiAV lHcEr+BXa0fxA7vDqAO8kVM/GkiFGB3ur57A8t8CRErYCBBcNd7QFJLFtaUZYAbt+PGW mA== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3se9kjajw9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Tue, 15 Aug 2023 08:28:16 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Tue, 15 Aug 2023 08:28:14 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Tue, 15 Aug 2023 08:28:14 -0700 Received: from localhost.localdomain (unknown [10.28.36.167]) by maili.marvell.com (Postfix) with ESMTP id 922BE3F703F; Tue, 15 Aug 2023 08:28:11 -0700 (PDT) From: Amit Singh Tomar To: , CC: , , , , , , Amit Singh Tomar Subject: [RFC 10/12] arm_mpam: resctrl: Facilitate writing downstream priority value Date: Tue, 15 Aug 2023 20:57:10 +0530 Message-ID: <20230815152712.1760046-11-amitsinght@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230815152712.1760046-1-amitsinght@marvell.com> References: <20230815152712.1760046-1-amitsinght@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-GUID: 9D23bdYHyp_wW0TPHsM4042SX3fjGDP- X-Proofpoint-ORIG-GUID: 9D23bdYHyp_wW0TPHsM4042SX3fjGDP- X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.601,FMLib:17.11.176.26 definitions=2023-08-15_16,2023-08-15_02,2023-05-22_02 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" This change provides a way to write downstream priority value (passed from schemata file) to arch specific resource control code. The priority value is stored in mpam_config structure, and eventually gets programmed into MPAMCFG_PRI register. Signed-off-by: Amit Singh Tomar --- drivers/platform/mpam/mpam_devices.c | 4 ---- drivers/platform/mpam/mpam_resctrl.c | 27 +++++++++++++++++---------- 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/drivers/platform/mpam/mpam_devices.c b/drivers/platform/mpam/m= pam_devices.c index 137cbff925ba..c0c83c04c77c 100644 --- a/drivers/platform/mpam/mpam_devices.c +++ b/drivers/platform/mpam/mpam_devices.c @@ -2351,10 +2351,6 @@ int mpam_apply_config(struct mpam_component *comp, u= 16 partid, =20 lockdep_assert_cpus_held(); =20 - if (!memcmp(&comp->cfg[partid], cfg, sizeof(*cfg))) - return 0; - - comp->cfg[partid] =3D *cfg; arg.comp =3D comp; arg.partid =3D partid; =20 diff --git a/drivers/platform/mpam/mpam_resctrl.c b/drivers/platform/mpam/m= pam_resctrl.c index dc710c90cfc2..ffd0fa84d37d 100644 --- a/drivers/platform/mpam/mpam_resctrl.c +++ b/drivers/platform/mpam/mpam_resctrl.c @@ -919,7 +919,7 @@ int resctrl_arch_update_one(struct rdt_resource *r, str= uct rdt_domain *d, { int err; u32 partid; - struct mpam_config cfg; + struct mpam_config *cfg; struct mpam_props *cprops; struct mpam_resctrl_res *res; struct mpam_resctrl_dom *dom; @@ -934,6 +934,7 @@ int resctrl_arch_update_one(struct rdt_resource *r, str= uct rdt_domain *d, cprops =3D &res->class->props; =20 partid =3D resctrl_get_config_index(closid, t); + cfg =3D &dom->comp->cfg[partid]; if (!r->alloc_capable || partid >=3D resctrl_arch_get_num_closid(r)) return -EINVAL; =20 @@ -941,17 +942,22 @@ int resctrl_arch_update_one(struct rdt_resource *r, s= truct rdt_domain *d, case RDT_RESOURCE_L2: case RDT_RESOURCE_L3: /* TODO: Scaling is not yet supported */ - cfg.cpbm =3D cfg_val; - mpam_set_feature(mpam_feat_cpor_part, &cfg); + if (r->dspri_store) { + cfg->dspri =3D cfg_val; + mpam_set_feature(mpam_feat_dspri_part, cfg); + } else { + cfg->cpbm =3D cfg_val; + mpam_set_feature(mpam_feat_cpor_part, cfg); + } break; case RDT_RESOURCE_MBA: if (mba_class_use_mbw_part(cprops)) { - cfg.mbw_pbm =3D percent_to_mbw_pbm(cfg_val, cprops); - mpam_set_feature(mpam_feat_mbw_part, &cfg); + cfg->mbw_pbm =3D percent_to_mbw_pbm(cfg_val, cprops); + mpam_set_feature(mpam_feat_mbw_part, cfg); break; } else if (mpam_has_feature(mpam_feat_mbw_max, cprops)) { - cfg.mbw_max =3D percent_to_mbw_max(cfg_val, cprops); - mpam_set_feature(mpam_feat_mbw_max, &cfg); + cfg->mbw_max =3D percent_to_mbw_max(cfg_val, cprops); + mpam_set_feature(mpam_feat_mbw_max, cfg); break; } fallthrough; @@ -965,15 +971,15 @@ int resctrl_arch_update_one(struct rdt_resource *r, s= truct rdt_domain *d, */ if (mpam_resctrl_hide_cdp(r->rid)) { partid =3D resctrl_get_config_index(closid, CDP_CODE); - err =3D mpam_apply_config(dom->comp, partid, &cfg); + err =3D mpam_apply_config(dom->comp, partid, cfg); if (err) return err; =20 partid =3D resctrl_get_config_index(closid, CDP_DATA); - return mpam_apply_config(dom->comp, partid, &cfg); + return mpam_apply_config(dom->comp, partid, cfg); =20 } else { - return mpam_apply_config(dom->comp, partid, &cfg); + return mpam_apply_config(dom->comp, partid, cfg); } } =20 @@ -998,6 +1004,7 @@ int resctrl_arch_update_domains(struct rdt_resource *r= , u32 closid) cfg->new_ctrl); if (err) return err; + cfg->have_new_ctrl =3D false; } } =20 --=20 2.25.1 From nobody Thu Dec 18 00:08:15 2025 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C5832C07E8F for ; Tue, 15 Aug 2023 15:29:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238094AbjHOP27 (ORCPT ); Tue, 15 Aug 2023 11:28:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44046 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237985AbjHOP2d (ORCPT ); Tue, 15 Aug 2023 11:28:33 -0400 Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 33B349C for ; Tue, 15 Aug 2023 08:28:32 -0700 (PDT) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 37FAGTxV003830; Tue, 15 Aug 2023 08:28:22 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=X52rhhnaJfUS4+lgw3taAm1Dv6OGkopQSygQ6G+3g7A=; b=U9FGU4MrrqYv7Ylal7lGTPOFV7E2EAA/VYrZoEDxE6rE6BPA51lZBq4KGDj0p9Fe2Lb8 fOd+d8ibJYpCQpgXkLJVTqjxHYoMZAMgu1aAPIjlX+zBesm0uW0zzFSlW5vzRsuAGisz Am9MeDUu4I6ZzkAff2d0xLmPN5EgXnKB1YHC+tvfjMIANH30Oe/LaPIw2ata2EZmVAHh 6mMxjaX0F2EZoPa25Isn6Ng0fSvjkwiS7qjETCqy448u7D4p7jsSbSLKrEG7SBVgMnh6 5Z/jHKV3wUKNFHI47TJifho5cMvogvqKNGhgXrDS3hbaJCWWwWXgn4tVmBLJwjI4hJds ZA== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3se9kjajwq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Tue, 15 Aug 2023 08:28:22 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Tue, 15 Aug 2023 08:28:20 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Tue, 15 Aug 2023 08:28:20 -0700 Received: from localhost.localdomain (unknown [10.28.36.167]) by maili.marvell.com (Postfix) with ESMTP id 1ACD83F7063; Tue, 15 Aug 2023 08:28:14 -0700 (PDT) From: Amit Singh Tomar To: , CC: , , , , , , Amit Singh Tomar Subject: [RFC 11/12] arm_mpam: Fix Downstream priority mask Date: Tue, 15 Aug 2023 20:57:11 +0530 Message-ID: <20230815152712.1760046-12-amitsinght@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230815152712.1760046-1-amitsinght@marvell.com> References: <20230815152712.1760046-1-amitsinght@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-GUID: Ca4QYOtQNqaA5F5wu-J3VSMVewF57DdI X-Proofpoint-ORIG-GUID: Ca4QYOtQNqaA5F5wu-J3VSMVewF57DdI X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.601,FMLib:17.11.176.26 definitions=2023-08-15_16,2023-08-15_02,2023-05-22_02 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" MPAMF_PRI_IDR_NS[DSPRI_WD] determines the number of implemented bits in the downstream priority field (MPAMCFG_PRI_NS). For instance, if the value of DSPRI_WD is 4, then the maximum value for dspri is 0xf, and mask should be GENMASK(3,0). But with current implementation, it turned out to be GENMASK(4,0) .i.e. 0x1f instead of 0xf. u16 dspri =3D GENMASK(rprops->dspri_wd, 0); Let's fix it, by subtracting 1 from DSPRI_WD value. Signed-off-by: Amit Singh Tomar --- drivers/platform/mpam/mpam_devices.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/platform/mpam/mpam_devices.c b/drivers/platform/mpam/m= pam_devices.c index c0c83c04c77c..59022e42920c 100644 --- a/drivers/platform/mpam/mpam_devices.c +++ b/drivers/platform/mpam/mpam_devices.c @@ -1099,7 +1099,7 @@ static void mpam_reprogram_ris_partid(struct mpam_msc= _ris *ris, u16 partid, struct mpam_msc *msc =3D ris->msc; u16 bwa_fract =3D MPAMCFG_MBW_MAX_MAX; struct mpam_props *rprops =3D &ris->props; - u16 dspri =3D GENMASK(rprops->dspri_wd, 0); + u16 dspri =3D GENMASK((rprops->dspri_wd-1), 0); u16 intpri =3D GENMASK(rprops->intpri_wd, 0); =20 lockdep_assert_held(&msc->lock); --=20 2.25.1 From nobody Thu Dec 18 00:08:15 2025 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3E27FC07E8E for ; Tue, 15 Aug 2023 15:29:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238113AbjHOP3C (ORCPT ); Tue, 15 Aug 2023 11:29:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44048 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237986AbjHOP2f (ORCPT ); Tue, 15 Aug 2023 11:28:35 -0400 Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EC9DA9C for ; Tue, 15 Aug 2023 08:28:34 -0700 (PDT) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 37FEFUMn008839; Tue, 15 Aug 2023 08:28:23 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=xtVORT7UOszKxIDuVayi97n1+3u19XMryXAicFeBbxc=; b=OU+qmQNq/LUsnrlCLeQEAgFrTqChaBlQc9synke3UQr3GiIXtGfgaiVrLmHEbYWBDjCp yMqcgOr77esXnSkWfe3ueZSxuGGi+6iGAz8bXTgRl/MjEnKaMy2G0HU3OWDrlYEYvG33 qkuHVtbuAeYscNtI3a91cZYuHqQ8naI+wBRR6AtZTHr0DhycuzL9eS78fW+u35CBTpdB CHWkgtL4e4IOIX43hbdHGMZnsyhcIWbTGZ6UflhG/Bera3iQpeSYL6qOaEpusLIHNsb/ HdypEORdP+V9fZRPqEg2QS/70y9p8RxvDSNhhF7CKMpCOV1kN9paWuvFHMLW5kXf6CW6 Gg== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3sgaydr8bk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Tue, 15 Aug 2023 08:28:23 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Tue, 15 Aug 2023 08:28:21 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Tue, 15 Aug 2023 08:28:21 -0700 Received: from localhost.localdomain (unknown [10.28.36.167]) by maili.marvell.com (Postfix) with ESMTP id A05013F7069; Tue, 15 Aug 2023 08:28:18 -0700 (PDT) From: Amit Singh Tomar To: , CC: , , , , , , Amit Singh Tomar Subject: [RFC 12/12] arm_mpam: Program Downstream priority value Date: Tue, 15 Aug 2023 20:57:12 +0530 Message-ID: <20230815152712.1760046-13-amitsinght@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230815152712.1760046-1-amitsinght@marvell.com> References: <20230815152712.1760046-1-amitsinght@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-GUID: YwdFVKD8zCPk4BzDY7B-Nps8cy0E9OfM X-Proofpoint-ORIG-GUID: YwdFVKD8zCPk4BzDY7B-Nps8cy0E9OfM X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.601,FMLib:17.11.176.26 definitions=2023-08-15_16,2023-08-15_02,2023-05-22_02 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Now that Downstream priorities values can be passed from resource control schemata file, let's program it into memory mapped Priority Partition Configuration Register. Signed-off-by: Amit Singh Tomar --- TODO: * Invert Priority value based on DSPRI_0_IS_LOW, suggested by James.=20 --- drivers/platform/mpam/mpam_devices.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/platform/mpam/mpam_devices.c b/drivers/platform/mpam/m= pam_devices.c index 59022e42920c..8af6424bb27b 100644 --- a/drivers/platform/mpam/mpam_devices.c +++ b/drivers/platform/mpam/mpam_devices.c @@ -1153,8 +1153,12 @@ static void mpam_reprogram_ris_partid(struct mpam_ms= c_ris *ris, u16 partid, =20 if (mpam_has_feature(mpam_feat_intpri_part, rprops)) pri_val |=3D FIELD_PREP(MPAMCFG_PRI_INTPRI, intpri); - if (mpam_has_feature(mpam_feat_dspri_part, rprops)) - pri_val |=3D FIELD_PREP(MPAMCFG_PRI_DSPRI, dspri); + if (mpam_has_feature(mpam_feat_dspri_part, rprops)) { + if (mpam_has_feature(mpam_feat_dspri_part, cfg)) { + pri_val |=3D FIELD_PREP(MPAMCFG_PRI_DSPRI, cfg->dspri & dspri); + } else + pri_val |=3D FIELD_PREP(MPAMCFG_PRI_DSPRI, dspri); + } =20 mpam_write_partsel_reg(msc, PRI, pri_val); } --=20 2.25.1