From patchwork Tue Aug 15 15:27:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Singh Tomar X-Patchwork-Id: 13353917 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 69D13C001DB for ; Tue, 15 Aug 2023 15:28: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: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id: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=NEHX/zqaaQZ0Vxf4s+If4p9fsiOHH1HG1gJkCsIZNRc=; b=hLI8t07U0X+sUh OtFftT3TfewytBl4vrwOXggvsrxY4I4uD+Xc1fTaIHJOM1GkH4IzDFCP4aK7MgEQS4WGKECNHHFoC 2LYAq6BU/p8Dl7RtzBVXFg1gFKRnOgRUGIjEDDhN0dVE42jC+7AbD7Oe1Q/q4bkpMtvHppk87nvIs 8n+HPRXWvRb3jfnZLQ8NJxUFZMCCpt00BHwiCsLlfmeyhzjEId2uY96OsnXlVj8yNf6O/IHoWGnKL MQnNJAS9/ZTeDqeSpIfWPvJTG5YUJTMeUzwgLnmnJ77xwg0Vh+76YVKgzL2rsCdbALZ0PX/Ev3zdj O6R0Y7NgF+jYJ/GdjkOg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qVvxs-001rDJ-1v; Tue, 15 Aug 2023 15:28:12 +0000 Received: from mx0a-0016f401.pphosted.com ([67.231.148.174] helo=mx0b-0016f401.pphosted.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qVvxm-001r9L-0h for linux-arm-kernel@lists.infradead.org; Tue, 15 Aug 2023 15:28:07 +0000 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 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230815_082806_264707_CD3F2A32 X-CRM114-Status: GOOD ( 19.96 ) 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 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_PART] 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/mpam_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 mpam_class *class) class->props = ris->props; } +/* 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 |= ris->props.features; + class->props.cpbm_wd |= ris->props.cpbm_wd; + class->props.dspri_wd |= ris->props.dspri_wd; + class->props.num_csu_mon |= 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) 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 != ris->props.features) + mpam_enable_club_class_features(class, ris); + else + __resource_props_mismatch(ris, class); class->nrdy_usec = max(class->nrdy_usec, ris->msc->nrdy_usec); From patchwork Tue Aug 15 15:27:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Singh Tomar X-Patchwork-Id: 13353918 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 2F023C04E69 for ; Tue, 15 Aug 2023 15:28:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id: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=IHC8jTRkLTGOEZpbeDtpL5LN3OOa7sjnd8f4xYOO+ZM=; b=Vr20ExsNecEfKO ESG6zoUYJi7mDc3ZY9QiCN4hTNyYviq2nEUqAl8/Xb81EQ16rtXbynWkPr5r+jcxx9kpFzhfmlo1F 96Hzj6+sBwgIVIkrhZtWBp1Y8ozEyK+TcG2U38M3oPWAYkODgI8U139h4IgHhIuwIsX/AtvR9jx+f hcBkda3dPi2JVDoxr02srMNqLzdL8BQ6LXanxxkbJKpR/T7ufHilH/XYu4SRHmXMxgkK4wHlj2Fw6 doX/W8NTG3dsNr/Iz+0cHB8en4yCaYJoXYTkjRK/bpWZrn6lT8eOePElLqrlmp5R9QTQqJ+vMYE/n R3h3LjIKM9/Fs7k1zC+A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qVvxt-001rDo-0a; Tue, 15 Aug 2023 15:28:13 +0000 Received: from mx0a-0016f401.pphosted.com ([67.231.148.174] helo=mx0b-0016f401.pphosted.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qVvxm-001rAR-0h for linux-arm-kernel@lists.infradead.org; Tue, 15 Aug 2023 15:28:07 +0000 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 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230815_082806_266827_749A9ABF X-CRM114-Status: GOOD ( 18.77 ) 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 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/mpam_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 *class) return (class->props.cpbm_wd <= RESCTRL_MAX_CBM); } +static bool cache_has_usable_priority_part(struct mpam_class *class) +{ + struct mpam_props *cprops = &class->props; + + if (!mpam_has_feature(mpam_feat_dspri_part, cprops)) + return false; + + return (class->props.dspri_wd <= 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_resctrl_res *res) res->resctrl_res.rid == RDT_RESOURCE_L3) { bool has_csu = cache_has_usable_csu(class); bool has_mbwu = class_has_usable_mbwu(class); + bool has_ppart = cache_has_usable_priority_part(class); /* TODO: Scaling is not yet supported */ r->cache.cbm_len = class->props.cpbm_wd; @@ -718,6 +729,9 @@ static int mpam_resctrl_resource_init(struct mpam_resctrl_res *res) exposed_alloc_capable = true; } + if (has_ppart) + r->priority_cap = 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 +#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; From patchwork Tue Aug 15 15:27:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Singh Tomar X-Patchwork-Id: 13353919 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 94687C04FDF for ; Tue, 15 Aug 2023 15:28:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id: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=NmT0hMgUgj/9Paqgv9ByAvKRxifEUnAVSceupIETW3E=; b=aePXM3ovzfHDzi OlPN+X572MmztkB5ndNu5CyVaQje60CPZTpKMnu+IFjvhvJMSFwy+MbSJ+W87TsFMbTXpjP+OrMVc RgINT+B5RcxEOpgIH/GqRhqsS0DZiwO642GckcbMYITkbFNpg7VvGNsb6bEW00E/jbAFpy3ADHpds H2JFfadRMxhPGtCtkgQcAJPFN6yLCMduNIvBXdzPmn4YlBRyI+kRK3ukLF8nWUovGSapzG9nj+jcb 7H+xpu/qABGC8GBl1yhwA+jwNNLOOYBHj/pmZRMAsrH2hFN5StlqhVhDZQeZQVNP+vkU8dhlgKyK1 GkaiGgzNjc0UoOC6b6vg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qVvxs-001rD2-0M; Tue, 15 Aug 2023 15:28:12 +0000 Received: from mx0b-0016f401.pphosted.com ([67.231.156.173]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qVvxh-001r9C-20 for linux-arm-kernel@lists.infradead.org; Tue, 15 Aug 2023 15:28:05 +0000 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 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230815_082801_788420_AF4A58A3 X-CRM114-Status: GOOD ( 15.18 ) 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 At the moment, "schemata" file contains information about cache portion bitmap (CPBM), and memory bandwidth allocation (MBA) in the following format. MB:0=0100 L3:0=ffff Lets' update the "schemata" file to accommodate information about priority partition control that indicates downstream priority value. For instance: L3:0=ffff,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/mpam_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_resctrl_res *res) r->cache.min_cbm_bits = 1; /* TODO: kill these properties off as they are derivatives */ - r->format_str = "%d=%0*x"; + if (mpam_has_feature(mpam_feat_dspri_part, &class->props)) + r->format_str = "%d=%0*x,%0*x"; + else + r->format_str = "%d=%0*x"; + r->fflags = RFTYPE_RES_CACHE; r->default_ctrl = BIT_MASK(class->props.cpbm_wd) - 1; r->data_width = (class->props.cpbm_wd + 3) / 4; From patchwork Tue Aug 15 15:27:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Singh Tomar X-Patchwork-Id: 13353914 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 B071BC04A6A for ; Tue, 15 Aug 2023 15:28:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id: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=3EDqXLZDoGSaMjtfgGd1HSY7AGIIJpZC3cDtlXOwz3E=; b=MENttnYSZ5EVAH AB8DDoCSzLQMp4wuMsIhIWDHOXOrM7LKeLFQAspPfDTODu1N/j78Xd2A2HqLQqMXcprJOoehrwAlz QVx0Gh27JqV5iNcrlLfnKoXdJ1ufGqyWX6E80H2G4aBQgsLA08bUql/wB+wBAq8MG6kjYZ8SY1Guq peLEFA0sDaqUabXFrdGJPEP6UOxK8RbiMxye2NB8RTIK7StASw6KdTI+MmBfQEazFLPCu1f16zGgS 0SiCtiNJripwqIAm40CfiE5BWviyTz//h46/EOL7NOUXPQKkFv40WjvdVzoUa5V039UsINYrdds8z g5WvrRl/zjy0GgNWhxWQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qVvxr-001rCc-21; Tue, 15 Aug 2023 15:28:11 +0000 Received: from mx0b-0016f401.pphosted.com ([67.231.156.173]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qVvxi-001r9r-0E for linux-arm-kernel@lists.infradead.org; Tue, 15 Aug 2023 15:28:05 +0000 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 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230815_082802_224652_9CB913A6 X-CRM114-Status: GOOD ( 14.61 ) 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 Resource control group's "schemata" file represents the cache portion bit map (XXXX), parsed from buffer with "L3:0=XXXX" format. Now, with the introduction of priority control, "schemata" file format has changed to "L3:0=XXXX,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 rdt_resource *r) unsigned int cbm_len = r->cache.cbm_len; int ret; + if (r->priority_cap) + buf = strsep(&buf, ","); + ret = kstrtoul(buf, 16, &val); if (ret) { rdt_last_cmd_printf("Non-hex character in the mask %s\n", buf); From patchwork Tue Aug 15 15:27:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Singh Tomar X-Patchwork-Id: 13353916 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 3732EC41513 for ; Tue, 15 Aug 2023 15:28:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id: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=4EvuW/KggDuGzynGhNuLmaHA1epuSPNZ/VVA86E3zUY=; b=JiLpqKlsmc9C0G I0INHW62QdyyeCBmG6K3k/GbuPAvkhxu1DyxSogpJMCMKp7UpozWFlc0X3mZgjZyFCiiqoZRvR/fc lr5+UfF5a5VdWihaTer6z8FdDoTsWUKvMtvhryjf/ojhcbH3WCIK2OJILkFI3tKTiHbZLdyxvL/7c WHGRNZaEpSrHc0SfvVE4UR2bhxJCLVkoce3uH/nsA71VdN4KrwMWi7ABV9rIOzt/+xyGq4/zuICYm cP9wcoRYcWaiOtVJIQuLuRvuNNYZNcMn9c22FKOf3b107dtVBH1R7FG85egcHst9cfJciLZN537gv LWuBMqlhLrBI8U9w1+7Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qVvxt-001rE5-2C; Tue, 15 Aug 2023 15:28:13 +0000 Received: from mx0a-0016f401.pphosted.com ([67.231.148.174] helo=mx0b-0016f401.pphosted.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qVvxo-001rC4-1M for linux-arm-kernel@lists.infradead.org; Tue, 15 Aug 2023 15:28:10 +0000 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 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230815_082808_462916_692BB4DC X-CRM114-Status: GOOD ( 20.48 ) 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 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/mpam_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_resctrl_res *res) exposed_alloc_capable = true; } - if (has_ppart) + if (has_ppart) { r->priority_cap = true; + r->dspri_default_ctrl = BIT_MASK(class->props.dspri_wd) - 1; + } /* * 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; } +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 = &d->staged_config[CDP_NONE]; + cfg->new_ctrl = r->dspri_default_ctrl; + cfg->have_new_ctrl = true; + r->dspri_store = 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 *rdtgrp) return ret; } + if (r->priority_cap) + r->dspri_store = false; + ret = resctrl_arch_update_domains(r, rdtgrp->closid); if (ret < 0) { rdt_last_cmd_puts("Failed to initialize allocations\n"); return ret; } + if (r->priority_cap) { + ret = rdtgroup_init_dspri(r, rdtgrp->closid); + if (ret < 0) + return ret; + + ret = resctrl_arch_update_domains(r, rdtgrp->closid); + if (ret < 0) { + rdt_last_cmd_puts("Failed to initialize allocations\n"); + return ret; + } + r->dspri_store = false; + } } rdtgrp->mode = 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; From patchwork Tue Aug 15 15:27:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Singh Tomar X-Patchwork-Id: 13353923 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 EE216C001B0 for ; Tue, 15 Aug 2023 15:29:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id: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=I1Iyo30Z9a1j60kG/OabwDx8NCL/jVZfyNRT57+G43k=; b=ezpV6ITb21j6MU gSITDed7SRFxdOkzkHryiwHD6B/agskli8aR0+2vAeERN3IkgQWNawZa8CbRkoVw4nCbBH+RAzYRi 1RzwOEmzstS/x871663QOA+n0WCqjJlDyncj25+LcwZGY3p8aSKRWhBifeJK8IXqRO7qheU/17A/w 8rsG8IrkDtSs6O6quYpKnaTevMHUMJMfOVf9cviMxgrczfE76+GZuEmSjmBnMafqVLj2cT2Aa5TVV cGqjpBaTz0urNqqEow66cbxxsOtGTZT9zuf5uS9ICmXQHOZddCCiNSmE8aDAdOEcZtFfWCvim40ag RXxXWBkfak7+0K9tm7WQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qVvyJ-001rRW-13; Tue, 15 Aug 2023 15:28:39 +0000 Received: from mx0a-0016f401.pphosted.com ([67.231.148.174] helo=mx0b-0016f401.pphosted.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qVvxu-001rEw-2J for linux-arm-kernel@lists.infradead.org; Tue, 15 Aug 2023 15:28:16 +0000 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 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230815_082814_764511_D2AA12BF X-CRM114-Status: GOOD ( 19.54 ) 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 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/mpam_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_resctrl_res *res) if (has_ppart) { r->priority_cap = true; + if (class->props.dspri_wd > 0x10) + class->props.dspri_wd = 0x10; + r->dspri_default_ctrl = BIT_MASK(class->props.dspri_wd) - 1; + r->dspri_data_width = (class->props.dspri_wd + 3) / 4; } /* 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 resctrl_schema *schema, int clo struct rdt_resource *r = schema->res; struct rdt_domain *dom; bool sep = false; - u32 ctrl_val; + u32 ctrl_val, dspri_ctrl_val; /* 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 resctrl_schema *schema, int clo ctrl_val = resctrl_arch_get_config(r, dom, closid, schema->conf_type); - seq_printf(s, r->format_str, dom->id, max_data_width, - ctrl_val); + if (r->priority_cap) { + r->dspri_show = true; + dspri_ctrl_val = 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 = true; + r->dspri_show = 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; From patchwork Tue Aug 15 15:27:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Singh Tomar X-Patchwork-Id: 13353920 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 69D63C001B0 for ; Tue, 15 Aug 2023 15:29:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id: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=gIiVPY0iO9oYo13P1m6YX6EQnSHB78OM8JRNLqKPgGw=; b=VP/t1eKRqrojXG +wrSM8yX99wOG43XabqPFRIWEToQtT4gOMkQYww48l8ryTn4alagivyrP16FcDp6NzJxb4tTNL8pH efZXwVIOusfExFI4ydxGZkGlDMmIpqdTVrLt2sCWv5dDgV/ZdlW3UKwpGAJNMgVvKpMbcpdstjtWU 6WDkYyfdSBEZgW9G40hX2V9KidzXwiSkW7XSyVIDvcLNjpq/w7SxHbl3ZpJm0GsyNfeB+hyIy64r6 +8E4XXt7w7qhhUbM5keVqBF/GUdbDyurmTZlvCP4XzyIAA4968qmRBDbHOsd/sV2BJkoa0D5b7PI5 OFjU20QjRyYL+Zg9QVAw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qVvyI-001rQy-2L; Tue, 15 Aug 2023 15:28:38 +0000 Received: from mx0b-0016f401.pphosted.com ([67.231.156.173]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qVvxu-001rE7-0h for linux-arm-kernel@lists.infradead.org; Tue, 15 Aug 2023 15:28:15 +0000 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 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230815_082814_366191_2DC7E0D1 X-CRM114-Status: GOOD ( 17.20 ) 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 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; }; struct mpam_component diff --git a/drivers/platform/mpam/mpam_resctrl.c b/drivers/platform/mpam/mpam_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, struct rdt_domain *d, lockdep_assert_cpus_held(); if (!mpam_is_enabled()) - return r->default_ctrl; + return r->dspri_show ? r->dspri_default_ctrl : r->default_ctrl; res = container_of(r, struct mpam_resctrl_res, resctrl_res); dom = container_of(d, struct mpam_resctrl_dom, resctrl_dom); @@ -876,7 +876,10 @@ u32 resctrl_arch_get_config(struct rdt_resource *r, struct rdt_domain *d, switch (r->rid) { case RDT_RESOURCE_L2: case RDT_RESOURCE_L3: - configured_by = mpam_feat_cpor_part; + if (r->dspri_show) + configured_by = mpam_feat_dspri_part; + else + configured_by = 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, struct rdt_domain *d, if (!r->alloc_capable || partid >= 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; 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); From patchwork Tue Aug 15 15:27:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Singh Tomar X-Patchwork-Id: 13353922 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 67DF4C001DB for ; Tue, 15 Aug 2023 15:29:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id: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=lPDDr5yoyln9V1xWlkO15wjS/YXHW7dbVokYuBXj+5o=; b=evtxhLPq0zWuIn lrTN0biiyQWZLrHYI9J3DyCCXZ/aWJS/LeFdCcmM5f9Rmr7Gbmvb1QcTttBxQl7o0UBdF9U/kuAe+ P/dnWlmMPY23NaaRxKLUCtvP/3/c/BQPBaKURAEYJntizTfGM6AMC69NeiN6ZNcCObST3c3oqh9tx l1aRHlh+Cqs/miF0CuOdJ5odVHDOqc3AjRj/7PJsC+PkxqCBsRCb2IeBUyMG4NJnpn/j01lZHqWwv thfU/q+Vg3GxsIVF7mtyHXM6HdnjIIvuqP1AgdUu7AcZMELrCzQMjYIlp1ixSplg2AissXXpW/3IE weiBoAjJzlcgxN2kJSsQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qVvyK-001rSC-0U; Tue, 15 Aug 2023 15:28:40 +0000 Received: from mx0a-0016f401.pphosted.com ([67.231.148.174] helo=mx0b-0016f401.pphosted.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qVvxz-001rHz-2i for linux-arm-kernel@lists.infradead.org; Tue, 15 Aug 2023 15:28:21 +0000 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 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230815_082819_895594_10432EED X-CRM114-Status: GOOD ( 15.74 ) 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 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_file *of, if (is_mba_sc(r)) continue; - ret = resctrl_arch_update_domains(r, rdtgrp->closid); - if (ret) - goto out; + if (!strcmp(resname, s->name)) { + ret = resctrl_arch_update_domains(r, rdtgrp->closid); + if (ret) + goto out; + } } if (rdtgrp->mode == RDT_MODE_PSEUDO_LOCKSETUP) { From patchwork Tue Aug 15 15:27:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Singh Tomar X-Patchwork-Id: 13353926 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 74ED3C3DA40 for ; Tue, 15 Aug 2023 15:29:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id: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=fDjSKhjCEpgT2xXReS9yiKm6Txq+r9FQKc+qe+5Tzjw=; b=CFIluqetkZb7mO JOkOXrtCkB1XlHah/BrGzctZbU5xLmaB560u5q6qnhDfUa0lSKo96NLDQn3hmQ+8LVF9u1sYpvVKh 6qWI55RVIHrS5fS7oFY+8mub6Itqv03/mHdU8J6tqfBEmLZZFzoIgwNISziDJlowQId8Kz6Z27nZ3 zmjg6ek/L2TDfxwui2X6m9Vm2hfLAfK8lmiw+2XpTFXV9aB46IsNg8+HupBR1uOlxFCSrTteFoSiz oYBTr4Ki9FDxsC4AQoQfLv45tYgIh/zYQT6K/U2TVcDkXROV0nEJpF6lmS/1WPmCXHSRfVswReJop /PP+NvzNCO64ytdPwNGA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qVvyL-001rTf-24; Tue, 15 Aug 2023 15:28:41 +0000 Received: from mx0b-0016f401.pphosted.com ([67.231.156.173]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qVvy1-001rIp-0H for linux-arm-kernel@lists.infradead.org; Tue, 15 Aug 2023 15:28:23 +0000 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 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230815_082821_241655_0A743B70 X-CRM114-Status: GOOD ( 19.41 ) 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 Currently, Users can pass the configurations for CPBM, and MBA through schemata file. For instance, CPBM can be passed using: echo L3:0=ffff > 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=ffff,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 *data, struct resctrl_schema *s, struct rdt_domain *d); +static bool dspri_validate(char *buf, unsigned long *data, struct rdt_resource *r) +{ + + char *dup_buf, *dspri_token; + unsigned long dspri_val; + bool success = true; + int ret; + + dup_buf = kstrdup(buf, GFP_KERNEL); + if (!dup_buf) { + rdt_last_cmd_printf("Failed to allocate buffer %s\n", + __func__); + success = false; + goto out; + } + + strsep(&dup_buf, ","); + if (!dup_buf) { + rdt_last_cmd_printf("Unable to find priority value token %s\n", + __func__); + success = false; + goto out; + } + + dspri_token = strsep(&dup_buf, ","); + ret = kstrtoul(dspri_token, 16, &dspri_val); + if (ret) { + rdt_last_cmd_printf("Non-hex character in the mask %s\n", buf); + success = 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 = false; + goto out; + } + + *data = 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 = s->res; + unsigned long pri_val; + + cfg = &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 = pri_val; + cfg->have_new_ctrl = 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 = 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_file *of, if (is_mba_sc(r)) continue; + if (r->priority_cap) + r->dspri_store = false; + if (!strcmp(resname, s->name)) { ret = resctrl_arch_update_domains(r, rdtgrp->closid); if (ret) goto out; + + if (r->priority_cap) { + r->dspri_store = true; + list_for_each_entry(dom, &r->domains, list) { + ctrlval_parser_t *parse_ctrlval = &parse_dspri; + char *dom_data = NULL; + + dom_data = strsep(&dup_buf, ";"); + dom_data = strim(dom_data); + data.buf = dom_data; + data.rdtgrp = rdtgrp; + if (parse_ctrlval(&data, s, dom)) + return -EINVAL; + } + + ret = resctrl_arch_update_domains(r, rdtgrp->closid); + if (ret) + goto out; + } } } From patchwork Tue Aug 15 15:27:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Singh Tomar X-Patchwork-Id: 13353921 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 8F394C001B0 for ; Tue, 15 Aug 2023 15:29:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id: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=X73PmkvUC5FwmuynpomRwKRC+OgmG9KMovu9z2h4e9U=; b=ewRz8+SPwEF9hg 6IpVMeaHL/mj9DveKrDSN3A4NBLAGp7Dcubo1IZVTq8kfEZ+VU/uqAhNtcV/rIzNphEsXOf46S/NY CO/cmtxkDnDhiiXr1DhWPYChwUIJ+xnpP2M8iWpdPEAWTFdEVTmxs3r5WKYoeN7WxNnA7mUen726q vKV+BATUtJU9wvx7ZZLAUvPGP1JCGoZQqYuIrbkoCg0ZAxcByCbX3J//nk7DT3ZtS47GYQFmmCG/y ttudxM/+01L8JhXhZuePPK0qZpwDh1ATQBYeMZKtgL4lfLOI2egYONEgIcixPwHWT0C+KG9MXioJF vtZhSHLXobXNEwcKAz2Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qVvyN-001rV1-12; Tue, 15 Aug 2023 15:28:43 +0000 Received: from mx0b-0016f401.pphosted.com ([67.231.156.173]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qVvy3-001rKD-34 for linux-arm-kernel@lists.infradead.org; Tue, 15 Aug 2023 15:28:26 +0000 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 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230815_082824_133910_DDDF21CC X-CRM114-Status: GOOD ( 19.25 ) 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 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/mpam_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, u16 partid, lockdep_assert_cpus_held(); - if (!memcmp(&comp->cfg[partid], cfg, sizeof(*cfg))) - return 0; - - comp->cfg[partid] = *cfg; arg.comp = comp; arg.partid = partid; diff --git a/drivers/platform/mpam/mpam_resctrl.c b/drivers/platform/mpam/mpam_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, struct 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, struct rdt_domain *d, cprops = &res->class->props; partid = resctrl_get_config_index(closid, t); + cfg = &dom->comp->cfg[partid]; if (!r->alloc_capable || partid >= resctrl_arch_get_num_closid(r)) return -EINVAL; @@ -941,17 +942,22 @@ int resctrl_arch_update_one(struct rdt_resource *r, struct rdt_domain *d, case RDT_RESOURCE_L2: case RDT_RESOURCE_L3: /* TODO: Scaling is not yet supported */ - cfg.cpbm = cfg_val; - mpam_set_feature(mpam_feat_cpor_part, &cfg); + if (r->dspri_store) { + cfg->dspri = cfg_val; + mpam_set_feature(mpam_feat_dspri_part, cfg); + } else { + cfg->cpbm = 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 = percent_to_mbw_pbm(cfg_val, cprops); - mpam_set_feature(mpam_feat_mbw_part, &cfg); + cfg->mbw_pbm = 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 = percent_to_mbw_max(cfg_val, cprops); - mpam_set_feature(mpam_feat_mbw_max, &cfg); + cfg->mbw_max = 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, struct rdt_domain *d, */ if (mpam_resctrl_hide_cdp(r->rid)) { partid = resctrl_get_config_index(closid, CDP_CODE); - err = mpam_apply_config(dom->comp, partid, &cfg); + err = mpam_apply_config(dom->comp, partid, cfg); if (err) return err; partid = resctrl_get_config_index(closid, CDP_DATA); - return mpam_apply_config(dom->comp, partid, &cfg); + return mpam_apply_config(dom->comp, partid, cfg); } else { - return mpam_apply_config(dom->comp, partid, &cfg); + return mpam_apply_config(dom->comp, partid, cfg); } } @@ -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 = false; } } From patchwork Tue Aug 15 15:27:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Singh Tomar X-Patchwork-Id: 13353925 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 D5E8AC04A6A for ; Tue, 15 Aug 2023 15:29:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id: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=sGqpcGfO1OVh3XZN7iamLL8zyCVCs84eWqx9tlPu+Tw=; b=C8dhnCywbDdN7w SeD+WCGJ5AEWUPBiQXqxMAD3e2FWJUooRbgCXuzfUaHlSuWNFrnqq8kMjeN+DYw10ywxeUNKwRJsw EWnQAvINtgsDDlB7X7dS2P3l8aKjJcJ5808ahH8zi8Z2H8lEqBsx8S9jkn6uDZlfBBMW0WoVMEqIr XqIa4zNosmaCXR86kU+Trrs6fh27tDvSylLawmbbLmm03yavOm869LyZMs8PjqdfTVJHldOjbirr+ yeYs2O4n+nNMs7jvdvQE4fFWKX8pbth/V9OF04TR30c8YbxGKyq3ZckgGpCvgL47dtqfxd+GKHstA Vbu6uKGcNXEOFb2VYqWA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qVvyO-001rWM-24; Tue, 15 Aug 2023 15:28:44 +0000 Received: from mx0b-0016f401.pphosted.com ([67.231.156.173]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qVvy9-001rMy-30 for linux-arm-kernel@lists.infradead.org; Tue, 15 Aug 2023 15:28:31 +0000 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 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230815_082830_083234_74624507 X-CRM114-Status: GOOD ( 16.35 ) 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 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 = 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/mpam_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 = ris->msc; u16 bwa_fract = MPAMCFG_MBW_MAX_MAX; struct mpam_props *rprops = &ris->props; - u16 dspri = GENMASK(rprops->dspri_wd, 0); + u16 dspri = GENMASK((rprops->dspri_wd-1), 0); u16 intpri = GENMASK(rprops->intpri_wd, 0); lockdep_assert_held(&msc->lock); From patchwork Tue Aug 15 15:27:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Singh Tomar X-Patchwork-Id: 13353924 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 D4BB1C001B0 for ; Tue, 15 Aug 2023 15:29:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id: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=RX//MYeK/bdlUf8GoQPtyBnEL686UU7QoHJ4ez+GIW4=; b=eMY+lwswrgOw62 zGbosQYMUHeAAD739isjwwtdeTl/oCrrAn34b6r5A4BD7pBZ5Q5jmPBSfks9e9q4OzRh+Cy2DyIBO XLajDv2F3oC4uCKV9iWLg/Um8/pt1BakhpJE1VURHWlyEzfjRFe5ngnVdjcpXkhnm/YzGd3eqcqMi DmSdHdY7xmDOyTGE5ORLfI9DZASbucpQuUPEckk4zkiT4uMDRYHbMROpRvqf6SiPVcP37Sozcz45n 2GtZ2WwW5oGaToYZhYS771Vbjt3ll5DEDwANzqsQFTTK/RaMESm/Ln+P1TicNa+WnpojJ93mqFDg0 JNGfvB10n3EQqD6G5LLg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qVvyP-001rWz-0h; Tue, 15 Aug 2023 15:28:45 +0000 Received: from mx0a-0016f401.pphosted.com ([67.231.148.174] helo=mx0b-0016f401.pphosted.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qVvyD-001rOw-1L for linux-arm-kernel@lists.infradead.org; Tue, 15 Aug 2023 15:28:34 +0000 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 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230815_082833_463096_53E8801C X-CRM114-Status: GOOD ( 14.23 ) 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 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. --- 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/mpam_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_msc_ris *ris, u16 partid, if (mpam_has_feature(mpam_feat_intpri_part, rprops)) pri_val |= FIELD_PREP(MPAMCFG_PRI_INTPRI, intpri); - if (mpam_has_feature(mpam_feat_dspri_part, rprops)) - pri_val |= 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 |= FIELD_PREP(MPAMCFG_PRI_DSPRI, cfg->dspri & dspri); + } else + pri_val |= FIELD_PREP(MPAMCFG_PRI_DSPRI, dspri); + } mpam_write_partsel_reg(msc, PRI, pri_val); }