From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=52.101.61.64 ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1796064625; b=BFL9qujMJMihJzVwcJTsNxGLPwgNXFWJN9Fubkn9uwUZnpR7m/E9NvTZR3N97Pi9bUbM Reo8G6rW9aQc+I3YRwObXp2rfsArx4e9cdTcCCoq7gCsPgd1eGXWnKgNIi/8Yi3f6mta0 cLGViIdZtVq7L9A7+VRxY71Fnwr+0p8VhrJo16xjKCFNp5F24Ru+h8fggZFEjT0HoLLrR 6Zw8zwZblHMoVk75Y8BZAfEWWXAQPM41nlWI5FEB8fbGZOMKW1EjOSo4y+L3PqWjVofX2 mto8svt0yM0wRg5WBajz1W9fttjTPlptzHdJqnghqYMMw4sDUns8ei/BgtAoyfvzMAQ== ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796064625; h=DMARC-Filter:DKIM-Signature:Received:Received:Date:From:To:Cc: Subject:Message-ID:References:Content-Type:Content-Disposition: In-Reply-To:X-ClientProxiedBy:MIME-Version:X-MS-PublicTrafficType: X-MS-TrafficTypeDiagnostic:X-MS-Office365-Filtering-Correlation-Id: X-MS-Exchange-SenderADCheck:X-MS-Exchange-AntiSpam-Relay: X-Microsoft-Antispam:X-Microsoft-Antispam-Message-Info: X-Forefront-Antispam-Report: X-MS-Exchange-AntiSpam-MessageData-ChunkCount: X-MS-Exchange-AntiSpam-MessageData-0:X-OriginatorOrg: X-MS-Exchange-CrossTenant-Network-Message-Id: X-MS-Exchange-CrossTenant-AuthSource:X-MS-Exchange-CrossTenant-AuthAs: X-MS-Exchange-CrossTenant-OriginalArrivalTime: X-MS-Exchange-CrossTenant-FromEntityHeader: X-MS-Exchange-CrossTenant-Id:X-MS-Exchange-CrossTenant-MailboxType: X-MS-Exchange-CrossTenant-UserPrincipalName: X-MS-Exchange-Transport-CrossTenantHeadersStamped; bh=Wx05G9Q0Ne5T/1LXDpnVKf328rtzTAhv72uvT99APLo=; b=HQMG3Z7asMIG2yYyZ8IMvbk7j/+nW2jCYrGpdpfN3Li719VzkGdDT7B7TFbFb4T4o7pQ 2W80SM2N41vqA3PTfGSKjY5j8Bzh7ZflnGO4ZapTLlohr5PXYA2I7qSioyNitp1FYYLN3 KevSTsIq+8yoa/3u4pOWO/f1LY43O8/IiLyKlVlyI4DVeWFq3ReJ/c+OdK4Vs/Q8vcW6e j78Did7NfZjvShjagckQDWcJau+7L1q20hz0bnRd5YcEQi8HfNMMXLvyaesF6WKayPUPs xchuqGM6u+adNMB+NoX9Z4n0ikYBtQqoLiidMDeWe9zDAeHVKXs38p2tEdrfk2KWhfQ== ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass header.d=amd.com header.i=@amd.com header.a=rsa-sha256 header.s=selector1 header.b="mH7/SnQ4"; arc=pass header.oldest-pass=0 smtp.remote-ip=52.101.61.64 Received: from DM1PR04CU001.outbound.protection.outlook.com (mail-centralusazon11010064.outbound.protection.outlook.com [52.101.61.64]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (secp384r1) server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B9FF4606A31C; Mon, 30 Nov 2026 18:50:24 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org B9FF4606A31C 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, unprotected) header.d=amd.com header.i=@amd.com header.a=rsa-sha256 header.s=selector1 header.b=mH7/SnQ4 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Njm4yx+3Ph0CbNfjfdJA/46QCSNGIHw75Lmik0Kb6nL35liEg1BeWuOjJzX0ih04SKDji2BycfcGW+rXTtoBc2D9QGqg3tZkUe9/HQ5qwwNztEHXPochL5dznaBgfzC92mdmQlwH5u5F8YJID60lhxfuYzl4oqxeFSRHXg9Y8EaQA86VOo+XyJfjJTHLYCp96XOMqQPGcHzXdcIk6649Y478ABU2agBT1IVMnIcTn5pDIWn1+tOf+7h1vuw0mzF5poqG6C8irpErUN6fSalr2I2cX9oNevdiOhLSUtEacM/vAfUYQXf8jQKZumr+oDEAOqgX8U/8/Hs7ndut84nmjw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Wx05G9Q0Ne5T/1LXDpnVKf328rtzTAhv72uvT99APLo=; b=mbvQ1yFc3kIaSdmbq1kyRRNK15sXWzJHvhF5Sf90idwLJloS1Q0ZzL9nh88V21Z6oAIwqHrXcpU4Anw7mh4TJi+pQ8CZPpfKufMyPzRm54XDsBPSmjDBHEP/bIDgr5Yb8nHdNtX0pme75hBx4Nw9qL1md/AmMWBaXPhJPY4zAjbCOdkqT67U+LjzXHJWoUiOvhWu8P/dAIgbqE2KxsufCeey2Q2ftv1G0pfn0L7VbIvYwHrRDopGLly3emnJZPgqonV2Zn4FIj8lqsLtYTRFT81tWCCCUm9qZb0S7K6zm+n/mB8KXIPB+Q0+i6CfpW4csVZeK/SBWNM1sb0PjHCwbw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Wx05G9Q0Ne5T/1LXDpnVKf328rtzTAhv72uvT99APLo=; b=mH7/SnQ4Pp5JuGzKPFzsNYZGkfkUP6ApZpgGmklZLB37VlJppyIvAqsqYRu4C+/LrBJz+0D6sKdHSZdcOWIHBCN5posFo4YDVeqc4p7zzrHpQnBM8DXcwZzm1Lxzt7KhWgzCNu4dDV0WRfYUlyxLqzaSEvdeWqjs/BDoXclNez4= Authentication-Results: mx.microsoft.com 1; dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; Received: from EAYPR12MB923140.namprd12.prod.outlook.com (2603:10b6:303:2fd::15) by LVUPR12MB999135.namprd12.prod.outlook.com (2603:10b6:408:3a1::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.662.12; Mon, 30 Nov 2026 18:50:21 +0000 Received: from EAYPR12MB923140.namprd12.prod.outlook.com ([fe80::b986:8b81:beda:c167]) by EAYPR12MB923140.namprd12.prod.outlook.com ([fe80::b986:8b81:beda:c167%4]) with mapi id 15.21.0662.004; Mon, 30 Nov 2026 18:50:21 +0000 Date: Mon, 30 Nov 2026 13:50:13 -0500 From: Yazen Ghannam To: Gokul K Cc: Tony Luck , Borislav Petkov , linux-edac@vger.kernel.org, John Allen , Aichun Shi , linux-kernel@vger.kernel.org Subject: Re: [PATCH] RAS/AMD/ATL: Check the legacy MMIO hole after the address map is read Message-ID: <20261130185013.GC212336@yaz-khff2.amd.com> References: <20261126091744.2096611-1-gokul02k@gmail.com> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20261126091744.2096611-1-gokul02k@gmail.com> X-ClientProxiedBy: BN0PR04CA0170.namprd04.prod.outlook.com (2603:10b6:408:eb::25) To EAYPR12MB923140.namprd12.prod.outlook.com (2603:10b6:303:2fd::15) X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: EAYPR12MB923140:EE_|LVUPR12MB999135:EE_ X-MS-Office365-Filtering-Correlation-Id: e3f91783-1014-4690-dcc9-08df4f12c958 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|1800799024|23010399003|376014|10067099003|56012099006|261028144727099003|261022105027099003|261026140227099003|261026121527099003|261021121427099003|261021123027099003|261102123227099003|261009223027099003|22082099003|18002099003|11063799006; X-Microsoft-Antispam-Message-Info: 10f4Ziv2LD1toPjp/FsYGAVrYTfmxaUCiiCcfNW+Wt+LyINUggy7kxPK3IPgRqKG5T8z/vKSXLfItTAZSB1khpm86rwiXLPTNZYSixDbOgH/FKinjy2J13txKTjPimzYxZMuamfPyPcwaiP+9RdrSF+Pavpmchr8UDtImNqvQEOc55Mp8UYDMzXiN/uFz6TfCELjzkILX3KnWO6gdjg6KZ65godGaIwF/8M81rb39KeGbRVRebdcw5VaXIG8gt0MGzssWWoaFmXB/35e3PLlVHEFkC4wCRgdV6Y6DCYO0oj5THSG8Vb1RGygHdz9JEcVEpnI7gOunOtnioXyo+VrmudIMCJspKFTw7BO5pKQUGZR5/uchPsk6GXpyOncgdcm+OPKugTgvKc0fzJ1beRhaPMU8VPcyRhmibf3hx2J1Yon8ft38qPpngJ7hbgBXW5BoF9Fyc3SS4rsy2t5idK2xLJQDD7IjaLmGVIEhARppLdVRsTNzLSU40ALACfW1KjNHr8YJBGE3xovmrkqLQ99DJd5gLUKphLsWqaiIP8mh81fVmvioonMYIrun4ZFfK7RtePPNwuZi5bf0nQMfzWAxsAItszEnE7JD4RGHg5BdTTi+TjjsogFJbPH6h2qLyFt X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:EAYPR12MB923140.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(1800799024)(23010399003)(376014)(10067099003)(56012099006)(261028144727099003)(261022105027099003)(261026140227099003)(261026121527099003)(261021121427099003)(261021123027099003)(261102123227099003)(261009223027099003)(22082099003)(18002099003)(11063799006);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?tzZaX/9xCCZ+wabTMNNcCHQ/R+LnMJr+wdlpwzsUEr3c9Ds4K9bglnNnkaHy?= =?us-ascii?Q?8LKnCABVgNjpktyxq36Di3tvh0rfZaISgJ0DdFBxFNaQHsrIAByZcbCw2SK8?= =?us-ascii?Q?o4/CGjj2TkZFD/aS0bifDs8awos/E8wm0cnos/NUjPsYA2pG4QxdnRxxN3lH?= =?us-ascii?Q?GQxJsGKWMYlRXX5J76IojLqYYkFyKXVW1wBXdhzpu17NfSmPOQjR72CK8NF5?= =?us-ascii?Q?s7eIjcugcSNviVgz4KDG7IMny9IoqadAP6sRjlYb5FEDk8VKsl2YbUb8lRZr?= =?us-ascii?Q?poEOY/Ua9++eDS1vK7hPwMy0yaSc2ahAave7zIS6r3dGS67zC4a6RnxXySiE?= =?us-ascii?Q?21g3haFbIPHxVKwPoWSu6tVektpfNRSjlbFTDt4RLl/60om/6oQA0HEZttk4?= =?us-ascii?Q?biq0bVky3y/8zocpHth/Vdw+sanzb/DwuhFh8IKatPjEJYvYyd0jQemKLHqN?= =?us-ascii?Q?wV2qQCyj4dgbVMw/AHQI7OmQjkqHENA0DCA9KStUah2JtaoYvPu0/0aQxvrz?= =?us-ascii?Q?HZKgSHp6EMB3lKIcJHBPpVrUZNmhCzL25YLZeVgxhGJumCLW441gRfhXxTbN?= =?us-ascii?Q?I1w6OEKXZg7Vf/lQVBOFxI2BwasDkI0AH/v1fwt5tYaevqqPmV74rut1Cswx?= =?us-ascii?Q?gvNGbwjHEiAPQ7Jyth50cR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0wO3ncMkv?= =?us-ascii?Q?8ouwW8Am2Se+MIMuIFS2zE4Gdm3HfNtylHoIy7/dzG3kStTeuxRRzZo8Jipj?= =?us-ascii?Q?mJ2y9ewYL6LDS2sY17Jux0v5aaCFkRSJKb4IbHw3Cbs/LM3A4WcrkchZYZ8v?= =?us-ascii?Q?VvXTzAdSlYauxAT6xgHQUGQbfS/HKt3zckQ3ANC2jmWX0Idk?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: e3f91783-1014-4690-dcc9-08df4f12c958 X-MS-Exchange-CrossTenant-AuthSource: EAYPR12MB923140.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Nov 2026 18:50:21.7514 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: h4Dd/YpG5IyeOj3iM8nJ/uz32jIqNWG7rOhk3Ud8FOrJYgalXQHz31FH8A4QuTd5is6PfVM9IZR5DPDeT7viuA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: LVUPR12MB999135 On Thu, Nov 26, 2026 at 02:47:44PM +0530, Gokul K wrote: Hi Gokul, Thanks for the patch. > norm_to_sys_addr() refuses to translate an address when the legacy MMIO > hole is enabled but the DRAM hole base is unknown. That check cannot > fire. It runs on a freshly zeroed addr_ctx, and legacy_hole_en() reads > ctx->map.base, or ctx->map.ctl on DF4 and later. Both are only filled in > by get_address_map(), which runs two calls further down, so FIELD_GET() > always sees a zeroed register and reports the hole as disabled. > > The situation the check was added for is still reachable. > get_df_system_info() only warns when get_dram_hole_base() fails and > leaves df_cfg.dram_hole_base at zero, so the library loads either way. > On a system whose hole is enabled, add_legacy_hole() then compares > against a base of zero, takes the branch for every address, and adds > BIT_ULL(32). The system physical address handed back is 4 GiB too high, > and the caller retires the wrong page. "retires the wrong page" is a very specific use case that may or may not apply. The gist of the issue is that the translated address is wrong. > > This has not been observed on hardware; it needs the DRAM hole base read > to fail on a system that has the hole enabled. > Right, this is one of those sanity checks that shouldn't ever happen in real use. It would be a bigger issue if we couldn't read the register, or if the values are invalid. The latter would affect general system functionality. > Move the check below get_address_map(), where ctx.map holds the values > read from the Data Fabric. > > Fixes: 1233aa3fb342 ("RAS/AMD/ATL: Read DRAM hole base early") > Signed-off-by: Gokul K > --- > Compile-tested only. ATL needs an AMD Zen system with a Data Fabric, and > norm_to_sys_addr() is only entered from a DRAM ECC error, so I cannot run it > here. Built at W=1 with CONFIG_AMD_ATL=m, and confirmed core.o is not built > with it =n. I also replayed the guard outside the kernel, with the same field > masks, across DF2 through DF4p5: it lets every address through today and the > result is 4 GiB too high in each case. > > Noticed while reading the Hygon Family 0x18 series, which clones this function > as hygon_norm_to_sys_addr() and places the same check after its own > get_address_map() call [1]. That is the ordering this patch moves to. > > Based on origin/master; drivers/ras/amd/atl/core.c is identical in > ras.git edac-for-next, so it applies there too. > > [1] https://lore.kernel.org/all/20260528035246.526012-6-shiaichun@open-hieco.net/ > > drivers/ras/amd/atl/core.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/drivers/ras/amd/atl/core.c b/drivers/ras/amd/atl/core.c > index d77dacdd4f56..06744d3aaf0c 100644 > --- a/drivers/ras/amd/atl/core.c > +++ b/drivers/ras/amd/atl/core.c > @@ -125,15 +125,15 @@ 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; > > if (get_address_map(&ctx)) > return -EINVAL; > > + if (legacy_hole_en(&ctx) && !df_cfg.dram_hole_base) > + return -EINVAL; > + > if (denormalize_address(&ctx)) > return -EINVAL; > > -- Besides the minor points above, this looks correct. Reviewed-by: Yazen Ghannam Thanks, Yazen