dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: Lukas Wunner <lukas@wunner.de>
Cc: Martin Lopatar <lopin@dataplex.cz>,
	nouveau@lists.freedesktop.org, Maik Freudenberg <hhfeuer@gmx.de>,
	"Rafael J. Wysocki" <rafael.j.wysocki@intel.com>,
	Daniel Drake <dan@reactivated.net>,
	dri-devel@lists.freedesktop.org, zigarrre@gmail.com,
	Denis Lisov <dennis.lissov@gmail.com>,
	Alex Deucher <alexander.deucher@amd.com>,
	Peter Wu <peter@lekensteyn.nl>,
	linux-pci@vger.kernel.org, Bjorn Helgaas <bhelgaas@google.com>,
	Raphael Doursenaud <rdoursenaud@free.fr>
Subject: Re: [PATCH v2 0/7] Modernize vga_switcheroo by using device link for HDA
Date: Tue, 6 Mar 2018 11:29:40 +0100	[thread overview]
Message-ID: <20180306102940.GG22212@phenom.ffwll.local> (raw)
In-Reply-To: <cover.1520068884.git.lukas@wunner.de>

On Sat, Mar 03, 2018 at 10:53:24AM +0100, Lukas Wunner wrote:
> Modernize vga_switcheroo by using a device link to enforce a runtime PM
> dependency from an HDA controller to the GPU it's integrated into, v2.
> 
> Changes since v1:
> 
> - Replace patch [1/7] to use pci_save_state() / pci_restore_state()
>   for consistency between runtime PM code path of bound and unbound
>   devices. (Rafael, Bjorn)
> 
> - Patch [5/7]: Drop an unnecessary initialization. (Bjorn)
>   Rephrase error message on failed link addition for clarity.
> 
> Link to v1:
> https://www.spinics.net/lists/dri-devel/msg165889.html
> 
> Testing on more machines would be greatly appreciated, particularly
> Nvidia Optimus or AMD PowerXpress.
> 
> The series is based on 4.16-rc3.  To test it on 4.15, you need to
> cherry-pick 7506dc798993 and 2fa6d6cdaf28.  For your convenience
> I've pushed a 4.15-based branch to:
> https://github.com/l1k/linux/commits/switcheroo_devlink_v2
> 
> Minimal test procedure:
> 
> - Note well: Recent Optimus require that a Mini-DP or HDMI cable is
>   plugged in on boot for the HDA device to be present.
> 
> - Check that HDA, GPU and root port autosuspend when not in use:
>   cat /sys/bus/pci/devices/0000:01:00.1/power/runtime_status  # HDA
>   cat /sys/bus/pci/devices/0000:01:00.0/power/runtime_status  # GPU
>   cat /sys/bus/pci/devices/0000:00:01.0/power/runtime_status  # Root Port
> 
> - Check that all three autoresume when accessing the HDA:
>   hdajacksensetest -c 1
> 
> - Unbind the HDA controller:
>   echo 0000:01:00.1 > /sys/bus/pci/drivers/snd_hda_intel/unbind
>   Wait for GPU to power off, then rebind the HDA controller:
>   echo 0000:01:00.1 > /sys/bus/pci/drivers/snd_hda_intel/bind
>   Check dmesg for errors, try accessing HDA with hdajacksensetest.
> 
> - If your laptop uses the root port's _PR3 to cut power to the GPU:
>   Unbind the GPU:
>   echo 0000:01:00.0 > /sys/bus/pci/drivers/{nouveau,amdgpu,radeon}/unbind
>   Allow runtime PM on the GPU:
>   echo auto > /sys/bus/pci/devices/0000:01:00.0/power/control
>   Wait for GPU to power off, then rebind it:
>   echo 0000:01:00.0 > /sys/bus/pci/drivers/{nouveau,amdgpu,radeon}/bind
>   Check dmesg for errors.  If you see any then we may need to perform
>   further actions in pci_pm_runtime_resume(), see patch [1/7].

This all looks really reasonable and like a good cleanup, but it's a bit
too much detail so I'll punt review to someone else with more clue.
-Daniel

