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 X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 20616C2D0A3 for ; Tue, 3 Nov 2020 21:54:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C0765223AB for ; Tue, 3 Nov 2020 21:54:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604440441; bh=OF1UzrEkpvQY/H024MBR+tM08Hv99WeM2oKPJDlgaAM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=HwF8IklcykeEELkn5iof14GsciVTcfBRGU3uvSyH7WyoMUH4Z+xgF64ifaLNfirVP IO9zyDTd/51twrXJ01BMfiCQOpEruIWwRYJPsErIH282nCd433ssgPZ8XncBjUkI7w FbfsdO7QCwb8TW4mRfzaFK1bkWeMttg/OhZPb3/o= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731083AbgKCUps (ORCPT ); Tue, 3 Nov 2020 15:45:48 -0500 Received: from mail.kernel.org ([198.145.29.99]:34386 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730546AbgKCUpr (ORCPT ); Tue, 3 Nov 2020 15:45:47 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A92D922404; Tue, 3 Nov 2020 20:45:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604436346; bh=OF1UzrEkpvQY/H024MBR+tM08Hv99WeM2oKPJDlgaAM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ci/+F+ztzjsTT6Eph4nJx/6juErmCzSabiPaEUDMCCtKN5gait7JcUZApvW7653pm 0cr780Odi2p5YKhWSKuwk9GV+Kgsnxy3UcKLlOLUjeTfNtLeANVpxUJxiRCBxz1rUh Ko2V3baBJfPiALVtRZhWJAcs3D71lr+dQNgL3HCA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Aaron Zakhrov , Michal Rostecki , Shai Coleman , Lukas Wunner , Alex Deucher , "Rafael J. Wysocki" , Arthur Borsboom , matoro Subject: [PATCH 5.9 209/391] PCI/ACPI: Whitelist hotplug ports for D3 if power managed by ACPI Date: Tue, 3 Nov 2020 21:34:20 +0100 Message-Id: <20201103203401.009760569@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201103203348.153465465@linuxfoundation.org> References: <20201103203348.153465465@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Lukas Wunner commit c6e331312ebfb52b7186e5d82d517d68b4d2f2d8 upstream. Recent laptops with dual AMD GPUs fail to suspend the discrete GPU, thus causing lockups on system sleep and high power consumption at runtime. The discrete GPU would normally be suspended to D3cold by turning off ACPI _PR3 Power Resources of the Root Port above the GPU. However on affected systems, the Root Port is hotplug-capable and pci_bridge_d3_possible() only allows hotplug ports to go to D3 if they belong to a Thunderbolt device or if the Root Port possesses a "HotPlugSupportInD3" ACPI property. Neither is the case on affected laptops. The reason for whitelisting only specific, known to work hotplug ports for D3 is that there have been reports of SkyLake Xeon-SP systems raising Hardware Error NMIs upon suspending their hotplug ports: https://lore.kernel.org/linux-pci/20170503180426.GA4058@otc-nc-03/ But if a hotplug port is power manageable by ACPI (as can be detected through presence of Power Resources and corresponding _PS0 and _PS3 methods) then it ought to be safe to suspend it to D3. To this end, amend acpi_pci_bridge_d3() to whitelist such ports for D3. Link: https://gitlab.freedesktop.org/drm/amd/-/issues/1222 Link: https://gitlab.freedesktop.org/drm/amd/-/issues/1252 Link: https://gitlab.freedesktop.org/drm/amd/-/issues/1304 Reported-and-tested-by: Arthur Borsboom Reported-and-tested-by: matoro Reported-by: Aaron Zakhrov Reported-by: Michal Rostecki Reported-by: Shai Coleman Signed-off-by: Lukas Wunner Acked-by: Alex Deucher Cc: 5.4+ # 5.4+ Signed-off-by: Rafael J. Wysocki Signed-off-by: Greg Kroah-Hartman --- drivers/pci/pci-acpi.c | 10 ++++++++++ 1 file changed, 10 insertions(+) --- a/drivers/pci/pci-acpi.c +++ b/drivers/pci/pci-acpi.c @@ -944,6 +944,16 @@ static bool acpi_pci_bridge_d3(struct pc if (!dev->is_hotplug_bridge) return false; + /* Assume D3 support if the bridge is power-manageable by ACPI. */ + adev = ACPI_COMPANION(&dev->dev); + if (!adev && !pci_dev_is_added(dev)) { + adev = acpi_pci_find_companion(&dev->dev); + ACPI_COMPANION_SET(&dev->dev, adev); + } + + if (adev && acpi_device_power_manageable(adev)) + return true; + /* * Look for a special _DSD property for the root port and if it * is set we know the hierarchy behind it supports D3 just fine.