linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Peter Wu <peter@lekensteyn.nl>
To: Lukas Wunner <lukas@wunner.de>
Cc: Bjorn Helgaas <helgaas@kernel.org>,
	"Rafael J. Wysocki" <rjw@rjwysocki.net>,
	Mika Westerberg <mika.westerberg@linux.intel.com>,
	Kilian Singer <kilian.singer@quantumtechnology.info>,
	linux-pci <linux-pci@vger.kernel.org>,
	Alex Deucher <alexander.deucher@amd.com>,
	Dave Airlie <airlied@redhat.com>
Subject: Re: PCI: Revert "PCI: Add runtime PM support for PCIe ports"
Date: Sat, 7 Jan 2017 12:35:10 +0100	[thread overview]
Message-ID: <20170107113510.GA10680@al> (raw)
In-Reply-To: <20170105144220.GA21446@wunner.de>

On Thu, Jan 05, 2017 at 03:42:20PM +0100, Lukas Wunner wrote:
> On Wed, Jan 04, 2017 at 10:09:54PM +0100, Peter Wu wrote:
> > [ Help/ideas are welcome, I suspect that these failures to restore power
> > on laptops designed for Win8+ all have the same cause, related to some
> > unknown interaction between ACPI and PCI. Some links:
> > https://bugzilla.kernel.org/show_bug.cgi?id=190861
> > https://bugzilla.kernel.org/show_bug.cgi?id=156341 ]
> 
> Looking at Kilian's acpidump again I notice that the methods to power
> the GPU on or off (GPON / GPOF) are called from two places:
> 
> - From the _PS0 and _PS3 methods of the GPU and
> - from the _PR3 power resource of the root port above the GPU.
> 
> In the former case they're called for pre Windows 2013 or if VDAD is true.
> In the latter case they're called unconditionally but GPOF becomes a no-op
> in the pre Windows 2013 case.
> 
> This means that GPOF would be executed *twice* on Windows 2013+ if VDAD
> is true.  I could imagine this to cause issues.

There is a flag "DGOS" which is set when PGON/PGOF are called, so
multiple invocations should not matter for the powerdown/up sequence.
There are some SMI calls though that might have side-effects though.

> VDAD is at 0x7CE7D018 + 0xEE2 + 6. It's not set in the DSDT.
> 
> @Kilian, what do you get if you execute this as root:
> 
> dd iflag=skip_bytes,count_bytes skip=$((0x7CE7D018 + 0xEE2 + 6)) count=1 \
>   if=/dev/mem 2>/dev/null | hexdump
> 
> Another oddity I've noticed is that when calling the Optimus DSM with
> the capabilities function number (0x1A, NOUVEAU_DSM_OPTIMUS_CAPS) and
> a special argument, it's possible to influence the behaviour of GPOF
> (the method to power the GPU off):  GPOF is a no-op unless it's running
> on Windows 2013+ or OMPR has value 0x03.  Initially OMPR has value 0x02,
> but by setting bits 18 and 19 in the argument given to the capabilities
> function, it can be set to 0x3.  After GPOF has finished, OMPR reverts
> back to 0x02.  This means that pre Windows 2013, GPOF only has any effect
> if the DSM capabilities function is called with an appropriate argument.

Pre-Windows 2013 (Win8), the DSM method was used to regulate power.
Value 3 means that _PS3 should power down the dGPU.  Value 2 means that
the platform should not do that.

Starting from Win8, PR3 is supported so this is used instead of DSM.

> The same functionality can be seen in the Clevo P651RA ssdt3/7.  What
> confuses me is that the bits are at position 18 and 19, but in
> nouveau_switcheroo_optimus_dsm() we're setting bits 0 and 1 as well as
> bits 24 and 25?  This may be a dumb question, I'm not familiar with
> Optimus, only Macs.

nouveau_switcheroo_optimus_dsm calls two different functions:

 - NOUVEAU_DSM_OPTIMUS_CAPS (0x1A) with bits 25:24 set (value 3 << 24).
   This enables powering down in _PS3.
 - NOUVEAU_DSM_OPTIMUS_FLAGS (0x1B) with bits 1:0 set (value 3).
   This enables the "dGPU audio codec flag" via SMI.

When the old DSM method is in use, these functions are always invoked
before _PS3.
-- 
Kind regards,
Peter Wu
https://lekensteyn.nl

  parent reply	other threads:[~2017-01-07 11:35 UTC|newest]

Thread overview: 115+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-27 23:57 PCI: Revert "PCI: Add runtime PM support for PCIe ports" Bjorn Helgaas
2016-12-28  9:17 ` Mika Westerberg
2016-12-28 11:29 ` Lukas Wunner
2016-12-28 16:18   ` Bjorn Helgaas
2016-12-29  9:58     ` Kilian Singer
2016-12-29 16:02       ` Kilian Singer
2016-12-29 16:20         ` Kilian Singer
2016-12-29 17:50           ` Lukas Wunner
2016-12-29 22:52             ` Kilian Singer
2016-12-29 23:02               ` Kilian Singer
2016-12-29 23:05                 ` Kilian Singer
2016-12-29 23:48               ` Lukas Wunner
2016-12-29 23:20             ` Kilian Singer
2016-12-30  0:07               ` Lukas Wunner
2016-12-30  0:16                 ` Kilian Singer
2016-12-30  0:24                   ` Kilian Singer
2016-12-30  0:22                     ` Rafael J. Wysocki
2016-12-30  0:39                       ` Kilian Singer
2016-12-30  0:41                         ` Rafael J. Wysocki
2016-12-30  0:45                       ` Kilian Singer
2016-12-30  1:40                         ` Rafael J. Wysocki
2016-12-30  1:50                           ` Rafael J. Wysocki
2016-12-30  1:52                             ` Rafael J. Wysocki
2016-12-30 13:37                               ` Kilian Singer
2016-12-30 13:59                                 ` Kilian Singer
2016-12-30 14:44                                   ` Rafael J. Wysocki
2016-12-30 14:47                                 ` Rafael J. Wysocki
2017-01-02 12:22                                   ` Mika Westerberg
2017-01-03 17:12                                     ` Kilian Singer
2017-01-02 11:40                   ` Lukas Wunner
2017-01-02 12:10                     ` Mika Westerberg
2017-01-02 13:53                       ` Mika Westerberg
2017-01-02 14:48                       ` Mika Westerberg
2017-01-02 21:31                         ` Rafael J. Wysocki
2017-01-03  9:51                           ` Mika Westerberg
2017-01-03 15:15                             ` Peter Wu
2017-01-03 16:11                               ` Lukas Wunner
2017-01-03 16:31                                 ` Peter Wu
2017-01-03 16:44                                   ` Deucher, Alexander
2017-01-03 18:09                                   ` Lukas Wunner
2017-01-03 18:12                                   ` Bjorn Helgaas
2017-01-03 21:38                                     ` Rafael J. Wysocki
2017-01-03 21:52                                       ` Kilian Singer
2017-01-03 22:07                                         ` Rafael J. Wysocki
2017-01-03 22:25                                           ` Kilian Singer
2017-01-03 22:25                                       ` Bjorn Helgaas
2017-01-03 23:13                                         ` Rafael J. Wysocki
2017-01-04  0:05                                           ` Bjorn Helgaas
2017-01-04  1:09                                             ` Rafael J. Wysocki
2017-01-04  8:16                                             ` Lukas Wunner
2017-01-04 10:33                                               ` Kilian Singer
2017-01-04 12:29                                                 ` Mika Westerberg
2017-01-04 15:50                                               ` Deucher, Alexander
2017-01-04 21:09                                               ` Peter Wu
2017-01-04 21:58                                                 ` Rafael J. Wysocki
2017-01-04 23:21                                                   ` David Airlie
2017-01-05 15:06                                                     ` Lukas Wunner
2017-01-05 18:13                                                       ` Peter Jones
2017-01-05 19:36                                                         ` David Airlie
2017-01-09 15:11                                                           ` Lyude Paul
2017-01-09 15:21                                                             ` Hans de Goede
2017-01-09 18:48                                                               ` Kilian Singer
2017-01-10  0:33                                                                 ` David Airlie
2017-01-10  9:17                                                                   ` Kilian Singer
2017-01-12 18:10                                                                     ` Lyude Paul
2017-01-24  4:59                                                                       ` Lukas Wunner
2017-01-24 19:09                                                                         ` Lyude Paul
2017-01-11 20:40                                                               ` Lyude Paul
2017-01-12  1:13                                                                 ` Lyude Paul
2017-01-12  2:04                                                                   ` Lyude Paul
2017-01-12  2:12                                                                     ` Lukas Wunner
2017-01-17 15:55                                                                       ` Mika Westerberg
2017-01-17 18:06                                                                         ` Lyude Paul
2017-01-17 19:10                                                                           ` Bjorn Helgaas
2017-01-17 19:49                                                                             ` Lyude Paul
2017-01-07 11:45                                                       ` Hans de Goede
2017-01-07 12:16                                                         ` Lukas Wunner
2017-01-09 23:00                                                         ` Peter Jones
2017-01-10  0:17                                                           ` David Airlie
2017-01-10  1:24                                                             ` Lukas Wunner
2017-01-10  2:15                                                               ` David Airlie
2017-01-11 11:04                                                       ` Hans de Goede
2017-01-11 13:24                                                         ` Kilian Singer
2017-01-11 13:26                                                           ` Hans de Goede
2017-01-11 16:24                                                             ` Peter Jones
2017-01-11 19:20                                                               ` Kilian Singer
2017-01-05 10:49                                                   ` Mika Westerberg
2017-01-05 14:19                                                     ` Rafael J. Wysocki
2017-01-05 14:20                                                     ` Mika Westerberg
2017-01-05 14:23                                                       ` Rafael J. Wysocki
2017-01-05 14:42                                                 ` Lukas Wunner
2017-01-06  1:21                                                   ` Rafael J. Wysocki
2017-01-07  6:50                                                     ` Mika Westerberg
2017-01-07 11:35                                                   ` Peter Wu [this message]
2017-01-07 12:19                                                     ` Lukas Wunner
2017-01-07 12:36                                                       ` Peter Wu
2017-01-08 14:05                                                         ` Lukas Wunner
2017-01-04 21:55                                               ` Rafael J. Wysocki
2017-01-03 21:26                                 ` Rafael J. Wysocki
2017-01-03 17:37                               ` Kilian Singer
2017-01-03 17:10                       ` Kilian Singer
2017-01-03 16:59                     ` Kilian Singer
2017-01-03 17:08                     ` Kilian Singer
2016-12-30  0:19     ` Rafael J. Wysocki
2016-12-30 14:48       ` Rafael J. Wysocki
2017-01-17 14:56 ` Bjorn Helgaas
2017-01-17 15:49   ` Kilian Singer
2017-01-23 20:33   ` Bjorn Helgaas
2017-01-23 21:12     ` Mika Westerberg
2017-01-24  4:53       ` Lukas Wunner
2017-01-24 20:01       ` Bjorn Helgaas
2017-01-25  9:48         ` Mika Westerberg
2017-01-25 16:05           ` Kilian Singer
2017-01-25 16:31             ` Mika Westerberg
2017-01-25 17:58 ` Bjorn Helgaas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170107113510.GA10680@al \
    --to=peter@lekensteyn.nl \
    --cc=airlied@redhat.com \
    --cc=alexander.deucher@amd.com \
    --cc=helgaas@kernel.org \
    --cc=kilian.singer@quantumtechnology.info \
    --cc=linux-pci@vger.kernel.org \
    --cc=lukas@wunner.de \
    --cc=mika.westerberg@linux.intel.com \
    --cc=rjw@rjwysocki.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).