From patchwork Mon Oct 31 22:48:22 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Wu X-Patchwork-Id: 9406635 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 9680360585 for ; Mon, 31 Oct 2016 22:48:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 888EB28F4E for ; Mon, 31 Oct 2016 22:48:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 78DDC290B1; Mon, 31 Oct 2016 22:48:44 +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 C083D28F4E for ; Mon, 31 Oct 2016 22:48:39 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9A07C6E391; Mon, 31 Oct 2016 22:48:38 +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 627AB89FA0; Mon, 31 Oct 2016 22:48:37 +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=UdvjkZ0wuEzYc7ck/BbAVd6CNF5D1CPISoiyD5zOHvY=; b=Cman6WaIMvG4ruh+yI9fjVljHnMVtlZ3vn93dF+RY8Bw+QMJTfoeSkuh5NJLwJaaiIKL1JjjJGZXRKwg8BDetAvDqDo6y9C6DStVVqYoeZXizwu28ZTRxPW7dSSj4GPq1duAcSWAvcC/DosCZcCFP0umZjHensjc/RlFIrVuY/Zer6oqvIO6pwRSRw9RotVnwmTEfRGK2wsFMjF/XIKAnGs2nR8+KKzmehE6ydgYEOZewjMdSSDd9BEwb3EkWOSwbNMnE6OkIVEvIUUwspfBB51Bqj3coaOwg326nrF+pR62fiUQC/+x/oPqHgb7OtvIIl8yL5/8dh87Z9RFkUcDwg==; Received: by lekensteyn.nl with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1c1LNX-0001ay-CS; Mon, 31 Oct 2016 23:48:31 +0100 From: Peter Wu To: Ben Skeggs Subject: [PATCH v2] drm/nouveau/acpi: fix check for power resources support Date: Mon, 31 Oct 2016 23:48:22 +0100 Message-Id: <20161031224822.11069-1-peter@lekensteyn.nl> X-Mailer: git-send-email 2.10.1 Cc: nouveau@lists.freedesktop.org, Mika Westerberg , dri-devel@lists.freedesktop.org, Rick Kerkhof 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 Check whether the kernel really supports power resources for a device, otherwise the power might not be removed when the device is runtime suspended (DSM should still work in these cases where PR does not). This is a workaround for a problem where ACPICA and Windows 10 differ in behavior. ACPICA does not correctly enumerate power resources within a conditional block (due to delayed execution of such blocks) and as a result power_resources is set to false even if _PR3 exists. Fixes: 692a17dcc292 ("drm/nouveau/acpi: fix lockup with PCIe runtime PM") Link: https://bugs.freedesktop.org/show_bug.cgi?id=98398 Reported-and-tested-by: Rick Kerkhof Reviewed-by: Mika Westerberg Signed-off-by: Peter Wu --- v2: collected tags from Rick and Mika; added ACPICA note as requested by Mika I suggest Cc: stable (if the maintainer is OK with that?) --- drivers/gpu/drm/nouveau/nouveau_acpi.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/nouveau/nouveau_acpi.c b/drivers/gpu/drm/nouveau/nouveau_acpi.c index dc57b62..193573d 100644 --- a/drivers/gpu/drm/nouveau/nouveau_acpi.c +++ b/drivers/gpu/drm/nouveau/nouveau_acpi.c @@ -240,7 +240,8 @@ static bool nouveau_pr3_present(struct pci_dev *pdev) if (!parent_adev) return false; - return acpi_has_method(parent_adev->handle, "_PR3"); + return parent_adev->power.flags.power_resources && + acpi_has_method(parent_adev->handle, "_PR3"); } static void nouveau_dsm_pci_probe(struct pci_dev *pdev, acpi_handle *dhandle_out,