From nobody Sat Feb 7 06:13:30 2026 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2054.outbound.protection.outlook.com [40.107.92.54]) (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 EAA83254AFD; Thu, 6 Mar 2025 16:45:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.92.54 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741279520; cv=fail; b=uhyzxqSjSme+YbJnJi9opraZuuT57/dIf3Wi0EPBO9z3ybGPOnrCoA8whvWbb1qBfStCuucSCok4ZEZMLic2rhmJdlMmsnbp6KDnwfG44gerXip3hNHQdftXYqSWlwi4wp8PeQo8SXuWmseDKFER1CxzLYfRAMwik7sC6BArgqs= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741279520; c=relaxed/simple; bh=rFzyIS9gUdPyvo7qYzMG+tYOh7V4/FUtSVa8fuiTBhc=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=BvVe7jO+fHGiSrWlKsSO5Q6vFuGlODZ2aEQbHN+LyZ+q0ek3YE7/IGRm9LnPd+4ugOmSG/Ob2uLKbGv7+Ipebg0ooLOnnL+2B0jD5UFs2Kgd2OJ4479HqZU1GDXro3T7L2P86S8MhToRTAFBbkuQI6wMgkC05DrdMk06oJZf66M= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=fUM6Slg3; arc=fail smtp.client-ip=40.107.92.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="fUM6Slg3" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=jpQmOpbNxs477aS24gYOErAn39c5DvZMmmXjEMIPEqQIVZL1FeGKIlMMkN+nf441OwHWf1bzvPx65ciJ57czB0CEPPz6z46kLrv1gjbRzCm/283GBKjCh7iFfBy1F9pMAIYBiQOH3zl+ZCI15M1PHde7wucZE4DFXgc6FmJwLme8OFQIcViM9xTF7Pgeh6FDsvYkUscO30llT+YEKkXpdXo3Yf17HiKYqIO72agCJ4wGvtp6RW4UGq+XuDRsOaTjgOSl2DDroogEpufJ1DppougWGCWDJE4bF4NVhbO64Iy1bg1GzQOEaKc1gO2ppuzFZv4NUQqznGomOVF7BFC/6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=nuzWqDpz1bdJ/BbF5OJ7so8CNlk16Ya7kQh2bbQ3ZWA=; b=LyF8YacCSXtSS9iheQu1aDxDYl5zt/cgAMrwpBOflqW4+nFZEgYQwKLxQoql0k0ndVw3eNcoV9BuO9HPRzxF+64TLM8GqC0g6KaTricCqq6CqYUcZJGbPOhiQzgCODJab7tK69OHv/wxa2gp33cn1jeEEaZCgMVpeoPnB1C5pfhJ6hb8VHfz6lAuJQ7L+3nettn6GruBYgO/TAYpXoeqvkBDrQHr/tEmPM8Y4J3oSg1/+xa0dUDrq6lWeCgD3uwPS091Q2DM7roTU1SoUjgPjx9qTA4EfDbP+uIyWXThLVs/u8m6fYDsh8sULElCzzeBFJmrBtZrH6wQSkr2pTm55w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=temperror (sender ip is 165.204.84.17) smtp.rcpttodomain=intel.com smtp.mailfrom=amd.com; dmarc=temperror action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=nuzWqDpz1bdJ/BbF5OJ7so8CNlk16Ya7kQh2bbQ3ZWA=; b=fUM6Slg3H0Y3vyHNsj7T0GlXJd1LrUECQ+Jmw3nG3MCYMz32KeN5BJDBUxTh/itdyaMU/x9z2qn9WIEBqhnrUCGNeclXnHVRTj74QyZDPiQsz7+u4x7gFhZQi4sZ+MpugxDbxSYslXTuxd1s4nWqrcDfYfNtN8HLExJbwKJCRgU= Received: from SN6PR16CA0057.namprd16.prod.outlook.com (2603:10b6:805:ca::34) by DS0PR12MB8477.namprd12.prod.outlook.com (2603:10b6:8:15b::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8511.17; Thu, 6 Mar 2025 16:45:12 +0000 Received: from SN1PEPF0002636C.namprd02.prod.outlook.com (2603:10b6:805:ca:cafe::a7) by SN6PR16CA0057.outlook.office365.com (2603:10b6:805:ca::34) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8511.17 via Frontend Transport; Thu, 6 Mar 2025 16:45:12 +0000 X-MS-Exchange-Authentication-Results: spf=temperror (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=temperror action=none header.from=amd.com; Received-SPF: TempError (protection.outlook.com: error in processing during lookup of amd.com: DNS Timeout) Received: from SATLEXMB04.amd.com (165.204.84.17) by SN1PEPF0002636C.mail.protection.outlook.com (10.167.241.137) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8511.15 via Frontend Transport; Thu, 6 Mar 2025 16:45:11 +0000 Received: from rric.localdomain (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Thu, 6 Mar 2025 10:45:07 -0600 From: Robert Richter To: Alison Schofield , Vishal Verma , Ira Weiny , Dan Williams , Jonathan Cameron , Dave Jiang , Davidlohr Bueso CC: , , Gregory Price , "Fabio M. De Francesco" , Terry Bowman , Robert Richter Subject: [PATCH v4 01/14] cxl: Remove else after return Date: Thu, 6 Mar 2025 17:44:35 +0100 Message-ID: <20250306164448.3354845-2-rrichter@amd.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250306164448.3354845-1-rrichter@amd.com> References: <20250306164448.3354845-1-rrichter@amd.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN1PEPF0002636C:EE_|DS0PR12MB8477:EE_ X-MS-Office365-Filtering-Correlation-Id: 133903aa-046a-4f9b-8b82-08dd5cce42f8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|7416014|82310400026|36860700013|1800799024; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?IZFlmdBQH/5ew9uZJ3ZQ0+2ubRU3NmS5XyZFuu74/37ItwDotP3ckTifaJvQ?= =?us-ascii?Q?suRVUG+sZ+IfDW7y90RO1nNYi1XuRHsdSKJRi1vtgX3ty6/o0cbTZZWfOFcE?= =?us-ascii?Q?5EPB1yZnXEHNf9TxT6wBzke3mTmIMBHOSicggcXdxAeFDYQXvax+93KMhH4C?= =?us-ascii?Q?WpLYB4P7kx/D77vPM1yTwOjNQPFwyfGk4ZwgXz797QCoBIQLq0dwZuD/jgrr?= =?us-ascii?Q?3p+sXt7ry21vXlGm315XCyrJXLY4rqladgSKmWomolCCxCQgPrvX9vG2E6Hi?= =?us-ascii?Q?cPDVRt8ggx8lTmTOIJmdV85mzAezzJgdwDo1pF7xXs0VXIF97P94jbYRemJ5?= =?us-ascii?Q?yF2yki3bpRiUXixjpyltxh+6QyCJT6UmRVrwH50NtSm+lX7T9E+pBP8wkGOM?= =?us-ascii?Q?yQKxgym14HnTXhoXjrL1w40LDtLwkfCk69mBINfSiF6LChMHEKDNpfsWtOoK?= =?us-ascii?Q?lYkZWzjoN3RG3Cad6GNmmkGdvMpw5xKZ8cZYoabHH/ONH+MOY3enM0c/2Hfz?= =?us-ascii?Q?KJWyPcctUX0z1vr/iZvvR9WvjbOcvBItBX6GepcEGo3VaOIbQp8R2E1Bzn17?= =?us-ascii?Q?S7VbxqQrL4Vamm0m9Xde0yn9RlZ8fGG1qUxt59hvvlOdhUjRpVWf0gOnCLPX?= =?us-ascii?Q?cclWURSs4PxAByfSLS1fYJtjsM15lilcEqaQC+rJ9ei37Of56CiqEXJvBFjm?= =?us-ascii?Q?kqOVGub+3qVOgbRukxW7iCfGIzx4idTy2VMpUNWs83MW1/joiGWEEEzcItGP?= =?us-ascii?Q?ESaBZp84eGjvVSno3R+K+ob3E96LBxg7xoEjy5HXyMQZgYafvT4l2KUF03kv?= =?us-ascii?Q?Oo2YqYZYbl5N/zekZ+vJq4/qIddtMjqax7pTrTzHJZoryOjqkKOH8Da0oZ8M?= =?us-ascii?Q?Yv8GVw7t8xP9s1RgZR+pMRXZA+sVo+P159Zphb7cNbGEw/G9OPTzId1zSTYA?= =?us-ascii?Q?8NUKb4cBoJtVheRkELU50G+ywuATdWa3T0WWKFlS1ooazBzELHD+QTGDXG40?= =?us-ascii?Q?UvNvrLHXxa++ImnI3mFGxMACtdyId2fifXyHX2QIHhb2cI942LBgeBE0G1DW?= =?us-ascii?Q?JbneH2mLHzM7nu4xuPnHRk7QcHKK64JKg1MBQZDObGwPc31YC/gxEPipujp1?= =?us-ascii?Q?VP0NW738M7+Vt3rqJlYqx83tBtVvXjeDtPj3K9rViu4LexOPirJjxmClql2K?= =?us-ascii?Q?qwU+xNQa51rZBHiKVfAuhXVviTZYnEwI8hupt/6sKZ7uQCyX5HH5TbQOj0p/?= =?us-ascii?Q?M8KI+ZUfS8W6lccSQx6D7YTmQlfbgxBbLrSl3i1k9nawhbo625oKMnkbADtQ?= =?us-ascii?Q?yG2NzXCmE3gFYZbKNvMrK8WEJAFmFUI/vIlo8DxgHEuQoutPKmR+OgNz8D3m?= =?us-ascii?Q?ipX7Ymuxr+44rONb1FBCv+bbF0u3GlF+JZsqUgB9sXHqy4oBO1pvz+diVW5o?= =?us-ascii?Q?PiAxsl7s5DbPECGtlnbVPotlWnlL6nm8aU9eoh/Ms7Iib00nCZNUz0zc/lDF?= =?us-ascii?Q?eJo09AOs/sm9D6c=3D?= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:ErrorRetry;CAT:NONE;SFS:(13230040)(376014)(7416014)(82310400026)(36860700013)(1800799024);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Mar 2025 16:45:11.2456 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 133903aa-046a-4f9b-8b82-08dd5cce42f8 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: SN1PEPF0002636C.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB8477 Content-Type: text/plain; charset="utf-8" Remove unnecessary 'else' after return. Improves readability of code. It is easier to place comments. Check and fix all occurrences under drivers/cxl/. Signed-off-by: Robert Richter Reviewed-by: Gregory Price Reviewed-by: Davidlohr Bueso Reviewed-by: Jonathan Cameron Reviewed-by: Dave Jiang Tested-by: Gregory Price Reviewed-by: Alison Schofield Reviewed-by: Fabio M. De Francesco --- drivers/cxl/core/cdat.c | 2 +- drivers/cxl/core/pci.c | 3 ++- drivers/cxl/core/region.c | 4 +++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/cxl/core/cdat.c b/drivers/cxl/core/cdat.c index edb4f41eeacc..0ccef2f2a26a 100644 --- a/drivers/cxl/core/cdat.c +++ b/drivers/cxl/core/cdat.c @@ -28,7 +28,7 @@ static u32 cdat_normalize(u16 entry, u64 base, u8 type) */ if (entry =3D=3D 0xffff || !entry) return 0; - else if (base > (UINT_MAX / (entry))) + if (base > (UINT_MAX / (entry))) return 0; =20 /* diff --git a/drivers/cxl/core/pci.c b/drivers/cxl/core/pci.c index 96fecb799cbc..33c3bdd35b24 100644 --- a/drivers/cxl/core/pci.c +++ b/drivers/cxl/core/pci.c @@ -415,7 +415,8 @@ int cxl_hdm_decode_init(struct cxl_dev_state *cxlds, st= ruct cxl_hdm *cxlhdm, */ if (global_ctrl & CXL_HDM_DECODER_ENABLE || (!hdm && info->mem_enabled)) return devm_cxl_enable_mem(&port->dev, cxlds); - else if (!hdm) + + if (!hdm) return -ENODEV; =20 root =3D to_cxl_port(port->dev.parent); diff --git a/drivers/cxl/core/region.c b/drivers/cxl/core/region.c index 8537b6a9ca18..cbe762abf6b3 100644 --- a/drivers/cxl/core/region.c +++ b/drivers/cxl/core/region.c @@ -1940,7 +1940,9 @@ static int cxl_region_attach(struct cxl_region *cxlr, if (p->state > CXL_CONFIG_INTERLEAVE_ACTIVE) { dev_dbg(&cxlr->dev, "region already active\n"); return -EBUSY; - } else if (p->state < CXL_CONFIG_INTERLEAVE_ACTIVE) { + } + + if (p->state < CXL_CONFIG_INTERLEAVE_ACTIVE) { dev_dbg(&cxlr->dev, "interleave config missing\n"); return -ENXIO; } --=20 2.39.5 From nobody Sat Feb 7 06:13:30 2026 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2082.outbound.protection.outlook.com [40.107.243.82]) (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 6F2FC254B09; Thu, 6 Mar 2025 16:45:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.243.82 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741279522; cv=fail; b=uSkvhQAaK8V7V98WYW1U/9dwyB7z+2PPamiziHea1GMtIM6be3GaRBDWJC74CtTZ1XCbEXIzqNDklGtOMru5ftDma66dpqxYtKTgs55UD/3JjjM5o1ob6eE//aBLUfpsln+kMfzBXgJgK6H/X9eLk5mG9kdp+uteBginx54fwHI= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741279522; c=relaxed/simple; bh=DHDfqNB+ueU4t8taHsrHcDJZ69Xm3Vg9ZmfOh0q8aZI=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=jGyD3VMuFmI3qUiWe+tE9RZJSTiXlEQ9iI/B0g3VduN+ILtlrM/3ThYzeosht2pQNRP5cOosovyCqDp7uX3WyqFCdZdUwArcUal6Ec8Y2czZ2RBX6uZzOepKVJnHHkPyXxQm8HqhIc2GfpTCfORFTN6XW2O6fX6XWm7Kq8e/7VQ= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=OX2trJji; arc=fail smtp.client-ip=40.107.243.82 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="OX2trJji" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=IAhyhbfhng9kalZZwy+AuavW+o0tAkBA/lBjE5LKDhJnRr/MQNdS5iBgask0o28+FyAzqk9NmNCAQqxx/AxKywqx8wHH7nOxzqWpQfxY+95QGVAAubJ2axUay6e/4anL8lzx182UwpJN4i738Pw/v9NsW8IVjUE+YbD2vWsmfBwPswDy2abvh+vRo3lmpwwpd9ixce+0xLLlBYOcLsLRQNzBKmHQTFhDmCsiBx/c1tEa+rEOvT2EUoOaEVWN97zGHuU0DU5u4Fq0T5d+e5uj/kaiFPbXf1Bo/M0w7OYvO1ALAH3ROqwwd2UgbgKGfqnxf70YyP7y/YDVpLImrERDuA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=3KnRjPysUG12TBtDUoNxCjBv9lA7sofyfs+XDoqF4PM=; b=lIvdlvrij5AdIV5BweHMSENW08Ngzy3DiYZuaWyrSzWDXjoYcEjjbvA3ENcsaRfjWKUahNQujfyAXk0IFXJjBFy448mkq8kvhPcvEtI45Gf8AspLnCyMRgjw3n3122i7j63uV2EOBR+7cwfPdfvTQxa4CeLW35WSdRCMm4BAQ9lfFpgMpiGAGRWFEEqfMrqcUIRtUAniHli3YTxUMOnabSZeTGq8qvOzdq4o0QN212Mo+5kLJpk4Uwnc49ENTwjwBm8mOcJ30AJFErRHhhPPR8MZhVvKMvpAsVPD63N4h4ax4VqyCePS9NGaFoB5jJSBOChHVhXTgOKp13ki63yNyg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=intel.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=3KnRjPysUG12TBtDUoNxCjBv9lA7sofyfs+XDoqF4PM=; b=OX2trJjiqLkNRZCzQSi/ozQNCUa+6x3sEjfDBNQwjRCAKAULNfS62FKCHb1twZZb/SDWdG99x5bCX0eh8JXWBV9P4J+IaSAanN7PUmaauBN7aJLF+HOuUEvWmFpaFewPcCa942Uy0hgSLRHBRAOmx7TTryjPF3/ZRv66TUzUAdI= Received: from MW4PR04CA0119.namprd04.prod.outlook.com (2603:10b6:303:83::34) by SJ2PR12MB8651.namprd12.prod.outlook.com (2603:10b6:a03:541::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8511.17; Thu, 6 Mar 2025 16:45:14 +0000 Received: from SJ1PEPF00001CE6.namprd03.prod.outlook.com (2603:10b6:303:83:cafe::b3) by MW4PR04CA0119.outlook.office365.com (2603:10b6:303:83::34) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8511.17 via Frontend Transport; Thu, 6 Mar 2025 16:45:14 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by SJ1PEPF00001CE6.mail.protection.outlook.com (10.167.242.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8511.15 via Frontend Transport; Thu, 6 Mar 2025 16:45:14 +0000 Received: from rric.localdomain (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Thu, 6 Mar 2025 10:45:10 -0600 From: Robert Richter To: Alison Schofield , Vishal Verma , Ira Weiny , Dan Williams , Jonathan Cameron , Dave Jiang , Davidlohr Bueso CC: , , Gregory Price , "Fabio M. De Francesco" , Terry Bowman , Robert Richter Subject: [PATCH v4 02/14] cxl/pci: Moving code in cxl_hdm_decode_init() Date: Thu, 6 Mar 2025 17:44:36 +0100 Message-ID: <20250306164448.3354845-3-rrichter@amd.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250306164448.3354845-1-rrichter@amd.com> References: <20250306164448.3354845-1-rrichter@amd.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ1PEPF00001CE6:EE_|SJ2PR12MB8651:EE_ X-MS-Office365-Filtering-Correlation-Id: 5283d1c6-544a-4ca7-ded3-08dd5cce44d7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|36860700013|82310400026|7416014|376014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?9nBAu22wyWbVXOcTSiP/hbdzzAc9AiwxV5MLBiYrNY25J1HdGTzamrjOZJ39?= =?us-ascii?Q?e4gZeu7fMoiOQhXZ1t/p2osmrY6tu3iOxybT0K2LSDB4VI2r4ezFv6khp0SY?= =?us-ascii?Q?42N8hRvrWNfsyb0ufSpsEqKFZgq1KKJ5gPuiED0z0ODf0Wbo+O1MI5oQrFWx?= =?us-ascii?Q?ktaxuTM5SjszEHjoQKKiCYeEM3hIU/Lexh0X0wFtwJX+17Mia5cWNnXibh1c?= =?us-ascii?Q?sXT7LzfZgXqc2fqsXX9M108e0FVpnRKzTCezjYTjyrgugaaKgcc2/vYFjG70?= =?us-ascii?Q?TsjBZB2Wz22UyNo7yLUb2OUqcRfdIBU//10x05Xzrw3bUgByK8EDfn24MQDZ?= =?us-ascii?Q?ODbWnuBoJJXE66wOjvEN+MdtMutf3Cb7CjQy05q76P3sAufk5IcYDRtCNbWN?= =?us-ascii?Q?vHsMLbOPTmVJHRdqIfGF4asCm/0AznlpNtcfQwcrYH+Jjh8BAYgcyJBb/4ki?= =?us-ascii?Q?wvSqqfA7IEu89aOdVvbLcD2brdEBuExU2jbSK0nr7knmhPFVN4l43ptSp+/d?= =?us-ascii?Q?HFtJlB8CV7cELYgicNW2Wjzw4e4WqBFgL87b3ebJ8FYgXQeAqv+BWkgdTbE6?= =?us-ascii?Q?FDeUjAImfCK5P6iIEFZK3NbrPo7jrv+7VytfRVQgAL230g8MXZDsNiGy1fRg?= =?us-ascii?Q?MPLy7veLiGqsdN86Dj79q5mQI5ny1ffCMCDwsTZQBMh9uIkMmW04Q/VC8BV3?= =?us-ascii?Q?QcpJJnoTRpLPAQgfjdDRNQkZGK3TAgPawfPoc6QTiNYnKL0DmqEazeniyB+Y?= =?us-ascii?Q?iVf+gfCWhLK59U205yjoqWkmQYvEUwg8vrisnxEc7lAowbBDrHvQgQoqjggX?= =?us-ascii?Q?7hiBDrEg3E18x30Bxn60YACzSsvGu4/NA6C5Hy+FWmHqXyoFa1O3ZjDPDzvc?= =?us-ascii?Q?bLk2oE5Q12XjSh/stbTMmlYF6gVfTVE3tz4t05MQrb+iafhicBO7dYdTGX3h?= =?us-ascii?Q?QJTmoieWXb5nk0A7xqXhof64+bQ1fwFkQvqzeXXfz4WCaMnBzGMD+ch20OhO?= =?us-ascii?Q?i4uGj7/7ip712z3JVhlz7yFCnYy1vgBWgbJqEiP6cGnio78QQ7vzB5HIjP3X?= =?us-ascii?Q?k1V10+0h24mO0RKIs5AtAmyiLMwduShuhXRnzxhIeGyikOzv96Rs28uFFcZL?= =?us-ascii?Q?12eprTksP7DkjNd84QREn2pTvAnNJ00gB90o+6t1nc7Id1XCgI+7PhaRlFJ6?= =?us-ascii?Q?KmxDBwzGCwrpBOVLe62TPo9nmwnV7KMR2nN+UzbEku+GelqX4Tcf1SU4sgpO?= =?us-ascii?Q?Sg5OHbEY2N9AMEod+uwCyh505QOftcVrVjvcRzYyihD4BxhDB36Fj1gc2z8W?= =?us-ascii?Q?ZpZdq0GUPUG/dco0MghmwgnDvCjr1caewJrX7mzmUTEPzvPUA/ZIeb/mnEqY?= =?us-ascii?Q?6LLi9G8fnzMPSvx5QVHQAomUevOMRghJd0lkYXC7xpnzQ0FNCwEOOsU3cm++?= =?us-ascii?Q?4aYKY18zF6LBKvq0o0LSHoA/8XcykIfcmv4FtRa02v7VCW/dZCNtmlu9H0q5?= =?us-ascii?Q?SBfaRQXd/lLFUjg=3D?= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(1800799024)(36860700013)(82310400026)(7416014)(376014);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Mar 2025 16:45:14.2932 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5283d1c6-544a-4ca7-ded3-08dd5cce44d7 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: SJ1PEPF00001CE6.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR12MB8651 Content-Type: text/plain; charset="utf-8" Commit 3f9e07531778 ("cxl/pci: simplify the check of mem_enabled in cxl_hdm_decode_init()") changed the code flow in this function. The root port is determined before a check to leave the function. Since the root port is not used by the check it can be moved to run the check first. This improves code readability and avoids unnesessary code execution. Signed-off-by: Robert Richter Reviewed-by: Gregory Price Reviewed-by: Davidlohr Bueso Tested-by: Gregory Price Reviewed-by: Alison Schofield Reviewed-by: Fabio M. De Francesco --- drivers/cxl/core/pci.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/cxl/core/pci.c b/drivers/cxl/core/pci.c index 33c3bdd35b24..6386e84e51a4 100644 --- a/drivers/cxl/core/pci.c +++ b/drivers/cxl/core/pci.c @@ -419,14 +419,6 @@ int cxl_hdm_decode_init(struct cxl_dev_state *cxlds, s= truct cxl_hdm *cxlhdm, if (!hdm) return -ENODEV; =20 - root =3D to_cxl_port(port->dev.parent); - while (!is_cxl_root(root) && is_cxl_port(root->dev.parent)) - root =3D to_cxl_port(root->dev.parent); - if (!is_cxl_root(root)) { - dev_err(dev, "Failed to acquire root port for HDM enable\n"); - return -ENODEV; - } - if (!info->mem_enabled) { rc =3D devm_cxl_enable_hdm(&port->dev, cxlhdm); if (rc) @@ -435,6 +427,14 @@ int cxl_hdm_decode_init(struct cxl_dev_state *cxlds, s= truct cxl_hdm *cxlhdm, return devm_cxl_enable_mem(&port->dev, cxlds); } =20 + root =3D to_cxl_port(port->dev.parent); + while (!is_cxl_root(root) && is_cxl_port(root->dev.parent)) + root =3D to_cxl_port(root->dev.parent); + if (!is_cxl_root(root)) { + dev_err(dev, "Failed to acquire root port for HDM enable\n"); + return -ENODEV; + } + for (i =3D 0, allowed =3D 0; i < info->ranges; i++) { struct device *cxld_dev; =20 --=20 2.39.5 From nobody Sat Feb 7 06:13:30 2026 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2055.outbound.protection.outlook.com [40.107.220.55]) (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 B41CC25524D; Thu, 6 Mar 2025 16:45:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.220.55 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741279522; cv=fail; b=tfBiqDPlwDYaPMe1X0RTz9VTBYJxS7yeBebjVmSLBSJiLkcbEkJgK4dZ9eusVsWomENoe4P+UFD/2qkJLrgqVZOJ56NNQdxT/HTeL9AeBKQBYlfSWjdvbgytFm5IhzV1IygHabY+ldCsq9cOnVnzXXXEDWZDcSQt1IhW2grVLfM= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741279522; c=relaxed/simple; bh=WPZddSnoQ5xIt1R0pWGs5b9ptNBAArqsInfuxgxAlTs=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=VMTdgPLZVjOqA3zlO+LYbBQPuYa1NkNjlMwNOF+AYZG+4BG5zXyGj/edniADt47uUgtbOcjm5a4lpwADVSuxaHotQM8P6J4pvxuhdbMy40QKpvEZ4hOKPGEqS9SjnIuUalxXy6f5lhv7SbcjXgTj1LbPJkdSGFCSuFjsfdYmTa8= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=lHaLM0JD; arc=fail smtp.client-ip=40.107.220.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="lHaLM0JD" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=ozvulBmF7F76Kwv54vI9MkStJGrjGKPvkQWZ9N3CRMMPnC0Q+K4jQ/PctefEvxbbNQS5b0o9Hyz2NwA1F3aoKMofEVHdNyADNW8OomXjIuVQ+nt9m63mLcaKOd+9MMFABMkcBF78S6cOknjdsUGO6RdOxT1drsjkDpiUsqIUKykBmmqdzQsXCf35gzXy824QWTWGGYv38oWE5pvV5vA9ZtAyGRY8EJnkvstKHRI2PhgQHzl5zgChkAlnNe+TPm2PyI3ajtvVeVCtg6MOaifH9A1tSZYRh8cq5KZ2sW1Gvl8y3raBlHLojRP+JuwW8BqS2G8PTVm8LK5HgSCe/nkmgA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=YlsWRYcKfZvWVL4jSl5LoLKtk8/TqmhwYkL15ITB4ps=; b=lzFS8aeR/yoBXHIy68MIVjheOS9WfuMBjcG6Vz/aEqEWesy+EmqnhB2fe+7oeN2qIGHqP+A0TnghlpU2sHLiCiv2NVjFJXqmSRwooCfYqDFdNwaQ3kBO7ct7FJZNer/kkzHadXYEnD3RNp5zemz0GJXCveK91xhr2UPn5/duSqGozJkQFxCPH0NkPtDNTZdOtEcbLSGLoFQ5vW8Q++aWfwxqE9VJYwf9sIGJVZk6gXnqQ/VrSjv6mqjaoAFV8HP9ir++5RoqSgi9xNbygkrSJuDj68Mm/fMRRqYEL+vbmqKvOTv6wEpxbw+I8FqNedhgyv+ZiIm3xMID7rBb0E62Ng== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=intel.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=YlsWRYcKfZvWVL4jSl5LoLKtk8/TqmhwYkL15ITB4ps=; b=lHaLM0JD5O7oJX3uOA+nYNLxd8vWUCEcQOO57ANogexlTKqX3a3vH7hXhM7R+TrgR8Ma9UueCtSE4OrCD64/FGEgpO02W+/JpaUGzViwHMlMiMx0/7+ZN0Q/sgb/1tmfGqrNepRoVbiZFZySqvTKq4iQ65u5rdNtlpqkeS8dQOc= Received: from SJ0PR03CA0363.namprd03.prod.outlook.com (2603:10b6:a03:3a1::8) by SJ2PR12MB8063.namprd12.prod.outlook.com (2603:10b6:a03:4d1::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8511.19; Thu, 6 Mar 2025 16:45:18 +0000 Received: from SJ1PEPF00001CE5.namprd03.prod.outlook.com (2603:10b6:a03:3a1:cafe::a) by SJ0PR03CA0363.outlook.office365.com (2603:10b6:a03:3a1::8) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8511.16 via Frontend Transport; Thu, 6 Mar 2025 16:45:18 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by SJ1PEPF00001CE5.mail.protection.outlook.com (10.167.242.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8511.15 via Frontend Transport; Thu, 6 Mar 2025 16:45:18 +0000 Received: from rric.localdomain (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Thu, 6 Mar 2025 10:45:14 -0600 From: Robert Richter To: Alison Schofield , Vishal Verma , Ira Weiny , Dan Williams , Jonathan Cameron , Dave Jiang , Davidlohr Bueso CC: , , Gregory Price , "Fabio M. De Francesco" , Terry Bowman , Robert Richter Subject: [PATCH v4 03/14] cxl/pci: Add comments to cxl_hdm_decode_init() Date: Thu, 6 Mar 2025 17:44:37 +0100 Message-ID: <20250306164448.3354845-4-rrichter@amd.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250306164448.3354845-1-rrichter@amd.com> References: <20250306164448.3354845-1-rrichter@amd.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ1PEPF00001CE5:EE_|SJ2PR12MB8063:EE_ X-MS-Office365-Filtering-Correlation-Id: 75f28bac-31da-401d-2825-08dd5cce4710 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|7416014|36860700013|376014|1800799024; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?1d0HcFf171UdEckYCMN3F+k7GfScEJ3CHCqxm1amP7woCHWPYxWd8HGVlP/P?= =?us-ascii?Q?nQ0GP0h6eYohe+F5oIekbI2DsQrmBE3D9ikZtfyv8UL+y9nP0MAnhfrtN+OG?= =?us-ascii?Q?Z0gcNAf1GT1aRLaeeJZQm3hu+1fdKrfnDG02x/OxniTtrvfznx+7wKZlsMNJ?= =?us-ascii?Q?p7471Oduu03wGX9nhLNjAKK8hlvvY3uFkc/C8KKUa3u4pbtihMaV//7IVAGU?= =?us-ascii?Q?VpQVLwkrxWXA2GV19urbZNTSQirzRiNHqErDeQhwN/Pe+Oyg+R72HIrWYHde?= =?us-ascii?Q?434mm2cAG15O/PhnR/EXnYyeKhNmjAhrx+JHBcdWWh8wb4UpSJjfRiP1f+7F?= =?us-ascii?Q?uRurdZJbvEjErbxGeP24t9INXtfB//f/srCAagbSSc6eY8vF4rA5eFw5vBJX?= =?us-ascii?Q?KVjUBHu43fxYhlcQGJLBrIkGlxnq9I5ZIlZpal6vHDjG9ye+kmOg4JbqQKm6?= =?us-ascii?Q?NqArvzrgsn47WLiW4fGrAg8wH8xUPkt8DjgRwuj45rt9XH7CHK32oKeECGD3?= =?us-ascii?Q?7+JMx1uMSHO316yD62QKxsdh2L70krJSo5C0vwAC2z4roay2oEyzbQZv/3AG?= =?us-ascii?Q?OmkAiVKFvMP5bkovxPQO3ZRZpHrDumWiKj1HSN6gIO/dxVf8ibjWpMCSXSuS?= =?us-ascii?Q?l6OLAysy4OXh488JEX1/Bs7L0bPBWjdYQ7hvHomrUioizpeQg6CI5z5+L+lf?= =?us-ascii?Q?wH7bYYvQHEE/OhNsKytf5PHji8YTTBcZ6ILLrJpWGzRRB3m70Z/+NSlpvIvT?= =?us-ascii?Q?zvadmwni7V8WHyQH44tEBbn0DwBvo85LnDLjyuFZKgn9pxGmqR+86H3uhOSL?= =?us-ascii?Q?vurJekQ6fvcaSO7N0fKNzXTgOEjXHG8/Ybbi6HZ7QMCJyEZWxa0FkdoK+O1D?= =?us-ascii?Q?OW62HG6haj7zvW61Kp/jLcqFfAFGfM+/PL5yKw14B5+uRfoAO/kRrjbtNFcb?= =?us-ascii?Q?SmQbCQK+07NSZS5+8s8NoffUoZZnt/JSXOeYZtEGZIhZdWCtb0bjQ94GpREg?= =?us-ascii?Q?EvaRDx5doUsT3VyPpmShjZN13p4MP2wHoSFvIaUgczmNdiYiL6Gfzk07NBX3?= =?us-ascii?Q?9W39RrYeOxf7S2JAPdB9AI5sfzIluJdeWB9pHAC3Hb7qS6R1SAF4eyZNGWVK?= =?us-ascii?Q?FUEjNpsEr2srAHag1yZJBV69xVYwEC9VtrUDKcGr6IxvMnYKoBKAh9Z7RdFM?= =?us-ascii?Q?U5cfVb1bQC/7c1hxUSV82QSTQw958bpv70e2kdrTm/h9GnnZrZH7bR815LWm?= =?us-ascii?Q?9EIE0Z3F5EyvkoHkicDmOvo3YnPUDdqcKBOR8RUHWCve68wwgMe5t1SqUWLh?= =?us-ascii?Q?zN/bm0MQgpWLY7rYr5pOyIWP+5AK9mOJbI5R+l/OyvWgfuwGypG+eWm7AU54?= =?us-ascii?Q?BY/KL/NachbibXyR15vUHwRHIwyIZiaix7GPWY0dXFfe7afk0T6pLvhFoz4I?= =?us-ascii?Q?L+IEJL3oqZmH0GIcQ3uNGythgEY/q9RFSrjN+30/HINI605bi7c9lRpiXr1m?= =?us-ascii?Q?YvUg7uolYbLhv+k=3D?= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(82310400026)(7416014)(36860700013)(376014)(1800799024);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Mar 2025 16:45:18.0019 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 75f28bac-31da-401d-2825-08dd5cce4710 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: SJ1PEPF00001CE5.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR12MB8063 Content-Type: text/plain; charset="utf-8" There are various configuration cases of HDM decoder registers causing different code paths. Add comments to cxl_hdm_decode_init() to better explain them. Signed-off-by: Robert Richter Tested-by: Gregory Price Reviewed-by: Alison Schofield Reviewed-by: Fabio M. De Francesco Reviewed-by: Gregory Price Reviewed-by: Jonathan Cameron --- drivers/cxl/core/pci.c | 33 ++++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/drivers/cxl/core/pci.c b/drivers/cxl/core/pci.c index 6386e84e51a4..ef4b08abe424 100644 --- a/drivers/cxl/core/pci.c +++ b/drivers/cxl/core/pci.c @@ -416,9 +416,21 @@ int cxl_hdm_decode_init(struct cxl_dev_state *cxlds, s= truct cxl_hdm *cxlhdm, if (global_ctrl & CXL_HDM_DECODER_ENABLE || (!hdm && info->mem_enabled)) return devm_cxl_enable_mem(&port->dev, cxlds); =20 + /* + * If the HDM Decoder Capability does not exist and DVSEC was + * not setup, the DVSEC based emulation cannot be used. + */ if (!hdm) return -ENODEV; =20 + /* + * The HDM Decoder Capability exists but is globally disabled. + */ + + /* + * If the DVSEC CXL Range registers are not enabled, just + * enable and use the HDM Decoder Capability registers. + */ if (!info->mem_enabled) { rc =3D devm_cxl_enable_hdm(&port->dev, cxlhdm); if (rc) @@ -427,6 +439,18 @@ int cxl_hdm_decode_init(struct cxl_dev_state *cxlds, s= truct cxl_hdm *cxlhdm, return devm_cxl_enable_mem(&port->dev, cxlds); } =20 + /* + * Per CXL 2.0 Section 8.1.3.8.3 and 8.1.3.8.4 DVSEC CXL Range 1 Base + * [High,Low] when HDM operation is enabled the range register values + * are ignored by the device, but the spec also recommends matching the + * DVSEC Range 1,2 to HDM Decoder Range 0,1. So, non-zero info->ranges + * are expected even though Linux does not require or maintain that + * match. Check if at least one DVSEC range is enabled and allowed by + * the platform. That is, the DVSEC range must be covered by a locked + * platform window (CFMWS). Fail otherwise as the endpoint's decoders + * cannot be used. + */ + root =3D to_cxl_port(port->dev.parent); while (!is_cxl_root(root) && is_cxl_port(root->dev.parent)) root =3D to_cxl_port(root->dev.parent); @@ -454,15 +478,6 @@ int cxl_hdm_decode_init(struct cxl_dev_state *cxlds, s= truct cxl_hdm *cxlhdm, return -ENXIO; } =20 - /* - * Per CXL 2.0 Section 8.1.3.8.3 and 8.1.3.8.4 DVSEC CXL Range 1 Base - * [High,Low] when HDM operation is enabled the range register values - * are ignored by the device, but the spec also recommends matching the - * DVSEC Range 1,2 to HDM Decoder Range 0,1. So, non-zero info->ranges - * are expected even though Linux does not require or maintain that - * match. If at least one DVSEC range is enabled and allowed, skip HDM - * Decoder Capability Enable. - */ return 0; } EXPORT_SYMBOL_NS_GPL(cxl_hdm_decode_init, "CXL"); --=20 2.39.5 From nobody Sat Feb 7 06:13:30 2026 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2072.outbound.protection.outlook.com [40.107.237.72]) (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 4FE9525333D; Thu, 6 Mar 2025 16:45:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.237.72 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741279527; cv=fail; b=AX4Xtg+KZTOFJMal+o9Ru1ybmY9XL6PMLJSSabK5kVpfZHs6KrIefrOtSs+IfPUbGotvQqhJLxjFi4oD5iIE6WfkdNaNgOHhvmHumeQSc/7RbJadSNHgSNmqJGFYc6TPmjyT0duvzfBv/y4ef8Py20rDYTmaVxzMqw19SOetATY= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741279527; c=relaxed/simple; bh=3eTnioFJmC5hh7I7shNf/0Ena7ZdlWTrQgGUsqv6wwc=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=BpNvyOJWeeXrRBreOPRyXiTI0Qf2kSr72al+Dh/RqCwIepwSVgYQKBX/Jdusg8pA8xIyYENtXTa6iYIILvNmPXR2oXhidzH6Pt9aFr3de3ZfducJn/eO0W/LM8IYrBJZpVxogZZscXknBj8eJ5EC1KuxQgW249m1zwUjov84jAs= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=4Si7ayMY; arc=fail smtp.client-ip=40.107.237.72 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="4Si7ayMY" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=sLnURTqE74cfM5N342F9LiYCqP9gvVdnMPs/FqE2riPTkKORTkSjWdcxmoCN4koAk/bDJ7Q14unRCkexFKPeb3QdeUSXb6R7Hom3lkjBy88JsmCxJe3tGg+mvwjkS62la7yJ6NJs8hh+uGbYqvWCUK2iZuymdRNHJHZsTOhwxFUNnxpu7vAM3u+PRhhhzKpsA38eOo/0Xp+MUoQv1BM+ClMufBsXFooWFZqA2e/m2+XzAF27wwFHVaagpTscTs4XhCUfRv1pXHV4eZRyE9sjtAgWf4oJriA7+bgCgxfooZ0WjCH83rnTUdlFUTvp+MyryesvSy5cJxjSvMPh60bHYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=4WQbPMnYnpg4Cn461+cE8PhyWselLsDjtNbM6Upb7Ok=; b=yJp8VLYpD91BG8y+Y7psrycT/ZHD3aKIXsaso4zLrjNq+yLHqkR5AeS4Tm5NV9P+A1ng5vErazYO9b33U2rzJ8HXFEP1dmmi9cjopvCtZV6OGNcasevIY6dudebuVk6ALTJWPULYlR4gZNGsZOKOVgIScV0dXeqyZfYEhvsa09NHFm0BZUaQF2oD+SScgi+AvOeNOJ6+0fx6QZkCpkYbN24xZUIi3+j9XSlqyNB74nSdTq3ayQ0KL7QxeVqa9LO0zFlZVtlnuarTl97j33QNzwrrSaVMEdNi1gOKXfMzdHXCLLRDZcE0+t3eRvUFwiLNNXiFQLh4LWn4/6jXjcdMTQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=intel.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=4WQbPMnYnpg4Cn461+cE8PhyWselLsDjtNbM6Upb7Ok=; b=4Si7ayMYC2qaRsR2dI3Ye15i80rd8/oKcDQKxz4FGY8nsisOR1LihMDsd5um3oTt4Tsl8z2vNgyMz+v1jDr2curtpDzc3wFeotp+o4BzsgykGox1KT5D5j4FtumrDHWPIH60JmZCGb2ydQbrwq8ipLI+bqtWfPyLJyH0Gq1hznc= Received: from MW4PR04CA0099.namprd04.prod.outlook.com (2603:10b6:303:83::14) by SA3PR12MB7904.namprd12.prod.outlook.com (2603:10b6:806:320::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8511.17; Thu, 6 Mar 2025 16:45:23 +0000 Received: from SJ1PEPF00001CE6.namprd03.prod.outlook.com (2603:10b6:303:83:cafe::91) by MW4PR04CA0099.outlook.office365.com (2603:10b6:303:83::14) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8511.19 via Frontend Transport; Thu, 6 Mar 2025 16:45:21 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by SJ1PEPF00001CE6.mail.protection.outlook.com (10.167.242.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8511.15 via Frontend Transport; Thu, 6 Mar 2025 16:45:21 +0000 Received: from rric.localdomain (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Thu, 6 Mar 2025 10:45:18 -0600 From: Robert Richter To: Alison Schofield , Vishal Verma , Ira Weiny , Dan Williams , Jonathan Cameron , Dave Jiang , Davidlohr Bueso CC: , , Gregory Price , "Fabio M. De Francesco" , Terry Bowman , Robert Richter Subject: [PATCH v4 04/14] cxl: Introduce parent_port_of() helper Date: Thu, 6 Mar 2025 17:44:38 +0100 Message-ID: <20250306164448.3354845-5-rrichter@amd.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250306164448.3354845-1-rrichter@amd.com> References: <20250306164448.3354845-1-rrichter@amd.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ1PEPF00001CE6:EE_|SA3PR12MB7904:EE_ X-MS-Office365-Filtering-Correlation-Id: ef36556a-d105-41ac-4d71-08dd5cce4912 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|82310400026|7416014|376014|1800799024; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?twJFwC8aCqYaJRkWiUXSWKn6IcQKrTS1G5+eMIcky8oKm3T2P7ji4hY/1SJ+?= =?us-ascii?Q?eB6dZau2765SdzQz5KZkW5Pn3HWI0Mt4t/iustL91T4ZFphqceHhh18YyZy8?= =?us-ascii?Q?8N2y09zCrqNYdmNzN4k8MpftzJWdO09llzrkxiJdbdTRb4FSM9+XAa4JikkG?= =?us-ascii?Q?/IxSXAWRe7JxVwhYHrZLMQrf38M6a8lDzxy/AaoBaYHuKCDEGYfyS4RhN8aP?= =?us-ascii?Q?29n6oTxBnH4kYaf/VQYK5kEygPlx+a4uNSAy6pzl8kJRuu1dul1MAr8mDQ7n?= =?us-ascii?Q?aWp8MUHssE/YrrvW3RJhxMbLrHtQx9QaeK6TKZ+Q/RcreTxEOi204CMdHY4N?= =?us-ascii?Q?7SE3A9v4O/vudBoJxTNIImCGYydflcHWETMfoX+ltsQ7MPx4G4mvsZYYwpI7?= =?us-ascii?Q?GErW84S8ewN5TocSq9nb1kUGQi6gTyCgUCFY4rNkkzCGBi9yb42qJrCi+0LT?= =?us-ascii?Q?dj6XdosX/+2a78DfmFxIX0s5Hr+Z40vE7FWwHY80nm0iTnGA7YrhssbpM+Lu?= =?us-ascii?Q?fUinf76YJ7rfw3tATcbjH6IVsGHWO04zLJeS1WGh8TuoSbFbx6YHnqoB7IrK?= =?us-ascii?Q?FrPqM+YSdLvIC7dzayXVndOCvTeBZoMfgj7aBVS7OBlZD98hSh4Wb7oFa1R0?= =?us-ascii?Q?6Y/it4v6zSLhHgSzmjtKUikroZhPAJ3OlLtWrHzZIwKDNBMvL1zQrY2Qrf2V?= =?us-ascii?Q?5JBpX3J/A+NrJa7EHSB6Y8fcIP+XqzbMESUIDRIQC0G2OcXPz8FIc7lGF4fq?= =?us-ascii?Q?N9OJOhqMpUwPkQxDTKbtoNqXiPRjMgT/+/uJlhQPyyVjx7sZ9GV1yQmAfGLh?= =?us-ascii?Q?pnRkxWH+usNTZwA2Yg2aW1j4JHJqL3QjiI2+0D6nz5d0V3MnJif+sEN57R1d?= =?us-ascii?Q?Zt82r1LBiZq6tuwI66nKr0UNeN5EDFPjztc7Fcgt930m0FXmO0q4plV9D0gt?= =?us-ascii?Q?SYis4MwfhBEsNZwBmr2wS3HykOJdregHWwllMqPs7gW9BuBfyPNbQQmHfGuR?= =?us-ascii?Q?UEmPQFFY2qwpnyyuGPFPLgu7TlpJG6wKlFm20jgN5Eka0SMRoez8L7SOwE2B?= =?us-ascii?Q?BzHFSXufoA9tTdOKOzOIdgJHKnGCu4Mo3oxp65sJSM106/RxASIyFdE4RD8+?= =?us-ascii?Q?IRKEI30GmwiNeXMytG1fTBIRvThGRbnqYsyyZiil6QxvltIoaIhZpVDlWZZu?= =?us-ascii?Q?C5sYdqS5kFJudOEEWii1KFbicYv3OL4WBYKaOZSOJ8KVrQux0yyYU2giHU2p?= =?us-ascii?Q?tw3MvLC0PVm1/0ayo4yZDwA6Nc3nRVN5AcmUvyeoxVZnav5imL4unrGjT8LX?= =?us-ascii?Q?0prRXO0JFDlybk+WGz9/BODY9w5/LTRyCJ4JprfhFrmvpayJzQCau1PKW/lF?= =?us-ascii?Q?ngjT0h1PbIDuZgRcbGZ6zd12hXXk2LduJkEL45fBmhMcdQUOCQjrl0Aa49JR?= =?us-ascii?Q?ar5EE0WwI0FWY6cp0t5BIhEDRqPHtT5NE9cPeYX/FUru43fgFprKqS1Znfkn?= =?us-ascii?Q?tYWI3ltGAhIk/Lk=3D?= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(36860700013)(82310400026)(7416014)(376014)(1800799024);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Mar 2025 16:45:21.3558 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ef36556a-d105-41ac-4d71-08dd5cce4912 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: SJ1PEPF00001CE6.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA3PR12MB7904 Content-Type: text/plain; charset="utf-8" Often a parent port must be determined. Introduce the parent_port_of() helper function for this. Signed-off-by: Robert Richter Reviewed-by: Gregory Price Reviewed-by: Jonathan Cameron Reviewed-by: Dave Jiang Tested-by: Gregory Price Reviewed-by: Alison Schofield Reviewed-by: Fabio M. De Francesco --- drivers/cxl/core/port.c | 15 +++++++++------ drivers/cxl/core/region.c | 11 ++--------- drivers/cxl/cxl.h | 1 + 3 files changed, 12 insertions(+), 15 deletions(-) diff --git a/drivers/cxl/core/port.c b/drivers/cxl/core/port.c index 6a44b6dad3c7..25eecb591496 100644 --- a/drivers/cxl/core/port.c +++ b/drivers/cxl/core/port.c @@ -602,17 +602,20 @@ struct cxl_port *to_cxl_port(const struct device *dev) } EXPORT_SYMBOL_NS_GPL(to_cxl_port, "CXL"); =20 +struct cxl_port *parent_port_of(struct cxl_port *port) +{ + if (!port || !port->parent_dport) + return NULL; + return port->parent_dport->port; +} +EXPORT_SYMBOL_NS_GPL(parent_port_of, "CXL"); + static void unregister_port(void *_port) { struct cxl_port *port =3D _port; - struct cxl_port *parent; + struct cxl_port *parent =3D parent_port_of(port); struct device *lock_dev; =20 - if (is_cxl_root(port)) - parent =3D NULL; - else - parent =3D to_cxl_port(port->dev.parent); - /* * CXL root port's and the first level of ports are unregistered * under the platform firmware device lock, all other ports are diff --git a/drivers/cxl/core/region.c b/drivers/cxl/core/region.c index cbe762abf6b3..4f79cc17c9c8 100644 --- a/drivers/cxl/core/region.c +++ b/drivers/cxl/core/region.c @@ -1748,13 +1748,6 @@ static int cmp_interleave_pos(const void *a, const v= oid *b) return cxled_a->pos - cxled_b->pos; } =20 -static struct cxl_port *next_port(struct cxl_port *port) -{ - if (!port->parent_dport) - return NULL; - return port->parent_dport->port; -} - static int match_switch_decoder_by_range(struct device *dev, const void *data) { @@ -1781,7 +1774,7 @@ static int find_pos_and_ways(struct cxl_port *port, s= truct range *range, struct device *dev; int rc =3D -ENXIO; =20 - parent =3D next_port(port); + parent =3D parent_port_of(port); if (!parent) return rc; =20 @@ -1861,7 +1854,7 @@ static int cxl_calc_interleave_pos(struct cxl_endpoin= t_decoder *cxled) */ =20 /* Iterate from endpoint to root_port refining the position */ - for (iter =3D port; iter; iter =3D next_port(iter)) { + for (iter =3D port; iter; iter =3D parent_port_of(iter)) { if (is_cxl_root(iter)) break; =20 diff --git a/drivers/cxl/cxl.h b/drivers/cxl/cxl.h index be8a7dc77719..24cec16d02a6 100644 --- a/drivers/cxl/cxl.h +++ b/drivers/cxl/cxl.h @@ -724,6 +724,7 @@ static inline bool is_cxl_root(struct cxl_port *port) int cxl_num_decoders_committed(struct cxl_port *port); bool is_cxl_port(const struct device *dev); struct cxl_port *to_cxl_port(const struct device *dev); +struct cxl_port *parent_port_of(struct cxl_port *port); void cxl_port_commit_reap(struct cxl_decoder *cxld); struct pci_bus; int devm_cxl_register_pci_bus(struct device *host, struct device *uport_de= v, --=20 2.39.5 From nobody Sat Feb 7 06:13:30 2026 Received: from NAM02-DM3-obe.outbound.protection.outlook.com (mail-dm3nam02on2049.outbound.protection.outlook.com [40.107.95.49]) (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 65A082566D1; Thu, 6 Mar 2025 16:45:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.95.49 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741279530; cv=fail; b=ekBdQ5xsRnSZ2PjK21rnCJ7JPVnbbZq038R3qEU5ZWVc0+kmBlvOewIzWVlT9tQJwbCvKIHZKh4C2rBjwEsfMpfrz+L8+JYnRaEfjuHPB1Z5Idwp7SPOACaMD0thCJdc+vh7tIl9TB5YV7Xsxyb2i4CgAHGtCl6Xnx+aMKoddNk= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741279530; c=relaxed/simple; bh=yPAvdw7vpgqEcZ5k+4DmXsbki/46NzusNY1k104yARQ=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=DRDdSJ9V7Uzhe0QrCGA+eIjgeO3kfhib7Wn3PN1WjFJ9NfUhsmQKlagOqQU0gJxsuH0Ilb112qdgcmVIkTWyiTqNGLlJFvpji+c6T9umo5TA2NLSm7ZSxhkON+/7/QXtV0fhsxJwwv4Z/G9cWg0z9bVy0h+maS0cUKyKWd+1nEc= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=USAZV7lb; arc=fail smtp.client-ip=40.107.95.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="USAZV7lb" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=L2xCFU+4jIQAHlZjc7k9hbq5pIm6N+7Kvo+Z+VtihAI2K03RgJTRu41oCNIrMUAnOYvhyhakVWcw4WNTri9B8uPN9x51gfyPLKfvLh7t3yzyG7KXI00Br7dNHLAYSBvlWvJjz6dpEdxkakoD1QF3XihgNSLmf5ETUY750YnaChBdI/2vc1BshxKc7meQNbnEdB27UvFf/JncQE9iSjAaV4NI+htO0M3T+RoE+WpABSrYe2qfvurVfcXw8MjGHf9YSNsFBUZ6ax2TmywqDTFeqhS0A6mDgwBqotEHE2CY2l14QDJmHRu0+bTAGPYrtvJ1EwnjqzKk0/kycdiMe+QMKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=eOvm1vhCRGbnCqwTCXhmgTud/0u3W3npvVgXr2xf2/k=; b=iHttgcgaiY/H16P/wGpuju6QKylXXENNqnFgKVPNOjPytZHqwkFGajcpJB6jStFy1JYBs537Nq+LIokTh03sZVIuvJ5aFS4cAq889rDTAdAQ0Ac8dQjoyEPUgFO4gd7D6EeWyJZDDmycpnZryAlCwhP3dQEjPNwA7uiepncSTyE2eHCxnAMrcXcK47SF9ZvcKvSLdkEulKVXum223aPQuCvugpHsIT8HyeLdrarGY6Yg+2XmHxoBO/E0gCrAzInayMZrdGw7nk/gSMHjGjZHfaLrA/KNwj+bFqQlm8axCtRApqjc7LhhNWAspvRzAlOKoAE1ObpQvG4W8BLtIac7rA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=intel.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=eOvm1vhCRGbnCqwTCXhmgTud/0u3W3npvVgXr2xf2/k=; b=USAZV7lb7JmsZUAFmfQ5ABKRX+naOksokaohd1vUgzZ7k1GxGJ78UHKetp6i9x+0lZU7qNjwqEn/PvA5MX6IgF3V1p3hD/HlcLM323u4eLtmeL1C92KcCkuirGMQ+cBD6KZCGM1IqaQ9GkMQih9dK7TK5DZD0rgE1jPEvW/DRf8= Received: from MW4PR04CA0102.namprd04.prod.outlook.com (2603:10b6:303:83::17) by SN7PR12MB8060.namprd12.prod.outlook.com (2603:10b6:806:343::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8511.19; Thu, 6 Mar 2025 16:45:25 +0000 Received: from SJ1PEPF00001CE6.namprd03.prod.outlook.com (2603:10b6:303:83:cafe::2b) by MW4PR04CA0102.outlook.office365.com (2603:10b6:303:83::17) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8511.17 via Frontend Transport; Thu, 6 Mar 2025 16:45:25 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by SJ1PEPF00001CE6.mail.protection.outlook.com (10.167.242.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8511.15 via Frontend Transport; Thu, 6 Mar 2025 16:45:25 +0000 Received: from rric.localdomain (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Thu, 6 Mar 2025 10:45:22 -0600 From: Robert Richter To: Alison Schofield , Vishal Verma , Ira Weiny , Dan Williams , Jonathan Cameron , Dave Jiang , Davidlohr Bueso CC: , , Gregory Price , "Fabio M. De Francesco" , Terry Bowman , Robert Richter Subject: [PATCH v4 05/14] cxl/region: Rename function to cxl_find_decoder_early() Date: Thu, 6 Mar 2025 17:44:39 +0100 Message-ID: <20250306164448.3354845-6-rrichter@amd.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250306164448.3354845-1-rrichter@amd.com> References: <20250306164448.3354845-1-rrichter@amd.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ1PEPF00001CE6:EE_|SN7PR12MB8060:EE_ X-MS-Office365-Filtering-Correlation-Id: 80a3d887-caa8-4f91-5c76-08dd5cce4b47 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|376014|7416014|1800799024|36860700013; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?u8u+Y73V/VEtHM6WwzkJXeUXl6OioF5kHJ1GBFFsEvFuNmQktBvxleEHrjzV?= =?us-ascii?Q?zklZU/Plk5DYaoxY3fes9VQlfrXzLH4W52O/fgGD9utY0aM6TCOFG181pFqz?= =?us-ascii?Q?zxqQ2COl3efxLI9yM9CcEsUSbtSIpZ0gvvtgnb1rJhe+zmeFr5lLWSKpZxNs?= =?us-ascii?Q?9wv05OXTb+R2bVCvpji3jAbYz529Pe9lyotRwcj/6kZJAbdtm0CnUF36qu55?= =?us-ascii?Q?ZvgMDi3Kr8LSQItmOwmTPF5OnFCxprVXXWcvuE4JQBJR+E16O7NOjHOvxzuO?= =?us-ascii?Q?GUZ6ZaUnxqmUlIuYmIHHZJqzIZh1q6bnwimrtBSFdAl7Kmblpb5oRD6gADT8?= =?us-ascii?Q?g8dM1RTzLfUGTI1eKqJGa+Hmp2RHTkk7/h7T/NT93FK4H2CPFsSnEkkCb3As?= =?us-ascii?Q?AOvy9r2+yh5xp2aR419vF+yIePjFhxCbeAqDyPRhSN2XCjSxJdknyc80rNXu?= =?us-ascii?Q?Qg248oDKsYMI5OTGNBEsk0qZYfd4OfRMlIioWns4Gk+7vsM/HuHDYTRw99ye?= =?us-ascii?Q?alEdgZIjZGlmULAVG9kSfjT7heNDI/U2kKAFJPJpQPRgJfUw3NUfa8imPw3N?= =?us-ascii?Q?DEdnlgry60y49+jszgNmHUYguoZYeHX0mmzdeISxEOlYwSVtNXqvhyqCSOGK?= =?us-ascii?Q?dBGeDF8L0OgfjgOp1zHY3bPw+C0fpyy4anVBjIUATFdVDRZ4FbiePSnxidyq?= =?us-ascii?Q?oBiN35p8w+B/LRSLNUwvXGwU80KQobG/XWz2juT3fuxoRXhe9n4SHLtBsjA7?= =?us-ascii?Q?oRFmHV49WBV0mnAiKd/2tWUerDgk/DqcCC7z0Jl0JLNaYO3m0NIsK7mSKyaI?= =?us-ascii?Q?MmfWazleVGIbnCkZrOdr4pMSjkDIKomXXDn+F3Ol/YZ0q0MzzPs4dG5uMOoJ?= =?us-ascii?Q?gXz7QoV2Ci9ejvrBiPv8fZ+vHTmJ76QyLQqVhvV1pg0pFcMCO3UuY9EvbP+u?= =?us-ascii?Q?UpPuNzuOfKjUQqfFd79QqYPXazej26XqjH+CYzvcwTZy4kCbHyLiZXPHG6GE?= =?us-ascii?Q?XZuDOsnUNxxhkQJ7wj00KKvfLzE2oDxoCPs5+Lg2+4bLywW2+1gxjhfXFCtK?= =?us-ascii?Q?d0lty+gBmXatxFx8IpN0IlHXjWe9qDm6QhGXubDqEeu2oy8QoBuT6zk0AXS1?= =?us-ascii?Q?reWNr1Otpn4zftz5Pk3fu+1vciW1AMxGiiILfEF5kNKuO7nlgOTPysemshfZ?= =?us-ascii?Q?MFMKdoc73hIHY/vqUxMsZ1wvYtwNySIKxyv4l2dweDjyNW7FAV7Xt79p1rvn?= =?us-ascii?Q?JTrPKmdD0SXH5yGuUwi2tYdkcMTe2c0IbPBRBB7ZH8e+I73TnKXoUGgAgsjQ?= =?us-ascii?Q?GiVoaIeHbtS6hjuRH77OXEpWfzfN9y42ia4j7PmU+TtTZIcRukE3ROqqVOcZ?= =?us-ascii?Q?x0YLNgxv8rdc7u+//iry1rkHOSy2AefA85o9wZqjzfz7G3FVxx33YTyGM7C1?= =?us-ascii?Q?DBZ0WuIb8DzO7+qALOTaDY2LVP6+Qffmavdz+5C+7GEAy9HCjtN88psCrmtN?= =?us-ascii?Q?O9iMrqTu/QDetwg=3D?= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(82310400026)(376014)(7416014)(1800799024)(36860700013);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Mar 2025 16:45:25.0745 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 80a3d887-caa8-4f91-5c76-08dd5cce4b47 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: SJ1PEPF00001CE6.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR12MB8060 Content-Type: text/plain; charset="utf-8" Current function cxl_region_find_decoder() is used to find a port's decoder during region setup. The decoder is later used to attach the port to a region. Rename function to cxl_find_decoder_early() to emphasize its use only during region setup in the early pre-init setup stage when an endpoint is not yet attached to a region (cxl_region_attach()). Once a port is attached to a region, the region reference can be used to lookup a region's port and decoder configuration (see struct cxl_region_ref). Signed-off-by: Robert Richter Reviewed-by: Gregory Price Tested-by: Gregory Price --- drivers/cxl/core/region.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/drivers/cxl/core/region.c b/drivers/cxl/core/region.c index 4f79cc17c9c8..e40ae0fefddc 100644 --- a/drivers/cxl/core/region.c +++ b/drivers/cxl/core/region.c @@ -865,10 +865,18 @@ static int match_auto_decoder(struct device *dev, con= st void *data) return 0; } =20 +/* + * Only use cxl_find_decoder_early() during region setup in the early + * pre-init setup stage when an endpoint is not yet attached to a + * region (cxl_region_attach()). Once a port is attached to a region, + * the region reference can be used to lookup a region's port and + * decoder configuration (see struct cxl_region_ref). +*/ + static struct cxl_decoder * -cxl_region_find_decoder(struct cxl_port *port, - struct cxl_endpoint_decoder *cxled, - struct cxl_region *cxlr) +cxl_find_decoder_early(struct cxl_port *port, + struct cxl_endpoint_decoder *cxled, + struct cxl_region *cxlr) { struct device *dev; =20 @@ -932,7 +940,7 @@ alloc_region_ref(struct cxl_port *port, struct cxl_regi= on *cxlr, if (test_bit(CXL_REGION_F_AUTO, &cxlr->flags)) { struct cxl_decoder *cxld; =20 - cxld =3D cxl_region_find_decoder(port, cxled, cxlr); + cxld =3D cxl_find_decoder_early(port, cxled, cxlr); if (auto_order_ok(port, iter->region, cxld)) continue; } @@ -1020,7 +1028,7 @@ static int cxl_rr_alloc_decoder(struct cxl_port *port= , struct cxl_region *cxlr, { struct cxl_decoder *cxld; =20 - cxld =3D cxl_region_find_decoder(port, cxled, cxlr); + cxld =3D cxl_find_decoder_early(port, cxled, cxlr); if (!cxld) { dev_dbg(&cxlr->dev, "%s: no decoder available\n", dev_name(&port->dev)); --=20 2.39.5 From nobody Sat Feb 7 06:13:30 2026 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2047.outbound.protection.outlook.com [40.107.236.47]) (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 1E89725486D; Thu, 6 Mar 2025 16:45:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.236.47 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741279539; cv=fail; b=S5raULfconUcPS/lmM3pjVXOo+EeQShDf4bzGc0RoEbjusmQG/6+HO/NaUrMgs/WLN6BrDnkAUoIw/aF74vFf+VdA5Bfp4H2m5QxyAdkDvnxPeP4xcZwRE+l2MQf3oIyvqXZfX829m3q2K3jJ69pue3+o3+nOtEbYXcmo585KOE= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741279539; c=relaxed/simple; bh=u1IvfuoNf/RVdz63/cWhWSSQDpJmpZrNCBkzIgK1Ny4=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=pzVaSM9cATyGu89Au36CCOjkA2erYEfz1pJf3Ls8HR80MOMvgzQ3SVjHNOLw53SqrWZL0TySOztwe+U4tPK65NmJWTXb5IRlsBvSuSU4mniGZ8kTAZILqwKP37eURkBGzwOakKcS71mX+Us/SwAzHyMkipduu9wEFxZwiCEykyI= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=k46Tpa7v; arc=fail smtp.client-ip=40.107.236.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="k46Tpa7v" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=R7T8HcBn5+8JU4h5h5kxhXdoDgeeZ9OCEwxKBveYoRYFyxq/lc3kI504U4/biIM8ARtCNaVPy0oeTk8yzVZZUx04b/z1frHErGQG9Wc9NYY5OhnHkQz2vblv239vstatIc5gDSCA0JmDmt1y4T8xGBDhopX4UoBP0eGWxsomZsqjcjlbtMNccGIRmPEdAtcZuJmCQPr7XWMfgzG1bxmkYEYM02HWvL4sqPq4AQL1XAT9hPgv3OPOF3rUwmu3ixOzKR3ccRnGECBbv8maLq75qFe5IQYI2SICNgyPJpJIyHC+i+hQRTUXauG2iSE95JSWtK8FLPlBnLShkm4+IvT2+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=KD+swixVqfBZ0kQEZPxPUcVQPWvZUVHz/vB2Lig+53w=; b=qQnY5OWWiiSJFYJXdwmhl+NoMKNSJ9Gl4hEdzjNXmPrn69QA26VV4FnOmnYV55fMOEPkLqHCizV6YRCnWW8mnHF9XhbNGqPZjVcKBhWUXy52oBC1x6JxoZPurN3U9Zb80cDS4v09LCPA5rwjdl2br9eQyHW5uTsep/qI3v0djlDoXl30KmZiOCiDQjlGUOEXXVAhqPZJjP+e8mpc5Xf14FgARX895mbiSeEXGZUwcuMKoTjoa8ReFAxDt8X074V7vaklqU6xqMONdlIVzhQuH+eYPM7/9b/TVMDv1OCJGIkZ8h/7jHsB8/TjrhAzmPe41R5cPOwQLSNYtovJfE4gaA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=intel.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=KD+swixVqfBZ0kQEZPxPUcVQPWvZUVHz/vB2Lig+53w=; b=k46Tpa7v/hLJO1ywXMqNa4iYNnOVaqdMmWLqwg6iobVvgLidFc5X57uT4cdSSXYGvSMMRt2pA86PSLa1lzC/W0auCPb7YEesAQ7e61LXf/wd1/GOc33llOYF4lVt18sZaTAgBhS1ZRSTtwc3uZq9qqfOHfqUWChsK1NxRPrhFis= Received: from MW4PR04CA0098.namprd04.prod.outlook.com (2603:10b6:303:83::13) by LV2PR12MB5775.namprd12.prod.outlook.com (2603:10b6:408:179::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8511.16; Thu, 6 Mar 2025 16:45:30 +0000 Received: from SJ1PEPF00001CE6.namprd03.prod.outlook.com (2603:10b6:303:83:cafe::dd) by MW4PR04CA0098.outlook.office365.com (2603:10b6:303:83::13) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8511.19 via Frontend Transport; Thu, 6 Mar 2025 16:45:29 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by SJ1PEPF00001CE6.mail.protection.outlook.com (10.167.242.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8511.15 via Frontend Transport; Thu, 6 Mar 2025 16:45:29 +0000 Received: from rric.localdomain (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Thu, 6 Mar 2025 10:45:25 -0600 From: Robert Richter To: Alison Schofield , Vishal Verma , Ira Weiny , Dan Williams , Jonathan Cameron , Dave Jiang , Davidlohr Bueso CC: , , Gregory Price , "Fabio M. De Francesco" , Terry Bowman , Robert Richter Subject: [PATCH v4 06/14] cxl/region: Avoid duplicate call of cxl_find_decoder_early() Date: Thu, 6 Mar 2025 17:44:40 +0100 Message-ID: <20250306164448.3354845-7-rrichter@amd.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250306164448.3354845-1-rrichter@amd.com> References: <20250306164448.3354845-1-rrichter@amd.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ1PEPF00001CE6:EE_|LV2PR12MB5775:EE_ X-MS-Office365-Filtering-Correlation-Id: 8803069a-0e32-4157-cb3b-08dd5cce4dbc X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|7416014|376014|36860700013|1800799024; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?BsAGoTZH7/NyOLBuZuv1aZxhDty5w0+8Wpt/6qI6PDnGrlR+ZZdsnpj4ekTd?= =?us-ascii?Q?TRFO1R7AZk9oZX9atg97MRVBHFRNyMSm3uWHdVuI1HkMfC4bH75QsViiu8Lx?= =?us-ascii?Q?tQRuEuSLpL6MmaciIZQvDyYKw2VKNeW5CcupiAPevTo1SIogsKpQD34kWVei?= =?us-ascii?Q?av5evFhlSy82bMJFlE2mdLsHjjUiFfqyJ6KAj61yOi1D25CHi/niBBf3vYjS?= =?us-ascii?Q?WMQquSCQlYyDV0tPgJCq8eIU+xs84BkpWcgQSxoa22fd3RuqFvl1SjzPP5QO?= =?us-ascii?Q?vdXctFgX7X31TyFYHg98qySbBFVtO42evtkMS8ImRHUAC4vGi+PwyI+ivaev?= =?us-ascii?Q?BSGDqKcI2nHGQl3w2X67Se450OYOZHO+irvpDXLpRGrOBlvnOujPp6blHhqS?= =?us-ascii?Q?oZwjyKZYM9NJoonA250UGHQK8dOkSo7lLYL7uZHbZ1oDqqCpohB4pCUsSCsf?= =?us-ascii?Q?MvSzhxxwBCX+KXwg/xTkFJHdmBRI5lsNUya38SIpyYNGp0XYRrUj9E6Ntf61?= =?us-ascii?Q?ZFnHFFGHzHAop0zEfxRodU7M8tpsi86rfNGcFzVwCD9tVgQSboiDlgx5PZYZ?= =?us-ascii?Q?ABXo/f+OVChONfrdzSmplqijfZFQ8YBA1/3B/h1HEpTmhJI7rdQeYhycmH1A?= =?us-ascii?Q?HUw05VIMVOzKdhgT0kvbRELlvh4fnf8+ZWhITHP3HFNbOQCSXa4Cupe2AwtY?= =?us-ascii?Q?lm/OisYRaSBgesk6KH7gafsKoIYZCEEMx7c4H01TpmjrmEthT+xk+Mxhbssp?= =?us-ascii?Q?0EvMHRQ/vs3I2OXmNSV1uPeq3dP8MaEeouiCBy5Pu7FPyWyW5pVGIY1jz8bM?= =?us-ascii?Q?Oke6v+BgqyTBb1Lhtr9rSJKWlJAtMWe8xRgknNfPiXzcJfuQ4T5YiUdMTg+V?= =?us-ascii?Q?VsMCa/kl04Rmuj2XwNcrykAArw2XUTcRHutVN1+zWQqNEjcQg5/0UHSMZL0f?= =?us-ascii?Q?f/rtqHDGqx8jtnwZ+10142tqWSfYPFG/VsTMU+uCuaOfEHiGLzOqik1rpl7v?= =?us-ascii?Q?HKs9kIIKZM4FXFtX1knEfQYjbgT2XKbvyh/DG/sya1Vyp5WhZcrWCN149ecZ?= =?us-ascii?Q?i1+6PsEvQ+aLhh3D4wC//c1wphJ5Vwg3OgrZLq/FeirCqMsuHc22RM6zefg/?= =?us-ascii?Q?l7tTgU2sakwfbpXYM3fgn/yOfKALMi92PrKZM2k7MQJdEp80HHxWk/gjxNCh?= =?us-ascii?Q?EmBnMsFNKRn7XMFJXWrW3rojNLAAQZ9INiW/zOZiA1wkz1WS/pq54mPo8iyf?= =?us-ascii?Q?AnmyAWmsovSCcNaGdGLxt283JBQz/09eWZvsrrEDVVaWb4oduMrgSdiw48i5?= =?us-ascii?Q?s4GGBN79ErK2ZJ5SXcqfAFQMTqOBz0ZZjZvPldVDpwnoxlNC5ViUxv6I8mdp?= =?us-ascii?Q?iIw6k+Kaom7xWqmwVYeLqKgHIf4sPhTAF5rmQtsZrbnSTbzzL3VZ/she+B+g?= =?us-ascii?Q?QVHBct8fFSn6V3bYKhSrTTn3N8FchgW/690SxbOk04bMWoQ0xRd1hTiVZqvX?= =?us-ascii?Q?u8V9Fa/Zm5esTnU=3D?= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(82310400026)(7416014)(376014)(36860700013)(1800799024);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Mar 2025 16:45:29.1996 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8803069a-0e32-4157-cb3b-08dd5cce4dbc X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: SJ1PEPF00001CE6.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV2PR12MB5775 Content-Type: text/plain; charset="utf-8" Function cxl_find_decoder_early() is called twice, in alloc_region_ref() and cxl_rr_alloc_decoder(). Both functions are subsequently called from cxl_port_attach_region(). Make the decoder a function argument to both which avoids a duplicate call of cxl_find_decoder_early(). Moving the call out of alloc_region_ref() also moves it out of the xa_for_each() loop in there. Now, cxld is determined no longer only for each auto-generated region, but now once for all regions regardless of auto-generated or not. This is fine as the cxld argument is needed for all regions in cxl_rr_alloc_decoder() and an error would be returned otherwise anyway. So it is better to determine the decoder in front of all this and fail early if missing instead of running through all that code with multiple calls of cxl_find_decoder_early(). Signed-off-by: Robert Richter Reviewed-by: Gregory Price Tested-by: Gregory Price --- drivers/cxl/core/region.c | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/drivers/cxl/core/region.c b/drivers/cxl/core/region.c index e40ae0fefddc..5a7a1dd583aa 100644 --- a/drivers/cxl/core/region.c +++ b/drivers/cxl/core/region.c @@ -924,7 +924,8 @@ static bool auto_order_ok(struct cxl_port *port, struct= cxl_region *cxlr_iter, =20 static struct cxl_region_ref * alloc_region_ref(struct cxl_port *port, struct cxl_region *cxlr, - struct cxl_endpoint_decoder *cxled) + struct cxl_endpoint_decoder *cxled, + struct cxl_decoder *cxld) { struct cxl_region_params *p =3D &cxlr->params; struct cxl_region_ref *cxl_rr, *iter; @@ -938,9 +939,6 @@ alloc_region_ref(struct cxl_port *port, struct cxl_regi= on *cxlr, continue; =20 if (test_bit(CXL_REGION_F_AUTO, &cxlr->flags)) { - struct cxl_decoder *cxld; - - cxld =3D cxl_find_decoder_early(port, cxled, cxlr); if (auto_order_ok(port, iter->region, cxld)) continue; } @@ -1024,17 +1022,9 @@ static int cxl_rr_ep_add(struct cxl_region_ref *cxl_= rr, =20 static int cxl_rr_alloc_decoder(struct cxl_port *port, struct cxl_region *= cxlr, struct cxl_endpoint_decoder *cxled, - struct cxl_region_ref *cxl_rr) + struct cxl_region_ref *cxl_rr, + struct cxl_decoder *cxld) { - struct cxl_decoder *cxld; - - cxld =3D cxl_find_decoder_early(port, cxled, cxlr); - if (!cxld) { - dev_dbg(&cxlr->dev, "%s: no decoder available\n", - dev_name(&port->dev)); - return -EBUSY; - } - if (cxld->region) { dev_dbg(&cxlr->dev, "%s: %s already attached to %s\n", dev_name(&port->dev), dev_name(&cxld->dev), @@ -1125,7 +1115,16 @@ static int cxl_port_attach_region(struct cxl_port *p= ort, nr_targets_inc =3D true; } } else { - cxl_rr =3D alloc_region_ref(port, cxlr, cxled); + struct cxl_decoder *cxld; + + cxld =3D cxl_find_decoder_early(port, cxled, cxlr); + if (!cxld) { + dev_dbg(&cxlr->dev, "%s: no decoder available\n", + dev_name(&port->dev)); + return -EBUSY; + } + + cxl_rr =3D alloc_region_ref(port, cxlr, cxled, cxld); if (IS_ERR(cxl_rr)) { dev_dbg(&cxlr->dev, "%s: failed to allocate region reference\n", @@ -1134,7 +1133,7 @@ static int cxl_port_attach_region(struct cxl_port *po= rt, } nr_targets_inc =3D true; =20 - rc =3D cxl_rr_alloc_decoder(port, cxlr, cxled, cxl_rr); + rc =3D cxl_rr_alloc_decoder(port, cxlr, cxled, cxl_rr, cxld); if (rc) goto out_erase; } --=20 2.39.5 From nobody Sat Feb 7 06:13:30 2026 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2089.outbound.protection.outlook.com [40.107.94.89]) (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 EDD2E257437; Thu, 6 Mar 2025 16:45:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.94.89 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741279546; cv=fail; b=iJmcpe3TcZbtC5u0uQ/jfBpClsBj6T04aOzrPvqq88JD+xLHR9MPWP+gIx3ivQIeHd6zDZtmPAwDDPdLJVfQCoXccJBdGsIKdimrvfu8a6ylG5SV2PAlnFBS2mp0A2kti8KdY9E/dGFuv5Mh2wNnbK2fpCZjmbAO87vDquK3eaM= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741279546; c=relaxed/simple; bh=UFQBkuxJzFs4K7cZmG9oqlaVqczn1YQC/9dqAyRl67c=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=oEzeOQt7xOaqSGCjNq21ULvM0jOCVZTz2jPzIj5LSrK352jv2kgDC0C4cPEMD02jYfpC+xTGTiEHD1iMVJNke9dJIINqiuFMIue0oqGGI5zqMUea4wlk+mBubp5sAcoycd5oghzwtTpAjsMtBIUNuS48MfB1j40DA0ix39tM2hM= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=J21MGZDq; arc=fail smtp.client-ip=40.107.94.89 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="J21MGZDq" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=K18UrPyXj4fMtE2dDMBys8LIXh5g90208ra+0XlmDDTZ6XL5NQSOxYAtDXrY3nw5JGOKsU0F29i+kxYb8H1l48sfQHVogS6JCDShZpGgyM431CFFzp9S2KOKkKTJmwXdAvgFQNImQuQgcR7KRQZeYrGrZhl7AUbKR9c0f5ZG5q1qbXQUVm+toY4P1eHSie6l2b4aWuyJuRjsBPm6ywZ7LISwABCoxQZ+ybzCaxqE1IDEFRo9FwoxMpXORjdNKEFlWD+mc3xI+aJn4eadzcSc4pK0Nw4ILHRgrPAYBzi3oCmUz2e6IX6h+pbfHpI/VSP6rCL0CfarwweHr/kmXzgwZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=O6Cil00/1reT36SE53vypkTZFVkHsLvsqdGmgM0Tf6s=; b=ASPmQk7OroPWo9wWWWj7kMCggraPdYzPLhlUHAD5Pn4kySB9XwQaM/UrKauKfuUh3b6JzcTEoCjKNefdUPd19Gdqj56dlEcfS60+TS2RSHu0R+3NgQ90szl4NDMuNKwRm33W+lNKh+T9yENhvXf7J8+kJrzDeYqTJ5mILLLZVAuSJoyNfQdKAQ986nnOFqgnVn5iXJ/vfrhAXUkfapMEStzbVxKvOl54csTA+7PZbtaKC7mTEEc9P4GMWKNfN0DbsZQhc9NRnVsAbVd4hrGvc3+Kc7rUyrd1hGOQiKTGCmLRdR/3Jjin0q/iZRpx4lltwosLMU6IDHAhkoNz4bZy6w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=intel.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=O6Cil00/1reT36SE53vypkTZFVkHsLvsqdGmgM0Tf6s=; b=J21MGZDqk/+T7ahr3KkcztDTLHILwP+/PwvNw1GnslvpqzjAlWw2DuHVtLvS71X04KRYmK6DgVFrvyXyCzBLBYJIiTb11M8tw6rTdZkO+nifbnOW2mmN2UcEH7CJzA3jik57wl9qzza6tGiTe7ZdOigCJSPR9FcfIkCfUoEt3y4= Received: from MW4PR04CA0110.namprd04.prod.outlook.com (2603:10b6:303:83::25) by CY8PR12MB7681.namprd12.prod.outlook.com (2603:10b6:930:84::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8511.18; Thu, 6 Mar 2025 16:45:39 +0000 Received: from SJ1PEPF00001CE6.namprd03.prod.outlook.com (2603:10b6:303:83:cafe::1a) by MW4PR04CA0110.outlook.office365.com (2603:10b6:303:83::25) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8511.19 via Frontend Transport; Thu, 6 Mar 2025 16:45:37 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by SJ1PEPF00001CE6.mail.protection.outlook.com (10.167.242.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8511.15 via Frontend Transport; Thu, 6 Mar 2025 16:45:37 +0000 Received: from rric.localdomain (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Thu, 6 Mar 2025 10:45:29 -0600 From: Robert Richter To: Alison Schofield , Vishal Verma , Ira Weiny , Dan Williams , Jonathan Cameron , Dave Jiang , Davidlohr Bueso CC: , , Gregory Price , "Fabio M. De Francesco" , Terry Bowman , Robert Richter Subject: [PATCH v4 07/14] cxl/region: Move find_cxl_root() to cxl_add_to_region() Date: Thu, 6 Mar 2025 17:44:41 +0100 Message-ID: <20250306164448.3354845-8-rrichter@amd.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250306164448.3354845-1-rrichter@amd.com> References: <20250306164448.3354845-1-rrichter@amd.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ1PEPF00001CE6:EE_|CY8PR12MB7681:EE_ X-MS-Office365-Filtering-Correlation-Id: 7494ce1d-3256-4ce8-a726-08dd5cce52c6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|1800799024|36860700013|7416014|376014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?WDEkyVWHx8KY6uRnTEOJ+/8JAqgIl6SUKG/0Wqd3XWFCwC+sbCmY5fAFYTHf?= =?us-ascii?Q?mCXtkZ8N1uSPUJMDflRc/t6Z+MZcUk1Yq0Vej5BSmn+SRKfY5GjgEszugaIw?= =?us-ascii?Q?/zWSg4caHeTsinfZ3E2FEhTcj+HZln844ks2yWoYRmSxTh2oSI83LY8odtZ7?= =?us-ascii?Q?6CPVibMCZdCGGPCvIe4/wcillDBAXIHYA8rApiZnbj7wy8roSHV/XVTwBgQk?= =?us-ascii?Q?Geii2IArNEwkxdD0Ep6Y0ayiKpKANs4bxSUOLlWWmBqcyNOLVRbhtQt7NXQ8?= =?us-ascii?Q?2sBwBsaCfhwoxZEa6iddvfsNQzXr9ch0A6NHbdOTaAMw26dTDi5HIDNqQs55?= =?us-ascii?Q?NGyghZ0PtnwuZJaLx9B4dfLpYjKCX+4O+hjNF7zxcR6Ll4DaMbQY2HMCTEy1?= =?us-ascii?Q?3yBfOGTzrsdS0LsYxLU4pDmhfNkSFcfBE++YMqi7w2OONhYBtz5RBbHrKK7f?= =?us-ascii?Q?4bKWPPh5vTe9TaWFoYPf+TzIwKjhpdvO0UA6hdr6QUif1BJyQZnb/RHjPqgB?= =?us-ascii?Q?7kV56wmGbt30nvb0L6Gv6cAldGXu56Mh+imIUgDmYCxS5eYe3mjB4JTbEp37?= =?us-ascii?Q?J5Ymvy7gQRR3zoKWOSUtwOZxitpCjal43GRfMvWS7+QdeVN8U1O1d5BLASPo?= =?us-ascii?Q?6RXDWrAm6drGc77NotmA0NEzFMS5+jdehPBduWMFsIYwWtzm1sBzUH41pRR/?= =?us-ascii?Q?AvzxQvQ4wOyCXBSXA1NBxP+iuezuV68PD9gFXxIBtvfvRXqhvcTLMxrFKXkk?= =?us-ascii?Q?mmzh5PwFuwMnvay6xopAZLfWSsMG3dOUu/r87pIThCDBOto8OTgs8e7H0KOn?= =?us-ascii?Q?CHLlQ/7FSM2076kgdAk47lCKVXcsju9pH2AFLKMli4nFtgVWoaI551rrIAlg?= =?us-ascii?Q?yNSInh0a1Omy5RNtLAZbYC+Mrx0abQkfKgJBwt3zyWu8IvWYfgS7+UOoC5sc?= =?us-ascii?Q?/3GcCNwWBFXgvrNhruRV89w2thA865+/mpV1NYiM06S7scSvkTomvMfC5fnS?= =?us-ascii?Q?rFnnPTPiKPiAmh6x96NYJf2f27MinE6kOEbUs0sV+RcjzjO5ywnJqylUjTvi?= =?us-ascii?Q?PEZ87iuRZdYcLopD/jZQr0L804lDTbU0q2OYVyDOLIELzwlHEh5EeBi36cJz?= =?us-ascii?Q?v5X8YSPQmdPRmOV6H/V63Y9NEFPqKLucPN/UdA4v+VwyvxAvfQRCe9/j4tHC?= =?us-ascii?Q?ICjxwaDOIsftvyxczdLzdflvAZ2Ap4dXDs0by48i3W11BXVZOHIgVFovwCom?= =?us-ascii?Q?bcx0DhzPPOC+KJBakNw8O+E2YCDZZhGpSm2dYHwyEH1jcmPZTviAQ2aiCjeV?= =?us-ascii?Q?pSGxO8liJiW+rRvgELjZHNPmPxRhDW1En0DR0zWsceK4sMhClk7TEuxpE9m/?= =?us-ascii?Q?jgIVbWHRSUeRQziNbZbYXzAI4bwWsdz4SEp3BcKmjiOb8b7hcfrOlZRef1Pk?= =?us-ascii?Q?UUWlcj98C3DbVpQethx1Su9w07ZFf3upRyveHws6VyLL6Z6NHnxPW2OkvEM6?= =?us-ascii?Q?1pM4aU1B3tuXo/U=3D?= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(82310400026)(1800799024)(36860700013)(7416014)(376014);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Mar 2025 16:45:37.6528 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7494ce1d-3256-4ce8-a726-08dd5cce52c6 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: SJ1PEPF00001CE6.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR12MB7681 Content-Type: text/plain; charset="utf-8" When adding an endpoint to a region, the root port is determined first. Move this directly into cxl_add_to_region(). This is in preparation of the initialization of endpoints that iterates the port hierarchy from the endpoint up to the root port. As a side-effect the root argument is removed from the argument lists of cxl_add_to_region() and related functions. Now, the endpoint is the only parameter to add a region. This simplifies the function interface. Signed-off-by: Robert Richter Reviewed-by: Gregory Price Reviewed-by: Jonathan Cameron Reviewed-by: Dave Jiang Tested-by: Gregory Price Reviewed-by: Alison Schofield Reviewed-by: Dan Williams Reviewed-by: Fabio M. De Francesco --- drivers/cxl/core/region.c | 6 ++++-- drivers/cxl/cxl.h | 6 ++---- drivers/cxl/port.c | 15 +++------------ 3 files changed, 9 insertions(+), 18 deletions(-) diff --git a/drivers/cxl/core/region.c b/drivers/cxl/core/region.c index 5a7a1dd583aa..8244a27d0fd6 100644 --- a/drivers/cxl/core/region.c +++ b/drivers/cxl/core/region.c @@ -3384,9 +3384,11 @@ static struct cxl_region *construct_region(struct cx= l_root_decoder *cxlrd, return cxlr; } =20 -int cxl_add_to_region(struct cxl_port *root, struct cxl_endpoint_decoder *= cxled) +int cxl_add_to_region(struct cxl_endpoint_decoder *cxled) { struct cxl_memdev *cxlmd =3D cxled_to_memdev(cxled); + struct cxl_port *port =3D cxled_to_port(cxled); + struct cxl_root *cxl_root __free(put_cxl_root) =3D find_cxl_root(port); struct range *hpa =3D &cxled->cxld.hpa_range; struct cxl_decoder *cxld =3D &cxled->cxld; struct device *cxlrd_dev, *region_dev; @@ -3396,7 +3398,7 @@ int cxl_add_to_region(struct cxl_port *root, struct c= xl_endpoint_decoder *cxled) bool attach =3D false; int rc; =20 - cxlrd_dev =3D device_find_child(&root->dev, &cxld->hpa_range, + cxlrd_dev =3D device_find_child(&cxl_root->port.dev, &cxld->hpa_range, match_root_decoder_by_range); if (!cxlrd_dev) { dev_err(cxlmd->dev.parent, diff --git a/drivers/cxl/cxl.h b/drivers/cxl/cxl.h index 24cec16d02a6..960efcc60476 100644 --- a/drivers/cxl/cxl.h +++ b/drivers/cxl/cxl.h @@ -857,8 +857,7 @@ struct cxl_nvdimm_bridge *cxl_find_nvdimm_bridge(struct= cxl_port *port); #ifdef CONFIG_CXL_REGION bool is_cxl_pmem_region(struct device *dev); struct cxl_pmem_region *to_cxl_pmem_region(struct device *dev); -int cxl_add_to_region(struct cxl_port *root, - struct cxl_endpoint_decoder *cxled); +int cxl_add_to_region(struct cxl_endpoint_decoder *cxled); struct cxl_dax_region *to_cxl_dax_region(struct device *dev); u64 cxl_port_get_spa_cache_alias(struct cxl_port *endpoint, u64 spa); #else @@ -870,8 +869,7 @@ static inline struct cxl_pmem_region *to_cxl_pmem_regio= n(struct device *dev) { return NULL; } -static inline int cxl_add_to_region(struct cxl_port *root, - struct cxl_endpoint_decoder *cxled) +static inline int cxl_add_to_region(struct cxl_endpoint_decoder *cxled) { return 0; } diff --git a/drivers/cxl/port.c b/drivers/cxl/port.c index d2bfd1ff5492..74587a403e3d 100644 --- a/drivers/cxl/port.c +++ b/drivers/cxl/port.c @@ -30,7 +30,7 @@ static void schedule_detach(void *cxlmd) schedule_cxl_memdev_detach(cxlmd); } =20 -static int discover_region(struct device *dev, void *root) +static int discover_region(struct device *dev, void *unused) { struct cxl_endpoint_decoder *cxled; int rc; @@ -49,7 +49,7 @@ static int discover_region(struct device *dev, void *root) * Region enumeration is opportunistic, if this add-event fails, * continue to the next endpoint decoder. */ - rc =3D cxl_add_to_region(root, cxled); + rc =3D cxl_add_to_region(cxled); if (rc) dev_dbg(dev, "failed to add to region: %#llx-%#llx\n", cxled->cxld.hpa_range.start, cxled->cxld.hpa_range.end); @@ -95,7 +95,6 @@ static int cxl_endpoint_port_probe(struct cxl_port *port) struct cxl_memdev *cxlmd =3D to_cxl_memdev(port->uport_dev); struct cxl_dev_state *cxlds =3D cxlmd->cxlds; struct cxl_hdm *cxlhdm; - struct cxl_port *root; int rc; =20 rc =3D cxl_dvsec_rr_decode(cxlds, &info); @@ -126,19 +125,11 @@ static int cxl_endpoint_port_probe(struct cxl_port *p= ort) if (rc) return rc; =20 - /* - * This can't fail in practice as CXL root exit unregisters all - * descendant ports and that in turn synchronizes with cxl_port_probe() - */ - struct cxl_root *cxl_root __free(put_cxl_root) =3D find_cxl_root(port); - - root =3D &cxl_root->port; - /* * Now that all endpoint decoders are successfully enumerated, try to * assemble regions from committed decoders */ - device_for_each_child(&port->dev, root, discover_region); + device_for_each_child(&port->dev, NULL, discover_region); =20 return 0; } --=20 2.39.5 From nobody Sat Feb 7 06:13:30 2026 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2051.outbound.protection.outlook.com [40.107.220.51]) (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 12E97255E55; Thu, 6 Mar 2025 16:45:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.220.51 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741279547; cv=fail; b=qM3wR10lX6SaPv+YdBap5RZ85W1WxWgLEWjqD8OYLaZnsIMeOYEVwpVUSY9bF20ZoVSqJlpJBESbNzPwdZedWiv2jSufAh5vG4e1Ob8YCFdvwrbO5WBJj4Q4qo+g3OZWSkjlkF8y9oSr8zeS0S2J5Zx1fTWFstq6qWoyyyvraUw= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741279547; c=relaxed/simple; bh=A7h+AtL8PaQpBjh05QIpuieTYJ/qglI42/UV7vkyxAI=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=tkt7PC/V6q9GcJpHjBFpMa7UYORDiwVsvLHa2gxQFv8NXR3ECFsFPxhxeFJuYSEHdbIeZBDsQPGW0nSF4iGkJMBiq+3f7yZ7PL0rvG/9TxZfitvVNsfrCtBBVLIt/FKqRwhNfvRkH9I5Wa8vUhbIu5gp3c5av0ubeKAN3XAMBJc= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=hoeXtYuU; arc=fail smtp.client-ip=40.107.220.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="hoeXtYuU" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=EPp89iSfIsBM3xocotl0yDKGCMHeJAOiaJWBhNfSHQvYpcO/1HBz80Nl9+qbm6rIdXW7yYe5TAKCEqCuoeGAmK4xOu7ySx43ozvCsBkVc49Z2tIP7fidK2BPoKX+vzNkUl1UXYYupqPBkpdWXEC+sd77dV812HpHdfxbGlbhsCgL/kYe1ELuaFrPEMeMILBt0XAZoH/5xaFT4EW53ydkNsi031JC1jP8rMFe+d76WihAATrAUgPUlIr1XuIvbv1kIM7dKbsFNtQnk9wSPjwFPl8tFbDs10LkPiUpo7cINnJjdlSho4CCJsvzxANwO04DT5gvo8TTFks0CKzaTusJ+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=kZz5DJq4v6ay1Geg1DjXJxJGLS8WFfoNIC+nmrAgyvE=; b=o43A52FvtQm02P/BKHX2zoNE+eyb9o5AGZNeU3Xr/fHy61rgj7K4ng4L0EIabiy5ki6Z597tFs+tn7pZTsNYuvQ3IPPOEEEp4Goq4RfY9b28b2UKC2zUJNDPOoxcn+gb8AjJTEsWjLe2WJv/4H3EdnfJbYlPZa0+0zbW/V7WA/yUUH/eMnzynkI1/0p6o+KAMufiBn1RfBP4Q1rZ/UATNgPzxQxtxgayGysTAnR/vWeVamInj41xxyZ+JKNqpCHRiq+arLIntVTbkuc/LFazio7qcJd1fTXxyMS6icGth2QFrQAVdy9MZbbC8WqsNatI1Rzj8H4iHujrzzEIng4pcw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=intel.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=kZz5DJq4v6ay1Geg1DjXJxJGLS8WFfoNIC+nmrAgyvE=; b=hoeXtYuUj2BBQYYx1gZPjPZgMVpBnlMoPU2UtKYH45Gusm6o44or6nctZFhKbU8w8VUtWyucGZngpCy6A6RyYF1OytCZIoBPzDzWR445vdkJuMUX5F9EX5Nbnb7dfsugq+zyald0I/lUSFlG2s28H1n1fgqpHnasPvwWRTs+cZ4= Received: from MW4PR04CA0120.namprd04.prod.outlook.com (2603:10b6:303:83::35) by SN7PR12MB6932.namprd12.prod.outlook.com (2603:10b6:806:260::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8511.19; Thu, 6 Mar 2025 16:45:42 +0000 Received: from SJ1PEPF00001CE6.namprd03.prod.outlook.com (2603:10b6:303:83:cafe::bb) by MW4PR04CA0120.outlook.office365.com (2603:10b6:303:83::35) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8511.18 via Frontend Transport; Thu, 6 Mar 2025 16:45:42 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by SJ1PEPF00001CE6.mail.protection.outlook.com (10.167.242.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8511.15 via Frontend Transport; Thu, 6 Mar 2025 16:45:41 +0000 Received: from rric.localdomain (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Thu, 6 Mar 2025 10:45:36 -0600 From: Robert Richter To: Alison Schofield , Vishal Verma , Ira Weiny , Dan Williams , Jonathan Cameron , Dave Jiang , Davidlohr Bueso CC: , , Gregory Price , "Fabio M. De Francesco" , Terry Bowman , Robert Richter Subject: [PATCH v4 08/14] cxl/region: Factor out code to find the root decoder Date: Thu, 6 Mar 2025 17:44:42 +0100 Message-ID: <20250306164448.3354845-9-rrichter@amd.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250306164448.3354845-1-rrichter@amd.com> References: <20250306164448.3354845-1-rrichter@amd.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ1PEPF00001CE6:EE_|SN7PR12MB6932:EE_ X-MS-Office365-Filtering-Correlation-Id: 526bd804-c356-4cd6-3ce9-08dd5cce5543 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|376014|7416014|1800799024|82310400026; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?1y2wp6x/m5yGMjT6udF4YsZcgt5lTYGi+dMgjWPIKNFsfehYlVJUXYgrHZTr?= =?us-ascii?Q?uwY1EzOfpDBgJK01I7lIeW9EZ+mAZnk6JrPoKdHVj7DHDe7QesRMdHA2UrfB?= =?us-ascii?Q?qLRaDhbMMc14TE2PsGELgNSXipgEZv0nY3Zp/ye9IOGOWaE8e3nViYG3+EXW?= =?us-ascii?Q?myh58vQbLj9wGC8Zm5ao6QlB48qK5ccoe1YyZBv6PrXqojMwSCSjOoKwnJsj?= =?us-ascii?Q?USP0g9nADaAmOEmq8Dy1q1CCT46UwpIrwQKbjfSEENoBMkTrVS/jObZf9ntm?= =?us-ascii?Q?0LxDPnuRWIbbag+molNnwsqdn2p1zR3PDQYmczk3g9nK3FknrPt/rdlW4kyr?= =?us-ascii?Q?JMRdrKzT0wVbbGJjZ+rvoNT/AXvYtFHGHJ2v6orrMMy1q2MgSWxCCx38A6c8?= =?us-ascii?Q?L6Jie8jByqFNKAlUVRcuLYPFJ943qD8guByT7C8Lu6bBAi4ToTb6VcFz/IKe?= =?us-ascii?Q?6hTCBnH2aXcFT3ccGO5ihAtZ2+3+1pVWeTowp2wrZRVTT3+rQnlCS/6MyP3b?= =?us-ascii?Q?fiUA1RC2sckRVpE61tMnWO2d6wV4iFKE/OSWkUX6G5pB26gfiF4FatFHiyNB?= =?us-ascii?Q?qe5tYfV5euYiC64kpFSzabXxHXlN4c3ygBrMoJmpETAPSH4KorLcsJfj+ruJ?= =?us-ascii?Q?MbYoRX+UR6+alz+dvJXL64Z1uy5NvWIC9IEElmwm5bv1+5k4NmqTBpVmEjHk?= =?us-ascii?Q?QOfAYCmYZPT0tar15aU5l4zIG3RU9ZMDezgq4GwTFKOTuzD/HX2r7yntnhiw?= =?us-ascii?Q?WT3uTPzE/6OUmQJpGtqVwOMLFs6gtaHGKcRQHd8SWKvyRxR0icJBxUYj9Xth?= =?us-ascii?Q?skUrxJQLXt/lMNVHiqa9b1KuQq1KwPUHGvyt4q9lKDXCc4W9dcfIVqlOo0jw?= =?us-ascii?Q?lJL6Bp5JEB2ZOqZIUkr4jBzV9efQLhiOuLLFcjNgprB6ruYA0S6WZz3NHFaK?= =?us-ascii?Q?cqd/Ho/FsVeAv/Vt1LXRNlVibH+tt0WNvJ6LG74yNtEQpjY9A8HEFoAJuPXB?= =?us-ascii?Q?bLD27f3Vi/lkW7q7hs63UrfLkzN+46GlQ5Sqgik3gD/AbVMMaMIN1gYpAr5w?= =?us-ascii?Q?OxHvuvhc71EIFH5lvQ4jQi5ax5l240zgOGMnA7RC8hRELSkGDIRIv50Qj/DZ?= =?us-ascii?Q?cmLv2uGhKjxqXs8FPqxAPpv2eSbJp4K0yLiWiSAUKkCwfkICAR84IQ/gJVSy?= =?us-ascii?Q?JijG3j1+dqd4x1bhAimKMjFTs5gmIfCxsThrwXywBABic+erN9NqaavPnuwl?= =?us-ascii?Q?+H4T01V73gxn6oyZ0wUlfvVu4mkHbeN6uLjFfyJdoO21oBfPVd03CE8cP68b?= =?us-ascii?Q?j1MixAGSIwdr+NIZ/hVL2AEcdi574S1Fqk5ig2BJVYRDg3JMNKLRD6k8tZi4?= =?us-ascii?Q?gdkidfAXLmIGBgBw156Te1o2QnjPQw73u+CnYq1vZbyd56gycEYbva3IgU2F?= =?us-ascii?Q?qG6RFdfYXlWLIo7/r8vuYP+nkPPrwNxiqIeb58xG3hD6HlKFrx4tZieIPtpd?= =?us-ascii?Q?t7gn4ihh0qZOQHc=3D?= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(36860700013)(376014)(7416014)(1800799024)(82310400026);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Mar 2025 16:45:41.8247 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 526bd804-c356-4cd6-3ce9-08dd5cce5543 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: SJ1PEPF00001CE6.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR12MB6932 Content-Type: text/plain; charset="utf-8" In function cxl_add_to_region() there is code to determine the root decoder associated to an endpoint decoder. Factor out that code for later reuse. This has the benefit of reducing cxl_add_to_region()'s function complexity. The reference of cxlrd_dev can be freed earlier. Since the root decoder exists as long as the root port exists and the endpoint already holds a reference to the root port, this additional reference is not needed. Though it looks obvious to use __free() for the reference of cxlrd_dev here too, this is done in a later rework. So just move the code. Signed-off-by: Robert Richter Reviewed-by: Gregory Price Reviewed-by: Jonathan Cameron Reviewed-by: Dave Jiang Tested-by: Gregory Price Reviewed-by: Alison Schofield Reviewed-by: Dan Williams Reviewed-by: Fabio M. De Francesco --- drivers/cxl/core/region.c | 55 ++++++++++++++++++++++++++------------- 1 file changed, 37 insertions(+), 18 deletions(-) diff --git a/drivers/cxl/core/region.c b/drivers/cxl/core/region.c index 8244a27d0fd6..7d9d9b8f9eea 100644 --- a/drivers/cxl/core/region.c +++ b/drivers/cxl/core/region.c @@ -3212,6 +3212,38 @@ static int match_root_decoder_by_range(struct device= *dev, return range_contains(r1, r2); } =20 +static struct cxl_root_decoder * +cxl_find_root_decoder(struct cxl_endpoint_decoder *cxled) +{ + struct cxl_memdev *cxlmd =3D cxled_to_memdev(cxled); + struct cxl_port *port =3D cxled_to_port(cxled); + struct cxl_root *cxl_root __free(put_cxl_root) =3D find_cxl_root(port); + struct cxl_decoder *cxld =3D &cxled->cxld; + struct range *hpa =3D &cxld->hpa_range; + struct device *cxlrd_dev; + + cxlrd_dev =3D device_find_child(&cxl_root->port.dev, hpa, + match_root_decoder_by_range); + if (!cxlrd_dev) { + dev_err(cxlmd->dev.parent, + "%s:%s no CXL window for range %#llx:%#llx\n", + dev_name(&cxlmd->dev), dev_name(&cxld->dev), + cxld->hpa_range.start, cxld->hpa_range.end); + return NULL; + } + + /* + * device_find_child() created a reference to the root + * decoder. Since the root decoder exists as long as the root + * port exists and the endpoint already holds a reference to + * the root port, this additional reference is not needed. + * Free it here. + */ + put_device(cxlrd_dev); + + return to_cxl_root_decoder(cxlrd_dev); +} + static int match_region_by_range(struct device *dev, const void *data) { struct cxl_region_params *p; @@ -3386,29 +3418,17 @@ static struct cxl_region *construct_region(struct c= xl_root_decoder *cxlrd, =20 int cxl_add_to_region(struct cxl_endpoint_decoder *cxled) { - struct cxl_memdev *cxlmd =3D cxled_to_memdev(cxled); - struct cxl_port *port =3D cxled_to_port(cxled); - struct cxl_root *cxl_root __free(put_cxl_root) =3D find_cxl_root(port); struct range *hpa =3D &cxled->cxld.hpa_range; - struct cxl_decoder *cxld =3D &cxled->cxld; - struct device *cxlrd_dev, *region_dev; + struct device *region_dev; struct cxl_root_decoder *cxlrd; struct cxl_region_params *p; struct cxl_region *cxlr; bool attach =3D false; int rc; =20 - cxlrd_dev =3D device_find_child(&cxl_root->port.dev, &cxld->hpa_range, - match_root_decoder_by_range); - if (!cxlrd_dev) { - dev_err(cxlmd->dev.parent, - "%s:%s no CXL window for range %#llx:%#llx\n", - dev_name(&cxlmd->dev), dev_name(&cxld->dev), - cxld->hpa_range.start, cxld->hpa_range.end); + cxlrd =3D cxl_find_root_decoder(cxled); + if (!cxlrd) return -ENXIO; - } - - cxlrd =3D to_cxl_root_decoder(cxlrd_dev); =20 /* * Ensure that if multiple threads race to construct_region() for @hpa @@ -3426,7 +3446,7 @@ int cxl_add_to_region(struct cxl_endpoint_decoder *cx= led) =20 rc =3D PTR_ERR_OR_ZERO(cxlr); if (rc) - goto out; + return rc; =20 attach_target(cxlr, cxled, -1, TASK_UNINTERRUPTIBLE); =20 @@ -3447,8 +3467,7 @@ int cxl_add_to_region(struct cxl_endpoint_decoder *cx= led) } =20 put_device(region_dev); -out: - put_device(cxlrd_dev); + return rc; } EXPORT_SYMBOL_NS_GPL(cxl_add_to_region, "CXL"); --=20 2.39.5 From nobody Sat Feb 7 06:13:30 2026 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2083.outbound.protection.outlook.com [40.107.94.83]) (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 C059C25334C; Thu, 6 Mar 2025 16:45:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.94.83 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741279549; cv=fail; b=H7N+Mm2CTjGG0pzEHE9hoI2dN3Yz8xGNu+GRWRVlMj/M3vbjnqGcHgrB7WnN7EBboh3rCMv+guF45nLGTOVnoyyjIrXTncMIoVTbBDbA0vgPDq37vV38AzgzZ+f58LudUAqAvXdPCZqPd9NhlxZiFDqyilEehakzqLg+kxET+Rg= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741279549; c=relaxed/simple; bh=eCaukBw8cUoKNQzhdoS2Bl4oZOjzVRVCZYyHhR1LRGY=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=cAxt33mXOm0E1EzWmvbUQWHYNw7EtiiW6pZXU+2tE6DQsu+4wE1l5deycOCjnQdJVgyVkl8QvYB1YdUes1zskSM/zllsoVBPcSKe/yslN8RtuT6ygCKeQ2aI0RGeVzW5L9sIGc0Pj5TkWXpxq2o3Z+hugvO3893seUS3iWqzHH0= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=e77K3sM/; arc=fail smtp.client-ip=40.107.94.83 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="e77K3sM/" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=wNdGy3egS7Y1Em6tfHwXCmPWkdVVd9xcoj1PpTuejeFoD5w904KTTjLgLcUFNR6cy5Kg4MkEw+oqjCUJNVwNqhqLYPqIWK5BQl4T0+RxaL+GHejrzpmerCC5DdrONLAkQwcLofDYANiySKrfdNP0D+ffXDkEQvociQ68Dt/N0hEb7v7FckL9U99s6UI0ZACO/eT6UqtleRJB/g7l0vWzAX1uPQpWd3MHbHl9uQ1T3Ye5GxbRIJZn9x3ATlcjLGaRxv5moRA84NJGKCdxORBPDsXkkZTMrbXK8JKY63TUJYzeUyfrSA3LxUyuermevnMw51feVdOYVh9GIjMPHlooZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=7wT+6LuaX391X/me5hc7//eactxEIRxGUDORxFtsRxw=; b=IG0MWavxcSOZekyV3SWGN2lhJPwGGKU4teDogvRuXazVf8aojTrKP/eiQ325eo3taJU3UEJ6pjya97INRgs8z/9aSI/NtE9SjawChnk96s+H8y2AS6tDC3UNtihulYpgKogc2Rvdw9e2/J0+9RGByWO3ICCN5viBRIqlQZQj0ZHQ1Su5okLdP70TXliFx/GLaZRu1aXKM14BrU6s2xYrF0I8bUgJlvhCW7z8+hHHTsR9DBeCEmpgy2Hzmghta3YL1JiqDvsQPASxlb0xC5wj4q97wKKwP1lgdZpKQw1RxiM65+1Due9xoqLfhzZtHssz1IkvwAgncjI65q/QDTp7VA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=intel.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=7wT+6LuaX391X/me5hc7//eactxEIRxGUDORxFtsRxw=; b=e77K3sM/UGzw6CO+/lLdQLz+6Al8K50YZOAAa+g9i+i5Tz3TttxXllPMMED5dIuz29aPd2A8vbmrmUmBzbw3oQKwvKIcxkDcrjQ1ql3cESlqHA2SnEZ3dowDxhZaLUJZlLhXuLyrLSCAPrJf24iJ04w6FXux3IKAaaQKJN6tzhI= Received: from SJ0PR03CA0368.namprd03.prod.outlook.com (2603:10b6:a03:3a1::13) by SJ0PR12MB6942.namprd12.prod.outlook.com (2603:10b6:a03:449::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8511.19; Thu, 6 Mar 2025 16:45:43 +0000 Received: from SJ1PEPF00001CE5.namprd03.prod.outlook.com (2603:10b6:a03:3a1:cafe::66) by SJ0PR03CA0368.outlook.office365.com (2603:10b6:a03:3a1::13) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8511.17 via Frontend Transport; Thu, 6 Mar 2025 16:45:43 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by SJ1PEPF00001CE5.mail.protection.outlook.com (10.167.242.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8511.15 via Frontend Transport; Thu, 6 Mar 2025 16:45:43 +0000 Received: from rric.localdomain (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Thu, 6 Mar 2025 10:45:39 -0600 From: Robert Richter To: Alison Schofield , Vishal Verma , Ira Weiny , Dan Williams , Jonathan Cameron , Dave Jiang , Davidlohr Bueso CC: , , Gregory Price , "Fabio M. De Francesco" , Terry Bowman , Robert Richter Subject: [PATCH v4 09/14] cxl/region: Factor out code to find a root decoder's region Date: Thu, 6 Mar 2025 17:44:43 +0100 Message-ID: <20250306164448.3354845-10-rrichter@amd.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250306164448.3354845-1-rrichter@amd.com> References: <20250306164448.3354845-1-rrichter@amd.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ1PEPF00001CE5:EE_|SJ0PR12MB6942:EE_ X-MS-Office365-Filtering-Correlation-Id: d63aedee-899e-4f74-0116-08dd5cce563c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|1800799024|36860700013|7416014|376014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?RMAAQ+svEWQw6wOuEILVr/ItfbVxtKMuvmFdek3MHa6k4l2DP1jlYSAPMlyd?= =?us-ascii?Q?E2H4gVmRylfWAesXGf+IsnC6+NK6OFu4b4+uLTCxt9s0lTBAxesIpwC9ZIAA?= =?us-ascii?Q?nXlHSL+duFT6qcTG3CFnE3pQjbknstmqgbquz/wpuH/UUnWAuAYUB7ID2AMo?= =?us-ascii?Q?TRYp1zETD25i+1DTPeHBS/gECWhLQf6GmSdjaSSrPcRbJ8TvdV3d+DRQi3vt?= =?us-ascii?Q?9QgXy/uQvBxf41tmAGoVpedaHU2o9aRwgAs67rS6RztPK4gpvmhYlrNWO7Ko?= =?us-ascii?Q?IWrF12jKWjixSee+3KDT2Zk8ERRkXcSsF6WvNYfRBZPekmLDJIpEtMJ9B/7/?= =?us-ascii?Q?9zLOIYyDQJQZRLRGroCI+68KpgjsCrv+qThq7GzX8sQmYzqsJpcGSBc9yKYC?= =?us-ascii?Q?DLmrr0QuGLii8WcVZFBy4dqI2BncYvznFKmHw1FHeeuY2TBFUBkgYn8SuHIb?= =?us-ascii?Q?k3xbV0z1usmCflafOQPFpQMUQDVOPiSB/OrdShPFDnnTiHfV6PQQqhlTZuPM?= =?us-ascii?Q?S1b1UZQOLVMyMSYh6MQj2NprJpqW6QtIjEtCGZTgOIBglmqy0G7xDf4AOA0f?= =?us-ascii?Q?AyQgHMDvaR1a8mHrreUyuBRZRk2DcSBo9hhE2DlF1aoiyY2iQNyuLbNxvvO0?= =?us-ascii?Q?+zj0lxAEStFTUEim6RqILxezisyxJBErJXZ/wqQYs4DhSnSZ0eJQ4LwTvqN8?= =?us-ascii?Q?hVfFAMgUFfaZVNfOW1xCRtZR9/eoCFjkVeFcWPPEJAMHG4KPubHcmqJLpbgg?= =?us-ascii?Q?+cRUOt092uqAyPyiV1vm/ZaGTPDNTPHqWuY24o1Uy2JSqHvm4KPz7ZsSy1uA?= =?us-ascii?Q?VC4RpUUvDCD3PL7GJa4CeBN9RBOo893SVw4NPuXmfuF4PfmdoeKXVs1/PJ2J?= =?us-ascii?Q?CUxaHC6y49UHGVKUdPX8Q8PM8w3OvItCEG5U74Q85FiAtI0sa4EU5JTP57GW?= =?us-ascii?Q?kCM+JukQ/92hYYOUjLXW66sk55Po6T5bLVOK516JA2y03DMs+QdctmuqhUGU?= =?us-ascii?Q?JFlsAtjPstXo3ngoTBN28NZsybQg/4o07DVy18j9akOQyge0uSSF+CKOnnXu?= =?us-ascii?Q?bsDwdbOBpLY2teYawje94PY91vNvDZV/K67IfKM7Z8FPX8Z14tuJpokCWqbn?= =?us-ascii?Q?DolaUQq6yTOOEA4A+6Vv+7yH5+Vu4oT2adzu3CTBjeLWAO5z5ebFBMUgFBM+?= =?us-ascii?Q?bcDKzXL69wLDnHxgLRv9XwIpJeD6boL3cEJZf8knJf5ADaE1OBXYiP9+w2Wo?= =?us-ascii?Q?aTbgF+Cr9N0FMTlgSrkEso39xtJix1Sz3hiE5xXTr1/j1OlDf8nR/YBafaoR?= =?us-ascii?Q?FlLJwD00ol4HAFpW7HFZU1R84vJ0iBMa8iPHpqUMYQI74PfDdkKN4NtxnNvs?= =?us-ascii?Q?AZNHTV7qqiMJszCAO7ydD/3SuLxbxAyQMROJSedxbjTOiNfK2GtQrGyyKcFM?= =?us-ascii?Q?krLobGp7A1WzNws3+owYT3jxmxL6ObefHnNMa81kmwHIO84AI2TaODxQOeg7?= =?us-ascii?Q?k7/JXmxytWJgRX4=3D?= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(82310400026)(1800799024)(36860700013)(7416014)(376014);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Mar 2025 16:45:43.4707 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d63aedee-899e-4f74-0116-08dd5cce563c X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: SJ1PEPF00001CE5.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR12MB6942 Content-Type: text/plain; charset="utf-8" In function cxl_add_to_region() there is code to determine a root decoder's region. Factor that code out. This is in preparation to further rework and simplify function cxl_add_to_region(). No functional changes. Signed-off-by: Robert Richter Reviewed-by: Gregory Price Reviewed-by: Jonathan Cameron Reviewed-by: Dave Jiang Tested-by: Gregory Price Reviewed-by: Alison Schofield Reviewed-by: Dan Williams Reviewed-by: Fabio M. De Francesco --- drivers/cxl/core/region.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/drivers/cxl/core/region.c b/drivers/cxl/core/region.c index 7d9d9b8f9eea..70ff4c94fb7a 100644 --- a/drivers/cxl/core/region.c +++ b/drivers/cxl/core/region.c @@ -3416,10 +3416,22 @@ static struct cxl_region *construct_region(struct c= xl_root_decoder *cxlrd, return cxlr; } =20 +static struct cxl_region * +cxl_find_region_by_range(struct cxl_root_decoder *cxlrd, struct range *hpa) +{ + struct device *region_dev; + + region_dev =3D device_find_child(&cxlrd->cxlsd.cxld.dev, hpa, + match_region_by_range); + if (!region_dev) + return NULL; + + return to_cxl_region(region_dev); +} + int cxl_add_to_region(struct cxl_endpoint_decoder *cxled) { struct range *hpa =3D &cxled->cxld.hpa_range; - struct device *region_dev; struct cxl_root_decoder *cxlrd; struct cxl_region_params *p; struct cxl_region *cxlr; @@ -3435,13 +3447,9 @@ int cxl_add_to_region(struct cxl_endpoint_decoder *c= xled) * one does the construction and the others add to that. */ mutex_lock(&cxlrd->range_lock); - region_dev =3D device_find_child(&cxlrd->cxlsd.cxld.dev, hpa, - match_region_by_range); - if (!region_dev) { + cxlr =3D cxl_find_region_by_range(cxlrd, hpa); + if (!cxlr) cxlr =3D construct_region(cxlrd, cxled); - region_dev =3D &cxlr->dev; - } else - cxlr =3D to_cxl_region(region_dev); mutex_unlock(&cxlrd->range_lock); =20 rc =3D PTR_ERR_OR_ZERO(cxlr); @@ -3466,7 +3474,7 @@ int cxl_add_to_region(struct cxl_endpoint_decoder *cx= led) p->res); } =20 - put_device(region_dev); + put_device(&cxlr->dev); /* cxl_find_region_by_range() */ =20 return rc; } --=20 2.39.5 From nobody Sat Feb 7 06:13:30 2026 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2083.outbound.protection.outlook.com [40.107.243.83]) (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 749C319047F; Thu, 6 Mar 2025 16:45:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.243.83 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741279559; cv=fail; b=bedS8pM/B2SfBSeSpRn2yd40R2JR5ttrIIKrdx/kjRu2D7vSb1hJ4L9QxqbKMVs3OQD25P/O/NZlTej9H8EXPeBsNxiDE03SDdPA+Q/hSKaXXRjf4yAAxhPmEvDumF022lUXFqUThmqyBXqSXSiv3IkzWMezalr76vHI+sRiamk= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741279559; c=relaxed/simple; bh=gUlPVSDsmC3cL6+ayXRxAP/ntPgslCWu+/BBekjjoh0=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=CoKyMThhzL6pPRjPhldzuMsEEaqTz/KDhbOA/0NIYL/JQNIHOzftZWYrO4y/CsYiHrGbzSOlYAbmP63fr74VpeTDv+rJwfrU/jrQcOIS7LXf4hRkCR55dw9+lU4Ad5vGAPJaOT1oPpB1AKO408qy2yffkMCvgQxzthNKzxBe1WI= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=FaXoxPuQ; arc=fail smtp.client-ip=40.107.243.83 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="FaXoxPuQ" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Emf22bQC4AdA0K8wDu9rFQpM7bnicVk1KsfqRy6UnLo+j2agoC3QSAwe7x20sCiGAoUUXix4Rl3WuC+fqf+99Y4oXXPVSfStMmSO4NLnhNV7jM/wLAnGDweVdTu31q7PLadkfRdtse0mBGdcCbHIA5d9JE3kipenDEAwWaZOUzgK9h0p687V0BBXxmZkWSrsibN5y7usBHFruKSNb9O1POSYU2WiBwsvC2Ex/1HwqoioCSAeMo3ucHVVggRu6uSoHv9mlmnmCJn4C1dGeSfkFFfwRWzHHE+88F6vnEQ4nAs/PXEzDp8bZ8ucKSYtdy6Up7BceTlQWDXXSrHI3bMKwA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=z8IexHW0Oly6jIL7mLsUdMwExV0Nh5XaQerOnZ7I30o=; b=yP4DODuvxcXEiFbP9BG3aJCjT41t8IOCDFWCyuesFnQbH5XlRU5s4ZtuAb43DH1VICJPOo+k4zhXrg9EGq1jpab1N8h+1o7htjKNzRNecCzVQMkQ+A5thDexRPfmFCZOfOWw57cOLKfEcoRfMQ81AIUUmP0na8L65BS+7wmx1a1n5d2Ys/qURcekUO7onzXsRdv9mWhJqD1cBNRH+E9xuNtoPKX9Pjc9X8TmhCtm9/16IKitkBjCXEKhgt3Jhuqm7WOrUHYkl+jOxPpzwAC/nl/po9d2+X/EipdrNUIVgMHyn2qenL+9vk2WNix0h+NyGjVx0NGxmuw9ILnD4oPRwg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=intel.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=z8IexHW0Oly6jIL7mLsUdMwExV0Nh5XaQerOnZ7I30o=; b=FaXoxPuQbxRIcbl5GMxjtvyyXtQnAi2B5IhdNRBDv1JH5M5C+Bs8KqV9UaJ6VgbJZ4M0RKVlSFSRSsj85LGYvrcn6djs7feqBgNgqZuH9X4b6M8R+gdmtjM9WpnnPdb21hlxrhAINidJ3GhgbOcnWD05APl71SBUOMdCCG1SMGg= Received: from MW4PR03CA0341.namprd03.prod.outlook.com (2603:10b6:303:dc::16) by DM4PR12MB7551.namprd12.prod.outlook.com (2603:10b6:8:10d::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8511.18; Thu, 6 Mar 2025 16:45:47 +0000 Received: from SJ1PEPF00001CE8.namprd03.prod.outlook.com (2603:10b6:303:dc:cafe::e6) by MW4PR03CA0341.outlook.office365.com (2603:10b6:303:dc::16) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8511.16 via Frontend Transport; Thu, 6 Mar 2025 16:45:47 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by SJ1PEPF00001CE8.mail.protection.outlook.com (10.167.242.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8511.15 via Frontend Transport; Thu, 6 Mar 2025 16:45:46 +0000 Received: from rric.localdomain (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Thu, 6 Mar 2025 10:45:43 -0600 From: Robert Richter To: Alison Schofield , Vishal Verma , Ira Weiny , Dan Williams , Jonathan Cameron , Dave Jiang , Davidlohr Bueso CC: , , Gregory Price , "Fabio M. De Francesco" , Terry Bowman , Robert Richter Subject: [PATCH v4 10/14] cxl/region: Add function to find a port's switch decoder by range Date: Thu, 6 Mar 2025 17:44:44 +0100 Message-ID: <20250306164448.3354845-11-rrichter@amd.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250306164448.3354845-1-rrichter@amd.com> References: <20250306164448.3354845-1-rrichter@amd.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ1PEPF00001CE8:EE_|DM4PR12MB7551:EE_ X-MS-Office365-Filtering-Correlation-Id: f5c1bb75-67b7-43bb-2efb-08dd5cce5853 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|1800799024|82310400026|7416014|376014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?6NqVdR7yj1D09KxKGGtqSScYJm8fUxI8kspuyybdgIvRLu44bCoRORKhMXSP?= =?us-ascii?Q?i0RMbe1v7Bdq04+9GWjfNczPz8bGTUE/FEOF0xKDUJ+WgjTuX/SX05llnPEN?= =?us-ascii?Q?ot6nX2rWKkAh51xOJQ0aafo0UtjhKFN3VU8/pW/1g/Pg9ou9KX79x1PJTu3I?= =?us-ascii?Q?JW4ChU+h8ldjRKcsX+B1PvA+CvDh1j4ROVlomU48v4n5iZzMXHQUnJxbtLc9?= =?us-ascii?Q?9GlksT1lmpmUXgp/1Elqt8uL+5OUUIfESfyHQyAY+02rUMu87wsbTC5UC5vu?= =?us-ascii?Q?cqFzie3kxL+0uKzJ0hirqFVrrZdqG6ZSH742CaZR6CIUASzH0EMLrJVgIaIr?= =?us-ascii?Q?vYBr4u3p/C/ruD1ZpAlK8zkNOgnpJ82qhBaBG3hCGfsLJshnaHERBmn1+LcT?= =?us-ascii?Q?t7dCUQ0vct3pM0RtRTlaVoMxbE3qpxHsKfkCx0MoYE1j/tg4rZW2RHJQbteP?= =?us-ascii?Q?3ADFAtXJOFyisJNFsoUWRvDY0RjMdp/iE+IKd7q5oXcO1E/2eNc+6Xn8FRVk?= =?us-ascii?Q?4uGVTvbSMGwRapiebyf2Wqw7oxEJagr4NtXf+ik3rGyLqjHjwxSSVvIa8bs8?= =?us-ascii?Q?RYVwdeI1pgpA2nurXB+PmD9PWB4edj+8CXSSjWk6XPhKbGBKtQ8WQaLiywxv?= =?us-ascii?Q?OVxQSY26xqqQZZjpX2mW8uNnS6DAPPVwtmIs7iBwSp8aBQqeoBWkt6CwGLdN?= =?us-ascii?Q?0rOtb/OxWl1e3ypNRgEUCYj1V8Mb/Trscbo9oexSZyX8mVNf1bkknjO7h9Tl?= =?us-ascii?Q?zbDcseZSiuio97bQo/TT98a48LsPhmX04aiHw7GzZ+zA97dn0GTOP/L3e0JU?= =?us-ascii?Q?kCe7Z40o7DuqwCaTw48zJAjSyadjRBS3xze3f+a67zYDZBrecK27iV1iZHSY?= =?us-ascii?Q?i+eQr2OV2YQsRY5rmdPt2Wn91Oo89HGgxvj3+auuuCO8AesJQqVwTiq/Hvww?= =?us-ascii?Q?Dwt1q/4pFGPG9Y25sodRVO7BE0SCklDQGOuRn35ypb4/oIoSX4mTy6iiUewh?= =?us-ascii?Q?xRsgS/PeYhuzwMovne9iH3ykJnL6CBdCfGE1NKtNnHR0p5/rNYw/1nCySEaH?= =?us-ascii?Q?4Z0vmwOiR9N1EAxQWg5cRGxCndlASEhq3Oftj5R68tmodbRrcRGpIbCjvqWF?= =?us-ascii?Q?NnRp1PyPzOsE30psFsrKaXLvnW1KoB7yAgy2C/uhET7AIFWDpHNaCfwi82AK?= =?us-ascii?Q?SHK1Yk35NkMYbLR0fK5fmhsCA9ijJxy/7vxnp2j8rZekveoIzyMolg4sigyU?= =?us-ascii?Q?oL/YGSFcJcnAsFKZICE0FTIFg5NKXo0oSIikBC92y1b4mOeoLTD/PCCtCYtt?= =?us-ascii?Q?gqW45rm0oKYx5kiqURBDSTqdJvUJiTzv0Ok6FbN/Khot9EBvLuBpd6oqcymY?= =?us-ascii?Q?tkkd6TlMmFYlROW3XxM2cU9E0BtWlr7sp6oxAnuE1e4zxJPQdqjquk9x5Xle?= =?us-ascii?Q?FWViZIcx0EX/WDj7Qjl7O/ejM/ksY9C3iwYkjxWTSwg1MF2KC8eLFp/z1/JT?= =?us-ascii?Q?d/o+LFVt4I8Agos=3D?= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(36860700013)(1800799024)(82310400026)(7416014)(376014);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Mar 2025 16:45:46.9624 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f5c1bb75-67b7-43bb-2efb-08dd5cce5853 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: SJ1PEPF00001CE8.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB7551 Content-Type: text/plain; charset="utf-8" Factor out code to find the switch decoder of a port for a specific address range. Reuse the code to search a root decoder, create the function cxl_port_find_switch_decoder() and rework match_root_decoder_by_range() to be usable for switch decoders too. Signed-off-by: Robert Richter Reviewed-by: Gregory Price Reviewed-by: Jonathan Cameron Reviewed-by: Dave Jiang Tested-by: Gregory Price --- drivers/cxl/core/region.c | 48 +++++++++++++++++++++++---------------- 1 file changed, 28 insertions(+), 20 deletions(-) diff --git a/drivers/cxl/core/region.c b/drivers/cxl/core/region.c index 70ff4c94fb7a..cf58ee284696 100644 --- a/drivers/cxl/core/region.c +++ b/drivers/cxl/core/region.c @@ -3198,33 +3198,48 @@ static int devm_cxl_add_dax_region(struct cxl_regio= n *cxlr) return rc; } =20 -static int match_root_decoder_by_range(struct device *dev, - const void *data) +static int match_decoder_by_range(struct device *dev, const void *data) { const struct range *r1, *r2 =3D data; - struct cxl_root_decoder *cxlrd; + struct cxl_decoder *cxld; =20 - if (!is_root_decoder(dev)) + if (!is_switch_decoder(dev)) return 0; =20 - cxlrd =3D to_cxl_root_decoder(dev); - r1 =3D &cxlrd->cxlsd.cxld.hpa_range; + cxld =3D to_cxl_decoder(dev); + r1 =3D &cxld->hpa_range; return range_contains(r1, r2); } =20 +static struct cxl_decoder * +cxl_port_find_switch_decoder(struct cxl_port *port, struct range *hpa) +{ + /* + * device_find_child() increments the reference count of the + * the switch decoder's parent port to protect the reference + * to its child. The port is already a parent of the endpoint + * decoder's port, at least indirectly in the port hierarchy. + * Thus, the endpoint already holds a reference for the parent + * port of the switch decoder. Free the unnecessary reference + * here. + */ + struct device *cxld_dev __free(put_device) =3D + device_find_child(&port->dev, hpa, match_decoder_by_range); + + return cxld_dev ? to_cxl_decoder(cxld_dev) : NULL; +} + static struct cxl_root_decoder * cxl_find_root_decoder(struct cxl_endpoint_decoder *cxled) { struct cxl_memdev *cxlmd =3D cxled_to_memdev(cxled); struct cxl_port *port =3D cxled_to_port(cxled); struct cxl_root *cxl_root __free(put_cxl_root) =3D find_cxl_root(port); - struct cxl_decoder *cxld =3D &cxled->cxld; + struct cxl_decoder *root, *cxld =3D &cxled->cxld; struct range *hpa =3D &cxld->hpa_range; - struct device *cxlrd_dev; =20 - cxlrd_dev =3D device_find_child(&cxl_root->port.dev, hpa, - match_root_decoder_by_range); - if (!cxlrd_dev) { + root =3D cxl_port_find_switch_decoder(&cxl_root->port, hpa); + if (!root) { dev_err(cxlmd->dev.parent, "%s:%s no CXL window for range %#llx:%#llx\n", dev_name(&cxlmd->dev), dev_name(&cxld->dev), @@ -3232,16 +3247,9 @@ cxl_find_root_decoder(struct cxl_endpoint_decoder *c= xled) return NULL; } =20 - /* - * device_find_child() created a reference to the root - * decoder. Since the root decoder exists as long as the root - * port exists and the endpoint already holds a reference to - * the root port, this additional reference is not needed. - * Free it here. - */ - put_device(cxlrd_dev); =20 - return to_cxl_root_decoder(cxlrd_dev); + + return to_cxl_root_decoder(&root->dev); } =20 static int match_region_by_range(struct device *dev, const void *data) --=20 2.39.5 From nobody Sat Feb 7 06:13:30 2026 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2057.outbound.protection.outlook.com [40.107.223.57]) (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 887D4253B7B; Thu, 6 Mar 2025 16:45:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.223.57 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741279558; cv=fail; b=QPJbBt7nQk+eWeZxE2gnxkWSmVIccTjQa3nXHFQM2lEjSQaP/txOTyfwf1aiyXmlwwVY8DerhJPCZAnsH1a6vY47UG1bSnGDYyMoPMKHJkDMso2chbsBIIhuvw9yNdftJJ7BlRBrEL8Y0aHuiHBMsKyaTtHvEG1j7JJ8wYp39Jg= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741279558; c=relaxed/simple; bh=G4dCmHq5d4eZ9+BG5eocxrd8nrYAa4NiBSdVlLGr5+w=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=ifADuDb7egJ2nYTy9xXR6hf0NENREqmFnBx4eKTH7zL8tq9UokKcuxDmSIONqu8p1IUIHY8QxiESJoGqcsQ9+ME05haecS/nkN6kMEucCVVyUJD9J3UGiTGzLgQHsaUkaC9YQQq6gLbSwwl39fRqhpZlhd/dgZpd3S8HLpXnIUg= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=2gi+YIGj; arc=fail smtp.client-ip=40.107.223.57 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="2gi+YIGj" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=f+s69Do7jCTk9Y5Y0ez0ouJ/YUAavgNyAOer22osetxb+jEbM8izOH3cBtkqIkPdnMKrAes8cFeAsacHwza50rkLzkwH0wUzayeyrWM7YRVyYvgV3ts3vexBfQ3UX7kZ9JuM8SKbhcyMX6f1lJUKrlmoYjMoyKhsDzUE7hu4Rbxz3mnJ7PuHihxMRKTZ10LC0RSzfPceyvqmPDSnx7DMhNQZU6uM7t7BD/L7wFWd+HFd0JD9J2P1xfbQJxpeoM9keXElFsH1Y7fWPMdiE1ITetKw4pPYFncezkJRZ3sWtSbIZxdNRPSZ2VDQGwqor5vqFiIi4cKNmvAa8xzwKvqBpA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=nRGd+Wxz9Lz8w38N7733t4jyvyv5FC/mu7LPJCRN0sg=; b=Q68Doy8l/XOjiWCRO4P/L/C5EyB2XH/O4pPli8tdq9fT21/J1Let0oyHB9U4MwgI7SE6UGiIVsHcvZvzwyYDwHNNvIVaXcLr1fJJZF7fcKj0b1SJqnkAPqVdMGjAhxsHVtR+3fhZcF1RZ4xfDBheE04PVfFTKnqob85MlGJz8yhZmMEf6F+/XClry7sAsZDDuN+6JN7SGZICtIybRldr2y846+3b9YxWlFuOBOjIGyU9LaCOlbdssGbMC0XD/JMemZarhDMDAP0fAprTsK0e+GqukqXgCwhJcp0iTNUcaP4fDraY8ABGdsZw0SeSoondluNflcaqhpPtVzhGGQaUaA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=intel.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=nRGd+Wxz9Lz8w38N7733t4jyvyv5FC/mu7LPJCRN0sg=; b=2gi+YIGjvyr6f7EF3P/XSO7LBoFa32l5pPs97rvgXVd1Jw9tEsJUB2IIiQ96QnkhXjSO0KCD1Jj5ITu+BP6FRA8O8xVMpGwVLp91U5lK6kt4F+TP+vVGABkH5libxiFHaz4TDL0DmcWEvW9Kie4NC1IBgsryq27xXjcfgmXdI+k= Received: from MW4PR03CA0340.namprd03.prod.outlook.com (2603:10b6:303:dc::15) by IA1PR12MB7613.namprd12.prod.outlook.com (2603:10b6:208:42a::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8489.25; Thu, 6 Mar 2025 16:45:51 +0000 Received: from SJ1PEPF00001CE8.namprd03.prod.outlook.com (2603:10b6:303:dc:cafe::a0) by MW4PR03CA0340.outlook.office365.com (2603:10b6:303:dc::15) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8511.19 via Frontend Transport; Thu, 6 Mar 2025 16:45:50 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by SJ1PEPF00001CE8.mail.protection.outlook.com (10.167.242.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8511.15 via Frontend Transport; Thu, 6 Mar 2025 16:45:50 +0000 Received: from rric.localdomain (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Thu, 6 Mar 2025 10:45:46 -0600 From: Robert Richter To: Alison Schofield , Vishal Verma , Ira Weiny , Dan Williams , Jonathan Cameron , Dave Jiang , Davidlohr Bueso CC: , , Gregory Price , "Fabio M. De Francesco" , Terry Bowman , Robert Richter Subject: [PATCH v4 11/14] cxl/region: Add a dev_warn() on registration failure Date: Thu, 6 Mar 2025 17:44:45 +0100 Message-ID: <20250306164448.3354845-12-rrichter@amd.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250306164448.3354845-1-rrichter@amd.com> References: <20250306164448.3354845-1-rrichter@amd.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ1PEPF00001CE8:EE_|IA1PR12MB7613:EE_ X-MS-Office365-Filtering-Correlation-Id: bddebbef-23f0-43a7-67cc-08dd5cce5a51 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|7416014|1800799024|36860700013|82310400026; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?DN7Gn3OhsYuh6ZokwyH1xArB5o2F7dWpm+owTCPUl8z0DcZuwjR/6E4cq5eS?= =?us-ascii?Q?MK2VZ7P2CLiwoWxBXMUkKYDDs3DgYZ5pSEp2PkWceLnvTmo9/ID73337/6jo?= =?us-ascii?Q?t3tFSmUJXi374VwJLQf1fE2TacNk2etTKy8XFHKFu2VLOPPL3IIxz8rQch3+?= =?us-ascii?Q?L6L9K8N6RiNG9NxmPHt7unpyNMKJPuofTTwxBA2Td3oqBr9ACSIvhuo0gYsh?= =?us-ascii?Q?c6hG57MEGd6geDJmzip38YRKZfEovB8FEDf1t55U/NZCcKtHEGhQEsNrs/Iw?= =?us-ascii?Q?oc/rMjPjjG9dJ3oFKP7IEs9Onmf8J0vURWe9kPJHSeFM/nxao/5uWWw7tqZq?= =?us-ascii?Q?Rd6rrm9543cOL9zrIqMYPrQg/+FapssHcg9BBcTJnEd4ld6XXrIA8RX67/ln?= =?us-ascii?Q?1p/KJzRD4OLRjRQ/LuzC6g01xicj4NdrEVPxjpE+TFJEHSli7WBePfUBXVml?= =?us-ascii?Q?K9q3Rl0y2YUP0yZcAl99GdtMpMEgPZlkLK/7T+vt8KWDjD16KZeeuvuE1swm?= =?us-ascii?Q?uJm00tpDEFjMLjYPcM6jFrAMB5LfqR0VVsUl+PU0dDmHX8aK8gt+zEKE2Wp2?= =?us-ascii?Q?jCbb2QSAjY1IhtijPDJWg8lnjNbXGfWBSIllcy273WjwUmPThedFn+fljkhw?= =?us-ascii?Q?ct6Li+f8N8Is1vBLg18n5DOTXCiOn3imRBlepVwJuUvywZhTjf4xmz5C2JZZ?= =?us-ascii?Q?h3O8t/6j5ADz/wjPw4sOt8TKt91XlMBkOcuY2tkNklSOy8zk1GpR9EGYerm/?= =?us-ascii?Q?W70QINqT29yqa4W1Lb2Qw82l+/9U6/IglkiqdiHALMGzRRYqhB/5iKtoK8yT?= =?us-ascii?Q?puVfMFXpVy5R6pEEyTbjbjQ59hyxBKQFppb9lsAliaW7A8swxfbCvK7hWjJI?= =?us-ascii?Q?BOVlgUh/w8JvJK6Jj4dc51MD1bVfk07fOk0foaaBk+f2OaXJHrdvnDkUGqgy?= =?us-ascii?Q?oJEbvFBpENZayUc3sK4z0aMuh3I6umxaZh7HusnkjaovswAzlWFbSWjCv6gx?= =?us-ascii?Q?FWMZ748X+ZsSJRvnezTGFhzVSZG7bYpaGm80xG2NKTMTom+oX2Ajs7Oqg27q?= =?us-ascii?Q?nqh58ifcOOHlUN62p6WsOayu878rt0dUUkRu3HMSV0NwwEsx9u0z8wxfU3/j?= =?us-ascii?Q?TYqOE6xSIZZco9SpQDWu+L/PZHOfDkglRmIe99Ak7T+JhfoCHuZHSHOoxAIW?= =?us-ascii?Q?+qWBReGaTatsVSfbytiXq95j6vbq84vXZfjGtx5n6/2apkbNtTdYiWF+6KIT?= =?us-ascii?Q?1/t0ybua1UsjDLN2lxr1NWW09VhtWDW+VkvlxGVwvkzE2tHX0r+gRBAXJEMs?= =?us-ascii?Q?XTGah8vbBDQJsO/iq5sB2zmsNSrMKAxZEsh9oFzGdDPaxC2YDluzR26mSIzZ?= =?us-ascii?Q?1A0QmShp+NICeyf1g7lrU8H7fP8gD2at3NCqvdmzjraXVjJ7PgL1+1wOfAWa?= =?us-ascii?Q?uX/FvMD4mlIXit2ROARtnLTw6S0z+iY4ENGqopVMPIWECYSCyn5+groZ/ZWY?= =?us-ascii?Q?Oxci8M8TuPs/tlw=3D?= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(376014)(7416014)(1800799024)(36860700013)(82310400026);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Mar 2025 16:45:50.3062 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: bddebbef-23f0-43a7-67cc-08dd5cce5a51 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: SJ1PEPF00001CE8.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB7613 Content-Type: text/plain; charset="utf-8" Esp. in complex system configurations with multiple endpoints and interleaving setups it is hard to detect region setup failures as its registration may silently fail. Add messages to show registration failures. Example log message: cxl region5: region sort successful cxl region5: mem0:endpoint5 decoder5.0 add: mem0:decoder5.0 @ 0 next: non= e nr_eps: 1 nr_targets: 1 cxl_port endpoint5: decoder5.0: range: 0x22350000000-0x2634fffffff iw: 1 = ig: 256 cxl region5: pci0000:e0:port1 decoder1.2 add: mem0:decoder5.0 @ 0 next: m= em0 nr_eps: 1 nr_targets: 1 cxl region5: pci0000:e0:port1 iw: 1 ig: 256 cxl region5: pci0000:e0:port1: decoder1.2 expected 0000:e0:01.2 at 0 cxl endpoint5: failed to attach decoder5.0 to region5: -6 cxl_port endpoint5: probe: 0 Signed-off-by: Robert Richter Reviewed-by: Gregory Price Reviewed-by: Jonathan Cameron Reviewed-by: Dave Jiang Tested-by: Gregory Price Reviewed-by: Alison Schofield Reviewed-by: Dan Williams Reviewed-by: Fabio M. De Francesco --- drivers/cxl/core/region.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/cxl/core/region.c b/drivers/cxl/core/region.c index cf58ee284696..bd1ce9d8bed7 100644 --- a/drivers/cxl/core/region.c +++ b/drivers/cxl/core/region.c @@ -2162,6 +2162,12 @@ static int attach_target(struct cxl_region *cxlr, rc =3D cxl_region_attach(cxlr, cxled, pos); up_read(&cxl_dpa_rwsem); up_write(&cxl_region_rwsem); + + if (rc) + dev_warn(cxled->cxld.dev.parent, + "failed to attach %s to %s: %d\n", + dev_name(&cxled->cxld.dev), dev_name(&cxlr->dev), rc); + return rc; } =20 --=20 2.39.5 From nobody Sat Feb 7 06:13:30 2026 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2057.outbound.protection.outlook.com [40.107.237.57]) (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 49B102561C7; Thu, 6 Mar 2025 16:46:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.237.57 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741279562; cv=fail; b=bjA7/0L58uZ7Z4lKhpZlrtEFxJ9gaflS1GTRn1XHuxaVlu5P5oWSQHTuGOKZrusXT7Gl2W1WQj859PNqwRVTrqolzXcmEKhcFDvxPoHQ2Rj6+XvlAJmCfGotUmYgh0CMQgk9O33uOjTWXUTQD+EWaireuE8Q42Qp31KEAU6abNw= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741279562; c=relaxed/simple; bh=tgWURgByjXeSt6jibaV1V5Vh+LSKxw3+kg6P9/lEEec=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=BfC1YEp/YkQA+v6K6QK6e0aRqOZPa3ShPdpv9yd6O/t0ndHMpOOFu0TDzn3ysy1j5BWt0grh5nMaSE5H5aYiVH8MBRqObWsm4NReuCijqADzL85bVgpMFcB4OVpn+0PoGB0mLYheaBOEsLP06E3Vsw0TcQK1REt5fV/4MqiScWY= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=t992HmW4; arc=fail smtp.client-ip=40.107.237.57 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="t992HmW4" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=tRtT24uLORETMjkY/QkJNpq7wFh3gN2M/Y/TQwT37vb3h+Cwv8HnLTEx4Eu+KpnmRoAqanJItN8SnElTbjcFPXa0/otGFuzF0cdWBRT8rdTLlh/mOpWg10Uv5zKadg8fgXnyH7dZG1RUqSZlC6nfjCf/Gv+/c34skUIg0yqSkgwxUVYP6qysVVQBHUT9YNjFjii023m9PoCIdHaLORxy292NlbX1rlixPt1dv+bG11ztijGwrXRKXvaSfbd5k7MSU3YiaPPS6VoMJ/hU4sNtIftQb+TYk9z2qJoQZkHTjULsh+4d/RsPMbdi7E2R0pEWbj+9eZjTKXcvP4UbaUgoNw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=S8KUigE1SOdnleOtu2WXQvc0ggAe0J8ZeO46L7gqTro=; b=jsi5ry78dH/7odb1sI1BCLEr9SL6WoPQvCxAom/T/XHiFv6iJ3kDgJykA+bLfF9xPYPNl6V+ePDCgrA+VupKdPCA3SblWcj3/hFmBbj+CxWyh1JRdpm3+SOEL1J4H4Kx/wnQ9ezxrDLZhALO4xOj4MDDiIKIcmnv1k4+OdRJDIECqGp0Hwsd8lHR7JcTfOw2PP30rz1VSDESbcdvJHOLpn78e23n6bg8KxpGoRMgI1FBWn11B1/6T534N3qryulHrWxKg58mDmGL9E1pBUO/FmFeE/BoctuS/BY7iVap82X/S/ve6AEArPOVD+lXkcec5ir8vj1K2gch5ge5kaCI1w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=intel.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=S8KUigE1SOdnleOtu2WXQvc0ggAe0J8ZeO46L7gqTro=; b=t992HmW40pzGUOChCmY4ZqgYyve06dQNLl4YF6ShXD/aZpQVaYJ+5KXKy3dT6xcyju2iGKu1tXHk9PaIiIW9Q1GT0uJvjSjWHTEs32o1A2cDZu2zn5Wt7GE0AY9bmKc2P3U9kcFMqNRfVLxccMqA+EvoKWsuX2v7BnTdp8iCUUs= Received: from MW4P220CA0012.NAMP220.PROD.OUTLOOK.COM (2603:10b6:303:115::17) by SJ0PR12MB7474.namprd12.prod.outlook.com (2603:10b6:a03:48d::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8511.19; Thu, 6 Mar 2025 16:45:55 +0000 Received: from SJ1PEPF00001CE4.namprd03.prod.outlook.com (2603:10b6:303:115:cafe::8e) by MW4P220CA0012.outlook.office365.com (2603:10b6:303:115::17) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8511.16 via Frontend Transport; Thu, 6 Mar 2025 16:45:54 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by SJ1PEPF00001CE4.mail.protection.outlook.com (10.167.242.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8511.15 via Frontend Transport; Thu, 6 Mar 2025 16:45:54 +0000 Received: from rric.localdomain (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Thu, 6 Mar 2025 10:45:50 -0600 From: Robert Richter To: Alison Schofield , Vishal Verma , Ira Weiny , Dan Williams , Jonathan Cameron , Dave Jiang , Davidlohr Bueso CC: , , Gregory Price , "Fabio M. De Francesco" , Terry Bowman , Robert Richter Subject: [PATCH v4 12/14] cxl/region: Add a dev_err() on missing target list entries Date: Thu, 6 Mar 2025 17:44:46 +0100 Message-ID: <20250306164448.3354845-13-rrichter@amd.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250306164448.3354845-1-rrichter@amd.com> References: <20250306164448.3354845-1-rrichter@amd.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ1PEPF00001CE4:EE_|SJ0PR12MB7474:EE_ X-MS-Office365-Filtering-Correlation-Id: b22d164b-d733-4c63-060a-08dd5cce5c9d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|36860700013|82310400026|376014|7416014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?4GmzSob/pkFE2vWgrvj9ymhVr/RuIQxKh9pZjA9ycFNKrQXKiQ8f6h18Nwkk?= =?us-ascii?Q?CuDvSJ18qykqPbnNAROyfL4pWF2Bi+2hWQ7BBvtDea5E73G9ixNFdXl/EQ1R?= =?us-ascii?Q?4ZV3uudaSkY+U1aSVIyWqwN5cG5dBMT79/kUKEnatcsHwa8hWpgPuNqs0Dvr?= =?us-ascii?Q?s3OxHrQl4YcTbbm/Un+d3yu1IW45Th4GHFL71/p1Gz1Bx6ai0zd87+6IoiMV?= =?us-ascii?Q?ZLmgZzDnn+CxHOK7rxUw7AuYWP3RDKOITk91WUUmxBBE6Jp8reW44gFhqzNU?= =?us-ascii?Q?p3/7/PEC0YF1YJL0anPk244iQ/d9CALPsRodBrxTZjuv7CXzuXR2fn3YhNfx?= =?us-ascii?Q?RXOL/g8/rB11ypdv7o6u764t8YWn/LM4ouB9Tp3IdkMYVSReDbVsKGUWnyC0?= =?us-ascii?Q?or6D+RbAtnpm/iSGfV3agdfr8m2HHFuWVnchbLhv5OAN+onx5eKARQFW/JxT?= =?us-ascii?Q?ZdJZOXUH1HnD8G9BKKpoA9icsdS/OymxB9tDWy72Vrx9xA5yayYx5C1tMAoK?= =?us-ascii?Q?FV0Nim9i4ofLEy2PgR6jfl3k8mzyuGgEKFVxIiCIqvGd6xnNlcu2r+TRhknV?= =?us-ascii?Q?4rLoviJvYQa6OckCK4fV+o3KlGlmD+C5SlRTJSYWYb+39dQQy9Q0a+NWVngq?= =?us-ascii?Q?PVqiEVg4l9ypatgnBAod9fOVuo8uxvhhLdr9xnFAemj8uLGrS/ugw8E1Oyqb?= =?us-ascii?Q?oPxgVK7f4R/BC2pcEZNmxAReANlTZUGseFpwNfJkfMJ6b75KrUz0eoQKH/Cs?= =?us-ascii?Q?xrU2DAJFfQATfY3tfDK3OWaZsr6JhEun0XIXruV7wq/zL+TkljJYRWUo0MBZ?= =?us-ascii?Q?6ZMbp49VnGzIuAUbZKfB7fX6X3lhLhXucIYZ9YRbMdCBIHVD0DDtRcVH+m+T?= =?us-ascii?Q?J/EaqlYx7q89wUB7mPLuqvCaAM/sL4zgAP7Ti293FOAsLbIYnCi0VvOd93M0?= =?us-ascii?Q?WuUam8sspmzu08RJk8SHrJyRNZ4bXgGNFA3lEdUBf3oyVXUW8cjSMWz3KEXW?= =?us-ascii?Q?o4kVF15Q9Kigy3ljUNea9ct23m2E0mYBBomjyObWAhFIRGl01mILIn0oO8Ne?= =?us-ascii?Q?4vXwtpO7oB16jdpCM++7VXaH97PhrsXyH00b55jZrDbJfY7iqzgmSHBPhsEP?= =?us-ascii?Q?5o+aAqbGpirXoy/AxIcCL8kny+RToCuELW6SExSSo+YrrDmlP93MndH/6yo9?= =?us-ascii?Q?FNPYLVL4mk9n6xokZ8LIllGZMumhXPxWlr5o0m9Q/2Rdc9xTtImqyktcLLH4?= =?us-ascii?Q?DlBBzCo8BdKjKlYjizYCqabCthsvaLS1rbO0NwJOlJhmeJ0O89W7iJ5UJHbk?= =?us-ascii?Q?40zpvUw47+aX0XDwcxzSFAea5e3mE/WUKqt4jD9ASjRaO2MtrImF7r8hMRyu?= =?us-ascii?Q?vD9B1BE8+PgnlCOSoLY/DbWyRb+zoOinxUYA7h6mPC5s/QLTUh7BYTfSaMJw?= =?us-ascii?Q?GbkclYA6OYZ8LkAqnqGnECUtHeY8yB0r3xBG33bxoUhlOSKMWTFu8yXiGSQ6?= =?us-ascii?Q?9T15Ckovb+bLPMA=3D?= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(1800799024)(36860700013)(82310400026)(376014)(7416014);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Mar 2025 16:45:54.1728 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b22d164b-d733-4c63-060a-08dd5cce5c9d X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: SJ1PEPF00001CE4.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR12MB7474 Content-Type: text/plain; charset="utf-8" Broken target lists are hard to discover as the driver fails at a later initialization stage. Add an error message for this. Example log messages: cxl_mem mem1: failed to find endpoint6:0000:e0:01.3 in target list of dec= oder1.1 cxl_port endpoint6: failed to register decoder6.0: -6 cxl_port endpoint6: probe: 0 Signed-off-by: Robert Richter Reviewed-by: Gregory Price Reviewed-by: Jonathan Cameron Reviewed-by: Dave Jiang Tested-by: Gregory Price Reviewed-by: Alison Schofield Reviewed-by: Dan Williams Reviewed-by: Fabio M. De Francesco --- drivers/cxl/core/region.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/cxl/core/region.c b/drivers/cxl/core/region.c index bd1ce9d8bed7..175f5f600c5d 100644 --- a/drivers/cxl/core/region.c +++ b/drivers/cxl/core/region.c @@ -1805,6 +1805,13 @@ static int find_pos_and_ways(struct cxl_port *port, = struct range *range, } put_device(dev); =20 + if (rc) + dev_err(port->uport_dev, + "failed to find %s:%s in target list of %s\n", + dev_name(&port->dev), + dev_name(port->parent_dport->dport_dev), + dev_name(&cxlsd->cxld.dev)); + return rc; } =20 --=20 2.39.5 From nobody Sat Feb 7 06:13:30 2026 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2053.outbound.protection.outlook.com [40.107.93.53]) (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 AE2E325C6F3; Thu, 6 Mar 2025 16:46:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.93.53 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741279566; cv=fail; b=j6XL0cT/1iMyfdjcqO6n8i09hIj50Z2VhJHVSHQJFOkhPyygahsSK1uyils1Qle1UZZNhyMnjl0Nz0ofSZzwFlilnpCNAnPp2pJIVlI3Tin5945JH9VjGqETNO1Yvv5xEiWtVz16sCKjVMUVEX6kGAEojRQUqzzdY6VgSO1OCB0= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741279566; c=relaxed/simple; bh=qVFh4YQ7NnwWd3oXWLsO5Tim0fF/EzvZXZk/N34YAl4=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=bRm3JElUWlunvsT4185eqkQPkWOT6phF2TYCkTqJ+R/3F0MHHZFRsm4Gq/M/Yv/G39tHLV9M8pt7yOOAiwcUv6u+YUEJ8v2O8gohrVSOeOd2HWe35bjJmxfFPh9riFDKDBh1JF0ah4gYbjm0XeYZSjFfw9SmHu8PBdDZHSWHHTQ= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=EFZcWyu2; arc=fail smtp.client-ip=40.107.93.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="EFZcWyu2" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=GkpvXTMCws4I15/jiOCJkOuxmFZO38dNuqaerDbeIYJXSEiFSEwcB6Ch7T6vdZBHm6W2+J9ePZihs9UZy2x5JDN5/TPrMQvodsp3Agc/GI1POjjoFYsmbw0k1ArAyqs7koWJloEvlRReTb+m/bynFxm8SGO9BI16KnHecMhZLKvvH7GCP8/r3+jCmiGxMfinO26IP6WKev/htihc1i2H8XOJQSvLT6sysaYvwII1H+fyMpj0b3mMJD+CpPRUdbhPV4t45dIn+WA0so3gEQyRvWXa18As4QvDHK185TSp7pMhGxFiKP5Q8u7Zmub5ZSQ5xvcYNxII79bCP64qjPZtmw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=NJs+pBDGPROgLV/9EuIlde+khfaM/org3fI76/a14o0=; b=AtecVvzZHkpcCvbTHcRUCklIDs4zqWySTSlyhLquK1jOxAPjK262QShyJ76dgPSIQ7vWmVZtFu85iHDTG8cvn6d+OVSbz2kE2qjS8TCWumN44sWjrIaYPVqB4uMbSzJfD8uAZhBZH2Who7tReKCdL9mEwWtOEkcb4l+ofOoUJHR2LZ0fYZSYm4azKrQaZ3G7rIG0Klo5jTVnCD4kK9gwB+WIzNVmDejJW/4tpXkiS3CZ9eIL3Ps1xbaeqDvZpkuZYeOz22nirewxXhwMA70qtgWnObFKeE746y+kPqWfnzINp8rT08yQZo8a9Edg9BY0pY5mrlKjyvkcPyfte5JZYQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=intel.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=NJs+pBDGPROgLV/9EuIlde+khfaM/org3fI76/a14o0=; b=EFZcWyu2AarJF+9DcxICvpA8FLFBL7FNJIS8tf0sA35i4Q/ho9E107hfUYICQW4J9e4vgQys2j8uXJ9ZkyXUFgzbBtIf+1vlKxHrWf8E6H/chC8FUvHWu90hxZiP1maTK9EDDI5i4Y98WRXDeG+weLKvXf+HWWz9fU0hoZ9d4mg= Received: from SJ0PR05CA0160.namprd05.prod.outlook.com (2603:10b6:a03:339::15) by PH8PR12MB6819.namprd12.prod.outlook.com (2603:10b6:510:1ca::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8511.19; Thu, 6 Mar 2025 16:45:58 +0000 Received: from SJ1PEPF00001CE7.namprd03.prod.outlook.com (2603:10b6:a03:339:cafe::b6) by SJ0PR05CA0160.outlook.office365.com (2603:10b6:a03:339::15) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8511.17 via Frontend Transport; Thu, 6 Mar 2025 16:45:58 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by SJ1PEPF00001CE7.mail.protection.outlook.com (10.167.242.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8511.15 via Frontend Transport; Thu, 6 Mar 2025 16:45:58 +0000 Received: from rric.localdomain (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Thu, 6 Mar 2025 10:45:54 -0600 From: Robert Richter To: Alison Schofield , Vishal Verma , Ira Weiny , Dan Williams , Jonathan Cameron , Dave Jiang , Davidlohr Bueso CC: , , Gregory Price , "Fabio M. De Francesco" , Terry Bowman , Robert Richter Subject: [PATCH v4 13/14] cxl: Add a dev_dbg() when a decoder was added to a port Date: Thu, 6 Mar 2025 17:44:47 +0100 Message-ID: <20250306164448.3354845-14-rrichter@amd.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250306164448.3354845-1-rrichter@amd.com> References: <20250306164448.3354845-1-rrichter@amd.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ1PEPF00001CE7:EE_|PH8PR12MB6819:EE_ X-MS-Office365-Filtering-Correlation-Id: fb05fa13-065b-4567-9e77-08dd5cce5f36 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|82310400026|7416014|376014|1800799024; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?Xac7YyEEzIDQ2ssH0pbAQxEOsg68ov52NIgBSoH+Ut+bWHfBv+PCmYkPadq3?= =?us-ascii?Q?/v0OOLrSnv+sPwP78WZJW0DDfuK65c6G/keAL8ONe9MOeh9pOECBvKyB3W08?= =?us-ascii?Q?IYxLzJ0Sl40SKDasqwrMJmCi1rh2X7s1CnLmvxj3rtDZQxtkdFmOl8XN70JF?= =?us-ascii?Q?LU990gfjVY1wLtLj7ZmmyGoi+1cDB/ejKBWhFVXjtUUfw9pkMLo8DYslEkOm?= =?us-ascii?Q?icQlYIAV3GinLtlWxDJgjErhyX+rIZcyCg6cvuuzanuXS1apFnODHy78j4oj?= =?us-ascii?Q?19OJCQBKkokA/GFjcI+oUctHTKVghOcFzlDTQbxWB4WPnpCwtIzNAsZBse0n?= =?us-ascii?Q?50AKxegHD3nC7+VeX2jq9REaDklITnQkZ2c15PXktYUcVhpJ1t/vGJs8cOXM?= =?us-ascii?Q?WGixExtH5PGU1WrlxjY3fTxngCTGxxB1uRVDKXy7M4G7FYyrT4I3zIkTgOma?= =?us-ascii?Q?enfXa3XOy/4W/TwOiU/E9jgwE7LEUw6QuxXiZAOrlkUmuzmjalmRgIqpyMF2?= =?us-ascii?Q?BFvXYVA6zC2t/5Xt3ru7pDKL2uwHX+S26Sp0t4AhdYDUd3GBwL5CmtjD4Wlx?= =?us-ascii?Q?3Bg308gaknDBrMhOnAY7pnOtPjRWdcH33HQh/F4K93slOAgWdmXpyQ4noqTT?= =?us-ascii?Q?XTWDDvXgs5Vx/okNQfJ3bgfOR+z7OVvwWZdLOMs+94tLPafAj6Pai2cxPEV0?= =?us-ascii?Q?Vyh5LulCX8HRqAt+6NmHeHrDsK4aNKHH3W+EFkzreqo8Sgb9GhMeL2KS88BB?= =?us-ascii?Q?Z9LbBaozLZAoTVl4N9UeLDKQdl1Rgpp/4V71gTuVN7mS6bcCFL8KAQHa23cG?= =?us-ascii?Q?50HxgHEy7G0KsOQceToV5kOrDgwXh/guNICUZA4Y14KRXoM3moB8vdH67Nvt?= =?us-ascii?Q?DQAHA+3a6P4SYcQ0nBtKgA8tgQ9hVO/1igLyzGOekKpyTxrSCYDIUtN3e5og?= =?us-ascii?Q?OBxo+mlA/szhb7JaILg+Lk/YHcOVkeJLq9uUYWj3LB5Y9Z7TDF35wZlMINli?= =?us-ascii?Q?9E6e/nyAbJ8/U7otkzbtI6QHHD2uCRvVGxd+I4fg+LwXV4Ygp92828KPZFbu?= =?us-ascii?Q?6Fu6hxp60euZcycXHVcuyISnyQF95ozRI4DJjpt+IinJYI2wh2aG/dp1xhZh?= =?us-ascii?Q?h57pk+sPXQq4vRoqGNEKQ8FbBhhGMK084FTL2Qon8L90mKqBe3KZHLMNTRz3?= =?us-ascii?Q?Cu/E38PDoO22Mlxyw3EDPcXZYRuPUaoSn3HNheU15aRW/jbcWWMkMyKn5jbR?= =?us-ascii?Q?bUZcp78O4zYSrler/gPm+bQmm5LKvCwoo1GUiFzXe3ozIgrit4nr7tghCRBs?= =?us-ascii?Q?LrkTaZfE6lV3k/yT3frRGCd/S0vFtzH8U+i4GSBBO0coEL3XVYx0h9TRdsqn?= =?us-ascii?Q?miNViJrnRJKB2he0ChB1iiK7/5qmJnZCEJL6oLDmzrmtGq6Zha0KBpKBbtF5?= =?us-ascii?Q?LBxoxOeu7Bdzw4t3iYS4t00xkvMvZVqrIYBGadbkVGbvhn4irKLWdOv0HbSk?= =?us-ascii?Q?vOrhIcgugwCm3wo=3D?= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(36860700013)(82310400026)(7416014)(376014)(1800799024);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Mar 2025 16:45:58.5349 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: fb05fa13-065b-4567-9e77-08dd5cce5f36 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: SJ1PEPF00001CE7.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH8PR12MB6819 Content-Type: text/plain; charset="utf-8" Improve debugging by adding and unifying messages whenever a decoder was added to a port. It is especially useful to get the decoder mapping of the involved CXL host bridge or PCI device. This avoids a complex lookup of the decoder/port/device mappings in sysfs. Example log messages: cxl_acpi ACPI0017:00: decoder0.0 added to root0 cxl_acpi ACPI0017:00: decoder0.1 added to root0 ... pci0000:e0: decoder1.0 added to port1 pci0000:e0: decoder1.1 added to port1 ... cxl_mem mem0: decoder5.0 added to endpoint5 cxl_mem mem0: decoder5.1 added to endpoint5 Signed-off-by: Robert Richter Reviewed-by: Gregory Price Reviewed-by: Jonathan Cameron Reviewed-by: Dave Jiang Tested-by: Gregory Price Reviewed-by: Alison Schofield --- drivers/cxl/acpi.c | 10 +++++++++- drivers/cxl/core/hdm.c | 3 ++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/drivers/cxl/acpi.c b/drivers/cxl/acpi.c index cb14829bb9be..3e75e612cbc4 100644 --- a/drivers/cxl/acpi.c +++ b/drivers/cxl/acpi.c @@ -421,7 +421,15 @@ static int __cxl_parse_cfmws(struct acpi_cedt_cfmws *c= fmws, rc =3D cxl_decoder_add(cxld, target_map); if (rc) return rc; - return cxl_root_decoder_autoremove(dev, no_free_ptr(cxlrd)); + + rc =3D cxl_root_decoder_autoremove(dev, no_free_ptr(cxlrd)); + if (rc) + return rc; + + dev_dbg(root_port->dev.parent, "%s added to %s\n", + dev_name(&cxld->dev), dev_name(&root_port->dev)); + + return 0; } =20 static int cxl_parse_cfmws(union acpi_subtable_headers *header, void *arg, diff --git a/drivers/cxl/core/hdm.c b/drivers/cxl/core/hdm.c index 70cae4ebf8a4..00c2de629a34 100644 --- a/drivers/cxl/core/hdm.c +++ b/drivers/cxl/core/hdm.c @@ -34,7 +34,8 @@ static int add_hdm_decoder(struct cxl_port *port, struct = cxl_decoder *cxld, if (rc) return rc; =20 - dev_dbg(&cxld->dev, "Added to port %s\n", dev_name(&port->dev)); + dev_dbg(port->uport_dev, "%s added to %s\n", + dev_name(&cxld->dev), dev_name(&port->dev)); =20 return 0; } --=20 2.39.5 From nobody Sat Feb 7 06:13:30 2026 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2067.outbound.protection.outlook.com [40.107.220.67]) (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 C28FE25C6F6; Thu, 6 Mar 2025 16:46:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.220.67 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741279568; cv=fail; b=SYhC4FiYOHkxJjZdfdVcuv6Coie4+8Hk9Iokwvw5ULvNZ6ClRkWVz3CP3YIgskNT5dVq3SGhbhZexBXtrs6xy9N7OfO3bQN9HF/bPR/kUGuUQjt4H5mwM135r+rtKuGB9G31L9A/23JkodG+Wpcy3TqAuzHLsqyNaaL/1VQgHyU= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741279568; c=relaxed/simple; bh=q68rvYXccMhnMN9whFw9DLYKUKZJISHBMsSpyc/META=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=s3+Ut408PBKAVW3eQjM8UUr3ibk/l2ME4LpzhxNLPYKyITmMYNeS2zTnolpQc6LsZyKV4rZgsK5CqPFW64eeceB5mbknGdwe19sbtVnkeCsT9iJQpf8KY24PF1jzYa0A3nUVvmbGRk5sGoUrENwVTHz3k0c+AKV8dXjODRZzk7M= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=C3c4/UnH; arc=fail smtp.client-ip=40.107.220.67 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="C3c4/UnH" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=CrHNBHuDdK1wFuEoZZOhXdp0iT3b3ogb6QMWTKuBY1KI32q8/W42vXIbiF7LqhQIxNbhptDyfpEb2x+/avs1Y1KOWWNvgxDg0HOfh3eJtPmoGRHJ6+yooPo758IF0zW/9lLSX9TwPX6L1wKFv+mvS+f6SLYniDJB+SQEFJxin7NJA7dxKUIr9BdnZ6v7A/k+teeqb6wumLFQSCOodMIPOOxLWdFGa8eIoiJqO0ALEOYaAHJgksyHtNVz8mTEc85WV9aHM6qRGv8Sn7PF9qIuUJLLL5zbXVYjy94cDCyaee1UUZh2TWGL6uzs/42y/vQcBGE8wMbjwGM+AEX7BAf6xQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=gH2eEhoqySD5sLD+wp42rTKAEOvnJqS0yXkr1HBWN1o=; b=dxym5Ur3DAYgQdF6iClXJ+7awPiSksQXREIg42I6So1Hw3HfjJn9SJBOoXstYnP5Q2PIpLxvMj1TCbkeU7gg1vZb0kQvs53vSMj5RlukBJ2EAyfPUyp/zOW7benkTqMZEliWq106Wbi3F42l+Npb9Fmj5FJJCgjo/KYDn93DgJOORO1LlVPNeqvblaWpnPOTdxVAZS+Zp7+LtG9ihwoBu3CNYWzkXEGlE7jFeTAScG8bJzOSxJ8llPU3WYdyU8sacgO9SL4YMGMIOQtzVSfBS19pkpbOt7fLIXxO3Vb62E4DZoTcrQdarBsiD/ed1beh8nVkWAPyuefUDBZYd3571g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=intel.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=gH2eEhoqySD5sLD+wp42rTKAEOvnJqS0yXkr1HBWN1o=; b=C3c4/UnHAYhcs9Xkll4cMFKrTRqsjxyktGHqD1c06xjqF54mEHGlMhaYqc5sS3xTD+Wt7WHiP5NkZFpJ13x8qDNTsBwqmkWWCegky5b0JCYWnfrsyUdFbuDAcvRRf9hfjmxm4CpWqG2DioAdjgGfj9daRGtYrDFBDQFb43jV6XU= Received: from MW4PR03CA0350.namprd03.prod.outlook.com (2603:10b6:303:dc::25) by LV3PR12MB9402.namprd12.prod.outlook.com (2603:10b6:408:213::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8511.19; Thu, 6 Mar 2025 16:46:03 +0000 Received: from SJ1PEPF00001CE8.namprd03.prod.outlook.com (2603:10b6:303:dc:cafe::55) by MW4PR03CA0350.outlook.office365.com (2603:10b6:303:dc::25) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8511.18 via Frontend Transport; Thu, 6 Mar 2025 16:46:02 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by SJ1PEPF00001CE8.mail.protection.outlook.com (10.167.242.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8511.15 via Frontend Transport; Thu, 6 Mar 2025 16:46:02 +0000 Received: from rric.localdomain (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Thu, 6 Mar 2025 10:45:58 -0600 From: Robert Richter To: Alison Schofield , Vishal Verma , Ira Weiny , Dan Williams , Jonathan Cameron , Dave Jiang , Davidlohr Bueso CC: , , Gregory Price , "Fabio M. De Francesco" , Terry Bowman , Robert Richter Subject: [PATCH v4 14/14] cxl/acpi: Unify CFMWS memory log messages with SRAT messages Date: Thu, 6 Mar 2025 17:44:48 +0100 Message-ID: <20250306164448.3354845-15-rrichter@amd.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250306164448.3354845-1-rrichter@amd.com> References: <20250306164448.3354845-1-rrichter@amd.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ1PEPF00001CE8:EE_|LV3PR12MB9402:EE_ X-MS-Office365-Filtering-Correlation-Id: 90889276-e85a-4fba-df69-08dd5cce615b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|7416014|376014|36860700013|1800799024; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?t8xkCRvlazIE82uEWG5om0ryuJ+RS+ZpRySAn9yNoK4lumdiC2m0kI6KXF+Q?= =?us-ascii?Q?3NHgOWd+2YRSk3ppCVS3cdoMeybPF/eWoFJnBeFqjQlnnBMX7/atbRdPaWhR?= =?us-ascii?Q?xKIMXoBeyNjPhVtY4uGkG0srCWXu7Or/qsekgTOrk6TClScQaNTQCyj4D6uD?= =?us-ascii?Q?zq89xRXYNjJHQdeRlDgNPCqvTbAe7ns7dviBcsJwT8PYsred0ZsTqTE9LlMW?= =?us-ascii?Q?S/NnmkspGVMjf9qvnKFykDHBcJH+ebGYTO152Kkz4FghQ+TdsVSDZEOy4ro/?= =?us-ascii?Q?WRLAPJc3BntX+8tBf++kM+ohwlw8wG4oLqFdNgXpS3+Zy5iTOqdfkCRXisE6?= =?us-ascii?Q?DuOTzjeJQXgHlr+z67GSJe2lmooUKTKWU5YHrunrb7jpExlU2oxz0qNZavEm?= =?us-ascii?Q?cdZo+khruf74mVhMES5i3bJwinqaokfcePUYuhsF5bj1fFZITH1jECaFzbvq?= =?us-ascii?Q?Iq8YumSt7pZRd54IbMg3VGjL/w/SKMdjy0B7rr2xVinG2QbRglBPbMwvKleM?= =?us-ascii?Q?PrxE2a1ea96s3VP36DIAdyJ0ldduYMEJie7gFwrPsVaPaf5hjOE9hlOCp0Su?= =?us-ascii?Q?dOMFJpa6MdAcRXgQD9r6Vm1SDNDPsXywZPRtaWebXhZtgBfLV4tSjHhSyyfn?= =?us-ascii?Q?92ZEEDmuVp6wCzvW6L7U8Htj14MyLxyGSrpB70prLT0FHT+G4uwWYN988ih6?= =?us-ascii?Q?wN5viA5BXaCAWur4TNFHk3Xq2ztQZw5IoGjzrWvTeK9BlHXJWKJKEq/fEYpv?= =?us-ascii?Q?SVC77Zxm8kSffiHSwUsBPj+Xn9VLxSYGXar6+b6/Rx88eCc2Y2/DB567GvmJ?= =?us-ascii?Q?jrPGtMhibFr1VGxZ7UuONdZdyJAIaCmWodvmDK9BmyO4dXTTQLZVuxovqBbr?= =?us-ascii?Q?qLR1XOVLNIQ0ybY2ZNNUaF5lYnQ6NDbS/vCV5S/fBhNG50cuJx1FeQnAAL7R?= =?us-ascii?Q?LDzl9pLss2sF1WKDCJwSUJXtbScApC9FxkooW4+RACFLL6GSQRANbtkVh+Kt?= =?us-ascii?Q?XREKVnL3m235nODe4weQvJqsFFnSaOrCg31bhzpeBg2a7Qmu9fbscRABsWrq?= =?us-ascii?Q?q56zPRRs52gZoIVB6SkEAH3uSGrMfyL+3NB8vFCqBYph02iEzk9rlopWya1q?= =?us-ascii?Q?tUaoFGuIMtpxKGHbPW3kZ6uPmEbJwn9OrnS/fzEPMobbnXzpsenaLF/m/m2J?= =?us-ascii?Q?FelxGgsRT0WWaOJfS0ms/p+Xvb0vmqRmz6Tlyz+7mWU7ZMEidCPmWJErjybM?= =?us-ascii?Q?PbMJllVoTkBUenuC0ZKH/jGqpVyn8YLflBEWMNRX6NkOEh49DyF0w6RdwlrA?= =?us-ascii?Q?EC16tdzixNq2W1PEjyW1PBa+0JpbzkFGMXFwlMGyjR5QmqYJ9GaXls96MS5F?= =?us-ascii?Q?lAAK8/Dtg5Z3EROkIPuP0/5mwA9FXYfyGKKC6nBw/hP2a26uj90bRpt534jb?= =?us-ascii?Q?WLaiNIn0yj7M1yG6DUovYoc/dT12zD3yKfXCRg1JtEM1xvzG/2vZHvj8m4xM?= =?us-ascii?Q?eFkSV2ePzXaNyhc=3D?= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(82310400026)(7416014)(376014)(36860700013)(1800799024);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Mar 2025 16:46:02.1188 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 90889276-e85a-4fba-df69-08dd5cce615b X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: SJ1PEPF00001CE8.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV3PR12MB9402 Content-Type: text/plain; charset="utf-8" CFMWS entries have a similar importance as SRAT table entries to describe memory regions. For CXL error analysis and memory debugging information of both is needed. Unify output of both messages to improve logging. Change the style of CFMWS message according to SRAT output. Also, turn messages into a dev_info() same as for SRAT. SRAT pr_info() for reference: drivers/acpi/numa/srat.c: pr_info("SRAT: Node %u PXM %u [mem %#010Lx-%#010Lx]%s%s\n", Signed-off-by: Robert Richter Reviewed-by: Gregory Price Reviewed-by: Jonathan Cameron Reviewed-by: Dave Jiang Tested-by: Gregory Price --- drivers/cxl/acpi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/cxl/acpi.c b/drivers/cxl/acpi.c index 3e75e612cbc4..93c73b163c28 100644 --- a/drivers/cxl/acpi.c +++ b/drivers/cxl/acpi.c @@ -447,7 +447,7 @@ static int cxl_parse_cfmws(union acpi_subtable_headers = *header, void *arg, cfmws->base_hpa, cfmws->base_hpa + cfmws->window_size - 1, rc); else - dev_dbg(dev, "decode range: node: %d range [%#llx - %#llx]\n", + dev_info(dev, "ACPI: CFMWS: Node %u [mem %#010Lx-%#010Lx]\n", phys_to_target_node(cfmws->base_hpa), cfmws->base_hpa, cfmws->base_hpa + cfmws->window_size - 1); =20 --=20 2.39.5