From patchwork Wed Oct 25 15:48:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Harris X-Patchwork-Id: 13436456 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7EF28C8EA for ; Wed, 25 Oct 2023 15:48:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="WmKHAYYv" Received: from mailout2.w2.samsung.com (mailout2.w2.samsung.com [211.189.100.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F260399 for ; Wed, 25 Oct 2023 08:48:56 -0700 (PDT) Received: from uscas1p2.samsung.com (unknown [182.198.245.207]) by mailout2.w2.samsung.com (KnoxPortal) with ESMTP id 20231025154856usoutp02dbb73215487407fffcc8e24ed773b2f5~RZGju1DKg1241412414usoutp02K; Wed, 25 Oct 2023 15:48:56 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w2.samsung.com 20231025154856usoutp02dbb73215487407fffcc8e24ed773b2f5~RZGju1DKg1241412414usoutp02K DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1698248936; bh=QMgFUOuOzGo+YkpE2zQ5Pxq9bPQTM38YaTs8425M1uM=; h=From:To:Subject:Date:In-Reply-To:References:From; b=WmKHAYYvVcp/17C8YXtaMrBovYUkoHW53XwB+jQMCiMgxhFdhjxyjh21IHhlUd1f0 FY7/f6cgciIVmlpK2QqI5U9clTfkkH7GPRTPOVg0hzGEKC4Jvi/MddIVCw70msHxoZ uBk3VbfOVQXj3IhDvu9Y61hPOV2RGNVIkeh/7e4M= Received: from ussmges1new.samsung.com (u109.gpu85.samsung.co.kr [203.254.195.109]) by uscas1p2.samsung.com (KnoxPortal) with ESMTP id 20231025154856uscas1p2e4f58ae7df06d6995480243ffd9e8e5e~RZGjmtKuD1685016850uscas1p2q; Wed, 25 Oct 2023 15:48:56 +0000 (GMT) Received: from uscas1p1.samsung.com ( [182.198.245.206]) by ussmges1new.samsung.com (USCPEMTA) with SMTP id F8.F8.50148.8E839356; Wed, 25 Oct 2023 11:48:56 -0400 (EDT) Received: from ussmgxs3new.samsung.com (u92.gpu85.samsung.co.kr [203.254.195.92]) by uscas1p2.samsung.com (KnoxPortal) with ESMTP id 20231025154855uscas1p2102cef0c09d3cd68e8f2040ca2264f00~RZGjU0z5j2151821518uscas1p2Y; Wed, 25 Oct 2023 15:48:55 +0000 (GMT) X-AuditID: cbfec36d-559ff7000002c3e4-b4-653938e8cab1 Received: from SSI-EX1.ssi.samsung.com ( [105.128.3.66]) by ussmgxs3new.samsung.com (USCPEXMTA) with SMTP id 94.30.31410.7E839356; Wed, 25 Oct 2023 11:48:55 -0400 (EDT) Received: from SSI-EX2.ssi.samsung.com (105.128.2.227) by SSI-EX1.ssi.samsung.com (105.128.2.226) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.1.2375.24; Wed, 25 Oct 2023 08:48:55 -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, 25 Oct 2023 08:48:55 -0700 From: Jim Harris To: "dan.j.williams@intel.com" , "linux-cxl@vger.kernel.org" Subject: [PATCH v2] cxl/region: use region (not root decoder) granularity for calculations Thread-Topic: [PATCH v2] cxl/region: use region (not root decoder) granularity for calculations Thread-Index: AQHaB1rCfAj9TB4myEWLhxXUjosmcA== Date: Wed, 25 Oct 2023 15:48:54 +0000 Message-ID: <169824893473.1403938.16110924262989774582.stgit@bgt-140510-bm03.eng.stellus.in> In-Reply-To: <169660931834.684402.2774329392272976121.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: <8B6987E49DEA774AA1ABBCD12DFB2580@ssi.samsung.com> Precedence: bulk X-Mailing-List: linux-cxl@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-CFilter-Loop: Reflected X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpkleLIzCtJLcpLzFFi42LZduzrOd0XFpapBks+sFtMn3qB0eL8rFMs Dkwei/e8ZPL4vEkugCmKyyYlNSezLLVI3y6BK+PD5nbGgnXiFW3bpzE2MD4Q62Lk5JAQMJG4 /2EDWxcjF4eQwEpGiW2T57FDOK1MEo++XGeHqdq+5B0TRGINo0T7vHeMEM4nRonejdOgWpYx SmxofALWwiagKfHryhqgFg4OEYESiWenbUDCwgIxEu1bZrCA2CICiRJ3lh9kgrD1JPr2bQZr ZRFQlTj+cRJYnBeo/tXRLjYQm1MgWmLiknusIDajgJjE91NrwGqYBcQlbj2ZzwRxqaDEotl7 mCFsMYl/ux6yQdiKEve/v2QHOYcZ6LT1u/QhWu0k2p5uY4ewFSWmdD9kh1grKHFy5hMWiFZJ iYMrbrCAvCghMJFD4uaCFqj5LhJ3lr6ChpC0xPQ1l6EasiVWru8Ae11CoECi4UgQRNhaYuGf 9VAn80n8/fWIcQKj8iwkH8xCuG4WkutmIbluFpLrFjCyrmIULy0uzk1PLTbMSy3XK07MLS7N S9dLzs/dxAhMJaf/Hc7dwbjj1ke9Q4xMHIyHGCU4mJVEeCN9LFKFeFMSK6tSi/Lji0pzUosP MUpzsCiJ8xrankwWEkhPLEnNTk0tSC2CyTJxcEo1MIUwRAZM3mzgvXTlruVVByT1D5UfqVX9 9U46VTlwvirfHm5ZJsHzGwwzX9+JicxuWe/U0itt1vcy1Mp8teQX3rtah8VMuOSm+CnFrZOR OiB4VsytRmjiKuXIvcvv50+of+ax9YyVHrNU1gn5YLbvyYcUNsXO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lZlKtKvkmD0OkclVKu6ykSrQfPNCtGDMy3neX3Q WH19Tjmfql/ZvMvaXSb17k4PxG12TPimbdw82+PY1E9xlpNia9x04gvaJLTsYz/NvPbylndl uMiO0/XBMjdWPChVYinOSDTUYi4qTgQAnqv3YiUDAAA= X-CMS-MailID: 20231025154855uscas1p2102cef0c09d3cd68e8f2040ca2264f00 CMS-TYPE: 301P X-CMS-RootMailID: 20231025154855uscas1p2102cef0c09d3cd68e8f2040ca2264f00 References: <169660931834.684402.2774329392272976121.stgit@bgt-140510-bm03.eng.stellus.in> Root decoder granularity must match value from CFWMS, which may not be the region's granularity for non-interleaved root decoders. So when calculating granularities for host bridge decoders, use the region's granularity instead of the root decoder's granularity to ensure the correct granularities are set for the host bridge decoders and any downstream switch decoders. 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 this patch: "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 | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/cxl/core/region.c b/drivers/cxl/core/region.c index 6d63b8798c29..c25be26d0bdf 100644 --- a/drivers/cxl/core/region.c +++ b/drivers/cxl/core/region.c @@ -1133,7 +1133,14 @@ static int cxl_port_setup_targets(struct cxl_port *port, } if (is_cxl_root(parent_port)) { - parent_ig = cxlrd->cxlsd.cxld.interleave_granularity; + /* + * Root decoder IG is always set to value in CFMWS which + * may be different than this region's IG. We can use the + * region's IG here since interleave_granularity_store() + * does not allow interleaved host-bridges with + * root IG != region IG. + */ + parent_ig = p->interleave_granularity; parent_iw = cxlrd->cxlsd.cxld.interleave_ways; /* * For purposes of address bit routing, use power-of-2 math for