From nobody Sat Jul 25 04:54:45 2026 Received: from DM5PR21CU001.outbound.protection.outlook.com (mail-centralusazon11011066.outbound.protection.outlook.com [52.101.62.66]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 426F23D5C0C; Fri, 17 Jul 2026 16:21:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.62.66 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784305286; cv=fail; b=MtGj826KdKa6qGElyKRpmf04iziNDEcyfEi+UrgWy7H2FZHK+1/A3AngH4qxjVdpu6v5+axqvclENtGv9W0NQCbjs9rQ60tgWfecnINgjKYWPdUjM/FPZ+lSWk9trHVNsP9tjJEizMtw2aSntlqlDO6pAr4ctHu8yx6D5TGmCQM= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784305286; c=relaxed/simple; bh=qytaomriOBsZpBgsYyxuyWON8X5jRhbDM7ek7ZYWDXo=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=HVzj6v/ha8Sh1El5/jyTMJynv64n2btvR5bJ2wsGwH+OxNjIJhhIgcSHnllON9Dooc7JjoGZVo6BZHoQ63TQIG5367SsaJ2xGStkD83Mw7co78aYAMzZ8+MfBW98MGswk/CFKSy14DonNkebyWyTXXUgtmMSzvB3GUt2kMWtHg8= 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=XF8nZWO7; arc=fail smtp.client-ip=52.101.62.66 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="XF8nZWO7" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=nt+297e0eUgOi1vP3hMCw1YSkedUo7UhRlj0q4N8SiShLbZU0njcEjSGu+IPwZNwlxWyuoGmkE1Xo0/Wofzc362bbRLNM+/s8iuteeuV4mPQSLy+1s5sbmfZfGi7OtLYohlBMMmN/dRUUHp5Em5Ko7wDp/8unOz/3EUjwzjQSNKS8AuoQS2SNLuMpSdd3YGN7HIDMqnFc13obQ1fgTH68sb7NwoOg5RFFjznA22A80z63IUPEm02n45Pv0DoZ6kuHy4UoCS+5yhkybXEhN81BAjk0IRAmzLooiZ1jUj6j1U8ZmR6WuPutGTXWeo2OeqfTTOGb/+avDSO/ObKNxmgww== 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=1iBjMAckTC91FcJfnb6p+FOAA7x87kf+MEvr8T3nZCY=; b=MGOnSHo/u5nNz698ZkPCriA4PLz6UhuL8KYReXBJNqSRRJfEG5dP0BCpCPeTUxvtOjoYrDQ/6I/MyBTpp+T2uynaPSWlFt54tTTYBiiZLW54QZpfeF5NpQ8RbTnbFryoxEeJzOZqPzaGmCj10QhX8tM1mW0yyxDtOCCIi5W1eKv7nNyh7xCdhbLqsat0RrLodUduHgvHIOmTW9p4FJFOf8zIQtRZw8+bIBmAoIU5sWO/P8di6xRidZpCHxapBzyUBXFuWVbmsJHPOF8UexjLiZVW60/a441/i/CY9orlsZ6MG0sFPnKKHat1P331/nCXJW6d4mABRr2ukeLuNEveWg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=linux.intel.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=1iBjMAckTC91FcJfnb6p+FOAA7x87kf+MEvr8T3nZCY=; b=XF8nZWO7S1OtHIDT0KBLiBKlJEM8wLWUXb9ZykGNhUPbipN5aEL8TzrZ4E/MCVthq5HKKyTWQFBoVBjM62cyZV5OSTaMy3Gz++7hVX6HNMcRPikJDlsUXtTk8zKNuE++ouI5qRAByDrtVQyKvJDAcDLOJCoW/Xz6QhVloavS/p8= Received: from DSSP220CA0014.NAMP220.PROD.OUTLOOK.COM (2603:10b6:8:3d3::7) by DS7PR12MB9550.namprd12.prod.outlook.com (2603:10b6:8:24e::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.223.12; Fri, 17 Jul 2026 16:21:19 +0000 Received: from DS3PEPF0000C380.namprd04.prod.outlook.com (2603:10b6:8:3d3:cafe::80) by DSSP220CA0014.outlook.office365.com (2603:10b6:8:3d3::7) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.223.13 via Frontend Transport; Fri, 17 Jul 2026 16:21:19 +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=satlexmb07.amd.com; pr=C Received: from satlexmb07.amd.com (165.204.84.17) by DS3PEPF0000C380.mail.protection.outlook.com (10.167.23.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.245.5 via Frontend Transport; Fri, 17 Jul 2026 16:21:18 +0000 Received: from ausmlimonci-lx1.amd.com (10.180.168.240) by satlexmb07.amd.com (10.181.42.216) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.41; Fri, 17 Jul 2026 11:21:17 -0500 From: Mario Limonciello To: =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= CC: Hans de Goede , open list , "open list:X86 PLATFORM DRIVERS" , Mario Limonciello , Francis De Brabandere , Subject: [PATCH 1/4] platform/x86/amd/pmc: Fix LPS0 and debugfs leaks when STB init fails Date: Fri, 17 Jul 2026 11:20:20 -0500 Message-ID: <20260717162023.956346-2-mario.limonciello@amd.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260717162023.956346-1-mario.limonciello@amd.com> References: <20260717162023.956346-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: satlexmb07.amd.com (10.181.42.216) To satlexmb07.amd.com (10.181.42.216) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS3PEPF0000C380:EE_|DS7PR12MB9550:EE_ X-MS-Office365-Filtering-Correlation-Id: e3016bcb-b099-4d7a-9f95-08dee41f6ef6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700016|376014|82310400026|1800799024|23010399003|13003099007|11063799006|56012099006|10067099003|22082099003|18002099003; X-Microsoft-Antispam-Message-Info: 69445x6DA/k4A/PlVE14ZAZq2ffrbOgsV85NtrQ/R2CWF+XKpACDq9nVRvOa9c3PV/MUNSkhwqICXcK2ugBGHTZvZXgp6PzcyzQ+clYnOjysMh5ZtBWi2G5fmMw57asb1u/8chkFmbX1ZF45ofrZFswHjJojAr/JlnWS9akOLr0ERRYgSm9zHghCl6ncEHvStIh3WR5sAasYI+pZwwTHo+5r1QiJusnICBRpWc8iztvS388Rn7KlvWC3PbGKPPpc7QjPBrU+HCb6XqNP4sDy4y38ebRZ+a9Gjd+443OYn/fbaEvQjvpqavm7r+lOqlJLk2QjpgQwThcr6ViwXGMykW2ozfldP6Ecf5PQYYGELyJvWeUDcpSaCuHTtXna5GRyHfS3VhNt+6VzIGsq1Rnfbo0GaYlDzk6ywUQlS8zcRsP4DcDznE69UYLjRhohZSMOKVdUqR7T0+TxjoHDZyUhOqoO1NMZOa3upp9zXBRQnYztsHExxrcp2l66qDTevOn3wZ5BRgbzUMrQO4tO9hXBTEyA7R9awX1bx9U8gHZPgsvn7cR8FkzRV9mWzJDJ1g/TdArNHGb58pQKT6Sl27fXoISsyEgsAtk8qMRut0Hd61EXb6LapuWtKFZ9Aqq8EjopQe0jTHH2EM2TCd7n4VvxmR6usuAAy/ukL+OrvaF6Jb4C6IYmKgBIbpfnN72XvWiaFSnlKnVXsrvqv7PpljZL2g== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:satlexmb07.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(36860700016)(376014)(82310400026)(1800799024)(23010399003)(13003099007)(11063799006)(56012099006)(10067099003)(22082099003)(18002099003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: p1z7NRPNgsBbKzpbN5XleeUv5I5l+vSLthmmRyhSJDkjfjMJV50VtYZTkFD/JDBB8y0qFTvl8+26AqY2AZ64r/7dWwqmZKsvWt0ksCetuY7UdYzqmUI1b6Z9uoAmfwaXw36PGmGj5n+ho7zJFR1LwpU+T/MzLvhcq2APplGLKy42Wk1DxnueVLRSlRdWbiEvNc7ki42vhByvIY3ZDqe4UMN/RGyccrFZkXioRHERmLYMYd5ezOFW4wMI3dU7kGrg0aw8MMEeNMbShOJ1E9sd61bvudsspIH4p5oH/DYMekgFCL39kL1u+6JRHoTKn1rO+yeQGPMtBdd4pSZ0iPRCGp1QEZay2RI//1OColt7ZFlROJDr0wUmLqDk5GGaMy4PsyBo6Y6LXsj2U+oSP7lhaESaJ61suJkYgCeOsmGkRN6zqqCLCeM4a8uNEARxjrGC X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jul 2026 16:21:18.9174 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e3016bcb-b099-4d7a-9f95-08dee41f6ef6 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=[satlexmb07.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DS3PEPF0000C380.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR12MB9550 Content-Type: text/plain; charset="utf-8" amd_pmc_probe() registers the LPS0 s2idle handler with acpi_register_lps0_dev() and creates the driver's debugfs directory before calling amd_stb_s2d_init(), which is the last step in probe that can fail. When amd_stb_s2d_init() fails (for example the S2D telemetry region cannot be ioremapped on a long-running system, or the SMU rejects the S2D setup) the error path only calls pci_dev_put() and returns. This leaves amd_pmc_s2idle_dev_ops on the global lps0_s2idle_devops_head list and leaks the debugfs directory, while the devm-managed resources backing the handler are torn down. Reloading the module then walks the corrupted list in acpi_register_lps0_dev() and hits: list_add corruption. next->prev should be prev, but was NULL. kernel BUG at lib/list_debug.c:29! acpi_register_lps0_dev+0x44/0x80 amd_pmc_probe+0x224/0x380 [amd_pmc] platform_probe+0x67/0x90 Even without a reload, the stale registration means the next s2idle transition calls into torn-down driver state. Unwind the debugfs directory and the LPS0 registration on the amd_stb_s2d_init() error path. acpi_unregister_lps0_dev() is safe to call unconditionally here: it is guarded on the same conditions as acpi_register_lps0_dev(), which is exactly what amd_pmc_remove() already relies on. Assisted-by: Claude:opus Reported-by: Francis De Brabandere Closes: https://bugzilla.kernel.org/show_bug.cgi?id=3D221759 Tested-by: Francis De Brabandere Fixes: 83ad6974dd3b ("platform/x86/amd/pmc: Move STB block into amd_pmc_s2d= _init()") Cc: stable@vger.kernel.org Signed-off-by: Mario Limonciello --- drivers/platform/x86/amd/pmc/pmc.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/platform/x86/amd/pmc/pmc.c b/drivers/platform/x86/amd/= pmc/pmc.c index d50ea62fa2f3a..630a664bdd2f4 100644 --- a/drivers/platform/x86/amd/pmc/pmc.c +++ b/drivers/platform/x86/amd/pmc/pmc.c @@ -919,13 +919,17 @@ static int amd_pmc_probe(struct platform_device *pdev) amd_pmc_dbgfs_register(dev); err =3D amd_stb_s2d_init(dev); if (err) - goto err_pci_dev_put; + goto err_dbgfs_unregister; =20 if (IS_ENABLED(CONFIG_AMD_MP2_STB)) amd_mp2_stb_init(dev); pm_report_max_hw_sleep(U64_MAX); return 0; =20 +err_dbgfs_unregister: + amd_pmc_dbgfs_unregister(dev); + if (IS_ENABLED(CONFIG_SUSPEND)) + acpi_unregister_lps0_dev(&amd_pmc_s2idle_dev_ops); err_pci_dev_put: pci_dev_put(rdev); return err; --=20 2.43.0 From nobody Sat Jul 25 04:54:45 2026 Received: from DM1PR04CU001.outbound.protection.outlook.com (mail-centralusazon11010026.outbound.protection.outlook.com [52.101.61.26]) (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 841F9429CCA; Fri, 17 Jul 2026 16:21:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.61.26 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784305292; cv=fail; b=STCjuDxVACZ5rCRI6Q6xJsKozhQncPD5ktJgGrlHeY5e25wbsF9NXw4YljXn45UJpIZG0zXgAKoEXb4COTLDAxDXn5IjXURhfCVvnfw7Ew2DcvI7a1UXhwLjIcbVixZnRsI04Hka3qpjTKCOpVFDxCFjphdfS1aAZkKx/IEN0b0= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784305292; c=relaxed/simple; bh=ZeiXP2klQS/hPOl6dx2GwlEE82P0lHTpvK/88tlNh4o=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=deOuoGM+heUOCXDq1Cz124hFkxozp6qmYG+7IJkakkkL3oDSd6iBxpvbxmtDrL50iFwaetzgMFjqZR4/5o5JzVq+Yxyq6lRp6Y5VEq3QB5QCaAIYlKYgTzhQ9m1K5fKuhEz8uDikQbj6tuWpP7oy06c564QPP6XqVsrv6xHs6EI= 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=STxkl/PO; arc=fail smtp.client-ip=52.101.61.26 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="STxkl/PO" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=O+p6WXBb8k6D99plXjnp7tfXLY5VjzHCIa9TjLMPvwJtQBU/jhaknCZ1sx7+177H1639Sxmq1RpXDyCj/lfIMZ3P5Rbw2a+CiWGWoCpkO+g+dQFGrwkBq9Olfldh+VASqwe9J1PY2NkdVXuchPeAPxo5hxu4F9m1nyw1VXmBJBysQr/eDUOKDEVeRuM/+f5Ml6xNgwuJOP4KLWeRoOf9yFN+3kyv1qnQTsYi4YRUYgMj9y7oUws1FrmvxEoN9NN7UC5SRI02AMKir+TE/LM86YkoqXUE5k0JkLd2BRxeLJEREUimYt6duQHskMeW1HkEkSB1iK0+eLLelRGannDDRw== 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=MKpNyvGiusIqZgi9DcCmmFbs5w0a8YDmT58BKS3XVnM=; b=gxzDrSR8+ypHg5xRVggTFl6g1wDXUwbUgDv70v2p7Cru5pIHKOL5yo330us3b0/g5I9LkoD7briFZOqwKDi0B9ScAFiQqzEBgmuEkl9o43An12hYnQS6Cl2nGq55FI+uh63DYR28PKq8CIVIax0c3dIwX5fiZZ0sWaKRoefMPLqPMBLhzCwu40iK0hZxqKaqNLjcbtzWESju90o89XbFdNehyr5ZR522Pfv6hCmZVmI7VD0jGyd46Y6gPLqy5j4ij8g/ECaXYjHJdq2XZsu41W65u5ZiLdLopeSO060fWYv7E8o8CncnERny+JPirFcl3v7iAJC3p3yZ/by/d4qABg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=linux.intel.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=MKpNyvGiusIqZgi9DcCmmFbs5w0a8YDmT58BKS3XVnM=; b=STxkl/PORTjZcboCqgmP+d1PHwiar5mqS6yKMYZDWSbeeSyqBUxkW3svdGF7zhBHWmAOoxijJMk8Tbyt1PK3uiMo87SIyLOEJJJK4F6psX9AEhQT8paxosD1lTv4hHWCkPYalRRbdggFKjFUNRjNEDUWsYoxiA8/K2DPqXshJUc= Received: from DSSP220CA0012.NAMP220.PROD.OUTLOOK.COM (2603:10b6:8:3d3::12) by PH7PR12MB7019.namprd12.prod.outlook.com (2603:10b6:510:1b9::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.223.12; Fri, 17 Jul 2026 16:21:19 +0000 Received: from DS3PEPF0000C380.namprd04.prod.outlook.com (2603:10b6:8:3d3:cafe::4c) by DSSP220CA0012.outlook.office365.com (2603:10b6:8:3d3::12) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.223.13 via Frontend Transport; Fri, 17 Jul 2026 16:21:19 +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=satlexmb07.amd.com; pr=C Received: from satlexmb07.amd.com (165.204.84.17) by DS3PEPF0000C380.mail.protection.outlook.com (10.167.23.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.245.5 via Frontend Transport; Fri, 17 Jul 2026 16:21:19 +0000 Received: from ausmlimonci-lx1.amd.com (10.180.168.240) by satlexmb07.amd.com (10.181.42.216) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.41; Fri, 17 Jul 2026 11:21:17 -0500 From: Mario Limonciello To: =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= CC: Hans de Goede , open list , "open list:X86 PLATFORM DRIVERS" , Mario Limonciello , Francis De Brabandere , Subject: [PATCH 2/4] platform/x86/amd/pmc: Fix error handling in amd_stb_s2d_init() Date: Fri, 17 Jul 2026 11:20:21 -0500 Message-ID: <20260717162023.956346-3-mario.limonciello@amd.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260717162023.956346-1-mario.limonciello@amd.com> References: <20260717162023.956346-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: satlexmb07.amd.com (10.181.42.216) To satlexmb07.amd.com (10.181.42.216) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS3PEPF0000C380:EE_|PH7PR12MB7019:EE_ X-MS-Office365-Filtering-Correlation-Id: 0588c573-2bd4-4901-2a4b-08dee41f6f33 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700016|1800799024|82310400026|376014|23010399003|56012099006|11063799006|3023799007|13003099007|18002099003|22082099003|10067099003; X-Microsoft-Antispam-Message-Info: +V0v8aEkDwh9XKR0H4vLF9+UNzpNC9Rt86QSCIHN2ufWdSJoPzOWjsLJCVqWZ4XDgO24mxUEph5iyjUmkFdxI1Ksb0i6bnzdaaF3x2UOO7sVMovimLYncLAcadoD75J6yFnr/v0KJsag2TV11j7biy506Eb3U0yGaeoCba7ahC9jI/I3VwsKc8yBYqn6XcThhwR3Zuz3Hoqy9aemMcYlaiFbS/kgFZ0mIZqUJ4b7nvNu5PLndZT/Mssv/xpcsFDmr7SeFvjuGDId0FWgnn6rlXRO9BdEzr9UyH8edZF5mMSfFSR1UcHzEgUbvvvE5/OaFQfuLI13zCqdnyU8pff9HuhiDN0LX0VQh4/t51D1Or0AmYX59cxLvoSQrhe+mMDolOI+Qpd9TD0rS4RDEsRz2FKdT2VUQg884gj2whn7fRW6zMS6QS8htYNMcqpzrJy/Nclvb3wqaX4HN3Xo1UqfytiNQKB3cPrp9b+ziqPBRKCnlLTEm2OdToVyYlK6Q2NMK6z7ndA3lYFX87YP07lnzB97t2l2zmzqBKISFUDJIY5oiLxHhhNXR7XMP5hlHalXYCw9IuqKkpxr4792Rvwl6LF7a1kbTrjYlGhvktgea7BwUw+Jt0z8TPcRuLPLdhekMZWNrHxxcfZQ4tEYmwEZLw+Ctlz9IWKse9RGVR/yxXhjp6oaznAsmtYQ25GwTR/hVhbSt1molZJQ5e8LiIj6GA== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:satlexmb07.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(36860700016)(1800799024)(82310400026)(376014)(23010399003)(56012099006)(11063799006)(3023799007)(13003099007)(18002099003)(22082099003)(10067099003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: OBVPdBmar1zWLXHUQq1gcVY+aIdyz0SboMhm3QswfdzThuyymE99NUWViwvvoK2mOX2hOGTv1HQ9i4ugTcs+Xt3NY27Aj1meFZwy4I7m+FrZy5u6cgIYZ3/uLzTMIDZR7OjLVt3McY25GKl+GJl+Yvm4oh22nVn2qHJdr0+dGCPcA6oA2DoIET5xawnUK8YwoGRLTan41pZIak2LgHis4ktAZQM4xZrdYi1gyuQ/ZxXN9xaccsTSu20W+E4JwiaH5SHo42lz2LLp4bsCiWkbnOpgoAL8hc1DuiN+AHs5ICCzXytgeVpvbU0fmUpn7C6M57roFye/0OHgyqn5Qt0XoPKn/yBDzQoqb1xtbR//K8bRA0VI9do1Gb0YXoWRTCZUYeaEkdbs2gTapE37OznZAyUD19y3Ac0J0Xrhmex7yvh+rJ4hkIwWNCJD1HHYSNEg X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jul 2026 16:21:19.3142 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0588c573-2bd4-4901-2a4b-08dee41f6f33 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=[satlexmb07.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DS3PEPF0000C380.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB7019 Content-Type: text/plain; charset="utf-8" amd_stb_s2d_init() has two problems on its error paths: - The return value of the S2D_TELEMETRY_SIZE SMU command is discarded. When the SMU refuses the command (e.g. "SMU cmd failed. err: 0xff") the failure is only noticed indirectly through the telemetry size check and reported as -EIO, masking the real error. - dev->msg_port is switched to MSG_PORT_S2D before issuing the S2D SMU commands but is only restored to MSG_PORT_PMC on the success path. The early "return -EIO" leaves the port stuck on MSG_PORT_S2D, so all subsequent SMU communication - including the s2idle prepare/restore handlers - is directed at the wrong mailbox. Consolidate the exit path through a single label so the message port is always restored, and propagate the SMU command error directly instead of inferring it from the size. Assisted-by: Claude:opus Reported-by: Francis De Brabandere Closes: https://bugzilla.kernel.org/show_bug.cgi?id=3D221759 Tested-by: Francis De Brabandere Fixes: 3d7d407dfb05 ("platform/x86: amd-pmc: Add support for AMD Spill to D= RAM STB feature") Cc: stable@vger.kernel.org Signed-off-by: Mario Limonciello --- drivers/platform/x86/amd/pmc/mp1_stb.c | 28 +++++++++++++++----------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/drivers/platform/x86/amd/pmc/mp1_stb.c b/drivers/platform/x86/= amd/pmc/mp1_stb.c index 753d630f3283d..6a048cb2605ec 100644 --- a/drivers/platform/x86/amd/pmc/mp1_stb.c +++ b/drivers/platform/x86/amd/pmc/mp1_stb.c @@ -289,7 +289,7 @@ int amd_stb_s2d_init(struct amd_pmc_dev *dev) u32 phys_addr_low, phys_addr_hi; u64 stb_phys_addr; u32 size =3D 0; - int ret; + int ret =3D 0; =20 if (!enable_stb) return 0; @@ -306,13 +306,17 @@ int amd_stb_s2d_init(struct amd_pmc_dev *dev) /* Spill to DRAM feature uses separate SMU message port */ dev->msg_port =3D MSG_PORT_S2D; =20 - amd_pmc_send_cmd(dev, S2D_TELEMETRY_SIZE, &size, dev->stb_arg.s2d_msg_id,= true); - if (size !=3D S2D_TELEMETRY_BYTES_MAX) - return -EIO; + ret =3D amd_pmc_send_cmd(dev, S2D_TELEMETRY_SIZE, &size, dev->stb_arg.s2d= _msg_id, true); + if (ret) + goto out; + if (size !=3D S2D_TELEMETRY_BYTES_MAX) { + ret =3D -EIO; + goto out; + } =20 - /* Get DRAM size */ - ret =3D amd_pmc_send_cmd(dev, S2D_DRAM_SIZE, &dev->dram_size, dev->stb_ar= g.s2d_msg_id, true); - if (ret || !dev->dram_size) + /* Get DRAM size; fall back to the default if the query fails */ + if (amd_pmc_send_cmd(dev, S2D_DRAM_SIZE, &dev->dram_size, dev->stb_arg.s2= d_msg_id, true) || + !dev->dram_size) dev->dram_size =3D S2D_TELEMETRY_DRAMBYTES_MAX; =20 /* Get STB DRAM address */ @@ -321,12 +325,12 @@ int amd_stb_s2d_init(struct amd_pmc_dev *dev) =20 stb_phys_addr =3D ((u64)phys_addr_hi << 32 | phys_addr_low); =20 - /* Clear msg_port for other SMU operation */ - dev->msg_port =3D MSG_PORT_PMC; - dev->stb_virt_addr =3D devm_ioremap(dev->dev, stb_phys_addr, dev->dram_si= ze); if (!dev->stb_virt_addr) - return -ENOMEM; + ret =3D -ENOMEM; =20 - return 0; +out: + /* Restore the default message port for subsequent SMU operations */ + dev->msg_port =3D MSG_PORT_PMC; + return ret; } --=20 2.43.0 From nobody Sat Jul 25 04:54:45 2026 Received: from BL0PR03CU003.outbound.protection.outlook.com (mail-eastusazon11012061.outbound.protection.outlook.com [52.101.53.61]) (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 426C4429CDA; Fri, 17 Jul 2026 16:21:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.53.61 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784305289; cv=fail; b=Hqawg+ngCquJcEvlTTsGNTiaECPVbIfIBLhyaJ7h9A3LqPO+HPm0ZR/plwJqlO4QDqswha30kIYppZBN3CG1OV9b9Cp1lLfNXl4WsszWDPTJEeQpVnCfJhXHDFS4uvkpkiORpinl1xSjT0PNjKg+IQEavpMQojHPbAbXXRvbLY4= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784305289; c=relaxed/simple; bh=dm4QLg59v2LOvLDXHolPxJme5UtUr1DZa50x/G84UEQ=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Ski4Oz7Q7DXEHfyUOTcSrVNPGGVIos37uCcwKhrlc4uFj42+hh55B6HrGAMILdy+n/D0+UyQtQU4KLuG63uvZiCUoZIFBXlWTjBpBsjoFVntK6Qdn5GseqV7N7N89QisWTWDFxz11ycF8yHUhEz3e6L/o8mV2hGo0xs/Qcksy34= 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=oZjWppIS; arc=fail smtp.client-ip=52.101.53.61 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="oZjWppIS" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=egIaSP5CAxpUUl4PzsnG6X3KI4Yuj/ueWms4WE17Ir8UOo9jvFJbaBPWiyLJRQ4Gw1BpPA4djAe//8mQYmkj/iEhG4bMrLg5hsJZE40F8MV0w8K6fTI13gZBvybUsj3HiWHjCr7UFLIRTMbIuqZrAoLEPBYnimi1ONLi6AwLzXD4oUDQ9Lgyw8MYekk1JORyulgrioHJEratjmqEMFWFhRrHpRl5mlJozX3CgUItF0q12DsrcaJ7EIEV70WQ+LWdgvN7r01O6UFpmprb2WAPrlQZpt5yd+MZlcwIadml3Xyt3bS72BP79000dDidTrG+uhI/wIWl8bP+A8RtfgyZ3g== 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=GfDxeVyiIMuBjd+8PvRR/S8uQtq/+RQYSjmK+x4Ga1M=; b=GLGJTb8Di5oK9o8HsgQ1X3ilFGP3yWrmQgBxFJRnpzMGfQXX6xLolA6nGkjZvvVq+Szdp36DRa0PEc9muEmCsMNa6aFwKn2cY+xouE7u1NBP7AYPkMjUIzdtQpr9EkkiuntqrKKPRAhh+GOZ2uXMtDkiRpg7wKLJSJYishf/BsgP6NwOzNr4adFi87EmAr7b6mfqzVrJESL6R7BQkf2Ax5kEGp/KFnVIfvC/bDMdj0NZ9vQDcSxFF380pS3155ylMdZ3FKmDPBUW1heSEyxmHz0wfjOOkIOy6IKxMrsJ5U2D2bAWkcCYBJ9kKu5UgkeKcv6VKvAxGek/1Z3cFmul9A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=linux.intel.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=GfDxeVyiIMuBjd+8PvRR/S8uQtq/+RQYSjmK+x4Ga1M=; b=oZjWppIS3131rzwFfHJKXG60/Q3w2hcburq2w+aJVUS3i6pLhaC8iKJ1u0zoBUL1Gnx+tw6NLBM57+LyaIPEsTFJ0lx+ADmDY4mzqD1G3K4GCHDwWwW0qTzhv0Tyum9rifUzhVFj1zQwKTbAh2Kji0R+hlv3t83h5Wl2d83AdgM= Received: from DSSP220CA0006.NAMP220.PROD.OUTLOOK.COM (2603:10b6:8:3d3::18) by DS0PR12MB8320.namprd12.prod.outlook.com (2603:10b6:8:f8::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.223.13; Fri, 17 Jul 2026 16:21:22 +0000 Received: from DS3PEPF0000C380.namprd04.prod.outlook.com (2603:10b6:8:3d3:cafe::2b) by DSSP220CA0006.outlook.office365.com (2603:10b6:8:3d3::18) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.223.13 via Frontend Transport; Fri, 17 Jul 2026 16:21:19 +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=satlexmb07.amd.com; pr=C Received: from satlexmb07.amd.com (165.204.84.17) by DS3PEPF0000C380.mail.protection.outlook.com (10.167.23.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.245.5 via Frontend Transport; Fri, 17 Jul 2026 16:21:19 +0000 Received: from ausmlimonci-lx1.amd.com (10.180.168.240) by satlexmb07.amd.com (10.181.42.216) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.41; Fri, 17 Jul 2026 11:21:18 -0500 From: Mario Limonciello To: =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= CC: Hans de Goede , open list , "open list:X86 PLATFORM DRIVERS" , Mario Limonciello , Francis De Brabandere Subject: [PATCH 3/4] platform/x86/amd/pmc: Do not fail probe when STB init fails Date: Fri, 17 Jul 2026 11:20:22 -0500 Message-ID: <20260717162023.956346-4-mario.limonciello@amd.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260717162023.956346-1-mario.limonciello@amd.com> References: <20260717162023.956346-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: satlexmb07.amd.com (10.181.42.216) To satlexmb07.amd.com (10.181.42.216) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS3PEPF0000C380:EE_|DS0PR12MB8320:EE_ X-MS-Office365-Filtering-Correlation-Id: c7648a86-e5fa-4ecb-9cc2-08dee41f6f8b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|36860700016|1800799024|376014|23010399003|18002099003|22082099003|3023799007|13003099007|10067099003|11063799006|56012099006|6133799003; X-Microsoft-Antispam-Message-Info: nRCmAmYZkNJMFhw5spCzSihlb1AZvA5h97ggHURLS3TqO+PBRxP6ERC3usqexnL2F01F7P1zmXkwvlPPB0UtW37s7W2zDMPHTKMRrC/tHFI8sMvTv9Kj7kA8Fb/X65kJefN9usIFoYtJVMkXheM04YbHgBHYarON+BiNKqAlQgsuXlz2vBfAhv2EmN0bmiuUeT96Wi8hG56nTcddPJ4EtEQTjhpNortW+JMVqbAeWPPW8yCGgyyhbDcMwdCCzgt5G32bkCWLBkeSjJ6jGOLeKwiwTMjavs3rtr9jU+CDtSl9pTb8QdlhygTiSgCtmKKByjdqGJtGHo8P8h5GChN71x+6h1nn41LC+BO/jZrbgU4dV2+SOUYY0n2cNq6Uep2qO0T1iHCg8Fa4TGUcNl/r98KUCjlaxWdK1Vm2oS/tHr6ohoMb7JW5fBsXLTUdFC1QUinBLktwuGfWINWnmIqDERlM4NcDX33gTk7wEpPuiWei7pq9iRPkaFX8onuOVZUw6nOCVEw2tWk2XmgR4wSBpUViMgdBw210qEkttliZmIOy6XN4LUqj7ZeCt6+I1FrS7XnMqXzU+5jwS9BcCd+nvbTCfVekTyJ+fX4MtwoL1YxJHQCRqf8PU7zDHnN9+9I6QLCZe6LaelqWWOUWW4ihcR/D8u4phaL2Pl6xyxNugEdXVR3k7Iii/DZB6ufqv5yTOnm0FapdJMwNUlB0h/nu+g== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:satlexmb07.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(82310400026)(36860700016)(1800799024)(376014)(23010399003)(18002099003)(22082099003)(3023799007)(13003099007)(10067099003)(11063799006)(56012099006)(6133799003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 0ws48aCGfMvfp1Rfrq800l+7FjvBdaEVryu0Qb9rfL4x9XMvoc0OHWwapyhVXlVoItTZ1F6j3acK1EUTs4k+Pk0Dzu41a6O7tRVEHqw+v0OLtSdDiXoaIaIEP2yGU4f9R2Bq5raVTD7qTx3bZmpswlaohqAQK8GKSkPbmGv10lxXOpXdisi7iQSVxdkkRddlJDhcs7PHE2X+mU4pk1HBH2Rhn52YUxLj6NRaPzZY2PTtpllM5fT9ygUcM9ZRiwjnWEY/cU46DGeCb8f4vkKax7SkChCaXG8qrYFeHWDgDxBzz8a+9XQphDc4xZ1f0xSzwVC5vfIbweo40BW7Xpn3Fw5Jnmt26/JW73UP0m0E5qBSl24bYWOsvhYznjgt2vx+SB4a/00+APRn4900PkN1mdC4oV8aiamaAZBOBNTiBF3lz8ALcGs+lrMzo8dmF2HI X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jul 2026 16:21:19.8942 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c7648a86-e5fa-4ecb-9cc2-08dee41f6f8b 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=[satlexmb07.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DS3PEPF0000C380.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB8320 Content-Type: text/plain; charset="utf-8" STB (Spill to DRAM) is an optional debugging facility that is only enabled through the enable_stb module parameter. On some platforms the SMU refuses the S2D setup outright, and on long-running systems the large telemetry region can fail to ioremap. In either case amd_stb_s2d_init() returns an error and, because probe treated that as fatal, the entire PMC driver failed to load - silently disabling s0i3 support even though STB is only a debug aid. Downgrade the failure to a warning and continue probing so that s0i3 support via the LPS0 handler no longer depends on an optional debug feature. Since probe no longer aborts on this path, the LPS0 and debugfs unwinding added by the earlier fix in this series becomes unreachable and is removed. Assisted-by: Claude:opus Reported-by: Francis De Brabandere Closes: https://bugzilla.kernel.org/show_bug.cgi?id=3D221759 Tested-by: Francis De Brabandere Signed-off-by: Mario Limonciello --- drivers/platform/x86/amd/pmc/pmc.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/drivers/platform/x86/amd/pmc/pmc.c b/drivers/platform/x86/amd/= pmc/pmc.c index 630a664bdd2f4..5b6c90abd4e5f 100644 --- a/drivers/platform/x86/amd/pmc/pmc.c +++ b/drivers/platform/x86/amd/pmc/pmc.c @@ -917,19 +917,24 @@ static int amd_pmc_probe(struct platform_device *pdev) } =20 amd_pmc_dbgfs_register(dev); + + /* + * STB is an optional debugging facility, only enabled via the + * enable_stb module parameter. A failure to initialize it (e.g. the + * SMU refusing the request, or the telemetry region failing to map) + * must not prevent the rest of the driver - most importantly the s0i3 + * LPS0 handler - from working, so treat it as non-fatal. + */ err =3D amd_stb_s2d_init(dev); if (err) - goto err_dbgfs_unregister; + dev_warn(dev->dev, "STB initialization failed (%d), continuing without S= TB support\n", + err); =20 if (IS_ENABLED(CONFIG_AMD_MP2_STB)) amd_mp2_stb_init(dev); pm_report_max_hw_sleep(U64_MAX); return 0; =20 -err_dbgfs_unregister: - amd_pmc_dbgfs_unregister(dev); - if (IS_ENABLED(CONFIG_SUSPEND)) - acpi_unregister_lps0_dev(&amd_pmc_s2idle_dev_ops); err_pci_dev_put: pci_dev_put(rdev); return err; --=20 2.43.0 From nobody Sat Jul 25 04:54:45 2026 Received: from BN8PR05CU002.outbound.protection.outlook.com (mail-eastus2azon11011023.outbound.protection.outlook.com [52.101.57.23]) (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 4BB2C3F8EA2; Fri, 17 Jul 2026 16:23:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.57.23 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784305387; cv=fail; b=ezFJRBSg4iFNk8Qv07k8HWuyX7+veukUTC0p2VHC+Zxc+D+R6poRH+IHfAF25OUBlJWIgTkyYkp6sCoJbpXlHzNZZhQJ5rYkEtrJrtU/ui9X/g50SfK5g7LYBzwsLz2PWieaCKkEpcIiQ1psgxmhHNBTjqoKYcllGfrKioRMiTA= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784305387; c=relaxed/simple; bh=Ql2d3V39yLKZsvlPNajsX1+JWFYcSrO3RffUswZ55uY=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=dNobAxe2Ht4TxNhlwR/TjwJiemKt0iwerSOa3CMg6jZdfqQhCuPZo7IPI98AYaPL+BW448ZYgH9xIQW6a6Rixg43VH6nBjcuub/bVPhX4sQ35TN6RXW00UG/UVgYsNcMoP2CuWmPxkbAwo6K3a/Umk/xSDofXqGLBKdwK8tueQ0= 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=WlPUg/AR; arc=fail smtp.client-ip=52.101.57.23 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="WlPUg/AR" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=QlxiQcsN8MIL+e27mjgdLmjzY4K8SNF7xhrdqefpTnceyySYFNP+47kWsHW3quSEzUxadnp3rMVPdlkiWUpy43Jhzziuzb6xJ97+15WoJTaAYvHl5Hl1y96aVNAgbY43nXulUHyzhgXG8f9Cfl5BUdJ96VjSvv/MrjnyztYQ2yBqkEUAZuxTFgVzujkk0eb8SGVW2gGWMXIvscQJ1NuCuqOF7fCe+WDMEV4lCJr9gqgx7gM0vKFsduYMccbc9aBCi+j0ImyxY6N1INbP47yDPdjkHdAUgtqmTuibT48lbIiaKVOyI16ZWsYxKSTGV2BYbamjgtsoLwtSz9xmgfI7Zw== 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=qrOOBXQod9g4/EfKv8a5bu+8QH6Lo6JN6dl3mm5jhdI=; b=x3kInZ6TNjQY/s/JgUCuFxT4kk0aJ0wEt6O8OyOua82UFdlNEQFbis5Xqon2S9msqJxwkVrRB9PXTMZTDgTpxujPXSDxfQTFoqL9R9LEC/NJ5jINcAjdt4EvDGzvKKxr+U42Ku13pqsanLSc1U6h09Nrp34fZrgJUnsWKUxucgDX1yCSBnmkcW5O5ndFSPdhwW7nGavae2PeRM4n94a0thE3NR6hHFVaABm7YYh5lnYkhu8G8LFhXyp5EOW0iET8u2wz98SR18qeuTqRshHVsXmdNdbCt3jkVnaeqekgSTG2Vg2Lw+nSn8qOKeOK9tPenbbFm9DY8ZO090ywLHPEbg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=linux.intel.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=qrOOBXQod9g4/EfKv8a5bu+8QH6Lo6JN6dl3mm5jhdI=; b=WlPUg/AR34ggxPM4zkX+z9XZOeeOdkeJcuXjJv0VOL78LDkH8EG3ppXTPGae17xUvSPbJVoksyZ4KzMfw/WHAL7Hb1dJ0iE8SzJEYAkFJdwvYAxat6IPshPSPs0izHX7pQoYfNTz6rsmr60Bw58ZdmxqxsWh46/GyoovNAzt3+c= Received: from CH0PR07CA0006.namprd07.prod.outlook.com (2603:10b6:610:32::11) by MW4PR12MB7311.namprd12.prod.outlook.com (2603:10b6:303:227::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.223.10; Fri, 17 Jul 2026 16:22:59 +0000 Received: from DS3PEPF0000C380.namprd04.prod.outlook.com (2603:10b6:610:32:cafe::2a) by CH0PR07CA0006.outlook.office365.com (2603:10b6:610:32::11) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.223.13 via Frontend Transport; Fri, 17 Jul 2026 16:22: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=satlexmb07.amd.com; pr=C Received: from satlexmb07.amd.com (165.204.84.17) by DS3PEPF0000C380.mail.protection.outlook.com (10.167.23.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.245.5 via Frontend Transport; Fri, 17 Jul 2026 16:22:57 +0000 Received: from ausmlimonci-lx1.amd.com (10.180.168.240) by satlexmb07.amd.com (10.181.42.216) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.41; Fri, 17 Jul 2026 11:21:18 -0500 From: Mario Limonciello To: =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= CC: Hans de Goede , open list , "open list:X86 PLATFORM DRIVERS" , Mario Limonciello Subject: [PATCH 4/4] platform/x86/amd/pmc: Validate S2D physical address before ioremap Date: Fri, 17 Jul 2026 11:20:23 -0500 Message-ID: <20260717162023.956346-5-mario.limonciello@amd.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260717162023.956346-1-mario.limonciello@amd.com> References: <20260717162023.956346-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: satlexmb07.amd.com (10.181.42.216) To satlexmb07.amd.com (10.181.42.216) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS3PEPF0000C380:EE_|MW4PR12MB7311:EE_ X-MS-Office365-Filtering-Correlation-Id: 2b6f134a-469e-43e1-d0d1-08dee41fa9eb X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|1800799024|82310400026|23010399003|36860700016|10067099003|22082099003|18002099003|6133799003|11063799006|56012099006|3023799007; X-Microsoft-Antispam-Message-Info: kp40qmOwuGwvKE1VllYqhzUYwb+yXMGhPHwsfiTZxpkHJ28QJvtDwqUuERlBcVzZJyJVKUi5dgp0LVLBb5Wu7pldaysKpvCg849ja+ioafdv5gpbvtAbz7zyjd+3LkRG9yLsgK8nyTxzbTzPqPg/THdGaiDRUQaXZjuNXbQEXt6QkZX1iO7rF4+51RI3yQz/iYYtrYn1kvifQIJ92vnvGJULA2LxI+5LO1ay+8oWNyqjcmVqqUoakHzS9WR7W72GBNaBDofK3VmaU+h+FFmaFvrIQjN/CApxrpq4wQVPnQGXCNBVJkv0+nqGf1Ae+BMV3AB6/XRi+bimakSQ/wPqVfzYBgcbmtsJ83ewSMOFHw8yTfVF63NQrMMXdkFi7eqinSR4BjvznkF4pXTYtE1lIna220MQkIPzBQvZPXyh3Ei0nvdlEEiugFdNEP9+sHRcZibAf+Ku9spoaYwz+3xne0GlTCI0/egZKqWyw0kA3Rg94HmP92lzg2yf4jNif65Jqjqm0b0hKgk7l8ZYN4fIC1vt53/CXBm5YS4YqqJG/Q/CFkp64XTW6WYuoBp4E2xbw8jW5ArmbH5LdIwa+VTG9b0rG6ZZyuPQXwRr8Mr+1jp1Pjk0Y253PASlCnC4WXMM6+Vespekof49c0ZQFWJMho5YKhNtyqM69KzldWGbQ3N3CcFTKII9LyvCT/lu2XdrV2Yg/sA7y37R9dixdF4fzw== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:satlexmb07.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(376014)(1800799024)(82310400026)(23010399003)(36860700016)(10067099003)(22082099003)(18002099003)(6133799003)(11063799006)(56012099006)(3023799007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 4agAZvv4rhUULgqo+5G53yN8HZiZicw7syc0f6SOfwBDyPV1U3jYrT+fQxEUHD+NxuED+UOLeym6pHwaQW2shs/OVTjgc3siNq0r3JzpXYRN52teUHL7R8XhhgHI8TMT5ugkD7+k+45+a8S/msyiJu/nWDQGmaaBzaNH76lPZF1PtXCTSO/5icsc0HJD+yUWOJxeBcvksR1+Krz/lC9yLDZFmYc0lnEV6O0o48UYGGCA3G+QGhIIotYRc9n8AQ5iOXEe2M1dxj3xvvqCJMo24S1okf92e5OZ3RxrQrMJlzNSjgeQxb0HgnOmuqVv4sUcjscWRQ4eh13qc66TezifB/SUMufnP48auArrr9WMz8xfEA31pB06V3ShATdLhpz8vlCnkKiYWegYTFaejIewyl7RtlFByIusq9YsdH+RTSq/dxBAy/jgo9TR1qcSl/gM X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jul 2026 16:22:57.8306 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2b6f134a-469e-43e1-d0d1-08dee41fa9eb 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=[satlexmb07.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DS3PEPF0000C380.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR12MB7311 Content-Type: text/plain; charset="utf-8" amd_stb_s2d_init() retrieves the S2D telemetry buffer's physical address via two SMU commands (low and high 32 bits) but does not check their return values. On some platforms the SMU refuses these commands (observed: "SMU cmd failed. err: 0xff") and the phys_addr_low/high output parameters are left uninitialized at zero. The driver then attempts devm_ioremap(dev, 0x0, 16 MB), which trips the ioremap-on-RAM warning and fails: amd_pmc AMDI000B:00: SMU cmd failed. err: 0xff ioremap on RAM at 0x0000000000000000 - 0x0000000000ffffff WARNING: CPU: 13 PID: 4592 at arch/x86/mm/ioremap.c:216 __ioremap_caller+0xfc/0x3b0 devm_ioremap+0x5a/0xb0 amd_stb_s2d_init+0x239/0x280 [amd_pmc] amd_pmc AMDI000B:00: STB initialization failed (-12), continuing... Probe completes successfully but the kernel is tainted by the WARN. Check both physical-address command return codes and reject a zero address before attempting the ioremap. Assisted-by: Claude:opus Signed-off-by: Mario Limonciello --- drivers/platform/x86/amd/pmc/mp1_stb.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/drivers/platform/x86/amd/pmc/mp1_stb.c b/drivers/platform/x86/= amd/pmc/mp1_stb.c index 6a048cb2605ec..a507444a945ae 100644 --- a/drivers/platform/x86/amd/pmc/mp1_stb.c +++ b/drivers/platform/x86/amd/pmc/mp1_stb.c @@ -320,10 +320,21 @@ int amd_stb_s2d_init(struct amd_pmc_dev *dev) dev->dram_size =3D S2D_TELEMETRY_DRAMBYTES_MAX; =20 /* Get STB DRAM address */ - amd_pmc_send_cmd(dev, S2D_PHYS_ADDR_LOW, &phys_addr_low, dev->stb_arg.s2d= _msg_id, true); - amd_pmc_send_cmd(dev, S2D_PHYS_ADDR_HIGH, &phys_addr_hi, dev->stb_arg.s2d= _msg_id, true); + ret =3D amd_pmc_send_cmd(dev, S2D_PHYS_ADDR_LOW, &phys_addr_low, + dev->stb_arg.s2d_msg_id, true); + if (ret) + goto out; + ret =3D amd_pmc_send_cmd(dev, S2D_PHYS_ADDR_HIGH, &phys_addr_hi, + dev->stb_arg.s2d_msg_id, true); + if (ret) + goto out; =20 stb_phys_addr =3D ((u64)phys_addr_hi << 32 | phys_addr_low); + if (!stb_phys_addr) { + dev_err(dev->dev, "S2D phys addr query returned invalid address\n"); + ret =3D -ENXIO; + goto out; + } =20 dev->stb_virt_addr =3D devm_ioremap(dev->dev, stb_phys_addr, dev->dram_si= ze); if (!dev->stb_virt_addr) --=20 2.43.0