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=-11.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 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 5753DC2D0E2 for ; Tue, 22 Sep 2020 06:54:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0922623A1D for ; Tue, 22 Sep 2020 06:54:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729547AbgIVGyk (ORCPT ); Tue, 22 Sep 2020 02:54:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51956 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727710AbgIVGyk (ORCPT ); Tue, 22 Sep 2020 02:54:40 -0400 Received: from bmailout3.hostsharing.net (bmailout3.hostsharing.net [IPv6:2a01:4f8:150:2161:1:b009:f23e:0]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D6628C061755 for ; Mon, 21 Sep 2020 23:54:39 -0700 (PDT) Received: from h08.hostsharing.net (h08.hostsharing.net [83.223.95.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "*.hostsharing.net", Issuer "COMODO RSA Domain Validation Secure Server CA" (not verified)) by bmailout3.hostsharing.net (Postfix) with ESMTPS id 3A84E100AFF3D; Tue, 22 Sep 2020 08:54:35 +0200 (CEST) Received: by h08.hostsharing.net (Postfix, from userid 100393) id EA240105C6C; Tue, 22 Sep 2020 08:54:34 +0200 (CEST) Date: Tue, 22 Sep 2020 08:54:34 +0200 From: Lukas Wunner To: Alex Deucher Cc: Linux PCI , Bjorn Helgaas , "Rafael J. Wysocki" , Mika Westerberg Subject: Re: Enabling d3 support on hotplug bridges Message-ID: <20200922065434.GA19668@wunner.de> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org [cc += Mika] On Mon, Sep 21, 2020 at 07:10:55PM -0400, Alex Deucher wrote: > Recent AMD laptops which have iGPU + dGPU have been non-functional on > Linux. The issue is that the laptops rely on ACPI to control the dGPU > power and that is not happening because the bridges are hotplug > capable, and the current pci code does not allow runtime pm on hotplug > capable bridges. This worked on previous laptops presumably because > the bridges did not support hotplug or they hit one of the allowed > cases. The driver enables runtime power management, but since the > dGPU does not actually get powered down via the platform ACPI > controls, no power is saved, and things fall apart on resume leading > to an unusable GPU or a system hang. To work around this users can > currently disable runtime pm in the GPU driver or specify > pcie_port_pm=force to force d3 on bridges. I'm not sure what the best > solution for this is. I'd rather not have to add device IDs to a > whitelist every time we release a new platform. Suggestions? What > about something like the attached patch work? What is Windows doing on these machines? Microsoft came up with an ACPI _DSD property to tell OSPM that it's safe to suspend a hotplug port to D3: https://docs.microsoft.com/en-us/windows-hardware/drivers/pci/dsd-for-pcie-root-ports#identifying-pcie-root-ports-supporting-hot-plug-in-d3 We support that since 26ad34d510a8 ("PCI / ACPI: Whitelist D3 for more PCIe hotplug ports"). I've skimmed the three gitlab bugs you mention below and none of them seems to contain an ACPI dump. First thing to do is request that from the users and check if the HotPlugSupportInD3 property is present. And if it's not, we need to find out why it's working on Windows. Thanks, Lukas > From 3a08cb6ac38c47b921b8b6f31b03fcd8f13c4018 Mon Sep 17 00:00:00 2001 > From: Alex Deucher > Date: Mon, 21 Sep 2020 18:07:27 -0400 > Subject: [PATCH] pci: allow d3 on hotplug bridges after 2018 > > Newer AMD laptops have hotplug capabe bridges with dGPUs behind them. > If d3 is disabled on the bridge, the dGPU is never powered down even > though the dGPU driver may think it is because power is handled by > the pci core. Things fall apart when the driver attempts to resume > a dGPU that was not properly powered down which leads to hangs. > > Bug: https://gitlab.freedesktop.org/drm/amd/-/issues/1252 > Bug: https://gitlab.freedesktop.org/drm/amd/-/issues/1222 > Bug: https://gitlab.freedesktop.org/drm/amd/-/issues/1304 > Signed-off-by: Alex Deucher > --- > drivers/pci/pci.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c > index a458c46d7e39..12927d5df4b9 100644 > --- a/drivers/pci/pci.c > +++ b/drivers/pci/pci.c > @@ -2856,7 +2856,7 @@ bool pci_bridge_d3_possible(struct pci_dev *bridge) > * by vendors for runtime D3 at least until 2018 because there > * was no OS support. > */ > - if (bridge->is_hotplug_bridge) > + if (bridge->is_hotplug_bridge && (dmi_get_bios_year() <= 2018)) > return false; > > if (dmi_check_system(bridge_d3_blacklist)) > -- > 2.25.4 >