All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 1/2] ALSA: hda: intel: Release i915 power also when delayed probe fails
@ 2026-11-20 15:09 Kai Vehmanen
  2026-11-20 15:09 ` [PATCH v2 2/2] ALSA: hda: intel: Remove unused free_on_error from azx_probe_continue() Kai Vehmanen
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Kai Vehmanen @ 2026-11-20 15:09 UTC (permalink / raw)
  To: linux-sound, tiwai, Peter Ujfalusi
  Cc: intel-gfx, kai.vehmanen, Michal Grzelak

Commit fbaccb1b19c7 ("ALSA: hda: intel: Don't free card in the probe
work") stopped freeing the card from azx_probe_work() when the delayed
probe fails, and only disconnects it, leaving the free to azx_remove().
This avoids the double free, but the resources that were released by
the card free via azx_free() are now kept until the PCI device is
unbound. In particular the display power reference stay held, blocking
runtime suspend for i915/xe.

Release the display power in the azx_probe_continue() work in all cases.
This power reference is only taken for the purpose of the display codec
probe. If the display codec probe was successful, it will have taken its
own reference. In case of systems with the HDA controller on GPU side
(hda->need_i915_power), functionality is same as before - we have to
keep power.

Fixes: fbaccb1b19c7 ("ALSA: hda: intel: Don't free card in the probe work")
Reported-by: Michal Grzelak <michal.grzelak@intel.com>
Link: https://gitlab.freedesktop.org/drm/i915/kernel/-/work_items/17751
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
---

Notes for V2:
 - Reduced the scope of change based sashikobot comments. In this version,
   only drop the display power reference taken for probing and do the change
   in in probe_continue(). Leave all the rest to azx_remove().
 - Add a second patch to remove unused code left after commit fbaccb1b19c7

 sound/hda/controllers/intel.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/sound/hda/controllers/intel.c b/sound/hda/controllers/intel.c
index 5a7dd69955d4..1f754f04eea8 100644
--- a/sound/hda/controllers/intel.c
+++ b/sound/hda/controllers/intel.c
@@ -2452,6 +2452,9 @@ static int azx_probe_continue(struct azx *chip, bool free_on_error)
 	}
 
 out_free:
+	if (!hda->need_i915_power)
+		display_power(chip, false);
+
 	if (err < 0) {
 		if (hda->vga_switcheroo_registered)
 			dev_warn(&pci->dev, "GPU sound probed, but not operational: please add a quirk to driver_denylist\n");
@@ -2462,8 +2465,6 @@ static int azx_probe_continue(struct azx *chip, bool free_on_error)
 		return err;
 	}
 
-	if (!hda->need_i915_power)
-		display_power(chip, false);
 	complete_all(&hda->probe_wait);
 	to_hda_bus(bus)->bus_probing = 0;
 	hda->probe_retry = 0;

base-commit: 1afd6b7547b2ff0824e91fdf269bbd089f767a5d
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH v2 2/2] ALSA: hda: intel: Remove unused free_on_error from azx_probe_continue()
  2026-11-20 15:09 [PATCH v2 1/2] ALSA: hda: intel: Release i915 power also when delayed probe fails Kai Vehmanen
@ 2026-11-20 15:09 ` Kai Vehmanen
  2026-11-20 19:09 ` ✓ i915.CI.BAT: success for series starting with [v2,1/2] ALSA: hda: intel: Release i915 power also when delayed probe fails Patchwork
  2026-11-22  8:24 ` [PATCH v2 1/2] " Takashi Iwai
  2 siblings, 0 replies; 4+ messages in thread
From: Kai Vehmanen @ 2026-11-20 15:09 UTC (permalink / raw)
  To: linux-sound, tiwai, Peter Ujfalusi; +Cc: intel-gfx, kai.vehmanen

