Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp823826pxb; Tue, 3 Nov 2020 13:34:32 -0800 (PST) X-Google-Smtp-Source: ABdhPJyJDz8RqqWb1CG3g23FtCYy27pZsf8GeG4hPXU9Lj5FvtolfpEVd2IGlTouN7ZeQENM5blU X-Received: by 2002:a05:6402:4c6:: with SMTP id n6mr24321505edw.204.1604439272535; Tue, 03 Nov 2020 13:34:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604439272; cv=none; d=google.com; s=arc-20160816; b=Un6S2NBkjgu9Iw5Rj4//mpgMLveuokXryJ+jjoMufs0WxbDflGQ7jsYtKFFqHlKMAz qGhpfPEAbTqJAAP1LOjAKTVW/TiGs+FYEmOMpH3t/TPYbcLNArGhWHDA3qheEY1ZlPr9 2XTXtggQQk5HVQ59pL5qTtxGEETZiuK8n6g7rpaBVdZHRwhSPh0xAZIervEyJScdn5tT LR5DKgUtXYPipHcH2edpZ/H/2uMBO0QdmmAK5RU9oCEDNfxbDPC8fRLtpQvm7+mlF59T Kte4/SjqPjl8W6oftFT44csM+i8fY74DEPtL5srXL31vxyHOf/rFJJK5NWpP2QGNpg25 s/JQ== 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=GDXOhA5mby85k54QFbxeN/sZO855o8+tmOX1/CDmtncUkazVkhlC4lcnJcuqjWYL2b JcSiGdiKEB07uDlD7MvhFMFhw2VK9L9nCb2jjfvwIRzCZkktZDyAkIynJdjSJnwPryqe sK7NhNk/T3GHS2Ok1oWXGPd1k8Hv6qivheYuFSbH17I286Az5EMDnR+d+ZYHdZ6lUmrJ sfp7ZyySGMIYSfb7gkUkrmiExEGiG2We1FB7mhRZXICWn/4afw1mR6dDjRW4+14zJmgv bZYRoi7cWhT2P/A5IYNgMhlGom002h/q2r41l8rtUOnu2bqSB0IiCFPapCKJ/vtbku6/ R7Eg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=wQWPJsbZ; 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 c14si10600269edr.82.2020.11.03.13.34.09; Tue, 03 Nov 2020 13:34:32 -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=wQWPJsbZ; 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 S1731989AbgKCVb0 (ORCPT + 99 others); Tue, 3 Nov 2020 16:31:26 -0500 Received: from mail.kernel.org ([198.145.29.99]:60210 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731750AbgKCU5p (ORCPT ); Tue, 3 Nov 2020 15:57:45 -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 6BAE32053B; Tue, 3 Nov 2020 20:57:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604437064; bh=OF1UzrEkpvQY/H024MBR+tM08Hv99WeM2oKPJDlgaAM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wQWPJsbZzHMmSV3XXyVQV50GHj3X2LimmqASXpTCu8EMgwrqSbLIA7qEuGopNauGq Xkd/m21wVYD5EszOrFlQk0awr4YU3AmOTsuphfrL14jAr46BiXfS7j2laZBDcq3H1w R+qgWgcF4pPESwsBUJ6w24W1Dz4jb0hVUyGvQwpM= 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.4 114/214] PCI/ACPI: Whitelist hotplug ports for D3 if power managed by ACPI Date: Tue, 3 Nov 2020 21:36:02 +0100 Message-Id: <20201103203301.578517893@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201103203249.448706377@linuxfoundation.org> References: <20201103203249.448706377@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.