From patchwork Thu Aug 25 23:00:54 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Wu X-Patchwork-Id: 9300109 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 3B7F360757 for ; Thu, 25 Aug 2016 23:01:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 229352937C for ; Thu, 25 Aug 2016 23:01:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1614C29406; Thu, 25 Aug 2016 23:01:26 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id CF9BA2937C for ; Thu, 25 Aug 2016 23:01:24 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id BB1C16E124; Thu, 25 Aug 2016 23:01:22 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail.lekensteyn.nl (mail.lekensteyn.nl [IPv6:2a02:2308::360:1:25]) by gabe.freedesktop.org (Postfix) with ESMTPS id 56C036E116; Thu, 25 Aug 2016 23:01:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lekensteyn.nl; s=s2048-2015-q1; h=Message-Id:Date:Subject:Cc:To:From; bh=xhchdHc2Bj7J66e5MUnzhFhX9/QIB7E+ALoY8LO0cdo=; b=kW6FdgrVsvsiYIR6AuSaMGFvbfqCVFkRLvmhPs4TlNmD7cEiR8JukSTcdMQzcz4goABvEnLG9dV/8V/y+6mNKi1keMfsrtI4/VfLOA4d4h+6gQu8eLv1d1wkXDV11715l1rQGmgRbqAyJKC2U0Zw0GIFKzuDD2Y7vJk7yuQDZBQA916TmLWE4qqfVOCPgOYiQo/s0FF6hvU1q5FmKzWljnn28YBtKXWO+nkvRSbr1SCNBmMSrv4klrQ6nJiytrM0wMAdmaDhTPcBe//vnUFQ8cprzLQkXMmavRfoVN2yzgszjEC/PPZ8of51ifyrrCdipVtFJJ6hUBDQ+K192E5Alw==; Received: by lekensteyn.nl with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1bd3du-0000w3-C1; Fri, 26 Aug 2016 01:01:18 +0200 From: Peter Wu To: Dave Airlie , Ben Skeggs Subject: [PATCH] drm/nouveau/acpi: use DSM if bridge does not support D3cold Date: Fri, 26 Aug 2016 01:00:54 +0200 Message-Id: <20160825230054.8649-1-peter@lekensteyn.nl> X-Mailer: git-send-email 2.9.3 Cc: nouveau@lists.freedesktop.org, Mika Westerberg , dri-devel@lists.freedesktop.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Even if PR3 support is available on the bridge, it will not be used if the PCI layer considers it unavailable (i.e. on all laptops from 2013 and 2014). Ensure that this condition is checked to allow a fallback to the Optimus DSM for device poweroff. Initially I wanted to call pci_d3cold_enable before checking bridge_d3 (in case the user changed d3cold_allowed), but that is such an unlikely case and likely fragile anyway. The current patch is suggested by Mika in http://www.spinics.net/lists/linux-pci/msg52599.html Cc: Mika Westerberg Signed-off-by: Peter Wu Reviewed-by: Mika Westerberg --- Hi, This idea is floating since July, but was blocked by the PCI D3cold patches. Since these got into -rc1, here is the promised follow-up patch for v4.8. Without this patch, some laptops from 2013 and 2014 will regress in v4.8 and suck more power. Kind regards, Peter --- drivers/gpu/drm/nouveau/nouveau_acpi.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/gpu/drm/nouveau/nouveau_acpi.c b/drivers/gpu/drm/nouveau/nouveau_acpi.c index f2ad17a..dc57b62 100644 --- a/drivers/gpu/drm/nouveau/nouveau_acpi.c +++ b/drivers/gpu/drm/nouveau/nouveau_acpi.c @@ -225,6 +225,17 @@ static bool nouveau_pr3_present(struct pci_dev *pdev) if (!parent_pdev) return false; + if (!parent_pdev->bridge_d3) { + /* + * Parent PCI bridge is currently not power managed. + * Since userspace can change these afterwards to be on + * the safe side we stick with _DSM and prevent usage of + * _PR3 from the bridge. + */ + pci_d3cold_disable(pdev); + return false; + } + parent_adev = ACPI_COMPANION(&parent_pdev->dev); if (!parent_adev) return false;