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.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,INVALID_MSGID,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham 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 AE206C4363D for ; Fri, 2 Oct 2020 20:17:57 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 6AD4E206FA for ; Fri, 2 Oct 2020 20:17:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6AD4E206FA Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=amd-gfx-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id EF0DB6E9C9; Fri, 2 Oct 2020 20:17:56 +0000 (UTC) Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by gabe.freedesktop.org (Postfix) with ESMTPS id C502E6E9C8 for ; Fri, 2 Oct 2020 19:56:31 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 6866EAC7D; Fri, 2 Oct 2020 19:56:30 +0000 (UTC) References: User-agent: mu4e 1.4.13; emacs 27.1 From: Michal Rostecki To: Lukas Wunner Subject: Re: [PATCH] PCI/ACPI: Whitelist hotplug ports for D3 if power managed by ACPI In-reply-to: Date: Fri, 02 Oct 2020 21:56:28 +0200 Message-ID: <86r1qgcsgj.fsf@> MIME-Version: 1.0 X-Mailman-Approved-At: Fri, 02 Oct 2020 20:17:56 +0000 X-BeenThere: amd-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion list for AMD gfx List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: matoro , Michal Rostecki , linux-pci@vger.kernel.org, "Rafael J. Wysocki" , Arthur Borsboom , linux-acpi@vger.kernel.org, Shai Coleman , Bjorn Helgaas , amd-gfx@lists.freedesktop.org, Aaron Zakhrov , Alex Deucher , Mika Westerberg , Len Brown Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: amd-gfx-bounces@lists.freedesktop.org Sender: "amd-gfx" Lukas Wunner writes: > 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 an > 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 > Cc: stable@vger.kernel.org > Cc: Alex Deucher > Cc: Rafael J. Wysocki > Cc: Mika Westerberg Thanks! It fixes the issue for me. Reported-and-tested-by: Michal Rostecki > --- > drivers/pci/pci-acpi.c | 10 ++++++++++ > 1 file changed, 10 insertions(+) > > diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c > index d5869a0..d9aa551 100644 > --- a/drivers/pci/pci-acpi.c > +++ b/drivers/pci/pci-acpi.c > @@ -944,6 +944,16 @@ static bool acpi_pci_bridge_d3(struct pci_dev *dev) > 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. _______________________________________________ amd-gfx mailing list amd-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/amd-gfx