From patchwork Wed Jan 17 14:14:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Singh Tomar X-Patchwork-Id: 13521782 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 E3DFAC47DA2 for ; Wed, 17 Jan 2024 14:15:52 +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=zH2t23QQHqHg0Kr26zULwWPfYEE2iH6c/5TzTxGK8uo=; b=wjPLVGoiGkL7L3 ht6CfL7aF0jR6YU9PYBM5bRyOzWUlnTeKkva3ejQ1wys7gtkpabFvaAixXdlb8LbIb63iazfZc5Mt iB2aJ2ZlvqEClu2Q1c+iZDbV0L0TSABJMbSzKPtfyzb+PTWEvXkr8KkNYBnatMixEoWf+Nk+hY2IM 0u7cdfHPfhDobeWgKkefhOjf6KRzrqXf/DTt8ynkkNL3imwUFbf2sLsMlaNNPbAsLolO0TbR931QZ GE0ZrzkaHj7HJBFP0tD1AZ2X0qL0rN0AetjT2ThHj/7uEVp/Zs/FofjOiM7hxrqUCG58TZVtO5GdP LSlnYp7B63h8nC0FATeg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rQ6hM-00GyHc-2v; Wed, 17 Jan 2024 14:15:20 +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 1rQ6h3-00Gxyp-2z for linux-arm-kernel@lists.infradead.org; Wed, 17 Jan 2024 14:15:06 +0000 Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 40H7jo69029521; Wed, 17 Jan 2024 06:14:52 -0800 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=0WIJ5Saq1p5+ZFQkIuWbmHjZZkw8Y3vMm4fuMdgzxlI=; b=fzY LqD2eeckn2TGAN+FrnWZWqW7SnFe6KexzmVa/MZ0cGQZKtT7yF8UIY62FmLQ3kKM GS88UryB4nUx2ZkDBDzZvs8RRX0c6D8Mv83IeebmOFRZzILTr1yVMJ5ImBuvDDlI y/AwwE+mBSDELApc7Z4ZBuF60o1NykgqJiOmO8mXnAZRhlHbk7nuSM3/g0IHyqpx yU5qpaFDba3aL8yNqTEqHBmkXTggThslQ4G8tRX66UlLruN/vt/yQOXYTLPzUAy7 WGtdUELGvDG0HwKXthNBq30CtUQnDhQkeN+mfxtRbsKwv+WflO1A2E8IR1/wmzNL I8n1HebnHTwPSFPxDNQ== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3vpask952w-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 17 Jan 2024 06:14:52 -0800 (PST) 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; Wed, 17 Jan 2024 06:14:50 -0800 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; Wed, 17 Jan 2024 06:14:50 -0800 Received: from localhost.localdomain (unknown [10.28.36.167]) by maili.marvell.com (Postfix) with ESMTP id 25DA35B6931; Wed, 17 Jan 2024 06:14:46 -0800 (PST) From: Amit Singh Tomar To: , CC: , , , , , , , , Amit Singh Tomar Subject: [PATCH v1 10/14] arm_mpam: resctrl: Facilitate writing downstream priority value Date: Wed, 17 Jan 2024 19:44:01 +0530 Message-ID: <20240117141405.3063506-11-amitsinght@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240117141405.3063506-1-amitsinght@marvell.com> References: <20240117141405.3063506-1-amitsinght@marvell.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: qrSVuiQUoMB2R6Cr5vwbsSEvLyZpLED2 X-Proofpoint-GUID: qrSVuiQUoMB2R6Cr5vwbsSEvLyZpLED2 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.997,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-01-17_08,2024-01-17_01,2023-05-22_02 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240117_061502_057363_FAFCE35A X-CRM114-Status: GOOD ( 14.88 ) 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 --- Changes since RFC: * Schemata write is based on Control type. --- drivers/platform/mpam/mpam_devices.c | 4 ---- drivers/platform/mpam/mpam_resctrl.c | 26 ++++++++++++++++---------- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/drivers/platform/mpam/mpam_devices.c b/drivers/platform/mpam/mpam_devices.c index 589ff1ef2b6b..3ef9e5d70afc 100644 --- a/drivers/platform/mpam/mpam_devices.c +++ b/drivers/platform/mpam/mpam_devices.c @@ -2329,10 +2329,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 7a797f9bcaed..42602bffba3f 100644 --- a/drivers/platform/mpam/mpam_resctrl.c +++ b/drivers/platform/mpam/mpam_resctrl.c @@ -925,7 +925,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; @@ -940,24 +940,30 @@ 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; switch (r->rid) { case RDT_RESOURCE_L2: case RDT_RESOURCE_L3: + if (type == SCHEMA_DSPRI) { + cfg->dspri = cfg_val; + mpam_set_feature(mpam_feat_dspri_part, cfg); + } else { /* TODO: Scaling is not yet supported */ - cfg.cpbm = cfg_val; - mpam_set_feature(mpam_feat_cpor_part, &cfg); + 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; @@ -971,15 +977,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); } }