Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp1863646ybc; Wed, 20 Nov 2019 05:23:51 -0800 (PST) X-Google-Smtp-Source: APXvYqx9CGCKUiWqyvFk1P6J4ziGk97vSWhfn7yisGNBjHYdNvDGjMnkz2yc3VGrckCoZLH3ZnMb X-Received: by 2002:a17:906:5586:: with SMTP id y6mr5432646ejp.76.1574256231168; Wed, 20 Nov 2019 05:23:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574256231; cv=none; d=google.com; s=arc-20160816; b=yBKwpLtgYDUOrdx5S8O23oxwdorrLLIbG/5a8jEJK+m70CwhAorJ2asCseNR64yGlP IJ5uQu8tek0C8SQ1wGwDJEY7Z1RTE5x2qBwtt3Ssx1yIXyU4BzAbJnU7KOgO0esoopgI nhA7a30tKQ/LmvFk1AgdY1nTsa6ybl3lhrt+doGh+IuOlrIDoqrCez3pG9daqPIY7IV2 iGLIougne/eaqhs7bJ4oM1qtG3ff7zUfmyKxdL8qtrs1GCLWpHNoRewjjaeVChD0a8sH QKGuwdVhXj0G8u58ePOoFTV7c5+0jhzCiACe+mOjL5XEC5evNRAXttZr5onLDwRb4d38 BUvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=iPxRqpnj1VRvKWjlC4bBmohXIj2CvgKB/Q/qWInRYCM=; b=0zNVfscF/zlw4y9fBNaK6NtlI8VeUiyD6ZDIR020WGwDuk3gpqIYHNAVJQgbQKLxhg Ci6j57/1TeYr28lC7wUGVHH2sTcRaiNpMDcZf+dkF3IfG9jz0nHbRObWdgVg5AAECoi8 rCrBmerA29HvRivlVgieou5Bu+zlO9m/nMlKYltSGQ3DFynhzJVjv/GFVNEbXd4AHSgu bSoyWap+vgYROQbrAbvx1nsd6xnydF7OIvl2LnzDwksbucOUqw/izGtTF4++gMMf438A s32zhMIuFlWdMcZnK4R3y368o92WChG6RlKFNiYqqEIDrQZUVTqMg4xUFh+1vFF++Fbw 5yNg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="E5ww/s7b"; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e21si17128425ejt.77.2019.11.20.05.23.26; Wed, 20 Nov 2019 05:23:51 -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; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="E5ww/s7b"; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729365AbfKTLve (ORCPT + 99 others); Wed, 20 Nov 2019 06:51:34 -0500 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:50674 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728665AbfKTLvd (ORCPT ); Wed, 20 Nov 2019 06:51:33 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1574250691; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=iPxRqpnj1VRvKWjlC4bBmohXIj2CvgKB/Q/qWInRYCM=; b=E5ww/s7b1kmsqwtcRi69ArP/ZnmY+xQxR5qZ7AaAwl8hp0wDrEjUwSO1vN7gJj8Jnrm7xh b6L3FmkkX/502LMTbafW0IdG5ATObOgQekWayBZZfMOvbKHUD9qtJ351s2ZWLwU2h3g4zu Ts1rGqrZU7ppGpWmEv4//zxez2RxU3A= Received: from mail-qk1-f197.google.com (mail-qk1-f197.google.com [209.85.222.197]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-101-xUOtt8sEOt6z4AwScdE2jA-1; Wed, 20 Nov 2019 06:51:30 -0500 Received: by mail-qk1-f197.google.com with SMTP id s144so15639684qke.20 for ; Wed, 20 Nov 2019 03:51:30 -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=CFyc/FUMDYyl2BocV0QKj5FHf/d/2FxPovJ0RWOX7+w=; b=lbQ4ls9S/twveHJf5PR1i/OALvj85wfue9N6lrqlgs6H9IxqpZm9CiicDeBKEcQlLk wUnuVzQIG++ASqBG1hmnvA5nnZ6Sl9AgLe8Ns6wtTMKePZGoAV8n/UhaZQ4geR/h8kqn sVPQ0CgfwgmBqzLxH4uA+Pyc2+W6lcl6rY0IVQkqjxOrK3yN7FkJMDnEzI5hH0UJT396 ////+qupul3vtsS6WeNU+dlCnYbfyljB7jd9ylFiBiWSA3eSp+XjRVaEQo7YggN5yYOL o6b2ma7zfUeSIbVyvXRQC3jF+kEgoKNkZU2cZy1K1W5LUqrf7W92ZW7QkRW8K2DqC6sm 8gaQ== X-Gm-Message-State: APjAAAX1wgxVC7ILbuB1AxeBg8ed2NQ/0nIV1t/mkDbLlx96D5AeiYAs 4s05KTjmWThFHg6C709XuIhfFYsR7qQzvle0ro0MXpl0HISnPVoPwvOZkWTm45cSJ7O8nPNbbbb jLpB4K20aLGSGbcnCtYRpAhpVPlsBzFO6QvHn/p4/ X-Received: by 2002:a05:6214:14f0:: with SMTP id k16mr2065699qvw.113.1574250689379; Wed, 20 Nov 2019 03:51:29 -0800 (PST) X-Received: by 2002:a05:6214:14f0:: with SMTP id k16mr2065670qvw.113.1574250689023; Wed, 20 Nov 2019 03:51:29 -0800 (PST) MIME-Version: 1.0 References: <20191017121901.13699-1-kherbst@redhat.com> <20191119214955.GA223696@google.com> <20191120101816.GX11621@lahna.fi.intel.com> <20191120112212.GA11621@lahna.fi.intel.com> In-Reply-To: From: Karol Herbst Date: Wed, 20 Nov 2019 12:51:17 +0100 Message-ID: Subject: Re: [PATCH v4] pci: prevent putting nvidia GPUs into lower device states on certain intel bridges To: "Rafael J. Wysocki" Cc: Mika Westerberg , Bjorn Helgaas , LKML , Lyude Paul , "Rafael J . Wysocki" , Linux PCI , Linux PM , dri-devel , nouveau , Dave Airlie , Mario Limonciello X-MC-Unique: xUOtt8sEOt6z4AwScdE2jA-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 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 12:48 PM Rafael J. Wysocki wrot= e: > > On Wed, Nov 20, 2019 at 12:22 PM Mika Westerberg > wrote: > > > > On Wed, Nov 20, 2019 at 11:52:22AM +0100, Rafael J. Wysocki wrote: > > > 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 int= o higher device > > > > > > > states. > > > > > > > > > > > > > > v2: convert to pci_dev quirk > > > > > > > put a proper technical explanation of the issue as a in-c= ode comment > > > > > > > v3: disable it only for certain combinations of intel and nvi= dia 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 g= et the > > > > > > minor procedural stuff below straightened out. > > > > > > > > > > > > > > > > Thanks, and I agree with your statement, but at this point I thin= k > > > > > only Intel can help out digging deeper as I see no way to debug t= his > > > > > further. > > > > > > > > I don't have anything against this patch, as long as the quirk stay= s > > > > 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 certa= in > > > > 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 D3c= old > > > > (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 alw= ays > > > > need help from the platform side which is ACPI in this case. This i= s > > > > done by having the device to have _PR3 method that returns one or m= ore > > > > 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 PCI= e > > > > 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 (b= oth > > > > 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 t= hat > > > > are used to put the device into D3cold and back. We know that in Wi= ndows > > > > 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 meth= ods > > > > 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 thi= s in > > > > the PGOF() method: > > > > > > > > If (((OSYS <=3D 0x07D9) || ((OSYS =3D=3D 0x07DF) && (_REV =3D=3D= 0x05)))) > > > > > > > > The ((OSYS =3D=3D 0x07DF) && (_REV =3D=3D 0x05)) checks specificall= y for Linux > > > > (see [1] and 18d78b64fddc ("ACPI / init: Make it possible to overri= de > > > > _REV")) so it might be that Dell people tested this at some point i= n > > > > Linux as well. Added Mario in case he has any ideas. > > > > > > > > Previously I suggested you to try the ACPI method tracing to see wh= at > > > > happens inside PGOF(). Did you have time to try it? It may provide = more > > > > information about that is happening inside those methods and hopefu= lly > > > > 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 "L= inux" > > > > 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? > > > > Yes, it looks like so if I read the ASL right. > > OK, so that would call for a DMI-based quirk as the real cause for the > issue seems to be the AML in question, which means a firmware problem. > And I disagree as this is a linux specific workaround and windows goes that path and succeeds. This firmware based workaround was added, because it broke on Linux.