From patchwork Wed Jan 17 14:13:53 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: 13521785 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 DFA06C47258 for ; Wed, 17 Jan 2024 14:16:02 +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=7UvFy+p0+IjM2cGWw3N2oxrf7SpLKyv+ug2fUE89wyo=; b=VX6kP7ktUmIDLc j9KdE211WPQtN+LLhhtb8IbztXKk6TBTw20xGqbZGpu4w3ivuBa7Nw2fytgIZ7+x2N2gmvFQix2vk C+5RqHGGTuxMtROIV7ClIFlRQzm+NT7BynvtnTwmBkudXAEvd8yek5GyWT4efYuCtoJhnXIyyE2nA NuwBklHnTUpbvHcnfJVUt6uwR26+eBOYMSnYRnjVjLsJOog+1yTO2Oag6KDNTXlIM0h8W8WINo7QE TUiCcz6SzhAfJjOvE+nWLa2CAVxF9kwx0vGEryTisgZZ8gHf685d+R4vJh0wdf2zcm3mOCSk5Gtro ybpGTxdHhdpH48pstFcw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rQ6hW-00GyS6-2h; Wed, 17 Jan 2024 14:15:30 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rQ6hC-00Gy7G-1d for linux-arm-kernel@bombadil.infradead.org; Wed, 17 Jan 2024 14:15:10 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Type:Content-Transfer-Encoding :MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From: Sender:Reply-To:Content-ID:Content-Description; bh=rTHrkWdzMVpRooEbJUcNk7UPFjuqmUJZpANqwMplbL0=; b=fgjyIrFRF68sFE2ykm2bN5j2b0 9qI8Rx6HvWlUSGlhq3hqXlhv39VY0EU4LHyZzkJvG+3VrFxH4T1Z9A3bITWw0l2vq/WhcAKRvGKFQ l8Sgi45NE/RRMBLVzmeCwdXq8grTH2lJgtI/zZmBY9XZ9bMmVXFKkWCWrzPlxyrOt9hu1SdWTziJA kKhBZScZC+LLc8TBbYEPszpye/vRkR24FojboHi0vFlzSPzV1sorrpk/4+J95JchYdGuRls5xBa0h U1OZAV56xm1Bq3lqonBemK9IwagreEMKskmx98ruGcAnsgVa3Ikgqs9zkn096bg00ACNOQjJF5QBR PxgNP1VA==; Received: from mx0a-0016f401.pphosted.com ([67.231.148.174] helo=mx0b-0016f401.pphosted.com) by desiato.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rQ6h6-00000000UCq-1TxR for linux-arm-kernel@lists.infradead.org; Wed, 17 Jan 2024 14:15:09 +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 40H7jROl028480; Wed, 17 Jan 2024 06:14:21 -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=rTHrkWdzMVpRooEbJUcNk7UPFjuqmUJZpANqwMplbL0=; b=Y4q AhAMPXhv3tDDDIogb5f0ehr8BUhpggzdQeB8fjlTleGmzvQDCyresuYYawHZw8yd Rvvl6Lc8yB1Zqh27ss1dGGVoUCPhHetcMgaLdhHjdiw16MojgBtwwR1XUHUqNixT uNl8vep6Ezi0ye/T7/ExFXE9lR+e2E7nR1RolnX/KyCWqrN1Bp6gcYpWLHo/PVS5 1SRxqbWrhDbQiSXzcJpuQHUgTQqWhBNs+GM9wq7b1SuZcaCuo5lX88yin5+E6KHH Hkp/06V3r3y22V1b+Td7uVzM72KPgkzmL2Up00K0OlH8CmWdrBJ+HXaaYAeR+kL0 kbX478OphYkh9Bf0Y5w== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3vpask950r-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 17 Jan 2024 06:14:21 -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:19 -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:19 -0800 Received: from localhost.localdomain (unknown [10.28.36.167]) by maili.marvell.com (Postfix) with ESMTP id 542765B6949; Wed, 17 Jan 2024 06:14:16 -0800 (PST) From: Amit Singh Tomar To: , CC: , , , , , , , , Amit Singh Tomar Subject: [PATCH v1 02/14] arm_mpam: resctrl: Detect priority partitioning capability Date: Wed, 17 Jan 2024 19:43:53 +0530 Message-ID: <20240117141405.3063506-3-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: VcNmQzlMrK097VLHZ7DMYhHno_UZvD3W X-Proofpoint-GUID: VcNmQzlMrK097VLHZ7DMYhHno_UZvD3W 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_141504_974424_3909D605 X-CRM114-Status: GOOD ( 13.98 ) 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 --- Changes since RFC: * No change. --- 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 125c4b0c2ff7..d49aed80a05e 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;