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.201.52 ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1795924181; b=uSVaPRBSvvcLrd3y9A6Xy1lQaDjpogQtzkc4qhV6BIVNas5bFn3G8dyHakZ5UWpdKN04 8GSWHD/W05bguPDJjc38C0ZWPNWNASVa0LdatY4iyi0L8ZGPfwv6Ij/L7L29dwZ0nHKQE /tyV3yCwdXuC2zoOsc05doG3p8LA8tFqmyXwvup+HmSiBrkryA41aan963NdJmkQHyu/9 1aCa+dJORRhTgeZxtQlPi1XyxJRGSkNox1/KFOgFxji5qv78l+a0hmx3hLpb08cqOoaEy s7uIwuyGc90j/jHVzyyl+Fktj2U9xbd4P0MOkosGfjYhyOLYPap2p3XQFEK3C7klvWA== ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795924181; h=DMARC-Filter:DKIM-Signature:Received:Received:Message-ID:Date: User-Agent:Subject:Content-Language:To:Cc:References:From:In-Reply-To: Content-Type:Content-Transfer-Encoding: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=6eWXnLjNFR5/b8cTAiiT6XLL5AiR2mAP39vPDG5fmGU=; b=sVd1igfQCrcveY3vrRIzHTNnZFHqH+hdcYwd8rUdiXVB3Vm8e2HmhrjThfPGF9ZvR9wo ED+exjVCuvMTE0OENEv89BqXZUGXcfmjN1INV9TY6V7eqpTeWOsq4HP3f1dCsq49XxFQ2 ve5cVCuVGmzJ0cIblzf6TBW/KSflvHOjkq+y0eRSxJblg+GZMuFvO/r6GbLK63UnvzEWd HbMeMhvtjhfiRTlbGmXewuUeiPlnn8nxOOaj3yBdhYd34g57OKYo46GoDS7hvYWnea3Av 2s66fo7kzugpMHtAnmN4gTYfFo2F6fDuIAoD3d9aoVixzdyL/g7v/NuCo2/ji3OKROQ== 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=p3SfloiK; arc=pass header.oldest-pass=0 smtp.remote-ip=52.101.201.52 Received: from PH7PR06CU001.outbound.protection.outlook.com (mail-westus3azon11010052.outbound.protection.outlook.com [52.101.201.52]) (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 83874606A31C; Sun, 29 Nov 2026 03:49:40 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 83874606A31C 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=p3SfloiK ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=gl6hpeMIJtlvE9eANQQI+7EI/icl3U/nfbBmod/KRjD5JzNsWdSE3i1nzgOvA2t+lhS3e5Dl1aT6b6fOpDlTZKAHEadcw8LM2B2s8sD0eNmQVvPaF7l/xseCLA+TCWZ2xPl3i3swqGxOQeL66Z/+yCWpeaFj03lEjkgYaMyZrcNSnpR1bAe/OiGPg0aCIktiTh94sMcr7IBHrlyGNiVM0gfp+2xggr0oILuPqltWxs+S6sYxNT9qy2GbwJtqW/Vuh7wUsnsz2gJH7wRDjrVxcvx1sHOummmXCb4Z9dk6LZjHVlMHt5BUgBC+Sj0RB2SwUqn1/j9R/J5d9ekNsPlOtQ== 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=6eWXnLjNFR5/b8cTAiiT6XLL5AiR2mAP39vPDG5fmGU=; b=eKvN/uO6VrAepuZxDrX14hSXh5+OzdkljO5mgqoIgvIPQ4oEcO/zrtMX/nQ1XOb8QcqNF3I7qG8V4BzWMdXFmidHB8nNrl/3zBdyB9uao9cNoMtT8STko3sp7CkYoVWcdaPzB5MAWmoFJULjVIceFmXah4NdkFp3hdXyLJjGmnYHUQJvFM1dmemCHZQ3kQkcuXUkr0ALbXnV1/IcBxCB6rZZ8qqUOPLR73iWpFFHcdByemmhtAfB6k/Zku8VD3M83vW2l4VXcwQJ4Caq9Eanc+FMGbqiGS/JSV0UItneJRxzpa9xOno7st4k0HzQ5yoanh9gKStQ/kxHeB1vU2bJkg== 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=6eWXnLjNFR5/b8cTAiiT6XLL5AiR2mAP39vPDG5fmGU=; b=p3SfloiKEqTKdCn/T5WYyYoRY6pvwEMhnanHqH1zSCJJhsLUoGgitgyuuizgbHEog3Vz8YDoUHZmHhcrE6qg+547z4PJP0XxcNxTs8rK8+cbTTt/xfpqD8YBtSY5x2Y9hPDNn6xi4jEy5K7QVKg/KeRFDoOysd7V+vnAE5Yx/+8= Authentication-Results: mx.microsoft.com 1; dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; Received: from PH7PR12MB9174.namprd12.prod.outlook.com (2603:10b6:510:2ed::9) by CH9PR12MB917979.namprd12.prod.outlook.com (2603:10b6:610:333::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.662.10; Sun, 29 Nov 2026 03:49:35 +0000 Received: from PH7PR12MB9174.namprd12.prod.outlook.com ([fe80::eaaa:b430:ba9:5dc]) by PH7PR12MB9174.namprd12.prod.outlook.com ([fe80::eaaa:b430:ba9:5dc%7]) with mapi id 15.21.0662.007; Sun, 29 Nov 2026 03:49:35 +0000 Message-ID: <2fa3676b-d3eb-497d-b564-57e335141d5a@amd.com> Date: Sat, 28 Nov 2026 21:49:32 -0600 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] ACPI: x86: Work around AMD CPM _L05 notifying a missing dGPU on ASUS G513QY Content-Language: en-US To: "Rafael J. Wysocki (Intel)" Cc: Len Brown , linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, Mike Lothian References: <20261122-fdo-gitlab-6061-v1-1-8380b1ec4e09@amd.com> From: Mario Limonciello In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-ClientProxiedBy: BN9PR03CA0437.namprd03.prod.outlook.com (2603:10b6:408:113::22) To PH7PR12MB9174.namprd12.prod.outlook.com (2603:10b6:510:2ed::9) X-Mailing-List: linux-acpi@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: PH7PR12MB9174:EE_|CH9PR12MB917979:EE_ X-MS-Office365-Filtering-Correlation-Id: bb53ab4c-b57b-49cc-3c80-08df4dcbc88c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|23010399003|1800799024|366016|376014|4143699003|11063799006|6133799003|18002099003|261009223027099003|22082099003|3023799007|10067099003|56012099006|261102123227099003|261026140227099003|261026121527099003|261028144727099003|261022075727099003|261021121427099003|261022105027099003; X-Microsoft-Antispam-Message-Info: 2N2Bd6OOvvZ+ngFOB8d3Jgi76nQtKQ1tFHAHA0dh6Q0rBWtIcOQPJS2IZ1qkOg38LbxpXqmaoV1s2Dv/5TEYDak+w9cFjT1jm6j4GZqMPrMoMly7mmQ3a+64zxAg+orHxnelxGSTC5PGAIL0mC/Al5i9jRMhxi9qBDu0OuHPokARRkqD7kuAozIza3KLOI8MQQlSfd4z7SNJRIHQCxCW6lXUiY7akIxE3U4e3PnmX9k1cIM56krrpAdK8MpZRDktzPxdeS7XaI1xdZac809QeTYfBvip0MXtSOfsiS3elMNq7LqXZPsnGlboDL6Pc0AfckVKoRN3cyscAozRLcRVeBLzB2q8KuOw9kKU5jaoWxgb/Y400rauEw4r5mn09GnWd6Cy3mcAdzEOpQZwlxcjkw06MJ3CG6reBY6oY44Xt44AbYvjWsJxaTDUpSgQr2K34BwHnPoDgLT7DcagNxTnMayE+460IJhriX7bZmG6tBJX5Z7hopMmzQj1/68lIQmWP+/OBYIGVL9T3XI8eQUIYflRpuiH+Hv3kHqKywYCY79+9R8t83SZuCBaPgReS0TiPMiOSygP5I9PP9RRAXIJkxUHQHqpT+39JVzERieucK5oCi14sd0lf/cgGVaxzDC0 X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH7PR12MB9174.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(23010399003)(1800799024)(366016)(376014)(4143699003)(11063799006)(6133799003)(18002099003)(261009223027099003)(22082099003)(3023799007)(10067099003)(56012099006)(261102123227099003)(261026140227099003)(261026121527099003)(261028144727099003)(261022075727099003)(261021121427099003)(261022105027099003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?YmxKRytxaURUUUpQeUVUNmtLd2JGU3B4eEc5K3MwWkFBS01JN1hvMnpMc21H?= =?utf-8?B?ZjBzSXphRFpKdUh3UDdGdlZjMHBLMFVjM0I1WDY4MERiRDhMbkEvUEFqNmkw?= =?utf-8?B?Y2ViUlJWQ3c5M2sxNElSUXhHd2FIVW8xbml6VUZwNDlFTmJSRGRXN1NOSU84?= =?utf-8?B?NnZXbkMyT2hFdEJsZ25WQ1N3Vms0SHJHOUpveGpacCtSdmJQcGJ1VFdaWkxK?= =?utf-8?B?eFpKUjRwWGlDandYWXU0WUIyTkM3bUJUaTIyd3A0R09GbVU3bXdKQjNIR3Vx?= =?utf-8?B?MFluK254RXFab1lXS0lYMmdjMnF5QjBKN1YwNDcxOG9uR09URzR3Q2JWeDFX?= =?utf-8?B?MVVJTkEyQXJSbFp4ZCtkQXdpTDkxdzkySm9SZ0NUSCtURnJHU1NhSXZTODQ4?= =?utf-8?B?amFiODQyeGpwRTUwWkh1dlZhSVV5UlRWeG1FTlpOakJHaDY0Mk5YZ0Z5QUhv?= =?utf-8?B?Tk1SUXUrQ2lydDlmUkZVVUdFaEh1aDNneGVQQi9JQ2s1d0VFQUdBM0JHTmoy?= =?utf-8?B?RENYaDhEZlFTYjdPSisxMnlkQnlFczhUZU44ck5YTFc1YlN2SFlieXlMUj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dcbc88c X-MS-Exchange-CrossTenant-AuthSource: PH7PR12MB9174.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Nov 2026 03:49:34.9956 (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: mjIlwy9RaSI/EgztegYu/JiZCdZWFwxpzCK9HZtxS5BSddjzOFvjkumEn0kSuUf/GBn3kpYmWFBm5+QsBpcnHg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH9PR12MB917979 On 11/26/26 08:54, Rafael J. Wysocki (Intel) wrote: > On Sun, Nov 22, 2026 at 7:14 PM Mario Limonciello > wrote: >> >> The AMD CPM D3cold SSDT (OEM table ID "CPMD3CLD") on the ASUS ROG Strix >> G513QY (BIOS G513QY.335) handles the dGPU hotplug GPE with: >> >> Scope (\_GPE) { Method (_L05) { Notify (\_SB.PCI0.GPP0.VGA, 0x81) } } >> >> On this board the Navi 22 sits behind an on-package PCIe switch and is >> \_SB.PCI0.GPP0.SWUS.SWDS.VGA; \_SB.PCI0.GPP0.VGA is not defined by any >> table. The interpreter correctly aborts the method: >> >> ACPI BIOS Error (bug): Could not resolve symbol [\_SB.PCI0.GPP0.VGA], AE_NOT_FOUND >> ACPI Error: Aborting method \_GPE._L05 due to previous error (AE_NOT_FOUND) >> ACPI Error: AE_NOT_FOUND, while evaluating GPE method [_L05] >> >> so the Notify is lost and a dGPU in D3cold is never woken for the >> hotplug. > > Which presumably doesn't happen in Windows. > > Do you know what the difference is? Mike, Can you try on Windows and confirm this behavior doesn't happen in Windows? > >> Other firmware on the same board (the _L00 handler and the >> ATIF dispatchers) guards both the GPP0.VGA and GPP0.SWUS.SWDS.VGA paths >> with CondRefOf(), so only this method was missed. >> >> Aliasing the missing name is not an option: those guarded branches would >> then both resolve and dispatch to the dGPU twice. Instead, load a small >> built-in SSDT with a method that notifies the real node and replace _L05 >> with a GPE handler that runs it. The handler defers to a workqueue, as >> AML can't run in interrupt context, and re-arms the level-triggered GPE >> behind the notify queue as ACPICA does for _Lxx methods. >> >> Match the DMI for the G513QY and introduce a new quirk behind a new >> ACPI_AML_QUIRKS option. > > I'm totally not a fan of adding AML blobs to the kernel. Yeah it's a really slippery slope; understood. > > It would be better to avoid putting the device in question into D3cold > on the affected system IMV. The problem with avoiding putting it into D3cold is that it's a dGPU - it's going to burn tons of power when it could otherwise be idle. > >> Reported-by: Mike Lothian >> Closes: https://gitlab.freedesktop.org/drm/amd/-/work_items/6061 >> Tested-by: Mike Lothian >> Link: https://lore.kernel.org/amd-gfx/20261029151422.56791-1-mike@fireburn.co.uk/ >> Signed-off-by: Mario Limonciello >> --- >> drivers/acpi/Kconfig | 16 +++++ >> drivers/acpi/x86/Makefile | 1 + >> drivers/acpi/x86/cpm_d3cold.c | 161 ++++++++++++++++++++++++++++++++++++++++++ >> 3 files changed, 178 insertions(+) >> >> diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig >> index fa3eb52b22cd8..70a8d3c79a1b5 100644 >> --- a/drivers/acpi/Kconfig >> +++ b/drivers/acpi/Kconfig >> @@ -393,6 +393,22 @@ config ACPI_TABLE_OVERRIDE_VIA_BUILTIN_INITRD >> >> See Documentation/admin-guide/acpi/initrd_table_override.rst for details >> >> +config ACPI_AML_QUIRKS >> + bool "Workarounds for known AML bugs in system firmware" >> + depends on X86 >> + help >> + Some systems ship AML that cannot work as written, for example a >> + method that notifies a device which does not exist in the namespace. >> + This option builds workarounds for such firmware bugs. Each one is >> + enabled only on the specific systems it is known to be needed on >> + (matched by DMI), and loads small built-in tables and/or takes over >> + an ACPI event from the firmware's own method on those systems. >> + >> + Currently this covers the AMD CPM D3cold dGPU hotplug GPE on the >> + ASUS ROG Strix G513QY. >> + >> + Systems that are not on the list are unaffected. If unsure, say N. >> + >> config ACPI_DEBUG >> bool "Debug Statements" >> default y >> diff --git a/drivers/acpi/x86/Makefile b/drivers/acpi/x86/Makefile >> index 63c99509ed9de..04c2c7ffc3a1c 100644 >> --- a/drivers/acpi/x86/Makefile >> +++ b/drivers/acpi/x86/Makefile >> @@ -4,5 +4,6 @@ acpi-x86-y += cmos_rtc.o >> acpi-x86-$(CONFIG_PCI) += lpss.o >> acpi-x86-y += s2idle.o >> acpi-x86-y += utils.o >> +acpi-x86-$(CONFIG_ACPI_AML_QUIRKS) += cpm_d3cold.o >> >> obj-$(CONFIG_X86) += blacklist.o >> diff --git a/drivers/acpi/x86/cpm_d3cold.c b/drivers/acpi/x86/cpm_d3cold.c >> new file mode 100644 >> index 0000000000000..8db5d5ba1a2af >> --- /dev/null >> +++ b/drivers/acpi/x86/cpm_d3cold.c >> @@ -0,0 +1,161 @@ >> +// SPDX-License-Identifier: GPL-2.0-only >> +/* >> + * cpm_d3cold.c - Work around AMD CPM D3cold tables that notify a missing dGPU >> + * >> + * The AMD CPM D3cold SSDT (OEM table ID "CPMD3CLD") handles the dGPU hotplug >> + * GPE with: >> + * >> + * Scope (\_GPE) { Method (_L05) { Notify (\_SB.PCI0.GPP0.VGA, 0x81) } } >> + * >> + * On boards where the dGPU sits behind an on-package PCIe switch the device is >> + * \_SB.PCI0.GPP0.SWUS.SWDS.VGA and \_SB.PCI0.GPP0.VGA does not exist. The >> + * interpreter correctly aborts _L05 with AE_NOT_FOUND, the Notify is lost and >> + * a dGPU in D3cold is never woken for the hotplug. Other tables from the same >> + * firmware (e.g. the _L00 handler) already guard both paths with CondRefOf(). >> + * >> + * Aliasing the missing name is not an option: those other tables would then >> + * see both paths and dispatch to the dGPU twice. Instead, on boards known to >> + * be affected, load a small SSDT that notifies the real node and run it from a >> + * GPE handler that replaces _L05. >> + * >> + * The built-in SSDT is the following, compiled with iasl: >> + * >> + * DefinitionBlock ("", "SSDT", 2, "LINUX", "CPML05FX", 1) >> + * { >> + * External (\_GPE, DeviceObj) >> + * External (\_SB.PCI0.GPP0.SWUS.SWDS.VGA, DeviceObj) >> + * >> + * Scope (\_GPE) >> + * { >> + * Method (FX05, 0, NotSerialized) >> + * { >> + * Notify (\_SB.PCI0.GPP0.SWUS.SWDS.VGA, 0x81) >> + * } >> + * } >> + * } >> + */ >> + >> +#define pr_fmt(fmt) "ACPI: CPM: " fmt >> + >> +#include >> +#include >> +#include >> +#include >> +#include >> + >> +#define CPM_D3COLD_GPE 0x05 >> + >> +#define CPM_L05_PATH "\\_GPE._L05" >> +#define CPM_FIX_PATH "\\_GPE.FX05" >> +#define CPM_MISSING_PATH "\\_SB.PCI0.GPP0.VGA" >> +#define CPM_DGPU_PATH "\\_SB.PCI0.GPP0.SWUS.SWDS.VGA" >> + >> +static const u8 cpm_l05_ssdt[] __initconst = { >> + 0x53, 0x53, 0x44, 0x54, 0x79, 0x00, 0x00, 0x00, 0x02, 0x7e, 0x4c, 0x49, >> + 0x4e, 0x55, 0x58, 0x00, 0x43, 0x50, 0x4d, 0x4c, 0x30, 0x35, 0x46, 0x58, >> + 0x01, 0x00, 0x00, 0x00, 0x49, 0x4e, 0x54, 0x4c, 0x28, 0x06, 0x23, 0x20, >> + 0xa0, 0x28, 0x00, 0x15, 0x5c, 0x5f, 0x47, 0x50, 0x45, 0x06, 0x00, 0x15, >> + 0x5c, 0x2f, 0x06, 0x5f, 0x53, 0x42, 0x5f, 0x50, 0x43, 0x49, 0x30, 0x47, >> + 0x50, 0x50, 0x30, 0x53, 0x57, 0x55, 0x53, 0x53, 0x57, 0x44, 0x53, 0x56, >> + 0x47, 0x41, 0x5f, 0x06, 0x00, 0x10, 0x2b, 0x5c, 0x5f, 0x47, 0x50, 0x45, >> + 0x14, 0x24, 0x46, 0x58, 0x30, 0x35, 0x00, 0x86, 0x5c, 0x2f, 0x06, 0x5f, >> + 0x53, 0x42, 0x5f, 0x50, 0x43, 0x49, 0x30, 0x47, 0x50, 0x50, 0x30, 0x53, >> + 0x57, 0x55, 0x53, 0x53, 0x57, 0x44, 0x53, 0x56, 0x47, 0x41, 0x5f, 0x0a, >> + 0x81 >> +}; >> + >> +static const struct dmi_system_id cpm_l05_dmi_table[] __initconst = { >> + { >> + .ident = "ASUS ROG Strix G513QY", >> + .matches = { >> + DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), >> + DMI_MATCH(DMI_BOARD_NAME, "G513QY"), >> + }, >> + }, >> + {} >> +}; >> + >> +static acpi_handle cpm_fix_handle; >> + >> +static void cpm_l05_rearm(void *unused) >> +{ >> + acpi_finish_gpe(NULL, CPM_D3COLD_GPE); >> +} >> + >> +static void cpm_l05_work(void *unused) >> +{ >> + acpi_status status; >> + >> + status = acpi_evaluate_object(cpm_fix_handle, NULL, NULL, NULL); >> + if (ACPI_FAILURE(status)) >> + pr_err("%s failed: %s\n", CPM_FIX_PATH, >> + acpi_format_exception(status)); >> + >> + /* >> + * Notify() handlers run from the notify workqueue. As for a firmware >> + * _Lxx method, only clear and re-enable the level-triggered GPE once >> + * they have been dispatched so it can't storm while the dGPU resumes. >> + */ >> + if (ACPI_FAILURE(acpi_os_execute(OSL_NOTIFY_HANDLER, cpm_l05_rearm, >> + NULL))) >> + cpm_l05_rearm(NULL); >> +} >> + >> +static u32 cpm_l05_gpe_handler(acpi_handle gpe_device, u32 gpe_number, >> + void *context) >> +{ >> + /* >> + * Interrupt context, AML can't run here. Don't return >> + * ACPI_REENABLE_GPE: the GPE stays disabled until cpm_l05_rearm(). >> + */ >> + if (ACPI_FAILURE(acpi_os_execute(OSL_GPE_HANDLER, cpm_l05_work, NULL))) >> + pr_err("unable to queue GPE %02X handler\n", gpe_number); >> + >> + return ACPI_INTERRUPT_HANDLED; >> +} >> + >> +static int __init cpm_d3cold_l05_init(void) >> +{ >> + struct acpi_table_header *ssdt; >> + acpi_status status; >> + >> + if (!dmi_check_system(cpm_l05_dmi_table)) >> + return 0; >> + >> + /* ACPICA keeps using the table, so it must never be freed */ >> + ssdt = kmemdup(cpm_l05_ssdt, sizeof(cpm_l05_ssdt), GFP_KERNEL); >> + if (!ssdt) >> + return -ENOMEM; >> + >> + status = acpi_load_table(ssdt, NULL); >> + if (ACPI_FAILURE(status)) { >> + pr_err("unable to load fixup table: %s\n", >> + acpi_format_exception(status)); >> + kfree(ssdt); >> + return -ENODEV; >> + } >> + >> + status = acpi_get_handle(NULL, CPM_FIX_PATH, &cpm_fix_handle); >> + if (ACPI_FAILURE(status)) >> + return -ENODEV; >> + >> + status = acpi_install_gpe_handler(NULL, CPM_D3COLD_GPE, >> + ACPI_GPE_LEVEL_TRIGGERED, >> + cpm_l05_gpe_handler, NULL); >> + if (ACPI_FAILURE(status)) { >> + pr_err("unable to install GPE %02X handler: %s\n", >> + CPM_D3COLD_GPE, acpi_format_exception(status)); >> + return -ENODEV; >> + } >> + >> + /* Installing the handler dropped the reference taken for _L05 */ >> + status = acpi_enable_gpe(NULL, CPM_D3COLD_GPE); >> + if (ACPI_FAILURE(status)) >> + pr_err("unable to enable GPE %02X: %s\n", CPM_D3COLD_GPE, >> + acpi_format_exception(status)); >> + >> + pr_info("%s notifies missing %s, using %s instead\n", CPM_L05_PATH, >> + CPM_MISSING_PATH, CPM_DGPU_PATH); >> + return 0; >> +} >> +subsys_initcall_sync(cpm_d3cold_l05_init); >> >> --- >> base-commit: aebb7274476403040d582c61478df8f4a7bf9cd3 >> change-id: 20261122-fdo-gitlab-6061-d6cbed847dbc >> >> Best regards, >> -- >> Mario Limonciello >> >>