Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp797300pxb; Tue, 3 Nov 2020 12:48:46 -0800 (PST) X-Google-Smtp-Source: ABdhPJzjrXTYNV0jBXimdidJzvae7dVF1p5cPGcxepkV8Gg7NWRDflEqwl/i4a6i/myG1idD/BIx X-Received: by 2002:a05:6402:1bdb:: with SMTP id ch27mr21120046edb.63.1604436526241; Tue, 03 Nov 2020 12:48:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604436526; cv=none; d=google.com; s=arc-20160816; b=HFEvbVTzPlXVv/in8OwOK5G5BSQF+W/6ERGfJ7kWHRLnjiIPw43UsmldLstFFRHfoP i34kyxiL9MS7BaukHmIFbuDdN4+zUA2/atEhDJ9UYLZ2mu+7RPfs4c3HMnyoZBHlElkJ LrPNUHyGFex6zADW7aEslT8fZY/8LBR4pNpS+WnfBZ2y0S29HCLHPKdls8ExqdOwJDi9 dqpHWm6z7Pjn2OgZ5uFn3DOqGUTwIirYOlioACdwu8YUqJGTm/daFs+6zLNIoubojqJU kSM/NkBeSKCjZ9UNZSwJHla0Sipi5Ko+pnIfcKLnAx7tzDxRNGdTbA4uSIdWC0pbv/P6 s1Nw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=EgpwdBa+Nf9syfEjcKUB7+LQLJWUnxmi8jaek8hDQZ0=; b=nShQKZu20/jG54WDDDFCOfySPb5ooMc3JRfjfPKQ5nirV6JIBrNaXX8Aq/50H2iSpz SwEhr1dcUjBZuOZ390HjEZuqo00KNwGlKxXWRWc+ufwTEC2ip6DWxw2oWxwHBSoqJbuI VtI5V/37KGrixI65qV3l4G9J0n2OYR9btyXIjw/a4onEVdQGjfuKnnaGNOZcCC7We3m2 tXmKh38iJ+3QjpMEoW0eGM4uLyQMIr4DJXMT44KQjgPE+fCeMMRw4sWOg780iDfMkN5G SgJUIVIj9p7BDiK/6BWp3wFm34C0xrMm7v5N6gSCUN4U24s88pU8mkZeEKHuwmk/sv8Q vOOQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="ci/+F+zt"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x18si12034ejd.193.2020.11.03.12.48.23; Tue, 03 Nov 2020 12:48:46 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="ci/+F+zt"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731091AbgKCUpu (ORCPT + 99 others); Tue, 3 Nov 2020 15:45:50 -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: linux-kernel@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.