From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E8265CAC582 for ; Fri, 12 Sep 2025 13:07:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Subject:CC:To: From:Date:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=j4l3OPVfOgtQXATZcFVrcd+Zs9PFEnRcQWv7T7nGtDg=; b=NJEGo3Za21S19tZ0hwlhq9Or1B xxRXbTvRHY1p97PiWTH/gR0PFScJYZvQXXwx7YI18Zh1TvtXqaEBXw3AePVVIASS9Qg4f75g88R7p wzpXVdGx+w1h6P2xJ7gfqKTLrFq4bc7LHPH8KSnbOdQgPIjQHwfKQlTPT+fbddGaI+oUkgcFXGN6r nZX9z4/ETqoSKlSpAZTaHZBlerOViBp1DBX6ifSEpM/tqrTPjHlrJNqTBiMMKqybwGVmdKOd/ymtG M4AObMfv/bnTaifdWSlL5yGvPdkpWmjENLWWQBcDOAybPUMFuyWzatCcTUKM7iA/m7OrlQEDSv0R1 Tp4oShVA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1ux3Uf-00000009R8F-1bGb; Fri, 12 Sep 2025 13:07:13 +0000 Received: from frasgout.his.huawei.com ([185.176.79.56]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1ux3Ub-00000009R7P-3w6q for linux-arm-kernel@lists.infradead.org; Fri, 12 Sep 2025 13:07:11 +0000 Received: from mail.maildlp.com (unknown [172.18.186.31]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4cNZRZ5Wmwz6GDFf; Fri, 12 Sep 2025 21:05:46 +0800 (CST) Received: from frapeml500008.china.huawei.com (unknown [7.182.85.71]) by mail.maildlp.com (Postfix) with ESMTPS id E737E1401F4; Fri, 12 Sep 2025 21:07:04 +0800 (CST) Received: from localhost (10.203.177.15) by frapeml500008.china.huawei.com (7.182.85.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Fri, 12 Sep 2025 15:07:03 +0200 Date: Fri, 12 Sep 2025 14:07:02 +0100 From: Jonathan Cameron To: James Morse CC: , , , D Scott Phillips OS , , , , , , Jamie Iles , Xin Hao , , , , David Hildenbrand , Dave Martin , Koba Ko , Shanker Donthineni , , , Rob Herring , Rohit Mathew , "Rafael Wysocki" , Len Brown , Lorenzo Pieralisi , Hanjun Guo , Sudeep Holla , Catalin Marinas , "Will Deacon" , Greg Kroah-Hartman , Danilo Krummrich , Zeng Heng Subject: Re: [PATCH v2 21/29] arm_mpam: Probe and reset the rest of the features Message-ID: <20250912140702.00000a5a@huawei.com> In-Reply-To: <20250910204309.20751-22-james.morse@arm.com> References: <20250910204309.20751-1-james.morse@arm.com> <20250910204309.20751-22-james.morse@arm.com> X-Mailer: Claws Mail 4.3.0 (GTK 3.24.42; x86_64-w64-mingw32) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.203.177.15] X-ClientProxiedBy: lhrpeml500012.china.huawei.com (7.191.174.4) To frapeml500008.china.huawei.com (7.182.85.71) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250912_060710_263617_3A5D8C04 X-CRM114-Status: GOOD ( 21.97 ) 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 On Wed, 10 Sep 2025 20:43:01 +0000 James Morse wrote: > MPAM supports more features than are going to be exposed to resctrl. > For partid other than 0, the reset values of these controls isn't > known. > > Discover the rest of the features so they can be reset to avoid any > side effects when resctrl is in use. > > PARTID narrowing allows MSC/RIS to support less configuration space than > is usable. If this feature is found on a class of device we are likely > to use, then reduce the partid_max to make it usable. This allows us > to map a PARTID to itself. > > CC: Rohit Mathew > CC: Zeng Heng > CC: Dave Martin > Signed-off-by: James Morse A few trivial things inline. Reviewed-by: Jonathan Cameron > int mpam_register_requestor(u16 partid_max, u8 pmg_max) > { > int err = 0; > @@ -667,10 +676,35 @@ static void mpam_ris_hw_probe(struct mpam_msc_ris *ris) > struct mpam_msc *msc = ris->vmsc->msc; > struct device *dev = &msc->pdev->dev; > struct mpam_props *props = &ris->props; > + struct mpam_class *class = ris->vmsc->comp->class; > > lockdep_assert_held(&msc->probe_lock); > lockdep_assert_held(&msc->part_sel_lock); > > + /* Cache Capacity Partitioning */ > + if (FIELD_GET(MPAMF_IDR_HAS_CCAP_PART, ris->idr)) { > + u32 ccap_features = mpam_read_partsel_reg(msc, CCAP_IDR); > + > + props->cmax_wd = FIELD_GET(MPAMF_CCAP_IDR_CMAX_WD, ccap_features); > + if (props->cmax_wd && > + FIELD_GET(MPAMF_CCAP_IDR_HAS_CMAX_SOFTLIM, ccap_features)) > + mpam_set_feature(mpam_feat_cmax_softlim, props); > + > + if (props->cmax_wd && > + !FIELD_GET(MPAMF_CCAP_IDR_NO_CMAX, ccap_features)) > + mpam_set_feature(mpam_feat_cmax_cmax, props); > + > + if (props->cmax_wd && > + FIELD_GET(MPAMF_CCAP_IDR_HAS_CMIN, ccap_features)) > + mpam_set_feature(mpam_feat_cmax_cmin, props); > + > + props->cassoc_wd = FIELD_GET(MPAMF_CCAP_IDR_CASSOC_WD, ccap_features); > + Trivial but blank line here feels inconsistent with local style. I'd drop it. > + if (props->cassoc_wd && > + FIELD_GET(MPAMF_CCAP_IDR_HAS_CASSOC, ccap_features)) > + mpam_set_feature(mpam_feat_cmax_cassoc, props); > + } > + > diff --git a/drivers/resctrl/mpam_internal.h b/drivers/resctrl/mpam_internal.h > index 17570d9aae9b..326ba9114d70 100644 > --- a/drivers/resctrl/mpam_internal.h > +++ b/drivers/resctrl/mpam_internal.h > @@ -136,25 +136,34 @@ static inline void mpam_mon_sel_lock_init(struct mpam_msc *msc) > * When we compact the supported features, we don't care what they are. > * Storing them as a bitmap makes life easy. > */ > -typedef u16 mpam_features_t; > +typedef u32 mpam_features_t; This is strengthening my view that this should just be a DECLARE_BITMAP(MPAM_FEATURE_LAST) in the appropriate places. > > /* Bits for mpam_features_t */ > enum mpam_device_features { > - mpam_feat_ccap_part = 0, > + mpam_feat_cmax_softlim, > + mpam_feat_cmax_cmax, > + mpam_feat_cmax_cmin, > + mpam_feat_cmax_cassoc, > mpam_feat_cpor_part, > mpam_feat_mbw_part, > mpam_feat_mbw_min, > mpam_feat_mbw_max, > mpam_feat_mbw_prop, > + mpam_feat_intpri_part, > + mpam_feat_intpri_part_0_low, > + mpam_feat_dspri_part, > + mpam_feat_dspri_part_0_low, > mpam_feat_msmon, > mpam_feat_msmon_csu, > mpam_feat_msmon_csu_capture, > + mpam_feat_msmon_csu_xcl, > mpam_feat_msmon_csu_hw_nrdy, > mpam_feat_msmon_mbwu, > mpam_feat_msmon_mbwu_capture, > mpam_feat_msmon_mbwu_rwbw, > mpam_feat_msmon_mbwu_hw_nrdy, > mpam_feat_msmon_capt, > + mpam_feat_partid_nrw, > MPAM_FEATURE_LAST, > }; > static_assert(BITS_PER_TYPE(mpam_features_t) >= MPAM_FEATURE_LAST); > @@ -165,6 +174,10 @@ struct mpam_props { > u16 cpbm_wd; > u16 mbw_pbm_bits; > u16 bwa_wd; > + u16 cmax_wd; > + u16 cassoc_wd; > + u16 intpri_wd; > + u16 dspri_wd; > u16 num_csu_mon; > u16 num_mbwu_mon; > };