Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp5805115ybg; Tue, 22 Oct 2019 08:37:21 -0700 (PDT) X-Google-Smtp-Source: APXvYqyGD1b3v/H0d6WDm4ieN5wBER2yKIF4DpAH0uDKI58zNeoAuBQ+0uqOghs66+BezijwWjO/ X-Received: by 2002:a17:907:42cc:: with SMTP id nz20mr11646030ejb.324.1571758641832; Tue, 22 Oct 2019 08:37:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571758641; cv=none; d=google.com; s=arc-20160816; b=r0N1dJglwSPc6Mk9XZL2YBBcA/Yf0h5LEUB9RQ8GXktJfxL596rQfQX1JMaTRmoe4d /qMpUZ3KFPcerHyCmByHzbX8Nej2kybGUiTmqSmFC3Z59BKFZXXpvtHGAVOGokr7MXXC +JxPqQjIw82X+Xc8yjboGn68LYolimkJqrq3nVh6+/nYdzVTM/HmoP4HTn89kHK6ZlG3 wxOb6gDrzzuuIW12w8OeWFDQHzN7hWKZ/lhiiQI27dFGSgXMnwSP4j+cnP5D3kK57lN+ pUbDUjPqfhumxQP7yxScfZuhEB+kZIEUY8DbyZbLInDyJx6mn+Df9M7r4MDm44kblB3H D6mQ== 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=3yeQelJTclqqXcJSeLCRYJucLdCvZTdooL8LQ/VknXg=; b=moyT1/D1TgIsluKDPUc7PWorc0rb3zcxKRuRUoOlViisX7VA/JOkx8ubN/YmIDirRD hl/tXkkAcaDD/aQl4T8E/fn2ATM5O2IaqUcpdMWzJyfzezxXke2zSuPKgunaGR+S4zjK 8GpZN/xhJER6KpIbRRiycM82vA+4txKdhHX7piBBfSpXoWwx7Lq1XLY5icCLUh3ikdha kJU+Cg08IpgMUiLRZSkuAczqrB/Gjh8rTUDCvuIPHagRaSv08bUP+Heg81dKk+qzb0z+ +c/ELZExtMVPa1PoMwBGcOywGovO8+P1QICej0cQ1BzOTw933QO7fRotteCychwIS3BI v9QA== 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ot22si2802812ejb.166.2019.10.22.08.36.57; Tue, 22 Oct 2019 08:37:21 -0700 (PDT) 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388946AbfJVMwG (ORCPT + 99 others); Tue, 22 Oct 2019 08:52:06 -0400 Received: from mx1.redhat.com ([209.132.183.28]:49910 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388655AbfJVMwG (ORCPT ); Tue, 22 Oct 2019 08:52:06 -0400 Received: from mail-qk1-f198.google.com (mail-qk1-f198.google.com [209.85.222.198]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BB26783F51 for ; Tue, 22 Oct 2019 12:52:05 +0000 (UTC) Received: by mail-qk1-f198.google.com with SMTP id z136so88780qkb.9 for ; Tue, 22 Oct 2019 05:52:05 -0700 (PDT) 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=3yeQelJTclqqXcJSeLCRYJucLdCvZTdooL8LQ/VknXg=; b=WRRRVoYDdKEUCTU8nezcpOHqRPF9CA9Ey/VSWqXGR8S8JChnlyQ80VsVJf87SWwPGC NauNc02U22Ap6Wl9h5q8QW/GjOA/XfC9COshBSqmsBlEf2sDlPy6NZ+JUNaoKEGW6bEC 3ebmTfwDj71die3ql+9QGQ/Md53dWI00yGD5CseABrwN3smFEnOdswb+fjvW12ZVEODC lLc+ARzK+kFK/A8hH9v07H2sKLPGoM772vjGG8hdD4Yjslfa0+Jik/X6O5ccDsV93NXn /nupmOJeW8cQ8AtwRujD2t0H9RVaWLYJKX1f6ED2lQgoQZwdAU9vzvDG+EMePnVkRNoN cU5g== X-Gm-Message-State: APjAAAVgdnG2lePwja1aI9ynibdPKYTmL3lOQwQJhYCHzvcZ5E7mH11Y /BUrw6Qoo8Ey2vbJqEVcqi9BMMvX42IINV6gt5IJ1cw4NYgY9NduZG93/dZTY7Ld3qnTL50QhhN 54UVBNH9TLTkP/NwbJXatPGl5aJb7tLQBmxM5/qEX X-Received: by 2002:a37:9c0f:: with SMTP id f15mr2853218qke.62.1571748724999; Tue, 22 Oct 2019 05:52:04 -0700 (PDT) X-Received: by 2002:a37:9c0f:: with SMTP id f15mr2853196qke.62.1571748724699; Tue, 22 Oct 2019 05:52:04 -0700 (PDT) MIME-Version: 1.0 References: <20191016213722.GA72810@google.com> <20191021133328.GI2819@lahna.fi.intel.com> <20191021140852.GM2819@lahna.fi.intel.com> <20191021154606.GT2819@lahna.fi.intel.com> <20191022124453.GK2819@lahna.fi.intel.com> In-Reply-To: <20191022124453.GK2819@lahna.fi.intel.com> From: Karol Herbst Date: Tue, 22 Oct 2019 14:51:53 +0200 Message-ID: Subject: Re: [PATCH v3] pci: prevent putting nvidia GPUs into lower device states on certain intel bridges To: Mika Westerberg Cc: Bjorn Helgaas , "Rafael J . Wysocki" , LKML , Lyude Paul , Linux PCI , Linux PM , dri-devel , nouveau , Linux ACPI Mailing List 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 Tue, Oct 22, 2019 at 2:45 PM Mika Westerberg wrote: > > On Tue, Oct 22, 2019 at 11:16:14AM +0200, Karol Herbst wrote: > > I think there is something I totally forgot about: > > > > When there was never a driver bound to the GPU, and if runtime power > > management gets enabled on that device, runtime suspend/resume works > > as expected (I am not 100% sure on if that always works, but I will > > recheck that). > > AFAIK, if there is no driver bound to the PCI device it is left to D0 > regardless of the runtime PM state which could explain why it works in > that case (it is never put into D3hot). > > I looked at the acpidump you sent and there is one thing that may > explain the differences between Windows and Linux. Not sure if you were > aware of this already, though. The power resource PGOF() method has > this: > > If (((OSYS <= 0x07D9) || ((OSYS == 0x07DF) && (_REV == 0x05)))) { > ... > } > I think this is the fallback to some older method of runtime suspending the device, and I think it will end up touching different registers on the bridge controller which do not show the broken behaviour. You'll find references to following variables which all cause a link to be powered down: Q0L2 (newest), P0L2, P0LD (oldest, I think). Maybe I remember incorrectly and have to read the code again... okay, the fallback path uses P0LD indeed. That's actually the only register of those being documented by Intel afaik. > If I read it right, the later condition tries to detect Linux which > fails nowadays but if you have acpi_rev_override in the command line (or > the machine is listed in acpi_rev_dmi_table) this check passes and does > some magic which is not clear to me. There is similar in PGON() side > which is used to turn the device back on. > > You can check what actually happens when _ON()/_OFF() is called by > passing something like below to the kernel command line: > > acpi.trace_debug_layer=0x80 acpi.trace_debug_level=0x10 acpi.trace_method_name=\_SB.PCI0.PEG0.PG00._ON acpi.trace_state=method > > (See also Documentation/firmware-guide/acpi/method-tracing.rst). > > Trace goes to system dmesg. This sounds to be very helpful, I'll give it a try.