> 
> Thanks,
> 
> Lukas
> 
> 
> Lukas Wunner (6):
>   PCI: Make pci_wakeup_bus() & pci_bus_set_current_state() public
>   vga_switcheroo: Update PCI current_state on power change
>   vga_switcheroo: Deduplicate power state tracking
>   vga_switcheroo: Use device link for HDA controller
>   vga_switcheroo: Let HDA autosuspend on mux change
>   drm/nouveau: Runtime suspend despite HDA being unbound
> 
> Rafael J. Wysocki (1):
>   PCI: Restore config space on runtime resume despite being unbound
> 
>  drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c |   2 -
>  drivers/gpu/drm/nouveau/nouveau_drm.c   |  46 ----------
>  drivers/gpu/drm/nouveau/nouveau_drv.h   |   1 -
>  drivers/gpu/drm/radeon/radeon_drv.c     |   2 -
>  drivers/gpu/vga/vga_switcheroo.c        | 152 ++++++++------------------------
>  drivers/pci/pci-driver.c                |  17 ++--
>  drivers/pci/pci.c                       |   8 +-
>  drivers/pci/quirks.c                    |  39 ++++++++
>  include/linux/pci.h                     |   2 +
>  include/linux/pci_ids.h                 |   1 +
>  include/linux/vga_switcheroo.h          |   6 --
>  include/sound/hdaudio.h                 |   3 -
>  sound/pci/hda/hda_intel.c               |  36 +++++---
>  sound/pci/hda/hda_intel.h               |   3 -
>  14 files changed, 117 insertions(+), 201 deletions(-)
> 
> -- 
> 2.15.1
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  parent reply	other threads:[~2018-03-06 10:29 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-03  9:53 [PATCH v2 0/7] Modernize vga_switcheroo by using device link for HDA Lukas Wunner
2018-03-03  9:53 ` [PATCH v2 4/7] vga_switcheroo: Deduplicate power state tracking Lukas Wunner
     [not found] ` <cover.1520068884.git.lukas-JFq808J9C/izQB+pC5nmwQ@public.gmane.org>
2018-03-03  9:53   ` [PATCH v2 7/7] drm/nouveau: Runtime suspend despite HDA being unbound Lukas Wunner
2018-03-03  9:53   ` [PATCH v2 2/7] PCI: Make pci_wakeup_bus() & pci_bus_set_current_state() public Lukas Wunner
2018-03-03  9:53   ` [PATCH v2 1/7] PCI: Restore config space on runtime resume despite being unbound Lukas Wunner
     [not found]     ` <92fb6e6ae2730915eb733c08e2f76c6a313e3860.1520068884.git.lukas-JFq808J9C/izQB+pC5nmwQ@public.gmane.org>
2018-03-13 17:34       ` Bjorn Helgaas
2018-03-03  9:53   ` [PATCH v2 6/7] vga_switcheroo: Let HDA autosuspend on mux change Lukas Wunner
2018-03-03  9:53   ` [PATCH v2 3/7] vga_switcheroo: Update PCI current_state on power change Lukas Wunner
2018-03-03  9:53   ` [PATCH v2 5/7] vga_switcheroo: Use device link for HDA controller Lukas Wunner
2018-03-05 20:58   ` [PATCH v2 0/7] Modernize vga_switcheroo by using device link for HDA Peter Wu
2018-03-10  6:09     ` Lukas Wunner
2018-03-06 10:29 ` Daniel Vetter [this message]
2018-03-11 15:55   ` Lukas Wunner
2018-03-12 16:54     ` Daniel Vetter
2018-03-12 20:55       ` Lukas Wunner
2018-03-12 21:25         ` Takashi Iwai
2018-03-13 15:05         ` Daniel Vetter
2018-03-13 17:36     ` Bjorn Helgaas
2018-03-14  6:07     ` Lukas Wunner

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=20180306102940.GG22212@phenom.ffwll.local \
    --to=daniel@ffwll.ch \
    --cc=alexander.deucher@amd.com \
    --cc=bhelgaas@google.com \
    --cc=dan@reactivated.net \
    --cc=dennis.lissov@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=hhfeuer@gmx.de \
    --cc=linux-pci@vger.kernel.org \
    --cc=lopin@dataplex.cz \
    --cc=lukas@wunner.de \
    --cc=nouveau@lists.freedesktop.org \
    --cc=peter@lekensteyn.nl \
    --cc=rafael.j.wysocki@intel.com \
    --cc=rdoursenaud@free.fr \
    --cc=zigarrre@gmail.com \
    /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