From patchwork Fri Oct 25 21:02:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Bowman, Terry" X-Patchwork-Id: 2002633 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=amd.com header.i=@amd.com header.a=rsa-sha256 header.s=selector1 header.b=H+zCpy1i; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2604:1380:45e3:2400::1; helo=sv.mirrors.kernel.org; envelope-from=linux-pci+bounces-15352-incoming=patchwork.ozlabs.org@vger.kernel.org; receiver=patchwork.ozlabs.org) Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [IPv6:2604:1380:45e3:2400::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4XZwJX1cq9z1xw0 for ; Sat, 26 Oct 2024 08:04:28 +1100 (AEDT) Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 47711284169 for ; Fri, 25 Oct 2024 21:04:26 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B6218213140; Fri, 25 Oct 2024 21:03:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="H+zCpy1i" X-Original-To: linux-pci@vger.kernel.org Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2051.outbound.protection.outlook.com [40.107.92.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7EFCA20EA55; Fri, 25 Oct 2024 21:03:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.92.51 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729890211; cv=fail; b=guA56N0qPq/tkmUFXtWnS8/t1uvvKQZvedDTyY6fD3qgSwkCHpNq9J3wMF9R6n626p6+aQN90V1uWUs2YJSHUYnyuycIfngLmh251utSDnVVPhoEiDeZPHflLfxKue7L4CdNDRe+Ww/yOe+xCfJl+O84+k1oZCx8B00hdXAa7/U= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729890211; c=relaxed/simple; bh=CzfXmIaE0cpdI4NO4JzPEKzraqK+NSd/DiOSUgLFjCA=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=LG21RiRx+mo9xaO/HYsB75uKIkB3WFtfUCIpEBHTVw7f6fLU2l3jAsz5i7lA+C9stEUEacTjJKghEwimiruEvBHl7s+e9WFICuzkMkkPtyVERfXFviQ1zSFf8+05XOSy+VUoYDw+QNxU72ctE71FWdNUxM/mHceTGJ490m8Voow= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=H+zCpy1i; arc=fail smtp.client-ip=40.107.92.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=vIDLQbs5wR8St4z96sl7CvzwXcfHdhf+JLKsqwTAulSniaJjGphqnLqGejRe9zJ1SSX706g8x2MoFmyjo6BVjCxDntnhRcJWjrNpEeF/rFFvt30RYHoHogd+0ahNE18K8CtznUZAL1JIksZBrAGDBn5o/JeDZJYTOUjQb/Wzqt6tKCDknQeEyt4GZPFLfK6kiV2BdFI5IEfsEjKp/iXCetAx9AgguaJsKlka8QXYD5zI6eJSNAUzysRNh/xozjuTEy8Rq5mJCj6XRzyQbVHj8lPeCWAXTOS1TyMBxBAzRG3h0LUnm9VxbFx9XPEJ6DcTlzTjn5+j4APIfXI0lRwZ2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=p4YPnP8xfTu4E3D4mZ0VQtiJJkSZl/mZ8f+jOzFr7jY=; b=rf/IZ9ZCmuaowpbjypfgCANOneZngLD5G+V4P80Hs/+dnl3r/j+OlyTVLV+gekIAqW9uJyx4B+dKmtS8SYPnM837CpM/SVT1V0tsG1pk90h2bjsLpuNyaMzzv+jNQK7YlgRMz4cy7iWBQTGtBtUt90FmMoQqOZGnXpHi8V2VWVKfT80I9uHFWwxEz1YGdxHTaX05RGM4zYnBZoYo8pupiocTiE8ykU8dcGZVsA1M4MofumuC4oOJgx7NJeooHThNXdcIlcoW1jWzbw5Wx4sCQCU6GTrIbM4vpiBhaxWEUT4egGnViTYBz70Aezy6EzIfPrS2fiVpRNODGYeeGbEzNg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=intel.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=p4YPnP8xfTu4E3D4mZ0VQtiJJkSZl/mZ8f+jOzFr7jY=; b=H+zCpy1iixAbMlzJPPc5zPMI9XHF27l/yXJH1WlinEcunlJJn7QGx3tNbWNTlLn9UJO7EN/s8kKDt4eRMCI3CTuQNSEi/78AGPV3Cl87FVOVtk8dNwFiLDvhR0Jq5ezp5ZrB6Z/5ez0epjhP15W26AwBMUuMnzo6nJdWH7Dfbc4= Received: from MW4PR04CA0287.namprd04.prod.outlook.com (2603:10b6:303:89::22) by DM4PR12MB7645.namprd12.prod.outlook.com (2603:10b6:8:107::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.21; Fri, 25 Oct 2024 21:03:23 +0000 Received: from CO1PEPF000044F7.namprd21.prod.outlook.com (2603:10b6:303:89:cafe::17) by MW4PR04CA0287.outlook.office365.com (2603:10b6:303:89::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.18 via Frontend Transport; Fri, 25 Oct 2024 21:03:23 +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 CO1PEPF000044F7.mail.protection.outlook.com (10.167.241.197) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8137.0 via Frontend Transport; Fri, 25 Oct 2024 21:03:22 +0000 Received: from ethanolx7ea3host.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Fri, 25 Oct 2024 16:03:21 -0500 From: Terry Bowman To: , , , , , , , , , , , , , , , , , , Subject: [PATCH v2 01/14] PCI/AER: Introduce 'struct cxl_err_handlers' and add to 'struct pci_driver' Date: Fri, 25 Oct 2024 16:02:52 -0500 Message-ID: <20241025210305.27499-2-terry.bowman@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241025210305.27499-1-terry.bowman@amd.com> References: <20241025210305.27499-1-terry.bowman@amd.com> Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1PEPF000044F7:EE_|DM4PR12MB7645:EE_ X-MS-Office365-Filtering-Correlation-Id: 205b2065-1b38-41f8-f38a-08dcf5387635 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|1800799024|36860700013|7416014|376014|921020; X-Microsoft-Antispam-Message-Info: Qchirn/nxDfcR2R0F8fsIkeDbGbCnK42QD0kleWt/iaQX0Y9d4ZItHVDOixA35TgkR4Oo2aL4Fbfqr0AYrssQ8Meaa4IdH/yjdt4KhQ8kC5nMmZvpHeXTerCI3P/4E46ZmGuZYX7IBPX2AG474QVGTKorZirOWfJfbuRfyX2o0gW7924L9ENid0GHIJrqFF4ykPWIP0hDlKZnXGBNkRP3/COyewcfG0LvIwQA7IjfngZIZfeztOjyC/eECZJZdjL35mCVtFvJV/6fLV9hTY10LL9aAetQoM7gYmQqiEviOttOuzx4cX2rdD40bcqpOh34EgAxLChNFWXGfHlEbgnxhvOwhTm94O/yIiDy8f091KXyGhK7PwUWFdMXNR0oD9gYLaLu2Cqggchaf5ULGebY3lkh0ZFxv/Yliu0IJKZt5H3AsPyVGsU+uGz7PyQnODBKUKiGMcGRS+BpHMKTayIp1bxIB8cY//pYk5My7z4eRUqM73/wNRdbUE6F2JSH/5zBI/2SIbWyM129U/oo0i9JoIvTp/0+wVr0packd9M2oZQE+x0EY8Dh/pc25FjXHmXE8vNZguYuPg5iMnZc2vVp10OkpXoy+cLxMYHRINGnSGrLTT/+jaZih32d/Js4i7V/x/AnCkiGfAcb4hHcGK2BuAwZfltF95ThPnQYQ0b/JXb57XS9XikBNT6q+ku1RKaXZvkF2LvrwMnZosICNay371QYcd5ptdVHd/NOmBzF0IXgF9dWL9BWltJRzZnE0MFo6FXyeevEVkVl6FkAi2VueqQ/MhUGbVuZIWBCwQvrxDZLqd463HPkFenXeysaTMGtOmQGZOTUB9l8nguPitT1Orq2aOMmHngeXfYoKhdn4cGqP4NhmA6vS5zchQCBfKz4DlNZup0x/ywuNHh0cz/z+ReD+A25EQf0uV6QF+LLliKDCw8Qt2M8LxiRdcTMURoRlHekg17I3Ic853ke6HvA2HzM0lvgA6hod3W7gM0ImOaXAzLEyRbx10EvYrWTbdJIm6g5YCjNz87cStALcORCDraOn3ue6PsrMU/Nn431wzrJLoIE7irE8hjq//d5t8pI5BWHj0W4H3XZO9mZz6fygLhkpV649P1InXzFeXm0d76qUm8+CZRZAxMCGF5f1CzflQu1oGpGDEFJVkYUE+DerhpZ8QoP7I7u07kcCFw9g4pnd3S2/RvGbK74JinVlEvbM/C6cJ/rmVR/lV35CSpWp+is8xuW2FH2yyWjiWOETTKBVAiTQvkAP+kztzHaLfRL/wOGZoFvtF1Ih3pb8TCeMgERhZ+tQa1s5/OgFHQGs+I6fnFwIeVmarXy7hgOFZRrm4eKqfXeCu7QV2+jNSCJCms3IEO4i+uArAwh0eAyL215jaWCq3h0DJRJXiWMB/O X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(82310400026)(1800799024)(36860700013)(7416014)(376014)(921020);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Oct 2024 21:03:22.8113 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 205b2065-1b38-41f8-f38a-08dcf5387635 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: CO1PEPF000044F7.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB7645 CXL.io provides PCIe like protocol error implementation, but CXL.io and PCIe have different handling requirements. The PCIe AER service driver may attempt recovering PCIe devices with uncorrectable errors while recovery is not used for CXL.io. Recovery is not used in the CXL.io recovery because of the potential for corruption on what can be system memory. Create pci_driver::cxl_err_handlers similar to pci_driver::error_handler. Create handlers for correctable and uncorrectable CXL.io error handling. The CXL error handlers will be used in future patches adding CXL PCIe port protocol error handling. Signed-off-by: Terry Bowman Reviewed-by: Jonathan Cameron Reviewed-by: Dave Jiang Reviewed-by: Fan Ni --- include/linux/pci.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/include/linux/pci.h b/include/linux/pci.h index 573b4c4c2be6..106ac83e3a7b 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -886,6 +886,14 @@ struct pci_error_handlers { void (*cor_error_detected)(struct pci_dev *dev); }; +/* CXL bus error event callbacks */ +struct cxl_error_handlers { + /* CXL bus error detected on this device */ + bool (*error_detected)(struct pci_dev *dev); + + /* Allow device driver to record more details of a correctable error */ + void (*cor_error_detected)(struct pci_dev *dev); +}; struct module; @@ -956,6 +964,7 @@ struct pci_driver { int (*sriov_set_msix_vec_count)(struct pci_dev *vf, int msix_vec_count); /* On PF */ u32 (*sriov_get_vf_total_msix)(struct pci_dev *pf); const struct pci_error_handlers *err_handler; + const struct cxl_error_handlers *cxl_err_handler; const struct attribute_group **groups; const struct attribute_group **dev_groups; struct device_driver driver; From patchwork Fri Oct 25 21:02:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Bowman, Terry" X-Patchwork-Id: 2002634 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=amd.com header.i=@amd.com header.a=rsa-sha256 header.s=selector1 header.b=BccFQ+Nw; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2604:1380:45e3:2400::1; helo=sv.mirrors.kernel.org; envelope-from=linux-pci+bounces-15353-incoming=patchwork.ozlabs.org@vger.kernel.org; receiver=patchwork.ozlabs.org) Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [IPv6:2604:1380:45e3:2400::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4XZwJr6x08z1xw0 for ; Sat, 26 Oct 2024 08:04:44 +1100 (AEDT) Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 33123283D20 for ; Fri, 25 Oct 2024 21:04:43 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0C1A120A5D0; Fri, 25 Oct 2024 21:03:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="BccFQ+Nw" X-Original-To: linux-pci@vger.kernel.org Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2055.outbound.protection.outlook.com [40.107.243.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D5412213151; Fri, 25 Oct 2024 21:03:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.243.55 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729890219; cv=fail; b=VR0N0uoX3VuLxF8BSfoqRhPx/8U/ROcHy+YFad+JdtB7Tfz43Eu/ePkJHVHKAOaYQLeglNVND/eXqAB9fZ1AQHt9h+VNnmuVUcEtI+lmwy7jOlcRj+DJyreNNQLOjoluGjeCmnOCrl+JZFJ6p8LBKnImi+8ugFXsPAkH91v0QW8= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729890219; c=relaxed/simple; bh=ZRjSPgJaRj8iM0kkHzcemktnD0wdGXJbBRFDp+JAWac=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=UCMzevSbN0LR3kWJd3ZbJHI1DFrdEJr+1Kp7PBo2Bv/SHZVn4s4oQKjp7Z6LqFUQHl+9Oi79+SB5DwCljrn067n4/3ZzIuBqskH0IRJ5B5+stai5WEJFK3S4j5dNWwcIeD/JOrhcQJI2PfkYoIOZJ1Nb0lDL1zpY0LN1aJmOwME= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=BccFQ+Nw; arc=fail smtp.client-ip=40.107.243.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=HiVR1Rw5zqZCp5L2OkaqSJeBQ/C1636EuahpJu04Mgpl4bap+xEAkTSO8llg6rbJQsvs4SQwLzytaE9ZEAC14tO9r6UjNlQJ6oF8QaLfJ5elANee+PiFXf0NC9JBO/qHpq71osTcrYtsjRk/jtLVkbaWSTBuMBPYsMTJl8QtTJU6MNFHg4GDnrZlMf0H5f982Be5vmHSi8uz2RU4e/GC65F+xA6nCYaueupR0jk6rKhYZy32io2k0JLR51KvlioZyRpz98ixYjfElQapHEjBhlfM/rBl2xlmY9SvqpxUmXQGXRF4Gv0aW63Kn2k5qKPcIERKhuthtqkB5E48FVBkvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=f979xuoLj14M6SqZv/ifTTpYtrTRQNtZxsdcLjh7Pgc=; b=c4vNST/sxxTX4z1szsfVdzkAupfbIzA4zxMuR6Z5suVFclveS0cF8tpPTqJ8rCkhMHSr4605npnVey5XFU12U8NWWTinPu5ZaABzuQHPK2OXIN1b9Mjn2b8Q9ylvR++FuaHcidcbdevoAcBPfSNIM0QCNmP5b2IzLCget2AaZNJrFGzwtXb5k8X/LId5iq9DMhxpcGmbySUFbQXaReEqN8zHF/sspi4tRMs6i2rfC21Mn/JGrJXHNFEYMwNNsiVoZfv/R4LsSimzAKRIb+Osu2iecjnt7AQFi6qGFd3HNphZ5Blw+Z5gPENxBOGWvTP7+WxibNXa6D/wrA+aM3ywhQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=intel.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=f979xuoLj14M6SqZv/ifTTpYtrTRQNtZxsdcLjh7Pgc=; b=BccFQ+Nw9WRl8AdnHy1PBQcAogGmeXS5on6mCTlajscaAbhCsf+a6bOUBkWbkNbWD/mMGeluuYw5P0uPBChxFVsyc2g4Bes2Khw49CxXj2eSP7UfgFp4lbZL/uPcAE5Vs3b4MZa2kwxqH/JzAVGGJ+qS/u/5QxrcqgkSaMRBI/k= Received: from MW4P223CA0029.NAMP223.PROD.OUTLOOK.COM (2603:10b6:303:80::34) by IA0PR12MB7650.namprd12.prod.outlook.com (2603:10b6:208:436::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.19; Fri, 25 Oct 2024 21:03:34 +0000 Received: from CO1PEPF000044FD.namprd21.prod.outlook.com (2603:10b6:303:80:cafe::8d) by MW4P223CA0029.outlook.office365.com (2603:10b6:303:80::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.18 via Frontend Transport; Fri, 25 Oct 2024 21:03:34 +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 CO1PEPF000044FD.mail.protection.outlook.com (10.167.241.203) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8137.0 via Frontend Transport; Fri, 25 Oct 2024 21:03:33 +0000 Received: from ethanolx7ea3host.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Fri, 25 Oct 2024 16:03:32 -0500 From: Terry Bowman To: , , , , , , , , , , , , , , , , , , Subject: [PATCH v2 02/14] PCI/AER: Rename AER driver's interfaces to also indicate CXL PCIe port support Date: Fri, 25 Oct 2024 16:02:53 -0500 Message-ID: <20241025210305.27499-3-terry.bowman@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241025210305.27499-1-terry.bowman@amd.com> References: <20241025210305.27499-1-terry.bowman@amd.com> Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1PEPF000044FD:EE_|IA0PR12MB7650:EE_ X-MS-Office365-Filtering-Correlation-Id: 7b013aa2-16b4-4eed-e49b-08dcf5387cdc X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|1800799024|376014|36860700013|7416014|921020; X-Microsoft-Antispam-Message-Info: sC4UbLSEZ0+A2kbIcgZ+KGKhGncAi0E5Z5zIbLMTLOQKH33NhBmEJSDOhLihVT96uQesz6VQIXcoDsV3kip26m8YyjnSjQgnBZePSExNginrMg3KECe10cXu4XJNaI3WBuedg6A4nnt/3sJDgf3eOzMx0KYgYIJHYQH6wbQwvebA3c4p6/kzPFGssseh1mmUXPo+R9LYZLasZ/iHLZe9QeYsg4Ktw57XpTC6L0LS0gLDBSiSMwb9g8S/yQZ6JvNQjWi237FjaZ+8F2DVwNfPdE96k+a0B0j0NTXTFYQO73RXvUutLbPQ6JL0ILAwu0Q0E/K21tu0+W73rX06A70BRjq5yNnBI6eH7EF3qi3okLKn/5mY9zdjb9FcC3q6e3oK8R4PAxl0MfHYIfGEBUMao/8PC2NTV5NrkFZD5OS46/F9U9SDroo1QKoq3LIsVOB6stx7k/s/JujqTB7Ux9AUBHCUEXNLq0OlOuw2h/KH+RVE+7lQkPlmMKKYgWIyPDbArmsrgzo+DmlFEGoYqyEhbl2AjbHEbtfBehI7DlfZM0qwVhYLs539EBX57mDZWRtMs/8BbIgDtliKZXvaUtRhYzAWaXg8Osyg4uOCx0eWsbc84zDPFGQhhqc3WHHnbmrN/Omy9u83/JRWhBICR2hMAJvDGpGfZd0mqYMq6Xm3Yce12Yzu2E8JEQ0kby9BrMqwh377DtQjmX1s9TQeEx9QTedeK7q+9USpMlbSGuY4O6LQuMCk4or6MEdFwzTxqnm8qseUYdiVvceTZojXknpaRG+fiB4ZLW6NUhZzm4AHLoLawsX8Vdq+uJmd1h7/baMK/xjlthC2reaOLrdw5+OaNdjg2Q79HgQaZRk8sR7QCQEqWwNghCzjc7EX0Psb5m27VgczpYNIKjLCSric0pGwM0+SsmkSZNGlhUwopUguoc4P7h5cO7DdnLOxwuyXIGr2aQtj6jCkTB5y7O/irQKMiq0cS7k5oqAW0WGxi71kdbuU08Ks5Ce2Ool2wN/ru0XGe8O5ZhAy1x8kBPx5yqRCaz+POUI5k6dllunroDUpLsG4JAdSsNpM4oIoSnlc2Di5Sok4qyyM16ztTym9Rll34t7JXBRRMx+pJK4rSYajpBMF7rZXfSofPxyWZaxd5LC0xlogQBjlHFUSvyo4RzzHDFWt0Cdios9wBTP0EiOpweuPrKzcWJ/JZxCfq1E+naDMpXnkGPXvj0421rFds2bFXWVAwBMI74WXMMJ68aXdU5m50oa6AoijOAVylhSKoVEtArslnHoB4da8qKVX7vW/dmtdPKb3PenRvXgsmoIPl3hVVrcyZs0iiqtxumoDP+A4PICidm/XOYry4Afzq76k2OS1FdkYMLiUiLKzgacgEIsvnGkHs/lNC+DlxAxI/+p5 X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(82310400026)(1800799024)(376014)(36860700013)(7416014)(921020);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Oct 2024 21:03:33.9873 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7b013aa2-16b4-4eed-e49b-08dcf5387cdc 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: CO1PEPF000044FD.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA0PR12MB7650 The AER service driver already includes support for CXL restricted host (RCH) downstream port error handling. The current implementation is based on CXL1.1 using a root complex event collector. Rename function interfaces and parameters where necessary to include virtual hierarchy (VH) mode CXL PCIe port error handling alongside the RCH handling.[1] The CXL PCIe port error handling will be added in a future patch. Limit changes to renaming variable and function names. No functional changes are added. [1] CXL 3.1 Spec, 9.12.2 CXL Virtual Hierarchy Signed-off-by: Terry Bowman Reviewed-by: Jonathan Cameron Reviewed-by: Dave Jiang Reviewed-by: Fan Ni --- drivers/pci/pcie/aer.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/drivers/pci/pcie/aer.c b/drivers/pci/pcie/aer.c index 13b8586924ea..fe6edf26279e 100644 --- a/drivers/pci/pcie/aer.c +++ b/drivers/pci/pcie/aer.c @@ -1029,7 +1029,7 @@ static int cxl_rch_handle_error_iter(struct pci_dev *dev, void *data) return 0; } -static void cxl_rch_handle_error(struct pci_dev *dev, struct aer_err_info *info) +static void cxl_handle_error(struct pci_dev *dev, struct aer_err_info *info) { /* * Internal errors of an RCEC indicate an AER error in an @@ -1052,30 +1052,30 @@ static int handles_cxl_error_iter(struct pci_dev *dev, void *data) return *handles_cxl; } -static bool handles_cxl_errors(struct pci_dev *rcec) +static bool handles_cxl_errors(struct pci_dev *dev) { 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); + if (pci_pcie_type(dev) == PCI_EXP_TYPE_RC_EC && + pcie_aer_is_native(dev)) + pcie_walk_rcec(dev, handles_cxl_error_iter, &handles_cxl); return handles_cxl; } -static void cxl_rch_enable_rcec(struct pci_dev *rcec) +static void cxl_enable_internal_errors(struct pci_dev *dev) { - if (!handles_cxl_errors(rcec)) + if (!handles_cxl_errors(dev)) return; - pci_aer_unmask_internal_errors(rcec); - pci_info(rcec, "CXL: Internal errors unmasked"); + pci_aer_unmask_internal_errors(dev); + pci_info(dev, "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) { } +static inline void cxl_enable_internal_errors(struct pci_dev *dev) { } +static inline void cxl_handle_error(struct pci_dev *dev, + struct aer_err_info *info) { } #endif /** @@ -1113,7 +1113,7 @@ static void pci_aer_handle_error(struct pci_dev *dev, struct aer_err_info *info) static void handle_error_source(struct pci_dev *dev, struct aer_err_info *info) { - cxl_rch_handle_error(dev, info); + cxl_handle_error(dev, info); pci_aer_handle_error(dev, info); pci_dev_put(dev); } @@ -1491,7 +1491,7 @@ static int aer_probe(struct pcie_device *dev) return status; } - cxl_rch_enable_rcec(port); + cxl_enable_internal_errors(port); aer_enable_rootport(rpc); pci_info(port, "enabled with IRQ %d\n", dev->irq); return 0; From patchwork Fri Oct 25 21:02:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Bowman, Terry" X-Patchwork-Id: 2002635 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=amd.com header.i=@amd.com header.a=rsa-sha256 header.s=selector1 header.b=k+ipOPNJ; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2604:1380:45e3:2400::1; helo=sv.mirrors.kernel.org; envelope-from=linux-pci+bounces-15354-incoming=patchwork.ozlabs.org@vger.kernel.org; receiver=patchwork.ozlabs.org) Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [IPv6:2604:1380:45e3:2400::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4XZwKB4pJ4z1xw0 for ; Sat, 26 Oct 2024 08:05:02 +1100 (AEDT) Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 13763284034 for ; Fri, 25 Oct 2024 21:05:01 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7017416088F; Fri, 25 Oct 2024 21:03:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="k+ipOPNJ" X-Original-To: linux-pci@vger.kernel.org Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2075.outbound.protection.outlook.com [40.107.93.75]) (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 28EFC17DFEC; Fri, 25 Oct 2024 21:03:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.93.75 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729890230; cv=fail; b=rzcazdqU5uflyK08XaI8pzfdPVnHiH4d76RVkXsvKai1C/oyupVph44i7iVl/sRUQzL4cnammrP9rBq2Avo9XW0zKm9ow/DlLnzBzeeKZQcgO5/y6ddQ/XFLXClKp7CGMm8mLzlQXx+sc2b2qBJqMxnA1SUuJ9D1DTDZ/XguMCk= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729890230; c=relaxed/simple; bh=6SmHFiEnGJpwhleO/GSxIknsXKe7BSXr2Jq4Y1MbXwA=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=OCePNH/zaRXKOvhBhS1RMoVMnpfZ8l5tWfIi9ArhmcmPH7sRYedXCMZQlVlLxJUifjyD9xkegBA0gxwGFAj4OabJjMakouL9sdu3UCXiNyBC7n7Ry2UmQeqp017F/5KQEB6oUtgSiUxpqWEW258yby/VUamQHrKSk5hHRJzbySQ= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=k+ipOPNJ; arc=fail smtp.client-ip=40.107.93.75 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=eSFQ/Z1G1yb+GESLd9ozEMITd5QQl9jZ8uGlGvhUsU/unGeVyTKPmgCnrtu89gZSTqf8tseiwKTh5TDKGnxnsUzKj64noK9Q3ETpiwaBzonjES0PtVoYoeUrR2CT6qP0+SduTunszWYyWLNdMSI1C+Vn1Kj1XYXPa3HV28V1dqQZnpveD06XU18Wtd5l/jCdkWml+9w0P75GL6vE1He3mKg9SZH+qWDemSq9PutAy19lSYeD8Bnq1yG02143uFwTSpdN9S+mxZAcIVSoZ9S7Ya6ibcHl8kEI4PYgBjpRW0YCxKnEa0aEqDWgJ/8aSTNOhYBzh2wA3PnWQXYiqFRHkA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=jDMr4++BpJAskl3YHWn3w1d3P7iZuJBTX0LiUw21bYw=; b=URyV9IKW4op0ua4G4w9Mp3078sUXDcmfcpqCm/FM54tVzPj/n93hrFh3Jj8l4ivP3nNDrP09TaiXju9444e3VimHKOx2pgn5cLvuNm8eGYO5X9+drHE4qT73ldkOJLGpz7btB3y+xO8up6KUZXA/P5gSDKN4378tfFkNZVSWvDOWzvJLGszbkh3PhhO/nQSvtRAMmo+Tn7MEPOJ0+5gW00fAzMFzNnpESjGr2+h2nY/nsUmQ1YsLcBZloYBoUqeIvPXLyrGZmMZ8+knlVWerlbK48HRzTa/JVs3jRTlWmV4U2/kWUmLB2eJyM/0t9+hJIsI8MXWxy7zC/2Ss52vqDg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=intel.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=jDMr4++BpJAskl3YHWn3w1d3P7iZuJBTX0LiUw21bYw=; b=k+ipOPNJy8MunjTx5QePsnHSNkinzwflM049ztcTZBWtq550bDo89is3f6Ul7uD2b+1zrgHcQpaYbzy+sHVZtTO9h9f2gddM8neDNvN9j3K5RBWt7zjUc8kqiS3t7DrD6hDIA0GMRVBLNxrXQCzjFwuIRottkoWiAqzUS56XakQ= Received: from MW4PR04CA0192.namprd04.prod.outlook.com (2603:10b6:303:86::17) by SJ2PR12MB9087.namprd12.prod.outlook.com (2603:10b6:a03:562::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.20; Fri, 25 Oct 2024 21:03:45 +0000 Received: from CO1PEPF000044FC.namprd21.prod.outlook.com (2603:10b6:303:86:cafe::2d) by MW4PR04CA0192.outlook.office365.com (2603:10b6:303:86::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.18 via Frontend Transport; Fri, 25 Oct 2024 21:03:45 +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 CO1PEPF000044FC.mail.protection.outlook.com (10.167.241.202) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8137.0 via Frontend Transport; Fri, 25 Oct 2024 21:03:44 +0000 Received: from ethanolx7ea3host.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Fri, 25 Oct 2024 16:03:43 -0500 From: Terry Bowman To: , , , , , , , , , , , , , , , , , , Subject: [PATCH v2 03/14] cxl/pci: Introduce helper functions pcie_is_cxl() and pcie_is_cxl_port() Date: Fri, 25 Oct 2024 16:02:54 -0500 Message-ID: <20241025210305.27499-4-terry.bowman@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241025210305.27499-1-terry.bowman@amd.com> References: <20241025210305.27499-1-terry.bowman@amd.com> Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1PEPF000044FC:EE_|SJ2PR12MB9087:EE_ X-MS-Office365-Filtering-Correlation-Id: 57500060-5194-4f1d-92be-08dcf538835e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|7416014|36860700013|82310400026|1800799024|921020; X-Microsoft-Antispam-Message-Info: 7eFhs5wpHCv0V1Iqr9r95T9QtIaKCj+wB1W7m0lM5KGAAklFGRFBGNUvbEPSSkWrWyVJmDrX8+4BvKwAmQwMxejYmwegtzKiq8YL6Trd0PlXpteIa0t4N8J0Rcr+fMJVK0pZ2Fues6TCS3a2R7L7fx6sZ5KfPQq3PjQ5MZmB2LsVmp8Dp0K+YjHuzloJnN5umvV5KsbCLBwGjTTMdrS3an5Lqjn/ITUVr896QY6RRzVmH6YSLqub86I564fttmIenL6Um1WLU6dyw6PRuXbIo5rv4cIDk8eChtX5e0DAixd7j3SLK+BZWQiyIwLfxxcRPPMK5QD0uSW4dVsaTuZ4IGZXWJLtBIxnYM0cN9PJ1dr0/c5cTiLrXAeF/dAO1S3igejjBYZ+lXqx0ctiTPWCEfD0vi2bnMTsUN32hG0HvQn63fZHSuNlLDF6M4kuaazwgfeIShvjPqLDb8P0B0tHsn1u21P6lZ3CNDy7Gj6k0aEijOsNqACfu+lJgSeBsX/8bWZaivjibBqQt9Bqgy8AKRq5h3sEM89ABx8+rFIJMOHjSnp5pmlpNvEe1R7/+uZb3SLo8zQuN//tVwlrZdR7l4WCqOrgsu7zyYatC/23MNo0a3Yc/bU5jVWp4wSIqzoTdLD5+wi3f591Xvu9QcX8DKHcjazoJcLLgHNpxsPAOhlyQekrhNhL/jMubI9rswvh+qX4FYHhAhsJUfJwj6kOr6lvsaEGbUmQ0Fykl3TrqOLA/0Vt9o+ugdhZwLNUqAeQqzkzpkvX/hnGa+pyStibRit+cAP6ZozW5l+vaqEUB2ftSACDCYcl9Bd2xhOgWh/JaEdczjwYgZSyEhfJq+4PLphw/JNAXOKf5G8mbRZ3AJSY/AGDuAv5R5xTxZw6V4otUFBhVEU5jQ+XVqVA9JVQfQ8pz7nouYGpx32BONGqHXLs0glAiG+mL7b/K2S72YQPOWApOQeS+kbZJEoit4mOpEaDGI/w8eKCivBxwIjcDK/JMloItc6pXhR6ajg1anf8I8c95G7pimfYvBNxfFf1lXhYOE3ZwAsIfyBEjOgbkjEGH1zh5eyKJzrn4YtbLgfqYP9n6OgCtJEbmxDJfH5T9+wwoMrnzjVjC9D6V+PsDpCUkTX7Ggm8OfxFcOpCP1HvLAt55bcvkqA6W34E/2zXGkXFkbvLtnXPANu5ON5VvTyDdZM7tkUMhCoL616dihOEFI0Zn1S8ZAEApyrfN+8D8Samko9FQOkpLB0InQrDvioZ9QuPye5la5zKxxFhON7ERuFkeE3UxWzMvBtPE/2ecJgav0JMw1J/LRN1/jzm+HJUoWpoQFxS9jaDRkicsGicj5ESadxcSbUjlWicQulreaH7nXaR/t304U7/NoiFKzBiWxmsgvStFtS3/9FpISXX X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(376014)(7416014)(36860700013)(82310400026)(1800799024)(921020);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Oct 2024 21:03:44.8879 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 57500060-5194-4f1d-92be-08dcf538835e 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: CO1PEPF000044FC.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR12MB9087 CXL and AER drivers need the ability to identify CXL devices and CXL port devices. First, add set_pcie_cxl() with logic checking for CXL Flexbus DVSEC presence. The CXL Flexbus DVSEC presence is used because it is required for all the CXL PCIe devices.[1] Add boolean 'struct pci_dev::is_cxl' with the purpose to cache the CXL Flexbus presence. Add pcie_is_cxl() as a macro to return 'struct pci_dev::is_cxl', Add pcie_is_cxl_port() to check if a device is a CXL root port, CXL upstream switch port, or CXL downstream switch port. Also, verify the CXL extensions DVSEC for port is present.[1] [1] CXL 3.1 Spec, 8.1.1 PCIe Designated Vendor-Specific Extended Capability (DVSEC) ID Assignment, Table 8-2 Signed-off-by: Terry Bowman Reviewed-by: Jonathan Cameron Reviewed-by: Dave Jiang Reviewed-by: Fan Ni --- drivers/pci/pci.c | 14 ++++++++++++++ drivers/pci/probe.c | 10 ++++++++++ include/linux/pci.h | 4 ++++ include/uapi/linux/pci_regs.h | 3 ++- 4 files changed, 30 insertions(+), 1 deletion(-) diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 7d85c04fbba2..c1b243aec61c 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -5034,6 +5034,20 @@ static u16 cxl_port_dvsec(struct pci_dev *dev) PCI_DVSEC_CXL_PORT); } +bool pcie_is_cxl_port(struct pci_dev *dev) +{ + if (!pcie_is_cxl(dev)) + return false; + + if ((pci_pcie_type(dev) != PCI_EXP_TYPE_ROOT_PORT) && + (pci_pcie_type(dev) != PCI_EXP_TYPE_UPSTREAM) && + (pci_pcie_type(dev) != PCI_EXP_TYPE_DOWNSTREAM)) + return false; + + return cxl_port_dvsec(dev); +} +EXPORT_SYMBOL_GPL(pcie_is_cxl_port); + static bool cxl_sbr_masked(struct pci_dev *dev) { u16 dvsec, reg; diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index 4f68414c3086..9324eb345f11 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c @@ -1631,6 +1631,14 @@ static void set_pcie_thunderbolt(struct pci_dev *dev) dev->is_thunderbolt = 1; } +static void set_pcie_cxl(struct pci_dev *dev) +{ + u16 dvsec = pci_find_dvsec_capability(dev, PCI_VENDOR_ID_CXL, + PCI_DVSEC_CXL_FLEXBUS); + if (dvsec) + dev->is_cxl = 1; +} + static void set_pcie_untrusted(struct pci_dev *dev) { struct pci_dev *parent; @@ -1945,6 +1953,8 @@ int pci_setup_device(struct pci_dev *dev) /* Need to have dev->cfg_size ready */ set_pcie_thunderbolt(dev); + set_pcie_cxl(dev); + set_pcie_untrusted(dev); /* "Unknown power state" */ diff --git a/include/linux/pci.h b/include/linux/pci.h index 106ac83e3a7b..d3b1af9fb273 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -443,6 +443,7 @@ struct pci_dev { unsigned int is_hotplug_bridge:1; unsigned int shpc_managed:1; /* SHPC owned by shpchp */ unsigned int is_thunderbolt:1; /* Thunderbolt controller */ + unsigned int is_cxl:1; /* CXL alternate protocol */ /* * Devices marked being untrusted are the ones that can potentially * execute DMA attacks and similar. They are typically connected @@ -743,6 +744,9 @@ static inline bool pci_is_vga(struct pci_dev *pdev) return false; } +#define pcie_is_cxl(dev) (dev->is_cxl) +bool pcie_is_cxl_port(struct pci_dev *dev); + #define for_each_pci_bridge(dev, bus) \ list_for_each_entry(dev, &bus->devices, bus_list) \ if (!pci_is_bridge(dev)) {} else diff --git a/include/uapi/linux/pci_regs.h b/include/uapi/linux/pci_regs.h index 12323b3334a9..5df6c74963c5 100644 --- a/include/uapi/linux/pci_regs.h +++ b/include/uapi/linux/pci_regs.h @@ -1186,9 +1186,10 @@ #define PCI_DOE_DATA_OBJECT_DISC_RSP_3_PROTOCOL 0x00ff0000 #define PCI_DOE_DATA_OBJECT_DISC_RSP_3_NEXT_INDEX 0xff000000 -/* Compute Express Link (CXL r3.1, sec 8.1.5) */ +/* Compute Express Link (CXL r3.1, sec 8.1) */ #define PCI_DVSEC_CXL_PORT 3 #define PCI_DVSEC_CXL_PORT_CTL 0x0c #define PCI_DVSEC_CXL_PORT_CTL_UNMASK_SBR 0x00000001 +#define PCI_DVSEC_CXL_FLEXBUS 7 #endif /* LINUX_PCI_REGS_H */ From patchwork Fri Oct 25 21:02:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Bowman, Terry" X-Patchwork-Id: 2002636 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=amd.com header.i=@amd.com header.a=rsa-sha256 header.s=selector1 header.b=1C+RKVvN; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=147.75.48.161; helo=sy.mirrors.kernel.org; envelope-from=linux-pci+bounces-15355-incoming=patchwork.ozlabs.org@vger.kernel.org; receiver=patchwork.ozlabs.org) Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org [147.75.48.161]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4XZwKW2dfnz1xwN for ; Sat, 26 Oct 2024 08:05:19 +1100 (AEDT) Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id A88E3B20CE1 for ; Fri, 25 Oct 2024 21:05:18 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B772C1FF04A; Fri, 25 Oct 2024 21:04:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="1C+RKVvN" X-Original-To: linux-pci@vger.kernel.org Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2064.outbound.protection.outlook.com [40.107.220.64]) (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 820A517B4E2; Fri, 25 Oct 2024 21:03:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.220.64 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729890241; cv=fail; b=GO8MNvwr80AiCsFjr+zt+07zwCebUaRQD6q5qmuCz3p7PTNuFbrVJXfOTiancVhWwQHcttb+wToedXax5S99zjyR1LLxxwkJYQ1e3GPLNG0GWH5JLLaCACiCq1jk1o2UPNvfEzDRuvpP0sTOqlNq2PRg8wddyvz61tF/vZR0DfI= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729890241; c=relaxed/simple; bh=nrFfd+HiD6Cm4JfvDVKJZ+FZXMnIS3ckYJOdL5s8zck=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=o4LBZldsK2bhUr1juPOY5Kf8imsNX1m2kYxNaFIPKb0KS90KjH5hxVZyu/YVIusZZKqmzcIJ17XAeSkPBn90lugYOh+L8P/yf1nNCKqAqH4uapAkNfxrgfbplLLb/Bz4XDRhCKi0RBrfGJWXV23DAT9AMskiRbgskiPuaF2vfA8= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=1C+RKVvN; arc=fail smtp.client-ip=40.107.220.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=vISGJ87Jg7mak9wjbOjWltt9r0eCfWwg07SBVaRH2d5u4rp1Novshph2c4RLEheJV7JXRBGpZWy2WDcVK18fL/mo+TBOW5K1sKKj+Lg+UAkpDUGLWdBpiChQ47J5lGHzuu8wP0+2oIUMIv1hPbcKwrCX8/Qyh+fNRZTGfnIcn3s2JztdJduD2YhapTZxBSICfrcYFYqlrKE2jMp7wxFTd3vYDfmkZozBXOOBXj0FdWi6K6heHZitg+N5BBtDY8K0fu1FxNwqSFuglZqyaSFEbOLylonXd+CjMsQcJrQiBGbPlttuCbIyRGx6s3OM0IyeFInMvK6NdLScfJTxGyTa3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=4/Mm9/AHwA6oFbwvuuIcPE+b34Z7Bpr+IbqMYM3pOzY=; b=R7r+2wov+ZXFv6IDxfD5Q4UYsNCOOCLzS2LfmOQFsbpXj/5Io+eJRsnGT6IkrRZV98cv8IgWlWYqQ3Q9obt3XrQAVsYLBgqnF6PSrZY1vT9dHo3OK4SJ5cvTXkgXW6z2i7TkmvgwyzcAiRWPgobBOp6cxsKhWPzjtO9Hta7DZj7AaIQLpccnkQVyeRhSolkzOQtlayeHJFbIhFmKnM1SuXQ2KJ4Nmm/mNM37iA2VpAeTR1Mv3SIzCwnjnI54vPQsNGsRHcok+q0Ge+DXlFiTn219S6iuURNbVUaVUBvimDfmbsRZX3U4SG82i0YI9G4qx8pJNfsFrKFEJBJevhmEOg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=intel.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=4/Mm9/AHwA6oFbwvuuIcPE+b34Z7Bpr+IbqMYM3pOzY=; b=1C+RKVvNkxcvw9ccl3e6tAF5odgtZWoe0nryItCeeBCypRLD3igaTQ+oVbFEcuJqXgroXoYlxs2W9H5XuMvFa+CplftxEK9phyTLHvvgBc7qrRsdtJoTE5Gp1DP57hFOrEcybRmiyirvjzvzVXVE9FmkM/idVkejfzhkLkkhMbs= Received: from SJ0PR05CA0112.namprd05.prod.outlook.com (2603:10b6:a03:334::27) by CYYPR12MB8656.namprd12.prod.outlook.com (2603:10b6:930:c3::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.17; Fri, 25 Oct 2024 21:03:56 +0000 Received: from CO1PEPF000044FB.namprd21.prod.outlook.com (2603:10b6:a03:334:cafe::75) by SJ0PR05CA0112.outlook.office365.com (2603:10b6:a03:334::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.5 via Frontend Transport; Fri, 25 Oct 2024 21:03: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 CO1PEPF000044FB.mail.protection.outlook.com (10.167.241.201) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8137.0 via Frontend Transport; Fri, 25 Oct 2024 21:03:55 +0000 Received: from ethanolx7ea3host.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Fri, 25 Oct 2024 16:03:54 -0500 From: Terry Bowman To: , , , , , , , , , , , , , , , , , , Subject: [PATCH v2 04/14] PCI/AER: Modify AER driver logging to report CXL or PCIe bus error type Date: Fri, 25 Oct 2024 16:02:55 -0500 Message-ID: <20241025210305.27499-5-terry.bowman@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241025210305.27499-1-terry.bowman@amd.com> References: <20241025210305.27499-1-terry.bowman@amd.com> Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1PEPF000044FB:EE_|CYYPR12MB8656:EE_ X-MS-Office365-Filtering-Correlation-Id: 7d177634-f314-4e7c-0da0-08dcf53889f1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|7416014|36860700013|1800799024|82310400026|921020; X-Microsoft-Antispam-Message-Info: eYXcCyCrqC9gZmTi1F9zHFNukoXGBAmCXP4wn/amrWUzgE225s7utaEjP10Mw1g/jIOB26m5y3yAyXI6doK65L8zpVwqXCkQegRRR2gYbR+Bl+cSFfYDNsxbPOSNZnLMFwgdeAjhsc+EOEWSVi7/j7CKLITn3xwN7rMfsdxvQyFQgURgLHUCZ99Qn8nT4Bt0LOOfTqpDk+SWKJWwFH7yFAzcihJ7qvoLL5bkGtqzD8A5zDggpcvrq35K1PsCAo03qS5BAJH6ZgLXQQlG9FWssbdSweOxcL7ytBrp8h5NcuGStbQuh7FQpXP6545I7SgTzzF77MvHm4ft4L1KjgAvZMuqcuVRxBgjTQJWYy5U3p+9HWLIf2nv5B+CJ0MIYyDQZGjBqrKn9lMiSZZ+C0QSCURoceMiQhfTxgmgLERk9ETvGVy6D70jq9/kDF+YdiBLLWEURNC66EJzZfXMwMidK5O39NNe3qh/i6GTTwW+lnVKUwByWRERlZN7E7Iq1mVLtcpxEKtcgu0EpbeNOjsHtENum+ZUvq+c4U772BX7TdrFdb/FN+Zw+BynvOziNKdD8jikzL/LO6yA2is+CXfHgdAzFQWsgp9dGOrPzcFgEg6WRAeAlFKHberF2gAB9r/Cbl2z7E3eqPak93eKclAIFDvJ6ojKiz2+qWM+dyoGG4mm0UmHWx9I3itnVCI+TYi8f48fgLJuKCQE7f+PPUcaqlIiKA9zfseVzzk2+ZsNPBEF3DQJxTibohN9sAsonqID7gZRxN3OdDA+rBpZY/UJ/SJtzmGnRYKLTuTYQdsRUrqkA2hMwUNhnt0EuzB98Lvk0cvYBwF7MmWlQnKgHAsVr+M8Q0TZY8BXZVxJE9HrUM2HFySydqhVd2S11mv+y3MVT/b3kGL8vqQmw4d+5ija7pu55Gywm4B2Qbpn+z2ZVS+Byit8f0Dqse6bVTdPhHgYE00qYrxurobKtRRAjNaq1a/yOGEw3nU80t49pxtzotkSqpKY1XPhzh2+SJ1AAz7NpILLNOH5Gx4jxD4XrxQOd4v9l2ccuGnhszZf+7gYl4cSTICbsoGME7ChMWcOw1YArY78AumunaVrZGwmXUPaOG78gBchFsITxPrWqNDgEEoPJ3bAXZiVrNMs6NFm0ZotP3B2Bz68moZGuk32jeSKo3b4bur2F16I0JS22qahiyl7GNEYukLxaqs29+FDV16uWZG1ZTUYqOzABU05NEecdIOLNNdlAToeNycXSu/9+exmtn+NXDNCpxpK+uyKZsA9RpULQS0s+26mO0vOQCEGVuzQZ5T3wTbXWMCOqv3/XlVL27xhGIObYETYqlDWvbLHeGtNGq4sxs+CNYeXOEGtNSay/cshCK7TLR38aGFe922qgAIvpaHWFzT0A5mMOr1hzXVNk1TJzaKJUXhzJnWsQ6WGbFCtDs66yVCBf3cv5vA= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(376014)(7416014)(36860700013)(1800799024)(82310400026)(921020);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Oct 2024 21:03:55.9299 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7d177634-f314-4e7c-0da0-08dcf53889f1 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: CO1PEPF000044FB.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CYYPR12MB8656 The AER driver and aer_event tracing currently log 'PCIe Bus Type' for all errors. Update the driver and aer_event tracing to log 'CXL Bus Type' for CXL devices. Signed-off-by: Terry Bowman Reviewed-by: Jonathan Cameron Reviewed-by: Dave Jiang Reviewed-by: Fan Ni --- drivers/pci/pcie/aer.c | 14 ++++++++------ include/ras/ras_event.h | 9 ++++++--- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/drivers/pci/pcie/aer.c b/drivers/pci/pcie/aer.c index fe6edf26279e..53e9a11f6c0f 100644 --- a/drivers/pci/pcie/aer.c +++ b/drivers/pci/pcie/aer.c @@ -699,13 +699,14 @@ static void __aer_print_error(struct pci_dev *dev, void aer_print_error(struct pci_dev *dev, struct aer_err_info *info) { + const char *bus_type = pcie_is_cxl(dev) ? "CXL" : "PCIe"; int layer, agent; int id = pci_dev_id(dev); const char *level; if (!info->status) { - pci_err(dev, "PCIe Bus Error: severity=%s, type=Inaccessible, (Unregistered Agent ID)\n", - aer_error_severity_string[info->severity]); + pci_err(dev, "%s Bus Error: severity=%s, type=Inaccessible, (Unregistered Agent ID)\n", + bus_type, aer_error_severity_string[info->severity]); goto out; } @@ -714,8 +715,8 @@ void aer_print_error(struct pci_dev *dev, struct aer_err_info *info) level = (info->severity == AER_CORRECTABLE) ? KERN_WARNING : KERN_ERR; - pci_printk(level, dev, "PCIe Bus Error: severity=%s, type=%s, (%s)\n", - aer_error_severity_string[info->severity], + pci_printk(level, dev, "%s Bus Error: severity=%s, type=%s, (%s)\n", + bus_type, aer_error_severity_string[info->severity], aer_error_layer[layer], aer_agent_string[agent]); pci_printk(level, dev, " device [%04x:%04x] error status/mask=%08x/%08x\n", @@ -730,7 +731,7 @@ void aer_print_error(struct pci_dev *dev, struct aer_err_info *info) if (info->id && info->error_dev_num > 1 && info->id == id) pci_err(dev, " Error of this Agent is reported first\n"); - trace_aer_event(dev_name(&dev->dev), (info->status & ~info->mask), + trace_aer_event(dev_name(&dev->dev), bus_type, (info->status & ~info->mask), info->severity, info->tlp_header_valid, &info->tlp); } @@ -764,6 +765,7 @@ EXPORT_SYMBOL_GPL(cper_severity_to_aer); void pci_print_aer(struct pci_dev *dev, int aer_severity, struct aer_capability_regs *aer) { + const char *bus_type = pcie_is_cxl(dev) ? "CXL" : "PCIe"; int layer, agent, tlp_header_valid = 0; u32 status, mask; struct aer_err_info info; @@ -798,7 +800,7 @@ void pci_print_aer(struct pci_dev *dev, int aer_severity, if (tlp_header_valid) __print_tlp_header(dev, &aer->header_log); - trace_aer_event(dev_name(&dev->dev), (status & ~mask), + trace_aer_event(dev_name(&dev->dev), bus_type, (status & ~mask), aer_severity, tlp_header_valid, &aer->header_log); } EXPORT_SYMBOL_NS_GPL(pci_print_aer, CXL); diff --git a/include/ras/ras_event.h b/include/ras/ras_event.h index e5f7ee0864e7..1bf8e7050ba8 100644 --- a/include/ras/ras_event.h +++ b/include/ras/ras_event.h @@ -297,15 +297,17 @@ TRACE_EVENT(non_standard_event, TRACE_EVENT(aer_event, TP_PROTO(const char *dev_name, + const char *bus_type, const u32 status, const u8 severity, const u8 tlp_header_valid, struct pcie_tlp_log *tlp), - TP_ARGS(dev_name, status, severity, tlp_header_valid, tlp), + TP_ARGS(dev_name, bus_type, status, severity, tlp_header_valid, tlp), TP_STRUCT__entry( __string( dev_name, dev_name ) + __string( bus_type, bus_type ) __field( u32, status ) __field( u8, severity ) __field( u8, tlp_header_valid) @@ -314,6 +316,7 @@ TRACE_EVENT(aer_event, TP_fast_assign( __assign_str(dev_name); + __assign_str(bus_type); __entry->status = status; __entry->severity = severity; __entry->tlp_header_valid = tlp_header_valid; @@ -325,8 +328,8 @@ TRACE_EVENT(aer_event, } ), - TP_printk("%s PCIe Bus Error: severity=%s, %s, TLP Header=%s\n", - __get_str(dev_name), + TP_printk("%s %s Bus Error: severity=%s, %s, TLP Header=%s\n", + __get_str(dev_name), __get_str(bus_type), __entry->severity == AER_CORRECTABLE ? "Corrected" : __entry->severity == AER_FATAL ? "Fatal" : "Uncorrected, non-fatal", From patchwork Fri Oct 25 21:02:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Bowman, Terry" X-Patchwork-Id: 2002638 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=amd.com header.i=@amd.com header.a=rsa-sha256 header.s=selector1 header.b=jFJ4RWXA; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2604:1380:45d1:ec00::1; helo=ny.mirrors.kernel.org; envelope-from=linux-pci+bounces-15356-incoming=patchwork.ozlabs.org@vger.kernel.org; receiver=patchwork.ozlabs.org) Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [IPv6:2604:1380:45d1:ec00::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4XZwLB1rV7z1xwN for ; Sat, 26 Oct 2024 08:05:54 +1100 (AEDT) Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 246A71C21C33 for ; Fri, 25 Oct 2024 21:05:52 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 684AA2161FC; Fri, 25 Oct 2024 21:04:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="jFJ4RWXA" X-Original-To: linux-pci@vger.kernel.org Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2083.outbound.protection.outlook.com [40.107.92.83]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E5554215C6D; Fri, 25 Oct 2024 21:04:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.92.83 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729890253; cv=fail; b=ucqyxq8iHoPlSd/GxbGlAlQhqABW46on3+fN2uKAmqntBKRcsPGkXEqeBWTV7S08OwTjya6WVF+LPK+j9U6cdedrf4mYLuTQtRbGwornr8V5kTvXfGKVF82YD9QTMflCdtLphC6M1Re3PM0+E5d4AuYmTqRyfl3j74gfTEoPwQI= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729890253; c=relaxed/simple; bh=zioKQcmyJmQH1sfE0C1M7XlIbWrM3m4HjYOQW2PS6VY=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=PC3r7yBjMLDpgqSXKr58K7h/O4XiCx3p5SjNKHgFiqFBIeVqG6svmyaUZ66Ej0tH6XxRXOyvCllXKAX8vewDEgZpEygpoppaH39lmfLQ/crOPrSw3WXW97qcWQanNARarWIZG2lzE0RX62bKJGyJ+f3qSaVs/cGROFHFNUmM4Mg= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=jFJ4RWXA; arc=fail smtp.client-ip=40.107.92.83 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=aT7XFednMwOkObU+Qg5qSKjXcdDIwPCaeGvKOM9f1YpkvHG1izPSeMhWh7yGWaD0wMYpH9XBFYObxLMojx2szoFFRYbGVlWZ1xTuYDsNTzBuUUrN0TTLf2hPYzaW3H7HlUfa9K1gOV3gRpAIXR7pKslxCQ52sTMRFfXw2vkeIKlIaG2UZmTSQJVA8Fm+YX950VflpeQ+ZbBtWhqV3lk+l0k74ZPgxtEwtDEA/V29mqanDHW2bUR7LqzsCSCwwmBgoNab5RGMtlVIJhRZ+7s6BOoBOkLr1k0vpQwypWTBAOGlVP9eflr8oWKZoYT2yU2vqckMXxalshwREAUw622btg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=5sVN2+sDwK+dHIO8CQZ8X/cG8jAf/ZsFUGUTpUSuU64=; b=iGNrkO08NoijZ2DqGuUCx0sCN++4VTbTIfeOY+OHCVlqAUOuSdbzadxAreBSWMluZrBfQS4FRp7EPealtcO69ne1eaIYMbC8mX6iZmeWPNIcVZH5OSrqV0ydQN2uLmLzNa2SXGajwB+cLREOCSAmy/72naq3/kcMOFuFGM0uhFb1qcMME1DEYido0vIY5IJZza+fkP30qrr0GeiQuTjbp7REMTFuHIKZnaV9ifExPgxOwfqZqChKqjXO08y3iwJf5KWPm4OWnVkJZh9GDfcd6PiuNdpT3DJjUkoU6FLeww39PijLHq/JPN4vYvNc2f0jLCFCG6nIwdBgddZZqhA38g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=intel.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=5sVN2+sDwK+dHIO8CQZ8X/cG8jAf/ZsFUGUTpUSuU64=; b=jFJ4RWXA2OJWYkQoNd3vk294nSqKXIojnQklnlnomS2RZBL5tzv0q/mbDeL+jSi/tBXJ0qXskK1yXhuZbLJc0WIdnN+PQ3nrB+a1aSNHrcHQaDN/OzCbyVR6ClxN34Wm7jQz8awlfqqX4X/7U0jNpHmqfCwMpU/Ek4yGjfST+fE= Received: from SJ0PR05CA0096.namprd05.prod.outlook.com (2603:10b6:a03:334::11) by DM6PR12MB4041.namprd12.prod.outlook.com (2603:10b6:5:210::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.21; Fri, 25 Oct 2024 21:04:07 +0000 Received: from CO1PEPF000044FB.namprd21.prod.outlook.com (2603:10b6:a03:334:cafe::bf) by SJ0PR05CA0096.outlook.office365.com (2603:10b6:a03:334::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.16 via Frontend Transport; Fri, 25 Oct 2024 21:04:07 +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 CO1PEPF000044FB.mail.protection.outlook.com (10.167.241.201) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8137.0 via Frontend Transport; Fri, 25 Oct 2024 21:04:07 +0000 Received: from ethanolx7ea3host.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Fri, 25 Oct 2024 16:04:05 -0500 From: Terry Bowman To: , , , , , , , , , , , , , , , , , , Subject: [PATCH v2 05/14] PCI/AER: Add CXL PCIe port correctable error support in AER service driver Date: Fri, 25 Oct 2024 16:02:56 -0500 Message-ID: <20241025210305.27499-6-terry.bowman@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241025210305.27499-1-terry.bowman@amd.com> References: <20241025210305.27499-1-terry.bowman@amd.com> Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1PEPF000044FB:EE_|DM6PR12MB4041:EE_ X-MS-Office365-Filtering-Correlation-Id: 64bcb1cf-5133-4ab8-0c85-08dcf53890a8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|7416014|376014|36860700013|82310400026|921020; X-Microsoft-Antispam-Message-Info: 19lgCxpxFzmylj82m1uDieAUxfQDQMm9FNoiJUMLP64f5PFy/EAmD+54RlBG5ATEcfPUcwzHvsSiSdjkhg9WwnBcX52KraCMOpAxKFKytdmwzUd2QwnJrVGULl0IFw+FK/Ax+c4y1RM7+PK8GXiUyvDY5Y731+837nXzZY9ubNmZOxiiWgxOd7nMBIa3BTeYJSKIN2yvyYBSPz2C9Tha7x8ijOXIl60Mt8BtgsjxWRoZQcEyQSfvVGefoCxT6pUbSHx3e8+OYeIQZdYiwGGW8wVc3aa2p2aymJi1pAWIECmEjuuS+g2UpFjBLOe/m5izugZ1z00WWyrXqaxcSt0Ln22cBlM58okYTUW5rnKfwKQ+YTnUGYKxoF0tn2kOZPWh0ul7DPiE9xiO6ARRc9+HhOq/jo2VzDpdLUhjtwyfo498ZkM7qxLu4Xhz6+I3jX6079au562dKdfeym7b80jbaMmiBiRxYFMUvuafCXlM/6BtNRg4n58n0fN974kC1MwAOHa1yKkH/OAiAKli27nXYig0T5jZqYZpJurTjqENvC9SREBg38CVi0vsa1EoyDtxbu6FyzfK8SAb5vNkRI4tdHdKatgNUGuBr2CXp7xSBNjz6vsq4OgYn/un+bSB7HWNImNxLwuky4riF7I0dgK0uLBEiKvY7Rc/PvWt9NNueSAfUrXJOXmBHqwbqdO3WtONrXx/Xxu/HykfffJOu5uM9EOdKc5fBwzed11ROFAk3Zw0efVsBeZYoDm5VIE6PPsAW0EiCRo8k7emJj1G/wsenFDrplMhuIy/TacRVdUeAcs+7qh0tryBiH0XPdMvoDCVn9sJkoPbh4V7SYZKUfMbLde/U2LWHD7VSswvC8PrZhuF9BvkCqQuOY6lh5jz1uL1mZLYda3xxYugG+WZzO3BaTTSXNA+Y1xpUuZmoMqBhmnInNHFZPbQQBKi864zlejcmjKsEL8g1FI28JgPUGrBRWs47TMIf9YPox6QENH1BR035vm+vvt5+V2/yYTJzpT3K/sK7Qr1TQiUsSlDEWI0cisjNDNskE5WVROTkuOMMlu28TczdxDZTInl47UVwVl35UIpxMGVjr+6ngMB+UgOSe6TGpjsAE8u10k3WOs1w6jxhpRVkz/woyOLeH31DprX4pXZsTWQk+aTUnirnI8I6J49XfkB3gzD5LypwAnY5AG1ryjZIueAswC9M8u4irN7E+IZSdZnFTwL9/E1Jgd75/H7JhfA3XKiNckSLQrWF9R95/r/7D5kwA0ZG4VeR0cxxSPWdB/MFgJkFOSduwmOmbaBwNx16wK8IdqMLRzJPuDU3g4gMaNRdC1uQp23mz4/i3qRXOOZyIuqmjUFftai8AwbshBzoDjRAMD1JBzkykhDt88MdxV4KeVTUWtEY9J0BSSNJZbrt7mGHA2EOqVgqYVyjYip2VXg8RrAecKddk4= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(1800799024)(7416014)(376014)(36860700013)(82310400026)(921020);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Oct 2024 21:04:07.1798 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 64bcb1cf-5133-4ab8-0c85-08dcf53890a8 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: CO1PEPF000044FB.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4041 The AER service driver doesn't currently handle CXL protocol errors reported by CXL root ports, CXL upstream switch ports, and CXL downstream switch ports. Consequently, RAS protocol errors from CXL PCIe port devices are not properly logged or handled. These errors are reported to the OS via the root port's AER correctable and uncorrectable internal error fields. While the AER driver supports handling downstream port protocol errors in restricted CXL host (RCH) mode also known as CXL1.1, it lacks the same functionality for CXL PCIe ports operating in virtual hierarchy (VH) mode. To address this gap, update the AER driver to handle CXL PCIe port device protocol correctable errors (CE). Make this update alongside the existing downstream port RCH error handling logic, extending support to CXL PCIe ports in VH mode. is_internal_error() is currently limited by CONFIG_PCIEAER_CXL kernel config. Update is_internal_error()'s function declaration such that it is always available regardless if CONFIG_PCIEAER_CXL kernel config is enabled or disabled. The uncorrectable error (UCE) handling will be added in a future patch. [1] CXL 3.1 Spec, 12.2.2 CXL Root Ports, Downstream Switch Ports, and Upstream Switch Ports Signed-off-by: Terry Bowman Reviewed-by: Jonathan Cameron Reviewed-by: Dave Jiang --- drivers/pci/pcie/aer.c | 59 ++++++++++++++++++++++++++++-------------- 1 file changed, 39 insertions(+), 20 deletions(-) diff --git a/drivers/pci/pcie/aer.c b/drivers/pci/pcie/aer.c index 53e9a11f6c0f..1d3e5b929661 100644 --- a/drivers/pci/pcie/aer.c +++ b/drivers/pci/pcie/aer.c @@ -941,8 +941,15 @@ static bool find_source_device(struct pci_dev *parent, return true; } -#ifdef CONFIG_PCIEAER_CXL +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; +} + +#ifdef CONFIG_PCIEAER_CXL /** * pci_aer_unmask_internal_errors - unmask internal errors * @dev: pointer to the pcie_dev data structure @@ -994,14 +1001,6 @@ static bool cxl_error_is_native(struct pci_dev *dev) 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; @@ -1033,14 +1032,23 @@ static int cxl_rch_handle_error_iter(struct pci_dev *dev, void *data) static void cxl_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)) + if (pci_pcie_type(dev) == PCI_EXP_TYPE_RC_EC) pcie_walk_rcec(dev, cxl_rch_handle_error_iter, info); + + if (info->severity == AER_CORRECTABLE) { + struct pci_driver *pdrv = dev->driver; + int aer = dev->aer_cap; + + if (aer) + pci_write_config_dword(dev, aer + PCI_ERR_COR_STATUS, + info->status); + + if (pdrv && pdrv->cxl_err_handler && + pdrv->cxl_err_handler->cor_error_detected) + pdrv->cxl_err_handler->cor_error_detected(dev); + + pcie_clear_device_status(dev); + } } static int handles_cxl_error_iter(struct pci_dev *dev, void *data) @@ -1058,9 +1066,13 @@ static bool handles_cxl_errors(struct pci_dev *dev) { bool handles_cxl = false; - if (pci_pcie_type(dev) == PCI_EXP_TYPE_RC_EC && - pcie_aer_is_native(dev)) + if (!pcie_aer_is_native(dev)) + return false; + + if (pci_pcie_type(dev) == PCI_EXP_TYPE_RC_EC) pcie_walk_rcec(dev, handles_cxl_error_iter, &handles_cxl); + else + handles_cxl = pcie_is_cxl_port(dev); return handles_cxl; } @@ -1078,6 +1090,10 @@ static void cxl_enable_internal_errors(struct pci_dev *dev) static inline void cxl_enable_internal_errors(struct pci_dev *dev) { } static inline void cxl_handle_error(struct pci_dev *dev, struct aer_err_info *info) { } +static bool handles_cxl_errors(struct pci_dev *dev) +{ + return false; +} #endif /** @@ -1115,8 +1131,11 @@ static void pci_aer_handle_error(struct pci_dev *dev, struct aer_err_info *info) static void handle_error_source(struct pci_dev *dev, struct aer_err_info *info) { - cxl_handle_error(dev, info); - pci_aer_handle_error(dev, info); + if (is_internal_error(info) && handles_cxl_errors(dev)) + cxl_handle_error(dev, info); + else + pci_aer_handle_error(dev, info); + pci_dev_put(dev); } From patchwork Fri Oct 25 21:02:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Bowman, Terry" X-Patchwork-Id: 2002639 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=amd.com header.i=@amd.com header.a=rsa-sha256 header.s=selector1 header.b=LXqspsou; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2604:1380:45e3:2400::1; helo=sv.mirrors.kernel.org; envelope-from=linux-pci+bounces-15357-incoming=patchwork.ozlabs.org@vger.kernel.org; receiver=patchwork.ozlabs.org) Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [IPv6:2604:1380:45e3:2400::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4XZwMH0CZ3z1xwN for ; Sat, 26 Oct 2024 08:06:51 +1100 (AEDT) Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 667152842E6 for ; Fri, 25 Oct 2024 21:06:49 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DDD7B217464; Fri, 25 Oct 2024 21:04:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="LXqspsou" X-Original-To: linux-pci@vger.kernel.org Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2056.outbound.protection.outlook.com [40.107.94.56]) (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 C9CAB217443; Fri, 25 Oct 2024 21:04:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.94.56 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729890262; cv=fail; b=DaazRE4oz0TBkZfSwIwaZO2WaOZy/G6VdHHSWxau8uAx/f+pJ11kuJkRwrp1GgniWJ8Bx2EkE3D9/O+qciKsOuJZ4FeslOv0TCoRPZPhI2x9CcWXr43RDF4RaNYm5XEUqWyvss7+hZ1FcLH9il+X8c0x5qVAaEZzjxCuSx7wIuY= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729890262; c=relaxed/simple; bh=/9XJuX40kCs0tSWWCrUdwpU7vxcAia9Zyln1UGg97r8=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=IaXy4ReNP7mGdLTve5d0BkhOW+fRyMpVBukHktMPUVA4EkMqQTNscbP+JD8HQqupHQHOK7PQ2JtfEQyh6x2r01I7vL09gpiaKVuSiGaAfhZRvDAYbJCoqzclfeJT8XIi5E0pM2p4MXB6QyxQjszGx1pwRn7FOq/Uc5bUBlYo8Gs= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=LXqspsou; arc=fail smtp.client-ip=40.107.94.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=JwW4M3x3+R3j0vO41fLIwO9vgVSiEmIo93HGJai/gta4DHrT21N9jeVraxnRLbyqznRlnyfMYkevR11hUZ3+uh07LQiOujTvay6Bg2yGI0EB3eXY7/TPnovLXsjbR3/r2AWM5TWCHjHeKbXahZhkX1+Pp1j139ZLDRrS4XHDNPUFek8Cf6tBR1Icm9iGQy5ExoD+zbMARu4Gc1GaidRmE+fYT+cyZXuODVMytYNHte+EEKWgLTmwwhOBIAaGJgXvPtKUVG+AcTz63VA+e6iEsszW2FLc6JmkhI3KFzJpVCObSm0V8goEO1kKCw78oeKKtUndI0KGI1DKH3Tbvtu84Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=0QJ+++jcSQCsJBok1XrLRy8StiCKAW5Hh3smQzHSG+0=; b=ZiW8WtL+IU7lL2qUYSWL8mYO6KkhUCQEUKBYS1kWAuWpqzWGcS52jEpDXOL872uPOHatpeJbIDQzrDRSw01/4vFAbT5CzeJTbGsUgTQmgv+ikXgst0zJJ882bMX9ijYbSim2oivDcN8KoSA4LpBc1+TJG1OSZ6Z8Rp24NliPpFAY9WbQyq9hM8hsCtzBq/GfcrRflzB0JoMgGPNZyRnFU7Gt7ZHh2Wqei2/50r5XusBoN8YMeIWaqDR0jg2RLGkbwXaX+An8E5hf76RFpG0YQbw1nSZ1FoEodkXmNcaREmcYOAe6uj8jb2PYzMI+/TPVcpiJ9Mv26P1BEm4Ze1tpqQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=intel.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=0QJ+++jcSQCsJBok1XrLRy8StiCKAW5Hh3smQzHSG+0=; b=LXqspsoug3nb4qP/qXRw/pi43ygB3cTPmOsqhRkLSFG1U4BWhOfuC/KnTieyEBLgqHgNL9nO7O7BrcNwTLsKkf1byiZrTQ08Hqiox+bxLl83AwgI28NYkU+da4E7REFZL4oER/fBSLoDr6bWlI9QZ4WOpgjf6HQgSoGrF56S8mQ= Received: from MW4PR04CA0285.namprd04.prod.outlook.com (2603:10b6:303:89::20) by MN2PR12MB4240.namprd12.prod.outlook.com (2603:10b6:208:1d3::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.23; Fri, 25 Oct 2024 21:04:18 +0000 Received: from CO1PEPF000044F7.namprd21.prod.outlook.com (2603:10b6:303:89:cafe::e9) by MW4PR04CA0285.outlook.office365.com (2603:10b6:303:89::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.17 via Frontend Transport; Fri, 25 Oct 2024 21:04:18 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by CO1PEPF000044F7.mail.protection.outlook.com (10.167.241.197) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8137.0 via Frontend Transport; Fri, 25 Oct 2024 21:04:17 +0000 Received: from ethanolx7ea3host.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Fri, 25 Oct 2024 16:04:16 -0500 From: Terry Bowman To: , , , , , , , , , , , , , , , , , , Subject: [PATCH v2 06/14] PCI/AER: Change AER driver to read UCE fatal status for all CXL PCIe port devices Date: Fri, 25 Oct 2024 16:02:57 -0500 Message-ID: <20241025210305.27499-7-terry.bowman@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241025210305.27499-1-terry.bowman@amd.com> References: <20241025210305.27499-1-terry.bowman@amd.com> Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1PEPF000044F7:EE_|MN2PR12MB4240:EE_ X-MS-Office365-Filtering-Correlation-Id: 517d4d12-5a8a-40b3-71a1-08dcf5389705 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|7416014|376014|36860700013|1800799024|82310400026|921020; X-Microsoft-Antispam-Message-Info: EhjqGE7a/KflKGyjkA9i2uoASwN2lbBSNeymE8rLnfl17o0iW2gOcemDMR6zDyKJuTkTe3m8pldrmfsq0+Q+HzqvBLRUndyQjVmfL9ntzXFI5SnF4D9rdhFY/dhWQ4wuncYxykUl2BAWPt3wwwLzmUsoCbbDLiEVvAgN1utCuhSHC0rHRRy2vDoVcSSvfS0dVnhb8VcpjN9gbRpuVCNc+qvvFH5sN+1i8SVAAOhEOjs/Ew31+m8mcwu3aGggC7l0Q38Mb1HJZi+0etqviwcK7yqO9MPruZmO022/Vz2EjHDMD7ZCRwwEg6FWb8jw/mficBCYqalYhY2ikATiasDk8H5Dn2Ir2tHJ7K718Q2Y+7pc1uWNkfSjeytLCA4wJw325ARVAcmG+D3qpm39jPniw/DXobrE5lnE+eZD8LbjEnYjVQ26LhhUPJL6vpl48N5HFs4prVqSKICJS/OxmEKH01dD28dDOSChrwfUFTQP3TlXLbmMz/Aj0ceBRx4u1bJB0JSdTNp++3M+INt0SpHBxa7GVOlIOH/LpmYio7+I9Cl8Dek+Xj6pqSoNbMx+NJE5b8O2q2orCSdzswP/1xtOqIa8pCmNBgQQodfLcdtaaZtQY1qrNC9in84qgEsMF2ymOOY4sieoxgNdxsoMkFLNR5FT/sJ55tfenDV2SyHYfnnZQFqeOnwZqTHfJAnCqH5dgiFxxz4W0fG9c3S6HqOkH4T6xgwVRk5tvbrdErj5dcKN58xZBA4O4g2jRzB0po6G6KeJEFRwtOZ9/0pCrV+CU1aMwgZWpDlr5FRvynhTZMbaThc4Zc2FGy6THGry0IPO99rGyy5zf4g7bt4DmV/so+cn6+7cGipQwicD+Zj8esPmroJEx6ViTanNImvypskzYPtLn9Vs7mwsqoULFBGBU1T20+NaWnHx/EeSXcGFX5vDQ9uBPq4Gn4vR3dl3oXa0MWrOz9QrFDpcu5iXoSu8xJWbjnzrk4HYTrYsjY7OhOlrSlaqRLMGwFxJgsZ9hkzWWQZnfbuY3g57SjOLJ1jZCC3a+YM3A3V42ZWvXQs8olzkq647zurWsGI+5om1o9feJroW7DcswL4lqtmsvdZrExqCf2/2V+iwkagoAMjSSt+54HdXFOQokf1BYpRiR7mYc571XFmS4tKdz8SyqXeJit+8m1g4mANanpm+rOHgNlHvbRawN6sbQttyOmW98q/Db0c8UNnI9GvE1OrvN51etSnLUqPKf8eQkyrfAgEAaSvIJDQU39zOjcJCGehl4XFCgVs6DfNwLckQFvIDudEuMRG7hS2HSvc5COvymPrFYGOtJ3mp7yoooWRisXJreYXy5nY5N+NiuVah1gRHVofph+bA6ZOh7bpzgvBM3mJ7nI3kasny42FTltTMQNPpXZkC X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(7416014)(376014)(36860700013)(1800799024)(82310400026)(921020);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Oct 2024 21:04:17.8739 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 517d4d12-5a8a-40b3-71a1-08dcf5389705 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: CO1PEPF000044F7.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4240 The AER service driver's aer_get_device_error_info() function doesn't read uncorrectable (UCE) fatal error status from PCIe upstream port devices, including CXL upstream switch ports. As a result, fatal errors are not logged or handled as needed for CXL PCIe upstream switch port devices. Update the aer_get_device_error_info() function to read the UCE fatal status for all CXL PCIe port devices. The fatal error status will be used in future patches implementing CXL PCIe port uncorrectable error handling and logging. Signed-off-by: Terry Bowman --- drivers/pci/pcie/aer.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/pci/pcie/aer.c b/drivers/pci/pcie/aer.c index 1d3e5b929661..d772f123c6a2 100644 --- a/drivers/pci/pcie/aer.c +++ b/drivers/pci/pcie/aer.c @@ -1250,6 +1250,7 @@ int aer_get_device_error_info(struct pci_dev *dev, struct aer_err_info *info) } else if (type == PCI_EXP_TYPE_ROOT_PORT || type == PCI_EXP_TYPE_RC_EC || type == PCI_EXP_TYPE_DOWNSTREAM || + type == PCI_EXP_TYPE_UPSTREAM || info->severity == AER_NONFATAL) { /* Link is still healthy for IO reads */ From patchwork Fri Oct 25 21:02:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Bowman, Terry" X-Patchwork-Id: 2002640 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=amd.com header.i=@amd.com header.a=rsa-sha256 header.s=selector1 header.b=S8Obw/6W; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2604:1380:45d1:ec00::1; helo=ny.mirrors.kernel.org; envelope-from=linux-pci+bounces-15358-incoming=patchwork.ozlabs.org@vger.kernel.org; receiver=patchwork.ozlabs.org) Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [IPv6:2604:1380:45d1:ec00::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4XZwMj75bkz1xwN for ; Sat, 26 Oct 2024 08:07:13 +1100 (AEDT) Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id A3BF41C20BD7 for ; Fri, 25 Oct 2024 21:07:11 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F352521313F; Fri, 25 Oct 2024 21:04:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="S8Obw/6W" X-Original-To: linux-pci@vger.kernel.org Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam02on2067.outbound.protection.outlook.com [40.107.212.67]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9DB151B21B1; Fri, 25 Oct 2024 21:04:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.212.67 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729890275; cv=fail; b=YJkYOfELeLDhdOfS3pGkUAgQffWdUrbM9r2Rnh+Ie+KBiGlCYlgPSdX5HafTRtcm2r8XwcsLBq6J6H1BsxQ6M+9v17aXevpklVQdazP36IZ4i3EQxll2rzMMggwsAK3JHuk98iq5eQnsK01d3mKP086hLMEsYRzX/2f4ZHOoG5U= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729890275; c=relaxed/simple; bh=Tei5V3LCgaZI2dNZaxk+p8W2HRQ7GNyUgiwrbkygGbI=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=rbPKA3Jmh8v0d8PNBg46Dx4EScBCSDCFFk4O97qXtV+z8U6C95BnU8jPcrXe6AR+PsqSoQrr0x0d+0OloH/tY3gDKKdfG3h8Xqr9YnkOmUax9cpYfb7bNEMUqLNC2vGe4izKyVS5keBxJVAPpyPQeWPSFnorGSENqpSldmLLY8A= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=S8Obw/6W; arc=fail smtp.client-ip=40.107.212.67 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=SsXcHDeatgVyQTHaHNbaaUlOnrlgxGxc8SmmoSYRM22ANxIo+fR9UkmsMNFS4Pw/y7rj7hU8bvYy3rsKP1XmhunOm4JsbvNDd2AfJetRZ/UbPqk8G6ZV81SsLUfcKWOMc318KKq9wE9kN6S4nSJ7owDvJjxdtkGXSqv7ljN9zt+/j7YayRXxJxr2H7fKGd4ZJMOuPPWMD/feL6Fw4w0MDSU2v4hzu2r522bNa+zeiqn/aFkWXIjDlrWjVR1wvTm8zFzTOw507qHym3m2jUapz78pUQmO4+T6ekC21Mu4LFydmYCOdDBOq0hm/789JB0CTZGNuYi9IHZTlKExt28gyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=efNNfyFyX9vuQVwQ0Zt//7YkM1yqocs5wuQfewqjA6I=; b=lDr7Q05GVP/WOxQhJLZuq2QmUUeXCvQgdK462pZ3YQBd5aJRHcN+Z7+A0DmeeEmZGkoQC+aTqaQk8sT+OdjKXsBrYIKf7c9rl+aexlM3ALsMLCHnIEKhJozF9TP2+160dNBpI1N9zKlopPbFGhHTMOVGsokxb4YzqvWuNzezqCRpZsBlv43uIko9BGZQ0WXIoUbvhfCCYOVo1NIj1KgO5CkwhZNOUsqlN0Bswgj260AD7d7bv+nbNWa7IMyOzAWODMf2R2+SJMmjaP3I8VQYyd3txZQNQu49jkksEOdc3UffGh8Ab5KZxMSKzY8ZzE2IxdpWE4h8Fviw1oHSYyHQTw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=intel.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=efNNfyFyX9vuQVwQ0Zt//7YkM1yqocs5wuQfewqjA6I=; b=S8Obw/6WIz9NG0hBTzztWf/nmmv8VsSM4rs7tHf0aG+iUxMWres68lEEyEV5t1rke7+YMkHOokH9KFuwnluj4XG/gEHLUImfoqBD7SF7MhQLyIK1/+IA9q6mEXYztHqFI/eUh6LKEW+U7J9WsEmSFASdrRBKT3ZJe6SaElITUns= Received: from MW4PR03CA0087.namprd03.prod.outlook.com (2603:10b6:303:b6::32) by CYXPR12MB9442.namprd12.prod.outlook.com (2603:10b6:930:e3::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.23; Fri, 25 Oct 2024 21:04:29 +0000 Received: from CO1PEPF000044FD.namprd21.prod.outlook.com (2603:10b6:303:b6:cafe::ea) by MW4PR03CA0087.outlook.office365.com (2603:10b6:303:b6::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.20 via Frontend Transport; Fri, 25 Oct 2024 21:04:29 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by CO1PEPF000044FD.mail.protection.outlook.com (10.167.241.203) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8137.0 via Frontend Transport; Fri, 25 Oct 2024 21:04:28 +0000 Received: from ethanolx7ea3host.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Fri, 25 Oct 2024 16:04:27 -0500 From: Terry Bowman To: , , , , , , , , , , , , , , , , , , Subject: [PATCH v2 07/14] PCI/AER: Add CXL PCIe port uncorrectable error recovery in AER service driver Date: Fri, 25 Oct 2024 16:02:58 -0500 Message-ID: <20241025210305.27499-8-terry.bowman@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241025210305.27499-1-terry.bowman@amd.com> References: <20241025210305.27499-1-terry.bowman@amd.com> Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1PEPF000044FD:EE_|CYXPR12MB9442:EE_ X-MS-Office365-Filtering-Correlation-Id: c66c381b-a2a5-428e-108c-08dcf5389d9e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|7416014|376014|36860700013|1800799024|82310400026|921020; X-Microsoft-Antispam-Message-Info: ZDOphukiMYcV4Ip3OrLGGMw/zrdSeVNsb4oaBw77EqlTbz4pvu4hljKhnBl7CiSOeoS30NUU0Wf8VMe9iQHKOoIqJcrKrzWEoQUWZQ5l1gykKJF38g25LjncRXwV+2npNWFcM7RXj98NcB6uwqT6FkyduxKjENt+3MklUqFMJCaeTauFsDuMcSovq+japMBCUSzQwBbxiCt2Jqisdp3b7ZcvVqR2MM68yd/N28CZUphYFdxvw2HZY3Hsg8yGg3qlUhLe352cXL3OKt7SsPpyC+vnLCMOYIuBoiYE6urV57gnBXRSkeGl+V83/h1e0t+jeOuLKLVh1xYJdpqjoK9xSB2jHGLA8/6GoFsQEpxD0lTlVHKhi3SXT0byWADxaaBGN828L2jP9dzL1/T+RkIkdxB9oV31HKWvfavNSehcguxiBouPD+o5DDstLqw+VZUcst3hyYBmQDv9OB2FWjMPLuTtDMNYH1/ak11pUeiGUifv1hYN8tFcmCAlXxIOpEg4xX87RLoxUgIIkJN1s+OFt4ocjhFmQ+U2dRERiNqmKeyyzr9jwxE5G7LBw8Z5fRAOCiCDj8lcd/gO82lufobjO+Frfj6KT5d3DdS6GVQJcQw2qOMmltpSFJc1Gbpy6u9WVnQNBw7q4P8SI6zB1whbHIsj3ErjH4ysXPL4baHzlb49ytsg7OhMaKcxLe6t5SZ64nCvvjrbT59PA/cs0VutHFJ45BRiUFsbmycWOrxWeXvOninmfORfMpNdFZQowo1pOW3MyFsC//PR+6nA/1rl1xpuniIVTssXcQ8lPvjum6gpymjUXIFeR3gkknOkUPxmwzTzO69/M0OTuFr4b/o8qM6UJ1dyJS4Ic5XaJzK0/kSpJO4YaF8Np/kgWNQO9Bt9J+03xDx+GX29v1sX540U4IMqtfSKdsKirplSm1a/NmXzl3x62fYPtvpEV1IdV2OauOOJ7Ppo07DHghdWwnykZqtU/Rsn/OUVymiJDvfft5D0fEQ1DNgP6B42VLiD1Du8i1w6SLNmQxID/2xtEV6kr/KvJQTj1k6jCKX0+bz4oSArjQsCNhQWJKVawigP+n44k3NlPd9w3w8fE5Y/dgTHHEmR5FopdDccIIaWZrJBnEW3PTsuMIEtk470mCxeS+QOakLPW8T8zMKgDip30b5pLypYjHAfzUjIH8bxtPVwv/cWCMtA3/3q+20nzx0CYOdaYua4tAGEnhuQN8m9S98y0X2Perrzg4Kcz58ZgalR5gj0yPNHk/zJmBourqMFrDHJafJClx5vqoQIAhJfcn2OZ0FJ7BE3pCLZm1RbencH4x1F4xcbIzZB7+7N+zRe7SqAGbQRrCDnaMJAEo9jO/jvSghuHDbMoIY8JOhH7ea0ZN3EuNZ+5R64IYRVJO2Ohg/3 X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(7416014)(376014)(36860700013)(1800799024)(82310400026)(921020);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Oct 2024 21:04:28.8935 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c66c381b-a2a5-428e-108c-08dcf5389d9e 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: CO1PEPF000044FD.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CYXPR12MB9442 Existing recovery procedure for PCIe uncorrectable errors (UCE) does not apply to CXL devices. Recovery can not be used for CXL devices because of the potential for corruption on what can be system memory. Also, current PCIe UCE recovery does not begin at the bridge but begins at the bridge's first downstream device. This will miss handling CXL protocol errors in a CXL root port. A separate CXL recovery is needed because of the different handling requirements Add a new function, cxl_do_recovery() using the following. Add cxl_walk_bridge() to iterate the detected error's sub-topology. cxl_walk_bridge() is similar to pci_walk_bridge() but the CXL flavor will begin iteration at the bridge rather than beginning at the bridge's first downstream child. Add cxl_report_error_detected() as an analog to report_error_detected(). It will call pci_driver::cxl_err_handlers for each iterated downstream child. The pci_driver::cxl_err_handlers UCE handler returns a boolean indicating if there was a UCE error detected during handling. cxl_do_recovery() uses the status from cxl_report_error_detected() to determine how to proceed. Non-fatal CXL UCE errors will be treated as fatal. If a UCE was present during handling then cxl_do_recovery() will kernel panic. Signed-off-by: Terry Bowman --- drivers/pci/pci.h | 3 +++ drivers/pci/pcie/aer.c | 5 +++- drivers/pci/pcie/err.c | 54 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 61 insertions(+), 1 deletion(-) diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h index 14d00ce45bfa..5a67e41919d8 100644 --- a/drivers/pci/pci.h +++ b/drivers/pci/pci.h @@ -658,6 +658,9 @@ pci_ers_result_t pcie_do_recovery(struct pci_dev *dev, pci_channel_state_t state, pci_ers_result_t (*reset_subordinates)(struct pci_dev *pdev)); +/* CXL error reporting and handling */ +void cxl_do_recovery(struct pci_dev *dev); + bool pcie_wait_for_link(struct pci_dev *pdev, bool active); int pcie_retrain_link(struct pci_dev *pdev, bool use_lt); diff --git a/drivers/pci/pcie/aer.c b/drivers/pci/pcie/aer.c index d772f123c6a2..19432ab2cfb6 100644 --- a/drivers/pci/pcie/aer.c +++ b/drivers/pci/pcie/aer.c @@ -1048,7 +1048,10 @@ static void cxl_handle_error(struct pci_dev *dev, struct aer_err_info *info) pdrv->cxl_err_handler->cor_error_detected(dev); pcie_clear_device_status(dev); - } + } else if (info->severity == AER_NONFATAL) + cxl_do_recovery(dev); + else if (info->severity == AER_FATAL) + cxl_do_recovery(dev); } static int handles_cxl_error_iter(struct pci_dev *dev, void *data) diff --git a/drivers/pci/pcie/err.c b/drivers/pci/pcie/err.c index 31090770fffc..3785f4ca5103 100644 --- a/drivers/pci/pcie/err.c +++ b/drivers/pci/pcie/err.c @@ -276,3 +276,57 @@ pci_ers_result_t pcie_do_recovery(struct pci_dev *dev, return status; } + +static void cxl_walk_bridge(struct pci_dev *bridge, + int (*cb)(struct pci_dev *, void *), + void *userdata) +{ + bool *status = userdata; + + cb(bridge, status); + if (bridge->subordinate && !*status) + pci_walk_bus(bridge->subordinate, cb, status); +} + +static int cxl_report_error_detected(struct pci_dev *dev, void *data) +{ + struct pci_driver *pdrv = dev->driver; + bool *status = data; + + device_lock(&dev->dev); + if (pdrv && pdrv->cxl_err_handler && + pdrv->cxl_err_handler->error_detected) { + const struct cxl_error_handlers *cxl_err_handler = + pdrv->cxl_err_handler; + *status |= cxl_err_handler->error_detected(dev); + } + device_unlock(&dev->dev); + return *status; +} + +void cxl_do_recovery(struct pci_dev *dev) +{ + struct pci_host_bridge *host = pci_find_host_bridge(dev->bus); + int type = pci_pcie_type(dev); + struct pci_dev *bridge; + int status; + + if (type == PCI_EXP_TYPE_ROOT_PORT || + type == PCI_EXP_TYPE_DOWNSTREAM || + type == PCI_EXP_TYPE_UPSTREAM || + type == PCI_EXP_TYPE_ENDPOINT) + bridge = dev; + else + bridge = pci_upstream_bridge(dev); + + cxl_walk_bridge(bridge, cxl_report_error_detected, &status); + if (status) + panic("CXL cachemem error. Invoking panic"); + + if (host->native_aer || pcie_ports_native) { + pcie_clear_device_status(dev); + pci_aer_clear_nonfatal_status(dev); + } + + pci_info(bridge, "No uncorrectable error found. Continuing.\n"); +} From patchwork Fri Oct 25 21:02:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Bowman, Terry" X-Patchwork-Id: 2002641 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=amd.com header.i=@amd.com header.a=rsa-sha256 header.s=selector1 header.b=U44ItDjo; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=147.75.80.249; helo=am.mirrors.kernel.org; envelope-from=linux-pci+bounces-15359-incoming=patchwork.ozlabs.org@vger.kernel.org; receiver=patchwork.ozlabs.org) Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4XZwNF3XqQz1xwN for ; Sat, 26 Oct 2024 08:07:41 +1100 (AEDT) Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id BD4551F29620 for ; Fri, 25 Oct 2024 21:07:38 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 481C021765D; Fri, 25 Oct 2024 21:04:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="U44ItDjo" X-Original-To: linux-pci@vger.kernel.org Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2047.outbound.protection.outlook.com [40.107.237.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 394881B21B1; Fri, 25 Oct 2024 21:04:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.237.47 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729890287; cv=fail; b=VV1r4zn78Fo01/8EYkWP54iasSTX2TXQwYuqFBDYQzl9eTyDk1fRaQQSKZxSLe2lU03Xx/aMb3wXWfgfzl+2BGS5S/3O8Rl1sWYdp+I7MnVxGWH8pT57+ZPZTgPJAaK06tA3jTPsQY1dKi+nGXboWqc9LOI59SYulxtoLh8ulhQ= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729890287; c=relaxed/simple; bh=/gciUkMMv/fmzvWAzaB1/vpC75eH95U3LDrMbnbb9CY=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=A43M4sAtrQFTzUr9PWmsM1Wqwmb3g2kK4zn65/ITT7RWRnCIIXqJperWUHjOBpxWGhs/pFO1JIuhPHdN3emqcr6FRJ+DrzJfp3Uf+jF+bRw+Q+BCBgjd1F0PEHIiwpz+z1uEAdVl2ywPvd9ez7wVYpN65YuKhRZe4x8mwPDp680= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=U44ItDjo; arc=fail smtp.client-ip=40.107.237.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=RLGzgq6RfEpsni2vqrKc454aEHIo3OuWhVonuS/HjR1B/hEWFsWhAnCm7ivIB1LVdOrCHhVq/TKjtkbYrK3O2oqIBfe4+TlxJPRE8/wnPrE1hkVwqYwY3mmRzpTQfHo+9HfwR3GvvoPfka2mdjNcsM43kbTShxX7eBTk73SXgxz6Vnl4VrQS6NZ5qPiQY9V3pY+4n6qCJjUjXNVa9YETghrszkRZ3+2M0eRaoAHHoVgfUc4uFEr5pFqMGZzyAcJbkVmbFaVDH5kBlAvWY410hPk8ZHbdHiU2gPBkQ82hnc5EQEHuxcXU0zLGtl1Vx1Gi65CRCcmzxO+favH5NEN/Yw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=lB7aW/QflGOsDvF/CcqsN9ewFe2W7T/z+vI8ciwGPIs=; b=Zm5TQYzloWBPV6kASpoGB82C1G05I6Dce2Al5NjTh3eqDWJ51EXP+2h+tRoBs4HkO+hcGV1FSv4U8JK580pbBHNvILZrLickiu5mzVVHXDJEMYdOsuPqFK4Xnc62hjtnR+w1PqKW043/E5BwQqvdAm5sXJ9LH3O7ZnmUgW3mkUo7WRDrijbCeDyY9kvoGlUsve2rRkrVrptTq4LN1n0C/5ES4VDjuKgssgHbefRaXr2C4rcukf8pvKOnXfVQ7BjvDQXHoEBH8CwO3qExLYVev8m7Zanr71R9ilw2n0/QdSqcvTLPKuPUPKr0ZETQC1jN3inw4xN6G1eVuwk5cxa3Fg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=intel.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=lB7aW/QflGOsDvF/CcqsN9ewFe2W7T/z+vI8ciwGPIs=; b=U44ItDjoAqWIbYygEveHAqF5maIeYJGh9lyWOXO5Wn29bgxx0RM2trHoL9qoHDKS6GO9HF0V4xCJ6KW8QYWqcbjhPF9IytJaI/W8rZ7n2mftvn85bqliYSTsT1yD6OaHnvN+HCMrNSkbT5VViDHzyFZAayWcELMEGymj+HWsCQg= Received: from MW4PR03CA0073.namprd03.prod.outlook.com (2603:10b6:303:b6::18) by DM4PR12MB9070.namprd12.prod.outlook.com (2603:10b6:8:bc::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.28; Fri, 25 Oct 2024 21:04:41 +0000 Received: from CO1PEPF000044FD.namprd21.prod.outlook.com (2603:10b6:303:b6:cafe::f0) by MW4PR03CA0073.outlook.office365.com (2603:10b6:303:b6::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.28 via Frontend Transport; Fri, 25 Oct 2024 21:04:40 +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 CO1PEPF000044FD.mail.protection.outlook.com (10.167.241.203) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8137.0 via Frontend Transport; Fri, 25 Oct 2024 21:04:40 +0000 Received: from ethanolx7ea3host.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Fri, 25 Oct 2024 16:04:38 -0500 From: Terry Bowman To: , , , , , , , , , , , , , , , , , , Subject: [PATCH v2 08/14] cxl/pci: Change find_cxl_ports() to non-static Date: Fri, 25 Oct 2024 16:02:59 -0500 Message-ID: <20241025210305.27499-9-terry.bowman@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241025210305.27499-1-terry.bowman@amd.com> References: <20241025210305.27499-1-terry.bowman@amd.com> Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1PEPF000044FD:EE_|DM4PR12MB9070:EE_ X-MS-Office365-Filtering-Correlation-Id: d060fb99-2f41-4fdb-9a81-08dcf538a43f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|376014|36860700013|1800799024|7416014|921020; X-Microsoft-Antispam-Message-Info: vLCXIDPjzVH+wq+VIZNkS37f9fjgCZh/VKAfpoLPARtaZz0/SK8e5FgRXnJZwJaMx3Z5cGvD86zjDWQGO5qeM9+Ofz537rQrsDCCgya3sY1M1rIFXZfDNriEBCoy/Ua1wCBYXX3LDO32m0qiSd/NwHd+ShEvZFq7vpLFUE4F2NZcPcNKKR/PD3oxgR8aYMQiEZfASAgTllnG8PpM/uiBSVVSCSGVGp3R7npDBvtgTAkb3tWXJy5lF3QbB2HOPtZ1pQ0LFW1MrLAwZ6+o3boTXhCPMqmIUWiXaYofqLArkdyp/mDEEKs7G/rUP9qGcLKlPDhKj7vbSVmFNdAwJXLOdvDGeQunIlAzyCNPEDrkFHlvAsZLxPDemy5LLnEvrFSwOO5qS+HFNJ61hF51CI67Nr7QiI4caDyvKPiEqrV4ld2kOhiUiVhxHmgwMEh9T8JiEYiuoJFP+uuMoLg2bsUv3OYa/WyI+GFkCOu9jTKDzt+rh5p0RJFi6KhXQllKegfipDjleM5AmeUuPWbVar8eXuYj0gDRig53XP+lWWH3sjYhO2L993sRNpRhP9XYWb9a5i1LfDBHeLgPumZTaMMSBK4kFxJfjVJfgzt7aaqG99MaBTiql7z39ZRR903tJC5R8gN+L4C7QF3aIoa9iwzJgx1v4WzDfGI2ncJU4VD0P+ifwLwFLmRY57KAzoFGVzw9hgfo2QGP8b//oCznFEwokf16u0tnNMtxizj+KmsV3+LGqPbCEzUgGOb8c0Ey4+h56LhLeW2eoha6k1s/QVah1tsDXd4kNdnkDLZ6ffTo+9HA0QLKXqzXMe1hslAA5hcEKRD9TbgusuHB34Ltwcy9+r3geJLADYKpObwflXC0+rWoGkgc1+7HQGZ+XREwZ4Ydh7XtAzBsqXFmygjzo9AxcqJPidjYs9vQ1SG6vAgW8a8TE2xo/SvIGO2p94nOnki2cgCLqWyoEmbiYE02HSsVZ4iDurjoB3tvfcyvJnRwWiykwZOvo1GI+ke7pkR3lArvzeylgCW+yWaHXRanukvIQdacB5u1gv6FNgQpZSw4iHrRO9yIysAb2SBPjp8xBiNQy6MW34DLBfYjMGTuy6UNrYtXTvdoAzuXeI4iLN7k4Z3UhSNEqlR89AqU9wJURS9kgKTRJ6zA5IKzrZWi9JAC1lzlL0bymFdMEQVISbDIRJoN3eHcpCr6z8NhKFyf6AaHEHWiDw8nXx6+bfFHuip25s33gPIpvM2UrXKV2/kS4yExgX6U86vs/D4MjpazNkzVVttACyT8ZRS63gqHFOs8cRYHLeN3fQZQBBdAHJGJxGcQOnjtLBYnmwYOCi7zK/TLCxm5NQcWEnN1+lZeTIS3BMibH8LBx6T5nCcpIhCgGC8qfcGQc6lQLW3xP6T1zLB5 X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(82310400026)(376014)(36860700013)(1800799024)(7416014)(921020);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Oct 2024 21:04:40.0498 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d060fb99-2f41-4fdb-9a81-08dcf538a43f 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: CO1PEPF000044FD.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB9070 CXL PCIe port protocol error support will be added in the future. This requires searching for a CXL PCIe port device in the CXL topology as provided by find_cxl_port(). But, find_cxl_port() is defined static and as a result is not callable outside of this source file. Update the find_cxl_port() declaration to be non-static. Signed-off-by: Terry Bowman Reviewed-by: Jonathan Cameron --- drivers/cxl/core/core.h | 3 +++ drivers/cxl/core/port.c | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/cxl/core/core.h b/drivers/cxl/core/core.h index 0c62b4069ba0..d81e5ee25f58 100644 --- a/drivers/cxl/core/core.h +++ b/drivers/cxl/core/core.h @@ -110,4 +110,7 @@ bool cxl_need_node_perf_attrs_update(int nid); int cxl_port_get_switch_dport_bandwidth(struct cxl_port *port, struct access_coordinate *c); +struct cxl_port *find_cxl_port(struct device *dport_dev, + struct cxl_dport **dport); + #endif /* __CXL_CORE_H__ */ diff --git a/drivers/cxl/core/port.c b/drivers/cxl/core/port.c index e666ec6a9085..2ac835cd4f1b 100644 --- a/drivers/cxl/core/port.c +++ b/drivers/cxl/core/port.c @@ -1342,8 +1342,8 @@ static struct cxl_port *__find_cxl_port(struct cxl_find_port_ctx *ctx) return NULL; } -static struct cxl_port *find_cxl_port(struct device *dport_dev, - struct cxl_dport **dport) +struct cxl_port *find_cxl_port(struct device *dport_dev, + struct cxl_dport **dport) { struct cxl_find_port_ctx ctx = { .dport_dev = dport_dev, From patchwork Fri Oct 25 21:03:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Bowman, Terry" X-Patchwork-Id: 2002642 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=amd.com header.i=@amd.com header.a=rsa-sha256 header.s=selector1 header.b=neo0BIP5; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=147.75.48.161; helo=sy.mirrors.kernel.org; envelope-from=linux-pci+bounces-15360-incoming=patchwork.ozlabs.org@vger.kernel.org; receiver=patchwork.ozlabs.org) Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org [147.75.48.161]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4XZwNd57Vdz1xwN for ; Sat, 26 Oct 2024 08:08:01 +1100 (AEDT) Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 4AE43B24EA3 for ; Fri, 25 Oct 2024 21:08:01 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A8DF410A0E; Fri, 25 Oct 2024 21:04:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="neo0BIP5" X-Original-To: linux-pci@vger.kernel.org Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2066.outbound.protection.outlook.com [40.107.244.66]) (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 516AB21441D; Fri, 25 Oct 2024 21:04:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.244.66 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729890297; cv=fail; b=LrVIrgPT06yVt/ssU+yzW2Ioh2hII/GEi5Pv4DugQ/bPa+2fMiCxyTP6CGiOxRTIKD2nFq5p4V4Rl4QxWXU7iuTg9nR8OopWNgEnRgLpkw42qSQXHve1nzCQX+QxU3wIZAsYex+KfngBnWY5x+QNuZwCCFzATqOKK4IN8LDwe/c= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729890297; c=relaxed/simple; bh=4LW4XSc59CyRAG7ITnRUURg6U1X9Rt9TBKTTHj/9lxg=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=DQdL/WPRG1HZKI+V73sJLxSLlb3Ga6C/DMvkcsbnBXU9zdGlZulLKVwZ9QkPPaTXmo0DbK3KKHJ1vwLEZHjjiVPPSfKYtrqUJsX6hYAmWuFlQGyQ+2chVoWKl3mqeK+E9R7SyUOqkzPJPBPj9G8wKWiwuXLiKIjCjOfv+ExI2Kk= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=neo0BIP5; arc=fail smtp.client-ip=40.107.244.66 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=s4Dp1GAMJw++zkFX960srb0RDVRzuxqQh8UeXlmkob3i+LPwCaooNSkMId37AIgu0dNWHGRwl3tIo0+eQtiHf3EYpp6Q2KXKSmDD/F2d9soNmVG1/A6gHnWbce6p9yrnUsMCxVsSyxI0jxicgq20TO2nKFKFVU2l0VSFfIKUsIz3crHq3WUsu8NlviEJuI3rtUW3gaIU0dkqsmmgaGrHb13bY62YYBHVVO36f/Rfi/xMqVyfvFf3pFmxK/QFhkfRO/XIuNP+9eFg9CXyzYm0EEJG3OoXlr4/wBLkLJ78577jAQRRPrfvl81C/JGAiSqoIcFEg0yV9LyXfnipwuWxgg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=wljKaQXriCA88e08x5mQCbE2H+gNf+KG4Nu7K2vlc0g=; b=W6mQeRGWfQAUWdtdqYgGojMwed+1oYmmLojMudi5TkDX8Evby3ZuUqp7syRZK9lXllF3abaHzBAF8qzM4swC6PYXZDeO/yy8Ey5A+Zdiy3lwLux8PoPO6qjwXLPAiAmVfQ2XM1Th6p085cLB5hPHud6qR+eHpiqEc3+kO2tZim+ErnOA0WEchEHpn+MjLBxbho89VyGsW1YKvb2WduVusZhCdqj0mFnUYaEm80QdvbqJMS4ooqeHGWxg2N/bxf0CjK2NCTcZSUJYvXwRBt/cTCyQVuP5NliB1czg+puYTGGs3GZvMYt6eO7xcrp2A/4nJktsYR3EZEa3lmJWluOtzg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=intel.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=wljKaQXriCA88e08x5mQCbE2H+gNf+KG4Nu7K2vlc0g=; b=neo0BIP5QrPyL81pI0MOAxIHctT3GKuGIeM1AcQZvQMGPJm8JX7k4HTW0fwPm8Szy7kjrCIaMbcNquNYnUgYhtMk61nGONtjvLTWW1FAKP1BBz+HvAg8PPcEvps1c5Ak9ArGynBm4CVdrYP0A9LcFwHcpwt05B2fd5Y+GAC/Pew= Received: from MW4PR03CA0289.namprd03.prod.outlook.com (2603:10b6:303:b5::24) by DM4PR12MB6327.namprd12.prod.outlook.com (2603:10b6:8:a2::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.21; Fri, 25 Oct 2024 21:04:52 +0000 Received: from CO1PEPF000044FA.namprd21.prod.outlook.com (2603:10b6:303:b5:cafe::20) by MW4PR03CA0289.outlook.office365.com (2603:10b6:303:b5::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.18 via Frontend Transport; Fri, 25 Oct 2024 21:04:51 +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 CO1PEPF000044FA.mail.protection.outlook.com (10.167.241.200) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8137.0 via Frontend Transport; Fri, 25 Oct 2024 21:04:51 +0000 Received: from ethanolx7ea3host.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Fri, 25 Oct 2024 16:04:49 -0500 From: Terry Bowman To: , , , , , , , , , , , , , , , , , , Subject: [PATCH v2 09/14] cxl/pci: Map CXL PCIe root port and downstream switch port RAS registers Date: Fri, 25 Oct 2024 16:03:00 -0500 Message-ID: <20241025210305.27499-10-terry.bowman@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241025210305.27499-1-terry.bowman@amd.com> References: <20241025210305.27499-1-terry.bowman@amd.com> Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1PEPF000044FA:EE_|DM4PR12MB6327:EE_ X-MS-Office365-Filtering-Correlation-Id: 571f49ff-d336-4644-2ed2-08dcf538ab0e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|7416014|376014|36860700013|82310400026|921020; X-Microsoft-Antispam-Message-Info: WrjWeA/VCZiBF1S6Ju9/b2G0QfWufpqU0VbTetwHjLCtqepOzahL6oFpg2jBpXEqTl0Dqb/4azs5EcheLebCnuIRPl7jGfWh1SRusUlsTpRPo96lZyq7s+amRwlFGld/ea4ITMUoloMURybFZZsX8NRyTIYNB+Hey/crXvy59U3+HuZZpQSaPhfd8ypE9t63iSKDS2pSYi3v5Qlm7FLJjINakYm0oVj4fdCgOJTtLh5xJaECq2ugJHlRh7u6AaYjxGF2W0+8bK1FVuXUxy3HSr5+damn0CGnFsjxRZ4Q/ugMW4lFPZYo0uSOYxfAlOIcL4rijrqauQE8YNVnorbev/8aUNjPU6PnFDYFZsU4cGJ/VltPnWpcbQ8huKJN1xQr/4d5reKsiLK7rNVP3fz627JRZ3wFoCZtmAXjs6y9uIaFU1O0FZ017K/M6Mn0MbOFlJui0e4G4YXNJ6jRsJwc84P+j7YCWg2oylZJlgNGEMeXegoQH+fWZyrcLOGmnruj3RpnplupcDcNYJJV/9NZ3j9otqS62obPMXw/JU3/yAd1R5QqYpH6LyGVizf8fjLwgn0jpKa/qbWP92GuQURfOv9YpnxHUiONZdDwHrrpNWlwgnsKtFyrTPiANhxGr2FNSY8an8Z8oWymD01aMOay7O2O5JskadQNWbSNgyZqd7EDUfjViROKHlF6jAJewJ+W1ZbIX32kgOvsHjM0P5uXHCUSwLTmzxvs0QRga057AOVzSLEJ/OhD2YEP2qLcUsIRBdkL9Whp8ZjqHFy9qQ7Rv7t6l9n8KnP/NN+PF0jVaBDi6/Ah1EwhLn0Ct2zvXi90rZvVtmpZLhLEXpWfTJxIVu3xzwyn34lqbZiPkF04lbCmCHubTdk0SkGLjzosxiydEXyTZnMsES/bldSUGaAyD0tZ50KJrInbnltSNfMeoaL/HJ8ziURS+65v6BV1dZMF0DVsMfjqR9PLSwC9DGQCDC4LjqIeW2ENE/wqiQr4d5Fd3Y5N1O7hRv6oN+1FCWjOUugNgkqNr/fZLL34h3EIGA+VfMZ3VeqoLoU9ulEgIdGY35BOE0WTsiF7s4jsRRUm7leAH0ZTF8siFmaDZ1cmj77UU6deFDgFdNm/ZOeBuYXYNOQP13yoODIHVSilBJ7uWjL02lgTNm4lQcR7M2NNbj7tS2pExAXE7JPxa5X6jVGgGhbbg+323zOpdF7oR1MvDMJuGZj4a4SuvIrgtDLZ0s/RRa+yHMJZHjkmBdaUJ2huzd8pixMKgSlYiWlvOCxQ4XfrXQW0IywKIpfjFjw6f/jA91eHSmrbwqeKS2hbRJ0OYCnmS4/ikNZ538NEAx7x3RltqYUzmIGK5hDf/dLCCa9TgDNh1peNoaC7tV3O6Lcx12gqOTo2KzHZufM/NiK5 X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(1800799024)(7416014)(376014)(36860700013)(82310400026)(921020);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Oct 2024 21:04:51.4699 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 571f49ff-d336-4644-2ed2-08dcf538ab0e 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: CO1PEPF000044FA.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB6327 Map RAS registers for CXL PCIe root port and downstream RAS registers. Refactor and rename cxl_setup_parent_dport() to be cxl_init_ep_ports_aer(). Update the function to iterate an endpoint's parent downstream switch ports and parent root ports. It maps the RAS registers for each CXL downstream switch port and CXL root port iterated. Move the RAS register map logic from cxl_dport_map_regs() into cxl_dport_init_ras_reporting(). This eliminates an unnecessary helper. cxl_dport_map_regs() can be removed. cxl_dport_init_ras_reporting() must check for previously mapped registers within the topology, particularly with CXL switches. Endpoints under a CXL switch may share parent ports or downstream ports, ensure the ports' registers are only mapped once. Signed-off-by: Terry Bowman --- drivers/cxl/core/pci.c | 38 +++++++++++++++++--------------------- drivers/cxl/cxl.h | 6 ++---- drivers/cxl/mem.c | 26 ++++++++++++++++++++++++-- 3 files changed, 43 insertions(+), 27 deletions(-) diff --git a/drivers/cxl/core/pci.c b/drivers/cxl/core/pci.c index 5b46bc46aaa9..0bb61e39cf8f 100644 --- a/drivers/cxl/core/pci.c +++ b/drivers/cxl/core/pci.c @@ -749,18 +749,6 @@ static void cxl_dport_map_rch_aer(struct cxl_dport *dport) } } -static void cxl_dport_map_ras(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"); -} - static void cxl_disable_rch_root_ints(struct cxl_dport *dport) { void __iomem *aer_base = dport->regs.dport_aer; @@ -790,20 +778,28 @@ static void cxl_disable_rch_root_ints(struct cxl_dport *dport) * @dport: the cxl_dport that needs to be initialized * @host: host device for devm operations */ -void cxl_dport_init_ras_reporting(struct cxl_dport *dport, struct device *host) +void cxl_dport_init_ras_reporting(struct cxl_dport *dport) { - dport->reg_map.host = host; - cxl_dport_map_ras(dport); - - if (dport->rch) { - struct pci_host_bridge *host_bridge = to_pci_host_bridge(dport->dport_dev); - - if (!host_bridge->native_aer) - return; + struct device *dport_dev = dport->dport_dev; + struct pci_host_bridge *host_bridge = to_pci_host_bridge(dport_dev); + if (dport->rch && host_bridge->native_aer) { cxl_dport_map_rch_aer(dport); cxl_disable_rch_root_ints(dport); } + + /* dport may have more than 1 downstream EP. Check if already mapped. */ + if (dport->regs.ras) { + dev_warn(dport_dev, "RAS is already mapped\n"); + return; + } + + dport->reg_map.host = dport_dev; + if (cxl_map_component_regs(&dport->reg_map, &dport->regs.component, + BIT(CXL_CM_CAP_CAP_ID_RAS))) { + dev_err(dport_dev, "Failed to map RAS capability.\n"); + return; + } } EXPORT_SYMBOL_NS_GPL(cxl_dport_init_ras_reporting, CXL); diff --git a/drivers/cxl/cxl.h b/drivers/cxl/cxl.h index 0d8b810a51f0..787688e81602 100644 --- a/drivers/cxl/cxl.h +++ b/drivers/cxl/cxl.h @@ -762,11 +762,9 @@ struct cxl_dport *devm_cxl_add_rch_dport(struct cxl_port *port, resource_size_t rcrb); #ifdef CONFIG_PCIEAER_CXL -void cxl_setup_parent_dport(struct device *host, struct cxl_dport *dport); -void cxl_dport_init_ras_reporting(struct cxl_dport *dport, struct device *host); +void cxl_dport_init_ras_reporting(struct cxl_dport *dport); #else -static inline void cxl_dport_init_ras_reporting(struct cxl_dport *dport, - struct device *host) { } +static inline void cxl_dport_init_ras_reporting(struct cxl_dport *dport) { } #endif struct cxl_decoder *to_cxl_decoder(struct device *dev); diff --git a/drivers/cxl/mem.c b/drivers/cxl/mem.c index a9fd5cd5a0d2..240d54b22a8c 100644 --- a/drivers/cxl/mem.c +++ b/drivers/cxl/mem.c @@ -45,6 +45,29 @@ static int cxl_mem_dpa_show(struct seq_file *file, void *data) return 0; } +static bool dev_is_cxl_pci(struct device *dev, u32 pcie_type) +{ + struct pci_dev *pdev; + + if (!dev_is_pci(dev)) + return false; + + pdev = to_pci_dev(dev); + if (!pcie_is_cxl_port(pdev)) + return false; + + return (pci_pcie_type(pdev) == pcie_type); +} + +static void cxl_init_ep_ports_aer(struct cxl_ep *ep) +{ + struct cxl_dport *dport = ep->dport; + + if (dev_is_cxl_pci(dport->dport_dev, PCI_EXP_TYPE_DOWNSTREAM) || + dev_is_cxl_pci(dport->dport_dev, PCI_EXP_TYPE_ROOT_PORT)) + cxl_dport_init_ras_reporting(dport); +} + static int devm_cxl_add_endpoint(struct device *host, struct cxl_memdev *cxlmd, struct cxl_dport *parent_dport) { @@ -62,6 +85,7 @@ static int devm_cxl_add_endpoint(struct device *host, struct cxl_memdev *cxlmd, ep = cxl_ep_load(iter, cxlmd); ep->next = down; + cxl_init_ep_ports_aer(ep); } /* Note: endpoint port component registers are derived from @cxlds */ @@ -166,8 +190,6 @@ static int cxl_mem_probe(struct device *dev) else endpoint_parent = &parent_port->dev; - cxl_dport_init_ras_reporting(dport, dev); - scoped_guard(device, endpoint_parent) { if (!endpoint_parent->driver) { dev_err(dev, "CXL port topology %s not enabled\n", From patchwork Fri Oct 25 21:03:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Bowman, Terry" X-Patchwork-Id: 2002643 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=amd.com header.i=@amd.com header.a=rsa-sha256 header.s=selector1 header.b=kOuBMm0s; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2604:1380:4601:e00::3; helo=am.mirrors.kernel.org; envelope-from=linux-pci+bounces-15361-incoming=patchwork.ozlabs.org@vger.kernel.org; receiver=patchwork.ozlabs.org) Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [IPv6:2604:1380:4601:e00::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4XZwP05Jmcz1xwN for ; Sat, 26 Oct 2024 08:08:20 +1100 (AEDT) Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 33FAB1F29C6F for ; Fri, 25 Oct 2024 21:08:18 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 69E6218BB90; Fri, 25 Oct 2024 21:05:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="kOuBMm0s" X-Original-To: linux-pci@vger.kernel.org Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2052.outbound.protection.outlook.com [40.107.244.52]) (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 3578F16A94A; Fri, 25 Oct 2024 21:05:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.244.52 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729890308; cv=fail; b=QETQedIYX+MosqRKHmhldQOOYapo5K/TMGq6rmtHZw4/ZiJrqIs6CFpBuebNu096y4a5TBrOkiQ0GpPzXVWT0xPc+9YT19qXxB3msv6+Jfrffslhp3uppZcihRozb57FVWo2BhjcB9KmkLUgn+W06J9UWkh3Onv2QOB1HNByFDc= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729890308; c=relaxed/simple; bh=QcAf1BuZDyCbH2DcyHI+FTUG9FefRJtXIB7thywpjdg=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=bXH61nc+fGUqWcNVnfb18N1YuqIqSAwXXwj03/n8uRQB/QOl248pYAIiyX/FZx4+MD4aoRfjSwJQ9IsvzoA55eksG2jB0snNpngu4esjaxHuA0mPvzz6hkZCILBeeAtMcserbLHtw0J1kG7Kx06TYP04lbK28uLlpqGvFzmzcf4= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=kOuBMm0s; arc=fail smtp.client-ip=40.107.244.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=rWYXkXCedlFV7IZ+jkZwTDIMAdKAqxnPd/wG5HLs/nwCv2iywtkQwDm4AgPt3g+6Oq3LCj0AMKdsbK8im2KNqCCjgIrxOUCU2ZW9XuOSLGePCnDyOLCW/C9XgrFv/9S2VCrmTr8l3DqniTZ/9yntxX/7oPDbzTTCQrEFM6gdpBEk/myoL1KX84N1LUcUWhUlDp+ftv78aIA4LYXyBoHLy02hiCAP/UEfHzpXDmFv1c9Lo6rWBYzEyxlZhN+99U3poFBQesXFZGj++ExYFtMkw08+50Nz1WHxcc3ra66E5f1ODZ1oLbwDykpVniwe5RuccqvynARdjdnyCyHarI+mMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=SMJOrvYxRIkiKfVAxbiFRGklKeHAZiPzwITeMhLfk+0=; b=cS+/UVON5XP5D9+Qiid9lAyrg+odmymWUzUSYokC0eS+OeIiRuLItT0LcsBwgYNrJPIEZtbMH++NMJVtGTEoDMCUR3SP2sKQN4B4N6wgK2FblwnKtKZMMJSZtP/rZqX4ssgDdYDJ97OXvjE8VJ1pJ4f109slY6y6yXiEB7yX6utn4vA8UOP15+0UWHpFzoV1XDoVO/fvHyWZjIQ51bSYXIFXafoU06e/OOOV4gGqNYh5M/ZC9IabefNO1Q3my+XUldygoMom+iZiuI8xHi8E6rWrHXlnrn3eHWGr1s1gSKETP70d8Zqu26LWFvShN0gIjqDwEmQyEAjC+QbszEkBUg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=intel.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=SMJOrvYxRIkiKfVAxbiFRGklKeHAZiPzwITeMhLfk+0=; b=kOuBMm0sv+YHm34ugnuBHCYjFehBjCr0jZdCMvQIN7l/ANquTJooDNgyvAhtEP0tLEGdWScJBXZC0CesJ+oWrg+yy1qOXhbzKChWIzb6+3vsTwbpkZ4xSONrcJASNYrVMwjL0y0XeFw5z5xlKhvLBVu4HXg+Re629DRJwQ2qgI0= Received: from MW4PR03CA0069.namprd03.prod.outlook.com (2603:10b6:303:b6::14) by SN7PR12MB7936.namprd12.prod.outlook.com (2603:10b6:806:347::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.20; Fri, 25 Oct 2024 21:05:02 +0000 Received: from CO1PEPF000044FD.namprd21.prod.outlook.com (2603:10b6:303:b6:cafe::7) by MW4PR03CA0069.outlook.office365.com (2603:10b6:303:b6::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.16 via Frontend Transport; Fri, 25 Oct 2024 21:05: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 CO1PEPF000044FD.mail.protection.outlook.com (10.167.241.203) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8137.0 via Frontend Transport; Fri, 25 Oct 2024 21:05:01 +0000 Received: from ethanolx7ea3host.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Fri, 25 Oct 2024 16:05:00 -0500 From: Terry Bowman To: , , , , , , , , , , , , , , , , , , Subject: [PATCH v2 10/14] cxl/pci: Map CXL PCIe upstream switch port RAS registers Date: Fri, 25 Oct 2024 16:03:01 -0500 Message-ID: <20241025210305.27499-11-terry.bowman@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241025210305.27499-1-terry.bowman@amd.com> References: <20241025210305.27499-1-terry.bowman@amd.com> Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1PEPF000044FD:EE_|SN7PR12MB7936:EE_ X-MS-Office365-Filtering-Correlation-Id: c9018107-609b-4da9-fee8-08dcf538b152 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|7416014|376014|36860700013|82310400026|921020; X-Microsoft-Antispam-Message-Info: 2USQINZotCBu9o2ZCzbKEveNx5jGk6M+2coMuL81hZpV1b6WmTFH8t1uqcyACyi3XJZH234Yv2y1Vxy2W0kGov3SNuuc78/I8NpGgLx7EVS2SycJIl0dkFAskxNUOC0KVGke9siftP4IglwR7/eRLNPBpCKLyovE5hiFf2Q1AmxlGo4+d2CPO+oNLHHupoFJxS0nB7ALPDOmQw+S61VYGjIZ2A4+vYzkI5449qAD4SRBnSKbjZXrg2DG9xcRTWXEslsfDovqyx0Ydp1quIf3HH/3apokG7SrD9BBxJCpPCoDrlEfVghNxy1pEfEePRPntiUrow2r/iSJoUdnyjtPb1IIP67Q5Yv8DrGWyibluRERtOHyvY+JOr3sIByUgiAO00lj9qaifabvu1ULEBS40GGsAINazU2DrjazFPPGrinz5gvDmO6HYK6xYvWjwJVjrNFI38ux49kvh3RO+Z1/V+dDovkP6SSM49/d0fXTfm9B2XBGJJBBIQ7kx2CKtfK8VlI/TwKjkxNmb1+Dsr764uF9oXFtrSPGHaRLnpC/Z9+ulNh/68xCNB1r6+D2YlpryI2YFPKpHJKBVsyy0BQohJc8djCwe3x1t6TBgVPfVXhowDtPCxFSyAhEqfp9W4eCw6zK2USH9o5Qt34BS5jjNp54AVo4xCzO6Lbc9g5tiAvOKGSTQe9m7flJR1BrTV+ojvBWKEprgvclEyFTlKHE3RoZh/dpooDJv+6DIY5QVudq1zGqjwi8CvMoxjHG0FYb4XbA4vpmS7oDLIag/4DV6ZfF3WzIIIcl9LdlNINcp2STiHPDwd4s1CbWxfmORy3mzbxERwGqU4Na7hWv+4pqqpzOSf25G8BxBU8CBYE38r1+67Iz7RpgXsPX6zWwRlTfa9I+WYZqZqTnHC4YZTv6boZs0vno5y1AkP3x6HYqVweSdYSuXUgZ6pq3uHzOv3alxnUYV1j/QRXcCOyebcc9g4W3hcdTuXZi17THFzl2cxO4By2C17Mkxaxd8MXtvLkPVsL/Q9YtA5I9UazfmwuMfyJdf+N6k9IxPNhKQH4oNzDOAcsRiEIXi4xiAldHllUnHMeKBFD0IVUSEu6yCoBqpdUIjW4cJz7Yo2CfRqUyoENLh/mmnquQGLbeFh2XPkb4TLnHUcetBJlKkMpdrWE0mYLj234NkHmUMiv3KV/jVkmaaXbqvjjS15G1zDQrJepD+uzRqz8cK0b6bt/GOAn6E8BYjEXUGfmXuaPpOFeGJV29SezZt8fbkI9qS/IOpkowpaOm57JH3vRlzkqGcNKHwU+/YhYx9hN7IRX1Fp3FsiaCHCcytIeF6ehFpm4l6GMPX5czzhXuU10WVsL+UZNvxO8/sYlzwkzoiUQ9Wo09WrHsXVL4CT+GwDGHnJHSg/tt X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(1800799024)(7416014)(376014)(36860700013)(82310400026)(921020);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Oct 2024 21:05:01.9872 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c9018107-609b-4da9-fee8-08dcf538b152 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: CO1PEPF000044FD.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR12MB7936 Add logic to map CXL PCIe upstream switch port (USP) RAS registers. Introduce 'struct cxl_regs' member into 'struct cxl_port' to store a pointer to the upstream port's mapped RAS registers. The upstream port may have multiple downstream endpoints. Before mapping AER registers check if the registers are already mapped. Signed-off-by: Terry Bowman --- drivers/cxl/core/pci.c | 17 +++++++++++++++++ drivers/cxl/cxl.h | 4 ++++ drivers/cxl/mem.c | 3 +++ 3 files changed, 24 insertions(+) diff --git a/drivers/cxl/core/pci.c b/drivers/cxl/core/pci.c index 0bb61e39cf8f..53ca773557f3 100644 --- a/drivers/cxl/core/pci.c +++ b/drivers/cxl/core/pci.c @@ -773,6 +773,23 @@ static void cxl_disable_rch_root_ints(struct cxl_dport *dport) writel(aer_cmd, aer_base + PCI_ERR_ROOT_COMMAND); } +void cxl_uport_init_ras_reporting(struct cxl_port *port) +{ + /* uport may have more than 1 downstream EP. Check if already mapped. */ + if (port->uport_regs.ras) { + dev_warn(&port->dev, "RAS is already mapped\n"); + return; + } + + port->reg_map.host = &port->dev; + if (cxl_map_component_regs(&port->reg_map, &port->uport_regs, + BIT(CXL_CM_CAP_CAP_ID_RAS))) { + dev_err(&port->dev, "Failed to map RAS capability.\n"); + return; + } +} +EXPORT_SYMBOL_NS_GPL(cxl_uport_init_ras_reporting, CXL); + /** * cxl_dport_init_ras_reporting - Setup CXL RAS report on this dport * @dport: the cxl_dport that needs to be initialized diff --git a/drivers/cxl/cxl.h b/drivers/cxl/cxl.h index 787688e81602..ded6a343c05e 100644 --- a/drivers/cxl/cxl.h +++ b/drivers/cxl/cxl.h @@ -592,6 +592,7 @@ struct cxl_dax_region { * @parent_dport: dport that points to this port in the parent * @decoder_ida: allocator for decoder ids * @reg_map: component and ras register mapping parameters + * @uport_regs: mapped component registers * @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 @@ -612,6 +613,7 @@ struct cxl_port { struct cxl_dport *parent_dport; struct ida decoder_ida; struct cxl_register_map reg_map; + struct cxl_component_regs uport_regs; int nr_dports; int hdm_end; int commit_end; @@ -763,8 +765,10 @@ struct cxl_dport *devm_cxl_add_rch_dport(struct cxl_port *port, #ifdef CONFIG_PCIEAER_CXL void cxl_dport_init_ras_reporting(struct cxl_dport *dport); +void cxl_uport_init_ras_reporting(struct cxl_port *port); #else static inline void cxl_dport_init_ras_reporting(struct cxl_dport *dport) { } +static inline void cxl_uport_init_ras_reporting(struct cxl_port *port) { } #endif struct cxl_decoder *to_cxl_decoder(struct device *dev); diff --git a/drivers/cxl/mem.c b/drivers/cxl/mem.c index 240d54b22a8c..067fd6389562 100644 --- a/drivers/cxl/mem.c +++ b/drivers/cxl/mem.c @@ -66,6 +66,9 @@ static void cxl_init_ep_ports_aer(struct cxl_ep *ep) if (dev_is_cxl_pci(dport->dport_dev, PCI_EXP_TYPE_DOWNSTREAM) || dev_is_cxl_pci(dport->dport_dev, PCI_EXP_TYPE_ROOT_PORT)) cxl_dport_init_ras_reporting(dport); + + if (dev_is_cxl_pci(dport->port->uport_dev, PCI_EXP_TYPE_UPSTREAM)) + cxl_uport_init_ras_reporting(dport->port); } static int devm_cxl_add_endpoint(struct device *host, struct cxl_memdev *cxlmd, From patchwork Fri Oct 25 21:03:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Bowman, Terry" X-Patchwork-Id: 2002644 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=amd.com header.i=@amd.com header.a=rsa-sha256 header.s=selector1 header.b=BOmPutbg; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2604:1380:45d1:ec00::1; helo=ny.mirrors.kernel.org; envelope-from=linux-pci+bounces-15362-incoming=patchwork.ozlabs.org@vger.kernel.org; receiver=patchwork.ozlabs.org) Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [IPv6:2604:1380:45d1:ec00::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4XZwPN28KXz1xwN for ; Sat, 26 Oct 2024 08:08:40 +1100 (AEDT) Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 306B81C224F8 for ; Fri, 25 Oct 2024 21:08:34 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 713F01FF04A; Fri, 25 Oct 2024 21:05:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="BOmPutbg" X-Original-To: linux-pci@vger.kernel.org Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2064.outbound.protection.outlook.com [40.107.94.64]) (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 4CB141D2B04; Fri, 25 Oct 2024 21:05:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.94.64 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729890320; cv=fail; b=Bmc8qH42IkdSpt+REUKgfkPc8XKAHgM1nQmumWByfkhiCPxCxFG4oV37gR/CceTa+lGUFslUFa5n7TLCgPthexYrNtYnZnCUvZ4MUqp526v40Q3b16Xbr2LJE0UxDnfdlqc32EVEUuasrsmO4GeUgQ/DZdCAgsM/V6X02aTOpcA= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729890320; c=relaxed/simple; bh=xMPqnjGySRkrlOppPyCgIEcNHzQg+tWfa8dlX+xpcIc=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=JHcordWzM2OZ+Bw/v+QIxtq+CzbKWY7mTZf+AgyLfh1bNfN7vOZerYPMGRR3cs5ZYxGsd4+cBwrE58jRh0KsUbyjQDQPQkv9V5S7Pt7Pfz4WBAyFduNFKS5BEiQQGIjFOonHhYAfXahyFAApc6PZX/LGzP/5/XiJttd79cKA2oo= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=BOmPutbg; arc=fail smtp.client-ip=40.107.94.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=IO27biXpXQLVgfcb4w4g2zzUE33sWBrJh0tkWH1RAfDyJILMO4xvkl2yNHGHjD3fZ3IDY1/EUKG20Ke5hgQWx8yt3RXKEuQRba1Gsuff5fF/MZGD60O4hunQZZLuMSuIU9dbb8Wtbek7rxtIBPLf3h+tiy9OnUtCKZ3jbW7jAemGLvF9tT+D/Z0ENKjlnQ0f42cdIXwis2/aNBEyycUfyT00HPV8pLgm+f7lXoSZJ8Q4fsGdDzHpKQqb4jI6H0OnFHi5xTHk0dp04qrFJzusddgH/JqD6pNE4Jmex09Qd/ZzhcC2htSqaIK8yWkwxJIFojX/Ei28emaCyikqOavNwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=fCcjp76MfUieof0YgM4NsZcJ6EOCvb3oRjqFA4i2qaw=; b=bHpzbfQaFstaod07IM04gsC4rJMr9Mu++imPp8fRXkVgy9PZIJOw7VC1ft1nJ1zSo5kZoHNQaz8S+aUpPhIGBkfkfySUfHLwoO+XcVocbDTTXD4aDJEBha60WpteyuOeCtSrpWTWpcHDV+gYneHcKxY9EAz0GI7s63Hwk/JqCypGUdowljT9n+xAWl/Yi9QePFzS15ZRXOvuAEHXcBo69AUJiB4EXw/ekq1YD+uLJlXySeZ9t/KDR5T38wWGhNL8oQTGNwlUKNbj/fjx8DFvt1SRHb/85NItossgonHY2pO165Fj/w2ssAfjtQWQADQL8IS6/dzZwu44aVqCFIwF2g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=intel.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=fCcjp76MfUieof0YgM4NsZcJ6EOCvb3oRjqFA4i2qaw=; b=BOmPutbgtn5tcdwM+avT2sKNPMwq2OK5ALObZUTurFIYjYXlzz0n8YB9V493fwkyPRxBj+9LrzHE4kNZcyKfy2cLSeE5rQtHLzu2o7cmFNqXl4nAJludXF0zhbu5WUVipDnKTMAf9bEwwAooTdRbIODnNlFj9tBUG7YH93ou2J0= Received: from MW4PR04CA0299.namprd04.prod.outlook.com (2603:10b6:303:89::34) by PH0PR12MB5680.namprd12.prod.outlook.com (2603:10b6:510:146::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.17; Fri, 25 Oct 2024 21:05:12 +0000 Received: from CO1PEPF000044F7.namprd21.prod.outlook.com (2603:10b6:303:89:cafe::40) by MW4PR04CA0299.outlook.office365.com (2603:10b6:303:89::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.18 via Frontend Transport; Fri, 25 Oct 2024 21:05:12 +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 CO1PEPF000044F7.mail.protection.outlook.com (10.167.241.197) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8137.0 via Frontend Transport; Fri, 25 Oct 2024 21:05:12 +0000 Received: from ethanolx7ea3host.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Fri, 25 Oct 2024 16:05:11 -0500 From: Terry Bowman To: , , , , , , , , , , , , , , , , , , Subject: [PATCH v2 11/14] cxl/pci: Rename RAS handler interfaces to also indicate CXL PCIe port support Date: Fri, 25 Oct 2024 16:03:02 -0500 Message-ID: <20241025210305.27499-12-terry.bowman@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241025210305.27499-1-terry.bowman@amd.com> References: <20241025210305.27499-1-terry.bowman@amd.com> Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1PEPF000044F7:EE_|PH0PR12MB5680:EE_ X-MS-Office365-Filtering-Correlation-Id: 744991a9-6ced-440b-1af6-08dcf538b77f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|376014|36860700013|1800799024|7416014|921020; X-Microsoft-Antispam-Message-Info: jcJWa8Gn/bOIyjV+6Wg0OVFW80g5TZBd5tQ9If60GjTf1LUi8OveisCeRBoofpDV0iz2+JkqQfuKqi8ITZuLduimtYob2lOU7x1M2/FEp4CMNNpzBfTuPyII3i4cQcX3L9sejXcdZK7bU53TpYwjruLtASHHBPNKJl7eomg1uhaci57aFLH33yRhyQFSSRumbOr5r0MA9oPSsNwm5pUViU/AAbi7iKiTW1V8j6C7wCg9sbhTvHxYzQZaV78uQkMGE50RgEbQiB5QJmR5waasAHaHwYYY65OAp1YtpMdumnmP0WbWqy6Wtokv0ucf80brx1u9h2E+4OH6V99KpayHiP9lVgafXez5hWSjdQl6fdnUXJTmGiVHxQ0gq+Bqba/VizkHR+Yx9Pk8eaAy3CokhpZNSAI4S9lVQWGT6wrkvR6ASIo8Yx3Jer+7SEyLhengPbUqjw3yGaUE0/5Ym1aoSeh1tLOBUSailA6iHACx8mZO3FPNgiDwygaK0wF2Du2izVWbaw7pisQcIurF/oIfuTqAYDGFQyf6EhCj5MM5jWfvyq7izWu6v+XA6dCuSFwERoVauWCAvkCU/dhaBV8odekcvKue3cYj9Yw72UZh0bLyJ5sscTg2EI/XixqFawY7Egs/1xfTLi6wPVjdSb5w3SYKjoosFw/gZfXun6Pd9vALrZmqCuffU5T93qEU/Aa587BOLo9xLdcAuW5al57nZpPjbT2Xx+CQpayMqsGHtbp357o9lzNkS0Bzt3wFFLG9PAx0ePmOl6xCmKTmgMnyGfB/C0dUjrMYUlfHpuEhr1xwIhHuX1pwhVbEKXvHUw/OaUFLlfQObRs2WlMR4C+u3rsiQiSN5EaT1jDNT9xMK1t8dDfNzlZHIgi/opm4SyjZTk8XTgT+oxlcsdpLfWyeYre8rHzv4v/Vpf8YTiAYRJwTPqaeSl3Vz4QBWE8bTjEcXLMmaps+579q0AH/cVNdEfJAGH62J54QLKTjiKuRcR0VNCy2DjCGz0FcdC7wttkmLUZiWk7D54n3OFCob3gBhyfaOqdzIkRK+9JIQjTwe02n3pW2uGJg+ftBstFFLFdb6GkDrsK8SdbyEHOWKT/n9iHvTcIQaQPMHxCZFksLvD2Ed6CR5eXQH0Jo6JEkNtjtpCEujy56q96nnhmzvo1RZZgF4yw3AGO5PhYwCc7xmWxGaLNUxfubJATYAqCSVJJkgp+xVJvI5ZI9Op0Y9y5papXq63iD7OsD4MIzvBwV18IRF7izGqZ3PlAwqnov9Jp0CE40Zmla0sZg5VBKW0owEK7TpYBn4LVNHoNhoiCIyxUR/a6vJag7DUYlkYW0vn8zAg69Rf6Pkjcy8ks/dNh8ijoi2GcHg6eJ/KIY4tvLDz00J3oq8aOnDa8lxqWdpkTn X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(82310400026)(376014)(36860700013)(1800799024)(7416014)(921020);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Oct 2024 21:05:12.3427 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 744991a9-6ced-440b-1af6-08dcf538b77f 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: CO1PEPF000044F7.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR12MB5680 CXL PCIe port protocol error handling support will be added to the CXL drivers in the future. In preparation, rename the existing interfaces to support handling all CXL PCIe port protocol errors. The driver's RAS support functions currently rely on a 'struct cxl_dev_state' type parameter, which is not available for CXL port devices. However, since the same CXL RAS capability structure is needed across most CXL components and devices, a common handling approach should be adopted. To accommodate this, update the __cxl_handle_cor_ras() and __cxl_handle_ras() functions to use a `struct device` instead of `struct cxl_dev_state`. No functional changes are introduced. [1] CXL 3.1 Spec, 8.2.4 CXL.cache and CXL.mem Registers Signed-off-by: Terry Bowman --- drivers/cxl/core/pci.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/drivers/cxl/core/pci.c b/drivers/cxl/core/pci.c index 53ca773557f3..bb2fd7d04c4f 100644 --- a/drivers/cxl/core/pci.c +++ b/drivers/cxl/core/pci.c @@ -650,7 +650,7 @@ void read_cdat_data(struct cxl_port *port) } EXPORT_SYMBOL_NS_GPL(read_cdat_data, CXL); -static void __cxl_handle_cor_ras(struct cxl_dev_state *cxlds, +static void __cxl_handle_cor_ras(struct device *dev, void __iomem *ras_base) { void __iomem *addr; @@ -663,13 +663,13 @@ static void __cxl_handle_cor_ras(struct cxl_dev_state *cxlds, 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); + trace_cxl_aer_correctable_error(to_cxl_memdev(dev), status); } } static void cxl_handle_endpoint_cor_ras(struct cxl_dev_state *cxlds) { - return __cxl_handle_cor_ras(cxlds, cxlds->regs.ras); + return __cxl_handle_cor_ras(&cxlds->cxlmd->dev, cxlds->regs.ras); } /* CXL spec rev3.0 8.2.4.16.1 */ @@ -693,8 +693,7 @@ static void header_log_copy(void __iomem *ras_base, 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_handle_ras(struct cxl_dev_state *cxlds, - void __iomem *ras_base) +static bool __cxl_handle_ras(struct device *dev, void __iomem *ras_base) { u32 hl[CXL_HEADERLOG_SIZE_U32]; void __iomem *addr; @@ -721,7 +720,7 @@ static bool __cxl_handle_ras(struct cxl_dev_state *cxlds, } header_log_copy(ras_base, hl); - trace_cxl_aer_uncorrectable_error(cxlds->cxlmd, status, fe, hl); + trace_cxl_aer_uncorrectable_error(to_cxl_memdev(dev), status, fe, hl); writel(status & CXL_RAS_UNCORRECTABLE_STATUS_MASK, addr); return true; @@ -729,7 +728,7 @@ static bool __cxl_handle_ras(struct cxl_dev_state *cxlds, static bool cxl_handle_endpoint_ras(struct cxl_dev_state *cxlds) { - return __cxl_handle_ras(cxlds, cxlds->regs.ras); + return __cxl_handle_ras(&cxlds->cxlmd->dev, cxlds->regs.ras); } #ifdef CONFIG_PCIEAER_CXL @@ -823,13 +822,13 @@ EXPORT_SYMBOL_NS_GPL(cxl_dport_init_ras_reporting, 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); + return __cxl_handle_cor_ras(&cxlds->cxlmd->dev, 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); + return __cxl_handle_ras(&cxlds->cxlmd->dev, dport->regs.ras); } /* From patchwork Fri Oct 25 21:03:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Bowman, Terry" X-Patchwork-Id: 2002645 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=amd.com header.i=@amd.com header.a=rsa-sha256 header.s=selector1 header.b=pw0dvQd4; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2604:1380:4601:e00::3; helo=am.mirrors.kernel.org; envelope-from=linux-pci+bounces-15364-incoming=patchwork.ozlabs.org@vger.kernel.org; receiver=patchwork.ozlabs.org) Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [IPv6:2604:1380:4601:e00::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4XZwQ4680Mz1xwN for ; Sat, 26 Oct 2024 08:09:16 +1100 (AEDT) Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 9491E1F2A4C0 for ; Fri, 25 Oct 2024 21:09:14 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D254F21B848; Fri, 25 Oct 2024 21:05:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="pw0dvQd4" X-Original-To: linux-pci@vger.kernel.org Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2049.outbound.protection.outlook.com [40.107.223.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C2831215C52; Fri, 25 Oct 2024 21:05:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.223.49 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729890331; cv=fail; b=ffxZwUq5gqCE9LOW3L4820pIML6SMMYr/y4IUMhgS/IKEB7kT/RUXqzPNI1yicD0yaHXnEu3BdbYagSq35KE7v4k0eO/uwIviZC0TSDB3KahQEnkNgJu+bYl39sKecxVaCDVs0i5Xhk+NzKj7QSkkfsiXQwi3qUdboQwBxukWkU= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729890331; c=relaxed/simple; bh=kTFGXrjGtDr14Ze9C1YsLS+2I9uGo4L3/doNRo0AhY4=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=YAoJui6mfp76kwHRWgSx9JBDrj0/9PtM7+R+EwPVDTFCdAk48LnkCZWPw1Xq3kyKNXeVQTWhZnvIuZSK06SEF44Rg+ujAaS6yJfcgJ0g5E5RffuIr9y6zIoJWW+6PJPcLNy9taavUrJgMW0u0UXBMvSh6/OkpAC3W8nsjlBF/Xw= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=pw0dvQd4; arc=fail smtp.client-ip=40.107.223.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=zUfCQILDmkJNYYyxuTc633fZW9a8UGGiTP2X8cu/+iHbqsJmuz3usE/giTHUBgpZMWFV0cl5o53oFgbRsQ6gWrz3rqlPYUfWT1G3Zy5n8SD9tycM+95XeHFPUg0ke5DMcKL0OBV6ZyMboHmfcroos8JyNYeUkA8mh/XFqffptGYA8P1g/MLmXHI2ND2rOq2oVB/OcIpRtCwGoSiCq5EEpEPrcEePZ+9f+tjqXmZRK7uMunjawlB8EVSBOtsPY2t5Nn7iau6oDF8XMjOcv6zyjdenPW/LS/52X60d+ItZpWHL3ka/CYbrqvsXGyhrJ+6FNZU9/AXa+2fPmX1RXjiNiw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=uIXbX+PP79KuODXXgLzFsESgnJddbJNI2TQr7VPs3gw=; b=gQqMo8xTCDD5TZcpSnbq5nERLvRNdPPT8p80axpN0qiBzGQ8z2QmO7fcNECmw6uS/VVTJXkOIKRvh/jZVGgEe614cYgd+3V4tE2rJf4nNLwe8F1qSke1IjfVc+yVA0NfSKbNVqxypE5zESUBpKG29Oi8zHGtKL6g8uMcg6z+ikb9Xi9yY45o9YoHBdu2FfDiUYNoTFjOjB506lCH5qoyCRjcAFTMNO0XxDewvHKdymjuzEkvbKRflS3MVFD3KxCvIOltIhnNIqFYsF7/CQ2EpBpC6ZGRPPnIJWkMdrg0vMoLid6TnT57/oUsFeH8BghVRjRH1o3CDtqOrUXXhT1FKA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=intel.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=uIXbX+PP79KuODXXgLzFsESgnJddbJNI2TQr7VPs3gw=; b=pw0dvQd41bZy40sbrvCpIp42Wskx29CofCFNPv0u7hFDY7wzzut8USH7Ibywn2XqRTZpHJdWNToZYPm+gBla5kepUAWauTr5koNMZddZlWDFKNoVhbCxImkYw/qwH9Sm5V9Zksj3b7V8IPhR3BKNRlP5gPiSyLGqdIj+gPmGkB8= Received: from MW4PR03CA0075.namprd03.prod.outlook.com (2603:10b6:303:b6::20) by CY8PR12MB8339.namprd12.prod.outlook.com (2603:10b6:930:7e::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.21; Fri, 25 Oct 2024 21:05:24 +0000 Received: from CO1PEPF000044FD.namprd21.prod.outlook.com (2603:10b6:303:b6:cafe::13) by MW4PR03CA0075.outlook.office365.com (2603:10b6:303:b6::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.16 via Frontend Transport; Fri, 25 Oct 2024 21:05:24 +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 CO1PEPF000044FD.mail.protection.outlook.com (10.167.241.203) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8137.0 via Frontend Transport; Fri, 25 Oct 2024 21:05:23 +0000 Received: from ethanolx7ea3host.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Fri, 25 Oct 2024 16:05:22 -0500 From: Terry Bowman To: , , , , , , , , , , , , , , , , , , Subject: [PATCH v2 12/14] cxl/pci: Add error handler for CXL PCIe port RAS errors Date: Fri, 25 Oct 2024 16:03:03 -0500 Message-ID: <20241025210305.27499-13-terry.bowman@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241025210305.27499-1-terry.bowman@amd.com> References: <20241025210305.27499-1-terry.bowman@amd.com> Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1PEPF000044FD:EE_|CY8PR12MB8339:EE_ X-MS-Office365-Filtering-Correlation-Id: 52d1acc1-700b-4a2c-c5cb-08dcf538be68 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|7416014|1800799024|82310400026|36860700013|376014|921020; X-Microsoft-Antispam-Message-Info: Wv8bViy98dwWCm2YToj0soiTQLJRfLCy/t7Fq8Z3aD7OJwefrVBfTfgof04fIbRAYbMdDl/FkvNk0ZdK4SUiJrqDQ4w9mwUNxlp3FgvtFe24hCuifBodspZSwY3XzPq89yoIBsSWoRdrLS7R2sU3Yw+0UF00JXZ8UOaoKX/8FJ89LlDCyv0/ci6Zf5syQBFqAg1WuCROcP0Xuy/Lyr/CyQeYebUeP/GoHwUOgtyl9UkojAUcsfm8G64UI/VGJr4FPeoGHPpb/FL/vuUHZp9KKecfspjwrQKQ9vn+H+IGz/W+IMJZ/1shkp2/cPMYAJb4DTL9MObLrBR/2Hni8dGvmCK7Gkt6y1UxlPrIK05bw4Y8SqshNPx3kwq6amfVgePKq4AYQjbXxMZN4A5XG4KjiGC+k5jfu/3T9Fl+UGZTi+b1KJObprspPpRqCtt1n0gM9nwfTvuKM4ivwTeyf2rEH99uFeiQ79A1cApNS+TfDG0kZ5WPIaVG7ZxOQWZweEhdH7pOpFvjb1g7axQMHA/zYywl2T3ZS92FzUa8jaDplPTJQCbgopDdLqgeVi8C8tQ6d4X9Vlv24YjKbv5VXjnvj2qPFqH/vPkP+02iz28061lwFVp3mCyVgfllpLuRxHdpK5qqN/VvUkHIoXKAiuvTw0sReMMm7xqjrjqAzomUAtVPYF251h19yRR1fLMsv7cLVCvBZRmv0RB0wwYYj+qhxkydrDecECy/hxV2xLj0LGZo4wgwZjgYoUea2MGswry7K+pMJvIGNhpytVPcHbbytrfI6NCk0kg+G5Wbbqr25V31pJLJwfQRFVydVjRR35TifscmL3JC7KY5Puw+k04w2vvrpaI64YETk2HzDddD7NXc3r0grxQ/ELwktRcy1TzsyjC9dRr2i2zZWHxKUepqliAbPxQIWXK+laOa9UYv83F9dyumahSSQ8nUgFf/MloOL2+lleeZzunbdCBcziMhe0GKfWq71/KBDpZvYkfEp/W/j+4jMLD65q5TX+OpjXalMs9CTnKxDoTv7PoY24eAydqomjc7EfF+aJeB8zrVZkrmQL2tGwvL179TcWZoU4jQ3myW5xfK9ag598JGY7vqpFn/faPi7LZ++tBvY1EWkPVmlIYePewIeDZ6t1YrEEJE3jypZMm9r9rnp6MWHoW6Xuh70c52/YuJnyW1icDvryvKqQaejYcQxndRpo43J7EuaTdOQ+apgPZREDRx8kvWim1yWhrOzfBz11ulRVDgS/0VGLrWdhsG0D+bpopu85AuoZjj0bhPNwV/zCrDYYnnWg7w8JHge7sHDNSKXP+Q1xlOYN9STrlpJmTuhNIZkw4Owzp8qUP8rEQ4nCyHhaGbvhf+fzq82VMy8nEYlGMwj2RL3j3ryPGh+3Vt6SrJXIry X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(7416014)(1800799024)(82310400026)(36860700013)(376014)(921020);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Oct 2024 21:05:23.9403 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 52d1acc1-700b-4a2c-c5cb-08dcf538be68 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: CO1PEPF000044FD.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR12MB8339 Introduce correctable and uncorrectable CXL PCIe port handlers. Use the PCIe port's device object to find the matching port or downstream port in the CXL topology. The matching port or downstream port will include the cached RAS register block. Invoke the existing __cxl_handle_ras() with the RAS registers as a parameter. __cxl_handle_ras() will log the RAS errors (if present) and clear the RAS status. Signed-off-by: Terry Bowman --- drivers/cxl/core/pci.c | 59 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/drivers/cxl/core/pci.c b/drivers/cxl/core/pci.c index bb2fd7d04c4f..adb184d346ae 100644 --- a/drivers/cxl/core/pci.c +++ b/drivers/cxl/core/pci.c @@ -772,6 +772,65 @@ static void cxl_disable_rch_root_ints(struct cxl_dport *dport) writel(aer_cmd, aer_base + PCI_ERR_ROOT_COMMAND); } +static int match_uport(struct device *dev, const void *data) +{ + struct device *uport_dev = (struct device *)data; + struct cxl_port *port; + + if (!is_cxl_port(dev)) + return 0; + + port = to_cxl_port(dev); + + return port->uport_dev == uport_dev; +} + +static void __iomem *cxl_pci_port_ras(struct pci_dev *pdev) +{ + struct cxl_port *port __free(put_cxl_port) = NULL; + void __iomem *ras_base = NULL; + + if (!pdev) + return NULL; + + if ((pci_pcie_type(pdev) == PCI_EXP_TYPE_ROOT_PORT) || + (pci_pcie_type(pdev) == PCI_EXP_TYPE_DOWNSTREAM)) { + struct cxl_dport *dport; + + port = find_cxl_port(&pdev->dev, &dport); + ras_base = dport ? dport->regs.ras : NULL; + } else if (pci_pcie_type(pdev) == PCI_EXP_TYPE_UPSTREAM) { + struct device *port_dev; + + port_dev = bus_find_device(&cxl_bus_type, NULL, &pdev->dev, + match_uport); + if (!port_dev) + return NULL; + + port = to_cxl_port(port_dev); + ras_base = port ? port->uport_regs.ras : NULL; + } + + return ras_base; +} + +static void cxl_port_cor_error_detected(struct pci_dev *pdev) +{ + void __iomem *ras_base = cxl_pci_port_ras(pdev); + + __cxl_handle_cor_ras(&pdev->dev, ras_base); +} + +static bool cxl_port_error_detected(struct pci_dev *pdev) +{ + void __iomem *ras_base = cxl_pci_port_ras(pdev); + bool ue; + + ue = __cxl_handle_ras(&pdev->dev, ras_base); + + return ue; +} + void cxl_uport_init_ras_reporting(struct cxl_port *port) { /* uport may have more than 1 downstream EP. Check if already mapped. */ From patchwork Fri Oct 25 21:03:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Bowman, Terry" X-Patchwork-Id: 2002646 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=amd.com header.i=@amd.com header.a=rsa-sha256 header.s=selector1 header.b=D3d8+qv/; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=147.75.48.161; helo=sy.mirrors.kernel.org; envelope-from=linux-pci+bounces-15365-incoming=patchwork.ozlabs.org@vger.kernel.org; receiver=patchwork.ozlabs.org) Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org [147.75.48.161]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4XZwQN0G5gz1xwN for ; Sat, 26 Oct 2024 08:09:32 +1100 (AEDT) Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 9901EB24513 for ; Fri, 25 Oct 2024 21:09:31 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DE3FA20EA3A; Fri, 25 Oct 2024 21:05:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="D3d8+qv/" X-Original-To: linux-pci@vger.kernel.org Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on2088.outbound.protection.outlook.com [40.107.96.88]) (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 A299B1B6CFE; Fri, 25 Oct 2024 21:05:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.96.88 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729890343; cv=fail; b=m6Nrkl1sZBSW8mTsEaGBFnDCTyFKU5hx92+S370kWeb830tHvbQ50pq/Lc8MmGefuw0IHnE1VNYSEmcg6kFrblkYTAgBAQ2Cw6j833HQVY0rfO7o1YKznuRYNw/J1FMrret8WPzb7CrL3aKXcFhRqXZ4FI9jn8H332v8VXxibGU= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729890343; c=relaxed/simple; bh=ejHoeT7Co2D/GMslgPzDJtkpzy8wQ7503exX6ezmgFE=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=chnqHXMWoBAUlNid1JoKig2CQq3Clgs6qd1Cr6Ki2evW/4t1yMUqAO6Fh0uc7Smjwb5sZ/HCVSofoJ2i6ShzL8RcKvcOsajTNGkGZ1+uAd+huRMTDSTIpVTtoRVuM8qo72SWpCzH70khj1Oou9xfjbprLThu8dgAuWcyDP2Out4= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=D3d8+qv/; arc=fail smtp.client-ip=40.107.96.88 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=tJyAHMvNAJ5DcUEfq3IIMv7AzPDtzIQP7fgK92W3oYrhYhmzrtlziZS0nJNaldcaVrxLWTbKJ2mrLjKPLsX4raj6cQDUMRFe9YTA6AL0bieMhc43Zuea0NMVqiB1JKIOmuWGKc/uHeQSvF9N+DHOHHqTLJZta2uu0iulmokjWIEPIZD/3cbX1HySsth21KPu43oDM20rTSYc4Bh19eIloOOEv5G9fySOAMBS4lBZh8so5xD2O/zI1BGnpWElbJtwC2bOfxcXk/jWWrak96Uf1tH44leVOoMV24II5SZioamsN6FI+bkhlI9l/DTc7p4cLv3m5TkUDTJ7IDm0IRbGvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=+UEomUt7HvgMyZTWsAD3mhbMMWljS13GXBCiD8enWxw=; b=erkBmtZzywjSCTLfqdj/ihYswf7vawdR1gJidR8pOyEiPpotNloILZC3zcULv5MYPhxpvf3CaOrE7prQYusX1wmZ28zBf8+pZY6+64WseKr9nhkLPENJTEBOvOGKUBK9mgdzzL6gO0rR3xsew4UJwrygKZ6myYiN3lJTo2J1+8JiZRJ6XX77R5kwEVCRC3jOxB46DqEe4QVjVPi9XL0KudvhCSK1tYaSIB6FCUUxIU4pIHUlvkrjjsIYZpuMi0vstrGKk2QOs1Vt7FwrjZ+aBjDlNuyONZXYIbk5JxxeAXxdnzfzlUrUabOsPoWmvG3gNY7Errdo53AdX5wJOdMkGA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=intel.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=+UEomUt7HvgMyZTWsAD3mhbMMWljS13GXBCiD8enWxw=; b=D3d8+qv/UGWQPg0kxfShc58pCmG5Fya3YLG1fKE3ufomqHF3+L2isMms1gcaqJs9nB2bKx1uhrs+jdAsBD+bnAC4JCyMfxakiEDTrprPG/xTuJLrTVRzj11QFWoAdwLxE/oaqYhnPyTWk4msO5cp2JdSiC/Hax3rl1H9vkOB6XM= Received: from MW4PR04CA0244.namprd04.prod.outlook.com (2603:10b6:303:88::9) by PH7PR12MB8039.namprd12.prod.outlook.com (2603:10b6:510:26a::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.23; Fri, 25 Oct 2024 21:05:38 +0000 Received: from CO1PEPF000044F6.namprd21.prod.outlook.com (2603:10b6:303:88:cafe::a0) by MW4PR04CA0244.outlook.office365.com (2603:10b6:303:88::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.20 via Frontend Transport; Fri, 25 Oct 2024 21:05:37 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by CO1PEPF000044F6.mail.protection.outlook.com (10.167.241.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8137.0 via Frontend Transport; Fri, 25 Oct 2024 21:05:37 +0000 Received: from ethanolx7ea3host.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Fri, 25 Oct 2024 16:05:33 -0500 From: Terry Bowman To: , , , , , , , , , , , , , , , , , , Subject: [PATCH v2 13/14] cxl/pci: Add trace logging for CXL PCIe port RAS errors Date: Fri, 25 Oct 2024 16:03:04 -0500 Message-ID: <20241025210305.27499-14-terry.bowman@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241025210305.27499-1-terry.bowman@amd.com> References: <20241025210305.27499-1-terry.bowman@amd.com> Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1PEPF000044F6:EE_|PH7PR12MB8039:EE_ X-MS-Office365-Filtering-Correlation-Id: 970caabe-ae17-4867-221e-08dcf538c689 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|7416014|376014|82310400026|36860700013|1800799024|921020; X-Microsoft-Antispam-Message-Info: pKurUUr4sDHAZfx1OePYXHAwZDoEPQWqipKuz6LPTXh8yJcYEJJIn0h8weay6EsM81Uo/QfDSBfJfKsuTnvZxLAFzp8vyq0NSs7K/72a+biIVPkpFdTIy9btIBB3y8vfZzJFdQimG5iMMMcG3BqcnWltRfygR+qUINUQX+KtSvUfYl4f8qkk8shXQTZQOKmK/UhpwPXHasEJjQaZOrFZCUWyuLKFJaegcN3vfFpLbxhbrAdF2I2qdIqXnt8iECwsQ8lAHDDeyItFv8ovY7phUCzrKYs2hhE8g5Hmiq6IIPyqB9K21GhHE/mEUK6MXj82xJr4vJUUw+ER/KgE3tYCLTsCRiCMmX9gMGz3IaimHE/Fxw4GMtpehkhLwfm6cUt7j9Ehum9qlgD9mFV4kEs0H9oBdYGS/4k1L/jhsFJVl4jdNswjuAwbUfmu0IuMn4u/+fPPtU9WhoXwOgdMEOHRBc0jrzzAhKsN3d0xdVFDVaAb0vomdm/PfrAOTXXKhrSWZ51tnbJnRjRY1ok/+NjrABjBDdHCot8clUP7eLhwgWD0sYN5+oyZYp/krxCFptZVs/t8VomVPC3YWTBuyrd0Fzy8OsRr5GgvS3rHqxCCKV8qJeWC4qh7v3b0UEA5yc1qkoNmGuejFozjzwuuWbG7vOZK48IimYhQVN///2ODv8b2+kd3hbVH8IT+F277tA6nHlnUQJqqN9R6Tt7JC9LMRJbtZLqURstztuJZZK7k8QSHBgwDeHGGoSqqrMBmZ3HWBSnsO97dpSeSaaPHngTSwxPLrVU4WrB5PpqPzRwIxe+MluSjHnNWlTj/K0S0Uv5tVie34bY/X0mGx5yThxafVUGbk4kDSFHH2YVuy0mD56jS9gb/I5tL37uxF3VVNwgQ5jimlGPHYrMFEsAsm7PyjzavTeFFFAObKJhYLteg4S4BAnxbD6DpBxH71tWX1s09n3h99CAcuMru7ml++gd2TEsbgNBrprjKwe1lfBt+OddubuGTb1rKRuyCHwWmRbLxdNsjamnvseW7ddeQARAvK3wVILea3LLME6XkwLJ3PhbXkMCvZI4hu7RYaKUi9IerDnofULndDRTCSM6enQQgqxTLkxQxeZtJ/ewqSuJXRF5I8kPylJNSMrjMXSV7GQR2FQHhug5SdlCzyZi6KxsSVAEHIGZ2ZOYnTE+/y7tddx1BQKxt/uIGHpatcaXEboIP6gRzfiQthDz1SvCCeqHdqjguVjHjdtglatAbq7HKJ/DdVMks8ZLJC1Ja77bIu4zYsdnt1RzXYjEdwWW7DgVBxUkxpBiPJRVztNPdb//zkZ+y4NeeXqKkQ4DTuWfkuNfrjySGrW19+TuOMkUzFm1yrOPY7WSCK1NMcREncOG5onJdShMiFM/HT7GK0ddCIqw+ X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(7416014)(376014)(82310400026)(36860700013)(1800799024)(921020);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Oct 2024 21:05:37.5742 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 970caabe-ae17-4867-221e-08dcf538c689 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: CO1PEPF000044F6.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB8039 The CXL drivers use kernel trace functions for logging endpoint and RCH downstream port RAS errors. Similar functionality is required for CXL root ports, CXL downstream switch ports, and CXL upstream switch ports. Introduce trace logging functions for both RAS correctable and uncorrectable errors specific to CXL PCIe ports. Additionally, update the PCIe port error handlers to invoke these new trace functions. Signed-off-by: Terry Bowman --- drivers/cxl/core/pci.c | 16 ++++++++++---- drivers/cxl/core/trace.h | 47 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+), 4 deletions(-) diff --git a/drivers/cxl/core/pci.c b/drivers/cxl/core/pci.c index adb184d346ae..eeb4a64ba5b5 100644 --- a/drivers/cxl/core/pci.c +++ b/drivers/cxl/core/pci.c @@ -661,10 +661,14 @@ static void __cxl_handle_cor_ras(struct device *dev, 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); + if (!(status & CXL_RAS_CORRECTABLE_STATUS_MASK)) + return; + writel(status & CXL_RAS_CORRECTABLE_STATUS_MASK, addr); + + if (is_cxl_memdev(dev)) trace_cxl_aer_correctable_error(to_cxl_memdev(dev), status); - } + else if (dev_is_pci(dev)) + trace_cxl_port_aer_correctable_error(dev, status); } static void cxl_handle_endpoint_cor_ras(struct cxl_dev_state *cxlds) @@ -720,7 +724,11 @@ static bool __cxl_handle_ras(struct device *dev, void __iomem *ras_base) } header_log_copy(ras_base, hl); - trace_cxl_aer_uncorrectable_error(to_cxl_memdev(dev), status, fe, hl); + if (is_cxl_memdev(dev)) + trace_cxl_aer_uncorrectable_error(to_cxl_memdev(dev), status, fe, hl); + else if (dev_is_pci(dev)) + trace_cxl_port_aer_uncorrectable_error(dev, status, fe, hl); + writel(status & CXL_RAS_UNCORRECTABLE_STATUS_MASK, addr); return true; diff --git a/drivers/cxl/core/trace.h b/drivers/cxl/core/trace.h index 8672b42ee4d1..1c4368a7b50b 100644 --- a/drivers/cxl/core/trace.h +++ b/drivers/cxl/core/trace.h @@ -48,6 +48,34 @@ { CXL_RAS_UC_IDE_RX_ERR, "IDE Rx Error" } \ ) +TRACE_EVENT(cxl_port_aer_uncorrectable_error, + TP_PROTO(struct device *dev, u32 status, u32 fe, u32 *hl), + TP_ARGS(dev, status, fe, hl), + TP_STRUCT__entry( + __string(devname, dev_name(dev)) + __string(host, dev_name(dev->parent)) + __field(u32, status) + __field(u32, first_error) + __array(u32, header_log, CXL_HEADERLOG_SIZE_U32) + ), + TP_fast_assign( + __assign_str(devname); + __assign_str(host); + __entry->status = status; + __entry->first_error = fe; + /* + * Embed the 512B headerlog data for user app retrieval and + * parsing, but no need to print this in the trace buffer. + */ + memcpy(__entry->header_log, hl, CXL_HEADERLOG_SIZE); + ), + TP_printk("device=%s host=%s status: '%s' first_error: '%s'", + __get_str(devname), __get_str(host), + show_uc_errs(__entry->status), + show_uc_errs(__entry->first_error) + ) +); + TRACE_EVENT(cxl_aer_uncorrectable_error, TP_PROTO(const struct cxl_memdev *cxlmd, u32 status, u32 fe, u32 *hl), TP_ARGS(cxlmd, status, fe, hl), @@ -96,6 +124,25 @@ TRACE_EVENT(cxl_aer_uncorrectable_error, { CXL_RAS_CE_PHYS_LAYER_ERR, "Received Error From Physical Layer" } \ ) +TRACE_EVENT(cxl_port_aer_correctable_error, + TP_PROTO(struct device *dev, u32 status), + TP_ARGS(dev, status), + TP_STRUCT__entry( + __string(devname, dev_name(dev)) + __string(host, dev_name(dev->parent)) + __field(u32, status) + ), + TP_fast_assign( + __assign_str(devname); + __assign_str(host); + __entry->status = status; + ), + TP_printk("device=%s host=%s status='%s'", + __get_str(devname), __get_str(host), + show_ce_errs(__entry->status) + ) +); + TRACE_EVENT(cxl_aer_correctable_error, TP_PROTO(const struct cxl_memdev *cxlmd, u32 status), TP_ARGS(cxlmd, status), From patchwork Fri Oct 25 21:03:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Bowman, Terry" X-Patchwork-Id: 2002647 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=amd.com header.i=@amd.com header.a=rsa-sha256 header.s=selector1 header.b=Xfuojr6F; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2604:1380:40f1:3f00::1; helo=sy.mirrors.kernel.org; envelope-from=linux-pci+bounces-15366-incoming=patchwork.ozlabs.org@vger.kernel.org; receiver=patchwork.ozlabs.org) Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org [IPv6:2604:1380:40f1:3f00::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4XZwQj027Yz1xwN for ; Sat, 26 Oct 2024 08:09:49 +1100 (AEDT) Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 8F8DAB2464E for ; Fri, 25 Oct 2024 21:09:48 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2E6DA2161EC; Fri, 25 Oct 2024 21:05:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="Xfuojr6F" X-Original-To: linux-pci@vger.kernel.org Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2077.outbound.protection.outlook.com [40.107.243.77]) (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 14BF120EA27; Fri, 25 Oct 2024 21:05:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.243.77 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729890354; cv=fail; b=rjbEU0b8nbHCZMBEzuM7u+mYWo6Mvx/uxWuxWE/0LhrRVaJ5giW9rsd963eefwSvSE9PKpP4prwr/kc3EbzeXpp3u3YOepsW3AUI6LDLrMHn5tCodwyQGbHkNKslQekoSM1siDWiTaBAVTn7uX5fH8DWOtX+tFSg8Im8EIwPu6c= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729890354; c=relaxed/simple; bh=QwmU4aamTKwOqXSIIHut5wxttWDNqtUGvIOD4OwpOnU=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Jj7UuQDVlsI7EyF3YcNKlQasEv13jIu1q7NMYjKwpiHuTlducR4ucgZmF7Th5c5E2syI9FfzsjVclyjlDjs4KzXw9wCwu1oIkA8T/Xm2q32Jes5Ld35MefbkEPnHxDTjaNMhokE2j3FjTnkzYVYf7SgdEZxzkkEFRJbcSyo3gio= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=Xfuojr6F; arc=fail smtp.client-ip=40.107.243.77 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=XwWtJKNMfS/04Wj+X/sSQrygvdlSSZ/pd4zuD5V+9Oq9kYjvzs3IOht2W/RYVa/wsn3mRq/ZUfXXd0FMCoy6sZlDQ7BwLolSxtmW9RZX/Nju+p4w2DREZw/w7eDGVP4pN4qut16sJcY04Drg1pwa0Xh3OZ4IOKTaN07sEXqsSxodDA3ajTkPBoaDOo26UznJzWG0oNK5dzot7BVzOuQoTeml1IHGOlC+OakiNqPLlG3HnnWGuUNAUk1Jo1X4R1U/8E0A5qS7wIsfNZWB7t3YwxO1XvqfmRZoE1rixS34OKUngEl+38W3HU4WG9l3YOH8a1rRDktzTxitDpZu23h4jQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=PkHkW2x6pc1dmmvxlTCsggWBfgCbm/GbyOOLZ6im680=; b=elCvVCCWQTOTm93r1WwW+R+rQW+dEVe5Kmw09SXs9xCL2Q1UvpSwkfvDpLIJVIsRD+kXigsm4a55pAOJ2etY71sS/xrehtJnVlVucBIq2xcHjuP8WbQC+COnoOJuImCq7qJuEtDIrK9zMQNkNA0Nb9GLuFC2+srsaKg1yTXI0LDP+ODQ480/cpEtgwkrL+ZSKdVu5U2vQpVZ2J7IdwSFVYzmEJj3M/eUWbB+LVLIhaibEUbdctDarzbeSbEyY0GcrNAJbY9WFs80rXzuPRZp5alhCGXvpAlaE1Rys+H+sZzU4KTbtJaj4nNmjPLV0hLmLrtLlzoTwYmI5o74ug4C9g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=intel.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=PkHkW2x6pc1dmmvxlTCsggWBfgCbm/GbyOOLZ6im680=; b=Xfuojr6Fp0vhWVSK2DqDbKqGzeqEyCcjnpbAduueVjAPvvdfjO+PtyTnJzHzP/++tDvXoZ3UwnnhXe629cz2sGBx276FYuo9x8ZZshpNUPZnVXYSC/G8FtHm00DCct1IITyqXK/KLvG5NtL/HcDFW3Hf6HE4GYWeCkLHZigrcoI= Received: from MW4PR04CA0296.namprd04.prod.outlook.com (2603:10b6:303:89::31) by CH2PR12MB4327.namprd12.prod.outlook.com (2603:10b6:610:7d::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.21; Fri, 25 Oct 2024 21:05:46 +0000 Received: from CO1PEPF000044F7.namprd21.prod.outlook.com (2603:10b6:303:89:cafe::22) by MW4PR04CA0296.outlook.office365.com (2603:10b6:303:89::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.21 via Frontend Transport; Fri, 25 Oct 2024 21:05:46 +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 CO1PEPF000044F7.mail.protection.outlook.com (10.167.241.197) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8137.0 via Frontend Transport; Fri, 25 Oct 2024 21:05:45 +0000 Received: from ethanolx7ea3host.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Fri, 25 Oct 2024 16:05:44 -0500 From: Terry Bowman To: , , , , , , , , , , , , , , , , , , Subject: [PATCH v2 14/14] cxl/pci: Add support to assign and clear pci_driver::cxl_err_handlers Date: Fri, 25 Oct 2024 16:03:05 -0500 Message-ID: <20241025210305.27499-15-terry.bowman@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241025210305.27499-1-terry.bowman@amd.com> References: <20241025210305.27499-1-terry.bowman@amd.com> Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1PEPF000044F7:EE_|CH2PR12MB4327:EE_ X-MS-Office365-Filtering-Correlation-Id: 6a0fa4dc-03c6-4606-2fce-08dcf538cb79 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|376014|7416014|36860700013|82310400026|921020; X-Microsoft-Antispam-Message-Info: pvAbYul0Tz640cwlwg5vAlhTNwn+u2lb8l76RVKhNlS1vGXAvXXDURoCNneoob68edNM5oiXnjNzOC0pi2EllbqsJHSS8oV3YVi/Hv0E40Atz6dmnhop/7ON+p/12k1DZToIZYlzQmlPTPup9BtDyME1vIPmDKvSDx6vXELyxqQKWk1fIjcf2Y/yE0SuBeqIoa4k+XXnOTZaTli6zl6kW9htnKK9Crnrg74UMxmCkB19wz5Y4aaEnog++7/gi7WsYCVNxDtiivcBW9htiZVAlNaGZiICLeMCEnjP3fQsLdLK9alJ8CMiSE08EvdOmpL2bPt8MoGcJtY5znFi88x+TSD5kfq9E/uMEltdUWSA7cBOfdSTXNG4Eos7d8D6WjV4eQ9jmCpRWsIOYtDx35I4rfUAX3mfjYp9fCCj5Ds6mS3bgsbwBD9VD+JDutKDkQNrHvKpvXAW0adwl2ko6O7yT9wIFImhrW0u46PiFCY/ckIZuonaA95fPykMekNVyT4pxSdNr6Sc2OOLAlLlIOO+I1A035BYngV1v2sM1oxrxBgBkVL8Q3pR1oy5Iybat05O3I0ck4wcDPwpyH18/4OVpayhWsXeAOSZVXRakYB4ZVEbElqkBqKfDih8uIPaDwBhkSCH58oUVoSN9Oy0goUEOdHQSxX/zyu58RjHYwMlPiHuxsJgXR/LOKLEbNeWGyPsc09clnL2x900AR9YRe66n0WuKYsBTWLMZoHEIbUZWzJk+8tH0qwSPtJ1550KioSVVEy9ECNyJ1Z1841RkFI2mMsC/We0nc6tPguYJp/Ahn0vV7fQQf2PdulFzq2EIMjflqRyswfTzW8wVjyzincI5iXT32kQ3TPYK+9YTIMsjRI56QG1mo/EH9M59k5xyDY/gItZc9S3Kz8/7KZ9TIgwr8I4yKyly6i+HUcG35qQvFjNa73QLl+B/BDsJY8ylVusSvMtb7J76Sl+jA+VIflbUkdH+kHgLp8LLCDEbnYkVes6ZOXoLfkC1g/P4E4bQOUJejER+Cr7RNRUR8RRN/DRgp7qCsaCzkVE7QfDxIqC9uZTFozs3g7wAW27mizH3yVGcRaOXIDNxBlzBKqemgrSy0eA6AParZiT++2jX0l00dNIpWl3pGGlFFJJxPe+H6Umt5Ao+H7QN+oZQC0b2g3471zkr7pHGcLueFMvEtQSNDpFwej27mS1ImpgUHCT83j/Af6k142SUrOaAtbxl3P0x9rAt5rpGy7ZaSEVuU6vL4w9CcNQvmrkWsLJsDLGFUwgLjiUCZpXQ9Lx5Nwe3n7/Ttroom+f44IGqr4GQ98ULqVXc608lorClO7vt3pCTXp08YcRVqD3i99T6fshNIbwZHb0eCqwb5TU3Npd4qYhB8JNJhPcsABvEmOtT13XVeQB X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(1800799024)(376014)(7416014)(36860700013)(82310400026)(921020);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Oct 2024 21:05:45.8583 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6a0fa4dc-03c6-4606-2fce-08dcf538cb79 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: CO1PEPF000044F7.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR12MB4327 pci_driver::cxl_err_handlers are not currrently assigned handler callbacks. The handlers can't be set in the pci_driver static definition because the CXL PCIe port devices are bound to the portdrv driver which is not CXL driver aware. Add cxl_assign_port_error_handlers() in the cxl_core module. This function will assign the default handlers for a CXL PCIe port device. When the CXL port (cxl_port or cxl_dport) is destroyed the CXL PCIe port device's pci_driver::cxl_err_handlers must be set to NULL to prevent future use. Create cxl_clear_port_error_handlers() and register it to be called when the CXL port device (cxl_port or cxl_dport) is destroyed. Signed-off-by: Terry Bowman --- drivers/cxl/core/pci.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/drivers/cxl/core/pci.c b/drivers/cxl/core/pci.c index eeb4a64ba5b5..5f7570c6173c 100644 --- a/drivers/cxl/core/pci.c +++ b/drivers/cxl/core/pci.c @@ -839,8 +839,36 @@ static bool cxl_port_error_detected(struct pci_dev *pdev) return ue; } +static const struct cxl_error_handlers cxl_port_error_handlers = { + .error_detected = cxl_port_error_detected, + .cor_error_detected = cxl_port_cor_error_detected, +}; + +static void cxl_assign_port_error_handlers(struct pci_dev *pdev) +{ + struct pci_driver *pdrv = pdev->driver; + + if (!pdrv) + return; + + pdrv->cxl_err_handler = &cxl_port_error_handlers; +} + +static void cxl_clear_port_error_handlers(void *data) +{ + struct pci_dev *pdev = data; + struct pci_driver *pdrv = pdev->driver; + + if (!pdrv) + return; + + pdrv->cxl_err_handler = NULL; +} + void cxl_uport_init_ras_reporting(struct cxl_port *port) { + struct pci_dev *pdev = to_pci_dev(port->uport_dev); + /* uport may have more than 1 downstream EP. Check if already mapped. */ if (port->uport_regs.ras) { dev_warn(&port->dev, "RAS is already mapped\n"); @@ -853,6 +881,9 @@ void cxl_uport_init_ras_reporting(struct cxl_port *port) dev_err(&port->dev, "Failed to map RAS capability.\n"); return; } + + cxl_assign_port_error_handlers(pdev); + devm_add_action_or_reset(port->uport_dev, cxl_clear_port_error_handlers, pdev); } EXPORT_SYMBOL_NS_GPL(cxl_uport_init_ras_reporting, CXL); @@ -865,6 +896,7 @@ void cxl_dport_init_ras_reporting(struct cxl_dport *dport) { struct device *dport_dev = dport->dport_dev; struct pci_host_bridge *host_bridge = to_pci_host_bridge(dport_dev); + struct pci_dev *pdev = to_pci_dev(dport_dev); if (dport->rch && host_bridge->native_aer) { cxl_dport_map_rch_aer(dport); @@ -883,6 +915,9 @@ void cxl_dport_init_ras_reporting(struct cxl_dport *dport) dev_err(dport_dev, "Failed to map RAS capability.\n"); return; } + + cxl_assign_port_error_handlers(pdev); + devm_add_action_or_reset(dport_dev, cxl_clear_port_error_handlers, pdev); } EXPORT_SYMBOL_NS_GPL(cxl_dport_init_ras_reporting, CXL);