From patchwork Wed Oct 4 23:08:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Harris X-Patchwork-Id: 13409663 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 60005E936EB for ; Wed, 4 Oct 2023 23:08:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233634AbjJDXIg (ORCPT ); Wed, 4 Oct 2023 19:08:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56164 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236558AbjJDXIg (ORCPT ); Wed, 4 Oct 2023 19:08:36 -0400 Received: from mailout1.w2.samsung.com (mailout1.w2.samsung.com [211.189.100.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2B522C6 for ; Wed, 4 Oct 2023 16:08:28 -0700 (PDT) Received: from uscas1p1.samsung.com (unknown [182.198.245.206]) by mailout1.w2.samsung.com (KnoxPortal) with ESMTP id 20231004230826usoutp01a070fca62a2cd1d4cc5ee8a6fea5f894~LCjTgFG0H2181121811usoutp01L for ; Wed, 4 Oct 2023 23:08:26 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w2.samsung.com 20231004230826usoutp01a070fca62a2cd1d4cc5ee8a6fea5f894~LCjTgFG0H2181121811usoutp01L DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1696460906; bh=6XIMs5ksVYQU25zcB4YaojuBPMXTguzbzrPVcArNu8w=; h=From:To:Subject:Date:References:From; b=fdftlMoCeUs6YHYeQYjlIOwb3VJcFRZfIcNHwEMyCufLnhVvnZ8C3IIIDnYXj0xTa kux3uWV+HAWuUUZOChrfBJz6AET7TWmVpD3TFIM7ESCHFZK3EIrDIQeyEGYBfZq1xk mh9gD3YvlKH7pY2vCtnnTDpA1C+vHmn/RIUB2C4M= Received: from ussmges2new.samsung.com (u111.gpu85.samsung.co.kr [203.254.195.111]) by uscas1p2.samsung.com (KnoxPortal) with ESMTP id 20231004230826uscas1p282c44798b0afab9b0d90e1ac8b17b41d~LCjTbB0aY1895418954uscas1p2F for ; Wed, 4 Oct 2023 23:08:26 +0000 (GMT) Received: from uscas1p1.samsung.com ( [182.198.245.206]) by ussmges2new.samsung.com (USCPEMTA) with SMTP id 6A.CC.40279.A60FD156; Wed, 4 Oct 2023 19:08:26 -0400 (EDT) Received: from ussmgxs3new.samsung.com (u92.gpu85.samsung.co.kr [203.254.195.92]) by uscas1p2.samsung.com (KnoxPortal) with ESMTP id 20231004230826uscas1p2f7957bf868a609211271e30ad8ff551f~LCjTLiWqq0758807588uscas1p2L for ; Wed, 4 Oct 2023 23:08:26 +0000 (GMT) X-AuditID: cbfec36f-241ff70000009d57-84-651df06a98f0 Received: from SSI-EX2.ssi.samsung.com ( [105.128.2.146]) by ussmgxs3new.samsung.com (USCPEXMTA) with SMTP id 85.FA.31410.A60FD156; Wed, 4 Oct 2023 19:08:26 -0400 (EDT) Received: from SSI-EX2.ssi.samsung.com (105.128.2.227) by SSI-EX2.ssi.samsung.com (105.128.2.227) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.1.2375.24; Wed, 4 Oct 2023 16:08:25 -0700 Received: from SSI-EX2.ssi.samsung.com ([105.128.2.227]) by SSI-EX2.ssi.samsung.com ([105.128.2.227]) with mapi id 15.01.2375.024; Wed, 4 Oct 2023 16:08:25 -0700 From: Jim Harris To: "linux-cxl@vger.kernel.org" Subject: [PATCH] cxl: set root decoder granularity based on region params Thread-Topic: [PATCH] cxl: set root decoder granularity based on region params Thread-Index: AQHZ9xetppHioUpJEUacMqps7+5BAQ== Date: Wed, 4 Oct 2023 23:08:25 +0000 Message-ID: <169646090522.666328.17608442776078591123.stgit@bgt-140510-bm03.eng.stellus.in> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [105.128.2.176] Content-ID: <60BC53EC75501242A0EA47C1503163A4@ssi.samsung.com> MIME-Version: 1.0 X-CFilter-Loop: Reflected X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrKIsWRmVeSWpSXmKPExsWy7djXc7pZH2RTDb5M1rE4P+sUiwOjx+dN cgGMUVw2Kak5mWWpRfp2CVwZfUfvsxZcEqqY9uQRSwPjFKEuRk4OCQETidfTTzB3MXJxCAms ZJSYfmEyG0hCSGApk8TUFjmYok93WpkgitYySizeuAiq4yOjxPI5S2A6GCXaF5iC2GwCmhK/ rqxhArFFBKwlJjRA1AgLeEqsmTCTGSIeINF37yAbhK0n0bL7KAuIzSKgIjFx32N2EJtXIFri 3N6DjCA2o4CYxPdTEDOZBcQlbj2ZzwRxnaDEotl7mCFsMYl/ux6yQdiKEve/vwSawwFUrymx fpc+RKudxJf166HGKEpM6X4ItUpQ4uTMJywQrZISB1fcYAH5UULgEbvEtJfXGSESLhKfrt6A 2istMX3NZaiGbImV6zuYQHZJCBRINBwJgghbSyz8A7OLT+Lvr0eMECW8Eh1tQhMYlWYheWYW wqGzkBw6C8mhs5AcuoCRdRWjeGlxcW56arFRXmq5XnFibnFpXrpecn7uJkZgyjj973D+Dsbr tz7qHWJk4mA8xCjBwawkwpveIJMqxJuSWFmVWpQfX1Sak1p8iFGag0VJnNfQ9mSykEB6Yklq dmpqQWoRTJaJg1OqgWnypSXPprMw7CxeWrcmSkes54LUhk1+u3T+m52TkGq52mPdEaR9S2ba E/u934MWx7U77zFqnS2sYnw/6HnLvomrHpkek/qtlHXRcZuqy5ENHPkvMt1/y31aMr9b4b3Y vGDOPLat7t/EvmqLTrJ/+y309OZVt/PfJL/cKO6vuvWku7lIhPrcrdvOLfTpO21vtH3x2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tl91/k0p086//Yk9+ECJZbijERDLeai4kQAsV9piwUDAAA= X-CMS-MailID: 20231004230826uscas1p2f7957bf868a609211271e30ad8ff551f CMS-TYPE: 301P X-CMS-RootMailID: 20231004230826uscas1p2f7957bf868a609211271e30ad8ff551f References: Precedence: bulk List-ID: X-Mailing-List: linux-cxl@vger.kernel.org The granularity for downstream targets is all based on descending the topology from the root. So we need to set the root decoder's granularity based on the region params. Test configuration is 1 host bridge * 2 switches * 2 endpoints per switch. Region created with 2048 granularity using following command line: cxl create-region -m -d decoder0.0 -w 4 mem0 mem2 mem1 mem3 \ -g 2048 -s 2048M Use "cxl list -PDE | grep granularity" to get a view of the granularity set at each level of the topology. Before: "interleave_granularity":2048, "interleave_granularity":2048, "interleave_granularity":512, "interleave_granularity":2048, "interleave_granularity":2048, "interleave_granularity":512, "interleave_granularity":256, After: "interleave_granularity":2048, "interleave_granularity":2048, "interleave_granularity":4096, "interleave_granularity":2048, "interleave_granularity":2048, "interleave_granularity":4096, "interleave_granularity":2048, Signed-off-by: Jim Harris --- drivers/cxl/core/region.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/cxl/core/region.c b/drivers/cxl/core/region.c index 6d63b8798c29..f14110e35f79 100644 --- a/drivers/cxl/core/region.c +++ b/drivers/cxl/core/region.c @@ -1691,6 +1691,11 @@ static int cxl_region_attach(struct cxl_region *cxlr, return -EINVAL; } + /* Set root decoder's granularity now, so that we can use it to calculate + * granularity for the downstream targets in cxl_region_setup_targets(). + */ + cxlrd->cxlsd.cxld.interleave_granularity = cxlr->params.interleave_granularity; + if (test_bit(CXL_REGION_F_AUTO, &cxlr->flags)) { int i;