lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <871q1ygov9.wl-tiwai@suse.de>
Date: Thu, 05 Sep 2024 16:24:26 +0200
From: Takashi Iwai <tiwai@...e.de>
To: Maxim Mikityanskiy <maxtram95@...il.com>
Cc: Jaroslav Kysela <perex@...ex.cz>,
	Takashi Iwai <tiwai@...e.com>,
	Pierre-Louis Bossart <pierre-louis.bossart@...ux.intel.com>,
	Kai Vehmanen <kai.vehmanen@...ux.intel.com>,
	Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
	Peter Ujfalusi <peter.ujfalusi@...ux.intel.com>,
	Chaitanya Kumar Borah <chaitanya.kumar.borah@...el.com>,
	Rui Salvaterra <rsalvaterra@...il.com>,
	Sui Jingfeng <suijingfeng@...ngson.cn>,
	Bjorn Helgaas <bhelgaas@...gle.com>,
	Peter Wu <peter@...ensteyn.nl>,
	Lukas Wunner <lukas@...ner.de>,
	linux-sound@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] ALSA: hda: intel: Fix Optimus when GPU has no sound

On Wed, 04 Sep 2024 22:39:55 +0200,
Maxim Mikityanskiy wrote:
> 
> Lenovo IdeaPad Z570 with NVIDIA GeForce Ge 520M doesn't have sound on
> the discrete GPU. snd_hda_intel probes the device and schedules
> azx_probe_continue(), which fails at azx_first_init(). The driver ends
> up probed, but calls azx_free() and stops the chip. However, from the
> runtime PM point of view, the device remains active, because the PCI
> subsystem makes it active on probe, and it's still bound. It prevents
> vga_switcheroo from turning off the DGPU (pci_create_device_link() syncs
> power management for the video and audio devices).
> 
> Fix it by forcing the device to the suspended state in azx_free().
> 
> Fixes: 07f4f97d7b4b ("vga_switcheroo: Use device link for HDA controller")
> Signed-off-by: Maxim Mikityanskiy <maxtram95@...il.com>

What if this device probe is skipped (e.g. adding your device entry to
driver_denylist[] in hda_intel.c)?  Is the device also in the
runtime-suspended state?


thanks,

Takashi

> ---
>  sound/pci/hda/hda_intel.c | 14 +++++++++++++-
>  1 file changed, 13 insertions(+), 1 deletion(-)
> 
> diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
> index b79020adce63..65fcb92e11c7 100644
> --- a/sound/pci/hda/hda_intel.c
> +++ b/sound/pci/hda/hda_intel.c
> @@ -1361,8 +1361,20 @@ static void azx_free(struct azx *chip)
>  	if (use_vga_switcheroo(hda)) {
>  		if (chip->disabled && hda->probe_continued)
>  			snd_hda_unlock_devices(&chip->bus);
> -		if (hda->vga_switcheroo_registered)
> +		if (hda->vga_switcheroo_registered) {
>  			vga_switcheroo_unregister_client(chip->pci);
> +
> +			/* Some GPUs don't have sound, and azx_first_init fails,
> +			 * leaving the device probed but non-functional. As long
> +			 * as it's probed, the PCI subsystem keeps its runtime
> +			 * PM status as active. Force it to suspended (as we
> +			 * actually stop the chip) to allow GPU to suspend via
> +			 * vga_switcheroo.
> +			 */
> +			pm_runtime_disable(&pci->dev);
> +			pm_runtime_set_suspended(&pci->dev);
> +			pm_runtime_enable(&pci->dev);
> +		}
>  	}
>  
>  	if (bus->chip_init) {
> -- 
> 2.46.0
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