Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp1769662ybc; Wed, 20 Nov 2019 03:55:15 -0800 (PST) X-Google-Smtp-Source: APXvYqxY7vYGUOyNX3Alsoc1z/ui4A3NCYtSNEW6FSj6XnCwNyppF5YGi/HHBUV5TMVHBrbzMf8/ X-Received: by 2002:a17:906:4dc8:: with SMTP id f8mr4885993ejw.62.1574250914942; Wed, 20 Nov 2019 03:55:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574250914; cv=none; d=google.com; s=arc-20160816; b=ePzWrlOjv39FC/kp6TUjso/oES1ETWpC6Bi8W41dHfKzjCn6ay/1TuaMmPFWJbf+Zr am8f7pwT8Gm1rC0ypN72uhM5U6EYRRd4WElIdAuNFkH/jqkHuWPfsYFzW+opDHxvCANY WGRqVspTEtRlnOTZrND+MM7NAT7a803/l9oNDIezOzHWdozaz+q6zStVRMgLoffHMRYj vV9gq1aTeOgawl/BMArNCLMHVVUjaw4/d/7tMSMmCw3SZRUieFqk8bjw/+eREXupUYUm bWc3l7m6mWLnNdq6IgWZ3qMeoI4mRH5xaSM9RIOejbboJEOs4R0GBLt6PLp5nyN8QP1i mftg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version; bh=0XJsWOiRBHmD2kFFkY9kcnlnvFi6tJbcT90YhvqGyXk=; b=mINxyCwnoKtIAanxtEdMVOter2Ijau9cg8Kp1zQ6bp+PBF3wu+Ec2UHjUcHQaNHIl0 078yn73VdFFt5rCREWKdzsdeWHv//+rUxo2D2vNW8xqBuaEKsum7fNpQTXsrCv18nn+f jFmyk5R64NI7LjSguGn4K45JEP5FG+KD0dBkbQRZOr0nq+18GOu3VN8EHdXAVUcZfW4K Wjau77JmeILdBRnZBKOHmoW3fJ6OQl+T2mu2/Ps9Dbqdn88fIVyoKb/LxPrD/EiSzmum 7l6+Pir3ErmbxWbbT6vl3YMfUamgFJm6mPPhIb7sfeLN+b+ZDn4IseIJ8cDxoDAxOLI2 Qgbg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l15si15994495ejp.114.2019.11.20.03.54.50; Wed, 20 Nov 2019 03:55:14 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728910AbfKTKwf (ORCPT + 99 others); Wed, 20 Nov 2019 05:52:35 -0500 Received: from mail-oi1-f194.google.com ([209.85.167.194]:37693 "EHLO mail-oi1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727514AbfKTKwf (ORCPT ); Wed, 20 Nov 2019 05:52:35 -0500 Received: by mail-oi1-f194.google.com with SMTP id y194so22109110oie.4; Wed, 20 Nov 2019 02:52:34 -0800 (PST) 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=0XJsWOiRBHmD2kFFkY9kcnlnvFi6tJbcT90YhvqGyXk=; b=qiGWd+XbXurL8W+kG/70kg6t3cxg2w0LjapF3GhgCZNcDcHalKboqxJ0Fvs+eIOAzE fDdibhF/wgWQalEtF5slXGtJmpi3XOJj6WA+bGKn3iDW0MD8UbAhHuG8ypBiPBIFue6m 0dHn+APRs+rzhK9R3taZtHFwvEdEPJKqyLc/1QNIUaCweGcwap/rT2X4KxT40b9SGY6x EuLePsBcXK1xTBk3mDdZHvWdUfvinBjdLYy7phPe49hvknb7bqrjSgWz7wCQkcRdDsgo tqoqE53kWeZkrlfZzb+RQ0G2gPjid8yEmlYzrJPawkLbMVnOtEX5mYovjYoRoiP6Vt5U 7jLw== X-Gm-Message-State: APjAAAU3yshwBNb3skcMSWhhFZ874UEJhrDI6eiXes119Szf9o3VMQf1 SnXtsHeENXgJTzm+odM6sJwRb75oM/Y9+GMJy3g= X-Received: by 2002:aca:530c:: with SMTP id h12mr2293868oib.110.1574247153834; Wed, 20 Nov 2019 02:52:33 -0800 (PST) MIME-Version: 1.0 References: <20191017121901.13699-1-kherbst@redhat.com> <20191119214955.GA223696@google.com> <20191120101816.GX11621@lahna.fi.intel.com> In-Reply-To: <20191120101816.GX11621@lahna.fi.intel.com> From: "Rafael J. Wysocki" Date: Wed, 20 Nov 2019 11:52:22 +0100 Message-ID: Subject: Re: [PATCH v4] pci: prevent putting nvidia GPUs into lower device states on certain intel bridges To: Mika Westerberg Cc: Karol Herbst , Bjorn Helgaas , LKML , Lyude Paul , "Rafael J . Wysocki" , Linux PCI , Linux PM , dri-devel , nouveau , Dave Airlie , Mario Limonciello Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Nov 20, 2019 at 11:18 AM Mika Westerberg wrote: > > Hi Karol, > > On Tue, Nov 19, 2019 at 11:26:45PM +0100, Karol Herbst wrote: > > On Tue, Nov 19, 2019 at 10:50 PM Bjorn Helgaas wrote: > > > > > > [+cc Dave] > > > > > > On Thu, Oct 17, 2019 at 02:19:01PM +0200, Karol Herbst wrote: > > > > Fixes state transitions of Nvidia Pascal GPUs from D3cold into higher device > > > > states. > > > > > > > > v2: convert to pci_dev quirk > > > > put a proper technical explanation of the issue as a in-code comment > > > > v3: disable it only for certain combinations of intel and nvidia hardware > > > > v4: simplify quirk by setting flag on the GPU itself > > > > > > I have zero confidence that we understand the real problem, but we do > > > need to do something with this. I'll merge it for v5.5 if we get the > > > minor procedural stuff below straightened out. > > > > > > > Thanks, and I agree with your statement, but at this point I think > > only Intel can help out digging deeper as I see no way to debug this > > further. > > I don't have anything against this patch, as long as the quirk stays > limited to the particular root port leading to the NVIDIA GPU. The > reason why I think it should to be limited is that I'm pretty certain > the problem is not in the root port itself. I have here a KBL based > Thinkpad X1 Carbon 6th gen that can put the TBT controller into D3cold > (it is connected to PCH root port) and it wakes up there just fine, so > don't want to break that. > > Now, PCIe devices cannot go into D3cold all by themselves. They always > need help from the platform side which is ACPI in this case. This is > done by having the device to have _PR3 method that returns one or more > power resources that the OS is supposed to turn off when the device is > put into D3cold. All of that is implemented as form of ACPI methods that > pretty much do the hardware specific things that are outside of PCIe > spec to get the device into D3cold. At high level the _OFF() method > causes the root port to broadcast PME_Turn_Off message that results the > link to enter L2/3 ready, it then asserts PERST, configures WAKE (both > can be GPIOs) and finally removes power (if the link goes into L3, > otherwise it goes into L2). > > I think this is where the problem actually lies - the ASL methods that > are used to put the device into D3cold and back. We know that in Windows > this all works fine so unless Windows quirks the root port the same way > there is another reason behind this. > > In case of Dell XPS 9560 (IIRC that's the machine you have) the > corresponding power resource is called \_SB.PCI0.PEG0.PG00 and its > _ON/_OFF methods end up calling PGON()/PGOF() accordingly. The methods > itself do lots of things and it is hard to follow the dissassembled > ASL which does not have any comments but there are couple of things that > stand out where we may go into a different path. One of them is this in > the PGOF() method: > > If (((OSYS <= 0x07D9) || ((OSYS == 0x07DF) && (_REV == 0x05)))) > > The ((OSYS == 0x07DF) && (_REV == 0x05)) checks specifically for Linux > (see [1] and 18d78b64fddc ("ACPI / init: Make it possible to override > _REV")) so it might be that Dell people tested this at some point in > Linux as well. Added Mario in case he has any ideas. > > Previously I suggested you to try the ACPI method tracing to see what > happens inside PGOF(). Did you have time to try it? It may provide more > information about that is happening inside those methods and hopefully > point us to the root cause. > > Also if you haven't tried already passing acpi_rev_override in the > command line makes the _REV to return 5 so it should go into the "Linux" > path in PGOF(). Oh, so does it look like we are trying to work around AML that tried to work around some problematic behavior in Linux at one point? > [1] https://www.kernel.org/doc/html/latest/firmware-guide/acpi/osi.html#do-not-use-rev