From patchwork Wed Oct 18 17:16:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Richter X-Patchwork-Id: 13427539 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A6DF13D3BD for ; Wed, 18 Oct 2023 17:19:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="j8r4D3/U" Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2065.outbound.protection.outlook.com [40.107.237.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C4A3730C4; Wed, 18 Oct 2023 10:18:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kbIm2tHtuuDjbRgy3ZAaPdo5Oye261ziciy0OoyGRrA8uVpNBaTfDMp8iGho0sePZBaQZHFCV7O1r9sUGE3HPSXDYDBjG5f467zc7psjyz5mkuqMygzHcYb3PD7DAy8mV8wR30J3uWWuiSJ2dQDTs8Cq0TOnZMCVwNA3WHRMN6ECHOdiNSkwIWPmAPcOo94FjOke83u99G4HpJCwvXG/5cRZRUrOo16j0Lg6XFHcVbr153jICdDJHL5w+3ooYXc8vGYQ/NAE8ECu9wsNrYV1YKxOcOjuSjtJWQStFHvI1TdCbE/C6vxF+p+4EuHV75TM3Z/z3q3KXjs2GANX2E1Few== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=NfsvuKuyDi/tXql6AZNMGDRoa5dOzFIVFGCOqCrVrFQ=; b=oGg7O5FLgMH1ByEpYgamUpP++7Y3rdJ9oA2+FXfaS1WP21mzCTdQL3jvYFqfYMEDlSv4MfYJCya/rVXG8BktYyGAprm4ZLmEAGn732OHWlPUZD1vWqUvJPSgQWG2CaVpWBKknw+txFHzDUjJ1LGAP6MEGA95IVXGs/BPPxrs8ASTFx3bzhoKhHr6Csu2D38ewgIXOm4gUmUq6QTUfaJgPpROQ30vn3idmR0X9rIEN+DOoS9Ca1zkn3O8wNPCvgl77xjFNwOUNOC33yZ2jFn/xHMK8yj+UBoPueOdbXpZGnp9wl3+xvlbYtwAjQgeZWJNntSFx8KoFjeRIhEhwMQRiw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=stgolabs.net 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 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=NfsvuKuyDi/tXql6AZNMGDRoa5dOzFIVFGCOqCrVrFQ=; b=j8r4D3/UDHVLkzZuSnP61Xm0Y+GcgYMsC2mAH7wAXA0WwZQFBDCQNPs33nNwF8ni+TOACGJMaczGokDwPveXveRzroFDPBybFsqgoRyM8OOo2krqA8UoVY7GU8C/1Rrh7JLeT4pas3UCnK2yzVx7sr+ahufj9T13T+PoB3vX46g= Received: from SN6PR2101CA0025.namprd21.prod.outlook.com (2603:10b6:805:106::35) by MN2PR12MB4440.namprd12.prod.outlook.com (2603:10b6:208:26e::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6907.24; Wed, 18 Oct 2023 17:18:08 +0000 Received: from SN1PEPF0002529D.namprd05.prod.outlook.com (2603:10b6:805:106:cafe::44) by SN6PR2101CA0025.outlook.office365.com (2603:10b6:805:106::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6933.7 via Frontend Transport; Wed, 18 Oct 2023 17:18:08 +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 SN1PEPF0002529D.mail.protection.outlook.com (10.167.242.4) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6907.20 via Frontend Transport; Wed, 18 Oct 2023 17:18:07 +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.27; Wed, 18 Oct 2023 12:18:04 -0500 From: Robert Richter To: Davidlohr Bueso , Jonathan Cameron , Dave Jiang , "Alison Schofield" , Vishal Verma , Ira Weiny , Ben Widawsky , Dan Williams , "Robert Richter" CC: , , Bjorn Helgaas , Terry Bowman , Jonathan Cameron Subject: [PATCH v12 01/20] cxl/port: Fix release of RCD endpoints Date: Wed, 18 Oct 2023 19:16:54 +0200 Message-ID: <20231018171713.1883517-2-rrichter@amd.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20231018171713.1883517-1-rrichter@amd.com> References: <20231018171713.1883517-1-rrichter@amd.com> Precedence: bulk X-Mailing-List: linux-cxl@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN1PEPF0002529D:EE_|MN2PR12MB4440:EE_ X-MS-Office365-Filtering-Correlation-Id: c3ef10a5-9709-44a6-5c8e-08dbcffe3286 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: foIJOp8RvBUdJbZnpX4/T8J1HFQ3RGrFuQ2hCHOGyWvgUtlR8ujjgDXHX14Be+ZoC79TevXE41v6rCmFCWkMuEGR2chGECvePAnKqbux635lzaAFjSYM12FO0ezyD+bm4JwNdOHvKn1td3j8gwzfYJzw3x5nrxx54EoU3F5XU3eDNb1NHMBp86ntypdj5F3GxEkAD+uECmVEJMOMGuON1u9V5EUWHvgXyioty6KGEbzm1lYK+QIeVFf2Jqwxoev8YEfVC9m6HP9c6yAFkht9fsrFjOC3A9fkBy+M3UzHf+kioN6vyHn131F3Wzkd8Hpy4a5fm0dbr5A9g5xG1FI4JAMTertdDu4QIiM4UGECkn1+RWfZSIDg75/I1GHzzACPIIzJswNWZ3ZUV8GJnLgKhbDdo5FWLU65XIv/CwpaDFwCAe7is6NbTybkWvsoQGR0oKYz9jaHkM4z45rSkUpOfS515hD7bW7BOw1VhhNGt4qnKeYSCOot20nh/TrHOO3JQQ3m4j0zqgr3vOJzBhOHlvBK3Qwbl75/VYLPrpmLw0ll3ScuEgQxYR25gxkJiv/GC00uAoiJNfWxInJn4N7f1pALw6WVWFdZffiNqOFsRaWM4j5WcOW0GtDG3WWuCV6S7oordQc+apue2MSVWAGcrnGseaoUG7EfPqxfsyoH4OqmE6rwQoZjNx/hnBX3WlCtAUQTAeXPEs9TAV0mICNNOZV56OFypT5JhRDF+mFtflMFkyYUBKQb2c6mQVSr+/CTxeSeDlK596uEguQEiD2eIA== 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:(13230031)(4636009)(346002)(136003)(39860400002)(376002)(396003)(230922051799003)(186009)(1800799009)(451199024)(82310400011)(64100799003)(46966006)(40470700004)(36840700001)(36860700001)(7049001)(426003)(336012)(26005)(16526019)(82740400003)(356005)(47076005)(40460700003)(83380400001)(7416002)(41300700001)(54906003)(8936002)(110136005)(70586007)(8676002)(4326008)(5660300002)(1076003)(70206006)(316002)(2906002)(478600001)(6666004)(40480700001)(81166007)(2616005)(36756003)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Oct 2023 17:18:07.8584 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c3ef10a5-9709-44a6-5c8e-08dbcffe3286 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: SN1PEPF0002529D.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4440 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Binding and unbindind RCD endpoints (e.g. mem0 device) caused the corresponding endpoint not being released. Reason for that is the wrong port discovered for RCD endpoints. See cxl_mem_probe() for proper endpoint parent detection. Fix delete_endpoint() respectively. Fixes: 0a19bfc8de93 ("cxl/port: Add RCD endpoint port enumeration") Signed-off-by: Robert Richter Reviewed-by: Jonathan Cameron Reported-by: Robert Richter Signed-off-by: Dan Williams Reviewed-by: Robert Richter Tested-by: Robert Richter --- drivers/cxl/core/port.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/cxl/core/port.c b/drivers/cxl/core/port.c index 7ca01a834e18..d4572a02989a 100644 --- a/drivers/cxl/core/port.c +++ b/drivers/cxl/core/port.c @@ -1222,12 +1222,17 @@ static void delete_endpoint(void *data) struct cxl_memdev *cxlmd = data; struct cxl_port *endpoint = cxlmd->endpoint; struct cxl_port *parent_port; + struct cxl_dport *dport; struct device *parent; - parent_port = cxl_mem_find_port(cxlmd, NULL); + parent_port = cxl_mem_find_port(cxlmd, &dport); if (!parent_port) goto out; - parent = &parent_port->dev; + + if (dport->rch) + parent = parent_port->uport_dev; + else + parent = &parent_port->dev; device_lock(parent); if (parent->driver && !endpoint->dead) { From patchwork Wed Oct 18 17:16:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Richter X-Patchwork-Id: 13427538 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B0BDA3D3BD for ; Wed, 18 Oct 2023 17:18:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="VzNH1j90" Received: from NAM02-DM3-obe.outbound.protection.outlook.com (mail-dm3nam02on2054.outbound.protection.outlook.com [40.107.95.54]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EBE0530DD; Wed, 18 Oct 2023 10:18:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lGW9SFnUR638xmZMdx+0qNPgULsprNYk1vQ8ZmfWlSDA9Xr9aFNKTYFK/vkKZiQ47pZl3TsoYz7QE/KNQ0NCTvfgUe7/lLHr+Gz26Zv67u2nw9sKt/RXtlC1FPe9o97hfHRuzGmeKsfh4sDgmdfKSaEk5DgdM0KQilZGW7Kk504LidQD3OSveHIwMcyym4tVRscCw8PFwgSCqOU1Qt231Dy3aDlOT3PUmKIly/ETEYS/Yt/xcM0RE0ehZf+h6LJDM7l5viFBVSfrM4/JELTQ9RclW4h0qVg1TzzawzZzk1fHILEWvDeuaHoJsszjFrB0zPmQ9E5aSftYO8XfhBYYow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=HzLKdHzELpATSnIHowrrl7C2VHnJBDvxzs4mMRxd4YY=; b=AhWUtaFiKXYL0sXBumy8iIzC9af6VIffbnie8IvABeQgcEgtuQL2U2zZzNWQmB4+TW+BFGTD+Lg5O2eFQ3j/CVgZSN4aWGuBsiv58xy6sj0143fOmX+1NuaR/cXGXc5LPkHzRE7uIgsYsEQlvAtb8s5C1YKqT+rPDUAtQPA4GJfyZ3KAnKo8uFmamrZLQ3YqxNf0h3Wly7LdKK28KJLVJuCE3X5J0lKlhNJe8WjSS2sTzToEKUoiAU8QasSkzg/VtXQ/Nrb8WC07mywJE8P94cUvrx6A3ft2tz9eF0Xb33C1yjp56uIVTJLyQLExvxpRo21uUmK9xmTvknyvZvjAZQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=stgolabs.net 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 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=HzLKdHzELpATSnIHowrrl7C2VHnJBDvxzs4mMRxd4YY=; b=VzNH1j90BMJyP678vcP18OU+pUEF/duq9zTZ1bsjGyHxk4M1QfCdcu95uTxP9Nk5J1IGRMPUdJow0KJ8ImrEahoLBaf7c4omHKoLOku+3W4OVFvGwVL6Ph8GOFnMR+ICuw0Wu0CCU/tvTcizIQ9s6VuWkRwZ59x3nknWRV88kqk= Received: from SA0PR11CA0183.namprd11.prod.outlook.com (2603:10b6:806:1bc::8) by LV3PR12MB9331.namprd12.prod.outlook.com (2603:10b6:408:219::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.36; Wed, 18 Oct 2023 17:18:12 +0000 Received: from SN1PEPF000252A2.namprd05.prod.outlook.com (2603:10b6:806:1bc:cafe::6c) by SA0PR11CA0183.outlook.office365.com (2603:10b6:806:1bc::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6907.21 via Frontend Transport; Wed, 18 Oct 2023 17:18:11 +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 SN1PEPF000252A2.mail.protection.outlook.com (10.167.242.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6907.20 via Frontend Transport; Wed, 18 Oct 2023 17:18: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.27; Wed, 18 Oct 2023 12:18:08 -0500 From: Robert Richter To: Davidlohr Bueso , Jonathan Cameron , Dave Jiang , "Alison Schofield" , Vishal Verma , Ira Weiny , Ben Widawsky , Dan Williams , "Robert Richter" , Terry Bowman CC: , , Bjorn Helgaas , Jonathan Cameron Subject: [PATCH v12 02/20] cxl/core/regs: Rename @dev to @host in struct cxl_register_map Date: Wed, 18 Oct 2023 19:16:55 +0200 Message-ID: <20231018171713.1883517-3-rrichter@amd.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20231018171713.1883517-1-rrichter@amd.com> References: <20231018171713.1883517-1-rrichter@amd.com> Precedence: bulk X-Mailing-List: linux-cxl@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN1PEPF000252A2:EE_|LV3PR12MB9331:EE_ X-MS-Office365-Filtering-Correlation-Id: 5562c569-9f3d-44b4-a843-08dbcffe34b8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: dDACd2Jp+LDZC1XHYf+End9PrA6/Ot66atcTsE995ab3uNvd4Se8VJH8FAkrENORX3M4mI4asi05oVDoDrOIeDpazQRMLU3VDCchtMGHWzVSVnocFLgpMgZoq43NcBxr7b9E45qBA1seaMMqH/fad+TE3YgeUaYqdvu6DfYtwy5EgGxc4Dn8NrsHoAe2F74Tl19MEUUfLGKNa1K9uRzDazMhYLUcqtPLy9D29IQCQtu8E/FcALNXpDdu7v53IsubyN4i1JUKvOWDK/V9JXr+U8IEXr9ZGW096rvoOknVb0ktwOGEbjEoVoWkFZcwU5lNF6zm19QqdBLkFCNiwdNuZOA171YfH09e7G1zI0VZZPPiVSm3nxPqOSSFC3HT4kTf+4pcYMYLqPzBTygeI1CQxRziMbJRTCCn7zqV8B/k+mFtw9wcefRKixPrsR+NQ6HrqmPqmgmCLJtvfglrmBojXB3m9kDYlyRm3TevlYkUD8RyLU+1eT53skZojy+ZsCJGGAUviz4MKOfP8ZFpbKV9F79Hhy0O8LYumL8LgqjvMH3R92Z4I9LxOYs2mz5EFY8YtxNYh4KPWKa2P1/BWaXIUGgflcFCI/6IhWmhVhEPoftdjsbCBTHCKNp04v4vBwJ5U8Kp94ZzOSE31aKgCsGyR3EscHEOIki6xNR/aOl/DDZjLw4KK2jsim1WDtl/3LKb+yWbCst3dXEfMbVV/FubPJmYEvS2Jw3cdHSbuKJ5vc3tXzxj2DEQgaLAFCEMjXDsRShsRJvDqV/qZQVKqNDy+pbNMw7eTqcuTP5Oj+oLJcQ= 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:(13230031)(4636009)(136003)(346002)(39860400002)(376002)(396003)(230922051799003)(82310400011)(451199024)(186009)(64100799003)(1800799009)(36840700001)(46966006)(40470700004)(40480700001)(5660300002)(36860700001)(2906002)(16526019)(6666004)(40460700003)(83380400001)(426003)(26005)(36756003)(336012)(2616005)(356005)(81166007)(921005)(47076005)(82740400003)(7416002)(1076003)(316002)(110136005)(70206006)(54906003)(6636002)(70586007)(8676002)(4326008)(41300700001)(8936002)(478600001)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Oct 2023 17:18:11.5591 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5562c569-9f3d-44b4-a843-08dbcffe34b8 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: SN1PEPF000252A2.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV3PR12MB9331 X-Spam-Status: No, score=0.8 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net The primary role of @dev is to host the mappings for devm operations. @dev is too ambiguous as a name. I.e. when does @dev refer to the 'struct device *' instance that the registers belong, and when does @dev refer to the 'struct device *' instance hosting the mapping for devm operations? Clarify the role of @dev in cxl_register_map by renaming it to @host. Also, rename local variables to 'host' where map->host is used. Add Fixes: tag as the fix in the next patch depends on this change. Fixes: 5d2ffbe4b81a ("cxl/port: Store the downstream port's Component Register mappings in struct cxl_dport") Signed-off-by: Terry Bowman Signed-off-by: Robert Richter Reviewed-by: Jonathan Cameron --- drivers/cxl/core/hdm.c | 2 +- drivers/cxl/core/port.c | 4 ++-- drivers/cxl/core/regs.c | 28 ++++++++++++++-------------- drivers/cxl/cxl.h | 4 ++-- drivers/cxl/pci.c | 2 +- 5 files changed, 20 insertions(+), 20 deletions(-) diff --git a/drivers/cxl/core/hdm.c b/drivers/cxl/core/hdm.c index 4449b34a80cc..11d9971f3e8c 100644 --- a/drivers/cxl/core/hdm.c +++ b/drivers/cxl/core/hdm.c @@ -85,7 +85,7 @@ static int map_hdm_decoder_regs(struct cxl_port *port, void __iomem *crb, struct cxl_component_regs *regs) { struct cxl_register_map map = { - .dev = &port->dev, + .host = &port->dev, .resource = port->component_reg_phys, .base = crb, .max_size = CXL_COMPONENT_REG_BLOCK_SIZE, diff --git a/drivers/cxl/core/port.c b/drivers/cxl/core/port.c index d4572a02989a..033651a5da30 100644 --- a/drivers/cxl/core/port.c +++ b/drivers/cxl/core/port.c @@ -691,14 +691,14 @@ static struct cxl_port *cxl_port_alloc(struct device *uport_dev, return ERR_PTR(rc); } -static int cxl_setup_comp_regs(struct device *dev, struct cxl_register_map *map, +static int cxl_setup_comp_regs(struct device *host, struct cxl_register_map *map, resource_size_t component_reg_phys) { if (component_reg_phys == CXL_RESOURCE_NONE) return 0; *map = (struct cxl_register_map) { - .dev = dev, + .host = host, .reg_type = CXL_REGLOC_RBI_COMPONENT, .resource = component_reg_phys, .max_size = CXL_COMPONENT_REG_BLOCK_SIZE, diff --git a/drivers/cxl/core/regs.c b/drivers/cxl/core/regs.c index 6281127b3e9d..e0fbe964f6f0 100644 --- a/drivers/cxl/core/regs.c +++ b/drivers/cxl/core/regs.c @@ -204,7 +204,7 @@ int cxl_map_component_regs(const struct cxl_register_map *map, struct cxl_component_regs *regs, unsigned long map_mask) { - struct device *dev = map->dev; + struct device *host = map->host; struct mapinfo { const struct cxl_reg_map *rmap; void __iomem **addr; @@ -225,7 +225,7 @@ int cxl_map_component_regs(const struct cxl_register_map *map, continue; phys_addr = map->resource + mi->rmap->offset; length = mi->rmap->size; - *(mi->addr) = devm_cxl_iomap_block(dev, phys_addr, length); + *(mi->addr) = devm_cxl_iomap_block(host, phys_addr, length); if (!*(mi->addr)) return -ENOMEM; } @@ -237,7 +237,7 @@ EXPORT_SYMBOL_NS_GPL(cxl_map_component_regs, CXL); int cxl_map_device_regs(const struct cxl_register_map *map, struct cxl_device_regs *regs) { - struct device *dev = map->dev; + struct device *host = map->host; resource_size_t phys_addr = map->resource; struct mapinfo { const struct cxl_reg_map *rmap; @@ -259,7 +259,7 @@ int cxl_map_device_regs(const struct cxl_register_map *map, addr = phys_addr + mi->rmap->offset; length = mi->rmap->size; - *(mi->addr) = devm_cxl_iomap_block(dev, addr, length); + *(mi->addr) = devm_cxl_iomap_block(host, addr, length); if (!*(mi->addr)) return -ENOMEM; } @@ -309,7 +309,7 @@ int cxl_find_regblock_instance(struct pci_dev *pdev, enum cxl_regloc_type type, int regloc, i; *map = (struct cxl_register_map) { - .dev = &pdev->dev, + .host = &pdev->dev, .resource = CXL_RESOURCE_NONE, }; @@ -403,15 +403,15 @@ EXPORT_SYMBOL_NS_GPL(cxl_map_pmu_regs, CXL); static int cxl_map_regblock(struct cxl_register_map *map) { - struct device *dev = map->dev; + struct device *host = map->host; map->base = ioremap(map->resource, map->max_size); if (!map->base) { - dev_err(dev, "failed to map registers\n"); + dev_err(host, "failed to map registers\n"); return -ENOMEM; } - dev_dbg(dev, "Mapped CXL Memory Device resource %pa\n", &map->resource); + dev_dbg(host, "Mapped CXL Memory Device resource %pa\n", &map->resource); return 0; } @@ -425,28 +425,28 @@ static int cxl_probe_regs(struct cxl_register_map *map) { struct cxl_component_reg_map *comp_map; struct cxl_device_reg_map *dev_map; - struct device *dev = map->dev; + struct device *host = map->host; void __iomem *base = map->base; switch (map->reg_type) { case CXL_REGLOC_RBI_COMPONENT: comp_map = &map->component_map; - cxl_probe_component_regs(dev, base, comp_map); - dev_dbg(dev, "Set up component registers\n"); + cxl_probe_component_regs(host, base, comp_map); + dev_dbg(host, "Set up component registers\n"); break; case CXL_REGLOC_RBI_MEMDEV: dev_map = &map->device_map; - cxl_probe_device_regs(dev, base, dev_map); + cxl_probe_device_regs(host, base, dev_map); if (!dev_map->status.valid || !dev_map->mbox.valid || !dev_map->memdev.valid) { - dev_err(dev, "registers not found: %s%s%s\n", + dev_err(host, "registers not found: %s%s%s\n", !dev_map->status.valid ? "status " : "", !dev_map->mbox.valid ? "mbox " : "", !dev_map->memdev.valid ? "memdev " : ""); return -ENXIO; } - dev_dbg(dev, "Probing device registers...\n"); + dev_dbg(host, "Probing device registers...\n"); break; default: break; diff --git a/drivers/cxl/cxl.h b/drivers/cxl/cxl.h index 76d92561af29..b5b015b661ea 100644 --- a/drivers/cxl/cxl.h +++ b/drivers/cxl/cxl.h @@ -247,7 +247,7 @@ struct cxl_pmu_reg_map { /** * struct cxl_register_map - DVSEC harvested register block mapping parameters - * @dev: device for devm operations and logging + * @host: device for devm operations and logging * @base: virtual base of the register-block-BAR + @block_offset * @resource: physical resource base of the register block * @max_size: maximum mapping size to perform register search @@ -257,7 +257,7 @@ struct cxl_pmu_reg_map { * @pmu_map: cxl_reg_maps for CXL Performance Monitoring Units */ struct cxl_register_map { - struct device *dev; + struct device *host; void __iomem *base; resource_size_t resource; resource_size_t max_size; diff --git a/drivers/cxl/pci.c b/drivers/cxl/pci.c index 44a21ab7add5..f9d852957809 100644 --- a/drivers/cxl/pci.c +++ b/drivers/cxl/pci.c @@ -484,7 +484,7 @@ static int cxl_rcrb_get_comp_regs(struct pci_dev *pdev, resource_size_t component_reg_phys; *map = (struct cxl_register_map) { - .dev = &pdev->dev, + .host = &pdev->dev, .resource = CXL_RESOURCE_NONE, }; From patchwork Wed Oct 18 17:16:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Richter X-Patchwork-Id: 13427537 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 153FF199CE for ; Wed, 18 Oct 2023 17:18:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="VwKB/JYT" Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on2064.outbound.protection.outlook.com [40.107.96.64]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6054AD41; Wed, 18 Oct 2023 10:18:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jEsSpy46ZNWUdIDd6Z3gvYEhF5HtkHjKe5SRjJSm4JaB3KO4d9A9GMk7S7MUHt4HR4bXvXY+keSMhq3iYOVYz2d7cqhuoo8viu30iSO17AOjExAIe9kFgeIfEErhgcgMzARbBaRpXuiEZci4evQEDlgzv5tiZwBcW0XYHWrecRNvmTqOjqvoJKH1TLINzjnPfuSk6esXWHWOkg5a+hAcZQo1MfzPALL2Z07HFirH7Dit7RNMQwLI324YixXi2bvH/Y+UQHT8Maa2M+//U1JZgbulEnQqCmJLVJYN7LVFVYI5Nj6psbLdMMJsHL4NDofedSF1/hjRzqz/kx8TZOuOdw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=+mpbMDvyRqMdfoxvXeGGWdCuDclZXRANG1e6m6hVK+I=; b=aNxxyV1K8gl1IgT9g1RsNZH1gRaJBSNTxf61Qo+Lov+8bmYeImZSYOKyoxZAGcn6zu0xHeJER0oABPVk3hxDzVm1UL0e6tkCSKXJfru88tFr5UbtEb86Vm0D7W7kLibkMS8EtdnThsdTri2wMhzd/jqqT5BkK2/8P4K574aXt3WE6m2oYQIOUsbBVT86ZeEUP4WLBh5jCv2Ue/bQbvY1AlQUDwn9oSjNCNEFs2yVUpCRelG8IEqnz0FFN8ol2/iRlcXsOfatk91DF6sK5RVSnFxylXn8gv2XLUytC/pS3LKz/2nQvsMS6cJwrQw2nBZ9RtVtq1i9RHDWQ91fufcHCA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=temperror (sender ip is 165.204.84.17) smtp.rcpttodomain=stgolabs.net smtp.mailfrom=amd.com; dmarc=temperror action=none header.from=amd.com; dkim=none (message not signed); arc=none 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=+mpbMDvyRqMdfoxvXeGGWdCuDclZXRANG1e6m6hVK+I=; b=VwKB/JYTvyrdwyubj7h3P4GFGF/ybASE3Rywa37eGh6OjfUb/m5BbdFzzR4owM9LZ7WzF1ro0tbD9oYWhmbGdQkPM/ROqNwnt9r/41XdHmeb0MtGoCubO2t7hxl5JOS9gh1JicaULLC8lDxjd8Fy4pQsR3aABDk10FMRfOOUqNw= Received: from PR1P264CA0040.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:2cb::19) by DM6PR12MB4354.namprd12.prod.outlook.com (2603:10b6:5:28f::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.36; Wed, 18 Oct 2023 17:18:18 +0000 Received: from SN1PEPF0002529E.namprd05.prod.outlook.com (2603:10a6:102:2cb:cafe::94) by PR1P264CA0040.outlook.office365.com (2603:10a6:102:2cb::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6907.22 via Frontend Transport; Wed, 18 Oct 2023 17:18:17 +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 SN1PEPF0002529E.mail.protection.outlook.com (10.167.242.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6907.20 via Frontend Transport; Wed, 18 Oct 2023 17:18:15 +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.27; Wed, 18 Oct 2023 12:18:11 -0500 From: Robert Richter To: Davidlohr Bueso , Jonathan Cameron , Dave Jiang , "Alison Schofield" , Vishal Verma , Ira Weiny , Ben Widawsky , Dan Williams , Terry Bowman , Robert Richter CC: , , Bjorn Helgaas , Jonathan Cameron Subject: [PATCH v12 03/20] cxl/port: Fix @host confusion in cxl_dport_setup_regs() Date: Wed, 18 Oct 2023 19:16:56 +0200 Message-ID: <20231018171713.1883517-4-rrichter@amd.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20231018171713.1883517-1-rrichter@amd.com> References: <20231018171713.1883517-1-rrichter@amd.com> Precedence: bulk X-Mailing-List: linux-cxl@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN1PEPF0002529E:EE_|DM6PR12MB4354:EE_ X-MS-Office365-Filtering-Correlation-Id: 386cad41-ed44-46be-93e2-08dbcffe376b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: gBPSwPm18cX/JugJH7sgL6Hzt+8iujRzg2usXq5QIY5GVeGw/TQyUQ1MdBLVa25Os5+ZFMBnIFFukaDCUuJADUSBb+BB3NoM8HNLeYoSnRUyzL6lRPZKWXLK6Jdc1LlmEqbvg3tZMfPXHb9QfWT7VV1aFtb7x6foiDBujH8FdkvpcrDeTlndpmAuEd26qevkjLSoqFdjrpjAAZz011Sa9YkHj+Ak0gWJzu+w8WPXnA28ZCUbG3FUuYaHs8qbji30LF2X7+qn+01sHgvJNGVZiOrV+jebeJV7YqjRmSATvB3gdGPWu9wyVJMYyHfmSKomr2A47kxFLsYNQWvRNTFxCjOifn1CgFYYArGzUClglHupEEWM62iMsu5qRD5qz4+VE7wKOetdkL2bawjVfcZ+nxxV4NROkatJfyNhy9WKO7tK5MCJeFjaxOasRRQzxP9bHlwhfZSQx2Hv2P04PtbBGoFhVAYp2u+vxPuQKIQmEUXPIUrDTzfE6z5lQiLgg65I3Q/fRnh9vaK+O3Psd19ilMMjzsopX7k4KsR0K5FNPLF3sR6R4KL9IZUlWr/8dj4lD1X6liUCRzVTzmvFe0v63y7cWaXatK05uDPRw4iE/6j9ewrgFQF1ztOu66jIhLyqjPS3GLXQqAoZEOy+UKBQY9Ko22fq7SB5yfyQxgVQ88ndev7zr/Or55uDsSXSjAbcSk/M5XCkBpQUE4/FsYkC1XdM+gvf0DGVCIWJqJrnwiq6sthhLLI1HR3gJTpO4EBzz13qwmx/0kELWQhAuRPwJ6FMxQp/UzWOr+07fLlIeDc= 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:(13230031)(4636009)(346002)(136003)(39860400002)(396003)(376002)(230922051799003)(82310400011)(1800799009)(64100799003)(451199024)(186009)(40470700004)(36840700001)(46966006)(7416002)(2906002)(63370400001)(356005)(63350400001)(921005)(110136005)(40480700001)(478600001)(81166007)(41300700001)(36756003)(54906003)(70206006)(70586007)(36860700001)(7049001)(6666004)(316002)(8676002)(1076003)(2616005)(26005)(16526019)(336012)(426003)(82740400003)(40460700003)(83380400001)(4326008)(47076005)(8936002)(5660300002)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Oct 2023 17:18:15.5872 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 386cad41-ed44-46be-93e2-08dbcffe376b 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: SN1PEPF0002529E.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4354 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net From: Dan Williams commit 5d2ffbe4b81a ("cxl/port: Store the downstream port's Component Register mappings in struct cxl_dport") ...moved the dport component registers from a raw component_reg_phys passed in at dport instantiation time to a 'struct cxl_register_map' populated with both the component register data *and* the "host" device for mapping operations. While typical CXL switch dports are mapped by their associated 'struct cxl_port', an RCH host bridge dport registered by cxl_acpi needs to wait until the cxl_mem driver makes the attachment to map the registers. This is because there are no intervening 'struct cxl_port' instances between the root cxl_port and the endpoint port in an RCH topology. For now just mark the host as NULL in the RCH dport case until code that needs to map the dport registers arrives. This patch is not flagged for -stable since nothing in the current driver uses the dport->comp_map. Now, I am slightly uneasy that cxl_setup_comp_regs() sets map->host to a wrong value and then cxl_dport_setup_regs() fixes it up, but the alternatives I came up with are more messy. For example, adding an @logdev to 'struct cxl_register_map' that the dev_printk()s can fall back to when @host is NULL. I settled on "post-fixup+comment" since it is only RCH dports that have this special case where register probing is split between a host-bridge RCRB lookup and when cxl_mem_probe() does the association of the cxl_memdev and endpoint port. Fixes: 5d2ffbe4b81a ("cxl/port: Store the downstream port's Component Register mappings in struct cxl_dport") Signed-off-by: Dan Williams [kept dev_dbg() message] [moved rename of @comp_map to @reg_map into next patch] Signed-off-by: Robert Richter Reviewed-by: Jonathan Cameron --- drivers/cxl/core/port.c | 43 +++++++++++++++++++++++++++++------------ 1 file changed, 31 insertions(+), 12 deletions(-) diff --git a/drivers/cxl/core/port.c b/drivers/cxl/core/port.c index 033651a5da30..9b1136018f18 100644 --- a/drivers/cxl/core/port.c +++ b/drivers/cxl/core/port.c @@ -716,13 +716,23 @@ static int cxl_port_setup_regs(struct cxl_port *port, component_reg_phys); } -static int cxl_dport_setup_regs(struct cxl_dport *dport, +static int cxl_dport_setup_regs(struct device *host, struct cxl_dport *dport, resource_size_t component_reg_phys) { + int rc; + if (dev_is_platform(dport->dport_dev)) return 0; - return cxl_setup_comp_regs(dport->dport_dev, &dport->comp_map, - component_reg_phys); + + /* + * use @dport->dport_dev for the context for error messages during + * register probing, and fixup @host after the fact, since @host may be + * NULL. + */ + rc = cxl_setup_comp_regs(dport->dport_dev, &dport->comp_map, + component_reg_phys); + dport->comp_map.host = host; + return rc; } static struct cxl_port *__devm_cxl_add_port(struct device *host, @@ -983,7 +993,16 @@ __devm_cxl_add_dport(struct cxl_port *port, struct device *dport_dev, if (!dport) return ERR_PTR(-ENOMEM); - if (rcrb != CXL_RESOURCE_NONE) { + dport->dport_dev = dport_dev; + dport->port_id = port_id; + dport->port = port; + + if (rcrb == CXL_RESOURCE_NONE) { + rc = cxl_dport_setup_regs(&port->dev, dport, + component_reg_phys); + if (rc) + return ERR_PTR(rc); + } else { dport->rcrb.base = rcrb; component_reg_phys = __rcrb_to_component(dport_dev, &dport->rcrb, CXL_RCRB_DOWNSTREAM); @@ -992,6 +1011,14 @@ __devm_cxl_add_dport(struct cxl_port *port, struct device *dport_dev, return ERR_PTR(-ENXIO); } + /* + * RCH @dport is not ready to map until associated with its + * memdev + */ + rc = cxl_dport_setup_regs(NULL, dport, component_reg_phys); + if (rc) + return ERR_PTR(rc); + dport->rch = true; } @@ -999,14 +1026,6 @@ __devm_cxl_add_dport(struct cxl_port *port, struct device *dport_dev, dev_dbg(dport_dev, "Component Registers found for dport: %pa\n", &component_reg_phys); - dport->dport_dev = dport_dev; - dport->port_id = port_id; - dport->port = port; - - rc = cxl_dport_setup_regs(dport, component_reg_phys); - if (rc) - return ERR_PTR(rc); - cond_cxl_root_lock(port); rc = add_dport(port, dport); cond_cxl_root_unlock(port); From patchwork Wed Oct 18 17:16:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Richter X-Patchwork-Id: 13427540 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B5E55199CE for ; Wed, 18 Oct 2023 17:19:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="djHaFSO3" Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2045.outbound.protection.outlook.com [40.107.92.45]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3A3F5125; Wed, 18 Oct 2023 10:18:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=klc5xN+z16UErMyr6tlekb7YVhicpJobOqc3RFLZlPX2azczkPau4cqRvXqzsbJuz8xB/JRm4a2GCAN/k8erNaFHX8M/h3X7ZboXw33atqkxkxRwsxnDHrlTFKH38372EP/eO0A3TODcRAlM5N9BH+UFt6yA0+6aXAQjyiQ0vchQdHgPgMMALywFiBKNThXysWudsilUQlIJYnCH21j8Vqeow/K44uus4PBLTyoJDHDWHjVbq+pTUB72RljNisVPfa8QvKtS5h7Ws8p/T1PSj5NbJ+gf5nyOHlZhggXibKF55Vb9M83LGJVH70AJmCqHX4r9qTlyQjorVIcRV60s/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=zofwanr9EnIyAP+3VCdaF9SXvWA2UyDJmk18Yhfzufs=; b=mR/ofD2Az+LPBZcWwuq+4u0jlog2g06pXMan+eAdDsZCgcRWCQVL7eltgAuG5RFVHRj7nYZWIcbQ4KFF4d8Rxp0nHFUw79+uclcgVgCcSaLDQpBQKLMAP8SxZj1D2AbR7oKi1LPl6O4QZfQCO48KmnsE7Uryz5YEzmto2re84Bx//3DIvlVHbTV+kUlNg7sthl4D/xwX9S3h0+EVuGhCESJ+709P4zZfdKHkoKB9wqtDvYuMNUle93mJeH7n8e/MmT+Uz8mr1FfBrQjHi0mg3AJ3NSx5wfHwHwdhdm3SCNB8ca7+tm+s5aYd3QkfBayz6rJm9HQsTWwqpQFvSYFzXQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=stgolabs.net 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 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=zofwanr9EnIyAP+3VCdaF9SXvWA2UyDJmk18Yhfzufs=; b=djHaFSO33Gsq+ULsuK1tjsG2u0Q76ERpMHO1za7vDjqpqHLFULSgN9dlgRXBiMD6mbeOPnfrP6oZVmmqgkydH5mNA2r7/z6I20f1WuxQQQiUc3PVLuBqdLbcHTrBERhOf1IHFSjjawpVY62DnUi0tqfl8aELRvmprijosrUWrgQ= Received: from PR1P264CA0048.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:2cb::14) by DM3PR12MB9286.namprd12.prod.outlook.com (2603:10b6:8:1ae::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6907.23; Wed, 18 Oct 2023 17:18:53 +0000 Received: from SN1PEPF0002529E.namprd05.prod.outlook.com (2603:10a6:102:2cb:cafe::c1) by PR1P264CA0048.outlook.office365.com (2603:10a6:102:2cb::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6907.21 via Frontend Transport; Wed, 18 Oct 2023 17:18:52 +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 SN1PEPF0002529E.mail.protection.outlook.com (10.167.242.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6907.20 via Frontend Transport; Wed, 18 Oct 2023 17:18:51 +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.27; Wed, 18 Oct 2023 12:18:15 -0500 From: Robert Richter To: Davidlohr Bueso , Jonathan Cameron , Dave Jiang , "Alison Schofield" , Vishal Verma , Ira Weiny , Ben Widawsky , Dan Williams CC: , , Bjorn Helgaas , Terry Bowman , Robert Richter , Jonathan Cameron Subject: [PATCH v12 04/20] cxl/port: Rename @comp_map to @reg_map in struct cxl_register_map Date: Wed, 18 Oct 2023 19:16:57 +0200 Message-ID: <20231018171713.1883517-5-rrichter@amd.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20231018171713.1883517-1-rrichter@amd.com> References: <20231018171713.1883517-1-rrichter@amd.com> Precedence: bulk X-Mailing-List: linux-cxl@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN1PEPF0002529E:EE_|DM3PR12MB9286:EE_ X-MS-Office365-Filtering-Correlation-Id: 087203ed-b6d1-4f61-fe82-08dbcffe4cbc X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: pe35DhKpgQq0bevfDC+089O9R3X8Wfnl/XH0GEwlQLmjkcLWNPM6AS4FC4oRJxGDtkyy+bvc9HYrnM+U5CMWhlmYRg+eIJZxaIw8eM4KWXfwlUaeJ1zODoMc/QCaTmwwnaf2TKVg3aEMLHH73vPDqbtaXWy5IMYUiVLKmMrqSFLM2zAb0uy/LA9v2FWf0On0OI9Wj+i7pb8rrt4+E7UeX5oXDJQfxaEgTnotn/hPBS4/aCf2WeIdMlJGv7xBEUcQQDVXy9W3x1EZc/ccbTGb+PoZkqSKPvkHM7x1O8ZbDPNG8e1jp9ONn5yE7xpXQey+B9pDFLUJX98u0ZC6evuMXxPzhKKaSMRfAujaPKrCP9slCx3qPz0qmw3PRVcUmH9XR9QUyJSfz9Z+Id8ZtbD5Xd74RBCKml0Qa0XwB57nBe2WVG3QIZmBN7K51w46Ho46feQ8Gtl6ys4WUsWnxo2eXcy5rtXTIBC3wNgw7837QXfiFxRVhe0xkAO248CwAIgSuoY0dq+RuysSWIP4WJsttN8e7rjFHNuN6fNxVwBbkGTbExfpJP247pa1NpaaZPZ0s/loIA9yfk3ntbyzDYiTDxQubYt0Rx/or7NlvghY9nCU8BN1j5NTe3yzq4a51JCPV4cs8bvjMzEz9AkLUbMrBtmRW7FzxoONwTQY/4Bq1AxyzaEVzZaehqNInIVIpJ3pt54Oq/ZFI7HK8eoYhahLm9ZrHuB2wTvZrVMlOtaRXunaus3vopurS8PB9ytn1jGNXzAHOYYAJ5P1kh3phQcPGw== 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:(13230031)(4636009)(346002)(39860400002)(376002)(396003)(136003)(230922051799003)(82310400011)(64100799003)(186009)(451199024)(1800799009)(36840700001)(46966006)(40470700004)(54906003)(478600001)(70586007)(70206006)(110136005)(82740400003)(47076005)(6666004)(316002)(5660300002)(8676002)(1076003)(8936002)(426003)(16526019)(26005)(336012)(2616005)(4326008)(40460700003)(40480700001)(2906002)(7416002)(83380400001)(36756003)(36860700001)(81166007)(356005)(41300700001)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Oct 2023 17:18:51.8529 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 087203ed-b6d1-4f61-fe82-08dbcffe4cbc 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: SN1PEPF0002529E.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM3PR12MB9286 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Name the field @reg_map, because @reg_map->host will be used for mapping operations beyond component registers (i.e. AER registers). This is valid for all occurrences of @comp_map. Change them all. Signed-off-by: Robert Richter Reviewed-by: Jonathan Cameron --- drivers/cxl/core/port.c | 6 +++--- drivers/cxl/cxl.h | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/cxl/core/port.c b/drivers/cxl/core/port.c index 9b1136018f18..b993dea61436 100644 --- a/drivers/cxl/core/port.c +++ b/drivers/cxl/core/port.c @@ -712,7 +712,7 @@ static int cxl_port_setup_regs(struct cxl_port *port, { if (dev_is_platform(port->uport_dev)) return 0; - return cxl_setup_comp_regs(&port->dev, &port->comp_map, + return cxl_setup_comp_regs(&port->dev, &port->reg_map, component_reg_phys); } @@ -729,9 +729,9 @@ static int cxl_dport_setup_regs(struct device *host, struct cxl_dport *dport, * register probing, and fixup @host after the fact, since @host may be * NULL. */ - rc = cxl_setup_comp_regs(dport->dport_dev, &dport->comp_map, + rc = cxl_setup_comp_regs(dport->dport_dev, &dport->reg_map, component_reg_phys); - dport->comp_map.host = host; + dport->reg_map.host = host; return rc; } diff --git a/drivers/cxl/cxl.h b/drivers/cxl/cxl.h index b5b015b661ea..3a51b58a66d0 100644 --- a/drivers/cxl/cxl.h +++ b/drivers/cxl/cxl.h @@ -572,7 +572,7 @@ struct cxl_dax_region { * @regions: cxl_region_ref instances, regions mapped by this port * @parent_dport: dport that points to this port in the parent * @decoder_ida: allocator for decoder ids - * @comp_map: component register capability mappings + * @reg_map: component and ras register mapping parameters * @nr_dports: number of entries in @dports * @hdm_end: track last allocated HDM decoder instance for allocation ordering * @commit_end: cursor to track highest committed decoder for commit ordering @@ -592,7 +592,7 @@ struct cxl_port { struct xarray regions; struct cxl_dport *parent_dport; struct ida decoder_ida; - struct cxl_register_map comp_map; + struct cxl_register_map reg_map; int nr_dports; int hdm_end; int commit_end; @@ -620,7 +620,7 @@ struct cxl_rcrb_info { /** * struct cxl_dport - CXL downstream port * @dport_dev: PCI bridge or firmware device representing the downstream link - * @comp_map: component register capability mappings + * @reg_map: component and ras register mapping parameters * @port_id: unique hardware identifier for dport in decoder target list * @rcrb: Data about the Root Complex Register Block layout * @rch: Indicate whether this dport was enumerated in RCH or VH mode @@ -628,7 +628,7 @@ struct cxl_rcrb_info { */ struct cxl_dport { struct device *dport_dev; - struct cxl_register_map comp_map; + struct cxl_register_map reg_map; int port_id; struct cxl_rcrb_info rcrb; bool rch; From patchwork Wed Oct 18 17:16:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Richter X-Patchwork-Id: 13427544 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6FC723D962 for ; Wed, 18 Oct 2023 17:19:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="zWvkaSg8" Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2040.outbound.protection.outlook.com [40.107.236.40]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6C91F1707; Wed, 18 Oct 2023 10:19:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cYKaffwjcw1jDK/V7/5Nh/XRUhjrc+lVqGWV9FE1WNb/VR05AN20gChbSn34/WzWlB531s+lVv+nZ0YWZ4+zeS+HpI/ONhgX77ozBP7CdkDOHeazekJmZ/wRmGHC95WLWIplPDLjxZ/BUDGvMZfux1+qN+MavJAAEFHPgMvBtniBil8TGsB93RQwiWLYHbloyp9P3KyE6OIHAFs+UiN9OYbp9bxEOxWbqQXrPr+gzTrRYtfm3hvmS9QINxg+9C8dU44NE+ji9JqPohGIv6kUb26/X4tDt9+y6uQYihP30sOXMcE2Q3kYmRKkR68MFwn4+V7h6VvQOBnEi3DiklLjqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=wZFzthQVdwIAg5t3M6GAN24TFpEVTAgqZ/bQ8wGg+y0=; b=BvSus1SVJNpqd3Nn3Yv64SQ0FRLt9N+Ume67IMv6A8pcgVrk9QRVT4p4WUa4Mfbp1xiL9EbMx9/o/nhwfFUb0qiRuRlv9jodaqLVvB8VE5Wf09qC46Rfhtnu93M3TATdU6dFsblUEFz6ABewgQS0snTXbvnbxe4eCFwLuPvHFKRRm4GefhZnF6z3cL9L6Uy3lzK8lP1URbXMzu2cfKHNkFk75x70r38nIpjk4OUr6YDaSCr87IrH/dH6e3ipoDgTcBcczS97UYFj2QjWqazswtH3TU002oqrkFydEbFhPkWhIg1stAnH1Iv6ZVA7P4h9hng7wxgOvu8LLAt4VO76kw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=stgolabs.net 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 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=wZFzthQVdwIAg5t3M6GAN24TFpEVTAgqZ/bQ8wGg+y0=; b=zWvkaSg8jONT305nB5NML5FLUsL+AURgLb4dLU+75CZKPpjRO/AWqywVSARY8vu35dkyFYjt6xT91r9ftarhxoa8eYj4QwKV9DDsDqb2Zb6NdrNnTF/p3xtycUFQ1DFFtA5xs95HBSseWfZEoOsTkOgyOCy/uo+2tfn2dXJuSL4= Received: from PR1P264CA0041.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:2cb::6) by SJ2PR12MB8830.namprd12.prod.outlook.com (2603:10b6:a03:4d0::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6907.23; Wed, 18 Oct 2023 17:18:57 +0000 Received: from SN1PEPF0002529E.namprd05.prod.outlook.com (2603:10a6:102:2cb:cafe::8) by PR1P264CA0041.outlook.office365.com (2603:10a6:102:2cb::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.35 via Frontend Transport; Wed, 18 Oct 2023 17:18:56 +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 SN1PEPF0002529E.mail.protection.outlook.com (10.167.242.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6907.20 via Frontend Transport; Wed, 18 Oct 2023 17:18:56 +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.27; Wed, 18 Oct 2023 12:18:49 -0500 From: Robert Richter To: Davidlohr Bueso , Jonathan Cameron , Dave Jiang , "Alison Schofield" , Vishal Verma , Ira Weiny , Ben Widawsky , Dan Williams CC: , , Bjorn Helgaas , Terry Bowman , Robert Richter , Jonathan Cameron Subject: [PATCH v12 05/20] cxl/port: Pre-initialize component register mappings Date: Wed, 18 Oct 2023 19:16:58 +0200 Message-ID: <20231018171713.1883517-6-rrichter@amd.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20231018171713.1883517-1-rrichter@amd.com> References: <20231018171713.1883517-1-rrichter@amd.com> Precedence: bulk X-Mailing-List: linux-cxl@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN1PEPF0002529E:EE_|SJ2PR12MB8830:EE_ X-MS-Office365-Filtering-Correlation-Id: 8f8ef16f-e15c-4768-5639-08dbcffe4f5d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 7a6d9m5yjVeC09j/H9MCcGhLoWuXCrFh6v/YAtbzFD9fGrzM+OrE8RfycxVLRUAwdXW3z4ozw77pGXFrnGvpsDED/UKpV84YyE2Mzvp+4o7HQmZh4woI0TyqLdJrwncyljYTCSUCDoykF88WQeDVwP7bMn/I1/zWuO6f4FxKX4Fw3J5sMQd97XscZB3niQ/lkRoNMwtCCSYn4kU/iuzbUZmgc+lSV8aK+OZwWhEQPKfhbJ/oVBO7ctUC755+k9JELdstoPWC8IgFJu+PSEO6HqLX9+8vrZNBM1exb1nSz+clhHM153OwjE/iCpRlNjQ9ItaRAQz47Kz560qnLZrBn8VnWVBZI4Ew5N9VC1GC4x266kHfMz+1aIV9FFMmM63HKh9I7RT0R+fDxuwp1nEV5byadSR6ceZPaG7bT/7+sX2O+rf4+qto+O0IkukuMOnygKUMBFraufDA1tAeamaqfJr2DjQ7MyacYCxfZipx27Ptt1gpNxWy+a2IdmAvtNFWz2PS4SWmdNIhmjx+V6mDEr8sdUs6zfw+xFJ7wc6oTkFNbnQ/pChti5D2u+mU1ftIWT56zZjOOlV4cBlXjzQb3x86gcrMrhvMX5wxeqawwVN1AtZl9oC+hKo6Xdz+pD6L6A6cfwC+stUcDkjfzy6cdWBRAf8m4TPgonij7HuKjK6mT+3lFSnvgD+KmI9aAu+5P4HLSyE7Mepxpfat+KNJqkSQxC8ZntlO1oppcwL4Pij07gMV6ccGqemtYb6MVIkXLoVZmLQmm+K1JZ16y0RNng== 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:(13230031)(4636009)(39860400002)(346002)(376002)(396003)(136003)(230922051799003)(451199024)(1800799009)(82310400011)(186009)(64100799003)(46966006)(40470700004)(36840700001)(36860700001)(40460700003)(478600001)(5660300002)(70586007)(110136005)(70206006)(83380400001)(8936002)(8676002)(7416002)(2906002)(41300700001)(6666004)(54906003)(316002)(4326008)(336012)(40480700001)(47076005)(81166007)(1076003)(26005)(2616005)(16526019)(356005)(426003)(82740400003)(36756003)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Oct 2023 17:18:56.2591 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8f8ef16f-e15c-4768-5639-08dbcffe4f5d 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: SN1PEPF0002529E.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR12MB8830 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net The component registers of a component may not exist and cxl_setup_comp_regs() will fail for that reason. In another case, Software may not use and set those registers up. cxl_setup_comp_regs() is then called with a base address of CXL_RESOURCE_NONE. Both are valid cases, but the function returns without initializing the register map. Now, a missing component register block is not necessarily a reason to fail (feature is optional or its existence checked later). Change cxl_setup_comp_regs() to also use components with the component register block missing. Thus, always initialize struct cxl_register_map with valid values, set @dev and make @resource CXL_RESOURCE_NONE. The change is in preparation of follow-on patches. Signed-off-by: Terry Bowman Signed-off-by: Robert Richter Reviewed-by: Jonathan Cameron --- drivers/cxl/core/port.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/cxl/core/port.c b/drivers/cxl/core/port.c index b993dea61436..28ba8922d0a4 100644 --- a/drivers/cxl/core/port.c +++ b/drivers/cxl/core/port.c @@ -694,16 +694,18 @@ static struct cxl_port *cxl_port_alloc(struct device *uport_dev, static int cxl_setup_comp_regs(struct device *host, struct cxl_register_map *map, resource_size_t component_reg_phys) { - if (component_reg_phys == CXL_RESOURCE_NONE) - return 0; - *map = (struct cxl_register_map) { .host = host, - .reg_type = CXL_REGLOC_RBI_COMPONENT, + .reg_type = CXL_REGLOC_RBI_EMPTY, .resource = component_reg_phys, - .max_size = CXL_COMPONENT_REG_BLOCK_SIZE, }; + if (component_reg_phys == CXL_RESOURCE_NONE) + return 0; + + map->reg_type = CXL_REGLOC_RBI_COMPONENT; + map->max_size = CXL_COMPONENT_REG_BLOCK_SIZE; + return cxl_setup_regs(map); } From patchwork Wed Oct 18 17:16:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Richter X-Patchwork-Id: 13427541 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2FD98199CE for ; Wed, 18 Oct 2023 17:19:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="tWrkWxyq" Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2041.outbound.protection.outlook.com [40.107.243.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2F20D1708; Wed, 18 Oct 2023 10:19:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZjQ5QW7gluYaipPraPV+zGIc26bGclg2XU5Mejf7OGBQNFleK7PVASGeV76g/H3RFFlb+C4MiInXQuL7wCqjRKjiFm0U4wVEJQ/bgY2PEE8XoJNrobRCAM2q8zowb6qKQTReMHwOIWrwYzC303s80aqqEp1WHfdrAahSVKnJcau513VX4R7HNQQw+9UnQq5/Gv91TzaeUEgMmit0Hh2+ChxeLLcj129EmhsR8ebfdT9U/6r4EVAgRNt7ZoeapkVNCzzpUo6gQppjass/uxL+C9ijdfdAhFlQT5HS/QRDt8z84y1lTIXiIP+3n3mWFEAReLHDqCp2gS9zjBcP8nerQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=QeD0TqmjlVXjKVielApkR5g5JE+54c6o6acRDdh6RsY=; b=ZWQC57WqonrK16pC5cwZb+yR9u83eIFuXBaayPM5sPa+SsWrdP9dPx6XkbjR0/RiQLWzqInOT0c2EJonv//HVHCjDmJV9dYA3PrYTjcYSNGhdkxF4HG0JqJIRz7yTuNHVG3oiGOU78RRqOrJzxlGtu1JCpdhALyBOp37IeqevnKyPXwxygkpAXrQT+vlRiOvwaVYAXib+Gd7w6uunKX0pwBygQc6Qe4EByT437kFmkw995fcdi670MKj4CFhmyFo83HZjAHrb4v6OPWFfsSgnJc+vrjb9ZRwwnXxby9/MmWFOLAwvBjVQndn/QGn8hX+c29Qkv2nacn0aC5F9AKGlA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=stgolabs.net 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 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=QeD0TqmjlVXjKVielApkR5g5JE+54c6o6acRDdh6RsY=; b=tWrkWxyqVPX2jORMmwkaGBILBGCDIy1kEC7D9xcXKx2yhlM3dztmKHraKGKgReHsTJrrH21bkfAQlMQE+Wt0uLqmb/g/SE+7+YtZqzB/rpH5cDwvCDDrHM2zFV15FXYzOIXIlynmxdoCC5dRtuF3fMNckVK7Duh86KdwJR/AAqU= Received: from PR1P264CA0047.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:2cb::8) by MW4PR12MB6682.namprd12.prod.outlook.com (2603:10b6:303:1e3::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6863.36; Wed, 18 Oct 2023 17:18:58 +0000 Received: from SN1PEPF0002529E.namprd05.prod.outlook.com (2603:10a6:102:2cb:cafe::17) by PR1P264CA0047.outlook.office365.com (2603:10a6:102:2cb::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.36 via Frontend Transport; Wed, 18 Oct 2023 17:18: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 SN1PEPF0002529E.mail.protection.outlook.com (10.167.242.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6907.20 via Frontend Transport; Wed, 18 Oct 2023 17:18:57 +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.27; Wed, 18 Oct 2023 12:18:52 -0500 From: Robert Richter To: Davidlohr Bueso , Jonathan Cameron , Dave Jiang , "Alison Schofield" , Vishal Verma , Ira Weiny , Ben Widawsky , Dan Williams CC: , , Bjorn Helgaas , Terry Bowman , Robert Richter , Jonathan Cameron Subject: [PATCH v12 06/20] cxl/pci: Store the endpoint's Component Register mappings in struct cxl_dev_state Date: Wed, 18 Oct 2023 19:16:59 +0200 Message-ID: <20231018171713.1883517-7-rrichter@amd.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20231018171713.1883517-1-rrichter@amd.com> References: <20231018171713.1883517-1-rrichter@amd.com> Precedence: bulk X-Mailing-List: linux-cxl@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN1PEPF0002529E:EE_|MW4PR12MB6682:EE_ X-MS-Office365-Filtering-Correlation-Id: 55206f8f-e098-4897-5f3e-08dbcffe5049 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: WWsBhzQL72TOYta+rfAyHm6KTGkDkXsQhYRsGgfMkkVcVIrI/89rphi5v9X2awMvrXqI070NM27jmo3949fj99jsfdEoHguOc48hQ6cT69TxQ/07vU30C9ohGxqZxtD9Ov5m5mfYJ2gbmXWWA3i5zj7TJSu1LdBc5irhyVqPygTiasNHWtKj8WIUR9TMSp2gIBq/sy+rElz1FTx0CZn8q5dSMCe4yI1lFngust6eWQhkrgkuJz16K54HKfXMF8Otg8T4PqONXVCn2MiPYDhHPLl+uELLrDlVuUp16yg6KWi/hIckHbSdr3F2PUxj2HJmewXxPa97ObImSqn4M18ibaZ5u5MdytJVAhIePi/q+oR8CCgF1O7SuxxOJ91dHkLcXMvuB6AKrFRDnd9DL88pvn4d4MlJ/UT1nWbp2Y/2wo93PgSuKWL6EzR3pJMDus2w2wIxgktlkWvKkzrG9JkiKlug0MwVmrRHvVaDwgNgHmCawJkMDhFXibDTpqJ/LDOmJ2fgxBuCB9hOMdy2uT28IoPvOROCXLSlqPUAx/f6XL11kmKDFvqGYQcW76OMmQXiqilnVcFnInE4dhF4oraJALbq/EcCxYJnUhy/mhLSxAAqu1JG3sjVfMHBokd/zOY8rFq1NsrnU4+e5mAPZ/mCGcv2Yq80wxnKue3xXWtzXAKAd3/DPNK86/Eag3XcvsPbOknUPppNIWxF0jWe5Pf8FzXAuAPjSBNMK/thRPS2lMMHF40te+pbt5BbIIFohtHRWO43mpSCbpnFmcWcyRKT1g== 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:(13230031)(4636009)(39860400002)(136003)(346002)(396003)(376002)(230922051799003)(186009)(1800799009)(451199024)(64100799003)(82310400011)(36840700001)(40470700004)(46966006)(2906002)(83380400001)(26005)(426003)(336012)(1076003)(16526019)(5660300002)(2616005)(81166007)(82740400003)(47076005)(40460700003)(478600001)(356005)(40480700001)(36756003)(70586007)(7416002)(41300700001)(54906003)(36860700001)(8676002)(8936002)(316002)(4326008)(110136005)(70206006)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Oct 2023 17:18:57.8060 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 55206f8f-e098-4897-5f3e-08dbcffe5049 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: SN1PEPF0002529E.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR12MB6682 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Same as for ports and dports, also store the endpoint's Component Register mappings, use struct cxl_dev_state for that. Keep the Component Register base address @component_reg_phys a bit to not break functionality. It will be removed after the transition in a later patch. Signed-off-by: Terry Bowman Signed-off-by: Robert Richter Reviewed-by: Jonathan Cameron Reviewed-by: Dave Jiang --- drivers/cxl/core/mbox.c | 2 ++ drivers/cxl/cxlmem.h | 2 ++ drivers/cxl/pci.c | 9 +++++---- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/drivers/cxl/core/mbox.c b/drivers/cxl/core/mbox.c index 4df4f614f490..7e1c4d6f2e39 100644 --- a/drivers/cxl/core/mbox.c +++ b/drivers/cxl/core/mbox.c @@ -1377,6 +1377,8 @@ struct cxl_memdev_state *cxl_memdev_state_create(struct device *dev) mutex_init(&mds->mbox_mutex); mutex_init(&mds->event.log_lock); mds->cxlds.dev = dev; + mds->cxlds.reg_map.host = dev; + mds->cxlds.reg_map.resource = CXL_RESOURCE_NONE; mds->cxlds.type = CXL_DEVTYPE_CLASSMEM; return mds; diff --git a/drivers/cxl/cxlmem.h b/drivers/cxl/cxlmem.h index 706f8a6d1ef4..8fb8db47c3b7 100644 --- a/drivers/cxl/cxlmem.h +++ b/drivers/cxl/cxlmem.h @@ -397,6 +397,7 @@ enum cxl_devtype { * * @dev: The device associated with this CXL state * @cxlmd: The device representing the CXL.mem capabilities of @dev + * @reg_map: component and ras register mapping parameters * @regs: Parsed register blocks * @cxl_dvsec: Offset to the PCIe device DVSEC * @rcd: operating in RCD mode (CXL 3.0 9.11.8 CXL Devices Attached to an RCH) @@ -411,6 +412,7 @@ enum cxl_devtype { struct cxl_dev_state { struct device *dev; struct cxl_memdev *cxlmd; + struct cxl_register_map reg_map; struct cxl_regs regs; int cxl_dvsec; bool rcd; diff --git a/drivers/cxl/pci.c b/drivers/cxl/pci.c index f9d852957809..a6ad9bcb96b4 100644 --- a/drivers/cxl/pci.c +++ b/drivers/cxl/pci.c @@ -835,15 +835,16 @@ static int cxl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) * still be useful for management functions so don't return an error. */ cxlds->component_reg_phys = CXL_RESOURCE_NONE; - rc = cxl_pci_setup_regs(pdev, CXL_REGLOC_RBI_COMPONENT, &map); + rc = cxl_pci_setup_regs(pdev, CXL_REGLOC_RBI_COMPONENT, + &cxlds->reg_map); if (rc) dev_warn(&pdev->dev, "No component registers (%d)\n", rc); - else if (!map.component_map.ras.valid) + else if (!cxlds->reg_map.component_map.ras.valid) dev_dbg(&pdev->dev, "RAS registers not found\n"); - cxlds->component_reg_phys = map.resource; + cxlds->component_reg_phys = cxlds->reg_map.resource; - rc = cxl_map_component_regs(&map, &cxlds->regs.component, + rc = cxl_map_component_regs(&cxlds->reg_map, &cxlds->regs.component, BIT(CXL_CM_CAP_CAP_ID_RAS)); if (rc) dev_dbg(&pdev->dev, "Failed to map RAS capability.\n"); From patchwork Wed Oct 18 17:17:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Richter X-Patchwork-Id: 13427543 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A13D6199CE for ; Wed, 18 Oct 2023 17:19:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="ek7QfdeF" Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2041.outbound.protection.outlook.com [40.107.236.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8C0FA1FDE; Wed, 18 Oct 2023 10:19:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EBkaf9K6TPaIOHNs/72Lgfiix9lVj8qPIiNGLcnUSkxCeYHK6xSydnmBCs2V89b9eRz8IVLNkAuGcK020DgeGxayfTsGsTf5yGMuLfR87Pr+Al9alzPMelmBbA/6HW8LV8OgSXVFvUQvtgip9JR5FBrrW6ocCqcxXReB/+vTgQ8pJIu+TomZWTrG+VC7UEowQKRgxUB/1EFub8g9oZKPcuzrfwB2yU5h8ZH6rfLjJ6iaFWWAk1ZGfLhRvf1b5kVArfFHutKs4HdThEO+qGa+qhUDQFOBjo5S3AMp1fw7EQzLYuPEF+WCvBk8AjNsYqMUdI/o9Tr6grJnfkxWxba9lg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=8IJytDqcDaz8BkOf8njyNx1HVF5uxCq02rdnhyh9vXg=; b=dpVBO5no/WwmVe4ePJHbtHVDSz4YYmrpy/+NoHyJ7RA/HA4DHqnE5JUO6AZDMt6RL1754RNQYGtP8jgn2ZXdWri6SwJykzmcy+lvmdBHA9z/OSeV6AQ0ViqKhJ6ggTRRk79wp0pU1sKjkZSHnQhm5AymsyOCHobKQnTVNq5xJ73AVtKLAemKRzfyHcvozR8CoUnffQ9QKRaKl3Mjvf/plhFAyC+xR3bLBZKJSWGW5fqiz/xKuvqNZ6uCYMfPjlgj2hAriEshSDYui3XflDturJPkaGd2DdEy81lX8EH9i3jdsoq8sDibGUU/OAzXcs4eFJDSiG/58UyDzKs6av4qAA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=stgolabs.net 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 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=8IJytDqcDaz8BkOf8njyNx1HVF5uxCq02rdnhyh9vXg=; b=ek7QfdeFyzd3aM12Mhs0mbFEBlOl6FgS+kasR02hkm2e6DsWGRm7LAGsut8Bx9IWNP9teVHAFoXYG4gF9/5X2zvia1C6/AKoMW5I6xiVHmgH9JvZVf6msfKsFs6Ft3GJaYKBHvRCCIHjVzX4M/a1zKjvDvL98Ha5QBFRx2f2av0= Received: from PR1P264CA0039.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:2cb::15) by DM6PR12MB4895.namprd12.prod.outlook.com (2603:10b6:5:1bc::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.40; Wed, 18 Oct 2023 17:19:03 +0000 Received: from SN1PEPF0002529E.namprd05.prod.outlook.com (2603:10a6:102:2cb:cafe::52) by PR1P264CA0039.outlook.office365.com (2603:10a6:102:2cb::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.36 via Frontend Transport; Wed, 18 Oct 2023 17:19: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 SN1PEPF0002529E.mail.protection.outlook.com (10.167.242.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6907.20 via Frontend Transport; Wed, 18 Oct 2023 17:19: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.27; Wed, 18 Oct 2023 12:18:56 -0500 From: Robert Richter To: Davidlohr Bueso , Jonathan Cameron , Dave Jiang , "Alison Schofield" , Vishal Verma , Ira Weiny , Ben Widawsky , Dan Williams CC: , , Bjorn Helgaas , Terry Bowman , Robert Richter Subject: [PATCH v12 07/20] cxl/hdm: Use stored Component Register mappings to map HDM decoder capability Date: Wed, 18 Oct 2023 19:17:00 +0200 Message-ID: <20231018171713.1883517-8-rrichter@amd.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20231018171713.1883517-1-rrichter@amd.com> References: <20231018171713.1883517-1-rrichter@amd.com> Precedence: bulk X-Mailing-List: linux-cxl@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN1PEPF0002529E:EE_|DM6PR12MB4895:EE_ X-MS-Office365-Filtering-Correlation-Id: 538c3933-729e-4dde-68cd-08dbcffe52db X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: /I7XE+Qdd9V3kEU0K7Oon7dLGk0uGzhjzqj+fpQ3lmHcbEdbEB92+mjWpxd23jL3oWUo3HOynZAbCWDs3mzTZUaTg3S7TNZxLIxhCbHzG29fRWM3pctdrTBz34NuEcLLkzb4J/IVokzNIqjw1xvwhpOIA8dH+TsvBE/HPD6i5WysS9AuW61qWqlVE4zlawu/eANYN2GfypWaYNv2EXqOUzRNC5wvOtJd9SIf9h1x3kENQDjlk+Z6CW2Cy20Zeymg8aWyR8o086mlEjfjQKrwYkVTWjgbYKJOLLqYfq1sHsxdtX74NWAqdD20+GMkqozUlA0XLE01HeOgOCEDBc5pTt2ZQwE7tL3cebiOKX0HjxXsgTepg5D3DCJU9RFSPJ0Pg6PEdMSO4FKv8ZNTvnnEPlEauLlBrD4q8ou35p/i1tbqoqZjb7btDLgq6StXX7ZNdL+M+sLV5CXtFXQChJ2AM14cv/nPmwcAperOCtBfg02iQJD0x2abcFMKIPq4tZidj6MpufNtiv7F7FsZU8S1eiF9xPM6Z3fIykNs+LPfr8RQFO4aaRkQjpwMWeDlvUNluhu5o8Utg6FtmVd10YFK29oWTeFT7KPxCdCdqHo0CET452cWFjaFerlGBhd5J6ZCmalo3Mi0KK84hFZgk6/x9HDYQ9TA4ZhLLf4yCsepF6sXwwlv6WEAYTHRPM3AyjxNfB4LM/9JoPyEnhM+vabBoAMnxQz+nKX+eozE3FyrLg86aAWTedsgqP2aK0gp71RKoeIAlk6ijCjiRWrh98i//Q== 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:(13230031)(4636009)(39860400002)(136003)(396003)(346002)(376002)(230922051799003)(451199024)(82310400011)(186009)(1800799009)(64100799003)(40470700004)(36840700001)(46966006)(83380400001)(40480700001)(40460700003)(36756003)(2616005)(81166007)(316002)(1076003)(2906002)(110136005)(7416002)(70206006)(41300700001)(54906003)(5660300002)(4326008)(8676002)(8936002)(70586007)(478600001)(6666004)(336012)(426003)(356005)(26005)(16526019)(82740400003)(36860700001)(47076005)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Oct 2023 17:19:02.1185 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 538c3933-729e-4dde-68cd-08dbcffe52db 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: SN1PEPF0002529E.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4895 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Now, that the Component Register mappings are stored, use them to enable and map the HDM decoder capabilities. The Component Registers do not need to be probed again for this, remove probing code. The HDM capability applies to Endpoints, USPs and VH Host Bridges. The Endpoint's component register mappings are located in the cxlds and else in the port's structure. Duplicate the cxlds->reg_map in port->reg_map for endpoint ports. Signed-off-by: Terry Bowman Signed-off-by: Robert Richter Reviewed-by: Dave Jiang [rework to drop cxl_port_get_comp_map()] Signed-off-by: Dan Williams --- drivers/cxl/core/hdm.c | 49 +++++++++++++++++------------------------ drivers/cxl/core/port.c | 29 ++++++++++++++++++------ drivers/cxl/mem.c | 5 ++--- 3 files changed, 44 insertions(+), 39 deletions(-) diff --git a/drivers/cxl/core/hdm.c b/drivers/cxl/core/hdm.c index 11d9971f3e8c..c5f951658130 100644 --- a/drivers/cxl/core/hdm.c +++ b/drivers/cxl/core/hdm.c @@ -81,26 +81,6 @@ static void parse_hdm_decoder_caps(struct cxl_hdm *cxlhdm) cxlhdm->interleave_mask |= GENMASK(14, 12); } -static int map_hdm_decoder_regs(struct cxl_port *port, void __iomem *crb, - struct cxl_component_regs *regs) -{ - struct cxl_register_map map = { - .host = &port->dev, - .resource = port->component_reg_phys, - .base = crb, - .max_size = CXL_COMPONENT_REG_BLOCK_SIZE, - }; - - cxl_probe_component_regs(&port->dev, crb, &map.component_map); - if (!map.component_map.hdm_decoder.valid) { - dev_dbg(&port->dev, "HDM decoder registers not implemented\n"); - /* unique error code to indicate no HDM decoder capability */ - return -ENODEV; - } - - return cxl_map_component_regs(&map, regs, BIT(CXL_CM_CAP_CAP_ID_HDM)); -} - static bool should_emulate_decoders(struct cxl_endpoint_dvsec_info *info) { struct cxl_hdm *cxlhdm; @@ -153,9 +133,9 @@ static bool should_emulate_decoders(struct cxl_endpoint_dvsec_info *info) struct cxl_hdm *devm_cxl_setup_hdm(struct cxl_port *port, struct cxl_endpoint_dvsec_info *info) { + struct cxl_register_map *reg_map = &port->reg_map; struct device *dev = &port->dev; struct cxl_hdm *cxlhdm; - void __iomem *crb; int rc; cxlhdm = devm_kzalloc(dev, sizeof(*cxlhdm), GFP_KERNEL); @@ -164,19 +144,30 @@ struct cxl_hdm *devm_cxl_setup_hdm(struct cxl_port *port, cxlhdm->port = port; dev_set_drvdata(dev, cxlhdm); - crb = ioremap(port->component_reg_phys, CXL_COMPONENT_REG_BLOCK_SIZE); - if (!crb && info && info->mem_enabled) { + /* Memory devices can configure device HDM using DVSEC range regs. */ + if (reg_map->resource == CXL_RESOURCE_NONE) { + if (!info && !info->mem_enabled) { + WARN_ON(1); + dev_err(dev, "No component registers mapped\n"); + return ERR_PTR(-ENXIO); + } + cxlhdm->decoder_count = info->ranges; return cxlhdm; - } else if (!crb) { - dev_err(dev, "No component registers mapped\n"); - return ERR_PTR(-ENXIO); } - rc = map_hdm_decoder_regs(port, crb, &cxlhdm->regs); - iounmap(crb); - if (rc) + if (!reg_map->component_map.hdm_decoder.valid) { + dev_dbg(&port->dev, "HDM decoder registers not implemented\n"); + /* unique error code to indicate no HDM decoder capability */ + return ERR_PTR(-ENODEV); + } + + rc = cxl_map_component_regs(reg_map, &cxlhdm->regs, + BIT(CXL_CM_CAP_CAP_ID_HDM)); + if (rc) { + dev_err(dev, "Failed to map HDM capability.\n"); return ERR_PTR(rc); + } parse_hdm_decoder_caps(cxlhdm); if (cxlhdm->decoder_count == 0) { diff --git a/drivers/cxl/core/port.c b/drivers/cxl/core/port.c index 28ba8922d0a4..f69484d3c93c 100644 --- a/drivers/cxl/core/port.c +++ b/drivers/cxl/core/port.c @@ -751,16 +751,31 @@ static struct cxl_port *__devm_cxl_add_port(struct device *host, return port; dev = &port->dev; - if (is_cxl_memdev(uport_dev)) + if (is_cxl_memdev(uport_dev)) { + struct cxl_memdev *cxlmd = to_cxl_memdev(uport_dev); + struct cxl_dev_state *cxlds = cxlmd->cxlds; + rc = dev_set_name(dev, "endpoint%d", port->id); - else if (parent_dport) + if (rc) + goto err; + + /* + * The endpoint driver already enumerated the component and RAS + * registers. Reuse that enumeration while prepping them to be + * mapped by the cxl_port driver. + */ + port->reg_map = cxlds->reg_map; + port->reg_map.host = &port->dev; + } else if (parent_dport) { rc = dev_set_name(dev, "port%d", port->id); - else - rc = dev_set_name(dev, "root%d", port->id); - if (rc) - goto err; + if (rc) + goto err; - rc = cxl_port_setup_regs(port, component_reg_phys); + rc = cxl_port_setup_regs(port, component_reg_phys); + if (rc) + goto err; + } else + rc = dev_set_name(dev, "root%d", port->id); if (rc) goto err; diff --git a/drivers/cxl/mem.c b/drivers/cxl/mem.c index 317c7548e4e9..04107058739b 100644 --- a/drivers/cxl/mem.c +++ b/drivers/cxl/mem.c @@ -49,7 +49,6 @@ static int devm_cxl_add_endpoint(struct device *host, struct cxl_memdev *cxlmd, struct cxl_dport *parent_dport) { struct cxl_port *parent_port = parent_dport->port; - struct cxl_dev_state *cxlds = cxlmd->cxlds; struct cxl_port *endpoint, *iter, *down; int rc; @@ -65,8 +64,8 @@ static int devm_cxl_add_endpoint(struct device *host, struct cxl_memdev *cxlmd, ep->next = down; } - endpoint = devm_cxl_add_port(host, &cxlmd->dev, - cxlds->component_reg_phys, + /* Note: endpoint port component registers are derived from @cxlds */ + endpoint = devm_cxl_add_port(host, &cxlmd->dev, CXL_RESOURCE_NONE, parent_dport); if (IS_ERR(endpoint)) return PTR_ERR(endpoint); From patchwork Wed Oct 18 17:17:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Richter X-Patchwork-Id: 13427545 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CE4FC3D3AE for ; Wed, 18 Oct 2023 17:20:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="dwYi+nC0" Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2058.outbound.protection.outlook.com [40.107.237.58]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9D30E1FDF; Wed, 18 Oct 2023 10:19:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PlWItJhPMWN12YsH4ZyfXaPk8Plv7CESdPycz/uf1wH9NRMu9qKIwx/8RrrN9QcHxGYGQpxYEdGDCNX4o2nvqZTk90TxojQJmaX/R2pdDf3W2v0D69hrrgmhIfrPnMV7Utc/cthVHs8tdjY3T/8/WeXJGu1gmRMp7/u0SwoZFfu0jdIuj8/YAA2ax7xWHrUZMcZNs5nO5NdN3OBXX7hP/1W4RznwJg/UHQTjlyvMXzBjlRZLPFaUeHP4pfGtZk1A4EPmyp90LK4CaREFILYcfgRj3iErrG0J8LDm4cNzW4yrIfu6hsz6kvJMcPRpPb4ivueFyQd0VcxXcbu6QALIow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=DSvQupq1zPeqA9EIKfhGUCfDPjvZA5Z8vWp/24P1mRE=; b=j1TY485lbFX0F7R/e46E3x1fw47bIqiQocGxdd9+oIJdeEUPnAO+cM2Yf6Q+vPq+Dv73gsDgkU07S0821/I4U01OoIV0HrgHaSLG8bYG2pJw9TxRbOWhKV+v0BHCRwlqtUhZGBbw0cq6VyhhrBEZly9V85jPOnsYCU5hoTHtsbSmG1RnBAxJ3/PNkwlcknElxTVgBSPQkYY/UiCTr11IKPerHMxWkaLY0AxWdXnEXKHHgs2eU8PTRQ1jH6IjSX3dJfDQxlS8WMLIr7rlU29W9ds/CUg4w6/v+iIn9ctdoSw4f7W/fnx82r2xin9pqV5OZwvyIzT0onWPjRco0LBKzw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=stgolabs.net 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 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=DSvQupq1zPeqA9EIKfhGUCfDPjvZA5Z8vWp/24P1mRE=; b=dwYi+nC02QPz6FeLLTdDo83l7M3Iybb5mcoBw8JKGJfnU+10c0mStYkXsjOtRtl1RCG9fW78f52mEG9mEHSX9yBACpahPrESveSgPuAl+tgSGxkhcNZdTmHi5eDZUb8UN2MqMnYgumS4IL0fDSXS8Vu13a8RMk4x/u3xQY6+Vik= Received: from PR1P264CA0037.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:2cb::11) by BL1PR12MB5828.namprd12.prod.outlook.com (2603:10b6:208:397::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.35; Wed, 18 Oct 2023 17:19:07 +0000 Received: from SN1PEPF0002529E.namprd05.prod.outlook.com (2603:10a6:102:2cb:cafe::cb) by PR1P264CA0037.outlook.office365.com (2603:10a6:102:2cb::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.36 via Frontend Transport; Wed, 18 Oct 2023 17:19:06 +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 SN1PEPF0002529E.mail.protection.outlook.com (10.167.242.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6907.20 via Frontend Transport; Wed, 18 Oct 2023 17:19:06 +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.27; Wed, 18 Oct 2023 12:19:00 -0500 From: Robert Richter To: Davidlohr Bueso , Jonathan Cameron , Dave Jiang , "Alison Schofield" , Vishal Verma , Ira Weiny , Ben Widawsky , Dan Williams CC: , , Bjorn Helgaas , Terry Bowman , Robert Richter , Jonathan Cameron Subject: [PATCH v12 08/20] cxl/pci: Remove Component Register base address from struct cxl_dev_state Date: Wed, 18 Oct 2023 19:17:01 +0200 Message-ID: <20231018171713.1883517-9-rrichter@amd.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20231018171713.1883517-1-rrichter@amd.com> References: <20231018171713.1883517-1-rrichter@amd.com> Precedence: bulk X-Mailing-List: linux-cxl@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN1PEPF0002529E:EE_|BL1PR12MB5828:EE_ X-MS-Office365-Filtering-Correlation-Id: 775c70e5-b2ba-4780-adab-08dbcffe5568 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: awhaj71lPlJGNr2eVG6LVQtKr7bahsQnB/ymXbwpUp3Ld5ynSwsXU5Y6bPzoUT+e61u3ekZWohUIshtI4zcjeImTktBtqu/Me9KfEM3XJzdhoigt7Rhuy0o8iEgULGWhi2mHVZKbZ2H5JeXzEvZEk2uu5hpo53TSGxa1xyKdZlS+PSQgVQt5sP9f+RgE1aHdrvNibVBtm9fla88D6lWgjgKGipWWJvVUOLjPOEFznN3Uej2GknVFLub2cfbpzVB/ZG/rYrIT7BTEeVR9UXSXKCzrkqAajLrk1HKk0b0mhMmNz4pw8OHCwkgaD2XgsEuG3XATaJcHrP5iaVaSNV+Rcg5xCqeePHh4OG35tP03+TKcFlRdQxhBnSo3TXWllaNsX/9SJn0BZawRvz1BOfHMLQsh96vm574GNY2AEBfM8pmkhY76SpucRTy9iJt5gmt/gnfLAa8kqQBWoDbtBgE3usPfziBIXFthBSVUzxsM6E2nlEZ0FleO/NM88gWa6u2fmaXKpXaBdTZctKkqDbFg/w98u/OnyXVhGPor5s3kHDQBXIdJ5aFzTgKlfEDCO+CYZzCiK23WySI9i5WlDg8iXznfgD6QJayGp6LRWLaalV9D6nf+WbrZxADIAlvHk4lvS9gPgHkcj3augHiIxE3tsG3ryy6nOPQiJZAYBGC/F0h3mpDRPlpponC/8uKa3/DiifBNicjBANQVfSoU8BvZCMH4G4iCf6J6xGiK9AhZ9GSbCjlTouIse5rwBk9q3/ktUqC2PikUH8d4qB9LI+ru8A== 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:(13230031)(4636009)(136003)(396003)(376002)(346002)(39860400002)(230922051799003)(1800799009)(82310400011)(186009)(64100799003)(451199024)(40470700004)(46966006)(36840700001)(316002)(70206006)(2616005)(70586007)(426003)(110136005)(478600001)(54906003)(2906002)(16526019)(4326008)(5660300002)(8676002)(26005)(7416002)(41300700001)(8936002)(82740400003)(47076005)(36756003)(83380400001)(36860700001)(1076003)(81166007)(356005)(336012)(40460700003)(40480700001)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Oct 2023 17:19:06.3998 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 775c70e5-b2ba-4780-adab-08dbcffe5568 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: SN1PEPF0002529E.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL1PR12MB5828 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net The Component Register base address @component_reg_phys is no longer used after the rework of the Component Register setup which now uses struct member @reg_map instead. Remove the base address. Signed-off-by: Terry Bowman Signed-off-by: Robert Richter Reviewed-by: Jonathan Cameron Reviewed-by: Dave Jiang --- drivers/cxl/cxlmem.h | 2 -- drivers/cxl/pci.c | 3 --- tools/testing/cxl/test/mem.c | 1 - 3 files changed, 6 deletions(-) diff --git a/drivers/cxl/cxlmem.h b/drivers/cxl/cxlmem.h index 8fb8db47c3b7..cfd287466fa8 100644 --- a/drivers/cxl/cxlmem.h +++ b/drivers/cxl/cxlmem.h @@ -405,7 +405,6 @@ enum cxl_devtype { * @dpa_res: Overall DPA resource tree for the device * @pmem_res: Active Persistent memory capacity configuration * @ram_res: Active Volatile memory capacity configuration - * @component_reg_phys: register base of component registers * @serial: PCIe Device Serial Number * @type: Generic Memory Class device or Vendor Specific Memory device */ @@ -420,7 +419,6 @@ struct cxl_dev_state { struct resource dpa_res; struct resource pmem_res; struct resource ram_res; - resource_size_t component_reg_phys; u64 serial; enum cxl_devtype type; }; diff --git a/drivers/cxl/pci.c b/drivers/cxl/pci.c index a6ad9bcb96b4..037792e941f2 100644 --- a/drivers/cxl/pci.c +++ b/drivers/cxl/pci.c @@ -834,7 +834,6 @@ static int cxl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) * If the component registers can't be found, the cxl_pci driver may * still be useful for management functions so don't return an error. */ - cxlds->component_reg_phys = CXL_RESOURCE_NONE; rc = cxl_pci_setup_regs(pdev, CXL_REGLOC_RBI_COMPONENT, &cxlds->reg_map); if (rc) @@ -842,8 +841,6 @@ static int cxl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) else if (!cxlds->reg_map.component_map.ras.valid) dev_dbg(&pdev->dev, "RAS registers not found\n"); - cxlds->component_reg_phys = cxlds->reg_map.resource; - rc = cxl_map_component_regs(&cxlds->reg_map, &cxlds->regs.component, BIT(CXL_CM_CAP_CAP_ID_RAS)); if (rc) diff --git a/tools/testing/cxl/test/mem.c b/tools/testing/cxl/test/mem.c index 464fc39ed277..aa44d111fd28 100644 --- a/tools/testing/cxl/test/mem.c +++ b/tools/testing/cxl/test/mem.c @@ -1423,7 +1423,6 @@ static int cxl_mock_mem_probe(struct platform_device *pdev) cxlds->serial = pdev->id; if (is_rcd(pdev)) { cxlds->rcd = true; - cxlds->component_reg_phys = CXL_RESOURCE_NONE; } rc = cxl_enumerate_cmds(mds); From patchwork Wed Oct 18 17:17:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Richter X-Patchwork-Id: 13427542 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 146D63D3BD for ; Wed, 18 Oct 2023 17:19:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="UOZ+m7i9" Received: from NAM04-MW2-obe.outbound.protection.outlook.com (mail-mw2nam04on2053.outbound.protection.outlook.com [40.107.101.53]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B77611FE6; Wed, 18 Oct 2023 10:19:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=j+JhyaXQbYqS+ke5wx8R3mb45OPa5WK4daEU5zhcObQEumP1EwvVRuu3TXs+qXv6s/3rkQiaMtGwAvy9aDBRaZSjYpP7YaryJRSiTIXEmdOvadHRjmLbRbhJrg6EeOh/7AZM7CjtV7aY0yGmo2pK7kXRv58nft/pNXuD30HIYDBlQFqaYQC0O0TNGqy5CHCrzllsqUQ7VGbGuDVS+v5unVZjQfA1RhQHM8zH9AIgV+DRW0p3OFlVTsvghevhHk4pQlr8Gkmay/+QVk49NfCK53A6YuADkQRmRHBBCmjHlg59zic/4PxQMFcHPDU7UhzxkKMApCOp0ltLaXwOBZkCEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=wa13YugWBoCwNnyBndxliXsrb/rMcaG5sf03Z8lk4y4=; b=gsL/geyGpbbUVyO4z5QIEhQY8Iu5ZFYvSt7RZ0WHpRMyVFif+vGMwoTIgyihL2Mr9EbBSzPjAQclYj76dpkfoxPzyUDWm3+4T01CgQKXIpeYMMyt22rP+DstT7cjp4VKQYV718ZC03na7oL9TB3J6+i6yTDleR9d7rLmbxPxTDwZMMiiiMaCfP72/Rek06z1Lgsh3FMambjVYBvxB2eeMKiLf0Tu/SplcIanTHYFyo8/D2pdzHeJtQ6h0r4TqZsZd5st5rK77P5mdgp3IdX3UCvdFBZloH19wD+c7QfBQqEdghg35/NnX9NavDmF2V4+unKhSq5y8vtHS4q0CnxEPw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=stgolabs.net 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 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=wa13YugWBoCwNnyBndxliXsrb/rMcaG5sf03Z8lk4y4=; b=UOZ+m7i9XJHLKSQvvqEh+kMDLJuvxpc+osVqOhR8SGxX6S4TTkc5iDx5Yc5BHTO4mPpNrZ9VuM1UZAW1GX/LmRWv9pzhlPPSfx+ZyQThwMqSHFTN1JiLaJHzPX8hizg/APDhgnxdzzcmdCw4aQCYQfLXZO3lGxu9aSYtrKxNwHo= Received: from PR1P264CA0046.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:2cb::17) by PH8PR12MB7447.namprd12.prod.outlook.com (2603:10b6:510:215::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.36; Wed, 18 Oct 2023 17:19:08 +0000 Received: from SN1PEPF0002529E.namprd05.prod.outlook.com (2603:10a6:102:2cb:cafe::e2) by PR1P264CA0046.outlook.office365.com (2603:10a6:102:2cb::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6907.23 via Frontend Transport; Wed, 18 Oct 2023 17:19:08 +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 SN1PEPF0002529E.mail.protection.outlook.com (10.167.242.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6907.20 via Frontend Transport; Wed, 18 Oct 2023 17:19:07 +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.27; Wed, 18 Oct 2023 12:19:03 -0500 From: Robert Richter To: Davidlohr Bueso , Jonathan Cameron , Dave Jiang , "Alison Schofield" , Vishal Verma , Ira Weiny , Ben Widawsky , Dan Williams CC: , , Bjorn Helgaas , Terry Bowman , Robert Richter , Jonathan Cameron Subject: [PATCH v12 09/20] cxl/port: Remove Component Register base address from struct cxl_port Date: Wed, 18 Oct 2023 19:17:02 +0200 Message-ID: <20231018171713.1883517-10-rrichter@amd.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20231018171713.1883517-1-rrichter@amd.com> References: <20231018171713.1883517-1-rrichter@amd.com> Precedence: bulk X-Mailing-List: linux-cxl@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN1PEPF0002529E:EE_|PH8PR12MB7447:EE_ X-MS-Office365-Filtering-Correlation-Id: 859b486f-15b4-4659-7caa-08dbcffe563a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: FaeXWIaIzlkFiIqzpVhrBcTCn+fUtaSRGley421dKFIE0BTvL/roDZ2y67Ww0vz2tSPIDyP/5JVB+als4MX34zpeV5VpV0pR1nPNZJn+m4UfRkO1GM4T6sIbnxSx/ksRjg1iDqyIin6VOzfdB4zDpW3+yv7daqyGlpwknWP+re3yLev5LhALQERRne55YJkSCMfxu1PUZgl+dpv7JO2d/jHy3+W/NG6Lpl486vYdvzhm6L5aoj2x2QKKZfB3lYv//6vPUuJ+IqP1GHtD9+EEMusup50gIFK9Hvka49Eb35uOGIuWUMlFBBDsbQKnEoysI1tIuKDDds5Vcg3oNFKccV4Q9vVbF/ePjnpfwI/OIKCKW7KDEVL4BHKybSrED/NTuQpHJtF3rtHubDl9PTcCvXZRUOIzfjUUc0+WKFQuQIw8ygH2AtwdWDewSx2/iTeyf/HyZ8WdN2UbrW9A0QhEA60flcjeE9D59PG8pxAiCI6ng+mxy7cYPpWloJbcyWVP8E6Q/P1e3K4hSdSwukdlv6NZGr792jOYPud5MTmybCMS/GtcknAxEv1rD8z+7jEus9F7ORsvhd9AH3W3BRsyPb2GcoLVwEsTdYKS1HD+k2iK7gYLsxYIKeFiq1TRaqcMOYtb8HCCqCneCrJkl6VVlpR34T5iBnLoKMrCke6nZyyylRCF5YvzKqkrSSYT+XhjZqG2uN2OEtlBMSfa7MKDPj9bTpxaNhG+wI0UUB2818NUb9Tq8UyUTRXBEPOeGG3R1Cge/ufTMsYPkKy1G7hJjg== 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:(13230031)(4636009)(346002)(396003)(39860400002)(376002)(136003)(230922051799003)(451199024)(64100799003)(82310400011)(186009)(1800799009)(36840700001)(40470700004)(46966006)(40460700003)(26005)(1076003)(426003)(16526019)(83380400001)(336012)(47076005)(8936002)(2616005)(41300700001)(5660300002)(8676002)(4326008)(7416002)(2906002)(478600001)(316002)(70206006)(110136005)(81166007)(356005)(54906003)(82740400003)(70586007)(36860700001)(36756003)(40480700001)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Oct 2023 17:19:07.7748 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 859b486f-15b4-4659-7caa-08dbcffe563a 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: SN1PEPF0002529E.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH8PR12MB7447 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net The Component Register base address @component_reg_phys is no longer used after the rework of the Component Register setup which now uses struct member @reg_map instead. Remove the base address. Signed-off-by: Terry Bowman Signed-off-by: Robert Richter Reviewed-by: Jonathan Cameron Reviewed-by: Dave Jiang --- drivers/cxl/core/port.c | 4 +--- drivers/cxl/cxl.h | 2 -- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/cxl/core/port.c b/drivers/cxl/core/port.c index f69484d3c93c..41a8aa56cffd 100644 --- a/drivers/cxl/core/port.c +++ b/drivers/cxl/core/port.c @@ -619,7 +619,6 @@ static int devm_cxl_link_parent_dport(struct device *host, static struct lock_class_key cxl_port_key; static struct cxl_port *cxl_port_alloc(struct device *uport_dev, - resource_size_t component_reg_phys, struct cxl_dport *parent_dport) { struct cxl_port *port; @@ -670,7 +669,6 @@ static struct cxl_port *cxl_port_alloc(struct device *uport_dev, } else dev->parent = uport_dev; - port->component_reg_phys = component_reg_phys; ida_init(&port->decoder_ida); port->hdm_end = -1; port->commit_end = -1; @@ -746,7 +744,7 @@ static struct cxl_port *__devm_cxl_add_port(struct device *host, struct device *dev; int rc; - port = cxl_port_alloc(uport_dev, component_reg_phys, parent_dport); + port = cxl_port_alloc(uport_dev, parent_dport); if (IS_ERR(port)) return port; diff --git a/drivers/cxl/cxl.h b/drivers/cxl/cxl.h index 3a51b58a66d0..c07064e0c136 100644 --- a/drivers/cxl/cxl.h +++ b/drivers/cxl/cxl.h @@ -576,7 +576,6 @@ struct cxl_dax_region { * @nr_dports: number of entries in @dports * @hdm_end: track last allocated HDM decoder instance for allocation ordering * @commit_end: cursor to track highest committed decoder for commit ordering - * @component_reg_phys: component register capability base address (optional) * @dead: last ep has been removed, force port re-creation * @depth: How deep this port is relative to the root. depth 0 is the root. * @cdat: Cached CDAT data @@ -596,7 +595,6 @@ struct cxl_port { int nr_dports; int hdm_end; int commit_end; - resource_size_t component_reg_phys; bool dead; unsigned int depth; struct cxl_cdat { From patchwork Wed Oct 18 17:17:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Richter X-Patchwork-Id: 13427547 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3E4B63D3BD for ; Wed, 18 Oct 2023 17:20:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="2zcRQhfH" Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2073.outbound.protection.outlook.com [40.107.93.73]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 55630324B; Wed, 18 Oct 2023 10:19:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=k7hgNMDo/E/SzLArtt2/3jeMzuGzGL2Y8Ko0d+zoqD8zoKed+7hg6YW+8QgZWC7CdCgXQtAjplIZgCKlOUMaqOe7VDheNJHowob5PlMxEX7ro0dBd37XYbC4pmIwXxwSPb+d+vk2Iv0rvQYwIo2KKimD3V51UsTd5VthS522/t3AqThX7ugdFql9IMdcJd5Nob30762yns5DpIkM3jhXVDW1BHk6np4WmhsQGcGPuwzosV3H2bw3Xni3KiV3qSu6mbQu4p7EjvRzflr7hfvPONJbzTduxYn9wYy92f5NPxEQGdoRJx1VmvhH4vGQ9yuvzMUL0Cw9NmLAWozxXonaBw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=3HBEJ0Wnnrej7ZFG4v4zI4otawjUFMMAynClT7d6q2I=; b=MeH0BjSpwUsuy0zrfUSsX36eiXnKx+aIHF+rF4jDWa77yW9qKI4BQSBKTOmSW2a3TDUTr9QJtvpgwdAs1NCFh4ZcMM/pQeMZ0uo8yUnG+m6JtRCuaNgW5xrgaaA1AF5VTS4HzX1KhbYh5tXVCYpDNlj5RKwkkiR0oRmX+YaThL1PB1DPuaiUPMfzPwXA1FUPZ452rFqWB8gfDtPVCLl7istlkjse92c0tEgoDIeyy0bqIDAuyIIv8o65g1TnQyQ4IVNZ791o33D1320dJOS5SHXyGZNNX12DQad1a3tJiFuWzPSKZ1u0hAtqv/wRVAYf6uocEdRyXXgpbxxvzAJvjA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=stgolabs.net 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 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=3HBEJ0Wnnrej7ZFG4v4zI4otawjUFMMAynClT7d6q2I=; b=2zcRQhfHWTSu4+PnaMsCINsGyaQwbNlhtHUOcWyme4mV3+hJeCke8uKtPGq+mmZV9PKsoZmrt5efbziU0FGUi3qeByxr0Cu8ieFeBuP/OK4tq3PCYZ6zpSg4Qgr6kR0neNsE8/eyETzlhx0sJjz26hjWuMr5YAcb40zXtGO+67U= Received: from PR0P264CA0176.FRAP264.PROD.OUTLOOK.COM (2603:10a6:100:1c::20) by IA1PR12MB6329.namprd12.prod.outlook.com (2603:10b6:208:3e5::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.35; Wed, 18 Oct 2023 17:19:51 +0000 Received: from SN1PEPF000252A3.namprd05.prod.outlook.com (2603:10a6:100:1c:cafe::bd) by PR0P264CA0176.outlook.office365.com (2603:10a6:100:1c::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6907.21 via Frontend Transport; Wed, 18 Oct 2023 17:19: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 SN1PEPF000252A3.mail.protection.outlook.com (10.167.242.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6907.20 via Frontend Transport; Wed, 18 Oct 2023 17:19:48 +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.27; Wed, 18 Oct 2023 12:19:07 -0500 From: Robert Richter To: Davidlohr Bueso , Jonathan Cameron , Dave Jiang , "Alison Schofield" , Vishal Verma , Ira Weiny , Ben Widawsky , Dan Williams CC: , , Bjorn Helgaas , Terry Bowman , Robert Richter Subject: [PATCH v12 10/20] cxl/pci: Introduce config option PCIEAER_CXL Date: Wed, 18 Oct 2023 19:17:03 +0200 Message-ID: <20231018171713.1883517-11-rrichter@amd.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20231018171713.1883517-1-rrichter@amd.com> References: <20231018171713.1883517-1-rrichter@amd.com> Precedence: bulk X-Mailing-List: linux-cxl@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN1PEPF000252A3:EE_|IA1PR12MB6329:EE_ X-MS-Office365-Filtering-Correlation-Id: acdd0be0-b800-46e7-c82e-08dbcffe6ec1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: /OigQgQc2/+zG/U+E0iQfHzFcOXLo+3owwYu/cCXcUl6Pg3z+6RccBssxFbbV0BsJt6mL4O3TtSJOkqLIjibnYnIZnpGorYMdBXurXfZS+/tjEhE1iS3NjyKxmolwaawfrZJmM6g4MSuilBuFxfC7cinpr7t3XIJU1aXZz7QwmC2pOGQhbBv2g+zpOdBzuhURUQgNoiY8MD7ZgrSjEpdXs6o2sBLfxS7ulDTR0UbCjW6bg9DG51D5wWO1ytvbo/FEZPGbsfHeZgLziZ/+h1NSLQtnAwI3Cjk4xQXlHCb4u/j2Zmmik5rTaU7yLxJ3JvN+iqzDHL49smzAFXQpmaDWJ40GCTGvY+0TSCC/4T7c5AdpqYHk7M2KwqKZj5xoGCmnDssZzcmM2MXgIx4XmIp/2f2faE8X/uIyE9tfrOWX1GqtZRvpQeFBmikY2z/uU7jZsnzzAk6UweL2jBSFBrANzBx1HJiNISZTaoDPK5re3LIEWssmoRGQZNSIotynBx9wdjSaqC5Htulu96fwCPHP+InRfWaF7dzcKHPJyMjzbzY722naH3cqiq1EjVUBpIYPbMN01OjF7rvoLz3flUkE/QoJFBKw4Rv1Aqhf7rp6EaSCUd78+ynkpZjwqsJBVZ+3gYksd96R0dHanOOsPbiO4Gdv5mYH/9mGrbxcqXTV3KSptDsstIq0AfDjq8xyt45X42oV+NrsSMSxUHCec/O3UGV+f9sk56REbWppocvE36VXPqqcMa2+ZpUMVvdGOpcNHxKPhGSOk8K4oqEuM5FGA== 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:(13230031)(4636009)(136003)(39860400002)(346002)(396003)(376002)(230922051799003)(186009)(1800799009)(82310400011)(64100799003)(451199024)(40470700004)(36840700001)(46966006)(40460700003)(40480700001)(478600001)(16526019)(2616005)(1076003)(6666004)(41300700001)(336012)(426003)(26005)(316002)(5660300002)(54906003)(70206006)(70586007)(356005)(110136005)(82740400003)(36756003)(83380400001)(36860700001)(81166007)(47076005)(8676002)(8936002)(4326008)(2906002)(7416002)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Oct 2023 17:19:48.9112 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: acdd0be0-b800-46e7-c82e-08dbcffe6ec1 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: SN1PEPF000252A3.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB6329 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net CXL error handling depends on AER. Introduce config option PCIEAER_CXL in preparation of the AER dport error handling. Also, introduce the stub function devm_cxl_setup_parent_dport() to setup dports. This is in preparation of follow on patches. Note the Kconfg part of the option is added in a later patch to enable it once coding of the feature is complete. Signed-off-by: Robert Richter Reviewed-by: Jonathan Cameron --- drivers/cxl/core/pci.c | 9 +++++++++ drivers/cxl/cxl.h | 7 +++++++ drivers/cxl/mem.c | 2 ++ 3 files changed, 18 insertions(+) diff --git a/drivers/cxl/core/pci.c b/drivers/cxl/core/pci.c index c7a7887ebdcf..7c3fbf9815e9 100644 --- a/drivers/cxl/core/pci.c +++ b/drivers/cxl/core/pci.c @@ -718,6 +718,15 @@ static bool cxl_report_and_clear(struct cxl_dev_state *cxlds) return true; } +#ifdef CONFIG_PCIEAER_CXL + +void cxl_setup_parent_dport(struct device *host, struct cxl_dport *dport) +{ +} +EXPORT_SYMBOL_NS_GPL(cxl_setup_parent_dport, CXL); + +#endif + pci_ers_result_t cxl_error_detected(struct pci_dev *pdev, pci_channel_state_t state) { diff --git a/drivers/cxl/cxl.h b/drivers/cxl/cxl.h index c07064e0c136..cdb2ade6ba29 100644 --- a/drivers/cxl/cxl.h +++ b/drivers/cxl/cxl.h @@ -704,6 +704,13 @@ struct cxl_dport *devm_cxl_add_rch_dport(struct cxl_port *port, struct device *dport_dev, int port_id, resource_size_t rcrb); +#ifdef CONFIG_PCIEAER_CXL +void cxl_setup_parent_dport(struct device *host, struct cxl_dport *dport); +#else +static inline void cxl_setup_parent_dport(struct device *host, + struct cxl_dport *dport) { } +#endif + struct cxl_decoder *to_cxl_decoder(struct device *dev); struct cxl_root_decoder *to_cxl_root_decoder(struct device *dev); struct cxl_switch_decoder *to_cxl_switch_decoder(struct device *dev); diff --git a/drivers/cxl/mem.c b/drivers/cxl/mem.c index 04107058739b..e087febf9af0 100644 --- a/drivers/cxl/mem.c +++ b/drivers/cxl/mem.c @@ -157,6 +157,8 @@ static int cxl_mem_probe(struct device *dev) else endpoint_parent = &parent_port->dev; + cxl_setup_parent_dport(dev, dport); + device_lock(endpoint_parent); if (!endpoint_parent->driver) { dev_err(dev, "CXL port topology %s not enabled\n", From patchwork Wed Oct 18 17:17:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Richter X-Patchwork-Id: 13427549 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D35083D968 for ; Wed, 18 Oct 2023 17:20:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="y2QMeK/W" Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2041.outbound.protection.outlook.com [40.107.236.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DCAEE358B; Wed, 18 Oct 2023 10:19:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AAd4ujOMQ2Pw1IerVt7XSbyrW4evwcM/ff+SDWijqPbmbP6DB54gi66F8qm26yFB9fBAOnj8QxM1ShZhQ+0+4flpK1tvDFHPqMpZdKd98lIx6ltSeTpUYxQHwzqz8RVF2C9PJfXLDzVpj/l5k5nTLUUBSDgXsBj63FqCgCEfRLhf8MdOCLwmr0c5JXWGqIzaO8WtkDaGHYNIzeG9EvXTKzDn3r1G30Xtm//HRe2P/JDZzW28c8CEuSAkDHL6K6/ev9FcajxEF6HIDC8JC+vjYo/b6RXT1dbFBRxABaU2G4nUC7zfnX/oA0h2Yv3N7kNF3MKEeFprb7w7JKQaKNcokQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=fl5nvBL6Vf0T0Bs/KWKnwDDXuIzIjJb4YX1QAHT6vmU=; b=OJbrCQsW0/bR4vTXO8MN95r5nSypIVkNSaG/xGnnGKDmypkByqDy6wyEqxl0zntj6Lzs2Q1XCauoSdje9qX3DMroG8zutTfOiuPWJeirXp0LplcaqtfeXU1vYhUC5lz2x9/bsS3V8vEscrYhpa37wRVnC+6d+Arf5WoZFTqz2b0iFSfEOTtB/n+0g0ELnxDRrPecH7/ytKSz1rMoqzyz7/NeUt27OAdiYZCha3/Ni/qFiJf8fLhzfw8rpuBzoGFF+c1yVNVDENsauyv3Rj5CZDhlCWnYbPnQ6OK9ng8NlP/2cEiLbUld/wMZc37d1bxanKL52bFJBpH5sgXvWkqFdA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=stgolabs.net 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 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=fl5nvBL6Vf0T0Bs/KWKnwDDXuIzIjJb4YX1QAHT6vmU=; b=y2QMeK/WiB4lYhA+u1+hIWF1tBTbpozLtYUm47WK6qInb+DpSwdyc6k5MiUNoZxlqQxDq1nYrIgn+h24ROZsTHiPt6QLiWZwgnAuvqrQawlS5rjkBDT75ZtaZX7cWzTS9RS9DKtsUiByygIZLjzEKyaIrvD5tNkCVnURpXmjvEA= Received: from PH7PR17CA0054.namprd17.prod.outlook.com (2603:10b6:510:325::18) by MW4PR12MB5627.namprd12.prod.outlook.com (2603:10b6:303:16a::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6907.24; Wed, 18 Oct 2023 17:19:56 +0000 Received: from SN1PEPF000252A0.namprd05.prod.outlook.com (2603:10b6:510:325:cafe::7d) by PH7PR17CA0054.outlook.office365.com (2603:10b6:510:325::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6907.21 via Frontend Transport; Wed, 18 Oct 2023 17:19:56 +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 SN1PEPF000252A0.mail.protection.outlook.com (10.167.242.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6907.20 via Frontend Transport; Wed, 18 Oct 2023 17:19:55 +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.27; Wed, 18 Oct 2023 12:19:48 -0500 From: Robert Richter To: Davidlohr Bueso , Jonathan Cameron , Dave Jiang , "Alison Schofield" , Vishal Verma , Ira Weiny , Ben Widawsky , Dan Williams CC: , , Bjorn Helgaas , Terry Bowman , Robert Richter , Jonathan Cameron Subject: [PATCH v12 11/20] cxl/pci: Add RCH downstream port AER register discovery Date: Wed, 18 Oct 2023 19:17:04 +0200 Message-ID: <20231018171713.1883517-12-rrichter@amd.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20231018171713.1883517-1-rrichter@amd.com> References: <20231018171713.1883517-1-rrichter@amd.com> Precedence: bulk X-Mailing-List: linux-cxl@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN1PEPF000252A0:EE_|MW4PR12MB5627:EE_ X-MS-Office365-Filtering-Correlation-Id: 2b3a658b-b461-405c-0607-08dbcffe72f0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: abQUH2TTt2Jexn1zBkuJaUrXEhaDesxhtEKCnZVSH+UNoiGsDZjMt+Yxj0pWDu12xzeqhyh9yf68FMNuvnXBzFY1JSuzjKr0nK4DBBp4hjYJX3bJyiw83BAY8GhYv8x0x42h2ZFF2pjHUxH7R4BoJVRvNHdQUSc+bdRWntGwKMD/cvLIFO0TgbjC/a1FMi442f9a3Gto2PosL0ji2R/C7Hb9pFRfoRvmPIvDJ7kaBipMsSvMoA66+y24oWOrATD1jDZxyZicXkks/zdmG3HKjHAEL0F4OTpJ2wQ7MPAvUhqXNr2uF54UQFnNxE37i9SOQKvzZDnDju3NeHWdfkoM5d/tmzem9ra8iRHhgUlnzJJX7FjQCVDZb0ap7YEg74NqOTlAy8LxlOxsviVcxlUAML8IFlF8BN6eZNdiUKQUffWXsg3OIh6ci9Nu7OZFRFqycFo3ftzQyxnTp1dAzjn1z13Lox+C/8fE63gMxTNUJlMBh6pYqEA+TE2G53m/XIp5gnAl3S/gLrpEWR8NbCIy3n4zq9OAlTCHfFtW+s36DWvZ2psXB7oUTlvQmerJB14QVY9UKXOTelyRpPJCzhkpiToV8x3Oqo+yd/QpGOSVpR42ZwNKzJOA37CftyAddu+Ag6RwmBHKbofk/5HixzvD4Zzo1ze9AHizlnuvfyfTAMe1rHhfbGdUfkhiZT7Vu6L0DGjy4uvPkzMURBbZFTUCedNFlcj12A5pbt3J+cJVkuGV6godXdphhSxBJLB6EsaDQcuZMy7MZF3W0uOuQOUIJw== 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:(13230031)(4636009)(39860400002)(136003)(346002)(396003)(376002)(230922051799003)(1800799009)(64100799003)(186009)(82310400011)(451199024)(40470700004)(46966006)(36840700001)(40460700003)(4326008)(40480700001)(47076005)(336012)(36756003)(82740400003)(356005)(426003)(1076003)(81166007)(16526019)(2616005)(26005)(83380400001)(8936002)(8676002)(5660300002)(478600001)(110136005)(70586007)(70206006)(316002)(54906003)(41300700001)(6666004)(7416002)(2906002)(36860700001)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Oct 2023 17:19:55.8157 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2b3a658b-b461-405c-0607-08dbcffe72f0 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: SN1PEPF000252A0.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR12MB5627 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net From: Terry Bowman Restricted CXL host (RCH) downstream port AER information is not currently logged while in the error state. One problem preventing the error logging is the AER and RAS registers are not accessible. The CXL driver requires changes to find RCH downstream port AER and RAS registers for purpose of error logging. RCH downstream ports are not enumerated during a PCI bus scan and are instead discovered using system firmware, ACPI in this case.[1] The downstream port is implemented as a Root Complex Register Block (RCRB). The RCRB is a 4k memory block containing PCIe registers based on the PCIe root port.[2] The RCRB includes AER extended capability registers used for reporting errors. Note, the RCH's AER Capability is located in the RCRB memory space instead of PCI configuration space, thus its register access is different. Existing kernel PCIe AER functions can not be used to manage the downstream port AER capabilities and RAS registers because the port was not enumerated during PCI scan and the registers are not PCI config accessible. Discover RCH downstream port AER extended capability registers. Use MMIO accesses to search for extended AER capability in RCRB register space. [1] CXL 3.0 Spec, 9.11.2 - System Firmware View of CXL 1.1 Hierarchy [2] CXL 3.0 Spec, 8.2.1.1 - RCH Downstream Port RCRB Co-developed-by: Robert Richter Signed-off-by: Terry Bowman Signed-off-by: Robert Richter Reviewed-by: Jonathan Cameron Reviewed-by: Dave Jiang --- drivers/cxl/core/core.h | 1 + drivers/cxl/core/pci.c | 6 ++++++ drivers/cxl/core/regs.c | 36 ++++++++++++++++++++++++++++++++++++ 3 files changed, 43 insertions(+) diff --git a/drivers/cxl/core/core.h b/drivers/cxl/core/core.h index 45e7e044cf4a..f470ef5c0a6a 100644 --- a/drivers/cxl/core/core.h +++ b/drivers/cxl/core/core.h @@ -73,6 +73,7 @@ struct cxl_rcrb_info; resource_size_t __rcrb_to_component(struct device *dev, struct cxl_rcrb_info *ri, enum cxl_rcrb which); +u16 cxl_rcrb_to_aer(struct device *dev, resource_size_t rcrb); extern struct rw_semaphore cxl_dpa_rwsem; diff --git a/drivers/cxl/core/pci.c b/drivers/cxl/core/pci.c index 7c3fbf9815e9..cbccc222bb91 100644 --- a/drivers/cxl/core/pci.c +++ b/drivers/cxl/core/pci.c @@ -722,6 +722,12 @@ static bool cxl_report_and_clear(struct cxl_dev_state *cxlds) void cxl_setup_parent_dport(struct device *host, struct cxl_dport *dport) { + struct device *dport_dev = dport->dport_dev; + struct pci_host_bridge *host_bridge; + + host_bridge = to_pci_host_bridge(dport_dev); + if (host_bridge->native_cxl_error) + dport->rcrb.aer_cap = cxl_rcrb_to_aer(dport_dev, dport->rcrb.base); } EXPORT_SYMBOL_NS_GPL(cxl_setup_parent_dport, CXL); diff --git a/drivers/cxl/core/regs.c b/drivers/cxl/core/regs.c index e0fbe964f6f0..9111ceef1127 100644 --- a/drivers/cxl/core/regs.c +++ b/drivers/cxl/core/regs.c @@ -470,6 +470,42 @@ int cxl_setup_regs(struct cxl_register_map *map) } EXPORT_SYMBOL_NS_GPL(cxl_setup_regs, CXL); +u16 cxl_rcrb_to_aer(struct device *dev, resource_size_t rcrb) +{ + void __iomem *addr; + u16 offset = 0; + u32 cap_hdr; + + if (WARN_ON_ONCE(rcrb == CXL_RESOURCE_NONE)) + return 0; + + if (!request_mem_region(rcrb, SZ_4K, dev_name(dev))) + return 0; + + addr = ioremap(rcrb, SZ_4K); + if (!addr) + goto out; + + cap_hdr = readl(addr + offset); + while (PCI_EXT_CAP_ID(cap_hdr) != PCI_EXT_CAP_ID_ERR) { + offset = PCI_EXT_CAP_NEXT(cap_hdr); + + /* Offset 0 terminates capability list. */ + if (!offset) + break; + cap_hdr = readl(addr + offset); + } + + if (offset) + dev_dbg(dev, "found AER extended capability (0x%x)\n", offset); + + iounmap(addr); +out: + release_mem_region(rcrb, SZ_4K); + + return offset; +} + resource_size_t __rcrb_to_component(struct device *dev, struct cxl_rcrb_info *ri, enum cxl_rcrb which) { From patchwork Wed Oct 18 17:17:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Richter X-Patchwork-Id: 13427551 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EC59F3D982 for ; Wed, 18 Oct 2023 17:20:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="y6jsoUaw" Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2040.outbound.protection.outlook.com [40.107.236.40]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EC0083592; Wed, 18 Oct 2023 10:20:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RQz8djnEkCrd/q1HRF1jvnBdDO2siIh8Ai3u+5UVBM31r2gmBV6H3Q+vSbm41FswJlxetrWs10WD6WO+Skpj+kTd7Ku3WbaKUlYgbElTOBhkcxRvfWFOgfOFR0Fz+hhj53Z6oyXyhuhiz/DsFhE1EmrSSTzazWS+VrklEwqgym8dzBnFvQrLjQpKNI0Mr9abD/hZ/lMkMvh4v/cWHCvn4SotlyPDD6ht6Dmxp/0mQhwlZBI37cElKcEyOZ6EwApbYk9Q9oVrOA6C10UTP0wKegmK0CHUhFTbqTn47sjCdQeKEiOHmikmPaoRUzCVLhlnxd59hJ1v82aGZbw5kiElRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=5OQKVGh3EZ/j+8iwVEPWfT+hqonAJDDZqGI8hLrumcM=; b=F/Ugye1EUinNCLEGTP0VT2NihJmgHxrWTBn5FcTb2siRiam8FvJbj4UOF3/NkWXY7gwDM8zzGXfiAZjz1C0b8T3CQ387ZnpV5F5j/lksmnZT/YrUNLeo3df0QDSWG3mXaFmU69u6HHCnAa+6aasL0n9Gmn+j3ezPTsF9Brr51GceFEORwC05ZGickJx+wKFBbFctfydxwLYLiVjUKjWciZ77rZtlHqW2K1JYBBt4jd9wx6O/1OGJMN3VRBpECRAnovrxw/P5N+VIF9vTybNM3DTLlkOIEMp7i3tkytL012dnezJHDx9pEVRw4ADjcR/GgRYPLP95ms6sIybJ+RFuZg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=stgolabs.net 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 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=5OQKVGh3EZ/j+8iwVEPWfT+hqonAJDDZqGI8hLrumcM=; b=y6jsoUawkF660MO2zOx8MJDEtZz25mSND+Beml0WlNOq9ayHr2ve0WNyulDmNQmeShhBThYGhz421RBdZGNkL4lGWth3uxOgm+V8LwQRm1w9jf8Xt01/WrmKcbOWEB83cgt+kO+MUkoj+/av0vjPFsZWXS71XhZsRhs+v2BWxT8= Received: from SA0PR11CA0186.namprd11.prod.outlook.com (2603:10b6:806:1bc::11) by PH7PR12MB6491.namprd12.prod.outlook.com (2603:10b6:510:1f4::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6907.23; Wed, 18 Oct 2023 17:20:01 +0000 Received: from SN1PEPF000252A1.namprd05.prod.outlook.com (2603:10b6:806:1bc:cafe::3) by SA0PR11CA0186.outlook.office365.com (2603:10b6:806:1bc::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6907.23 via Frontend Transport; Wed, 18 Oct 2023 17:20:01 +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 SN1PEPF000252A1.mail.protection.outlook.com (10.167.242.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6907.20 via Frontend Transport; Wed, 18 Oct 2023 17:20:00 +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.27; Wed, 18 Oct 2023 12:19:52 -0500 From: Robert Richter To: Davidlohr Bueso , Jonathan Cameron , Dave Jiang , "Alison Schofield" , Vishal Verma , Ira Weiny , Ben Widawsky , Dan Williams , "Mahesh J Salgaonkar" , Bjorn Helgaas CC: , , Terry Bowman , Robert Richter , Oliver O'Halloran , , Jonathan Cameron , Subject: [PATCH v12 12/20] PCI/AER: Refactor cper_print_aer() for use by CXL driver module Date: Wed, 18 Oct 2023 19:17:05 +0200 Message-ID: <20231018171713.1883517-13-rrichter@amd.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20231018171713.1883517-1-rrichter@amd.com> References: <20231018171713.1883517-1-rrichter@amd.com> Precedence: bulk X-Mailing-List: linux-cxl@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN1PEPF000252A1:EE_|PH7PR12MB6491:EE_ X-MS-Office365-Filtering-Correlation-Id: 83e9582f-8ba2-41de-5aeb-08dbcffe75b2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: iYEN+XP1Ly/xvnRz1HX47knYDC/uFvO9kbk9aUH6BzTip85n5Aovj+d2fSY75MYSaQWTVIgVivmkfvQE+MZJW5SclSNJkzFhxTRJ31hSfPBN3iXi8S+UWgx7fJT9D2hmWEJRKxzJ8KuOMs6mEF3TXMWv9/G9R4so5VHpVI2uAUcyZOIiOflSQiEiSSKrN4sMZAfMJJsdnBnwXVdlCPyaEe7c7+MZBcOzv7L9mDG6tQo2yw65DCA8jv0YNtZgNZPO7gV1ka8UZLC9f04FRe+hfR3YIrqy52jwJDhUZ07oLrKpHVe/73Z3e3Z21cUqMsCieSRAu7vfWRz/fpm5F7TJBQYIus8H+aJG7+l6qOSNOOx/Ivy2M+I3mkXOiITGovG0DDl9V69P+VTp0NYDorV8hyRW76xzMG8NdUa5vOjbaIegLOmyuZ3z32FYzM+A86ZIz5KdO3gztJDAZWlRCC6hsb2HkHaalyZheOKejFyO/QcJOwJROzNOpON/aIegcJoXYiO+vd5NijRSr5HnRyRBaVL5KA8Kevpw2sLpagJv97MW6l2XAWUh9gePqRFwV8O1Vdwmkjrf7L0ZrAYePGcM7zBQtjBfa7v3Yiy8SXR5DlM1H8duQUu50VsAV4x/e00bQZL6E8dpXp7HIC/L/lT4NgvH+9FMD3BUDAz5vuxgJfxWv6t9G7KfzVgsUC1i3gtlwb4P3Y/qpAXcOaZb0O61CpveO2kxt1gMCX4xYv9a7NMc2e/3sxvosS3YalgxkLJMuuMDlu6aComhB/jyQQzHt8sjfKJo3n27FjgFuroesm8= 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:(13230031)(4636009)(39860400002)(346002)(376002)(396003)(136003)(230922051799003)(451199024)(1800799009)(82310400011)(186009)(64100799003)(46966006)(40470700004)(36840700001)(36860700001)(40460700003)(478600001)(5660300002)(70586007)(110136005)(70206006)(83380400001)(8936002)(8676002)(7416002)(2906002)(41300700001)(6666004)(54906003)(316002)(4326008)(336012)(40480700001)(47076005)(81166007)(1076003)(26005)(2616005)(16526019)(356005)(426003)(82740400003)(921005)(36756003)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Oct 2023 17:20:00.5385 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 83e9582f-8ba2-41de-5aeb-08dbcffe75b2 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: SN1PEPF000252A1.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB6491 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net From: Terry Bowman The CXL driver plans to use cper_print_aer() for logging restricted CXL host (RCH) AER errors. cper_print_aer() is not currently exported and therefore not usable by the CXL drivers built as loadable modules. Export the cper_print_aer() function. Use the EXPORT_SYMBOL_NS_GPL() variant to restrict the export to CXL drivers. The CONFIG_ACPI_APEI_PCIEAER kernel config is currently used to enable cper_print_aer(). cper_print_aer() logs the AER registers and is useful in PCIE AER logging outside of APEI. Remove the CONFIG_ACPI_APEI_PCIEAER dependency to enable cper_print_aer(). The cper_print_aer() function name implies CPER specific use but is useful in non-CPER cases as well. Rename cper_print_aer() to pci_print_aer(). Also, update cxl_core to import CXL namespace imports. Co-developed-by: Robert Richter Signed-off-by: Terry Bowman Signed-off-by: Robert Richter Cc: Mahesh J Salgaonkar Cc: "Oliver O'Halloran" Cc: Bjorn Helgaas Cc: linux-pci@vger.kernel.org Reviewed-by: Jonathan Cameron Acked-by: Bjorn Helgaas Reviewed-by: Dave Jiang --- drivers/cxl/core/port.c | 1 + drivers/pci/pcie/aer.c | 9 +++++---- include/linux/aer.h | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/cxl/core/port.c b/drivers/cxl/core/port.c index 41a8aa56cffd..802e85321a63 100644 --- a/drivers/cxl/core/port.c +++ b/drivers/cxl/core/port.c @@ -2101,3 +2101,4 @@ static void cxl_core_exit(void) subsys_initcall(cxl_core_init); module_exit(cxl_core_exit); MODULE_LICENSE("GPL v2"); +MODULE_IMPORT_NS(CXL); diff --git a/drivers/pci/pcie/aer.c b/drivers/pci/pcie/aer.c index 9c8fd69ae5ad..6593fe3fc555 100644 --- a/drivers/pci/pcie/aer.c +++ b/drivers/pci/pcie/aer.c @@ -759,9 +759,10 @@ int cper_severity_to_aer(int cper_severity) } } EXPORT_SYMBOL_GPL(cper_severity_to_aer); +#endif -void cper_print_aer(struct pci_dev *dev, int aer_severity, - struct aer_capability_regs *aer) +void pci_print_aer(struct pci_dev *dev, int aer_severity, + struct aer_capability_regs *aer) { int layer, agent, tlp_header_valid = 0; u32 status, mask; @@ -800,7 +801,7 @@ void cper_print_aer(struct pci_dev *dev, int aer_severity, trace_aer_event(dev_name(&dev->dev), (status & ~mask), aer_severity, tlp_header_valid, &aer->header_log); } -#endif +EXPORT_SYMBOL_NS_GPL(pci_print_aer, CXL); /** * add_error_device - list device to be handled @@ -996,7 +997,7 @@ static void aer_recover_work_func(struct work_struct *work) PCI_SLOT(entry.devfn), PCI_FUNC(entry.devfn)); continue; } - cper_print_aer(pdev, entry.severity, entry.regs); + pci_print_aer(pdev, entry.severity, entry.regs); if (entry.severity == AER_NONFATAL) pcie_do_recovery(pdev, pci_channel_io_normal, aer_root_reset); diff --git a/include/linux/aer.h b/include/linux/aer.h index 29cc10220952..f6ea2f57d808 100644 --- a/include/linux/aer.h +++ b/include/linux/aer.h @@ -51,7 +51,7 @@ static inline int pci_aer_clear_nonfatal_status(struct pci_dev *dev) static inline int pcie_aer_is_native(struct pci_dev *dev) { return 0; } #endif -void cper_print_aer(struct pci_dev *dev, int aer_severity, +void pci_print_aer(struct pci_dev *dev, int aer_severity, struct aer_capability_regs *aer); int cper_severity_to_aer(int cper_severity); void aer_recover_queue(int domain, unsigned int bus, unsigned int devfn, From patchwork Wed Oct 18 17:17:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Richter X-Patchwork-Id: 13427550 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 844663D3BD for ; Wed, 18 Oct 2023 17:20:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="YfmgKqON" Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on2050.outbound.protection.outlook.com [40.107.96.50]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CFFFF3595; Wed, 18 Oct 2023 10:20:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jKas5m+FzuMUUUSHt7WcYecUc+Nq+1FjLga9bfaF9bsOugmKqSZbZ7hST0FgTPiwsjhF3Jaea7sJl1uszpStWf3qfn4M4DnyEnmsBnOp74YAhDX6P8hspbmflCqxddDnbkeZNspt6YRqcz+MJtPdYzQoYPPvhdF7VTrpsEw2QEqN7Z1gVqA1B2PBuC+pdotdi9LZxYnMDKgQxSxK8PcuXNYv4QJ09q4V7WRkWWuadfb5YcoMmdt0nM49MT08BHWgTYOlrQUL7buCUyFuXKtdeEDK3y4VguYedRwI1Ak3x55WxhgiIximIlnyDJ9sxfnPB4HkkZjGZRCsJ8UtGL9TmQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=xjb+9q8+7vrJ15SqV6iRp4HtHEU3wR++60PEXfJVDSc=; b=D++Q+/Dy3agaGggUk5rEjHRBihrhJ+7g/uWs4Sy4MzpuvOdsxRqKaV29rl1qHkG6xaebfVtWB4A/ZGTSp8LOgLjxtznmvMrvyY5tv8kLWO9TOi0RQ0B1L2dDVvxzRkprcWLsCntS2Yog2oKDxhds/sLqX/0ZAXRQKYPbDN9qZhhWYa+2j11QSPEn3MEaBSET7WXS1nGBQfibwyoAVl494PBYZXVPE0A7/HI5nsSIUOIfcmDzmuEW4RRayrgBy3ptmlXtbXPS9US4gLZxkuF+Ixxdgg6Lb4NkuCMg6AThLU2y7BnZtSJcd6PsvWa7T0v1EfHBB/m5imTaQe7pjLXgTw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=stgolabs.net 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 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=xjb+9q8+7vrJ15SqV6iRp4HtHEU3wR++60PEXfJVDSc=; b=YfmgKqONJYTMejW2YH3nTuUgAA7JOhC+HojC9uZYCkRJydsDcwBBfbvRdZJtCSLLBbBgVWo1jf5Jo3WVWhAmq5pfq+JDZGde5WqkVtMBOO+O6+EZtDIHh+WG4jdCQfRzLv09ocdqgEbXf8/gKXJzD9bJ9gMnVaKI7FhX7cu2npQ= Received: from SA0PR11CA0195.namprd11.prod.outlook.com (2603:10b6:806:1bc::20) by PH7PR12MB6660.namprd12.prod.outlook.com (2603:10b6:510:212::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.36; Wed, 18 Oct 2023 17:20:01 +0000 Received: from SN1PEPF000252A1.namprd05.prod.outlook.com (2603:10b6:806:1bc:cafe::f7) by SA0PR11CA0195.outlook.office365.com (2603:10b6:806:1bc::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6907.21 via Frontend Transport; Wed, 18 Oct 2023 17:20:01 +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 SN1PEPF000252A1.mail.protection.outlook.com (10.167.242.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6907.20 via Frontend Transport; Wed, 18 Oct 2023 17:20:01 +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.27; Wed, 18 Oct 2023 12:19:56 -0500 From: Robert Richter To: Davidlohr Bueso , Jonathan Cameron , Dave Jiang , "Alison Schofield" , Vishal Verma , Ira Weiny , Ben Widawsky , Dan Williams CC: , , Bjorn Helgaas , Terry Bowman , Robert Richter , Jonathan Cameron Subject: [PATCH v12 13/20] cxl/pci: Update CXL error logging to use RAS register address Date: Wed, 18 Oct 2023 19:17:06 +0200 Message-ID: <20231018171713.1883517-14-rrichter@amd.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20231018171713.1883517-1-rrichter@amd.com> References: <20231018171713.1883517-1-rrichter@amd.com> Precedence: bulk X-Mailing-List: linux-cxl@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN1PEPF000252A1:EE_|PH7PR12MB6660:EE_ X-MS-Office365-Filtering-Correlation-Id: ba4e9186-47f0-42ec-7b59-08dbcffe7654 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: g8KmxwZwTxU4Dlwmdur0/zOu+Rn5P1uUUxwK97o4a8vsICLVB7iyuLWyadn2clCnZWdCvihV5Tk9J7hKWxg9WmmWguz9IougVjyTFRKrLC7KQJ6jYqrR/2CyDHRFITY22Pcl+zpmFtYxNKyGVPRQ5m8iPFrZ+NfLtK5ry9TFuSOdmVkCO30nc5SoP79BuyaM/KFYoLmAKD5cVtFNPApXmOpIjavvlnFpxVrFjGSzo3P/MSsVrL6EZ9wNMURivN4K7lPduirEcglWjptOBHXZY0Hdb64NmwnNM1sk5s/ZbRU5Dxtqfiid00+5LK9X0uSOAKHoZDa4l1KdK9ZoYv0N4gDPIGEiS5ssd9rjBtedbslEnItqkLgXwxUcNQqaI/iDuhEVzwssbFUzDJ9n6RhOdVjKyFeo8bbZTvTLYZyoDcjBryxypTP78TmFOgaL+tkP7hfLncHAV914ziivbQjM/YV/2Teor7H9NLwJDsiAlwZOXw+KXmOByM3XCQGwbDtV9jUsAExf8StTzvHyX9KM4irqEsWMqh1sAkFbNDmVxCUci7YhpQOZ8Xe2bKWsHNppcjSUHrilweNIypVdGXjH670fOAwEbn00jAgnLBnNTsR0iw00y71A8JVpiabIY655CB2ZDcitHxGzvfA001I6Uh5q+Zdu/z5RTyc6u3ZYs4i4jBacFy+49gqTpF+o+qCS4rdPkjqDU3i62gT4veFPOjlgqFQ76Us0bXU/Q0R3bTde510BsGp0VjQ3/PD32Qv8JAfCkGa6uwZPNONxuW5bRw== 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:(13230031)(4636009)(346002)(39860400002)(136003)(396003)(376002)(230922051799003)(82310400011)(451199024)(64100799003)(186009)(1800799009)(46966006)(40470700004)(36840700001)(36860700001)(47076005)(6666004)(82740400003)(356005)(81166007)(2906002)(54906003)(478600001)(316002)(70586007)(70206006)(7416002)(4326008)(8936002)(41300700001)(5660300002)(8676002)(110136005)(15650500001)(2616005)(83380400001)(1076003)(16526019)(336012)(426003)(26005)(36756003)(40480700001)(40460700003)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Oct 2023 17:20:01.6010 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ba4e9186-47f0-42ec-7b59-08dbcffe7654 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: SN1PEPF000252A1.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB6660 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net From: Terry Bowman The CXL error handler currently only logs endpoint RAS status. The CXL topology includes several components providing RAS details to be logged during error handling.[1] Update the current handler's RAS logging to use a RAS register address. Also, update the error handler function names to be consistent with correctable and uncorrectable RAS. This will allow for adding support to log other CXL component's RAS details in the future. [1] CXL3.0 Table 8-22 CXL_Capability_ID Assignment Co-developed-by: Robert Richter Signed-off-by: Terry Bowman Signed-off-by: Robert Richter Reviewed-by: Jonathan Cameron Reviewed-by: Dave Jiang --- drivers/cxl/core/pci.c | 44 +++++++++++++++++++++++++++++------------- 1 file changed, 31 insertions(+), 13 deletions(-) diff --git a/drivers/cxl/core/pci.c b/drivers/cxl/core/pci.c index cbccc222bb91..d101fdafb07c 100644 --- a/drivers/cxl/core/pci.c +++ b/drivers/cxl/core/pci.c @@ -646,32 +646,36 @@ void read_cdat_data(struct cxl_port *port) } EXPORT_SYMBOL_NS_GPL(read_cdat_data, CXL); -void cxl_cor_error_detected(struct pci_dev *pdev) +static void __cxl_handle_cor_ras(struct cxl_dev_state *cxlds, + void __iomem *ras_base) { - struct cxl_dev_state *cxlds = pci_get_drvdata(pdev); void __iomem *addr; u32 status; - if (!cxlds->regs.ras) + if (!ras_base) return; - addr = cxlds->regs.ras + CXL_RAS_CORRECTABLE_STATUS_OFFSET; + addr = ras_base + CXL_RAS_CORRECTABLE_STATUS_OFFSET; status = readl(addr); if (status & CXL_RAS_CORRECTABLE_STATUS_MASK) { writel(status & CXL_RAS_CORRECTABLE_STATUS_MASK, addr); trace_cxl_aer_correctable_error(cxlds->cxlmd, status); } } -EXPORT_SYMBOL_NS_GPL(cxl_cor_error_detected, CXL); + +static void cxl_handle_endpoint_cor_ras(struct cxl_dev_state *cxlds) +{ + return __cxl_handle_cor_ras(cxlds, cxlds->regs.ras); +} /* CXL spec rev3.0 8.2.4.16.1 */ -static void header_log_copy(struct cxl_dev_state *cxlds, u32 *log) +static void header_log_copy(void __iomem *ras_base, u32 *log) { void __iomem *addr; u32 *log_addr; int i, log_u32_size = CXL_HEADERLOG_SIZE / sizeof(u32); - addr = cxlds->regs.ras + CXL_RAS_HEADER_LOG_OFFSET; + addr = ras_base + CXL_RAS_HEADER_LOG_OFFSET; log_addr = log; for (i = 0; i < log_u32_size; i++) { @@ -685,17 +689,18 @@ static void header_log_copy(struct cxl_dev_state *cxlds, u32 *log) * Log the state of the RAS status registers and prepare them to log the * next error status. Return 1 if reset needed. */ -static bool cxl_report_and_clear(struct cxl_dev_state *cxlds) +static bool __cxl_handle_ras(struct cxl_dev_state *cxlds, + void __iomem *ras_base) { u32 hl[CXL_HEADERLOG_SIZE_U32]; void __iomem *addr; u32 status; u32 fe; - if (!cxlds->regs.ras) + if (!ras_base) return false; - addr = cxlds->regs.ras + CXL_RAS_UNCORRECTABLE_STATUS_OFFSET; + addr = ras_base + CXL_RAS_UNCORRECTABLE_STATUS_OFFSET; status = readl(addr); if (!(status & CXL_RAS_UNCORRECTABLE_STATUS_MASK)) return false; @@ -703,7 +708,7 @@ static bool cxl_report_and_clear(struct cxl_dev_state *cxlds) /* If multiple errors, log header points to first error from ctrl reg */ if (hweight32(status) > 1) { void __iomem *rcc_addr = - cxlds->regs.ras + CXL_RAS_CAP_CONTROL_OFFSET; + ras_base + CXL_RAS_CAP_CONTROL_OFFSET; fe = BIT(FIELD_GET(CXL_RAS_CAP_CONTROL_FE_MASK, readl(rcc_addr))); @@ -711,13 +716,18 @@ static bool cxl_report_and_clear(struct cxl_dev_state *cxlds) fe = status; } - header_log_copy(cxlds, hl); + header_log_copy(ras_base, hl); trace_cxl_aer_uncorrectable_error(cxlds->cxlmd, status, fe, hl); writel(status & CXL_RAS_UNCORRECTABLE_STATUS_MASK, addr); return true; } +static bool cxl_handle_endpoint_ras(struct cxl_dev_state *cxlds) +{ + return __cxl_handle_ras(cxlds, cxlds->regs.ras); +} + #ifdef CONFIG_PCIEAER_CXL void cxl_setup_parent_dport(struct device *host, struct cxl_dport *dport) @@ -733,6 +743,14 @@ EXPORT_SYMBOL_NS_GPL(cxl_setup_parent_dport, CXL); #endif +void cxl_cor_error_detected(struct pci_dev *pdev) +{ + struct cxl_dev_state *cxlds = pci_get_drvdata(pdev); + + cxl_handle_endpoint_cor_ras(cxlds); +} +EXPORT_SYMBOL_NS_GPL(cxl_cor_error_detected, CXL); + pci_ers_result_t cxl_error_detected(struct pci_dev *pdev, pci_channel_state_t state) { @@ -747,7 +765,7 @@ pci_ers_result_t cxl_error_detected(struct pci_dev *pdev, * chance the situation is recoverable dump the status of the RAS * capability registers and bounce the active state of the memdev. */ - ue = cxl_report_and_clear(cxlds); + ue = cxl_handle_endpoint_ras(cxlds); switch (state) { case pci_channel_io_normal: From patchwork Wed Oct 18 17:17:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Richter X-Patchwork-Id: 13427548 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4D9373D3BE for ; Wed, 18 Oct 2023 17:20:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="sIUr1rSx" Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2079.outbound.protection.outlook.com [40.107.237.79]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 46DE92121; Wed, 18 Oct 2023 10:20:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IGs+wW8Y9G2/GiGKIZkKrnjSRTeL5BlzZIsYUs8dhzLYl21w2Fc4eY112gEcZwPEe0rJ+3eNMQ4+RV51ivRqREtUbthxlsUd2ZRt17DBQ66o3x4uq289FqycLj/AtSUWSTB1XrYtM5g/0ki1Zf7YZSl4L4StbOFmRigXfl9oWN+d5W2ON81q/+wl0yYyZ+f/1HHeUbKNsgEbKxxDpS71E5tQwLknUJJRhIxT7reOXIbP/lHARvdyOEYkENDiWh6syPlQVw2Z9MB9EG6A7B9ibx0nezimWyRpw3OEaS/QlBzsUMjuUCyXkAFasu2Knt3dgV67+d0FTX62AUXkHawASw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=rCP/pWOdvSlcAkAy1hynVuPUWlCUHIObdOAE9gQykmA=; b=atM4QLEglU0+D6sjlW5Y9WiNHDpnT+1hOgIpRevzfGAMZ0xIxyUjKk7Vaco+YmkYkUpMBkv91xnhFzJ7W2NzSW4g/5oHPKtP+BSG/hzKFpw22ZyQcRqFR/cmXFQY50LLeTBj2eeLUPTMxXb6vQ+WcOX9oPm3w4tcP+vHLNbchIJWUfNUzwz5gi14l34mhpBwm9HmssMPvZgTBxOqq3sp6fqLtybfdnEe0dC1x725knWt8G6MH7e9QQYNQXvgFMxyScKV3Nk8aUrhsVO9aMWFDd/yz8zqafHWfsger+TX+qnLsrCZ6L6TiGUPR7QAB0tbw1Jk+r3rRE8YJ890Qqb4Pw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=stgolabs.net 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 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=rCP/pWOdvSlcAkAy1hynVuPUWlCUHIObdOAE9gQykmA=; b=sIUr1rSx/4qW6u8Vn1WcEUJmnvZGsbvwVhDZdiA5+3eyn1D9k2g8gxnuuG/kxn/36Cdp3oqdl6NCBfZF9GPJhLSLw+fkQKR0GqEg6Vl/v3z2HZBDBjaO+mkBlI7BTsvJdl0kVBS/YFHaDk+lrYS+C2MOCzGSFwHaHcdBOiBo5qY= Received: from SA0PR11CA0187.namprd11.prod.outlook.com (2603:10b6:806:1bc::12) by BN9PR12MB5033.namprd12.prod.outlook.com (2603:10b6:408:132::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6907.21; Wed, 18 Oct 2023 17:20:04 +0000 Received: from SN1PEPF000252A1.namprd05.prod.outlook.com (2603:10b6:806:1bc:cafe::f5) by SA0PR11CA0187.outlook.office365.com (2603:10b6:806:1bc::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6907.21 via Frontend Transport; Wed, 18 Oct 2023 17:20:04 +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 SN1PEPF000252A1.mail.protection.outlook.com (10.167.242.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6907.20 via Frontend Transport; Wed, 18 Oct 2023 17:20:04 +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.27; Wed, 18 Oct 2023 12:20:00 -0500 From: Robert Richter To: Davidlohr Bueso , Jonathan Cameron , Dave Jiang , "Alison Schofield" , Vishal Verma , Ira Weiny , Ben Widawsky , Dan Williams CC: , , Bjorn Helgaas , Terry Bowman , Robert Richter , Jonathan Cameron Subject: [PATCH v12 14/20] cxl/pci: Map RCH downstream AER registers for logging protocol errors Date: Wed, 18 Oct 2023 19:17:07 +0200 Message-ID: <20231018171713.1883517-15-rrichter@amd.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20231018171713.1883517-1-rrichter@amd.com> References: <20231018171713.1883517-1-rrichter@amd.com> Precedence: bulk X-Mailing-List: linux-cxl@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN1PEPF000252A1:EE_|BN9PR12MB5033:EE_ X-MS-Office365-Filtering-Correlation-Id: 901b0365-a43c-4d02-2e15-08dbcffe780b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Ch1S69fTX51eAqYsRr6xMmrQTnGK89PDsplU98UsUeSX+26xYN0nWg03BlStM+uyiVRGptPS0y+nsFv7XeH2U0a7Y3EMZBrPeUFk6c3Qj5GgFkQuKG+jYcJHzHkIciHifN1Njo/8UBr/6n84uJLNJk42kd9PJ+G6L2ITnmqWoB9He5cTbRgMRqbIfsAR8WT7gpw27S005KL42F3hA1yOGSMHPCxkVr+ItlYN5/iAf9XT7NJIWSZxDFZYKBcIvjDenzz2wj/96vnPhewaco7DNxCAtPIKJ/QOOQIebC74qqCsrHbIPlJSmCoxL/tjAI4u1gwN5qYlnngDpIydEBJG6m5QxWyNPGC90fwxFmeQkJezw3rYpXptLQoegDjxCUDbPkYmO31eoqXnYKtNqTusgT9ZgaVG7tP4rhMP7hX4CLy850BHM3+z77E3AZulgAE2+43RcQlkucn8OBLubWGeO2M/WPAlmwBe3Bny8lBLykUMCeGfYRXwwxTFjTCMU9MD9VCcy7xgNKLe89lux9opn8/+zyCxDF6XPW/jAiXO1mqsW2s03CUddjnYRWTr1tE8ye3kYJLlxy00ZF1EA+bXb4oATMDIzmdibkkbE7RNj3JFFXgc653SH6sQKabRocCG64Bl9FVymRRlWWaACuvEVmgLrwen1O1i+a/QltQB5E7L5OwgiL30KbZ8PZmxv8MEF6cYJpFkwzzbchB2p+wfnAsv1atxuwAmkIgE0O+zQBx3MqdhORwT1GD2cZw33wVCNMY/jv9K+BzWjFC86MWcuw== 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:(13230031)(4636009)(376002)(346002)(39860400002)(396003)(136003)(230922051799003)(451199024)(64100799003)(82310400011)(186009)(1800799009)(36840700001)(40470700004)(46966006)(40460700003)(26005)(1076003)(426003)(8936002)(16526019)(2616005)(83380400001)(336012)(36860700001)(316002)(7416002)(5660300002)(47076005)(41300700001)(4326008)(8676002)(2906002)(82740400003)(478600001)(70206006)(54906003)(110136005)(70586007)(356005)(81166007)(40480700001)(36756003)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Oct 2023 17:20:04.4136 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 901b0365-a43c-4d02-2e15-08dbcffe780b 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: SN1PEPF000252A1.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN9PR12MB5033 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net From: Terry Bowman The restricted CXL host (RCH) error handler will log protocol errors using AER and RAS status registers. The AER and RAS registers need to be virtually memory mapped before enabling interrupts. Create the initializer function devm_cxl_setup_parent_dport() for this when the endpoint is connected with the dport. The initialization sets up the RCH RAS and AER mappings. Add 'struct cxl_regs' to 'struct cxl_dport' for saving a pointer to the RCH downstream port's AER and RAS registers. Signed-off-by: Terry Bowman Co-developed-by: Robert Richter Signed-off-by: Robert Richter Reviewed-by: Jonathan Cameron Signed-off-by: Dan Williams --- drivers/cxl/core/pci.c | 36 ++++++++++++++++++++++++++++++++++++ drivers/cxl/cxl.h | 10 ++++++++++ 2 files changed, 46 insertions(+) diff --git a/drivers/cxl/core/pci.c b/drivers/cxl/core/pci.c index d101fdafb07c..3b4bb8d05035 100644 --- a/drivers/cxl/core/pci.c +++ b/drivers/cxl/core/pci.c @@ -5,6 +5,7 @@ #include #include #include +#include #include #include #include @@ -730,6 +731,38 @@ static bool cxl_handle_endpoint_ras(struct cxl_dev_state *cxlds) #ifdef CONFIG_PCIEAER_CXL +static void cxl_dport_map_rch_aer(struct cxl_dport *dport) +{ + struct cxl_rcrb_info *ri = &dport->rcrb; + void __iomem *dport_aer = NULL; + resource_size_t aer_phys; + struct device *host; + + if (dport->rch && ri->aer_cap) { + host = dport->reg_map.host; + aer_phys = ri->aer_cap + ri->base; + dport_aer = devm_cxl_iomap_block(host, aer_phys, + sizeof(struct aer_capability_regs)); + } + + dport->regs.dport_aer = dport_aer; +} + +static void cxl_dport_map_regs(struct cxl_dport *dport) +{ + struct cxl_register_map *map = &dport->reg_map; + struct device *dev = dport->dport_dev; + + if (!map->component_map.ras.valid) + dev_dbg(dev, "RAS registers not found\n"); + else if (cxl_map_component_regs(map, &dport->regs.component, + BIT(CXL_CM_CAP_CAP_ID_RAS))) + dev_dbg(dev, "Failed to map RAS capability.\n"); + + if (dport->rch) + cxl_dport_map_rch_aer(dport); +} + void cxl_setup_parent_dport(struct device *host, struct cxl_dport *dport) { struct device *dport_dev = dport->dport_dev; @@ -738,6 +771,9 @@ void cxl_setup_parent_dport(struct device *host, struct cxl_dport *dport) host_bridge = to_pci_host_bridge(dport_dev); if (host_bridge->native_cxl_error) dport->rcrb.aer_cap = cxl_rcrb_to_aer(dport_dev, dport->rcrb.base); + + dport->reg_map.host = host; + cxl_dport_map_regs(dport); } EXPORT_SYMBOL_NS_GPL(cxl_setup_parent_dport, CXL); diff --git a/drivers/cxl/cxl.h b/drivers/cxl/cxl.h index cdb2ade6ba29..3b09286d9d52 100644 --- a/drivers/cxl/cxl.h +++ b/drivers/cxl/cxl.h @@ -221,6 +221,14 @@ struct cxl_regs { struct_group_tagged(cxl_pmu_regs, pmu_regs, void __iomem *pmu; ); + + /* + * RCH downstream port specific RAS register + * @aer: CXL 3.0 8.2.1.1 RCH Downstream Port RCRB + */ + struct_group_tagged(cxl_rch_regs, rch_regs, + void __iomem *dport_aer; + ); }; struct cxl_reg_map { @@ -623,6 +631,7 @@ struct cxl_rcrb_info { * @rcrb: Data about the Root Complex Register Block layout * @rch: Indicate whether this dport was enumerated in RCH or VH mode * @port: reference to cxl_port that contains this downstream port + * @regs: Dport parsed register blocks */ struct cxl_dport { struct device *dport_dev; @@ -631,6 +640,7 @@ struct cxl_dport { struct cxl_rcrb_info rcrb; bool rch; struct cxl_port *port; + struct cxl_regs regs; }; /** From patchwork Wed Oct 18 17:17:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Richter X-Patchwork-Id: 13427553 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D15C13D961 for ; Wed, 18 Oct 2023 17:20:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="e8edoueB" Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2089.outbound.protection.outlook.com [40.107.93.89]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 073EB3A8F; Wed, 18 Oct 2023 10:20:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XE+rMjUQm+kNtR8SRscZlBSp6AXvlw92x2Tq2eIk/zReVjO6NYvVXls/SiFjhACJ+pCUcEGq5DgA2/hG61FTV4eGJT/5JSY+amiFDy965pPkhK5h7bBz4WgEDfYGipuDE8wnbuComQx/ZxVgVYJ8uf1YSacxUEiJdCLmYh8bFOwEHDpPzQOWybr/O4yuVrsPLdI6kMMQZtJrD0QsYMCIQOyUQNv4l2FvhfAXOlrCE33yB8THtrZSSp2ILZr861PstlUezsGgHJ7pwoZy5k19+Uyv1CvTYV4tp4cwjoiMh39QP+ZUoMt/ptrbqY+P6VVi2P2wRAr6xBPsUoSADQbT1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=hqT2wso/0hYRxptcVRWsFjsJ4DzNBQnDU4voR1s8jIo=; b=fMDETF/QKLs5XJrwlyQJVv3/hELXzZ5osPlpx5Dp+m1FdnFsCGe7Dt8vuaMgdUdC+aTxHKczz001v56nw3tDSGyO3oN5OiaRFq2KLpJs1aMui0Cw7MibIdaqcv/Lp0asPoOdJpgwpxXkR84OaKu0Px1hHTVfZydX5H44Ckvs0H51FiQjT8k/dgXvaFodzKKXU8qogwwoGlxyAlKD0s+LA7YepttNGQbGe3ryyuAu8dG3BfFozKzoTV35rG2IDK61EI2wpHhooBqcpdiUEN4G8TMVXGO+n+40/GoSKlLbVG+4mKEiK/qUV+UPowL7ZPLqfZJm3zhgx7ty4xRvc2CoJA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=stgolabs.net 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 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=hqT2wso/0hYRxptcVRWsFjsJ4DzNBQnDU4voR1s8jIo=; b=e8edoueBGCZpvuw2XWbkIsHLDwFl6Jr9SF+xIqlrz6LuDA4OY96Q/Ol5UfC7a0KWT2dDKLvtrb6tXpLWID+/v0T4Rm8PFrdtyIP/hDCnykewsibamlRjIMHwWMNExE2gf+AEmSTqj7r/o/Z/BBh2PjjZ4CD/Q40ysfWgB8Gn1SA= Received: from PR1P264CA0043.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:2cb::20) by CY5PR12MB6322.namprd12.prod.outlook.com (2603:10b6:930:21::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6907.23; Wed, 18 Oct 2023 17:20:35 +0000 Received: from SN1PEPF0002529E.namprd05.prod.outlook.com (2603:10a6:102:2cb:cafe::d6) by PR1P264CA0043.outlook.office365.com (2603:10a6:102:2cb::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.35 via Frontend Transport; Wed, 18 Oct 2023 17:20:35 +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 SN1PEPF0002529E.mail.protection.outlook.com (10.167.242.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6907.20 via Frontend Transport; Wed, 18 Oct 2023 17:20:34 +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.27; Wed, 18 Oct 2023 12:20:04 -0500 From: Robert Richter To: Davidlohr Bueso , Jonathan Cameron , Dave Jiang , "Alison Schofield" , Vishal Verma , Ira Weiny , Ben Widawsky , Dan Williams CC: , , Bjorn Helgaas , Terry Bowman , Robert Richter , Jonathan Cameron Subject: [PATCH v12 15/20] cxl/pci: Add RCH downstream port error logging Date: Wed, 18 Oct 2023 19:17:08 +0200 Message-ID: <20231018171713.1883517-16-rrichter@amd.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20231018171713.1883517-1-rrichter@amd.com> References: <20231018171713.1883517-1-rrichter@amd.com> Precedence: bulk X-Mailing-List: linux-cxl@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN1PEPF0002529E:EE_|CY5PR12MB6322:EE_ X-MS-Office365-Filtering-Correlation-Id: 179a2966-772e-460e-9aa1-08dbcffe89e3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: tA73G/OR/wT/cVze8ZDfYUa1NPdkFgZkL2p4EHdVTSCnq5cmLOR4m9YXbmpxgx3Z4tDeacNX7CYsugz+BblcIeT/GNXEAD6rsNC3GnAnv+M8BY9nQ0OthZdhywCUksfhGIbPazIkNyfeKbs22EabRPAPdDmjweqv5avWxwPmLLRIiVMhyHFz/cfFuQlfrSbJ6o3PVUV6FdYL7rkdb5AuQ03ZMXSiuG87rfw9JBL5EbBtToo/w6yM4WpYoLY4qqtGjZ5PLepmPO/lFwBcegcXEfzTEqfaISJg3Dg1573zT7YCPOHkElMQb6GL7g5CBAJRVr7TjC8NtsyWaBORFavg+7lSOKZ0m+mzKNEBg1QxcLVhFGnlyt45yt1xvIs9auNZf9jhnOW0KBSiHl3gfyD69Z08S3xQ7wfbO+5SBOBfj6GOvM8fnhu9eNK0skPi2/SppXSsgozw9kaRg9SLY1Dd6E+YgdPR1xRC8b9HdrSxKfME5JNQQn67ZKN8GHKpq4lz1MSGgSiqMBB+SpzARB2M86+k7Fk0qHCGMo55+eaGG2RaRtRpLM02/cAeVgcT4QeV/nPUeuYjy/povX2+mcht7Lzgw0TO3wivUAmFsorMjNAY8/lO1W00RG5zuT0stS8U45mGl6AaOugqFGSkabX4X6aRyPzI0OMP0bO88nihuKK6p6Gt21TwWX6c2Bt/ww2Ofigw2NRFBGp2ghqZvbteYZgdKQUJGJ6JUaz0zqFhBqyxWKX09EDxoEiZ6C4zRwOExNV0OAQ5vA7IR9P+52oYfQ== 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:(13230031)(4636009)(346002)(376002)(136003)(39860400002)(396003)(230922051799003)(64100799003)(1800799009)(186009)(82310400011)(451199024)(46966006)(40470700004)(36840700001)(40460700003)(40480700001)(70586007)(70206006)(54906003)(110136005)(41300700001)(316002)(478600001)(36756003)(5660300002)(8676002)(8936002)(4326008)(2906002)(36860700001)(81166007)(7416002)(356005)(336012)(47076005)(2616005)(1076003)(426003)(26005)(82740400003)(16526019)(83380400001)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Oct 2023 17:20:34.4469 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 179a2966-772e-460e-9aa1-08dbcffe89e3 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: SN1PEPF0002529E.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY5PR12MB6322 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net From: Terry Bowman RCH downstream port error logging is missing in the current CXL driver. The missing AER and RAS error logging is needed for communicating driver error details to userspace. Update the driver to include PCIe AER and CXL RAS error logging. Add RCH downstream port error handling into the existing RCiEP handler. The downstream port error handler is added to the RCiEP error handler because the downstream port is implemented in a RCRB, is not PCI enumerable, and as a result is not directly accessible to the PCI AER root port driver. The AER root port driver calls the RCiEP handler for handling RCD errors and RCH downstream port protocol errors. Update existing RCiEP correctable and uncorrectable handlers to also call the RCH handler. The RCH handler will read the RCH AER registers, check for error severity, and if an error exists will log using an existing kernel AER trace routine. The RCH handler will also log downstream port RAS errors if they exist. Co-developed-by: Robert Richter Signed-off-by: Terry Bowman Signed-off-by: Robert Richter Reviewed-by: Jonathan Cameron Reviewed-by: Dave Jiang --- drivers/cxl/core/pci.c | 96 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 96 insertions(+) diff --git a/drivers/cxl/core/pci.c b/drivers/cxl/core/pci.c index 3b4bb8d05035..3c85fd1ae5a9 100644 --- a/drivers/cxl/core/pci.c +++ b/drivers/cxl/core/pci.c @@ -777,12 +777,105 @@ void cxl_setup_parent_dport(struct device *host, struct cxl_dport *dport) } EXPORT_SYMBOL_NS_GPL(cxl_setup_parent_dport, CXL); +static void cxl_handle_rdport_cor_ras(struct cxl_dev_state *cxlds, + struct cxl_dport *dport) +{ + return __cxl_handle_cor_ras(cxlds, dport->regs.ras); +} + +static bool cxl_handle_rdport_ras(struct cxl_dev_state *cxlds, + struct cxl_dport *dport) +{ + return __cxl_handle_ras(cxlds, dport->regs.ras); +} + +/* + * Copy the AER capability registers using 32 bit read accesses. + * This is necessary because RCRB AER capability is MMIO mapped. Clear the + * status after copying. + * + * @aer_base: base address of AER capability block in RCRB + * @aer_regs: destination for copying AER capability + */ +static bool cxl_rch_get_aer_info(void __iomem *aer_base, + struct aer_capability_regs *aer_regs) +{ + int read_cnt = sizeof(struct aer_capability_regs) / sizeof(u32); + u32 *aer_regs_buf = (u32 *)aer_regs; + int n; + + if (!aer_base) + return false; + + /* Use readl() to guarantee 32-bit accesses */ + for (n = 0; n < read_cnt; n++) + aer_regs_buf[n] = readl(aer_base + n * sizeof(u32)); + + writel(aer_regs->uncor_status, aer_base + PCI_ERR_UNCOR_STATUS); + writel(aer_regs->cor_status, aer_base + PCI_ERR_COR_STATUS); + + return true; +} + +/* Get AER severity. Return false if there is no error. */ +static bool cxl_rch_get_aer_severity(struct aer_capability_regs *aer_regs, + int *severity) +{ + if (aer_regs->uncor_status & ~aer_regs->uncor_mask) { + if (aer_regs->uncor_status & PCI_ERR_ROOT_FATAL_RCV) + *severity = AER_FATAL; + else + *severity = AER_NONFATAL; + return true; + } + + if (aer_regs->cor_status & ~aer_regs->cor_mask) { + *severity = AER_CORRECTABLE; + return true; + } + + return false; +} + +static void cxl_handle_rdport_errors(struct cxl_dev_state *cxlds) +{ + struct pci_dev *pdev = to_pci_dev(cxlds->dev); + struct aer_capability_regs aer_regs; + struct cxl_dport *dport; + struct cxl_port *port; + int severity; + + port = cxl_pci_find_port(pdev, &dport); + if (!port) + return; + + put_device(&port->dev); + + if (!cxl_rch_get_aer_info(dport->regs.dport_aer, &aer_regs)) + return; + + if (!cxl_rch_get_aer_severity(&aer_regs, &severity)) + return; + + pci_print_aer(pdev, severity, &aer_regs); + + if (severity == AER_CORRECTABLE) + cxl_handle_rdport_cor_ras(cxlds, dport); + else + cxl_handle_rdport_ras(cxlds, dport); +} + +#else +static void cxl_handle_rdport_errors(struct cxl_dev_state *cxlds) { } #endif void cxl_cor_error_detected(struct pci_dev *pdev) { struct cxl_dev_state *cxlds = pci_get_drvdata(pdev); + if (cxlds->rcd) + cxl_handle_rdport_errors(cxlds); + cxl_handle_endpoint_cor_ras(cxlds); } EXPORT_SYMBOL_NS_GPL(cxl_cor_error_detected, CXL); @@ -795,6 +888,9 @@ pci_ers_result_t cxl_error_detected(struct pci_dev *pdev, struct device *dev = &cxlmd->dev; bool ue; + if (cxlds->rcd) + cxl_handle_rdport_errors(cxlds); + /* * A frozen channel indicates an impending reset which is fatal to * CXL.mem operation, and will likely crash the system. On the off From patchwork Wed Oct 18 17:17:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Richter X-Patchwork-Id: 13427552 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B4A003D3AE for ; Wed, 18 Oct 2023 17:20:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="5nAQzc4d" Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2086.outbound.protection.outlook.com [40.107.244.86]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 90CB63A90; Wed, 18 Oct 2023 10:20:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZOmtdO7rkIWwz2zDM23BgzHh63bLOEeSNaj7J13wtw1m+PHz2PS0OtjSGTuzZXjhSVZuNRMJ4+0Ei8IvKlOE+MWsLzuzEPpWPFTXCndtrsTLa49dk09LRI7BF6e+ozzNYATwG1JSxlItJgnyEGi6XpDViDgLHiNQZcrYmvmeHA4uF4gqZsC3HTxUlwQ2olTFJV7ELn6s8lNUi+ChoPfDmnH2vOOddaXP8akp8T+Qra8sW8S0w7ejx/0MLqnwedOcOlbvLw3+79DR7ug7R1whTf/k8c5An7sQPidnwKy1bk6cSfZh/vuupbLLsA2/56gL6D9/36c6AKOq+7ztaYuhUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=sqtoTpc8P9ULmgmi98sqiz9tg0uQaFxc14rukWdyR4k=; b=Xs276YJZIYIJlYJGSUemRcwi7on7zju4i76RSaHBQJ3WG3mAGYeFvK2ysItAml8mml+CdsDPT3XkBu7654vXPqRgiJhLaXoSYV37Z7U/5f2XkVjEFZIqrWmvSjWujRFCEnaoO6N7DkeAgYEtGLpE12dZFtlA5X8MCbS23FsUwh+W6Hwn0R+s9Gbyy35n3J20HMnJSJy2Ihqq+0cTTQtdoLIhKBn+/DwtX/tj0ZNBiVCq05KtrIgFc3TPX+t/S8V3m017ObfX9LG7phYL2quvOx+7lWAV7qLg/urjToYgaj7SzSx+RkktnlLAtxVvMn2wheGCiInvJSlubvWyfp53kQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=stgolabs.net 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 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=sqtoTpc8P9ULmgmi98sqiz9tg0uQaFxc14rukWdyR4k=; b=5nAQzc4dLV6/nsCg8jj+lhHjBNbnTo5Hp5YilaIfX6Ay3tcCvoj/+rFlcr7gLN+as6jomK8BLqHXzDAVC3IvmTRt0IgpT7N/mBbu0Q/LO4kZ1P0IKafWwqNFK89nTPNfLJ4UKv9CDCeJ5q6KcgMJPw5PjF1F7r5GLspTZwie/rY= Received: from PR0P264CA0171.FRAP264.PROD.OUTLOOK.COM (2603:10a6:100:1c::15) by CH0PR12MB5329.namprd12.prod.outlook.com (2603:10b6:610:d4::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6907.23; Wed, 18 Oct 2023 17:20:36 +0000 Received: from SN1PEPF000252A3.namprd05.prod.outlook.com (2603:10a6:100:1c:cafe::6c) by PR0P264CA0171.outlook.office365.com (2603:10a6:100:1c::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6907.21 via Frontend Transport; Wed, 18 Oct 2023 17:20:35 +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 SN1PEPF000252A3.mail.protection.outlook.com (10.167.242.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6907.20 via Frontend Transport; Wed, 18 Oct 2023 17:20:34 +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.27; Wed, 18 Oct 2023 12:20:30 -0500 From: Robert Richter To: Davidlohr Bueso , Jonathan Cameron , Dave Jiang , "Alison Schofield" , Vishal Verma , Ira Weiny , Ben Widawsky , Dan Williams CC: , , Bjorn Helgaas , Terry Bowman , Robert Richter , Jonathan Cameron Subject: [PATCH v12 16/20] cxl/pci: Disable root port interrupts in RCH mode Date: Wed, 18 Oct 2023 19:17:09 +0200 Message-ID: <20231018171713.1883517-17-rrichter@amd.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20231018171713.1883517-1-rrichter@amd.com> References: <20231018171713.1883517-1-rrichter@amd.com> Precedence: bulk X-Mailing-List: linux-cxl@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN1PEPF000252A3:EE_|CH0PR12MB5329:EE_ X-MS-Office365-Filtering-Correlation-Id: 0b4a0655-2b13-41a8-a81d-08dbcffe89f3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: /XQlUHSDrvj8EYX/ZLlKoiIqMhcbg7ZLFxjAOH1DBzqh4lc0HWAntfgJeHqrtH8e85fNxIXRBI7SrccNv0odb2JfUHtZTevvQXbvOxRMk1vxOywU/5pcNgAZplHHiodbJo9pIIAIlfAIXklGfctpCdVxaIcj2kSSve19VvgNubDxQnGKl23C3oAJjBlb4cl7V+a3xT3Vx6OoGzIUTrdaJaR7uuLiWNGEfhbWQi3UPDsFxZgXamKngUUEJL8jo2j4+NyuiIfRla/lGQvbw/oS+38eLZO9qY9VFz6Cf43sQtaRAmLoeMYXkQhNpLse+TAbX+cL8Cm6ft4Jdo++rYy6FDtqW7wgPE2PjjgoIzc/P0q48eUsTQHArUpwW6E0YGcBFog+lvr5ZWq485y6AP+AcHnoVeV8/E6GAjPdV0bDeylNZnKqG9GBwfmXPNbQ7ixXd1mWIuHzU6HYq8PfZfIWaVwoB04Z3xAEnn1K5G9Q1UTlA82fNc5C6d3TBg1IYNox1J436t3BoIR1jOjrUTe18AIKyvwovwnQGOeGi+DsjR/hBMayXvwrEIrpTXuIEzGKj2N8so+8qicajEZnylfAcG3ow4MzA7AB6x63KflE/OZWRZccGaz5CTX1DGvFmusYPK2X/jnsgpiuyYTe753dlMZgnNuamtNiWnu34ol/UWVE/w9XPtEyMQQzchYyaUuDIiRXTKX0/22OqG9xTWbL8mdIy/ALk2PRXglYRA+U1+QxBto18NWhDonGt/OQYx8nrMlJ4NX8+1h9GP3o2fRoNQ== 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:(13230031)(4636009)(396003)(136003)(376002)(346002)(39860400002)(230922051799003)(451199024)(82310400011)(64100799003)(186009)(1800799009)(40470700004)(46966006)(36840700001)(40460700003)(81166007)(36860700001)(16526019)(7416002)(2906002)(356005)(5660300002)(8936002)(36756003)(8676002)(4326008)(83380400001)(82740400003)(426003)(26005)(1076003)(2616005)(336012)(47076005)(40480700001)(316002)(478600001)(6666004)(54906003)(110136005)(41300700001)(70206006)(70586007)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Oct 2023 17:20:34.5678 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0b4a0655-2b13-41a8-a81d-08dbcffe89f3 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: SN1PEPF000252A3.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR12MB5329 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net From: Terry Bowman The RCH root port contains root command AER registers that should not be enabled.[1] Disable these to prevent root port interrupts. [1] CXL 3.0 - 12.2.1.1 RCH Downstream Port-detected Errors Signed-off-by: Terry Bowman Signed-off-by: Robert Richter Reviewed-by: Jonathan Cameron Reviewed-by: Dave Jiang --- drivers/cxl/core/pci.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/drivers/cxl/core/pci.c b/drivers/cxl/core/pci.c index 3c85fd1ae5a9..3da195caa4ad 100644 --- a/drivers/cxl/core/pci.c +++ b/drivers/cxl/core/pci.c @@ -763,6 +763,35 @@ static void cxl_dport_map_regs(struct cxl_dport *dport) cxl_dport_map_rch_aer(dport); } +static void cxl_disable_rch_root_ints(struct cxl_dport *dport) +{ + void __iomem *aer_base = dport->regs.dport_aer; + struct pci_host_bridge *bridge; + u32 aer_cmd_mask, aer_cmd; + + if (!aer_base) + return; + + bridge = to_pci_host_bridge(dport->dport_dev); + + /* + * Disable RCH root port command interrupts. + * CXL 3.0 12.2.1.1 - RCH Downstream Port-detected Errors + * + * This sequence may not be necessary. CXL spec states disabling + * the root cmd register's interrupts is required. But, PCI spec + * shows these are disabled by default on reset. + */ + if (bridge->native_cxl_error) { + aer_cmd_mask = (PCI_ERR_ROOT_CMD_COR_EN | + PCI_ERR_ROOT_CMD_NONFATAL_EN | + PCI_ERR_ROOT_CMD_FATAL_EN); + aer_cmd = readl(aer_base + PCI_ERR_ROOT_COMMAND); + aer_cmd &= ~aer_cmd_mask; + writel(aer_cmd, aer_base + PCI_ERR_ROOT_COMMAND); + } +} + void cxl_setup_parent_dport(struct device *host, struct cxl_dport *dport) { struct device *dport_dev = dport->dport_dev; @@ -774,6 +803,9 @@ void cxl_setup_parent_dport(struct device *host, struct cxl_dport *dport) dport->reg_map.host = host; cxl_dport_map_regs(dport); + + if (dport->rch) + cxl_disable_rch_root_ints(dport); } EXPORT_SYMBOL_NS_GPL(cxl_setup_parent_dport, CXL); From patchwork Wed Oct 18 17:17:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Richter X-Patchwork-Id: 13427554 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 682E33D986 for ; Wed, 18 Oct 2023 17:20:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="z4Dahgf+" Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2050.outbound.protection.outlook.com [40.107.220.50]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 407643A94; Wed, 18 Oct 2023 10:20:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=W2jiIqXuML0jMy64v76Gn4JMQhRn6bFpXSJrNJu8s/wfQXiiGU7A2gWSzfw2hVmMi6ao2pdM2x2Z5ZW8+2PbsURRMIYS/yA3cpCES+3L3H4lYn9t9CehhIISIWWy/QRdqu9kdyF/whYjqFruXzGDy3cBZQuIG4tW9p6rMsUM/7/xtFv2hbqkBga/0KgrbwOHezJc3Yeec5MPPsMJogpXSAQaSDhtcDPb+ICHCoB18mfdBJ+wxmWwaGujY7ep4So7xdwCfaU1PGHoVkPwNXeC9RvONqTj92z5jJgLKyglWiRfZUF+6oF8yIcW2M13Z982OaXvEHkP7XcQZ52hgbtCXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=KLg1TI1Fps2XZkitjCKMw9Q0fWDRuttHbdagJuV/u5Y=; b=LcCKdjA66znLhks0HXV4CjY+1ktia0dTZYXNgiOkvIWxPaYZ2jGejetyNmyJERKxwWVyrbw6YDg1TvHuRnNeNlOTv2pbBO3spIRf7LOXsSDrInxTiTCHiEylg2gpA9w59VxVGW9N1/pQEqGkjdfxaK0wfDOIkTKWnbWfD/2sMAz7Zt+Qh1hOoeD6iI3CUnMeFjx8Ae2stz3XJToEOxu0MBPh1k8OJCdT4LQYIagxU6DDBSh+TjHCqP2UfUhB55WaQ5iDL1eTThhALYGpJtYU5HfL01VIE7QLYRADosPu0BIQuO7ST7O2G4vkEBH49l5Rwtsw/4B45F8zqe/tnR+K8Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=stgolabs.net 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 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=KLg1TI1Fps2XZkitjCKMw9Q0fWDRuttHbdagJuV/u5Y=; b=z4Dahgf+Vq2PmVg2em5kZC8j0SoiMplkvZaOFveX0CHp1S6fsfxdjRRbc1E+Uh7ZUFlFLpnJLTACh8lQSN9WHpZPB2MguKWXEr/V5IqfHIbUX8c6Lh7pwwzvZGv94itXOZ2m3LL0Z68g8gZUVUe9yn/EeAN4OA9DX79NKPhqQvw= Received: from SA0PR11CA0204.namprd11.prod.outlook.com (2603:10b6:806:1bc::29) by PH7PR12MB6883.namprd12.prod.outlook.com (2603:10b6:510:1b9::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.35; Wed, 18 Oct 2023 17:20:38 +0000 Received: from SN1PEPF000252A2.namprd05.prod.outlook.com (2603:10b6:806:1bc:cafe::e7) by SA0PR11CA0204.outlook.office365.com (2603:10b6:806:1bc::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6907.21 via Frontend Transport; Wed, 18 Oct 2023 17:20:38 +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 SN1PEPF000252A2.mail.protection.outlook.com (10.167.242.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6907.20 via Frontend Transport; Wed, 18 Oct 2023 17:20: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.27; Wed, 18 Oct 2023 12:20:33 -0500 From: Robert Richter To: Davidlohr Bueso , Jonathan Cameron , Dave Jiang , "Alison Schofield" , Vishal Verma , Ira Weiny , Ben Widawsky , Dan Williams , Bjorn Helgaas , Mahesh J Salgaonkar CC: , , Terry Bowman , Robert Richter , Oliver O'Halloran , , , Jonathan Cameron Subject: [PATCH v12 17/20] PCI/AER: Forward RCH downstream port-detected errors to the CXL.mem dev handler Date: Wed, 18 Oct 2023 19:17:10 +0200 Message-ID: <20231018171713.1883517-18-rrichter@amd.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20231018171713.1883517-1-rrichter@amd.com> References: <20231018171713.1883517-1-rrichter@amd.com> Precedence: bulk X-Mailing-List: linux-cxl@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN1PEPF000252A2:EE_|PH7PR12MB6883:EE_ X-MS-Office365-Filtering-Correlation-Id: 612c07f5-8e8a-42d9-80d2-08dbcffe8bbe X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: hiPZQvKq1WUQVkOoNIdWFRP9fyg1H2MLt96wyDxOl3Zvv3+0NdLtybva+F0EUqjXmEtCWkjAI5WonCvcavfjUdWJmTPlSwLWdOoBQDS0bt1QNC7te/v/h1gYoTMVXJ6rTVICNvGTuYKo+1N+ofr5WFGmRGejpIKT/wtuXCpast8ZJ6HviA6FuH8lCVDes3CZ7kKvbIxPcRedkjHBSrnlcnaiPKf6ueemZ7pQHH/Y3uMkqGw4mi/tmERQIuD2rTUsMn59/X6562eilLaANd9tGBys+CwZh+soYtmErAIZGbwXhF1VN8KvBidOGt7lbH6yhxGAHaS8Gael+kN+Npx93oHdOkH55jFwkjSr6nCtDCY3+lHrHrsVx8QuuCZgk3FlcmrAO1Wx321JIPaL6XSfGoXyHdPpSHJiheik2TLaPb8eLpZgc4+bIXtuxMXDqjBgTSg2NuUVfIN3j8TPF7OrG00g/Xokyjnpy0Mw1kjVUTr8xob2lI/cu9Nj6qiC0c+yDaWC7jS3zDQZyoySthd83vL/YHX9Gs0fY0WIQvnZDq+N9XQRLD4iWaG7bRivxTCIJcEKeCQtSvjbjz5IhpIkXrKi2znzR5aLKjq/KKVVhQxlxC2xUlDGeTp5/2Xrs8KZYsqlYxWyObLIE2Ul3Qu5LGZMmLGs9B2T4fx94s9VV/UqY0WX+J96k7kCcibZ5AqSbz5rajIAbozIdnpZ/Q579KtG6rJh8b9az2gQ5VMMyZxRgvEkOhdd8i3E9UUi8wD9IhMY2Vt928rA6oVv4MmvuQ== 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:(13230031)(4636009)(39860400002)(346002)(376002)(136003)(396003)(230922051799003)(186009)(64100799003)(82310400011)(451199024)(1800799009)(40470700004)(46966006)(36840700001)(2906002)(6666004)(966005)(54906003)(110136005)(316002)(41300700001)(7416002)(8936002)(4326008)(8676002)(478600001)(70586007)(70206006)(40480700001)(36860700001)(47076005)(81166007)(921005)(2616005)(336012)(356005)(82740400003)(16526019)(36756003)(83380400001)(426003)(5660300002)(1076003)(26005)(40460700003)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Oct 2023 17:20:37.5592 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 612c07f5-8e8a-42d9-80d2-08dbcffe8bbe 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: SN1PEPF000252A2.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB6883 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net In Restricted CXL Device (RCD) mode a CXL device is exposed as an RCiEP, but CXL downstream and upstream ports are not enumerated and not visible in the PCIe hierarchy. [1] Protocol and link errors from these non-enumerated ports are signaled as internal AER errors, either Uncorrectable Internal Error (UIE) or Corrected Internal Errors (CIE) via an RCEC. Restricted CXL host (RCH) downstream port-detected errors have the Requester ID of the RCEC set in the RCEC's AER Error Source ID register. A CXL handler must then inspect the error status in various CXL registers residing in the dport's component register space (CXL RAS capability) or the dport's RCRB (PCIe AER extended capability). [2] Errors showing up in the RCEC's error handler must be handled and connected to the CXL subsystem. Implement this by forwarding the error to all CXL devices below the RCEC. Since the entire CXL device is controlled only using PCIe Configuration Space of device 0, function 0, only pass it there [3]. The error handling is limited to currently supported devices with the Memory Device class code set (CXL Type 3 Device, PCI_CLASS_MEMORY_CXL, 502h), handle downstream port errors in the device's cxl_pci driver. Support for other CXL Device Types (e.g. a CXL.cache Device) can be added later. To handle downstream port errors in addition to errors directed to the CXL endpoint device, a handler must also inspect the CXL RAS and PCIe AER capabilities of the CXL downstream port the device is connected to. Since CXL downstream port errors are signaled using internal errors, the handler requires those errors to be unmasked. This is subject of a follow-on patch. The reason for choosing this implementation is that the AER service driver claims the RCEC device, but does not allow it to register a custom specific handler to support CXL. Connecting the RCEC hard-wired with a CXL handler does not work, as the CXL subsystem might not be present all the time. The alternative to add an implementation to the portdrv to allow the registration of a custom RCEC error handler isn't worth doing it as CXL would be its only user. Instead, just check for an CXL RCEC and pass it down to the connected CXL device's error handler. With this approach the code can entirely be implemented in the PCIe AER driver and is independent of the CXL subsystem. The CXL driver only provides the handler. [1] CXL 3.0 spec: 9.11.8 CXL Devices Attached to an RCH [2] CXL 3.0 spec, 12.2.1.1 RCH Downstream Port-detected Errors [3] CXL 3.0 spec, 8.1.3 PCIe DVSEC for CXL Devices Co-developed-by: Terry Bowman Signed-off-by: Terry Bowman Signed-off-by: Robert Richter Cc: "Oliver O'Halloran" Cc: Bjorn Helgaas Cc: linuxppc-dev@lists.ozlabs.org Cc: linux-pci@vger.kernel.org Acked-by: Bjorn Helgaas Reviewed-by: Jonathan Cameron Reviewed-by: Dave Jiang --- drivers/pci/pcie/Kconfig | 9 ++++ drivers/pci/pcie/aer.c | 93 +++++++++++++++++++++++++++++++++++++++- 2 files changed, 100 insertions(+), 2 deletions(-) diff --git a/drivers/pci/pcie/Kconfig b/drivers/pci/pcie/Kconfig index 228652a59f27..8999fcebde6a 100644 --- a/drivers/pci/pcie/Kconfig +++ b/drivers/pci/pcie/Kconfig @@ -49,6 +49,15 @@ config PCIEAER_INJECT gotten from: https://git.kernel.org/cgit/linux/kernel/git/gong.chen/aer-inject.git/ +config PCIEAER_CXL + bool "PCI Express CXL RAS support" + default y + depends on PCIEAER && CXL_PCI + help + Enables CXL error handling. + + If unsure, say Y. + # # PCI Express ECRC # diff --git a/drivers/pci/pcie/aer.c b/drivers/pci/pcie/aer.c index 6593fe3fc555..f1e8494f5bb6 100644 --- a/drivers/pci/pcie/aer.c +++ b/drivers/pci/pcie/aer.c @@ -934,14 +934,97 @@ static bool find_source_device(struct pci_dev *parent, return true; } +#ifdef CONFIG_PCIEAER_CXL + +static bool is_cxl_mem_dev(struct pci_dev *dev) +{ + /* + * The capability, status, and control fields in Device 0, + * Function 0 DVSEC control the CXL functionality of the + * entire device (CXL 3.0, 8.1.3). + */ + if (dev->devfn != PCI_DEVFN(0, 0)) + return false; + + /* + * CXL Memory Devices must have the 502h class code set (CXL + * 3.0, 8.1.12.1). + */ + if ((dev->class >> 8) != PCI_CLASS_MEMORY_CXL) + return false; + + return true; +} + +static bool cxl_error_is_native(struct pci_dev *dev) +{ + struct pci_host_bridge *host = pci_find_host_bridge(dev->bus); + + return (pcie_ports_native || host->native_aer); +} + +static bool is_internal_error(struct aer_err_info *info) +{ + if (info->severity == AER_CORRECTABLE) + return info->status & PCI_ERR_COR_INTERNAL; + + return info->status & PCI_ERR_UNC_INTN; +} + +static int cxl_rch_handle_error_iter(struct pci_dev *dev, void *data) +{ + struct aer_err_info *info = (struct aer_err_info *)data; + const struct pci_error_handlers *err_handler; + + if (!is_cxl_mem_dev(dev) || !cxl_error_is_native(dev)) + return 0; + + /* protect dev->driver */ + device_lock(&dev->dev); + + err_handler = dev->driver ? dev->driver->err_handler : NULL; + if (!err_handler) + goto out; + + if (info->severity == AER_CORRECTABLE) { + if (err_handler->cor_error_detected) + err_handler->cor_error_detected(dev); + } else if (err_handler->error_detected) { + if (info->severity == AER_NONFATAL) + err_handler->error_detected(dev, pci_channel_io_normal); + else if (info->severity == AER_FATAL) + err_handler->error_detected(dev, pci_channel_io_frozen); + } +out: + device_unlock(&dev->dev); + return 0; +} + +static void cxl_rch_handle_error(struct pci_dev *dev, struct aer_err_info *info) +{ + /* + * Internal errors of an RCEC indicate an AER error in an + * RCH's downstream port. Check and handle them in the CXL.mem + * device driver. + */ + if (pci_pcie_type(dev) == PCI_EXP_TYPE_RC_EC && + is_internal_error(info)) + pcie_walk_rcec(dev, cxl_rch_handle_error_iter, info); +} + +#else +static inline void cxl_rch_handle_error(struct pci_dev *dev, + struct aer_err_info *info) { } +#endif + /** - * handle_error_source - handle logging error into an event log + * pci_aer_handle_error - handle logging error into an event log * @dev: pointer to pci_dev data structure of error source device * @info: comprehensive error information * * Invoked when an error being detected by Root Port. */ -static void handle_error_source(struct pci_dev *dev, struct aer_err_info *info) +static void pci_aer_handle_error(struct pci_dev *dev, struct aer_err_info *info) { int aer = dev->aer_cap; @@ -965,6 +1048,12 @@ static void handle_error_source(struct pci_dev *dev, struct aer_err_info *info) pcie_do_recovery(dev, pci_channel_io_normal, aer_root_reset); else if (info->severity == AER_FATAL) pcie_do_recovery(dev, pci_channel_io_frozen, aer_root_reset); +} + +static void handle_error_source(struct pci_dev *dev, struct aer_err_info *info) +{ + cxl_rch_handle_error(dev, info); + pci_aer_handle_error(dev, info); pci_dev_put(dev); } From patchwork Wed Oct 18 17:17:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Richter X-Patchwork-Id: 13427555 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E96183D982 for ; Wed, 18 Oct 2023 17:20:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="qU4CJiRS" Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2041.outbound.protection.outlook.com [40.107.236.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F361A3A9F; Wed, 18 Oct 2023 10:20:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BxSzVUd82gNaaHvOv5e7qcNWzHx8khA+kzmFeulIzEKMqVyreYeYzIJv6ebEhZfLsc6IJMq2zT+TdYFaJo4qzc6V8kz9uoRtbQN3j9eMWrm8jnqQIBd1aPKfoAphg6LoiReBe34UDBsqHSZ6SI3/C2WG28EuUE/wkFP1u/G8GopUuqiyczizdBfxgpYTsVnQVOiFuPU6dcjZi1sRvDDW8jlI7oVxk8qXqURKa8MPZzQdMnkrYy67eKBSZ698H6Y/gI+DYMWWOUCD3PVt56w+HFbeC4o912t0tCXiK/XdNhCQ/ELXnQ1/Mn64pCcL3mTnqhjvyc1Q538jWUXeA7GhgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=6JeIikDGFCSsEiqCPWnGvXoD10jydbbTgmGgNaa/v54=; b=JiorhSlu7gdrC0iyX4x4kLUewZLUDbYgVrsCHTiOfvqh8dDkzvYbN6NpKMKH6yzbH3pJQbXe96+FyDvErLscaUBlojP0TizjA3XD5Oko64R+UfxTeOOBJeOtAX1v7/y7vfdylfh07bX2qHsl1u5Xn/vJnCvDXtUEatssiQxDgTy34iI9jnDdiv3RagHkBn814OxkCHM7Itlu/1+TdC4vY+b4jaSIA5KwTEuEROu0ttKi4XzRTz5KfI6tX8afAQfqhHtwXnNS2/qJt50XU2t4E0MzgPjL6YrL8f6BAjtbWZ+YH0qiie9GhLT6iAKdaC0M/PzUuq8G1E5j+r52weZBgA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=stgolabs.net 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 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=6JeIikDGFCSsEiqCPWnGvXoD10jydbbTgmGgNaa/v54=; b=qU4CJiRSC5ZsTzQz7XSSZmCfYPYflurx4XVYhuvXT1QBf28bjoj/XiJq7YVoUBlVjgJIiSxGy+mftZMDRIMWFaLA7KguY7dbSqyOy9dc/+dLpKoxSgaJecCGRR21hGU3TN/FazW9tj30e8YxmCIYHaMbaRxT+AaDJCURlrHW67g= Received: from PR0P264CA0183.FRAP264.PROD.OUTLOOK.COM (2603:10a6:100:1c::27) by PH7PR12MB6666.namprd12.prod.outlook.com (2603:10b6:510:1a8::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.35; Wed, 18 Oct 2023 17:20:45 +0000 Received: from SN1PEPF000252A3.namprd05.prod.outlook.com (2603:10a6:100:1c:cafe::c8) by PR0P264CA0183.outlook.office365.com (2603:10a6:100:1c::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.36 via Frontend Transport; Wed, 18 Oct 2023 17:20: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 SN1PEPF000252A3.mail.protection.outlook.com (10.167.242.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6907.20 via Frontend Transport; Wed, 18 Oct 2023 17:20: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.27; Wed, 18 Oct 2023 12:20:37 -0500 From: Robert Richter To: Davidlohr Bueso , Jonathan Cameron , Dave Jiang , "Alison Schofield" , Vishal Verma , Ira Weiny , Ben Widawsky , Dan Williams , "Mahesh J Salgaonkar" , Bjorn Helgaas CC: , , Terry Bowman , Robert Richter , Jonathan Cameron , Oliver O'Halloran , , Subject: [PATCH v12 18/20] PCI/AER: Unmask RCEC internal errors to enable RCH downstream port error handling Date: Wed, 18 Oct 2023 19:17:11 +0200 Message-ID: <20231018171713.1883517-19-rrichter@amd.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20231018171713.1883517-1-rrichter@amd.com> References: <20231018171713.1883517-1-rrichter@amd.com> Precedence: bulk X-Mailing-List: linux-cxl@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN1PEPF000252A3:EE_|PH7PR12MB6666:EE_ X-MS-Office365-Filtering-Correlation-Id: 32fc37f9-e641-4e5a-bce2-08dbcffe8f17 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: JB/W40Bpu/86nzlRdyp0sLy32v7p+lbRhzXqFYXEGk/P5z7tb+jo9T2dMf58hoMG1UMlXj7cB0oeZliyyCzx4dTL7WAFRVXqW2MiPXDQVOwFSiDRdbHC3KWVO4EXOCixnVWBkFE9IwHJGx+s4qV+eUhCm5bODUMGbmlUZ/XzGROcHOeH0yEAMggf8OVc6gAwFdT9S+bef2e1oQXMBOjbpbJAViKfP+S1CyicVQIjkLAANwtcR/jCc2UZ7j6LwMblmmiG6twe2btzUIqE1VyXH1ELOH7UXTI5uwossJZb5S0rSn65lIKonFudcv0VUI5+EAi34ZcBlJ74uR+M0IVlSs7NNA7vlbOXdIe2VIKpa291lU81Wlnt3YSpv9Twk6/RAiInn8PtDrIZtPbsPaHhUD41ohtAIYbS3cHEfIoC9o2VR6tOWy4eb7u1H9DBGJr/r88e/lJfwqwl2Cy+H5pMj2TkA+m6XOhkL33g39OmSYvVV6Z1tH+54hxM6NvsgPPveUWwHI3CLjDu9opERDIr8/b2hUxMiBNpZjTByIbW63OhWbv+7E1oLMaV+oq4Q94JAJbLf4XsAhlQvq4vCXE5mmf7P//EYaaWcYFAOuke7xFOHrptRtN0g/dczOlSOGQNxtGG7P0rag99N1YXEQ6OqTxdDS01x3YvGeFuS1r+mY355ZJahjqvqE8BAq0CRgJHDE3I3PkDPKCjozm9eQm/nuDFEKDFPh2bw+gHfyFs6udW7y6L+D+rjVjItUVPszx1nwU0nMcOBhl9gy6BtPQzCs2rPnYgkrLYnIcwdNp3LiI= 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:(13230031)(4636009)(136003)(396003)(376002)(346002)(39860400002)(230922051799003)(1800799009)(82310400011)(64100799003)(186009)(451199024)(40470700004)(46966006)(36840700001)(316002)(70206006)(2616005)(70586007)(426003)(110136005)(478600001)(54906003)(2906002)(16526019)(4326008)(5660300002)(8676002)(26005)(7416002)(41300700001)(8936002)(921005)(82740400003)(47076005)(36756003)(83380400001)(36860700001)(6666004)(1076003)(81166007)(356005)(336012)(40460700003)(40480700001)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Oct 2023 17:20:43.1772 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 32fc37f9-e641-4e5a-bce2-08dbcffe8f17 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: SN1PEPF000252A3.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB6666 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net AER corrected and uncorrectable internal errors (CIE/UIE) are masked in their corresponding mask registers per default once in power-up state. [1][2] Enable internal errors for RCECs to receive CXL downstream port errors of Restricted CXL Hosts (RCHs). [1] CXL 3.0 Spec, 12.2.1.1 - RCH Downstream Port Detected Errors [2] PCIe Base Spec r6.0, 7.8.4.3 Uncorrectable Error Mask Register, 7.8.4.6 Correctable Error Mask Register Co-developed-by: Terry Bowman Signed-off-by: Terry Bowman Signed-off-by: Robert Richter Acked-by: Bjorn Helgaas Reviewed-by: Jonathan Cameron Reviewed-by: Dave Jiang --- drivers/pci/pcie/aer.c | 57 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/drivers/pci/pcie/aer.c b/drivers/pci/pcie/aer.c index f1e8494f5bb6..41076cb2956e 100644 --- a/drivers/pci/pcie/aer.c +++ b/drivers/pci/pcie/aer.c @@ -936,6 +936,30 @@ static bool find_source_device(struct pci_dev *parent, #ifdef CONFIG_PCIEAER_CXL +/** + * pci_aer_unmask_internal_errors - unmask internal errors + * @dev: pointer to the pcie_dev data structure + * + * Unmasks internal errors in the Uncorrectable and Correctable Error + * Mask registers. + * + * Note: AER must be enabled and supported by the device which must be + * checked in advance, e.g. with pcie_aer_is_native(). + */ +static void pci_aer_unmask_internal_errors(struct pci_dev *dev) +{ + int aer = dev->aer_cap; + u32 mask; + + pci_read_config_dword(dev, aer + PCI_ERR_UNCOR_MASK, &mask); + mask &= ~PCI_ERR_UNC_INTN; + pci_write_config_dword(dev, aer + PCI_ERR_UNCOR_MASK, mask); + + pci_read_config_dword(dev, aer + PCI_ERR_COR_MASK, &mask); + mask &= ~PCI_ERR_COR_INTERNAL; + pci_write_config_dword(dev, aer + PCI_ERR_COR_MASK, mask); +} + static bool is_cxl_mem_dev(struct pci_dev *dev) { /* @@ -1012,7 +1036,39 @@ static void cxl_rch_handle_error(struct pci_dev *dev, struct aer_err_info *info) pcie_walk_rcec(dev, cxl_rch_handle_error_iter, info); } +static int handles_cxl_error_iter(struct pci_dev *dev, void *data) +{ + bool *handles_cxl = data; + + if (!*handles_cxl) + *handles_cxl = is_cxl_mem_dev(dev) && cxl_error_is_native(dev); + + /* Non-zero terminates iteration */ + return *handles_cxl; +} + +static bool handles_cxl_errors(struct pci_dev *rcec) +{ + bool handles_cxl = false; + + if (pci_pcie_type(rcec) == PCI_EXP_TYPE_RC_EC && + pcie_aer_is_native(rcec)) + pcie_walk_rcec(rcec, handles_cxl_error_iter, &handles_cxl); + + return handles_cxl; +} + +static void cxl_rch_enable_rcec(struct pci_dev *rcec) +{ + if (!handles_cxl_errors(rcec)) + return; + + pci_aer_unmask_internal_errors(rcec); + pci_info(rcec, "CXL: Internal errors unmasked"); +} + #else +static inline void cxl_rch_enable_rcec(struct pci_dev *dev) { } static inline void cxl_rch_handle_error(struct pci_dev *dev, struct aer_err_info *info) { } #endif @@ -1412,6 +1468,7 @@ static int aer_probe(struct pcie_device *dev) return status; } + cxl_rch_enable_rcec(port); aer_enable_rootport(rpc); pci_info(port, "enabled with IRQ %d\n", dev->irq); return 0; From patchwork Wed Oct 18 17:17:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Richter X-Patchwork-Id: 13427557 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B32EF3E47D for ; Wed, 18 Oct 2023 17:20:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="Vb6/N6aT" Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2063.outbound.protection.outlook.com [40.107.243.63]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 046933A99; Wed, 18 Oct 2023 10:20:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eligYX3FtiEbwYuhR92vTOY8URw8qsY+WWoPkc3Na7sWdVfQ9u86ScuScsv3Yd6BnGD8Xv0iyZxAuFt0WN+9gy9+11cRQ2Ffh6fK7J6obhasctlXKduT79iSOed0pc6mTBwSJIhicvDf1qbOpWWqrnJcgRIrzKkn2U/5pxdCof86JFP5RodvejxsiLv5FxlcOoFZNoNRFTrqC74pwJojpLMd631gRS1KrzvgZ2wJwP7s1Eq8Y4FFPCxwWZZJey81h4rw7rNxjNVvukUzlGbwJkP2LlYKcen9G5HVBvU2CbuX45qkO1EnudhM/l8Qb9CMiz+uDGTEfKqrvNnzqLNWOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=CdHQ6ZapXhY9GyC+7nBOBIusN6J+LUEwgiPEiwaJpNU=; b=ZcPn1eOCMaOwOSg5sxs27jdmG4jZ5sSuB5Ar+/ZhgNPaTlOCWG9RTF24At/4Loxwn63TPlIvc9p/u18LfHRv8QjfscZ9ge//cB4GBUYskau10vMYAJTziLGe0WRzRTQVm4gJe2FBWfyQHpvYUaYyrwnb10Gt/iwA9eoDRzATPGFedBgty/4Az/vQVfR9DnkelKJsmZqIURLlTfgWkvtWOKCVUeb/kLxq3ecnG3gdXkdKWk2HctjBlaRvWT84qEzoNc2bRrJ190TXtfYC3k8EP3oQUSTYH+kd9JD5L555sCjxLGIV9p8jk9xBCtChLwNtiiT54/mIW8j2qNOYCFkEww== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=stgolabs.net 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 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=CdHQ6ZapXhY9GyC+7nBOBIusN6J+LUEwgiPEiwaJpNU=; b=Vb6/N6aTkKbAgTZJwMtYnaQALcdGjfPNUj7pzZiNgcYuzAOPQNGkdsI5VDo3svbCbaItLtVHhcbLKgyptsnK65aImYaZtQNqWBglsjrO+EPCfkOC7AUA/B9MpIo3bfR5ZqXB3eSW8d94BEBPHtin8RQXirCrFVnH08hnqzUKYCs= Received: from PR0P264CA0176.FRAP264.PROD.OUTLOOK.COM (2603:10a6:100:1c::20) by DM6PR12MB4155.namprd12.prod.outlook.com (2603:10b6:5:221::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6863.37; Wed, 18 Oct 2023 17:20:49 +0000 Received: from SN1PEPF000252A3.namprd05.prod.outlook.com (2603:10a6:100:1c:cafe::9a) by PR0P264CA0176.outlook.office365.com (2603:10a6:100:1c::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6907.21 via Frontend Transport; Wed, 18 Oct 2023 17:20:48 +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 SN1PEPF000252A3.mail.protection.outlook.com (10.167.242.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6907.20 via Frontend Transport; Wed, 18 Oct 2023 17:20:48 +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.27; Wed, 18 Oct 2023 12:20:41 -0500 From: Robert Richter To: Davidlohr Bueso , Jonathan Cameron , Dave Jiang , "Alison Schofield" , Vishal Verma , Ira Weiny , Ben Widawsky , Dan Williams CC: , , Bjorn Helgaas , Terry Bowman , Robert Richter , Jonathan Cameron Subject: [PATCH v12 19/20] cxl/core/regs: Rename phys_addr in cxl_map_component_regs() Date: Wed, 18 Oct 2023 19:17:12 +0200 Message-ID: <20231018171713.1883517-20-rrichter@amd.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20231018171713.1883517-1-rrichter@amd.com> References: <20231018171713.1883517-1-rrichter@amd.com> Precedence: bulk X-Mailing-List: linux-cxl@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN1PEPF000252A3:EE_|DM6PR12MB4155:EE_ X-MS-Office365-Filtering-Correlation-Id: d81832e1-c18c-413e-ea32-08dbcffe920d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: BI25FQKFftXZZ0Rysqk6QxgYIEi+mlCcLAe1+6vuArQ+9vK7tE8f/3V6E9eGBimV6B4Xs5+P3Q7QFrBLsDCs/pRKNEsCOfGpPIfREB1uczl7iK6TlkScG87Jo9rP61erDn6eA9XK5EC3jTzmi3QSrZADOZKYnLJwWTYNuuVwmb0lj8drgcHA6X4ZYt6enJNM1un8EZH0GqaEojGp5aB9dyt/mJVHkLKIqF2HbHFgiypDK06GRQaPRXPTAZyGumS9q9PEiGu7y4aY1p3WAoj/LF0K65bqjaFydjOjupVO4DoFBFwIykLMPE7iZ/F2GfbfydRT2fvKpYq3DzFOujFO0+Iizy+Dj6eXlisfj414byCvckBGFsJU+L+yyyAly0S7d0tJTNLjpmYenKdB1Py3Y+2iIWESTaFUDMT6kqTdyIjVSyB68WDViYKx5vgfWh5ZRomQdZ1/LWQH0VkJ3I+tZoXvFmf/e+O3nw1pMnGdxhriCdw+F6wrjo8QfuVbMp23cXdV1WbRubEKKfUsDeeZINn2lsRJOPtrqzH1j0rDfqCYb1h4MxBYr3dP5TuuKUjMLNcu8GN82i+Ks3WfxVGfDXAM2OyyJxZwALQqLZD208cm6EbAbRTDK3W8GJXuB2mrB4OnmSXBrbFg/RBnBmR+gWyR/CjF+oLQVzzjzs597E+yv/nFd/ekUkbA7Fl5b/x3jk/tecz6kPIwLGEK3h3DYmImN46ELDyGtbKdCsV7nm0GxrWK1nJPynq8R3+s3s/ZJOuPm5Y/cl3X768fd9nthg== 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:(13230031)(4636009)(346002)(396003)(39860400002)(136003)(376002)(230922051799003)(1800799009)(64100799003)(186009)(451199024)(82310400011)(46966006)(36840700001)(40470700004)(41300700001)(6666004)(8676002)(2616005)(1076003)(70586007)(82740400003)(40480700001)(36860700001)(316002)(478600001)(36756003)(110136005)(356005)(81166007)(40460700003)(426003)(47076005)(7416002)(2906002)(336012)(83380400001)(5660300002)(26005)(16526019)(8936002)(4326008)(70206006)(54906003)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Oct 2023 17:20:48.1616 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d81832e1-c18c-413e-ea32-08dbcffe920d 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: SN1PEPF000252A3.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4155 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Trivial change that renames variable phys_addr in cxl_map_component_regs() to shorten its length to keep the 80 char size limit for the line and also for consistency between the different paths. Signed-off-by: Terry Bowman Signed-off-by: Robert Richter Reviewed-by: Dave Jiang Reviewed-by: Jonathan Cameron --- drivers/cxl/core/regs.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/cxl/core/regs.c b/drivers/cxl/core/regs.c index 9111ceef1127..cac28a656cb8 100644 --- a/drivers/cxl/core/regs.c +++ b/drivers/cxl/core/regs.c @@ -216,16 +216,16 @@ int cxl_map_component_regs(const struct cxl_register_map *map, for (i = 0; i < ARRAY_SIZE(mapinfo); i++) { struct mapinfo *mi = &mapinfo[i]; - resource_size_t phys_addr; + resource_size_t addr; resource_size_t length; if (!mi->rmap->valid) continue; if (!test_bit(mi->rmap->id, &map_mask)) continue; - phys_addr = map->resource + mi->rmap->offset; + addr = map->resource + mi->rmap->offset; length = mi->rmap->size; - *(mi->addr) = devm_cxl_iomap_block(host, phys_addr, length); + *(mi->addr) = devm_cxl_iomap_block(host, addr, length); if (!*(mi->addr)) return -ENOMEM; } From patchwork Wed Oct 18 17:17:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Richter X-Patchwork-Id: 13427556 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 197E33D993 for ; Wed, 18 Oct 2023 17:20:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="FwwgIzSH" Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam02on2058.outbound.protection.outlook.com [40.107.212.58]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B9B403AAB; Wed, 18 Oct 2023 10:20:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lkZoxab54vQbnOAQKGIUzbuuv/k5pqVU2bThBS5mLm656mn+yCwxjFcsDAvRxsmkoH4rwlfN/JI2+g3iAG0W5RUH4ngbmLvF+t9fkqeaqrqxYLTgCppFwyROHBz8iMU4dMCuIHw4Kqi1LTMmCG+vMnJ27xfXVI4sRLg7gLfM/8lBtZJoonmGnXn1BaY7FH/jqBpbYA4ECZH7Tk5pEhbQBHwJ8bKb2yfXxlHNhRgsqAZSwJPuNKPy7lRW5ynqcCnWSsdadEmP79gK25jDUTgTwaCGXNn6D9mAUrdjbEV1Bbml1WynnXm7sD1cL8xjy39HBg+8TOD+ljMmoU1TKtrpyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=9sDEWl2jwqd1G2P3lOG6nRF+RXcG5Z8R7T0UdFKmmd8=; b=lkKrMC2NX9TYCb2DPCohkx7nIvHnHbt+z0IDplteih10s0YnpLOhajpkL3MSEWoz99fqHuBe9BdngP3Mqdj6s+zYJVsGoGkPZB3W3QFmh7CrL0+6sXy1YHkPzhhU+3r4WVfu56J7otCYhOCuPaEqxA6TXRO6MCBYa/ZpVovXGv9tTI9FGvbxWUolELhV3nSDQuR68zZVcWVgEXetn6HG2xgbOp/chr85weg0PCB6qXivshV+xBmtks2VTy9AoriYlZ/lWdbgO7cHAOqX1Z+dNWLdCN+2jq6DS8HCuSWraavqppdeLD5TcfyBUsky49lpIk8hjk1P+qVjM23VE51oAQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=stgolabs.net 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 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=9sDEWl2jwqd1G2P3lOG6nRF+RXcG5Z8R7T0UdFKmmd8=; b=FwwgIzSH7947WaQwfV8On3ZjO1iUVpoC9rT2IBcvtB+sHC+AQUce1J4uyQ3T8z7dq6XwB4T6V6LO247TlRsN1zOPXWV+jY6NXZgvsAK3FdUA0L5Y+XE8zP5DjfuMH5/c7fGdmyYqCr5qtvCR9QyUQBwtVECK4DG8iXtzGZM6YjM= Received: from PR0P264CA0185.FRAP264.PROD.OUTLOOK.COM (2603:10a6:100:1c::29) by MW4PR12MB6801.namprd12.prod.outlook.com (2603:10b6:303:1e8::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6863.37; Wed, 18 Oct 2023 17:20:51 +0000 Received: from SN1PEPF000252A3.namprd05.prod.outlook.com (2603:10a6:100:1c:cafe::f3) by PR0P264CA0185.outlook.office365.com (2603:10a6:100:1c::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6907.21 via Frontend Transport; Wed, 18 Oct 2023 17:20: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 SN1PEPF000252A3.mail.protection.outlook.com (10.167.242.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6907.20 via Frontend Transport; Wed, 18 Oct 2023 17:20: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.27; Wed, 18 Oct 2023 12:20:45 -0500 From: Robert Richter To: Davidlohr Bueso , Jonathan Cameron , Dave Jiang , "Alison Schofield" , Vishal Verma , Ira Weiny , Ben Widawsky , Dan Williams CC: , , Bjorn Helgaas , Terry Bowman , Robert Richter , Jonathan Cameron Subject: [PATCH v12 20/20] cxl/core/regs: Rework cxl_map_pmu_regs() to use map->dev for devm Date: Wed, 18 Oct 2023 19:17:13 +0200 Message-ID: <20231018171713.1883517-21-rrichter@amd.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20231018171713.1883517-1-rrichter@amd.com> References: <20231018171713.1883517-1-rrichter@amd.com> Precedence: bulk X-Mailing-List: linux-cxl@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN1PEPF000252A3:EE_|MW4PR12MB6801:EE_ X-MS-Office365-Filtering-Correlation-Id: c37b7886-d943-47ed-ddf6-08dbcffe9362 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: n4VbFb7QVSD/M5CFFraPyCgrovq80Mw1TaqD7dmjLRk0g69t4ilPQr7OzEbsuaMp7+8xbWKQQkMjVgpDjysFCQU4OE94oDAjt2xDLBLS0n9aOtU8kStwLn3XJicmUZpygmkXWNzxVBxzAZ2taE6OFOe/liT/brZxL38u/vmis3hvAAgcSr2tgT+ZQLiihzW3LmvEuOrnVVlmxkHye7GeFRcCYkR8catAOdBgR7rbu3P7j6DPrGKCOVtR1SbH1Usci+UcPn2YflHRZv0TOF5h/Kfh2eIpwXIk+ikU/BxfbU2fYxmJXTUNDVTyUpM5jb0BRYwTETP8GjsI1p9tNyNp2EcQRf4GtXbv9gXs9VdVuTfRMK1hjUqBRiFtuO/MpqvudsEnhB+XMrPv+3pvOWnralikJVkop/ehlc98Fr0fcL6FUUoIgPpHQPOkqEyg4iVCX8fH/qCOW9BumFV72DoVDO7BVD/DWCqQl3zgWy4rzL9tuc8XbAQpuy21qsmhSy0CMao0JsaLvJtAWvXfGaVT2mqAvxjIBIcVFxFAyoVm8QGzJ4xHdxncLTwAk76ctOC0ubSqxeTz6teHlgWAglvbi08AMW6Fh5k79ywZQgJoZwIpDpSXQkK15Y7+RTXQTj1/DY6YeNsLAGr9c1WLoX1UE5XRLqEFO/Q1dpugOXVhZDSoV8pZZLjI2yEKENXnyXw6f6zFpY93yyVpnPH7xaoy8rr/xD4QB56fpNVH7FxwGHMCtu/uVUbXZp+Mkn9LD1WFFLV6o6bDYnnLIX83Hv1Raw== 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:(13230031)(4636009)(396003)(346002)(136003)(39860400002)(376002)(230922051799003)(451199024)(64100799003)(82310400011)(1800799009)(186009)(46966006)(36840700001)(40470700004)(426003)(6666004)(41300700001)(2616005)(1076003)(2906002)(82740400003)(81166007)(36860700001)(40460700003)(40480700001)(70586007)(356005)(36756003)(83380400001)(7416002)(478600001)(16526019)(5660300002)(336012)(316002)(47076005)(8676002)(26005)(4326008)(110136005)(70206006)(8936002)(54906003)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Oct 2023 17:20:50.3804 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c37b7886-d943-47ed-ddf6-08dbcffe9362 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: SN1PEPF000252A3.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR12MB6801 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net struct cxl_register_map carries a @dev parameter for devm operations. Simplify the function interface to use that instead of a separate @dev argument. Signed-off-by: Terry Bowman Signed-off-by: Robert Richter Reviewed-by: Jonathan Cameron --- drivers/cxl/core/regs.c | 5 ++--- drivers/cxl/cxl.h | 3 +-- drivers/cxl/pci.c | 2 +- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/cxl/core/regs.c b/drivers/cxl/core/regs.c index cac28a656cb8..372786f80955 100644 --- a/drivers/cxl/core/regs.c +++ b/drivers/cxl/core/regs.c @@ -386,10 +386,9 @@ int cxl_count_regblock(struct pci_dev *pdev, enum cxl_regloc_type type) } EXPORT_SYMBOL_NS_GPL(cxl_count_regblock, CXL); -int cxl_map_pmu_regs(struct pci_dev *pdev, struct cxl_pmu_regs *regs, - struct cxl_register_map *map) +int cxl_map_pmu_regs(struct cxl_register_map *map, struct cxl_pmu_regs *regs) { - struct device *dev = &pdev->dev; + struct device *dev = map->host; resource_size_t phys_addr; phys_addr = map->resource; diff --git a/drivers/cxl/cxl.h b/drivers/cxl/cxl.h index 3b09286d9d52..378fc96ff7ff 100644 --- a/drivers/cxl/cxl.h +++ b/drivers/cxl/cxl.h @@ -286,8 +286,7 @@ int cxl_map_component_regs(const struct cxl_register_map *map, unsigned long map_mask); int cxl_map_device_regs(const struct cxl_register_map *map, struct cxl_device_regs *regs); -int cxl_map_pmu_regs(struct pci_dev *pdev, struct cxl_pmu_regs *regs, - struct cxl_register_map *map); +int cxl_map_pmu_regs(struct cxl_register_map *map, struct cxl_pmu_regs *regs); enum cxl_regloc_type; int cxl_count_regblock(struct pci_dev *pdev, enum cxl_regloc_type type); diff --git a/drivers/cxl/pci.c b/drivers/cxl/pci.c index 037792e941f2..fa94bc61af25 100644 --- a/drivers/cxl/pci.c +++ b/drivers/cxl/pci.c @@ -898,7 +898,7 @@ static int cxl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) break; } - rc = cxl_map_pmu_regs(pdev, &pmu_regs, &map); + rc = cxl_map_pmu_regs(&map, &pmu_regs); if (rc) { dev_dbg(&pdev->dev, "Could not map PMU regs\n"); break;