Commit fbaccb1b19c7 ("ALSA: hda: intel: Don't free card in the probe
work") changed azx_probe_work() to pass false for the free_on_error
argument of azx_probe_continue(), and left freeing the card to
azx_remove(). That was the only caller that passed true, so the
argument is now always false and the code freeing the card on error is
dead.

Remove the argument and the dead code.

No functional change.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
---
 sound/hda/controllers/intel.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/sound/hda/controllers/intel.c b/sound/hda/controllers/intel.c
index 1f754f04eea8..acca8bb9ef0b 100644
--- a/sound/hda/controllers/intel.c
+++ b/sound/hda/controllers/intel.c
@@ -1184,7 +1184,7 @@ static const struct dev_pm_ops azx_pm = {
 };
 
 
-static int azx_probe_continue(struct azx *chip, bool free_on_error);
+static int azx_probe_continue(struct azx *chip);
 
 #ifdef SUPPORT_VGA_SWITCHEROO
 static struct pci_dev *get_bound_vga(struct pci_dev *pci);
@@ -1211,7 +1211,7 @@ static void azx_vs_set_state(struct pci_dev *pci,
 		if (!disabled) {
 			dev_info(chip->card->dev,
 				 "Start delayed initialization\n");
-			if (azx_probe_continue(chip, false) < 0) {
+			if (azx_probe_continue(chip) < 0) {
 				hda->init_failed = 1;
 				dev_err(chip->card->dev, "initialization error\n");
 			}
@@ -1739,7 +1739,7 @@ static void azx_probe_work(struct work_struct *work)
 {
 	struct hda_intel *hda = container_of(work, struct hda_intel, probe_work.work);
 
-	if (azx_probe_continue(&hda->chip, false) < 0) {
+	if (azx_probe_continue(&hda->chip) < 0) {
 		hda->init_failed = 1;
 		complete_all(&hda->probe_wait);
 		snd_card_disconnect(hda->chip.card);
@@ -2362,7 +2362,7 @@ static const unsigned int azx_max_codecs[AZX_NUM_DRIVERS] = {
 	[AZX_DRIVER_TERA] = 1,
 };
 
-static int azx_probe_continue(struct azx *chip, bool free_on_error)
+static int azx_probe_continue(struct azx *chip)
 {
 	struct hda_intel *hda = container_of(chip, struct hda_intel, chip);
 	struct hdac_bus *bus = azx_bus(chip);
@@ -2458,10 +2458,6 @@ static int azx_probe_continue(struct azx *chip, bool free_on_error)
 	if (err < 0) {
 		if (hda->vga_switcheroo_registered)
 			dev_warn(&pci->dev, "GPU sound probed, but not operational: please add a quirk to driver_denylist\n");
-		if (free_on_error) {
-			pci_set_drvdata(pci, NULL);
-			snd_card_free(chip->card);
-		}
 		return err;
 	}
 
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* ✓ i915.CI.BAT: success for series starting with [v2,1/2] ALSA: hda: intel: Release i915 power also when delayed probe fails
  2026-11-20 15:09 [PATCH v2 1/2] ALSA: hda: intel: Release i915 power also when delayed probe fails Kai Vehmanen
  2026-11-20 15:09 ` [PATCH v2 2/2] ALSA: hda: intel: Remove unused free_on_error from azx_probe_continue() Kai Vehmanen
@ 2026-11-20 19:09 ` Patchwork
  2026-11-22  8:24 ` [PATCH v2 1/2] " Takashi Iwai
  2 siblings, 0 replies; 4+ messages in thread
From: Patchwork @ 2026-11-20 19:09 UTC (permalink / raw)
  To: Kai Vehmanen; +Cc: intel-gfx

[-- Attachment #1: Type: text/plain, Size: 5506 bytes --]

== Series Details ==

Series: series starting with [v2,1/2] ALSA: hda: intel: Release i915 power also when delayed probe fails
URL   : https://patchwork.freedesktop.org/series/179218/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_19574 -> Patchwork_179218v1
====================================================

Summary
-------

  **SUCCESS**

  No regressions found.

  External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_179218v1/index.html

Participating hosts (39 -> 39)
------------------------------

  Additional (1): bat-adls-6 
  Missing    (1): bat-dg2-13 

Known issues
------------

  Here are the changes found in Patchwork_179218v1 that come from known issues:

### IGT changes ###

#### Issues hit ####

  * igt@gem_lmem_swapping@parallel-random-engines:
    - bat-adls-6:         NOTRUN -> [SKIP][1] ([i915#4613]) +3 other tests skip
   [1]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_179218v1/bat-adls-6/igt@gem_lmem_swapping@parallel-random-engines.html

  * igt@gem_tiled_pread_basic@basic:
    - bat-adls-6:         NOTRUN -> [SKIP][2] ([i915#15656])
   [2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_179218v1/bat-adls-6/igt@gem_tiled_pread_basic@basic.html

  * igt@intel_hwmon@hwmon-read:
    - bat-adls-6:         NOTRUN -> [SKIP][3] ([i915#7707]) +1 other test skip
   [3]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_179218v1/bat-adls-6/igt@intel_hwmon@hwmon-read.html

  * igt@kms_cursor_legacy@basic-busy-flip-before-cursor-legacy:
    - bat-adls-6:         NOTRUN -> [SKIP][4] ([i915#4103]) +1 other test skip
   [4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_179218v1/bat-adls-6/igt@kms_cursor_legacy@basic-busy-flip-before-cursor-legacy.html

  * igt@kms_dsc@dsc-basic:
    - bat-adls-6:         NOTRUN -> [SKIP][5] ([i915#16361])
   [5]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_179218v1/bat-adls-6/igt@kms_dsc@dsc-basic.html

  * igt@kms_force_connector_basic@force-load-detect:
    - bat-adls-6:         NOTRUN -> [SKIP][6] ([i915#17452])
   [6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_179218v1/bat-adls-6/igt@kms_force_connector_basic@force-load-detect.html

  * igt@kms_pm_backlight@basic-brightness:
    - bat-adls-6:         NOTRUN -> [SKIP][7] ([i915#5354])
   [7]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_179218v1/bat-adls-6/igt@kms_pm_backlight@basic-brightness.html

  * igt@kms_psr@psr-primary-mmap-gtt:
    - bat-adls-6:         NOTRUN -> [SKIP][8] ([i915#1072] / [i915#9732]) +3 other tests skip
   [8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_179218v1/bat-adls-6/igt@kms_psr@psr-primary-mmap-gtt.html

  * igt@kms_setmode@basic-clone-single-crtc:
    - bat-adls-6:         NOTRUN -> [SKIP][9] ([i915#3555])
   [9]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_179218v1/bat-adls-6/igt@kms_setmode@basic-clone-single-crtc.html

  * igt@prime_vgem@basic-fence-read:
    - bat-adls-6:         NOTRUN -> [SKIP][10] ([i915#17448] / [i915#3291]) +2 other tests skip
   [10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_179218v1/bat-adls-6/igt@prime_vgem@basic-fence-read.html

  
#### Possible fixes ####

  * igt@i915_pm_rpm@module-reload:
    - bat-arls-6:         [SKIP][11] ([i915#17751]) -> [PASS][12]
   [11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_19574/bat-arls-6/igt@i915_pm_rpm@module-reload.html
   [12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_179218v1/bat-arls-6/igt@i915_pm_rpm@module-reload.html
    - bat-arls-5:         [SKIP][13] ([i915#17751]) -> [PASS][14]
   [13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_19574/bat-arls-5/igt@i915_pm_rpm@module-reload.html
   [14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_179218v1/bat-arls-5/igt@i915_pm_rpm@module-reload.html
    - bat-jsl-5:          [FAIL][15] ([i915#17751]) -> [PASS][16]
   [15]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_19574/bat-jsl-5/igt@i915_pm_rpm@module-reload.html
   [16]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_179218v1/bat-jsl-5/igt@i915_pm_rpm@module-reload.html

  
  [i915#1072]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/1072
  [i915#15656]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/15656
  [i915#16361]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/16361
  [i915#17448]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/17448
  [i915#17452]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/17452
  [i915#17751]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/17751
  [i915#3291]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/3291
  [i915#3555]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/3555
  [i915#4103]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/4103
  [i915#4613]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/4613
  [i915#5354]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/5354
  [i915#7707]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/7707
  [i915#9732]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/9732


Build changes
-------------

  * Linux: CI_DRM_19574 -> Patchwork_179218v1

  CI-20190529: 20190529
  CI_DRM_19574: 90b50d97b3af2f55a75116f1ec76e0cf62914418 @ git://anongit.freedesktop.org/gfx-ci/linux
  IGT_9200: 9200
  Patchwork_179218v1: 90b50d97b3af2f55a75116f1ec76e0cf62914418 @ git://anongit.freedesktop.org/gfx-ci/linux

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_179218v1/index.html

[-- Attachment #2: Type: text/html, Size: 6523 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 1/2] ALSA: hda: intel: Release i915 power also when delayed probe fails
  2026-11-20 15:09 [PATCH v2 1/2] ALSA: hda: intel: Release i915 power also when delayed probe fails Kai Vehmanen
  2026-11-20 15:09 ` [PATCH v2 2/2] ALSA: hda: intel: Remove unused free_on_error from azx_probe_continue() Kai Vehmanen
  2026-11-20 19:09 ` ✓ i915.CI.BAT: success for series starting with [v2,1/2] ALSA: hda: intel: Release i915 power also when delayed probe fails Patchwork
@ 2026-11-22  8:24 ` Takashi Iwai
  2 siblings, 0 replies; 4+ messages in thread
From: Takashi Iwai @ 2026-11-22  8:24 UTC (permalink / raw)
  To: Kai Vehmanen
  Cc: linux-sound, tiwai, Peter Ujfalusi, intel-gfx, Michal Grzelak

On Fri, 20 Nov 2026 16:09:36 +0100,
Kai Vehmanen wrote:
> 
> Commit fbaccb1b19c7 ("ALSA: hda: intel: Don't free card in the probe
> work") stopped freeing the card from azx_probe_work() when the delayed
> probe fails, and only disconnects it, leaving the free to azx_remove().
> This avoids the double free, but the resources that were released by
> the card free via azx_free() are now kept until the PCI device is
> unbound. In particular the display power reference stay held, blocking
> runtime suspend for i915/xe.
> 
> Release the display power in the azx_probe_continue() work in all cases.
> This power reference is only taken for the purpose of the display codec
> probe. If the display codec probe was successful, it will have taken its
> own reference. In case of systems with the HDA controller on GPU side
> (hda->need_i915_power), functionality is same as before - we have to
> keep power.
> 
> Fixes: fbaccb1b19c7 ("ALSA: hda: intel: Don't free card in the probe work")
> Reported-by: Michal Grzelak <michal.grzelak@intel.com>
> Link: https://gitlab.freedesktop.org/drm/i915/kernel/-/work_items/17751
> Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>

Applied now.  Thanks.


Takashi

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-11-22  8:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-20 15:09 [PATCH v2 1/2] ALSA: hda: intel: Release i915 power also when delayed probe fails Kai Vehmanen
2026-11-20 15:09 ` [PATCH v2 2/2] ALSA: hda: intel: Remove unused free_on_error from azx_probe_continue() Kai Vehmanen
2026-11-20 19:09 ` ✓ i915.CI.BAT: success for series starting with [v2,1/2] ALSA: hda: intel: Release i915 power also when delayed probe fails Patchwork
2026-11-22  8:24 ` [PATCH v2 1/2] " Takashi Iwai

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.