From patchwork Mon Feb 26 15:29:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yazen Ghannam X-Patchwork-Id: 206745 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp2151415dyb; Mon, 26 Feb 2024 07:30:28 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVHsnoFT61FiAugyiq2Bhd87dSvVvdcbAgWmUufjZ8FUUriJ5pLqS/mOmf18MZYzr+gxeX/bj0Ks2daO3niiHQvdVWV8Q== X-Google-Smtp-Source: AGHT+IHdNdogg07yTJl6T+VvH4+iCf7CNTJdxHVyux6Ea7hmGlKZmHDmSRv7BTPmz5tOif93p3K0 X-Received: by 2002:a17:906:694b:b0:a43:adc:7220 with SMTP id c11-20020a170906694b00b00a430adc7220mr3295125ejs.8.1708961428177; Mon, 26 Feb 2024 07:30:28 -0800 (PST) Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id f18-20020a17090624d200b00a3f5dbc89b5si2256457ejb.325.2024.02.26.07.30.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Feb 2024 07:30:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-81806-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@amd.com header.s=selector1 header.b=o2fJMto6; arc=fail (body hash mismatch); spf=pass (google.com: domain of linux-kernel+bounces-81806-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-81806-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com 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 9FB8E1F22544 for ; Mon, 26 Feb 2024 15:30:27 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 131E312BF03; Mon, 26 Feb 2024 15:30:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=amd.com header.i=@amd.com header.b="o2fJMto6" Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2089.outbound.protection.outlook.com [40.107.93.89]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 634E44437; Mon, 26 Feb 2024 15:29:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.93.89 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708961399; cv=fail; b=PzWz4Rg4o2yPbZIval26qz6wph8VHGr3Es0Z6zHIj3d3VXZQALVfGMAlMHtwS5VBQxX4z18BXTVcB+/IsLlTGELywXliZk/BKPZ9K/86eAINVz7TzOsHNHrQONwN96aFC5ZK6mX1APU+UTWbU8vz0pdRyS5AlPoTOt3CzMC9osA= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708961399; c=relaxed/simple; bh=CZ9B5aDx6l9+235keTD7e4ysYo5zBFRaOArBl4Ctmrc=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=AkbTDyEXB2UsPfy+bDz9yD+kSPKiz3TWehLm5XG0fMzIrmGQje1M4TSuWzO7D8+2wC6QFKVTe19ptDctVlugJfM0NrKKovgsM/7S2mZdu6My4CUrZnct/EKQWsVJAjzb/cF0xt7XWcLNfHEp72DKbCJ8Os93M5xrN8eSLEdb+lw= 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=o2fJMto6; arc=fail smtp.client-ip=40.107.93.89 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=M/OpBAuM9u/km7DdLRNc8iNR16FKzBjq6IyQNpY0cdxLzPssuw1ewfNHrMzy5/OqjNV+UqvOqDl6dcvay0kq43jSxeHTEvdxt0ERU82PNXCJDdHCDgRhj8j+9uC4oMRGF10eGZdqyaaIZykM8jOlCtkYu4BFZkxchPL9CxvJBjzh99KZ4xkkYCbtcdEYyMtAKGH9evhnvRgNxZe37xfJ5NkJGMpOZ3osq9n2Zee1ZGUWMfG0kRpx6nBDg1tiFwBU/RM7qUxnTyXr7IDaUGVoJS3ia61jFjunYep+ah6mlGlMg61OjuTvimYsc/77rYf6JYQEyAMhB6r8KIQ+cZX3ig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=TyXhMVyv4gwcxUsD6b+bkksiQ8IvIdgTZcLZg/84MFk=; b=AqhG7jln+GaKRjobOgWoBaiVAc2m7gj0kKavRUu16jL0k2MRmez2nAU3TDWVw0/BJsJYIoN0l+WbIJWi9okPafu6QqK5HqMghtMfJLFMfW61XiXYFxqMezrnNzdL2R5+yZsRoH+UCtaqP+KrREXpyPknHsH6ynXTDs5J5GR9tfaM8LCzgSVffgO0XH5v7Cp0vfA0puBuREJdUWtOq7+pjOk7wp/cyGAF5lJ3eNgnwm809Aa6qrfDDj7F9/+OeGTB1MVVIqwz2z/ySGFy94uTJxwc25KmQqoS2kdYYTr7FkO+PXfSLtFuVqEhRPdUl4ljxWeLOPeLWxW0pmQvc4f0oA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=alien8.de 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=TyXhMVyv4gwcxUsD6b+bkksiQ8IvIdgTZcLZg/84MFk=; b=o2fJMto62ItkRyVMIWYG899RZbb2ZLNmNfVY3INL4++fcVr9cT4G2vZi3h88SJCANTkaFGLQXQbPpMtN0AlooIbbFu4k/IdEB0T8dhWsX/3CiKY3iCzUPxMFQHhORZ1v27qQC+z0X11HaD0hgOseLOp6NvuRqTg7q65E3xpeqj0= Received: from SJ0PR03CA0373.namprd03.prod.outlook.com (2603:10b6:a03:3a1::18) by PH8PR12MB8431.namprd12.prod.outlook.com (2603:10b6:510:25a::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7316.33; Mon, 26 Feb 2024 15:29:54 +0000 Received: from CO1PEPF000044FA.namprd21.prod.outlook.com (2603:10b6:a03:3a1:cafe::df) by SJ0PR03CA0373.outlook.office365.com (2603:10b6:a03:3a1::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7292.49 via Frontend Transport; Mon, 26 Feb 2024 15:29:54 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by 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.7362.0 via Frontend Transport; Mon, 26 Feb 2024 15:29:54 +0000 Received: from quartz-7b1chost.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.35; Mon, 26 Feb 2024 09:29:51 -0600 From: Yazen Ghannam To: , , CC: , , , , , , Yazen Ghannam Subject: [PATCH 1/3] RAS: Export ras_debugfs_dir Date: Mon, 26 Feb 2024 09:29:39 -0600 Message-ID: <20240226152941.2615007-2-yazen.ghannam@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240226152941.2615007-1-yazen.ghannam@amd.com> References: <20240226152941.2615007-1-yazen.ghannam@amd.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1PEPF000044FA:EE_|PH8PR12MB8431:EE_ X-MS-Office365-Filtering-Correlation-Id: e2d1a1ff-61ae-46b5-e723-08dc36dfc83c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: CuD5kJJGfw5pUdrXNshtLlFLroqhP8eVct0QOBCv/i/R2vrot0iKQzYqy0LAXjuF/gfXkj3J1M9RPWguvh2obKXIZwy3EtmwoHjozHtbCylxvO3qmKCV5aNwmIf8axkNZuojS4hzZsbF7NsRJXeE0810yVISt2F1nz6HpFI1SelzWRkg1gm4ZMr7tLbQNiihC9peA44Y5mW506ChPY8C1KdD55PSLE952wLDX25ciOvMbv4dNgZn+RWBRIpHXuCsZg8wRujU6xAZI4FjxvBuvhKNd+zpQm+D0QIus1cLWgwcg+8zLSrGqF9aRgArAQSQuVfVxYguWkEw/MK3NlDhNR3KEG7XhDJwFjVY9GQIXU/jA8cAwK13u1/rrs7UMinhcGYH6bLcPDJF9nQJvhC60LlitSAuoZMskjNosmsBgbTfDYZk4osHgAMYvwvO9GVW4BaddhIPvfL9CGu6Ofw8D91gRG5UAWPQgOqDrQGQZyrWm/xowd07Fn2qo4nDUgZGwz2RnYO8NpezUqmU+wzNsPIpNeSpKMEL+W+Rpb/sJrR/0LukQeSQkZiaNjKuHWmMvC1Qzpct2LjkIR/9IE+KG/U4GcaoxbUItSPnHrQnloap4THiZqczAG+TOHuL53P4W+P1+hdGIPSqhFfiem9ZyHBIxEIggBbXugrDCD+RXVphN6PiTQKYCSG6rTwZVSFV3NZVUJ5Y05hGGUiYWZVis2wEtq7nPcXXk6zmj32aMpXy64uvsY0ahLAqz+yxZtoa X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(36860700004);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Feb 2024 15:29:54.3090 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e2d1a1ff-61ae-46b5-e723-08dc36dfc83c 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: PH8PR12MB8431 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791975938345957033 X-GMAIL-MSGID: 1791975938345957033 ..so that RAS modules can use it. Signed-off-by: Yazen Ghannam --- drivers/ras/debugfs.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/ras/debugfs.c b/drivers/ras/debugfs.c index ffb973c328e3..fd3d4595c122 100644 --- a/drivers/ras/debugfs.c +++ b/drivers/ras/debugfs.c @@ -4,6 +4,7 @@ #include "debugfs.h" struct dentry *ras_debugfs_dir; +EXPORT_SYMBOL_GPL(ras_debugfs_dir); static atomic_t trace_count = ATOMIC_INIT(0); From patchwork Mon Feb 26 15:29:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yazen Ghannam X-Patchwork-Id: 206747 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp2152574dyb; Mon, 26 Feb 2024 07:32:06 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUJm+v7Q03KyOqD5HdcKoIcpZRlJ2MbWaHHtTU/TGBnFRfUUfZxc9cLUTC5oO5SGjzMauJa8VDNUT9ek768x2sB9lp3KQ== X-Google-Smtp-Source: AGHT+IGU9oG/JdAlYloCL6VoLDVF8ovg2kGWmUozcDr1LUcY7mmAZ6NuIDrpHtzeeypDv3vlGC3Y X-Received: by 2002:a05:622a:1346:b0:42e:802b:32b1 with SMTP id w6-20020a05622a134600b0042e802b32b1mr4698889qtk.23.1708961525792; Mon, 26 Feb 2024 07:32:05 -0800 (PST) Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id fy14-20020a05622a5a0e00b0042e823ff1b1si3006787qtb.781.2024.02.26.07.32.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Feb 2024 07:32:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-81809-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=4Prv1yUv; arc=fail (signature failed); spf=pass (google.com: domain of linux-kernel+bounces-81809-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-81809-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com 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 4791A1C2B235 for ; Mon, 26 Feb 2024 15:31:14 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7548912B159; Mon, 26 Feb 2024 15:30:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="4Prv1yUv" Received: from NAM02-DM3-obe.outbound.protection.outlook.com (mail-dm3nam02on2069.outbound.protection.outlook.com [40.107.95.69]) (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 1436F12BF04; Mon, 26 Feb 2024 15:30:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.95.69 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708961407; cv=fail; b=E/ssLU2EUHbaoBV3iVx1J3p5sISVvuHJ8+akFniwbWqe2zPCTutZW0P/seTfjyCmrSMCBlPAdIkAA2DliyhpXNRM0KYjlqtF88x9crFexb9+Oz3Gk+CIbyPQon5Ce5vvoGXHRPEgahSePwILI6IfXP1xvN6+xFqR7bRTRI6iA1A= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708961407; c=relaxed/simple; bh=O2DaZKUVdJdHfqYpsi8cYS07DrBogz2tu9421v2kQuE=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=BxFDPz2cGBGm2GmMDMAjTy6/HyfFEFIIYb75JVeB8kt+HO3o3oNvAIFtRLSfhfb4hzCPA6WepDzxvqBS5gM0mb1DU7HXxxLJj7if5A9tigMK5qrSSrMVGj3g3d6xIdHj64PBnoCJ+BtUf33YsLhDc/308I247dvPkGl6Ezbr+bI= 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=4Prv1yUv; arc=fail smtp.client-ip=40.107.95.69 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=arcselector9901; d=microsoft.com; cv=none; b=AqVG6VV000yJPQftdBl419cFKUnm0vMaVLAdmWmOsEX/Erys/NehTUYD8beJ6UawdkzJaR8CWUMoID8MiF5FKrdVQAj3AgEffkeEMUeDqhcjFENS82LRCM5JTYUPWai1f12mnvkVnXLeUNTnk0pjRFB/ajUuzAm5Jw+PuMnUuJZJYrl5TilXmX8PZPaeSowKBnyLfm6QDjBXtLISV2Ko8vjcy+s65lEApAAtno/2iJ4tlCDAEbT3RRFr0DFZDvsBS6MqU7vB5bSRyfwnkAoORrMnCz570O7TvvFX4aSXiN3S3mjcSJPNIFUa7uAgp0CIVPXOPDThf/tKhRJYduAR3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ly228eJ8AZmumPzBOy+HtVxFu7gzrh1aPSEfBgI1m6s=; b=SPlzADJDEAAVwAGY7E8lgOa88fdKqGCAt+ZkM0LEc5ilCBlsubAD07YzxYC1hBj0aFolCuFm8e40auKyZgad4RNKlx9g4zJrcpIWaARcunnsxV+xOjMhFTX71XSGfs3gSbFQTVWRu6ns/BOdJNL8RK/Wz97RcFyXS8mrMLQskrvU3U/a/SX13hnt0dAtOPyCcwI2GPCaYJrBBp6I1sqnqrjldx7ZsCs4ktOfm/bDbSOb8kOYsidDQgEkGcLaQqhWSfnoIcr+ZSxHhhLFhR/I7ebsrFhz0cxFNHT2QQ9AQsaDQppm5acl/wacdSa9Vsf22Y2vCYv1Sv/Is5AmEqpa1Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=alien8.de 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=ly228eJ8AZmumPzBOy+HtVxFu7gzrh1aPSEfBgI1m6s=; b=4Prv1yUvG212E4xpTKqA6g51UjgAFjNKpmXJ6hGj79p+IGeadK0/F8T5DzGbRgjd273yewKcX1fpocJgDy+zE/kMjQyhTOL06ALCQZGKjDoqhEhXhGrFFq1bQbThrTNfFz2FssQ4v2XdGfwxdtvpckOPFOW3hjREq3FMSS8Q00s= Received: from SJ0PR03CA0384.namprd03.prod.outlook.com (2603:10b6:a03:3a1::29) by IA1PR12MB7591.namprd12.prod.outlook.com (2603:10b6:208:429::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7316.34; Mon, 26 Feb 2024 15:29:58 +0000 Received: from CO1PEPF000044FA.namprd21.prod.outlook.com (2603:10b6:a03:3a1:cafe::93) by SJ0PR03CA0384.outlook.office365.com (2603:10b6:a03:3a1::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7292.49 via Frontend Transport; Mon, 26 Feb 2024 15:29:55 +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.7362.0 via Frontend Transport; Mon, 26 Feb 2024 15:29:55 +0000 Received: from quartz-7b1chost.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.35; Mon, 26 Feb 2024 09:29:51 -0600 From: Yazen Ghannam To: , , CC: , , , , , , Yazen Ghannam Subject: [PATCH 2/3] RAS/AMD/FMPM: Save SPA values Date: Mon, 26 Feb 2024 09:29:40 -0600 Message-ID: <20240226152941.2615007-3-yazen.ghannam@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240226152941.2615007-1-yazen.ghannam@amd.com> References: <20240226152941.2615007-1-yazen.ghannam@amd.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1PEPF000044FA:EE_|IA1PR12MB7591:EE_ X-MS-Office365-Filtering-Correlation-Id: 8c589e48-6623-4733-e01e-08dc36dfc8d7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Ipo+RQenvVmLqTZwuh98kRrQHXqCaLUk8OnjdbmPraIDZvZZhyoBS+OKUBVoY88AszUSMX6YY5fkdCdPZd3MYaW0qbQ2YS33gLRXiHYtNfaPjvd1dUTjvIFuQy73YWH2C0jM+mhLqX1paLKWwwueQD/SbB0Em97JVetnehXPEex4YugWondEwB1muJzyM9tlNBQ84Bm6caSVFPMTm51TQ9gTp+CL9CB2ZHhIRQnbclOtCUs6sIiE7qzOC+CzYgNED7Y/ssielv+0OrnVgvubQRNBiMl8JNrylfPu5OhxHHagdrnPzOhkNarQwWlg7f8MovcbV6JINUjigJ5kwwBC2Gryq1Zf2eGQRUJDK8FVXNHLxpw6psCLJZJQf2vY/MBdZ19YB8+1MfK+CCtNPIEAbY0CZhvH9Yi7i2eYE2npkCN1LZ8x2teY+PMAF6MTKC3XaxudnuorFkH/PzQ+qwQ9T0IDDfwB2KA7e0WUd2BHK4hJstW2EfdSbYAVRJ7f6SxgBDpDNkx3lInLvVYlh2X0sa4oGWG2DdDckkpSwQkZM4nJ6iKKoQ9ig4mdbLmP9kgIanjZR6xBawOgwNHTk32jcKBZ+/xmAjrjpDDs8YuzMkLLB3vWBJD0WXHL0giWlb1O+pEoxH0+qPkJPrraAHeWjOpj1JJrrAJRt0DZs7Z1o/6nC6fkkASObphu7v28c7HJSwwSq6TcKEFt/LU0FaQ2wni00evhSikWadGyW+6jEZgyFZ3gRxcyV6Hs83DwCf5V X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(36860700004);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Feb 2024 15:29:55.3246 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8c589e48-6623-4733-e01e-08dc36dfc8d7 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: IA1PR12MB7591 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791976040921568165 X-GMAIL-MSGID: 1791976040921568165 The system physical address (SPA) of an error is not a stable value. It will change depending on the location of the memory: parts can be swapped. And it will change depending on memory topology: NUMA nodes and/or interleaving can be adjusted. Therefore, the SPA value is not part of the "FRU Memory Poison" record format. And it will not be saved to persistent storage. However, the SPA values can be helpful during debug and for system admins during run time. Save the SPA values in a separate structure. Update this when records are restored and when new errors are saved. Signed-off-by: Yazen Ghannam --- drivers/ras/amd/fmpm.c | 54 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/drivers/ras/amd/fmpm.c b/drivers/ras/amd/fmpm.c index 80dd112b720a..04961d36dd9f 100644 --- a/drivers/ras/amd/fmpm.c +++ b/drivers/ras/amd/fmpm.c @@ -111,6 +111,9 @@ struct fru_rec { */ static struct fru_rec **fru_records; +#define INVALID_SPA ~0ULL +static u64 *sys_addrs; + #define CPER_CREATOR_FMP \ GUID_INIT(0xcd5c2993, 0xf4b2, 0x41b2, 0xb5, 0xd4, 0xf9, 0xc3, \ 0xa0, 0x33, 0x08, 0x75) @@ -140,6 +143,9 @@ static unsigned int max_nr_fru; /* Total length of record including headers and list of descriptor entries. */ static size_t max_rec_len; +/* Total number of entries for the entire system. */ +static unsigned int sys_nr_entries; + /* * Protect the local records cache in fru_records and prevent concurrent * writes to storage. This is only needed after init once notifier block @@ -269,6 +275,40 @@ static bool rec_has_fpd(struct fru_rec *rec, struct cper_fru_poison_desc *fpd) return false; } +static void save_spa(struct fru_rec *rec, unsigned int entry, + u64 addr, u64 id, unsigned int cpu) +{ + unsigned int i, fru_idx, sys_entry; + unsigned long sys_addr; + struct atl_err a_err; + + memset(&a_err, 0, sizeof(struct atl_err)); + + a_err.addr = addr; + a_err.ipid = id; + a_err.cpu = cpu; + + sys_addr = amd_convert_umc_mca_addr_to_sys_addr(&a_err); + if (IS_ERR_VALUE(sys_addr)) { + pr_debug("Failed to get system address\n"); + return; + } + + for (i = 0; i < sys_nr_entries; i += max_nr_entries) { + fru_idx = i / max_nr_entries; + if (fru_records[fru_idx] != rec) + continue; + + sys_entry = i + entry; + if (sys_entry < sys_nr_entries) { + sys_addrs[sys_entry] = sys_addr; + pr_debug("fru_idx: %u, entry: %u, sys_entry: %u, sys_addr: 0x%016llx\n", + fru_idx, entry, sys_entry, sys_addrs[sys_entry]); + break; + } + } +} + static void update_fru_record(struct fru_rec *rec, struct mce *m) { struct cper_sec_fru_mem_poison *fmp = &rec->fmp; @@ -301,6 +341,7 @@ static void update_fru_record(struct fru_rec *rec, struct mce *m) entry = fmp->nr_entries; save_fpd: + save_spa(rec, entry, m->addr, m->ipid, m->extcpu); fpd_dest = &rec->entries[entry]; memcpy(fpd_dest, &fpd, sizeof(struct cper_fru_poison_desc)); @@ -385,6 +426,7 @@ static void retire_mem_fmp(struct fru_rec *rec) continue; retire_dram_row(fpd->addr, fpd->hw_id, err_cpu); + save_spa(rec, i, fpd->addr, fpd->hw_id, err_cpu); } } @@ -696,6 +738,8 @@ static int get_system_info(void) if (!max_nr_entries) max_nr_entries = FMPM_DEFAULT_MAX_NR_ENTRIES; + sys_nr_entries = max_nr_fru * max_nr_entries; + max_rec_len = sizeof(struct fru_rec); max_rec_len += sizeof(struct cper_fru_poison_desc) * max_nr_entries; @@ -714,6 +758,7 @@ static void free_records(void) kfree(rec); kfree(fru_records); + kfree(sys_addrs); } static int allocate_records(void) @@ -734,6 +779,15 @@ static int allocate_records(void) } } + sys_addrs = kcalloc(sys_nr_entries, sizeof(u64), GFP_KERNEL); + if (!sys_addrs) { + ret = -ENOMEM; + goto out_free; + } + + for (i = 0; i < sys_nr_entries; i++) + sys_addrs[i] = INVALID_SPA; + return ret; out_free: From patchwork Mon Feb 26 15:29:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yazen Ghannam X-Patchwork-Id: 206749 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp2156876dyb; Mon, 26 Feb 2024 07:38:59 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCW6uVVvNtub0k3rk+F8wOQoWsy69apNDYEX4+aO877THN71kIMMRGGucco6XjiIiLdI92mLH89cKZ8SXpU/kcOHtexe1A== X-Google-Smtp-Source: AGHT+IHX642JwS5zFJCagS/aUvMQDi4BctsGrjHkHBelR+npcGdwtq/XF2GlSjhn/4xzwNu5U+Su X-Received: by 2002:a92:dd11:0:b0:364:2328:22ba with SMTP id n17-20020a92dd11000000b00364232822bamr7904924ilm.12.1708961939616; Mon, 26 Feb 2024 07:38:59 -0800 (PST) Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id l33-20020a635721000000b005cf0abea01dsi3847998pgb.114.2024.02.26.07.38.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Feb 2024 07:38:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-81807-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=wjJ3N85A; arc=fail (signature failed); spf=pass (google.com: domain of linux-kernel+bounces-81807-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-81807-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com 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 99A87291D3D for ; Mon, 26 Feb 2024 15:30:56 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8521E12C7E7; Mon, 26 Feb 2024 15:30:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="wjJ3N85A" Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2071.outbound.protection.outlook.com [40.107.237.71]) (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 8977212BEBF; Mon, 26 Feb 2024 15:30:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.237.71 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708961404; cv=fail; b=RlT9EWp7Yr60MEKsrGxS7OF/hrxQWfJsRg0T/STaMX8i5x87oF4GxwCYjjBQCdWVn1sack0WIPpfESl8Twb6u7UNsk8GY2PstKeq88Gz5nnAkhWum2rQYoClyVqKyaKRB3IZYzT2aXHcrepGidkeahKA2KUaAxuVOYNUe9MflDI= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708961404; c=relaxed/simple; bh=xDWTUmdpAiHy2sZsA1K0WHKMrI+o24ngea9zbEnq068=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=anWIjn+aqgW/qS6GOAcdxcvDAEK/Wdmke3tFJ1SrhhXSIFHOWr1UAxGWIFhcIB9ou2HL0rtseVQU9N2dcFxRl0d3aRu2e8hhjSm046ExkpmRv2i5+d8smE0+W2kyJV9j47ltHcW/O1o/+ESzX7FesFXIWeQmmlgs7yXs2mRvSLU= 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=wjJ3N85A; arc=fail smtp.client-ip=40.107.237.71 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=arcselector9901; d=microsoft.com; cv=none; b=N7CxNm8v93FNS1IDy/Nq9VNOLwxnu757D0WA42xrjbz6+0lld4leITLYcrYmdxYlzoodt18fzUKyYX2ZMAKilGIMcQHQXQDxD27vBY4XNHdEIkFpAXido/LCBx8wEx2lk80naI5p8cH1yki913aur93mIYaVLcdZTpfgBmPwq0+NjGqMKhyOAjT/PLsxCH9OXvGycjotBCubhdgyKXAfBP/rpA7if6y/R2WdHlZofBQp2lzIuzAa3+D1XAjW9dIufb+shzjka0Msp0jconfX9l+7cCdwv1ay5ibNG4NnCRgAKDOWVgD4327Ea8Q9OiVoNKqhHfm3zzvelxXb8OsobA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=8M1xkrsufNk3J5PFoOjspbxct9V8YK0UnuCnaptKX48=; b=Sz4WC3uc8bDT5vNZa3JomxCQ4KlzAAiDtjysnUHwUm2Hk5EigsjOxpgHTPKpwGNJUqAEGXgeiEbdwByOQPygSY6OqY9uhFH9NhyWlketLmrJ28zLhwifpXP+XCmxmmy0nZ5XgMae1Ct8qB/J0U8IgWen3EsuEzxrIpZcriclywJhwUiMDUHBVV2smd6U5Ts+asBHogChr4DbJ3MpzBrFCTlAMfC7bs7XbDnqyO6lyFEU7hjhmoECcQ3UMbfb/ibgsxVYoMpOuV4uD+yjwfu7IBn5yq4CSi7cu1p8v9UvshsBPx0dsyiw7Dgx/GUVkblgh7vpCm20QCrcanSRPcObUA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=alien8.de 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=8M1xkrsufNk3J5PFoOjspbxct9V8YK0UnuCnaptKX48=; b=wjJ3N85AWDf096id52VZOUk0s/AUOXQLdUWrezg2a6VTESq5MJj+m7GzAOXHWxBv1cRTOsOuwJyWPD9401kz9paccd4PutHqkdbIKb/fywTbwyXpZZL+w5BcrGM0UichAoY8vU4BonG8W70Wug4uqlNDV4dwFmASDWXaNWypdtY= Received: from SJ0PR03CA0382.namprd03.prod.outlook.com (2603:10b6:a03:3a1::27) by SA0PR12MB4526.namprd12.prod.outlook.com (2603:10b6:806:98::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7316.34; Mon, 26 Feb 2024 15:30:00 +0000 Received: from CO1PEPF000044FA.namprd21.prod.outlook.com (2603:10b6:a03:3a1:cafe::f9) by SJ0PR03CA0382.outlook.office365.com (2603:10b6:a03:3a1::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7292.49 via Frontend Transport; Mon, 26 Feb 2024 15:29:59 +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.7362.0 via Frontend Transport; Mon, 26 Feb 2024 15:29:59 +0000 Received: from quartz-7b1chost.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.35; Mon, 26 Feb 2024 09:29:52 -0600 From: Yazen Ghannam To: , , CC: , , , , , , Yazen Ghannam Subject: [PATCH 3/3] RAS/AMD/FMPM: Add debugfs interface to print record entries Date: Mon, 26 Feb 2024 09:29:41 -0600 Message-ID: <20240226152941.2615007-4-yazen.ghannam@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240226152941.2615007-1-yazen.ghannam@amd.com> References: <20240226152941.2615007-1-yazen.ghannam@amd.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1PEPF000044FA:EE_|SA0PR12MB4526:EE_ X-MS-Office365-Filtering-Correlation-Id: 2a3dfcb1-292f-47cb-afe8-08dc36dfcb4f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: aD/BUaOGMVQ6WQ6jHKEDHAz6qD3HQwmQknrR+k1Vi8Z5OeQDmusxUhUbPeXkxjxiKNBlugfvVySiEyzwPV+HQcSD+miCgq5n/Is4/1WN+T3Z/NxFfzgN19JCiXJxbAS6TlLLfLADGj8UO4Xlgx4JYQa03WbLPh4nB1mPgr8bR8DYCmCIPH6hlKSGchlognZTBIlcBXF7MG1Qn4kdW0lsClVR7VBxDkllXZS6449lnzqRYtGjr8O7nj61Gh/RPCy3ZGpSVELXPbaqu5KfY7sDZ5mF3YeoTeH9sJDrZlw8QDoUDpd+zcdDLBjaN7kUI+lwgGvw19N1MuShqIfiBbAO7MiqSsBmC3/I8GpFgi28lu7BivoxLxCbM7vWk3P1mQwdrc1raZfFcV/qdfkamkGCQGgg36YwmMWcxauJ30caS5UkIXYq7AYh/C8HaksnsV5F8o2uoSMc4c+edk+5jJkhF/t9E3My1mFI2SyAFEs3YJBMMFlynwdehXOL5fyvJQC5RmR6hM0/c5tJz7zior3+171U51CKCdjA/J2D7VdfJOanqlOY5zaiphTniAoDqVlYqFyh+WTKbSxVCTJpMGHhmiwhRTJsUc9sSvmyI0WteHLJaM0WP95qgXtqYD6w6G96AObxdb/UxLbU/TfsbuiL4VM6CHoNLZCFXA7AJopIQbSe6ZWqSqnlJ7noQXpYmtvnIa17byiG2Bt7w630oqxs0plv44K1f7lGaa1mmsjkDOMHB708Bp0GYRPkqihMF3ZL X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(36860700004);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Feb 2024 15:29:59.4653 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2a3dfcb1-292f-47cb-afe8-08dc36dfcb4f 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: SA0PR12MB4526 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791976474652620682 X-GMAIL-MSGID: 1791976474652620682 It is helpful to see the saved record entries during run time in human-readable format. This is useful for testing during module development. And it can be used by system admins to quickly and easily see the state of the system. Provide a sequential file in debugfs to print fields of interest from the FRU records and their entries. Don't fail to load the module if the debugfs interface is not available. This is a convenience feature which does not affect other module functionality. The new interface reads the record entries and should hold the mutex. Expand the mutex code comment to clarify when it should be held. Signed-off-by: Yazen Ghannam --- drivers/ras/amd/fmpm.c | 129 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 129 insertions(+) diff --git a/drivers/ras/amd/fmpm.c b/drivers/ras/amd/fmpm.c index 04961d36dd9f..967af84b7fe9 100644 --- a/drivers/ras/amd/fmpm.c +++ b/drivers/ras/amd/fmpm.c @@ -54,6 +54,8 @@ #include #include +#include "../debugfs.h" + #define INVALID_CPU UINT_MAX /* Validation Bits */ @@ -114,6 +116,9 @@ static struct fru_rec **fru_records; #define INVALID_SPA ~0ULL static u64 *sys_addrs; +static struct dentry *fmpm_dfs_dir; +static struct dentry *fmpm_dfs_entries; + #define CPER_CREATOR_FMP \ GUID_INIT(0xcd5c2993, 0xf4b2, 0x41b2, 0xb5, 0xd4, 0xf9, 0xc3, \ 0xa0, 0x33, 0x08, 0x75) @@ -150,6 +155,11 @@ static unsigned int sys_nr_entries; * Protect the local records cache in fru_records and prevent concurrent * writes to storage. This is only needed after init once notifier block * registration is done. + * + * The majority of a record is fixed at module init and will not change + * during run time. The entries within a record will be updated as new + * errors are reported. The mutex should be held whenever the entries are + * accessed during run time. */ static DEFINE_MUTEX(fmpm_update_mutex); @@ -799,6 +809,122 @@ static int allocate_records(void) return ret; } +static void *fmpm_start(struct seq_file *f, loff_t *pos) +{ + if (*pos >= (sys_nr_entries + 1)) + return NULL; + return pos; +} + +static void *fmpm_next(struct seq_file *f, void *data, loff_t *pos) +{ + if (++(*pos) >= (sys_nr_entries + 1)) + return NULL; + return pos; +} + +static void fmpm_stop(struct seq_file *f, void *data) +{ +} + +#define SHORT_WIDTH 8 +#define U64_WIDTH 18 +#define TIMESTAMP_WIDTH 19 +#define LONG_WIDTH 24 +#define U64_PAD (LONG_WIDTH - U64_WIDTH) +#define TS_PAD (LONG_WIDTH - TIMESTAMP_WIDTH) +static int fmpm_show(struct seq_file *f, void *data) +{ + unsigned int fru_idx, entry, sys_entry, line; + struct cper_fru_poison_desc *fpd; + struct fru_rec *rec; + + line = *(loff_t *)data; + if (line == 0) { + seq_printf(f, "%-*s", SHORT_WIDTH, "fru_idx"); + seq_printf(f, "%-*s", LONG_WIDTH, "fru_id"); + seq_printf(f, "%-*s", SHORT_WIDTH, "entry"); + seq_printf(f, "%-*s", LONG_WIDTH, "timestamp"); + seq_printf(f, "%-*s", LONG_WIDTH, "hw_id"); + seq_printf(f, "%-*s", LONG_WIDTH, "addr"); + seq_printf(f, "%-*s", LONG_WIDTH, "spa"); + goto out_newline; + } + + sys_entry = line - 1; + fru_idx = sys_entry / max_nr_entries; + entry = sys_entry % max_nr_entries; + + rec = fru_records[fru_idx]; + if (!rec) + goto out; + + seq_printf(f, "%-*u", SHORT_WIDTH, fru_idx); + seq_printf(f, "0x%016llx%-*s", rec->fmp.fru_id, U64_PAD, ""); + seq_printf(f, "%-*u", SHORT_WIDTH, entry); + + mutex_lock(&fmpm_update_mutex); + + if (entry >= rec->fmp.nr_entries) { + seq_printf(f, "%-*s", LONG_WIDTH, "*"); + seq_printf(f, "%-*s", LONG_WIDTH, "*"); + seq_printf(f, "%-*s", LONG_WIDTH, "*"); + seq_printf(f, "%-*s", LONG_WIDTH, "*"); + goto out_unlock; + } + + fpd = &rec->entries[entry]; + + seq_printf(f, "%ptT%-*s", &fpd->timestamp, TS_PAD, ""); + seq_printf(f, "0x%016llx%-*s", fpd->hw_id, U64_PAD, ""); + seq_printf(f, "0x%016llx%-*s", fpd->addr, U64_PAD, ""); + + if (sys_addrs[sys_entry] == INVALID_SPA) + seq_printf(f, "%-*s", LONG_WIDTH, "*"); + else + seq_printf(f, "0x%016llx%-*s", sys_addrs[sys_entry], U64_PAD, ""); + +out_unlock: + mutex_unlock(&fmpm_update_mutex); +out_newline: + seq_putc(f, '\n'); +out: + return 0; +} + +static const struct seq_operations fmpm_seq_ops = { + .start = fmpm_start, + .next = fmpm_next, + .stop = fmpm_stop, + .show = fmpm_show, +}; + +static int fmpm_open(struct inode *inode, struct file *file) +{ + return seq_open(file, &fmpm_seq_ops); +} + +static const struct file_operations fmpm_fops = { + .open = fmpm_open, + .release = seq_release, + .read = seq_read, + .llseek = seq_lseek, +}; + +static void setup_debugfs(void) +{ + if (!ras_debugfs_dir) + return; + + fmpm_dfs_dir = debugfs_create_dir(KBUILD_MODNAME, ras_debugfs_dir); + if (!fmpm_dfs_dir) + return; + + fmpm_dfs_entries = debugfs_create_file("entries", 0400, fmpm_dfs_dir, NULL, &fmpm_fops); + if (!fmpm_dfs_entries) + debugfs_remove(fmpm_dfs_dir); +} + static const struct x86_cpu_id fmpm_cpuids[] = { X86_MATCH_VENDOR_FAM(AMD, 0x19, NULL), { } @@ -840,6 +966,8 @@ static int __init fru_mem_poison_init(void) if (ret) goto out_free; + setup_debugfs(); + retire_mem_records(); mce_register_decode_chain(&fru_mem_poison_nb); @@ -856,6 +984,7 @@ static int __init fru_mem_poison_init(void) static void __exit fru_mem_poison_exit(void) { mce_unregister_decode_chain(&fru_mem_poison_nb); + debugfs_remove(fmpm_dfs_dir); free_records(); }