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=-10.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 0CF70C47423 for ; Fri, 2 Oct 2020 14:17:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C1FCC206A5 for ; Fri, 2 Oct 2020 14:17:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601648250; bh=APqjhJhNnz0Jxh7h9KkEbQ3UE9Zyvg96SRRk4ckhTrQ=; h=References:In-Reply-To:From:Date:Subject:To:Cc:List-ID:From; b=t60ELdejKDY93oN3O8t59nv2LKmTRFAa9j3/1VxuQ0S9P8U2n00Yo9r3ja+TribmP 2PVdyL8NERieQJfHMGIeEqJ2XPNjOi4nfP8PCuWD+NpBij8BVibtcMq7nTH0cQ6xw/ VgRlvmcpkflBQxLnshDFqabRuTRhWDpWqm7N9rXM= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388047AbgJBOR3 (ORCPT ); Fri, 2 Oct 2020 10:17:29 -0400 Received: from mail-ot1-f65.google.com ([209.85.210.65]:36383 "EHLO mail-ot1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387688AbgJBOR2 (ORCPT ); Fri, 2 Oct 2020 10:17:28 -0400 Received: by mail-ot1-f65.google.com with SMTP id 60so1491651otw.3; Fri, 02 Oct 2020 07:17:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=2xfW2r+5F5TUfquNrBpvFl+fZupXfBEeJ3aS3h1+V9U=; b=KxHyd+Cpn8my+XDksA+kge3Q4E/DA6mseVh9Qss5SyWMacbSiOWAc4M1Wfso8jqcgo ZLBVFvRLMpyZeIMb1IKQp747uRCeBt0PrZ3X1yka49t+47NCPwEwDLEVbmr1zioNEnVN uaYpg2PAselQOd2ur9rvcyXQjYfPADlU4rPgHx3i/KY6NLJU6anrS1gC9tw0GxK20YQg Xf5tdyFpkLuEDJMl+DRbFQEo0YgBeWcASDh8IBQJWBk0Et3HieUHJdemjMlAzD8u73cv bj161AlKWBDMVc29W0GjOa83xx9lUuB1H4SedgO4IsbhjKEyE/pqtNaISlQ05qSOmYCd 1t1w== X-Gm-Message-State: AOAM533wzup4ZIpMdGHNtd69vnPpBKx9D4k2EcZwTVeJQMBmNbYIfkWa 1+KqYdA78kbGAVv2DVRsn1kgH2hJ4LK35T1+ttM= X-Google-Smtp-Source: ABdhPJzXm554JtWA/ocFLcb2CIIiiUOnto9zamZpCzFCyUU6KYxt5wXGwLT9IKo1P4fJiendlJDRKnxDcdkSXViCSjg= X-Received: by 2002:a9d:718a:: with SMTP id o10mr1888736otj.262.1601648247890; Fri, 02 Oct 2020 07:17:27 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: "Rafael J. Wysocki" Date: Fri, 2 Oct 2020 16:17:15 +0200 Message-ID: Subject: Re: [PATCH] PCI/ACPI: Whitelist hotplug ports for D3 if power managed by ACPI To: Lukas Wunner Cc: Bjorn Helgaas , "Rafael J. Wysocki" , Len Brown , Alex Deucher , Mika Westerberg , Linux PCI , ACPI Devel Maling List , amd-gfx list , Arthur Borsboom , matoro , Aaron Zakhrov , Michal Rostecki , Shai Coleman Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org On Fri, Oct 2, 2020 at 7:17 AM Lukas Wunner wrote: > > 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 > Cc: stable@vger.kernel.org > Cc: Alex Deucher > Cc: Rafael J. Wysocki > Cc: Mika Westerberg > --- > 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. > -- I'm going to apply this patch for 5.10 unless Bjorn would rather route it through the PCI tree. Thanks! 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=-10.0 required=3.0 tests=BAYES_00,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 58469C4363D for ; Fri, 2 Oct 2020 14:17:32 +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 122C2206A5 for ; Fri, 2 Oct 2020 14:17:30 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 122C2206A5 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org 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 7A6276E95A; Fri, 2 Oct 2020 14:17:30 +0000 (UTC) Received: from mail-ot1-f66.google.com (mail-ot1-f66.google.com [209.85.210.66]) by gabe.freedesktop.org (Postfix) with ESMTPS id CA4406E95A for ; Fri, 2 Oct 2020 14:17:28 +0000 (UTC) Received: by mail-ot1-f66.google.com with SMTP id m13so1467534otl.9 for ; Fri, 02 Oct 2020 07:17:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=2xfW2r+5F5TUfquNrBpvFl+fZupXfBEeJ3aS3h1+V9U=; b=bgWrPmukmZEyBIcCufqa3fSIdWgxbHksCKBqHZfc6pG2QHAZ8Tm3K8zfLZrRudmv3d BqMEeaVA0DHkU+nhRU+Y116tLDonJ6JipySYU8PU7dSVnP+50g2iFw5liiyk5erHVhen 24pYpRW8rZEPI+dE7b4asFRb1pWSr/omoMczUaaSv5ykUuhzBgsGm8nEY61YTg0g6te/ pjZWuoGarq82JJ3ei8R0AFKsXCoJHo4sqsiPpwvnSEceldMmJrBQSuA10xaHMo8fP2dm tu9M64fYClGFfq62R2DL53ilMFsf9lG5bTIrRyNCJrPgTo0r5nlpdfT+LE5Lj1ItFpdP MkvQ== X-Gm-Message-State: AOAM533Fsajqz0+CLfuK8clkykM8y+SMhAkuD3l1/D+SByaQLxdLWahe 5Auz5tHXeFSyoyOv8TVtM0kFjzvN/ChM22peUDo= X-Google-Smtp-Source: ABdhPJzXm554JtWA/ocFLcb2CIIiiUOnto9zamZpCzFCyUU6KYxt5wXGwLT9IKo1P4fJiendlJDRKnxDcdkSXViCSjg= X-Received: by 2002:a9d:718a:: with SMTP id o10mr1888736otj.262.1601648247890; Fri, 02 Oct 2020 07:17:27 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: "Rafael J. Wysocki" Date: Fri, 2 Oct 2020 16:17:15 +0200 Message-ID: Subject: Re: [PATCH] PCI/ACPI: Whitelist hotplug ports for D3 if power managed by ACPI To: Lukas Wunner 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: Aaron Zakhrov , Michal Rostecki , Linux PCI , "Rafael J. Wysocki" , amd-gfx list , ACPI Devel Maling List , Shai Coleman , Bjorn Helgaas , Arthur Borsboom , matoro , 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" On Fri, Oct 2, 2020 at 7:17 AM Lukas Wunner wrote: > > 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 > Cc: stable@vger.kernel.org > Cc: Alex Deucher > Cc: Rafael J. Wysocki > Cc: Mika Westerberg > --- > 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. > -- I'm going to apply this patch for 5.10 unless Bjorn would rather route it through the PCI tree. Thanks! _______________________________________________ amd-gfx mailing list amd-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/amd-gfx