From patchwork Thu Jun 6 20:33:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Allen X-Patchwork-Id: 13688935 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2041.outbound.protection.outlook.com [40.107.223.41]) (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 E17DD13AD0D; Thu, 6 Jun 2024 20:33:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.223.41 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717706021; cv=fail; b=YtJ5kOtrvJmZqFlI1WEYBKkiiiVwoaTDMxV3riZPXmmE5/oF/zvTaoyDopHpfoJRzymTDTSV1ZC1eYs/FkF8PU9fGcmGldfo27Mu4pK5ZilPOQpJ0F2A9IhOcMUKJFVOkowrw3wdh9H4LUiPYbwo3gyPTMLXJWrCuT7Z6QlKCy8= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717706021; c=relaxed/simple; bh=F9BLyAPpcE93fn+yA2tHvc6zwKzZ0sKBcsqryUr/O1I=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=kVuBFsLzgnZBQQu7ViYku5IITPHLzwwYa5Y89n7zTKCdYJ4jeaA3uS1tTdVgOgwHMetGlAMEKGHQj0EwVvNiRsWuIEa46oNeC+qf6NVovRWI8OrpwXkBWbpOArlTggH982SrTTAvx/YqzMwTyYbyfQAKpUo32YJ5TFSMggjS9FE= 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=bw1VoJDB; arc=fail smtp.client-ip=40.107.223.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="bw1VoJDB" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LJkj9NhqG4/RVyEydRImpZiRpHNsRZZw6V65JJx8SJGWQzFWpJJORmlDSZh1+OXMCoEl+QPhtCRiOQnzqW4dIi05/jzSexC8X0uuem2xM9Fcqn+Z1XKVJAmQzTjwH2KKV28JF4mKC5ocz+88NK/fI1TaUd0S1J8TyQp1pUN6RmDJChI6H+4QkrfO82yRcbfFuTvyATEjUDfctvnIWVphWsdd2Uy3lj5bOBpp5uBTWPSud2eZ95E0aD365GMcQYdn6PKzTTWp2JiZmtMyEYJK1t/iMYOF56DJuj2IFBSGQIMagO/s1+d7Rf7kJ40t/eCuwJsz+SpxdC3YjUnt7tqTiw== 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=zFd4CfqyV16VobCWQPmql8AMl0s5DsG0FP6euJZ1EDI=; b=YgkcXn3pt9/5WbmRKfYlJAo8X49W1pipmDFKzNeSicvlCvLfuVtfx1rjBy35cvh471ss1I4e0zYk6iULItbixgUn4QLML8iF1689NlrcCRkz3hqobQqd3XpWmbE3K1A49AtxxEdPtf/XA4mXHPT9lxWf++DCERJj4oQMn77LxGtDsgsszokmbLvn7hZeLMoFWuJWz7KOZy1R0C/wNRK+8yT0W0AdRbF+lxPB+c4DHmao19H48P7UVmxWvHK0wwn1MEcUsLkXJAHnegp1P+FfrZFqiuDz6D9GmXx5BBC8G4VZ+PoRwYHc+soILqhK7h1tV+ay6eKXB0XY7HL4YJaXcQ== 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=zFd4CfqyV16VobCWQPmql8AMl0s5DsG0FP6euJZ1EDI=; b=bw1VoJDB94MvzGWB3oFJ+JcGpHwVORgel+OGFWAebO89cTBCp9nw/HRkD1zaQV0fD/xE7ZnxN4SMQ7sdZ3FNiXB1yIt/Hh7R7aAF2OJsrSBsMHS1Fmf/GmSbz7k7qMEyJB6Z3VlxxmJyg1Osl6u02rBa9XkxRAHATHvLnZ0k2ks= Received: from CH0PR04CA0012.namprd04.prod.outlook.com (2603:10b6:610:76::17) by DS0PR12MB9399.namprd12.prod.outlook.com (2603:10b6:8:1b8::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7633.33; Thu, 6 Jun 2024 20:33:37 +0000 Received: from CH3PEPF00000009.namprd04.prod.outlook.com (2603:10b6:610:76:cafe::95) by CH0PR04CA0012.outlook.office365.com (2603:10b6:610:76::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7656.21 via Frontend Transport; Thu, 6 Jun 2024 20:33: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 CH3PEPF00000009.mail.protection.outlook.com (10.167.244.36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7633.15 via Frontend Transport; Thu, 6 Jun 2024 20:33:37 +0000 Received: from jallen-jump-host.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; Thu, 6 Jun 2024 15:33:36 -0500 From: John Allen To: , , , CC: , , , John Allen Subject: [PATCH v5 1/6] RAS/AMD/ATL: Add amd_atl pr_fmt prefix Date: Thu, 6 Jun 2024 20:33:08 +0000 Message-ID: <20240606203313.51197-2-john.allen@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240606203313.51197-1-john.allen@amd.com> References: <20240606203313.51197-1-john.allen@amd.com> Precedence: bulk X-Mailing-List: linux-edac@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: CH3PEPF00000009:EE_|DS0PR12MB9399:EE_ X-MS-Office365-Filtering-Correlation-Id: 1ebdcbfe-c4bc-4d86-c052-08dc8667f183 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|82310400017|1800799015|376005|36860700004; X-Microsoft-Antispam-Message-Info: X1X9Va1DKjd8ASdxmX4qNZy++A9Ev/2xeySmAjHKysRISTKJZkLiBh21i0mHFREVhsOLAITRLDTX929UmSg584b5iRb/D4ovt7JHasmyGf3JxyK+PuEQ2yTeOGDxkCQRMgdozPIP1kXrq/A8FfprdotnjTftReqneVdR1kyg3V+X0PexNFVNFgA+O4E8zPKHuTxVGenN9P5s7rxNCjcoY2MH8rLF+4arVqUIbxLpPNIMni7dbeqggKf4qexkLGEoERaNVQZ6xpIlpQBVoFmpmLHYZVDf7i+RLfFWarO4cm4kUZF8NZD1PZssx2wpNv8iy1henUnF3vCX4bOm2UnhWrt7ZuscpiuskPPkjFzIJg+98qYP4eGvm2IXucPMtnmeWU6wKJGG8yI2PfWwjgn+sy8Bv+lHXiw6hsZIOMvS2re7kFmWi4mKjkPFKOeuuvNrFIXaDNA4hGFUdCCwyJVf5Jfyqva4o/WD37P3gaiVVIvOKYYPNvCX+RCKJK2jtvjYtkOZE6Ioy1SNXbdU+DnXkHLjU6gHLAMGh0azO4v99dweFKc1LICsGtuoqUjeIE3FUjq5PrRtmTIReT/SL/CcIALYLuDu6FHp6kXhLslEU6EH0S3pW3yZisAlrbsK7u/q0xoLSOPvLGqomSLCNGse7Nr1w8nHXnBVdwnYEUKs7PGzEFd2rePDsxFJqbHzPRcyDMeXTgnaVDkncVtybt+dILfEA8/V/MtACGCbF6NqGklw2SyRLKcEGegO25LJfuRE1GUR1WH87hiNnkzQRrmyYE5q7BqkCRp/pvZy+TnC64iTt9FT9RFpfw53F61hjcBUkDn6Qc2x9zxufCeNmhg/Q79SKAuBFn1NIeAA0klL39OH2B9Er9EMF6n6Mydra27J9JOPy4buuZGSqZxylB6ArTNyMvzogZHtphKYrNakpMHsYR1PVd6Qnwbc0znFGLgxB7UI/Xg+eFELrODqe3TiXrgAT6L4ZSQIVefWIJKTj9ifsFSHmqwawsvUFhOn7czoxGrcbpd2DJd5nwbROdzOq+K978Xbkz/Y7HRXWNZ5pR+nzzol6rBDT+pd2RepG/78sJnj5oNDSTHun/cyZGSn5EIHf2M6N8If/CB90GutrV1dl4b7Mg/zFxe3tYk3hdZ6Mnb6aqp0toJnhd38QZ6e4/Ti404SG7YYQ+sxcpuMB0eX8lA9Ty0y+QWXT4AJZ0wNE6IMt9hhxNLHL3gsVRRoEWZC5dSyctJrdasVFZMaLf4/QYEuDJgyGn+kBUiagXx2gqxBoCySWjuJMDLZkLcNA5rO9AHxuCQo7jR1ArqqY652iMItmJjF4e5qbNIEEUJJakEJQGVhYvG2Ct1kirLZnCgQneYK/8dxPLb2bPkjO+9/TWD+ILhqLLQjq5J51o9mhqG2bG6o6UdO/eu9EH8+qg== 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)(82310400017)(1800799015)(376005)(36860700004);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jun 2024 20:33:37.0683 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1ebdcbfe-c4bc-4d86-c052-08dc8667f183 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: CH3PEPF00000009.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB9399 Prefix all AMD ATL pr_* statements with "amd_atl:". Signed-off-by: John Allen --- v5: - New in v5. --- drivers/ras/amd/atl/internal.h | 3 +++ drivers/ras/amd/atl/system.c | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/ras/amd/atl/internal.h b/drivers/ras/amd/atl/internal.h index 5de69e0bb0f9..cb0f96040fbd 100644 --- a/drivers/ras/amd/atl/internal.h +++ b/drivers/ras/amd/atl/internal.h @@ -21,6 +21,9 @@ #include "reg_fields.h" +#undef pr_fmt +#define pr_fmt(fmt) "amd_atl: " fmt + /* Maximum possible number of Coherent Stations within a single Data Fabric. */ #define MAX_COH_ST_CHANNELS 32 diff --git a/drivers/ras/amd/atl/system.c b/drivers/ras/amd/atl/system.c index 701349e84942..248ea493b841 100644 --- a/drivers/ras/amd/atl/system.c +++ b/drivers/ras/amd/atl/system.c @@ -273,7 +273,7 @@ static void dump_df_cfg(void) int get_df_system_info(void) { if (determine_df_rev()) { - pr_warn("amd_atl: Failed to determine DF Revision"); + pr_warn("Failed to determine DF Revision"); df_cfg.rev = UNKNOWN; return -EINVAL; } From patchwork Thu Jun 6 20:33:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Allen X-Patchwork-Id: 13688936 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2050.outbound.protection.outlook.com [40.107.237.50]) (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 E7A7513AD0D; Thu, 6 Jun 2024 20:33:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.237.50 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717706027; cv=fail; b=Ab/77+f1Bqw3w31Wb1riYiV4sWsyIy6aoEAYxpbYuX0UWzAK6bbAxdgiZaOls7Acb+n9y6zEeqhm9fwETei8i6mVLRE4D9B5gsTLZOwEaieMTTaUVaWjPnWr/TQSeW1EKHmpgvSjE7cN9g72mC6vrLSPdQ0IxPxQm7FNMP29xPg= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717706027; c=relaxed/simple; bh=ixY3ATydXDQApvU1/2THonIPKkNLWbOdM4kXv/TSnwU=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=pnmWzOWTbpuutpJpqq37OOtbUf6rhSgDtu9ogM5zNmaE0tJiQSAqFA+FlbfJcoTM22KVdyjz3poNo/lILRfe/5MYvGa43udVK5e0iR0hILk/v7MZgt+Tb+OB+eBtcvzdT9jNAqhf09IVkhkC7h0Zv3I1CHTtVYdP3DLNC7D3vQs= 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=pR74VZue; arc=fail smtp.client-ip=40.107.237.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="pR74VZue" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GYEop3nJkA2miRY+KcS2DmtCmm6aRMj32PZ+oV5wytWvPimAZ6RPuW9iAnApV+OIV3tS4XCR1HajjIcMYWnLktpYG4HrYZEUzzfF+QlHC3gt2B8oYS4Z6swHH/HvCP1a2Zus5KaOy1qPftt4sbaIyPE07xbZ82hjTRLZavfeeaWe7r+27YdQQ7Qsb3uW31w5h9LWuTZHUT/cQoA/yDWyIfKFiXR7Nf9jXbzefOHuRfjs8R4O4jU9VTJAAK2Qchx+zoUZ9a7YUYIiJTFdkMcBTAjevkA76P4rbaOOq9+Xwv2JalZeNqgo2FVS4ubLyAq37RmSQ2MbIrY3L2t3fh2izQ== 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=QlKt1Jaq3MzbwLZey7d1f47qFEUibfRfXzW7CCeLHa4=; b=m2MTq1JAor0Svqr7cSxrChIn6g96ZTlU2Q6HYj9lynCElCHW3SkGG0NiRTmVULkd66cF2pWrWE635v/UaFsJdqCZPbmgyF5C+AlAQYcm4JwkhYf3sZZ2OJ9QwBLRxwpp6JWDX0dfvtQl0gJJ6MeQem+NHxOaZGVFWIw0LXRmzH1CZgxLeHbhXyW8jwAbfNFI1mmVAFrNPJeSVdtUSXpCaqoxrFS2SroJk+fhPu/OnFieHWJizOqFFSCDl24pfhxG+3TVxL8muI3bTH8est1AKqglcQncq/+Imddc4eWSzi4dJKtrBf9fvO7ynzhBify9ODw/l6gx01i2ycE4Xs6wcg== 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=QlKt1Jaq3MzbwLZey7d1f47qFEUibfRfXzW7CCeLHa4=; b=pR74VZueWK+n+q+s3EUFsZl7yfkN63/hrmP178nqGlihSrKNO64xJS8jbGMtX0OdZh+eHm9Yh4QmTnIJzBEz3vEwCRgoB1bQvx8sTJSIiaSWixXzJ32DAP74o+h3uNxFfUURHszUzSAV2YZbnQpNJv1lKSRP+47f3X3T/DJucl4= Received: from CH2PR19CA0013.namprd19.prod.outlook.com (2603:10b6:610:4d::23) by CH3PR12MB9429.namprd12.prod.outlook.com (2603:10b6:610:1c9::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7633.34; Thu, 6 Jun 2024 20:33:43 +0000 Received: from CH3PEPF0000000F.namprd04.prod.outlook.com (2603:10b6:610:4d:cafe::a3) by CH2PR19CA0013.outlook.office365.com (2603:10b6:610:4d::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7656.19 via Frontend Transport; Thu, 6 Jun 2024 20:33:43 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by CH3PEPF0000000F.mail.protection.outlook.com (10.167.244.40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7633.15 via Frontend Transport; Thu, 6 Jun 2024 20:33:43 +0000 Received: from jallen-jump-host.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; Thu, 6 Jun 2024 15:33:42 -0500 From: John Allen To: , , , CC: , , , John Allen Subject: [PATCH v5 2/6] RAS/AMD/ATL: Read DRAM hole base early Date: Thu, 6 Jun 2024 20:33:09 +0000 Message-ID: <20240606203313.51197-3-john.allen@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240606203313.51197-1-john.allen@amd.com> References: <20240606203313.51197-1-john.allen@amd.com> Precedence: bulk X-Mailing-List: linux-edac@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: CH3PEPF0000000F:EE_|CH3PR12MB9429:EE_ X-MS-Office365-Filtering-Correlation-Id: d689fc4c-9e9b-448a-9fde-08dc8667f515 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|1800799015|36860700004|376005|82310400017; X-Microsoft-Antispam-Message-Info: row+NP2Uv0qa0t1/s6GJdQrhCZXlX9uCFc4Qkl2917SRpURalM1c9evntjhDRiFp7StFAUChifW1Ke6WVgMb6qVCAg1l3fuLOfieyJbM8CjhmR507i6IPW6AqAdejqnegWbQNedIQ0VZLswuUGiUm523ftce6Jxc9JlhlFSa+rr2Rk8/luL9inLgGg2aVmJHaXO9z3NWqNarb/iRjZNibsz1ZtBU1umt7XbN6k6LGc1KWmiLNZsONPyeOhKXP8KY8G2oSTthxbYXOaW5WSTAJ0u6sdk7Jvxn/uRUGVs3RrVG7FQllT/MSrmPr0MQmwu8fDRkJzCahJ4xt9Hs/5Gxpuj5dXNU6S5wGQhDmYS/hbLCyCYfd2eOlM5JnrIhw7JGqdHerfNjhJgTz8mQHMAtOm60Y4RS3O0nq1UgoIu+hrviOeV8Tk7x7hHxKQRUGEPdJhTHGUt7XPlYoJP+VH4sGKXOjpzbL1bfk6asyNGgWPBixjwozNNFCMArRYa2eJPYAofzSDCf7soEQ6QikCiH9wHA6eeyKhyhWAy3g9OIIMmQzY2s10DQxBWjbTAYXOL2qcJ5zBIbVkAOwrcQo/UyO0IoywlhNB/TbP9sOQ3+sgX7BLNuNBbsnlMkhSG//y6CuDNuOF4PbeDyYm+WXW4jULwEt3nzQ2cUx4KBzuZzMOUrrDU14+jOiQ8LIb3euk3Nsy/H1A/F/udyDXqmJbWzSwrRmRR3fqBQGNHJeW2Ib9HB9YAGRfklE2DIgmOPMapV09EMEAxxUSJdffR7gIZhnAMzAH5zj9zulTGAvzEhFTFcGoU2oTwfFFAb38AZXd4Jznelyab7o7NOC8+aXQ/Ph6F/i9PfUkCDIzhIH7ANvPqkSHtASbIyC4EEz53EoKMnY51bd1zMhkahW3MGOeINJrL7Z3ijeLWzWgUccJBJVvb9gt6xSc8EUDVDThygpENyCyMOwFqS30eefc70KIh1eYeUHDyOSFyQjABguKKqX4QRtqNsfVQi8oiN9U9iRWrFg44IRSObYpxvxuNkucuoC0Thz66aw+Bj86OKhWT+LwUdCUk5OyuKWUpFn/m1EvIyIQ72HqkQW1f937bAYnHBbeKnfXIRl1rcB94WDowOFy0QmjupqB1dry0UEIRS6p9L5kqWJyBLiO+Em/1mhfWyPJ/M69Q0gple8AlTzIaDpcas2rmdIPqo4P13ohGZPsDyEdvUTN3Ees9w3a5tfZy/ViBIDc3yH6/rq6IaeQXcLpX6nTzdHlshcWNQzvxQqXlx6kV4bO9pXuK+V5C5+52ViqZsCPVKy3GniaYYZK0q/DOJNGSaiE6BQ7Mu/iKyQJtxBSTb3ogXdBGGqHuRIGAHW+tRgGJ5ZCHlOXBUO+wlHw/zS+szkXzCJsSsdWRA5nLkyBAxZsVWFAOX3Nicn+BQhA== 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)(1800799015)(36860700004)(376005)(82310400017);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jun 2024 20:33:43.0418 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d689fc4c-9e9b-448a-9fde-08dc8667f515 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: CH3PEPF0000000F.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR12MB9429 Read DRAM hole base when constructing the address map as the value will not change during run time. Reviewed-by: Yazen Ghannam Signed-off-by: John Allen --- v2: - Fix compilation error. ctx->addr should read ctx->ret_addr. - Improve commit description. v3: - Include "0x" prefix for dram_hole_base print v5: - Don't fail loading the driver if the DRAM hole base can't be read. Check if the hole was read properly at the beginning of translation and fail there instead. --- drivers/ras/amd/atl/core.c | 18 +++++------------- drivers/ras/amd/atl/internal.h | 2 ++ drivers/ras/amd/atl/system.c | 19 +++++++++++++++++++ 3 files changed, 26 insertions(+), 13 deletions(-) diff --git a/drivers/ras/amd/atl/core.c b/drivers/ras/amd/atl/core.c index 7be4982fdf19..82f77f129d54 100644 --- a/drivers/ras/amd/atl/core.c +++ b/drivers/ras/amd/atl/core.c @@ -51,22 +51,11 @@ static bool legacy_hole_en(struct addr_ctx *ctx) static int add_legacy_hole(struct addr_ctx *ctx) { - u32 dram_hole_base; - u8 func = 0; - if (!legacy_hole_en(ctx)) return 0; - if (df_cfg.rev >= DF4) - func = 7; - - if (df_indirect_read_broadcast(ctx->node_id, func, 0x104, &dram_hole_base)) - return -EINVAL; - - dram_hole_base &= DF_DRAM_HOLE_BASE_MASK; - - if (ctx->ret_addr >= dram_hole_base) - ctx->ret_addr += (BIT_ULL(32) - dram_hole_base); + if (ctx->ret_addr >= df_cfg.dram_hole_base) + ctx->ret_addr += (BIT_ULL(32) - df_cfg.dram_hole_base); return 0; } @@ -125,6 +114,9 @@ unsigned long norm_to_sys_addr(u8 socket_id, u8 die_id, u8 coh_st_inst_id, unsig ctx.inputs.die_id = die_id; ctx.inputs.coh_st_inst_id = coh_st_inst_id; + if (legacy_hole_en(&ctx) && !df_cfg.dram_hole_base) + return -EINVAL; + if (determine_node_id(&ctx, socket_id, die_id)) return -EINVAL; diff --git a/drivers/ras/amd/atl/internal.h b/drivers/ras/amd/atl/internal.h index cb0f96040fbd..3596ad5ca3e0 100644 --- a/drivers/ras/amd/atl/internal.h +++ b/drivers/ras/amd/atl/internal.h @@ -135,6 +135,8 @@ struct df_config { /* Number of DRAM Address maps visible in a Coherent Station. */ u8 num_coh_st_maps; + u32 dram_hole_base; + /* Global flags to handle special cases. */ struct df_flags flags; }; diff --git a/drivers/ras/amd/atl/system.c b/drivers/ras/amd/atl/system.c index 248ea493b841..8423c9f3a8d2 100644 --- a/drivers/ras/amd/atl/system.c +++ b/drivers/ras/amd/atl/system.c @@ -223,6 +223,21 @@ static int determine_df_rev(void) return -EINVAL; } +static int get_dram_hole_base(void) +{ + u8 func = 0; + + if (df_cfg.rev >= DF4) + func = 7; + + if (df_indirect_read_broadcast(0, func, 0x104, &df_cfg.dram_hole_base)) + return -EINVAL; + + df_cfg.dram_hole_base &= DF_DRAM_HOLE_BASE_MASK; + + return 0; +} + static void get_num_maps(void) { switch (df_cfg.rev) { @@ -266,6 +281,7 @@ static void dump_df_cfg(void) pr_debug("num_coh_st_maps=%u", df_cfg.num_coh_st_maps); + pr_debug("dram_hole_base=0x%x", df_cfg.dram_hole_base); pr_debug("flags.legacy_ficaa=%u", df_cfg.flags.legacy_ficaa); pr_debug("flags.socket_id_shift_quirk=%u", df_cfg.flags.socket_id_shift_quirk); } @@ -282,6 +298,9 @@ int get_df_system_info(void) get_num_maps(); + if (get_dram_hole_base()) + pr_warn("Failed to read DRAM hole base"); + dump_df_cfg(); return 0; From patchwork Thu Jun 6 20:33:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Allen X-Patchwork-Id: 13688938 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2044.outbound.protection.outlook.com [40.107.236.44]) (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 A5E3919AD64; Thu, 6 Jun 2024 20:34:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.236.44 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717706042; cv=fail; b=k5d8cqOB1tq1bNTcXoYt5c1mxGs5v9cMlrAsDsgr/TO5alOXBZFJqm1Y3nmIHNwLtWSqD5p8P8YLIh1w3jns0qmUxQmZiFCzslvOJho6XLcG6EyYaDt2Com/JrhcFFdsqf/IHWDIyYL27LZPWbOgT34laX262T/MKkJzAxTCbGI= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717706042; c=relaxed/simple; bh=eAWb7WkzuMa0uv8d/SidCwyDs4Ngu7vb8BAnqvhOR+g=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=V0f9AE9bI+WPzE3iCez8xSh2rPPCN/J0s4Bkpoy9wPVpgBo2pM7jZIap5y5xPNVTWawDENCcgk+xm8+8PEsjJdm4G26bWaZjnSgJChTpWK/tnmZwp7Xs2qQL63fVaL2kp986+tnHn84gTcUqvLpwyMv4LouMb1hEpiko9ATddH0= 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=b+HFwjhj; arc=fail smtp.client-ip=40.107.236.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="b+HFwjhj" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mHD/Dxt8Y/LtG+mRAYkxq0Mvec6xAhcGxNkIDdnnxeaF95rcCO7iX90H8SYUDQvYmeYt9cAgSPwzsmsJ2kKpxtHTjNSkgY1R6kKSbm8fJSxvWK4vDGr/w1HyTiEufpFUSo5NnrdOumiSJc0EpbW2Sa0q7IvK5vkflD7SXB/1IYJKEXKm2rxhWozE6jvNN3JSH9sJZE85/BZ3EAVjCKLk6oC4uHtoDzThpJS85taCP7mWNLkjyAginjpppT8OVAaE8p3DLvrFzfwtGbrczos6nQ09a/XPg2A+0u3dGhHE+pu3sWgpif81viv0FNh8/J8gzzzFR2wY+glltqHs1/jP+A== 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=NOCfvWhm6ib3Sq/M4H+4rNFDKcZh1Xpj/OCyUUYJZe4=; b=Wld0l1PNqbPRmvI2qpP7AQAyefLQXfYDhHJl0SshO1WALbseuWIbywA6P+DC1hTMfudEZvwZGrYRRa0bZE4K5cRclrJBDxhT+qWN3QRkY0fWMz8dl9PmtRUo3oBECU3YCc4B29pYxptoLAZVCFx8vZ5Hz4jvhSyl8GOtSTnX6UTFyhl64o0NFjKY8YAKU+diIGtKJXOQ1rE7Tll3MRSrHf2frOl6RqhgrMGJqFxXTL+GETgRArupi9+YPHePkPcBoQQoO8BXUJbXvoL/Eat1WGFEwZHirTlfoJeuepC1MAsxTaoC3S2KibmqK8IgKKRUTyXaF+kgGHfFhmyrY5juJw== 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=NOCfvWhm6ib3Sq/M4H+4rNFDKcZh1Xpj/OCyUUYJZe4=; b=b+HFwjhj0Ddk5bbSKejpY7/Y4LlzcqX1ZU19hKsq1d/BHtlZW///hO/yVLd5zXOu5CElH/EeF9ay/BLAFdQ+NCe5OkTuBvde7vlcYZ9nOnkn9ci7ipIEayY6j1bS4hZ6x5crNw6MHHaW7o29AFuTwvWLKVHDoiclMGc7Fepzq5U= Received: from CH0PR03CA0024.namprd03.prod.outlook.com (2603:10b6:610:b0::29) by PH7PR12MB7308.namprd12.prod.outlook.com (2603:10b6:510:20c::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7633.27; Thu, 6 Jun 2024 20:33:51 +0000 Received: from CH3PEPF0000000B.namprd04.prod.outlook.com (2603:10b6:610:b0:cafe::59) by CH0PR03CA0024.outlook.office365.com (2603:10b6:610:b0::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7656.20 via Frontend Transport; Thu, 6 Jun 2024 20:33:50 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by CH3PEPF0000000B.mail.protection.outlook.com (10.167.244.38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7633.15 via Frontend Transport; Thu, 6 Jun 2024 20:33:48 +0000 Received: from jallen-jump-host.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; Thu, 6 Jun 2024 15:33:47 -0500 From: John Allen To: , , , CC: , , , John Allen Subject: [PATCH v5 3/6] RAS/AMD/ATL: Expand helpers for adding and removing base and hole Date: Thu, 6 Jun 2024 20:33:10 +0000 Message-ID: <20240606203313.51197-4-john.allen@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240606203313.51197-1-john.allen@amd.com> References: <20240606203313.51197-1-john.allen@amd.com> Precedence: bulk X-Mailing-List: linux-edac@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: CH3PEPF0000000B:EE_|PH7PR12MB7308:EE_ X-MS-Office365-Filtering-Correlation-Id: b53e999b-bba6-4337-0a49-08dc8667f880 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|36860700004|376005|1800799015|82310400017; X-Microsoft-Antispam-Message-Info: qpFOvEfxS828mNnW6znTNjLYlz2YiFD3sNbhwuQj4a9R5+gOIofdbNnoJesw7O0Rb3EbXp9Uu+PuvgdOj/1NuZVGL+XOQCwG7HIJbb8/uoKBPavZ0qHJujHAUUkERxEHOVGvLW1iWx5trwJBmIr0vDCVFN5Q9Cm3p/d3y7RfejLe4aAe/9sYMx/FgK3Mdnjzc1zYYdqJDcGrbXW6ZH1Xo1uTGmoDG+WsdrYPaQZ6Qud0SjTKA3fvCQH3981rW4hB4MbfT1ed3UFi+EFrmeqZXXkd3PWQhqTEdlT+VxyFMZ2vgckdnfNjnKl3VbvMKv4fnGlc0/zPQgnhrOqNuzqh3dNRJZ/Sc5zso6KG41WEWT7Ol2Xp33/L2rt+zTwL/ET4NEP5cx9dsFiNp3xNMGOXMeO78KFkt8sJPjGI+6gJZKjmDKpHq/6hndNHTdy7FE7Kq21KrdVIB2vXEHll9zjyB/lM5hL61z2NPPRcnsHMvRsw2xSjdv+/V5zle1hvSuqBehbS9fHIlUyOG2rXjemRDRW2u6qDg9CS2c4EipxKyZ7V+GEeYZAHwk3yigH2fZb0wE7xroFJymKo92DRTRzG3mVNdwDhH0ELRsWTlxsqgV4CIV2UqFLok9ATKWVfFV0WhgUWOeOgo2WYeH81sKCYyWX1/n7AKtlTLUW6rj6ywEkJeKvv/wAWVorGW7/KdMHyX9/ombAGaJdg/TYwUZmfdYD8siypNVjRphHddDxHterE2Cs8EFZ7iiaUsC8dGPFf6uLxuKZZJ5NiF6g6V9um5inn9pKOoyOgzJc1Es2GMCoUbevHahkUuHKmAKNCoLcn6fV5GDTRzjySpccb5b21tzr2mqDA0fYt6UQaetL74qFVbAjYxnlYFugtFK93B83v19NDPi7qPGxgOxchNjPVZdK+5XLWCNPe7eUdUdzCM4BGyvJF8WCO9CnX+7nmvDzQWXkLVERtR/uPtO7AyZnA125EY5VVSkVkFv1StRLa9K0AF+XG+9O6mEc0d2xTUhwQ3ZsyOq8jU4kOeZQ9vgstfFnw1HI1U9lapIunB0FtRjxYrMwwXKwB2EbaBG/hxZIf0/e+xf4T1F0qOWVf1TltgF5oC5imt8F17k97FR7gePGpsVpsYtPKt5kBkrtCAQZSa9oTH2iaXiZoJcdegJ+1sHYw02IUGzYxLPJvdCWN2+27IGZSaG41qdE/lIrPK+RoYfZn32Hs4x/v/YFOBi46jaPPURJ8uL0E7rU3QDVzegsEL+58SWa39HI/srOL1TFciAcrpVsGm8vdvHMLSw7/eJPcvwG88xnbixNYFQCwBVTwIGLzVopec4fl1qQO7PMnEpT4sxCuKJ/1Zu9QDMnZBy2KndovmAjIm/1/Vp5Kf+KkQtS8Dal/Sg1yT5AKq1jTAV8doAH2+B+ngsVJ6W+t2g== 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)(376005)(1800799015)(82310400017);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jun 2024 20:33:48.7880 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b53e999b-bba6-4337-0a49-08dc8667f880 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: CH3PEPF0000000B.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB7308 The ret_addr field in struct addr_ctx contains the intermediate value of the returned address as it passes through multiple steps in the translation process. Currently, adding the DRAM base and legacy hole is only done once, so it operates directly on the intermediate value. However, for DF 4.5 non-power-of-2 denormalization, adding and removing the DRAM base and legacy hole needs to be done for multiple temporary address values. During this process, the intermediate value should not be lost so the ret_addr value can't be reused. Update the existing 'add' helper to operate on an arbitrary address and introduce a new 'remove' helper to do the inverse operations. Reviewed-by: Yazen Ghannam Signed-off-by: John Allen --- v2: - Make remove_base_and_hole the inverse of add_base_and_hole, removing the hole first and then removing the base. - Improve commit description. v3: - Rewrite commit description. - Fix bug in remove_base_and_hole. v5: - Simplify add_base_and_hole and remove_base_and_hole. --- drivers/ras/amd/atl/core.c | 41 +++++++++++++++++++++------------- drivers/ras/amd/atl/internal.h | 3 +++ 2 files changed, 29 insertions(+), 15 deletions(-) diff --git a/drivers/ras/amd/atl/core.c b/drivers/ras/amd/atl/core.c index 82f77f129d54..7cdf7769c189 100644 --- a/drivers/ras/amd/atl/core.c +++ b/drivers/ras/amd/atl/core.c @@ -49,15 +49,26 @@ static bool legacy_hole_en(struct addr_ctx *ctx) return FIELD_GET(DF_LEGACY_MMIO_HOLE_EN, reg); } -static int add_legacy_hole(struct addr_ctx *ctx) +static u64 add_legacy_hole(struct addr_ctx *ctx, u64 addr) { if (!legacy_hole_en(ctx)) - return 0; + return addr; - if (ctx->ret_addr >= df_cfg.dram_hole_base) - ctx->ret_addr += (BIT_ULL(32) - df_cfg.dram_hole_base); + if (addr >= df_cfg.dram_hole_base) + addr += (BIT_ULL(32) - df_cfg.dram_hole_base); - return 0; + return addr; +} + +static u64 remove_legacy_hole(struct addr_ctx *ctx, u64 addr) +{ + if (!legacy_hole_en(ctx)) + return addr; + + if (addr >= df_cfg.dram_hole_base) + addr -= (BIT_ULL(32) - df_cfg.dram_hole_base); + + return addr; } static u64 get_base_addr(struct addr_ctx *ctx) @@ -72,14 +83,14 @@ static u64 get_base_addr(struct addr_ctx *ctx) return base_addr << DF_DRAM_BASE_LIMIT_LSB; } -static int add_base_and_hole(struct addr_ctx *ctx) +u64 add_base_and_hole(struct addr_ctx *ctx, u64 addr) { - ctx->ret_addr += get_base_addr(ctx); - - if (add_legacy_hole(ctx)) - return -EINVAL; + return add_legacy_hole(ctx, addr + get_base_addr(ctx)); +} - return 0; +u64 remove_base_and_hole(struct addr_ctx *ctx, u64 addr) +{ + return remove_legacy_hole(ctx, addr) - get_base_addr(ctx); } static bool late_hole_remove(struct addr_ctx *ctx) @@ -126,14 +137,14 @@ unsigned long norm_to_sys_addr(u8 socket_id, u8 die_id, u8 coh_st_inst_id, unsig if (denormalize_address(&ctx)) return -EINVAL; - if (!late_hole_remove(&ctx) && add_base_and_hole(&ctx)) - return -EINVAL; + if (!late_hole_remove(&ctx)) + ctx.ret_addr = add_base_and_hole(&ctx, ctx.ret_addr); if (dehash_address(&ctx)) return -EINVAL; - if (late_hole_remove(&ctx) && add_base_and_hole(&ctx)) - return -EINVAL; + if (late_hole_remove(&ctx)) + ctx.ret_addr = add_base_and_hole(&ctx, ctx.ret_addr); if (addr_over_limit(&ctx)) return -EINVAL; diff --git a/drivers/ras/amd/atl/internal.h b/drivers/ras/amd/atl/internal.h index 3596ad5ca3e0..f623ac23e4b9 100644 --- a/drivers/ras/amd/atl/internal.h +++ b/drivers/ras/amd/atl/internal.h @@ -239,6 +239,9 @@ int dehash_address(struct addr_ctx *ctx); unsigned long norm_to_sys_addr(u8 socket_id, u8 die_id, u8 coh_st_inst_id, unsigned long addr); unsigned long convert_umc_mca_addr_to_sys_addr(struct atl_err *err); +u64 add_base_and_hole(struct addr_ctx *ctx, u64 addr); +u64 remove_base_and_hole(struct addr_ctx *ctx, u64 addr); + /* * Make a gap in @data that is @num_bits long starting at @bit_num. * e.g. data = 11111111'b From patchwork Thu Jun 6 20:33:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Allen X-Patchwork-Id: 13688937 Received: from NAM04-MW2-obe.outbound.protection.outlook.com (mail-mw2nam04on2086.outbound.protection.outlook.com [40.107.101.86]) (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 935BB13AD0D; Thu, 6 Jun 2024 20:33:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.101.86 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717706037; cv=fail; b=SEaguQtX06buxbN8+8/aiVYrai25omWPK1wTln6ce0E9mPrpV7CQt5c2u8HVeA30/+MQ/0ZU33EUVshlXzhFMVSwer42GQUvU8WwDWD1sZNvmPTdQILTyDpVBpu0SIWB09WFqdMkO0x8xiNzBlp+uRsulKjkObbEOm8dQY3VqE0= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717706037; c=relaxed/simple; bh=HZS3q81HvKzpBK/eoctUUdf2QF03WCm8mxKNH7UQUe8=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=KSJaQQ0u82OL5kITlA6ap8UX3AGMH1u41AC4JN05mYW96aAdASa19EoGZXdiG2pdHC01pgd+gfxcsAvUiNX58g67bRYqdWxrVmj0N9yzAG8tUdPUARWtVSs9Qy+c3z1FxbG7jkjnxi2905WFsld5f+a6dwV3wjwSEpYq9PqL/mI= 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=HlPSXZJv; arc=fail smtp.client-ip=40.107.101.86 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="HlPSXZJv" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WZitRzY53uqE19ma40NmVKVx6j+AKWWZSgN+oDe2qbj/EKtIBAfZW6DUnZu4qKQ//zcgFTB3AhEeiV6p5wUMq1YgCdvfmJoqdBTURqBWnQ8xriVczhugFZHjk7KF4TEATHY7ZIxEmoUv/UoKTBd7ftuXzRH0jQECW5by3ANgfG7DwpFquiL2U1NxKEjp73X5+drSjzM9unyZcwZ6eFUlF3MfwyebX27cl2MCqvwaOsb1QwFtssff583N+8ySrLxwcBeOPso8v9SjMxQehd8NlGih1Au0BauMEdQzC472hlSeLmp0RH2Jasojnuq/60d6BCDiRPj0nbgrCMlby11vbA== 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=ZKRi2p3riJkhUvf2EOJ0WSO41tYfx7BRyhFmYSJqblE=; b=m3QY+e7W0CLiI3M00GQDVb66UGxJ6NTJtV3lE/CMi1Sq4loQkz13nXtosqxAt/yWmldGTpQIWWX/dc3+cGOSBt2t0qNe9Su6qSfmUrerWEyN18g8EknT003iAHQgRwqoHPfTJi9X/dMBIacoiBDVOTt5Iybe8VL5PLS962NkrRKaGC3zQIJOZRsV0xp6UdFJL0b7KD/BehSRV5TQtCV78yxbCm9PRohA3vZ1swC4GXZiWPXLrEksGDkUcj9F2buBHbVmI95uO1613SroGwGMjFHNzwaoJRh1eC9NUD7cteZskLGUKgzuLTCku3YgMJpwx0cwvUlKdln823viPasPww== 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=ZKRi2p3riJkhUvf2EOJ0WSO41tYfx7BRyhFmYSJqblE=; b=HlPSXZJv7meMyIWp6I3fDtOmFCc+i0v/0Og4DjjrVApmjv/A3l6syNaAqIhI2p7k+Nn5fJ6cz7KEJJ6l78rlDtRM6rQ4BgWJehEwBjW6vMSr25Rz0ov/QYsI/mLRc86cCQIF5POxnIQxvM9WH4Rf0/YqID3awh4rRXnh98S5ngA= Received: from CH2PR18CA0016.namprd18.prod.outlook.com (2603:10b6:610:4f::26) by IA0PR12MB8931.namprd12.prod.outlook.com (2603:10b6:208:48a::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7633.21; Thu, 6 Jun 2024 20:33:53 +0000 Received: from CH3PEPF00000010.namprd04.prod.outlook.com (2603:10b6:610:4f:cafe::b3) by CH2PR18CA0016.outlook.office365.com (2603:10b6:610:4f::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7633.29 via Frontend Transport; Thu, 6 Jun 2024 20:33:53 +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 CH3PEPF00000010.mail.protection.outlook.com (10.167.244.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7633.15 via Frontend Transport; Thu, 6 Jun 2024 20:33:52 +0000 Received: from jallen-jump-host.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; Thu, 6 Jun 2024 15:33:51 -0500 From: John Allen To: , , , CC: , , , John Allen Subject: [PATCH v5 4/6] RAS/AMD/ATL: Validate address map when information is gathered Date: Thu, 6 Jun 2024 20:33:11 +0000 Message-ID: <20240606203313.51197-5-john.allen@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240606203313.51197-1-john.allen@amd.com> References: <20240606203313.51197-1-john.allen@amd.com> Precedence: bulk X-Mailing-List: linux-edac@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: CH3PEPF00000010:EE_|IA0PR12MB8931:EE_ X-MS-Office365-Filtering-Correlation-Id: 5a4aa912-1f67-4822-0d36-08dc8667fae7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|82310400017|36860700004|376005|1800799015; X-Microsoft-Antispam-Message-Info: RTrtLZzdEAbT2vmXWZgN9pwTbXKuDqo7er7bF0pBcwxxE0zTcBLkxmM7RDWYBmem3h7hE1lUbw1cbdqWMISnbH9dVW5qJAVDVaf+Lm/JpExgVomFgyMCoN4cOtL6HdY7lBvZePt2LUCFuTRClCKc9tMTafk3X7UOHC32U9j7XfaQHTI2C6LWa5fPwpZ6ezMJfnb5MCdnw6aWfuX7HW8QMVypA6D6hrQXRHPVH3f8i6XtHCjtpRreuzh0QblXDKSL1f3G8GX/7QQ/BUfEyneCrzjT8lVD66CTudysqHj/YEwgEsrmTJhK9T5yqrL5EmvRz54aqnDsREiY8YueTngisRCx4k+HZ+kFwJTHbza0wxpnDfJEqxVjloD/CKSHINxlLZEfEq83k57wI/aaaOG9IVOWQeotg23+bP5TZ3TP/sHkoFGktYn079k9RQ1BrXu7WVnmb9hVDyJJwvAs1TL96t1i+G6NYuvt2MTzhDHMg+5Waj2U+0OGnK+HmRfgciDloB3LxU6eB6k4fNi38jUEH4iAzjbekspC/mkxnugtrR2V3vUO4SDC4oD/YO4kNdtMtkkmsUbj8Qqi4hv/qtsXQyrzrSILJ6gX4SOMwKs+2ci3JQ8edY7p/H3C19UZDBdbLu95hAL++qAfi9r6uM6p65U9aty5+lIgjm76f70Bf30a7HctNPhvVBezeHoy8VegWobP9LfzG2I+YEgq/Q232gKpAfoYqzO6AsqSqMMP9dFqjtoO4LrfRcrj6FSuPJjCzIlvbBuYdXfHFCyyTJTPRVfBE9c+mkG7oZjxybGGpdrMCJDzlYYnKCiGS2cBMDXrwwh+RC04TW6pEgJR1jgUKYDE1adWR1ND8EUWcLkB9MpyiW+l3JvF+k7LVBkkWkFSFrIePlEgY06yZQd4NpZ5pYKtY/yeUEm8lCE6NT2GQW/aZGpGE+lRR+FcD702KyaE47K2i8JHsNiNbmlAygOrLtjS2WDuraH46qOCkHkcajX0yAobFyGIUd61NtWGoAIeTltcyllT17mxnRczBhuAZSrlZLfY3O7H+zrnY8TFabMVPcRkalUh8p1iYq0Wc9BtBzFUPTORlAUEOQC37nFPdv0mqSc3fqWD/KanXkJO1sT2Wew5CqVmiuXU0wTo+lR90Tu6/mwwSZW0Rt2f7vUt5JcbUn6ZZzgBVALyAWl9OfjvS5dVaaXFvBsvZYv+IGgT00E8FC6IuNLuaZVcHelNkTANAV814PFiUv0xVmTnkk7t8WJ4qVREXT/iLNbL1ueItk69JGznIo7cotVtZickCokfMKH+Ps0xMQnofVPOxSUlBMUZSioblHVBbmG4m8a/nMRYiE7geJeolc3ToCOsG68fJUS+CMtkZoOgGiOydnnDEm1xf5r8kHLs47QN7wfhY4hZtNP/YAee6kcnFxz7EA== 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)(82310400017)(36860700004)(376005)(1800799015);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jun 2024 20:33:52.8186 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5a4aa912-1f67-4822-0d36-08dc8667fae7 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: CH3PEPF00000010.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA0PR12MB8931 Validate address maps at the time the information is gathered as the address map will not change during translation. Reviewed-by: Yazen Ghannam Signed-off-by: John Allen --- v2: - New in v2. v3: - Move DF 4.5 np2 validation to patch 4. - Update commit description. v4: - Merge common cases in map validation function. - Fix map validation for cases that don't have explicit checks. v5: - Rename "out" label to "err". --- drivers/ras/amd/atl/dehash.c | 43 -------------------- drivers/ras/amd/atl/map.c | 77 ++++++++++++++++++++++++++++++++++++ 2 files changed, 77 insertions(+), 43 deletions(-) diff --git a/drivers/ras/amd/atl/dehash.c b/drivers/ras/amd/atl/dehash.c index 4ea46262c4f5..d4ee7ecabaee 100644 --- a/drivers/ras/amd/atl/dehash.c +++ b/drivers/ras/amd/atl/dehash.c @@ -12,41 +12,10 @@ #include "internal.h" -/* - * Verify the interleave bits are correct in the different interleaving - * settings. - * - * If @num_intlv_dies and/or @num_intlv_sockets are 1, it means the - * respective interleaving is disabled. - */ -static inline bool map_bits_valid(struct addr_ctx *ctx, u8 bit1, u8 bit2, - u8 num_intlv_dies, u8 num_intlv_sockets) -{ - if (!(ctx->map.intlv_bit_pos == bit1 || ctx->map.intlv_bit_pos == bit2)) { - pr_debug("Invalid interleave bit: %u", ctx->map.intlv_bit_pos); - return false; - } - - if (ctx->map.num_intlv_dies > num_intlv_dies) { - pr_debug("Invalid number of interleave dies: %u", ctx->map.num_intlv_dies); - return false; - } - - if (ctx->map.num_intlv_sockets > num_intlv_sockets) { - pr_debug("Invalid number of interleave sockets: %u", ctx->map.num_intlv_sockets); - return false; - } - - return true; -} - static int df2_dehash_addr(struct addr_ctx *ctx) { u8 hashed_bit, intlv_bit, intlv_bit_pos; - if (!map_bits_valid(ctx, 8, 9, 1, 1)) - return -EINVAL; - intlv_bit_pos = ctx->map.intlv_bit_pos; intlv_bit = !!(BIT_ULL(intlv_bit_pos) & ctx->ret_addr); @@ -67,9 +36,6 @@ static int df3_dehash_addr(struct addr_ctx *ctx) bool hash_ctl_64k, hash_ctl_2M, hash_ctl_1G; u8 hashed_bit, intlv_bit, intlv_bit_pos; - if (!map_bits_valid(ctx, 8, 9, 1, 1)) - return -EINVAL; - hash_ctl_64k = FIELD_GET(DF3_HASH_CTL_64K, ctx->map.ctl); hash_ctl_2M = FIELD_GET(DF3_HASH_CTL_2M, ctx->map.ctl); hash_ctl_1G = FIELD_GET(DF3_HASH_CTL_1G, ctx->map.ctl); @@ -171,9 +137,6 @@ static int df4_dehash_addr(struct addr_ctx *ctx) bool hash_ctl_64k, hash_ctl_2M, hash_ctl_1G; u8 hashed_bit, intlv_bit; - if (!map_bits_valid(ctx, 8, 8, 1, 2)) - return -EINVAL; - hash_ctl_64k = FIELD_GET(DF4_HASH_CTL_64K, ctx->map.ctl); hash_ctl_2M = FIELD_GET(DF4_HASH_CTL_2M, ctx->map.ctl); hash_ctl_1G = FIELD_GET(DF4_HASH_CTL_1G, ctx->map.ctl); @@ -247,9 +210,6 @@ static int df4p5_dehash_addr(struct addr_ctx *ctx) u8 hashed_bit, intlv_bit; u64 rehash_vector; - if (!map_bits_valid(ctx, 8, 8, 1, 2)) - return -EINVAL; - hash_ctl_64k = FIELD_GET(DF4_HASH_CTL_64K, ctx->map.ctl); hash_ctl_2M = FIELD_GET(DF4_HASH_CTL_2M, ctx->map.ctl); hash_ctl_1G = FIELD_GET(DF4_HASH_CTL_1G, ctx->map.ctl); @@ -360,9 +320,6 @@ static int mi300_dehash_addr(struct addr_ctx *ctx) bool hashed_bit, intlv_bit, test_bit; u8 num_intlv_bits, base_bit, i; - if (!map_bits_valid(ctx, 8, 8, 4, 1)) - return -EINVAL; - hash_ctl_4k = FIELD_GET(DF4p5_HASH_CTL_4K, ctx->map.ctl); hash_ctl_64k = FIELD_GET(DF4_HASH_CTL_64K, ctx->map.ctl); hash_ctl_2M = FIELD_GET(DF4_HASH_CTL_2M, ctx->map.ctl); diff --git a/drivers/ras/amd/atl/map.c b/drivers/ras/amd/atl/map.c index 8b908e8d7495..04419923f088 100644 --- a/drivers/ras/amd/atl/map.c +++ b/drivers/ras/amd/atl/map.c @@ -642,6 +642,79 @@ static int get_global_map_data(struct addr_ctx *ctx) return 0; } +/* + * Verify the interleave bits are correct in the different interleaving + * settings. + * + * If @num_intlv_dies and/or @num_intlv_sockets are 1, it means the + * respective interleaving is disabled. + */ +static inline bool map_bits_valid(struct addr_ctx *ctx, u8 bit1, u8 bit2, + u8 num_intlv_dies, u8 num_intlv_sockets) +{ + if (!(ctx->map.intlv_bit_pos == bit1 || ctx->map.intlv_bit_pos == bit2)) { + pr_debug("Invalid interleave bit: %u", ctx->map.intlv_bit_pos); + return false; + } + + if (ctx->map.num_intlv_dies > num_intlv_dies) { + pr_debug("Invalid number of interleave dies: %u", ctx->map.num_intlv_dies); + return false; + } + + if (ctx->map.num_intlv_sockets > num_intlv_sockets) { + pr_debug("Invalid number of interleave sockets: %u", ctx->map.num_intlv_sockets); + return false; + } + + return true; +} + +static int validate_address_map(struct addr_ctx *ctx) +{ + switch (ctx->map.intlv_mode) { + case DF2_2CHAN_HASH: + case DF3_COD4_2CHAN_HASH: + case DF3_COD2_4CHAN_HASH: + case DF3_COD1_8CHAN_HASH: + if (!map_bits_valid(ctx, 8, 9, 1, 1)) + goto err; + break; + + case DF4_NPS4_2CHAN_HASH: + case DF4_NPS2_4CHAN_HASH: + case DF4_NPS1_8CHAN_HASH: + case DF4p5_NPS4_2CHAN_1K_HASH: + case DF4p5_NPS4_2CHAN_2K_HASH: + case DF4p5_NPS2_4CHAN_1K_HASH: + case DF4p5_NPS2_4CHAN_2K_HASH: + case DF4p5_NPS1_8CHAN_1K_HASH: + case DF4p5_NPS1_8CHAN_2K_HASH: + case DF4p5_NPS1_16CHAN_1K_HASH: + case DF4p5_NPS1_16CHAN_2K_HASH: + if (!map_bits_valid(ctx, 8, 8, 1, 2)) + goto err; + break; + + case MI3_HASH_8CHAN: + case MI3_HASH_16CHAN: + case MI3_HASH_32CHAN: + if (!map_bits_valid(ctx, 8, 8, 4, 1)) + goto err; + break; + + /* Nothing to do for modes that don't need special validation checks. */ + default: + break; + } + + return 0; + +err: + atl_debug(ctx, "Inconsistent address map"); + return -EINVAL; +} + static void dump_address_map(struct dram_addr_map *map) { u8 i; @@ -678,5 +751,9 @@ int get_address_map(struct addr_ctx *ctx) dump_address_map(&ctx->map); + ret = validate_address_map(ctx); + if (ret) + return ret; + return ret; } From patchwork Thu Jun 6 20:33:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Allen X-Patchwork-Id: 13688939 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2085.outbound.protection.outlook.com [40.107.237.85]) (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 759AF19AD73; Thu, 6 Jun 2024 20:34:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.237.85 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717706044; cv=fail; b=HmfPjIBujiVQy/iKNhK6QM8k+7tivGzYxkbXf4jUYwNFiRS49vyzU2avAxhosq/b3auDunblO3vs60VvifHkChDBxS6j5ohvJmDrV5xL4lcCjjwJH8Cu5NhEZlhWohxJ/AxDv1OLf7GPVJ80l1BuOR57Qg1hEmC2ahPF6RfFGJk= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717706044; c=relaxed/simple; bh=etPo4WY4xIizRy6iDb7hu3jArsvG1MUTR3NG8yNtQtU=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=SJQMfPaOMQz/Ii2YikQpuxSxoY6t/EhblnlxoChanAMROG47Z1qvYRw/wKUU0uptJIK900QpgG7nRgcHKWfm0dXRIKmvNc41W0ON94hsFiepTg3vycMsd8eUpCQLgZddpNBJHVYDLDJcJXt1JUbLmU/YWUqBSsJeqGv+6SyagcU= 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=gPbloCdn; arc=fail smtp.client-ip=40.107.237.85 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="gPbloCdn" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EgMF8QuVx5Kh/d7utMn9ptuByyd7n+oI//XJDUvsYtgQmIhQNBqTZnPwx6Sh/xceiXWBHBW2ef0cC+VSYN7+t1Ger1R5NNaYtbzBi3QhSh6LFsLZVlUJeNth/uxUUhud4KgCqHzfYfyfehdp8BfKds4p9uwmY35tJhxDLmIoJAJ86y7PF/m1NxnFFnNTu/Iu3p9m6yMkuaVcmKyD5XWljoOkfaYL9mHvlPrbLIEgpW3RKDFyMsSj95FHdPrSUCRd7BE5hkfNFHGPGiDOu6ShY71kGvuo5S5abKwabtwDXl0+QbIVTqhHY5EmCh5tfArOF3/fVF/uLhfd9vZXfDHFOA== 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=MPzJInAFhjs24o713G5/alYclQCy7leVKqTDfEiX5iM=; b=XMAkNWAVBBK6GKPfGeRuDMdgCzfOt7hiFSCt0/A9EcLAn9Gh6OKLTPhNo758z/+oh5xBDlPH7auZUqmfXc8XE8aKyt+O8Qfp9n7c7TI5+2tvn9203G6xv03p3+TSHoVZEIeGoBwjDblFnTBJVuINDYy05BVPzvqJnRmR9jTXRztY9p/5LSR/3oS0WXsuV5b0ts4WlKEvkHSVnN0g1E3PasxFdV9UO29BXeIL6HStWJnmHWfSoWlbEPr1AtBWpKGDywQ7Oedf1y2dY4pDnFC5fFDlIs2+y3AJp1pUDPMVsvQ9o9+HMl3UgugU3vY5ms4eFDPhJk0YlcCHmROcHbxXNg== 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=MPzJInAFhjs24o713G5/alYclQCy7leVKqTDfEiX5iM=; b=gPbloCdnTaf8TeM3RsvAVg17FW39PfVSM5PEJq1wGEYPFYTku6cPvmJ92i9AVoJ4TN4ceknkjPA3Sphl02bxBkHnit/bukwC+igZVW6JpNjwNRizmQ1mBo2ciuOmdUFrxK59HZmPd2KvN87ZdCZUWyUIWc0gD+SnfKa7r4mYL4c= Received: from CH0PR04CA0030.namprd04.prod.outlook.com (2603:10b6:610:76::35) by CH3PR12MB7521.namprd12.prod.outlook.com (2603:10b6:610:143::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7633.34; Thu, 6 Jun 2024 20:33:58 +0000 Received: from CH3PEPF00000009.namprd04.prod.outlook.com (2603:10b6:610:76:cafe::5b) by CH0PR04CA0030.outlook.office365.com (2603:10b6:610:76::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7656.21 via Frontend Transport; Thu, 6 Jun 2024 20:33:58 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by CH3PEPF00000009.mail.protection.outlook.com (10.167.244.36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7633.15 via Frontend Transport; Thu, 6 Jun 2024 20:33:58 +0000 Received: from jallen-jump-host.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; Thu, 6 Jun 2024 15:33:57 -0500 From: John Allen To: , , , CC: , , , John Allen Subject: [PATCH v5 5/6] RAS/AMD/ATL: Implement DF 4.5 NP2 denormalization Date: Thu, 6 Jun 2024 20:33:12 +0000 Message-ID: <20240606203313.51197-6-john.allen@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240606203313.51197-1-john.allen@amd.com> References: <20240606203313.51197-1-john.allen@amd.com> Precedence: bulk X-Mailing-List: linux-edac@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: CH3PEPF00000009:EE_|CH3PR12MB7521:EE_ X-MS-Office365-Filtering-Correlation-Id: edaa5a35-0a8a-4526-3208-08dc8667fe59 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|376005|36860700004|82310400017|1800799015; X-Microsoft-Antispam-Message-Info: HkuYZskVr1zWXeyTax1eLglpprzaxUgOcOtU53nbjVbGj3vhjDb1Bv08dg0n0y/E/Kz7CQMHB1f/ZcUBO1n0IOWq6J84BRkWQJOFNn/xiCFR3I6cgDThjzN0x29DiuEuHRzH0WkyOc/wmL5asenjp+G+wBm5caq3pgbtCx3E24L5GRKRKSxBRc1Ywtl+mzEbnV+8kHHDlO+z/PUYFd6wfHTwdGUeb8jjTjR1vLF5Dhs+E4BNZsWneP0A0tNCHm0pidnOpWlYMg/1eLSNTdNKs49EDBGIU2JnpCnD+CfbIdZuqx1fg5ECreClZLTgQCv3wH9aSeSWC00en+kElQEFILhLJ0m9XXJ6rOcb403aWG1yTvDGjczgDZoADrmG0iFK1l24afP6wWTH9WBkurzM5pO8BZfRoG/ho4yCWfbC2SKAahQN7WKfTZKmLDFviwBpHv/tb2+VWceThlpPk3llmWm6Hkjkic+WMYL5zf4WYpbD9ICTNiv2WHyL6Ov24umxAaPH5AZuT5mwKEDn+I1DzXeZbEhJydjc+MTsKoXQ7vMIcmWiCgONqReivZFKnhjHI+GUv9HDyfEgCqubajXmG0SqKdodHoR5N1sI04nW1sQkAIhMJH29QkumVP1NexpL1rC52sGXUAUzCHgFwtY5uWZBMErWTTFEUo0n50h+QxyVkHN1JXalJCsnDLZq77+/3xXuO65Q+mGL9ILXPyjhsh87iIOR2/MupExZbLgm3/q62yFWV3FPKI2nwH0FHGasTwHXLpcbQ62N2m/eCpZkwyJMoT9dvMZ4Xp+kanYomVl6VKbz3vPzPbRp/pImxo9hdIOMF37tkMc/CeY8y3Jt+zOju6tgxvHmPVDDbCH3SbDjVAJ9W2xqtANgHIs1//8idvcxWHgC+4Xl2nynrkB9TxwWCTk/c5IxMH2l1nHsGADuLuw/s9JLKKzjVK+lFyRJ8vS5UF2R/11hbyuSrm2Qb0K0HolAusiXeNIFjG+rS3nJgkaf15QP8XEvw2y28PpEM/YbsC5RTPBlB/tgjcNeAVrU/sWVqwYeGMMf5B04Fpbx8shk0B+b2ZYszLQvyVgydw0/3gvtP/8j6GluiMqKdxxT5i0bGZV9JymoFWiT6D2Lc3cfiIhYsRrN69p4sFYNz/4UbGNnimqGRpPKkqEFLMzklF5rCuiOmKE0yzO96slYIfqToYiepPffIoUsvK/Mm8csMEyHBXEBt3JlZ+vjEBsTRuCvJjo/ZC3VG6mZffxKrOOCzIxc6aaUEk37oSDkgPHDC/Lr4oBwzCi3HJvPSpCerXm6+EqKekfyTStmRcaXrFDfolXyfwlLHpS1LUgrTf81OjhIRDVnx9pPpcoz9JWjh6g40rYvP4f0JQ1me0LddWfpKU2wQUFT8kj8DQCgWqGrDjQyOVDMSVGl+5XdgQ== 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)(376005)(36860700004)(82310400017)(1800799015);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jun 2024 20:33:58.5998 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: edaa5a35-0a8a-4526-3208-08dc8667fe59 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: CH3PEPF00000009.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR12MB7521 Unlike with previous Data Fabric versions, with Data Fabric 4.5 non-power-of-2 denormalization, there are bits of the system physical address that can't be fully reconstructed from the normalized address. To determine the proper combination of missing system physical address bits, iterate through each possible combination of these bits, normalize the resulting system physical address, and compare to the original address that is being translated. If the addresses match, then the correct permutation of bits has been found. Reviewed-by: Yazen Ghannam Signed-off-by: John Allen --- v2: - Move map validation to patch 3/4. v3: - Change return value of get_logical_coh_st_fabric_id_for_current_spa to u16. - Initialize variables where defined in normalize_addr_df4p5_np2. - check_logical_coh_st_fabric_id: - Rename to match_logical_coh_st_fabric_id. - Shorten local variable name. - Simplify return logic. - check_norm_addr: - Rename to match_norm_addr. - Shorten local variable name and reuse single variable for multiple uses. - Simplify return logic. v5: - Add newlines after breaks in case statements. - Remove variable names from comments in df4p5_denorm_ctx. --- drivers/ras/amd/atl/denormalize.c | 561 ++++++++++++++++++++++++++++++ drivers/ras/amd/atl/internal.h | 40 +++ drivers/ras/amd/atl/map.c | 20 ++ 3 files changed, 621 insertions(+) diff --git a/drivers/ras/amd/atl/denormalize.c b/drivers/ras/amd/atl/denormalize.c index e279224288d6..1a525cfa983c 100644 --- a/drivers/ras/amd/atl/denormalize.c +++ b/drivers/ras/amd/atl/denormalize.c @@ -448,6 +448,118 @@ static u16 get_logical_coh_st_fabric_id(struct addr_ctx *ctx) return (phys_fabric_id & df_cfg.node_id_mask) | log_fabric_id; } +static u16 get_logical_coh_st_fabric_id_for_current_spa(struct addr_ctx *ctx, + struct df4p5_denorm_ctx *denorm_ctx) +{ + bool hash_ctl_64k, hash_ctl_2M, hash_ctl_1G, hash_ctl_1T; + bool hash_pa8, hash_pa9, hash_pa12, hash_pa13; + u64 cs_id = 0; + + hash_ctl_64k = FIELD_GET(DF4_HASH_CTL_64K, ctx->map.ctl); + hash_ctl_2M = FIELD_GET(DF4_HASH_CTL_2M, ctx->map.ctl); + hash_ctl_1G = FIELD_GET(DF4_HASH_CTL_1G, ctx->map.ctl); + hash_ctl_1T = FIELD_GET(DF4p5_HASH_CTL_1T, ctx->map.ctl); + + hash_pa8 = FIELD_GET(BIT_ULL(8), denorm_ctx->current_spa); + hash_pa8 ^= FIELD_GET(BIT_ULL(14), denorm_ctx->current_spa); + hash_pa8 ^= FIELD_GET(BIT_ULL(16), denorm_ctx->current_spa) & hash_ctl_64k; + hash_pa8 ^= FIELD_GET(BIT_ULL(21), denorm_ctx->current_spa) & hash_ctl_2M; + hash_pa8 ^= FIELD_GET(BIT_ULL(30), denorm_ctx->current_spa) & hash_ctl_1G; + hash_pa8 ^= FIELD_GET(BIT_ULL(40), denorm_ctx->current_spa) & hash_ctl_1T; + + hash_pa9 = FIELD_GET(BIT_ULL(9), denorm_ctx->current_spa); + hash_pa9 ^= FIELD_GET(BIT_ULL(17), denorm_ctx->current_spa) & hash_ctl_64k; + hash_pa9 ^= FIELD_GET(BIT_ULL(22), denorm_ctx->current_spa) & hash_ctl_2M; + hash_pa9 ^= FIELD_GET(BIT_ULL(31), denorm_ctx->current_spa) & hash_ctl_1G; + hash_pa9 ^= FIELD_GET(BIT_ULL(41), denorm_ctx->current_spa) & hash_ctl_1T; + + hash_pa12 = FIELD_GET(BIT_ULL(12), denorm_ctx->current_spa); + hash_pa12 ^= FIELD_GET(BIT_ULL(18), denorm_ctx->current_spa) & hash_ctl_64k; + hash_pa12 ^= FIELD_GET(BIT_ULL(23), denorm_ctx->current_spa) & hash_ctl_2M; + hash_pa12 ^= FIELD_GET(BIT_ULL(32), denorm_ctx->current_spa) & hash_ctl_1G; + hash_pa12 ^= FIELD_GET(BIT_ULL(42), denorm_ctx->current_spa) & hash_ctl_1T; + + hash_pa13 = FIELD_GET(BIT_ULL(13), denorm_ctx->current_spa); + hash_pa13 ^= FIELD_GET(BIT_ULL(19), denorm_ctx->current_spa) & hash_ctl_64k; + hash_pa13 ^= FIELD_GET(BIT_ULL(24), denorm_ctx->current_spa) & hash_ctl_2M; + hash_pa13 ^= FIELD_GET(BIT_ULL(33), denorm_ctx->current_spa) & hash_ctl_1G; + hash_pa13 ^= FIELD_GET(BIT_ULL(43), denorm_ctx->current_spa) & hash_ctl_1T; + + switch (ctx->map.intlv_mode) { + case DF4p5_NPS0_24CHAN_1K_HASH: + cs_id = FIELD_GET(GENMASK_ULL(63, 13), denorm_ctx->current_spa) << 3; + cs_id %= denorm_ctx->mod_value; + cs_id <<= 2; + cs_id |= (hash_pa9 | (hash_pa12 << 1)); + cs_id |= hash_pa8 << df_cfg.socket_id_shift; + break; + + case DF4p5_NPS0_24CHAN_2K_HASH: + cs_id = FIELD_GET(GENMASK_ULL(63, 14), denorm_ctx->current_spa) << 4; + cs_id %= denorm_ctx->mod_value; + cs_id <<= 2; + cs_id |= (hash_pa12 | (hash_pa13 << 1)); + cs_id |= hash_pa8 << df_cfg.socket_id_shift; + break; + + case DF4p5_NPS1_12CHAN_1K_HASH: + cs_id = FIELD_GET(GENMASK_ULL(63, 12), denorm_ctx->current_spa) << 2; + cs_id %= denorm_ctx->mod_value; + cs_id <<= 2; + cs_id |= (hash_pa8 | (hash_pa9 << 1)); + break; + + case DF4p5_NPS1_12CHAN_2K_HASH: + cs_id = FIELD_GET(GENMASK_ULL(63, 13), denorm_ctx->current_spa) << 3; + cs_id %= denorm_ctx->mod_value; + cs_id <<= 2; + cs_id |= (hash_pa8 | (hash_pa12 << 1)); + break; + + case DF4p5_NPS2_6CHAN_1K_HASH: + case DF4p5_NPS1_10CHAN_1K_HASH: + cs_id = FIELD_GET(GENMASK_ULL(63, 12), denorm_ctx->current_spa) << 2; + cs_id |= (FIELD_GET(BIT_ULL(9), denorm_ctx->current_spa) << 1); + cs_id %= denorm_ctx->mod_value; + cs_id <<= 1; + cs_id |= hash_pa8; + break; + + case DF4p5_NPS2_6CHAN_2K_HASH: + case DF4p5_NPS1_10CHAN_2K_HASH: + cs_id = FIELD_GET(GENMASK_ULL(63, 12), denorm_ctx->current_spa) << 2; + cs_id %= denorm_ctx->mod_value; + cs_id <<= 1; + cs_id |= hash_pa8; + break; + + case DF4p5_NPS4_3CHAN_1K_HASH: + case DF4p5_NPS2_5CHAN_1K_HASH: + cs_id = FIELD_GET(GENMASK_ULL(63, 12), denorm_ctx->current_spa) << 2; + cs_id |= FIELD_GET(GENMASK_ULL(9, 8), denorm_ctx->current_spa); + cs_id %= denorm_ctx->mod_value; + break; + + case DF4p5_NPS4_3CHAN_2K_HASH: + case DF4p5_NPS2_5CHAN_2K_HASH: + cs_id = FIELD_GET(GENMASK_ULL(63, 12), denorm_ctx->current_spa) << 2; + cs_id |= FIELD_GET(BIT_ULL(8), denorm_ctx->current_spa) << 1; + cs_id %= denorm_ctx->mod_value; + break; + + default: + atl_debug_on_bad_intlv_mode(ctx); + return 0; + } + + if (cs_id > 0xffff) { + atl_debug(ctx, "Translation error: Resulting cs_id larger than u16\n"); + return 0; + } + + return cs_id; +} + static int denorm_addr_common(struct addr_ctx *ctx) { u64 denorm_addr; @@ -699,6 +811,442 @@ static int denorm_addr_df4_np2(struct addr_ctx *ctx) return 0; } +static u64 normalize_addr_df4p5_np2(struct addr_ctx *ctx, struct df4p5_denorm_ctx *denorm_ctx, + u64 addr) +{ + u64 temp_addr_a = 0, temp_addr_b = 0; + + switch (ctx->map.intlv_mode) { + case DF4p5_NPS0_24CHAN_1K_HASH: + case DF4p5_NPS1_12CHAN_1K_HASH: + case DF4p5_NPS2_6CHAN_1K_HASH: + case DF4p5_NPS4_3CHAN_1K_HASH: + case DF4p5_NPS1_10CHAN_1K_HASH: + case DF4p5_NPS2_5CHAN_1K_HASH: + temp_addr_a = FIELD_GET(GENMASK_ULL(11, 10), addr) << 8; + break; + + case DF4p5_NPS0_24CHAN_2K_HASH: + case DF4p5_NPS1_12CHAN_2K_HASH: + case DF4p5_NPS2_6CHAN_2K_HASH: + case DF4p5_NPS4_3CHAN_2K_HASH: + case DF4p5_NPS1_10CHAN_2K_HASH: + case DF4p5_NPS2_5CHAN_2K_HASH: + temp_addr_a = FIELD_GET(GENMASK_ULL(11, 9), addr) << 8; + break; + + default: + atl_debug_on_bad_intlv_mode(ctx); + return 0; + } + + switch (ctx->map.intlv_mode) { + case DF4p5_NPS0_24CHAN_1K_HASH: + temp_addr_b = FIELD_GET(GENMASK_ULL(63, 13), addr) / denorm_ctx->mod_value; + temp_addr_b <<= 10; + break; + + case DF4p5_NPS0_24CHAN_2K_HASH: + temp_addr_b = FIELD_GET(GENMASK_ULL(63, 14), addr) / denorm_ctx->mod_value; + temp_addr_b <<= 11; + break; + + case DF4p5_NPS1_12CHAN_1K_HASH: + temp_addr_b = FIELD_GET(GENMASK_ULL(63, 12), addr) / denorm_ctx->mod_value; + temp_addr_b <<= 10; + break; + + case DF4p5_NPS1_12CHAN_2K_HASH: + temp_addr_b = FIELD_GET(GENMASK_ULL(63, 13), addr) / denorm_ctx->mod_value; + temp_addr_b <<= 11; + break; + + case DF4p5_NPS2_6CHAN_1K_HASH: + case DF4p5_NPS1_10CHAN_1K_HASH: + temp_addr_b = FIELD_GET(GENMASK_ULL(63, 12), addr) << 1; + temp_addr_b |= FIELD_GET(BIT_ULL(9), addr); + temp_addr_b /= denorm_ctx->mod_value; + temp_addr_b <<= 10; + break; + + case DF4p5_NPS2_6CHAN_2K_HASH: + case DF4p5_NPS1_10CHAN_2K_HASH: + temp_addr_b = FIELD_GET(GENMASK_ULL(63, 12), addr) / denorm_ctx->mod_value; + temp_addr_b <<= 11; + break; + + case DF4p5_NPS4_3CHAN_1K_HASH: + case DF4p5_NPS2_5CHAN_1K_HASH: + temp_addr_b = FIELD_GET(GENMASK_ULL(63, 12), addr) << 2; + temp_addr_b |= FIELD_GET(GENMASK_ULL(9, 8), addr); + temp_addr_b /= denorm_ctx->mod_value; + temp_addr_b <<= 10; + break; + + case DF4p5_NPS4_3CHAN_2K_HASH: + case DF4p5_NPS2_5CHAN_2K_HASH: + temp_addr_b = FIELD_GET(GENMASK_ULL(63, 12), addr) << 1; + temp_addr_b |= FIELD_GET(BIT_ULL(8), addr); + temp_addr_b /= denorm_ctx->mod_value; + temp_addr_b <<= 11; + break; + + default: + atl_debug_on_bad_intlv_mode(ctx); + return 0; + } + + return denorm_ctx->base_denorm_addr | temp_addr_a | temp_addr_b; +} + +static void recalculate_hashed_bits_df4p5_np2(struct addr_ctx *ctx, + struct df4p5_denorm_ctx *denorm_ctx) +{ + bool hash_ctl_64k, hash_ctl_2M, hash_ctl_1G, hash_ctl_1T, hashed_bit; + + if (!denorm_ctx->rehash_vector) + return; + + hash_ctl_64k = FIELD_GET(DF4_HASH_CTL_64K, ctx->map.ctl); + hash_ctl_2M = FIELD_GET(DF4_HASH_CTL_2M, ctx->map.ctl); + hash_ctl_1G = FIELD_GET(DF4_HASH_CTL_1G, ctx->map.ctl); + hash_ctl_1T = FIELD_GET(DF4p5_HASH_CTL_1T, ctx->map.ctl); + + if (denorm_ctx->rehash_vector & BIT_ULL(8)) { + hashed_bit = FIELD_GET(BIT_ULL(8), denorm_ctx->current_spa); + hashed_bit ^= FIELD_GET(BIT_ULL(14), denorm_ctx->current_spa); + hashed_bit ^= FIELD_GET(BIT_ULL(16), denorm_ctx->current_spa) & hash_ctl_64k; + hashed_bit ^= FIELD_GET(BIT_ULL(21), denorm_ctx->current_spa) & hash_ctl_2M; + hashed_bit ^= FIELD_GET(BIT_ULL(30), denorm_ctx->current_spa) & hash_ctl_1G; + hashed_bit ^= FIELD_GET(BIT_ULL(40), denorm_ctx->current_spa) & hash_ctl_1T; + + if (FIELD_GET(BIT_ULL(8), denorm_ctx->current_spa) != hashed_bit) + denorm_ctx->current_spa ^= BIT_ULL(8); + } + + if (denorm_ctx->rehash_vector & BIT_ULL(9)) { + hashed_bit = FIELD_GET(BIT_ULL(9), denorm_ctx->current_spa); + hashed_bit ^= FIELD_GET(BIT_ULL(17), denorm_ctx->current_spa) & hash_ctl_64k; + hashed_bit ^= FIELD_GET(BIT_ULL(22), denorm_ctx->current_spa) & hash_ctl_2M; + hashed_bit ^= FIELD_GET(BIT_ULL(31), denorm_ctx->current_spa) & hash_ctl_1G; + hashed_bit ^= FIELD_GET(BIT_ULL(41), denorm_ctx->current_spa) & hash_ctl_1T; + + if (FIELD_GET(BIT_ULL(9), denorm_ctx->current_spa) != hashed_bit) + denorm_ctx->current_spa ^= BIT_ULL(9); + } + + if (denorm_ctx->rehash_vector & BIT_ULL(12)) { + hashed_bit = FIELD_GET(BIT_ULL(12), denorm_ctx->current_spa); + hashed_bit ^= FIELD_GET(BIT_ULL(18), denorm_ctx->current_spa) & hash_ctl_64k; + hashed_bit ^= FIELD_GET(BIT_ULL(23), denorm_ctx->current_spa) & hash_ctl_2M; + hashed_bit ^= FIELD_GET(BIT_ULL(32), denorm_ctx->current_spa) & hash_ctl_1G; + hashed_bit ^= FIELD_GET(BIT_ULL(42), denorm_ctx->current_spa) & hash_ctl_1T; + + if (FIELD_GET(BIT_ULL(12), denorm_ctx->current_spa) != hashed_bit) + denorm_ctx->current_spa ^= BIT_ULL(12); + } + + if (denorm_ctx->rehash_vector & BIT_ULL(13)) { + hashed_bit = FIELD_GET(BIT_ULL(13), denorm_ctx->current_spa); + hashed_bit ^= FIELD_GET(BIT_ULL(19), denorm_ctx->current_spa) & hash_ctl_64k; + hashed_bit ^= FIELD_GET(BIT_ULL(24), denorm_ctx->current_spa) & hash_ctl_2M; + hashed_bit ^= FIELD_GET(BIT_ULL(33), denorm_ctx->current_spa) & hash_ctl_1G; + hashed_bit ^= FIELD_GET(BIT_ULL(43), denorm_ctx->current_spa) & hash_ctl_1T; + + if (FIELD_GET(BIT_ULL(13), denorm_ctx->current_spa) != hashed_bit) + denorm_ctx->current_spa ^= BIT_ULL(13); + } +} + +static bool match_logical_coh_st_fabric_id(struct addr_ctx *ctx, + struct df4p5_denorm_ctx *denorm_ctx) +{ + /* + * The logical CS fabric ID of the permutation must be calculated from the + * current SPA with the base and with the MMIO hole. + */ + u16 id = get_logical_coh_st_fabric_id_for_current_spa(ctx, denorm_ctx); + + atl_debug(ctx, "Checking calculated logical coherent station fabric id:\n"); + atl_debug(ctx, " calculated fabric id = 0x%x\n", id); + atl_debug(ctx, " expected fabric id = 0x%x\n", denorm_ctx->coh_st_fabric_id); + + return denorm_ctx->coh_st_fabric_id == id; +} + +static bool match_norm_addr(struct addr_ctx *ctx, struct df4p5_denorm_ctx *denorm_ctx) +{ + u64 addr = remove_base_and_hole(ctx, denorm_ctx->current_spa); + + /* + * The normalized address must be calculated with the current SPA without + * the base and without the MMIO hole. + */ + addr = normalize_addr_df4p5_np2(ctx, denorm_ctx, addr); + + atl_debug(ctx, "Checking calculated normalized address:\n"); + atl_debug(ctx, " calculated normalized addr = 0x%016llx\n", addr); + atl_debug(ctx, " expected normalized addr = 0x%016llx\n", ctx->ret_addr); + + return addr == ctx->ret_addr; +} + +static int check_permutations(struct addr_ctx *ctx, struct df4p5_denorm_ctx *denorm_ctx) +{ + u64 test_perm, temp_addr, denorm_addr, num_perms; + unsigned int dropped_remainder; + + denorm_ctx->div_addr *= denorm_ctx->mod_value; + + /* + * The high order bits of num_permutations represent the permutations + * of the dropped remainder. This will be either 0-3 or 0-5 depending + * on the interleave mode. The low order bits represent the + * permutations of other "lost" bits which will be any combination of + * 1, 2, or 3 bits depending on the interleave mode. + */ + num_perms = denorm_ctx->mod_value << denorm_ctx->perm_shift; + + for (test_perm = 0; test_perm < num_perms; test_perm++) { + denorm_addr = denorm_ctx->base_denorm_addr; + dropped_remainder = test_perm >> denorm_ctx->perm_shift; + temp_addr = denorm_ctx->div_addr + dropped_remainder; + + switch (ctx->map.intlv_mode) { + case DF4p5_NPS0_24CHAN_2K_HASH: + denorm_addr |= temp_addr << 14; + break; + + case DF4p5_NPS0_24CHAN_1K_HASH: + case DF4p5_NPS1_12CHAN_2K_HASH: + denorm_addr |= temp_addr << 13; + break; + + case DF4p5_NPS1_12CHAN_1K_HASH: + case DF4p5_NPS2_6CHAN_2K_HASH: + case DF4p5_NPS1_10CHAN_2K_HASH: + denorm_addr |= temp_addr << 12; + break; + + case DF4p5_NPS2_6CHAN_1K_HASH: + case DF4p5_NPS1_10CHAN_1K_HASH: + denorm_addr |= FIELD_GET(BIT_ULL(0), temp_addr) << 9; + denorm_addr |= FIELD_GET(GENMASK_ULL(63, 1), temp_addr) << 12; + break; + + case DF4p5_NPS4_3CHAN_1K_HASH: + case DF4p5_NPS2_5CHAN_1K_HASH: + denorm_addr |= FIELD_GET(GENMASK_ULL(1, 0), temp_addr) << 8; + denorm_addr |= FIELD_GET(GENMASK_ULL(63, 2), (temp_addr)) << 12; + break; + + case DF4p5_NPS4_3CHAN_2K_HASH: + case DF4p5_NPS2_5CHAN_2K_HASH: + denorm_addr |= FIELD_GET(BIT_ULL(0), temp_addr) << 8; + denorm_addr |= FIELD_GET(GENMASK_ULL(63, 1), temp_addr) << 12; + break; + + default: + atl_debug_on_bad_intlv_mode(ctx); + return -EINVAL; + } + + switch (ctx->map.intlv_mode) { + case DF4p5_NPS0_24CHAN_1K_HASH: + denorm_addr |= FIELD_GET(BIT_ULL(0), test_perm) << 8; + denorm_addr |= FIELD_GET(BIT_ULL(1), test_perm) << 9; + denorm_addr |= FIELD_GET(BIT_ULL(2), test_perm) << 12; + break; + + case DF4p5_NPS0_24CHAN_2K_HASH: + denorm_addr |= FIELD_GET(BIT_ULL(0), test_perm) << 8; + denorm_addr |= FIELD_GET(BIT_ULL(1), test_perm) << 12; + denorm_addr |= FIELD_GET(BIT_ULL(2), test_perm) << 13; + break; + + case DF4p5_NPS1_12CHAN_2K_HASH: + denorm_addr |= FIELD_GET(BIT_ULL(0), test_perm) << 8; + denorm_addr |= FIELD_GET(BIT_ULL(1), test_perm) << 12; + break; + + case DF4p5_NPS1_12CHAN_1K_HASH: + case DF4p5_NPS4_3CHAN_1K_HASH: + case DF4p5_NPS2_5CHAN_1K_HASH: + denorm_addr |= FIELD_GET(BIT_ULL(0), test_perm) << 8; + denorm_addr |= FIELD_GET(BIT_ULL(1), test_perm) << 9; + break; + + case DF4p5_NPS2_6CHAN_1K_HASH: + case DF4p5_NPS2_6CHAN_2K_HASH: + case DF4p5_NPS4_3CHAN_2K_HASH: + case DF4p5_NPS1_10CHAN_1K_HASH: + case DF4p5_NPS1_10CHAN_2K_HASH: + case DF4p5_NPS2_5CHAN_2K_HASH: + denorm_addr |= FIELD_GET(BIT_ULL(0), test_perm) << 8; + break; + + default: + atl_debug_on_bad_intlv_mode(ctx); + return -EINVAL; + } + + denorm_ctx->current_spa = add_base_and_hole(ctx, denorm_addr); + recalculate_hashed_bits_df4p5_np2(ctx, denorm_ctx); + + atl_debug(ctx, "Checking potential system physical address 0x%016llx\n", + denorm_ctx->current_spa); + + if (!match_logical_coh_st_fabric_id(ctx, denorm_ctx)) + continue; + + if (!match_norm_addr(ctx, denorm_ctx)) + continue; + + if (denorm_ctx->resolved_spa == INVALID_SPA || + denorm_ctx->current_spa > denorm_ctx->resolved_spa) + denorm_ctx->resolved_spa = denorm_ctx->current_spa; + } + + if (denorm_ctx->resolved_spa == INVALID_SPA) { + atl_debug(ctx, "Failed to find valid SPA for normalized address 0x%016llx\n", + ctx->ret_addr); + return -EINVAL; + } + + /* Return the resolved SPA without the base, without the MMIO hole */ + ctx->ret_addr = remove_base_and_hole(ctx, denorm_ctx->resolved_spa); + + return 0; +} + +static int init_df4p5_denorm_ctx(struct addr_ctx *ctx, struct df4p5_denorm_ctx *denorm_ctx) +{ + denorm_ctx->current_spa = INVALID_SPA; + denorm_ctx->resolved_spa = INVALID_SPA; + + switch (ctx->map.intlv_mode) { + case DF4p5_NPS0_24CHAN_1K_HASH: + denorm_ctx->perm_shift = 3; + denorm_ctx->rehash_vector = BIT(8) | BIT(9) | BIT(12); + break; + + case DF4p5_NPS0_24CHAN_2K_HASH: + denorm_ctx->perm_shift = 3; + denorm_ctx->rehash_vector = BIT(8) | BIT(12) | BIT(13); + break; + + case DF4p5_NPS1_12CHAN_1K_HASH: + denorm_ctx->perm_shift = 2; + denorm_ctx->rehash_vector = BIT(8); + break; + + case DF4p5_NPS1_12CHAN_2K_HASH: + denorm_ctx->perm_shift = 2; + denorm_ctx->rehash_vector = BIT(8) | BIT(12); + break; + + case DF4p5_NPS2_6CHAN_1K_HASH: + case DF4p5_NPS2_6CHAN_2K_HASH: + case DF4p5_NPS1_10CHAN_1K_HASH: + case DF4p5_NPS1_10CHAN_2K_HASH: + denorm_ctx->perm_shift = 1; + denorm_ctx->rehash_vector = BIT(8); + break; + + case DF4p5_NPS4_3CHAN_1K_HASH: + case DF4p5_NPS2_5CHAN_1K_HASH: + denorm_ctx->perm_shift = 2; + denorm_ctx->rehash_vector = 0; + break; + + case DF4p5_NPS4_3CHAN_2K_HASH: + case DF4p5_NPS2_5CHAN_2K_HASH: + denorm_ctx->perm_shift = 1; + denorm_ctx->rehash_vector = 0; + break; + + default: + atl_debug_on_bad_intlv_mode(ctx); + return -EINVAL; + } + + denorm_ctx->base_denorm_addr = FIELD_GET(GENMASK_ULL(7, 0), ctx->ret_addr); + + switch (ctx->map.intlv_mode) { + case DF4p5_NPS0_24CHAN_1K_HASH: + case DF4p5_NPS1_12CHAN_1K_HASH: + case DF4p5_NPS2_6CHAN_1K_HASH: + case DF4p5_NPS4_3CHAN_1K_HASH: + case DF4p5_NPS1_10CHAN_1K_HASH: + case DF4p5_NPS2_5CHAN_1K_HASH: + denorm_ctx->base_denorm_addr |= FIELD_GET(GENMASK_ULL(9, 8), ctx->ret_addr) << 10; + denorm_ctx->div_addr = FIELD_GET(GENMASK_ULL(63, 10), ctx->ret_addr); + break; + + case DF4p5_NPS0_24CHAN_2K_HASH: + case DF4p5_NPS1_12CHAN_2K_HASH: + case DF4p5_NPS2_6CHAN_2K_HASH: + case DF4p5_NPS4_3CHAN_2K_HASH: + case DF4p5_NPS1_10CHAN_2K_HASH: + case DF4p5_NPS2_5CHAN_2K_HASH: + denorm_ctx->base_denorm_addr |= FIELD_GET(GENMASK_ULL(10, 8), ctx->ret_addr) << 9; + denorm_ctx->div_addr = FIELD_GET(GENMASK_ULL(63, 11), ctx->ret_addr); + break; + + default: + atl_debug_on_bad_intlv_mode(ctx); + return -EINVAL; + } + + if (ctx->map.num_intlv_chan % 3 == 0) + denorm_ctx->mod_value = 3; + else + denorm_ctx->mod_value = 5; + + denorm_ctx->coh_st_fabric_id = get_logical_coh_st_fabric_id(ctx) - get_dst_fabric_id(ctx); + + atl_debug(ctx, "Initialized df4p5_denorm_ctx:"); + atl_debug(ctx, " mod_value = %d", denorm_ctx->mod_value); + atl_debug(ctx, " perm_shift = %d", denorm_ctx->perm_shift); + atl_debug(ctx, " rehash_vector = 0x%x", denorm_ctx->rehash_vector); + atl_debug(ctx, " base_denorm_addr = 0x%016llx", denorm_ctx->base_denorm_addr); + atl_debug(ctx, " div_addr = 0x%016llx", denorm_ctx->div_addr); + atl_debug(ctx, " coh_st_fabric_id = 0x%x", denorm_ctx->coh_st_fabric_id); + + return 0; +} + +/* + * For DF 4.5, parts of the physical address can be directly pulled from the + * normalized address. The exact bits will differ between interleave modes, but + * using NPS0_24CHAN_1K_HASH as an example, the normalized address consists of + * bits [63:13] (divided by 3), bits [11:10], and bits [7:0] of the system + * physical address. + * + * In this case, there is no way to reconstruct the missing bits (bits 8, 9, + * and 12) from the normalized address. Additionally, when bits [63:13] are + * divided by 3, the remainder is dropped. Determine the proper combination of + * "lost" bits and dropped remainder by iterating through each possible + * permutation of these bits and then normalizing the generated system physical + * addresses. If the normalized address matches the address we are trying to + * translate, then we have found the correct permutation of bits. + */ +static int denorm_addr_df4p5_np2(struct addr_ctx *ctx) +{ + struct df4p5_denorm_ctx denorm_ctx; + int ret = 0; + + memset(&denorm_ctx, 0, sizeof(denorm_ctx)); + + atl_debug(ctx, "Denormalizing DF 4.5 normalized address 0x%016llx", ctx->ret_addr); + + ret = init_df4p5_denorm_ctx(ctx, &denorm_ctx); + if (ret) + return ret; + + return check_permutations(ctx, &denorm_ctx); +} + int denormalize_address(struct addr_ctx *ctx) { switch (ctx->map.intlv_mode) { @@ -710,6 +1258,19 @@ int denormalize_address(struct addr_ctx *ctx) case DF4_NPS2_5CHAN_HASH: case DF4_NPS1_10CHAN_HASH: return denorm_addr_df4_np2(ctx); + case DF4p5_NPS0_24CHAN_1K_HASH: + case DF4p5_NPS4_3CHAN_1K_HASH: + case DF4p5_NPS2_6CHAN_1K_HASH: + case DF4p5_NPS1_12CHAN_1K_HASH: + case DF4p5_NPS2_5CHAN_1K_HASH: + case DF4p5_NPS1_10CHAN_1K_HASH: + case DF4p5_NPS4_3CHAN_2K_HASH: + case DF4p5_NPS2_6CHAN_2K_HASH: + case DF4p5_NPS1_12CHAN_2K_HASH: + case DF4p5_NPS0_24CHAN_2K_HASH: + case DF4p5_NPS2_5CHAN_2K_HASH: + case DF4p5_NPS1_10CHAN_2K_HASH: + return denorm_addr_df4p5_np2(ctx); case DF3_6CHAN: return denorm_addr_df3_6chan(ctx); default: diff --git a/drivers/ras/amd/atl/internal.h b/drivers/ras/amd/atl/internal.h index f623ac23e4b9..c67ba4bfe9cf 100644 --- a/drivers/ras/amd/atl/internal.h +++ b/drivers/ras/amd/atl/internal.h @@ -37,6 +37,8 @@ #define DF_DRAM_BASE_LIMIT_LSB 28 #define MI300_DRAM_LIMIT_LSB 20 +#define INVALID_SPA ~0ULL + enum df_revisions { UNKNOWN, DF2, @@ -93,6 +95,44 @@ enum intlv_modes { DF4p5_NPS1_10CHAN_2K_HASH = 0x49, }; +struct df4p5_denorm_ctx { + /* Indicates the number of "lost" bits. This will be 1, 2, or 3. */ + u8 perm_shift; + + /* A mask indicating the bits that need to be rehashed. */ + u16 rehash_vector; + + /* + * Represents the value that the high bits of the normalized address + * are divided by during normalization. This value will be 3 for + * interleave modes with a number of channels divisible by 3 or the + * value will be 5 for interleave modes with a number of channels + * divisible by 5. Power-of-two interleave modes are handled + * separately. + */ + u8 mod_value; + + /* + * Represents the bits that can be directly pulled from the normalized + * address. In each case, pass through bits [7:0] of the normalized + * address. The other bits depend on the interleave bit position which + * will be bit 10 for 1K interleave stripe cases and bit 11 for 2K + * interleave stripe cases. + */ + u64 base_denorm_addr; + + /* + * Represents the high bits of the physical address that have been + * divided by the mod_value. + */ + u64 div_addr; + + u64 current_spa; + u64 resolved_spa; + + u16 coh_st_fabric_id; +}; + struct df_flags { __u8 legacy_ficaa : 1, socket_id_shift_quirk : 1, diff --git a/drivers/ras/amd/atl/map.c b/drivers/ras/amd/atl/map.c index 04419923f088..24a05af747d5 100644 --- a/drivers/ras/amd/atl/map.c +++ b/drivers/ras/amd/atl/map.c @@ -696,6 +696,26 @@ static int validate_address_map(struct addr_ctx *ctx) goto err; break; + case DF4p5_NPS4_3CHAN_1K_HASH: + case DF4p5_NPS4_3CHAN_2K_HASH: + case DF4p5_NPS2_5CHAN_1K_HASH: + case DF4p5_NPS2_5CHAN_2K_HASH: + case DF4p5_NPS2_6CHAN_1K_HASH: + case DF4p5_NPS2_6CHAN_2K_HASH: + case DF4p5_NPS1_10CHAN_1K_HASH: + case DF4p5_NPS1_10CHAN_2K_HASH: + case DF4p5_NPS1_12CHAN_1K_HASH: + case DF4p5_NPS1_12CHAN_2K_HASH: + if (ctx->map.num_intlv_sockets != 1 || !map_bits_valid(ctx, 8, 0, 1, 1)) + goto err; + break; + + case DF4p5_NPS0_24CHAN_1K_HASH: + case DF4p5_NPS0_24CHAN_2K_HASH: + if (ctx->map.num_intlv_sockets < 2 || !map_bits_valid(ctx, 8, 0, 1, 2)) + goto err; + break; + case MI3_HASH_8CHAN: case MI3_HASH_16CHAN: case MI3_HASH_32CHAN: From patchwork Thu Jun 6 20:33:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Allen X-Patchwork-Id: 13688940 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2073.outbound.protection.outlook.com [40.107.93.73]) (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 9D96719ADB8; Thu, 6 Jun 2024 20:34:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.93.73 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717706049; cv=fail; b=f6pBaG4xyEezKR54a5qTAyaOUfwgYvgwmSkVfdotcfXvg6s5zic5hVs+y/VQQNAfYZSi1Utjlq54HCUwzRTWtsPz0MgKHaEdRDSqMHPj0px/iqm4DaTqvhgzTSJVqKACgX+dg60aszELJ5Xh+skaGjDEVky0ZOU/LHzs8iaq7OU= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717706049; c=relaxed/simple; bh=AeMMhQtlrucptAm1uHkX5q7loCFVcJ4EkJJ+fsjwe/A=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=LvbTcDWDrdzL/z7gG68T2RCVmCPPb997EfcBuiznczG/Yd55n7L5BXzq3MTzEye6DzyM2dR3KDrOK0mATeeobwz+ixEyG2+jenrXhDTg9vmOsxJDvWCBR26JJbWO3QKdNtbeVrwiWRSKUZv/hQjDM5lC9lWVRXiajzaNkcBQeW8= 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=qrKGiktd; arc=fail smtp.client-ip=40.107.93.73 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="qrKGiktd" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PaLTyjjYUwU+Thi2KTDpmGxxbB5XRDiBK7nJo6j+bPoo/+D9iDRxZfholoPyJZnIYugBuER1H0ti7PRTX/5LbWrYBEKJZaKqeqnPX5Cdl3beB1BOYd3ThAjQl7MtxwOXxsGzRAHrLyipSMHQR9PYljJMRYL5TbjVRvmWxxumem02qdDCmrMZUGsJoZgm/oxBKWiPsAgFceZv5e/S+ZeY6md1Tsnvvyvdl+/c6s3Lvgi1ZVmt4DY3JYBGPG8Sm4o4ik4OMEZ0jh5IRPhPlLc+4Ov+M0EM0iwQUFrBiO9ki/91wD+0AJP5DLmfi1ogHr4THbCCWmA8HRmQpO3IT8jPcQ== 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=rhENGeqn+Zn4TRwsxGj7qi01/XO7JTSoaeshs0+elDs=; b=jswjdye12dFS6gAJVlT/EzaZDi0pvmMtleJRchePr+nRylUyOKFN2xD+9v693Ztsrqu93Ym2A8wgPPA603rlT55d8WjlpEFBR+9N61hANSlO2w7wUw19szEn3DXG1kaXhsYKsGZi81lh/8RodRjIKeTvFOfFDqYAv/t+uVnVX31vzQAesxpopZ0PaQ9dMQn83kBYDhJl2KH+gDa6FQZOWswkzkbYaIAQiJGycbluoCEFZNY6hl7+CRywue/bXPHrPEZmV3Mx1wNww34rIeCxuSMOGCXIeqHNK30EMmC2qvIzwYxnwT67n1J7LOtQjFJaDislB18WhWSuRqIxVrShVw== 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=rhENGeqn+Zn4TRwsxGj7qi01/XO7JTSoaeshs0+elDs=; b=qrKGiktd9Tr9TvBIIZ6TXdmggSAlQiDPX9FE132GVWBDI+SLs/HGRLkpUgLKthoFfP/ocCCh8hQQ5lsy6iQ6SCq8g2Hf/pYVrVzlj7TXNUtATxwQYgvjfSP2dgPYizf0Memrn97OG6+a8Gb2oXwP+dE4ifb2PqybIG36QtOYW6U= Received: from CH2PR19CA0010.namprd19.prod.outlook.com (2603:10b6:610:4d::20) by IA1PR12MB6138.namprd12.prod.outlook.com (2603:10b6:208:3ea::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7633.27; Thu, 6 Jun 2024 20:34:04 +0000 Received: from CH3PEPF0000000F.namprd04.prod.outlook.com (2603:10b6:610:4d:cafe::f9) by CH2PR19CA0010.outlook.office365.com (2603:10b6:610:4d::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7633.31 via Frontend Transport; Thu, 6 Jun 2024 20:34:04 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by CH3PEPF0000000F.mail.protection.outlook.com (10.167.244.40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7633.15 via Frontend Transport; Thu, 6 Jun 2024 20:34:04 +0000 Received: from jallen-jump-host.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; Thu, 6 Jun 2024 15:34:03 -0500 From: John Allen To: , , , CC: , , , John Allen Subject: [PATCH v5 6/6] RAS/AMD/FMPM: Use atl internal.h for INVALID_SPA Date: Thu, 6 Jun 2024 20:33:13 +0000 Message-ID: <20240606203313.51197-7-john.allen@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240606203313.51197-1-john.allen@amd.com> References: <20240606203313.51197-1-john.allen@amd.com> Precedence: bulk X-Mailing-List: linux-edac@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: CH3PEPF0000000F:EE_|IA1PR12MB6138:EE_ X-MS-Office365-Filtering-Correlation-Id: 1ed1f8f6-fa67-4e38-a57b-08dc866801c9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|376005|82310400017|1800799015|36860700004; X-Microsoft-Antispam-Message-Info: 1Cge47+Lv2j3ZV8qHJa+z2TJOBGoz/aMXzjdRnTpt47pmZ1FFGioRqgIcAmQshcZyUaK4wIibaM6PD/Dj/VaRwMch9uyozlWMIg2xm3UOuMt2Fbbi9uiYwwfSOhWWDGctFwBpzZ+rO0IaVhzeZwI10VI80LpiYNWKO2darX4QcdJygRR+d/TOqFBYwjbuiugVjJXp4RuFe53WaLDcKPuyHWiZhyAUUc/JKBmoc6t318QkfcTg+JOXMRf70cvrb/z9Xf7IACH6XBxaqccQKcDvPszf8Mv6ePcVS1XhbQr/0Rdpd4mgOu8dXFtw/Xk6xAydA88/Oa3qv9rmMOT6/dOHrS8TUJFUixhp5SgL+Z32QYA7qmD8j7C1BT2PquVrFTpwjfjq9kTRKd5ydS0vK7+KQwjMKZeOA5sogkW3z57pNwsoRDgJOpD6P3p3YnlUGwfuNKMcb/oxtmBorTKaSWD3nlWiUEHofaPdrdtpCVvu334ZpZrO1x5XHKTvUq9cBbb2iKPzbJruo+R6GeHjBB3l3WlRn19QmKq8Ea2lmjS/vegxNWMAMiFqIj79U1ytAQ+iw9yLE8ET2dp0ycmymQGMRBjw+sWblZhaBfanvl7G1Nt4STc0sR/bn4tpiCjQi6D3J7Q70FqthFIJlsF7+oEwSX/tUsyrw+nyjCRCzCRRLBlWNriGub80TgJXS1iipCoY3Jul5OkGeOl7eEVz+ga1PNNDdSqS6kTx3vyVy0FRodY5uVURHydnm8oBhal80VYsz97MG9Vw/L/On8YUKb6PgneQ4icjzA/fEDwoysdbVhhIys3sytw+ngApC1WaRVDs+zXhUxGGejHUo0fkG3IiXfOZlQigzngzv6zS8wYQ9rkzRVrSORNG5J6kXls7LLoEstoSFXj7yNUIjeHL6ExihfIg/eG5ok05KgZ2ICeW1JaZcUAL2az13WbUPmrGoTZZH0XfJJUS6oZiVCKlgTEv8mTpY88Il0UrRBgRcmjBhY2IhPdP9EK5Rf16zU+b6CAjT0rxUdPd74VeYTZ3O1dfIbC68HStP4gjoQyx99c0shqbe1cWI0nhmMNwJAMq+DZ4WJpb74gnP2D9Z1Mh1Ipq8dTvd8zwWYC+CDX2kPGhq/nvrOYnAs5JS8dLJIUoO2Utkfkf+YwjT8SF+t0cCCS3YgJ6rhzHMSFvccU/y5QgD0RHcVmcH6Qo7kePJp1Pu7V4xFn0kG4OAkmUBNb4wwxYWVaflWhqpk6oYGfQCY7MIjQyThkSnRhogW5/OWSYMH9bOVWrOhT1Dw2DholXTw7IBVIggkEwvNSp1gKZ2pn6ZpDXYwtyejEY8tf2eufmbzfdkKBI1OgwxEVCF9RqTDs5Jsa7yWG4b2pO7oNUwAARU6H2d3Dr9ej1c9QFJk6+cz79zUEiIxO35jJb27YLxzMJA== 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)(376005)(82310400017)(1800799015)(36860700004);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jun 2024 20:34:04.3543 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1ed1f8f6-fa67-4e38-a57b-08dc866801c9 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: CH3PEPF0000000F.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB6138 Both the AMD ATL and the FMPM driver define INVALID_SPA. Include the definition from the ATL internal.h header in the FMPM driver. Signed-off-by: John Allen --- v5: - New in v5. --- drivers/ras/amd/fmpm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/ras/amd/fmpm.c b/drivers/ras/amd/fmpm.c index 271dfad05d68..90de737fbc90 100644 --- a/drivers/ras/amd/fmpm.c +++ b/drivers/ras/amd/fmpm.c @@ -56,6 +56,8 @@ #include "../debugfs.h" +#include "atl/internal.h" + #define INVALID_CPU UINT_MAX /* Validation Bits */ @@ -116,8 +118,6 @@ static struct fru_rec **fru_records; /* system physical addresses array */ static u64 *spa_entries; -#define INVALID_SPA ~0ULL - static struct dentry *fmpm_dfs_dir; static struct dentry *fmpm_dfs_entries;