From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2D538C5DF7D for ; Fri, 21 Aug 2026 20:06:23 +0000 (UTC) Received: from kara.freedesktop.org (unknown [131.252.210.166]) by gabe.freedesktop.org (Postfix) with ESMTPS id E4C9410F405; Fri, 21 Aug 2026 20:06:22 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.b="cgRUnIG9"; dkim-atps=neutral Received: from kara.freedesktop.org (localhost [127.0.0.1]) by kara.freedesktop.org (Postfix) with ESMTP id C5DCA47ABF; Fri, 21 Aug 2026 19:49:44 +0000 (UTC) ARC-Seal: i=1; cv=none; a=rsa-sha256; d=lists.freedesktop.org; s=20240201; t=1787341784; b=KOW1s499BGF/EtATioHLgc3jey4usAXREBprjq0H8bc3TiYoGuTR5X5NnNMHpA3eEOb09 UN7wJJP6bxmJGbhfK48JCI45TW4CmWKrkJjls75dKr8CgDKgOcPNI6QWtPhZyG7rja6fM+M 99iNtGGVTa/BgZQG758uz1WHm5oAtNxhjBB6Fit+B5sXaD0/Q9/kQMaTutL6eLEWSb8GqJf EewqrbwNlwNhnoTDxKeNxrFN4rzy/rhywdzK8rXVcK2bqCoHNMxPPeQDwUIEi1of7HH+vCW 8yb0WdxI6Bf+C8ZGABM+MjEZrPjBasbQ654Nn+uGQ0FPrfbA71hI4BhjjEhg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=lists.freedesktop.org; s=20240201; t=1787341784; h=from : sender : reply-to : subject : date : message-id : to : cc : mime-version : content-type : content-transfer-encoding : content-id : content-description : resent-date : resent-from : resent-sender : resent-to : resent-cc : resent-message-id : in-reply-to : references : list-id : list-help : list-unsubscribe : list-subscribe : list-post : list-owner : list-archive; bh=4Edr5cAtYcXCdnLa7oLzVihOqQYUUfcaDCBdJd9wwpE=; b=I9FDAyr/i4+6ivryjSxSTM94Mj4YwJ5TDB/xIkaPZhRv3l8nVQWSxqp9RVIP+bP/Wa6ry UgWzSbgAx3Pb491zdAhfl1NG3snpFxUHG4+aE5ujFTCcfJA4vLB8IPkOOpEZC8HWRhZCSA4 NquOBQDhGFU5p00Sw5gpke+/3vx4ILCX7aORJn54EBX/vDr8fx4cpoPXqMzeJzGpYKA8y1R PgvItwiiuvDHA+PjJQ6NfRDakq+UZpTGZV62p7/zMi0LA3+T9mBXOSN7qOWbF3MWRBtnF2B P5deiIAkliPZBpCrSM1BqEHTHeSdo3SzRLtJYqCUPIZ2PGEw0Ut1MACXA7YA== ARC-Authentication-Results: i=1; mail.freedesktop.org; dkim=pass header.d=redhat.com; arc=none (Message is not ARC signed); dmarc=pass (Used From Domain Record) header.from=redhat.com policy.dmarc=quarantine Authentication-Results: mail.freedesktop.org; dkim=pass header.d=redhat.com; arc=none (Message is not ARC signed); dmarc=pass (Used From Domain Record) header.from=redhat.com policy.dmarc=quarantine Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by kara.freedesktop.org (Postfix) with ESMTPS id E347847AB5 for ; Fri, 21 Aug 2026 19:49:41 +0000 (UTC) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8F42D10E33F for ; Fri, 21 Aug 2026 20:06:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1787342778; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=4Edr5cAtYcXCdnLa7oLzVihOqQYUUfcaDCBdJd9wwpE=; b=cgRUnIG9X3NwjtVVsY8d0UQugijrTO5auhF+DLH27xGWNJLcMQbi7AqJBR24g/GMHL/+hD MT/X0MGzkdkMKM8yzur3OU9qn1Itca/I6oKFysYl4ENz2NcBa9ANhaTp/zOYQLhez9fIxI qe2oIWOHhTJ6yw8rfGkhI0S2tsdH31g= Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-180-A8Al9uYjPEyH8ezlI4yzgQ-1; Fri, 21 Aug 2026 16:06:15 -0400 X-MC-Unique: A8Al9uYjPEyH8ezlI4yzgQ-1 X-Mimecast-MFC-AGG-ID: A8Al9uYjPEyH8ezlI4yzgQ_1787342773 Received: from mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.95]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 28AEB1956073; Fri, 21 Aug 2026 20:06:13 +0000 (UTC) Received: from GoldenWind.redhat.com (unknown [10.22.80.7]) by mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 702DA426; Fri, 21 Aug 2026 20:06:11 +0000 (UTC) From: Lyude Paul To: dri-devel@lists.freedesktop.org, nouveau@lists.freedesktop.org, linux-kernel@vger.kernel.org, Bjorn Helgaas , linux-pci@vger.kernel.org Subject: [PATCH v2] pci: Add broken-GPE quirk for Lenovo Legion 16APH8 and 16AHP9 Nvidia GPUs Date: Fri, 21 Aug 2026 16:04:51 -0400 Message-ID: <20260821200607.621341-1-lyude@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.6 on 10.30.177.95 X-Mimecast-MFC-PROC-ID: L_92XAawu96sw5YYKQlaTT7zUeBdusrv5ECIOFAcN6g_1787342773 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit content-type: text/plain; charset="US-ASCII"; x-default=true Message-ID-Hash: XCWWKWH7RNVCKDQ6DXONMAL5JNGXIH2U X-Message-ID-Hash: XCWWKWH7RNVCKDQ6DXONMAL5JNGXIH2U X-MailFrom: lyude@redhat.com X-Mailman-Rule-Hits: member-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address CC: Mark Pearson , Ryan Brue , stable@vger.kernel.org X-Mailman-Version: 3.3.8 Precedence: list List-Id: Nouveau development list Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On the Lenovo Legion Slim 5 16APH8 and 16AHP9, the firmware appears to enjoy firing a GPE on the parent PCIe port of the nvidia GPU very shortly after the GPU enters D3Cold. This means that every time the GPU is runtime suspended, ACPI firmware immediately wakes up its parent PCIe port, which then wakes up the GPU. Once it falls asleep again, the cycle repeats. See: https://github.com/NVIDIA/open-gpu-kernel-modules/issues/905 Note, this bug doesn't require Nvidia's driver. It happens on nouveau and nova as well, and it even seems possible for this to happen without any driver loaded. This seems to simply be a bug. Luckily, there is nothing that we actually need ACPI wakeup events for on the GPU. Events such as display connector hotplug events in D3Cold come through as ACPI_VIDEO events which aren't affected by this quirk. Reported-by: Ryan Brue Co-authored-by: Ryan Brue Signed-off-by: Lyude Paul Cc: stable@vger.kernel.org Fixes: https://github.com/NVIDIA/open-gpu-kernel-modules/issues/905 --- V2: * Don't forget to actually use parent_adev with acpi_remove_pm_notifier() * Check if parent_adev is NULL (could happen if booted with acpi=off), just consider it a no-op if it is. * Base the patch off Linux master instead, I based it off drm-misc-next by mistake because I'm too used to working on DRM drivers :). drivers/pci/quirks.c | 79 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index b09f27f7846fc..b6d8ba5e4c2a6 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c @@ -6165,6 +6165,85 @@ DECLARE_PCI_FIXUP_CLASS_FINAL(PCI_VENDOR_ID_NVIDIA, 0x13b1, PCI_CLASS_DISPLAY_VGA, 8, quirk_reset_lenovo_thinkpad_p50_nvgpu); +#ifdef CONFIG_ACPI +#ifdef CONFIG_DMI +static const struct dmi_system_id nvidia_dgpu_broken_gpe_quirk_table[] = { + { + .matches = { + DMI_EXACT_MATCH(DMI_SYS_VENDOR, "LENOVO"), + DMI_MATCH(DMI_PRODUCT_VERSION, "16APH8"), + }, + }, + { + .matches = { + DMI_EXACT_MATCH(DMI_SYS_VENDOR, "LENOVO"), + DMI_MATCH(DMI_PRODUCT_VERSION, "16AHP9"), + }, + }, + {} +}; + +/* + * On the Lenovo Legion Slim 5 16APH8 and 16AHP9, the firmware appears to enjoy + * firing a GPE on the parent PCIe port of the nvidia GPU very shortly after the + * GPU enters D3Cold. This means that every time the GPU is runtime suspended, + * ACPI firmware immediately wakes up its parent PCIe port, which then wakes up + * the GPU. Once it falls asleep again, the cycle repeats. + * + * See: https://github.com/NVIDIA/open-gpu-kernel-modules/issues/905 + * + * Note, this bug doesn't require Nvidia's driver. It happens on nouveau and + * nova as well, and it even seems possible for this to happen without any + * driver loaded. + * + * This seems to simply be a bug. Luckily, there is nothing that we actually + * need ACPI wakeup events for on the GPU. Events such as display connector + * hotplug events in D3Cold come through as ACPI_VIDEO events which aren't + * affected by this quirk. + * + * So, workaround this by disabling wakeup events for the parent PCIe port of + * the GPU. + */ +static void quirk_nvidia_dgpu_broken_gpe(struct pci_dev *pdev) +{ + struct acpi_device *parent_adev; + struct device *parent_dev; + int ret; + + /* Just to be extra safe and make sure we don't try this on an eGPU */ + if (pci_is_thunderbolt_attached(pdev)) + return; + + ret = dmi_check_system(nvidia_dgpu_broken_gpe_quirk_table); + if (ret == 0) + return; + + pci_info(pdev, FW_BUG "GPU PCIe port has broken wakeup events, disabling\n"); + + parent_dev = pci_physfn(pdev)->dev.parent; + if (!parent_dev) { + pci_err(pdev, + "Can't find PCIe parent? Your Nvidia GPU will have broken runtime PM\n"); + return; + } + + parent_adev = ACPI_COMPANION(parent_dev); + if (!parent_adev) /* No ACPI? That means no GPE, and nothing to do here. */ + return; + + /* The spurious GPEs will be sent from the ACPI device for the PCIe port this GPU is + * connected to, so remove our PM notifier to turn them into a no-op. + */ + ret = acpi_remove_pm_notifier(parent_adev); + if (ACPI_FAILURE(ret)) + pci_err(pdev, "Removing PM notifier failed: %d\n", ret); +} +DECLARE_PCI_FIXUP_CLASS_FINAL(PCI_VENDOR_ID_NVIDIA, 0x28e0, + PCI_CLASS_DISPLAY_VGA, 8, + quirk_nvidia_dgpu_broken_gpe); +#endif +#endif + /* * Device [1b21:2142] * When in D0, PME# doesn't get asserted when plugging USB 3.0 device. base-commit: 2be02a7c996aa733bb36e29e07715621b0de9736 -- 2.55.0 From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (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 B15C9340DB0 for ; Fri, 21 Aug 2026 20:06:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787342782; cv=none; b=lv9H0V09fjvKKZJZtWnJrPOSOOBd38EJz69Nstl06kJ0mHz1SbfbDrFeQDkYC+WGnZAEyMl2KUWjbauLj9gAJYW3J/hMI21hHI0jiyAW4uuXBYZF7ont2vxTNl5KLcIryDzHmnwgt8AELRSieNJ1al+zreAn1WBHQfAoytPfviI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787342782; c=relaxed/simple; bh=Deysu6za0mBKUURfnCfq0+2INVdFgYbsn4st/YxRJwk=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=JNa/ovX2qzkKj0mXijen1dDFnosmdqTtRdGftXCh+I91X1V3QzXLosJMAilfsDrZRZhmdp8Rt1/k1p17Epzj/eLeIwpXCuu3rG5jMxuID8u5h9MVVWqrHBf4sc5pLjNEwg0JWc2hhxDvIwuXGxRzMWUIqdm8zOL2TmuGApUCiIc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=b9appkcU; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="b9appkcU" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1787342778; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=4Edr5cAtYcXCdnLa7oLzVihOqQYUUfcaDCBdJd9wwpE=; b=b9appkcUDk2ioREWa4hF+ITQRe/fOkeB5XG0F2zM/H3sntpAjKLMXbyT4Ozje8XksKaIbK BMfphfVuysd38vSo7lwpw416b3EZ9bLBLIWivLnvkJ3uFjE7O2P+OPbkRr9gM2gYaGW4SX eILs35vh1nIYZp/6j75XLYiFW+zrMMQ= Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-180-A8Al9uYjPEyH8ezlI4yzgQ-1; Fri, 21 Aug 2026 16:06:15 -0400 X-MC-Unique: A8Al9uYjPEyH8ezlI4yzgQ-1 X-Mimecast-MFC-AGG-ID: A8Al9uYjPEyH8ezlI4yzgQ_1787342773 Received: from mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.95]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 28AEB1956073; Fri, 21 Aug 2026 20:06:13 +0000 (UTC) Received: from GoldenWind.redhat.com (unknown [10.22.80.7]) by mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 702DA426; Fri, 21 Aug 2026 20:06:11 +0000 (UTC) From: Lyude Paul To: dri-devel@lists.freedesktop.org, nouveau@lists.freedesktop.org, linux-kernel@vger.kernel.org, Bjorn Helgaas , linux-pci@vger.kernel.org Cc: Mark Pearson , Timur Tabi , John Hubbard , Ryan Brue , stable@vger.kernel.org, "Lyude Paul" Subject: [PATCH v2] pci: Add broken-GPE quirk for Lenovo Legion 16APH8 and 16AHP9 Nvidia GPUs Date: Fri, 21 Aug 2026 16:04:51 -0400 Message-ID: <20260821200607.621341-1-lyude@redhat.com> Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.6 on 10.30.177.95 On the Lenovo Legion Slim 5 16APH8 and 16AHP9, the firmware appears to enjoy firing a GPE on the parent PCIe port of the nvidia GPU very shortly after the GPU enters D3Cold. This means that every time the GPU is runtime suspended, ACPI firmware immediately wakes up its parent PCIe port, which then wakes up the GPU. Once it falls asleep again, the cycle repeats. See: https://github.com/NVIDIA/open-gpu-kernel-modules/issues/905 Note, this bug doesn't require Nvidia's driver. It happens on nouveau and nova as well, and it even seems possible for this to happen without any driver loaded. This seems to simply be a bug. Luckily, there is nothing that we actually need ACPI wakeup events for on the GPU. Events such as display connector hotplug events in D3Cold come through as ACPI_VIDEO events which aren't affected by this quirk. Reported-by: Ryan Brue Co-authored-by: Ryan Brue Signed-off-by: Lyude Paul Cc: stable@vger.kernel.org Fixes: https://github.com/NVIDIA/open-gpu-kernel-modules/issues/905 --- V2: * Don't forget to actually use parent_adev with acpi_remove_pm_notifier() * Check if parent_adev is NULL (could happen if booted with acpi=off), just consider it a no-op if it is. * Base the patch off Linux master instead, I based it off drm-misc-next by mistake because I'm too used to working on DRM drivers :). drivers/pci/quirks.c | 79 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index b09f27f7846fc..b6d8ba5e4c2a6 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c @@ -6165,6 +6165,85 @@ DECLARE_PCI_FIXUP_CLASS_FINAL(PCI_VENDOR_ID_NVIDIA, 0x13b1, PCI_CLASS_DISPLAY_VGA, 8, quirk_reset_lenovo_thinkpad_p50_nvgpu); +#ifdef CONFIG_ACPI +#ifdef CONFIG_DMI +static const struct dmi_system_id nvidia_dgpu_broken_gpe_quirk_table[] = { + { + .matches = { + DMI_EXACT_MATCH(DMI_SYS_VENDOR, "LENOVO"), + DMI_MATCH(DMI_PRODUCT_VERSION, "16APH8"), + }, + }, + { + .matches = { + DMI_EXACT_MATCH(DMI_SYS_VENDOR, "LENOVO"), + DMI_MATCH(DMI_PRODUCT_VERSION, "16AHP9"), + }, + }, + {} +}; + +/* + * On the Lenovo Legion Slim 5 16APH8 and 16AHP9, the firmware appears to enjoy + * firing a GPE on the parent PCIe port of the nvidia GPU very shortly after the + * GPU enters D3Cold. This means that every time the GPU is runtime suspended, + * ACPI firmware immediately wakes up its parent PCIe port, which then wakes up + * the GPU. Once it falls asleep again, the cycle repeats. + * + * See: https://github.com/NVIDIA/open-gpu-kernel-modules/issues/905 + * + * Note, this bug doesn't require Nvidia's driver. It happens on nouveau and + * nova as well, and it even seems possible for this to happen without any + * driver loaded. + * + * This seems to simply be a bug. Luckily, there is nothing that we actually + * need ACPI wakeup events for on the GPU. Events such as display connector + * hotplug events in D3Cold come through as ACPI_VIDEO events which aren't + * affected by this quirk. + * + * So, workaround this by disabling wakeup events for the parent PCIe port of + * the GPU. + */ +static void quirk_nvidia_dgpu_broken_gpe(struct pci_dev *pdev) +{ + struct acpi_device *parent_adev; + struct device *parent_dev; + int ret; + + /* Just to be extra safe and make sure we don't try this on an eGPU */ + if (pci_is_thunderbolt_attached(pdev)) + return; + + ret = dmi_check_system(nvidia_dgpu_broken_gpe_quirk_table); + if (ret == 0) + return; + + pci_info(pdev, FW_BUG "GPU PCIe port has broken wakeup events, disabling\n"); + + parent_dev = pci_physfn(pdev)->dev.parent; + if (!parent_dev) { + pci_err(pdev, + "Can't find PCIe parent? Your Nvidia GPU will have broken runtime PM\n"); + return; + } + + parent_adev = ACPI_COMPANION(parent_dev); + if (!parent_adev) /* No ACPI? That means no GPE, and nothing to do here. */ + return; + + /* The spurious GPEs will be sent from the ACPI device for the PCIe port this GPU is + * connected to, so remove our PM notifier to turn them into a no-op. + */ + ret = acpi_remove_pm_notifier(parent_adev); + if (ACPI_FAILURE(ret)) + pci_err(pdev, "Removing PM notifier failed: %d\n", ret); +} +DECLARE_PCI_FIXUP_CLASS_FINAL(PCI_VENDOR_ID_NVIDIA, 0x28e0, + PCI_CLASS_DISPLAY_VGA, 8, + quirk_nvidia_dgpu_broken_gpe); +#endif +#endif + /* * Device [1b21:2142] * When in D0, PME# doesn't get asserted when plugging USB 3.0 device. base-commit: 2be02a7c996aa733bb36e29e07715621b0de9736 -- 2.55.0