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 88282C4363D for ; Fri, 2 Oct 2020 14:24:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3C525206FA for ; Fri, 2 Oct 2020 14:24:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601648698; bh=xmeFcPXFt716w/O8GVwachHUIy8GorHaGk5X5TlV4BA=; h=References:In-Reply-To:From:Date:Subject:To:Cc:List-ID:From; b=q0EMtIIwN6an6IdIetf4yN1XWK4Bg10lngy+pGb36S7Mh8XL3mH7KOdttgrcs/PuO jAEGmQb4hjLkwaPTQXHVg+pZZo5i4AF6VhD4AiSy6ba9xb6Aq/OQWTRYpPtneWEg+A 64nxktDOaaOZD/tI2BFtpwB7M5hL5JV5+JUOwgvQ= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726090AbgJBOY5 (ORCPT ); Fri, 2 Oct 2020 10:24:57 -0400 Received: from mail-oi1-f195.google.com ([209.85.167.195]:40843 "EHLO mail-oi1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387777AbgJBOYz (ORCPT ); Fri, 2 Oct 2020 10:24:55 -0400 Received: by mail-oi1-f195.google.com with SMTP id m128so1379394oig.7; Fri, 02 Oct 2020 07:24:54 -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=/oXpa3kicEZpKqydffMP2F2DCvS5CBlfjCKM89ZyVOM=; b=PwHn+UOL0hJ6nqHvwhYZPC9SnMPG7JhzJ0G4oJxQsBAbj7njVHGWLGGDG1mQu6rd09 ZAjpy9s62WjJqRw94BrkO4vIuTStyqqHvkOK4x0EUkIcufrCy94pppwkh0lMW0BFyjNX hMi5hJS0UN9loS8abSOZk+nLXAJfjO8W2AwdweuxLWfiZRwOKsMbkiH66AC/5XbjTNkW MrBDsqIbErDg7SHgc0LS8mpzbRGQFF8FoL01wnF0AEMc+qfRp+Ji1sc23BifR14fP8ww RG7IfKuaynuZafOw+uy9g7LE8xuarjgu2JAY7kponx1U9o4YIRMpuQivcLX5sx/1vkVJ Y6Og== X-Gm-Message-State: AOAM531rrNkS90fIXOkfvVz7tvTa68yGKAjCPVM/3GKqu7wVQwfkUEdP RTpgIPEr/LOF3+nUWiyuRrphy+a6kHmr77cyVik= X-Google-Smtp-Source: ABdhPJxz7C7wkVk/Uve1kV8PtdOMbPoxoqT/bJyjWJ9DUI+FeAsIM20zb3yKwQjjZOC4EfyoZPEh6IfVfmeof2SW0AI= X-Received: by 2002:aca:df84:: with SMTP id w126mr1454599oig.103.1601648694157; Fri, 02 Oct 2020 07:24:54 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: "Rafael J. Wysocki" Date: Fri, 2 Oct 2020 16:24:41 +0200 Message-ID: Subject: Re: [PATCH] PCI/ACPI: Whitelist hotplug ports for D3 if power managed by ACPI To: "Deucher, Alexander" Cc: "Rafael J. Wysocki" , Lukas Wunner , Aaron Zakhrov , Michal Rostecki , Linux PCI , "Rafael J. Wysocki" , amd-gfx list , ACPI Devel Maling List , Shai Coleman , Bjorn Helgaas , Arthur Borsboom , matoro , Mika Westerberg , Len Brown Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org On Fri, Oct 2, 2020 at 4:20 PM Deucher, Alexander wrote: > > [AMD Public Use] > > > -----Original Message----- > > From: amd-gfx On Behalf Of > > Rafael J. Wysocki > > Sent: Friday, October 2, 2020 10:17 AM > > To: Lukas Wunner > > Cc: Aaron Zakhrov ; Michal Rostecki > > ; Linux PCI ; Rafael J. > > Wysocki ; amd-gfx list > gfx@lists.freedesktop.org>; ACPI Devel Maling List > acpi@vger.kernel.org>; Shai Coleman ; Bjorn > > Helgaas ; Arthur Borsboom > > ; matoro ; Deucher, > > Alexander ; Mika Westerberg > > ; Len Brown > > Subject: Re: [PATCH] PCI/ACPI: Whitelist hotplug ports for D3 if power > > managed by ACPI > > > > 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://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flore > > > .kernel.org%2Flinux-pci%2F20170503180426.GA4058%40otc-nc- > > 03%2F&dat > > > > > a=02%7C01%7Calexander.deucher%40amd.com%7C99ec20b6d4dc410baf800 > > 8d866dd > > > > > e688%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C6373724505855 > > 84491&a > > > > > mp;sdata=EPFyxPA0MDBuAkvH7bbp2wHYnpos8p%2BoZmzlUvvdAek%3D&a > > mp;reserved > > > =0 > > > > > > 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://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgitl > > > ab.freedesktop.org%2Fdrm%2Famd%2F- > > %2Fissues%2F1222&data=02%7C01%7C > > > > > alexander.deucher%40amd.com%7C99ec20b6d4dc410baf8008d866dde688% > > 7C3dd89 > > > > > 61fe4884e608e11a82d994e183d%7C0%7C0%7C637372450585584491&sd > > ata=cMj > > > > > LDIbjp8RQiWX8pgK2bDUH%2B0u3oquy3TqeT9QjZGE%3D&reserved=0 > > > Link: > > > https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgitl > > > ab.freedesktop.org%2Fdrm%2Famd%2F- > > %2Fissues%2F1252&data=02%7C01%7C > > > > > alexander.deucher%40amd.com%7C99ec20b6d4dc410baf8008d866dde688% > > 7C3dd89 > > > > > 61fe4884e608e11a82d994e183d%7C0%7C0%7C637372450585584491&sd > > ata=iP9 > > > > > EqNcM15Dj4Ax%2BE6e2HaMWHEX%2B0IO3cMoi0NXWGzM%3D&reser > > ved=0 > > > Link: > > > https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgitl > > > ab.freedesktop.org%2Fdrm%2Famd%2F- > > %2Fissues%2F1304&data=02%7C01%7C > > > > > alexander.deucher%40amd.com%7C99ec20b6d4dc410baf8008d866dde688% > > 7C3dd89 > > > > > 61fe4884e608e11a82d994e183d%7C0%7C0%7C637372450585584491&sd > > ata=VlT > > > UV2UCH4RvKgTXZcpGOpkjZpfijmPgwtvKx6HRT04%3D&reserved=0 > > > 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. > > Any chance we can get this into stable at some point as well? It would be nice to fix the laptops out there in the wild running older kernels. I can mark it for stable, but I'm not sure which releases it should go back to. Thanks!