Linux Sound subsystem development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Kai Vehmanen" <kai.vehmanen@linux.intel.com>,
	linux-sound@vger.kernel.org
Subject: Re: [PATCH] ALSA: hda: intel: Release i915 component when delayed probe fails
Date: Thu, 19 Nov 2026 16:45:51 +0000	[thread overview]
Message-ID: <sashiko-outbox-223560@kernel.org> (raw)
In-Reply-To: <20261119162253.1779252-1-kai.vehmanen@linux.intel.com>

Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Medium] ALSA: hda: intel: azx_probe_work() drops display power before
  stopping chip
- [Medium] ALSA: hda: intel: azx_probe_work() exits i915 while codecs
  remain registered
--

commit 8668fbf5bb132662ae06081f1c3f17768cfd79c9
Author: Kai Vehmanen <kai.vehmanen@linux.intel.com>

ALSA: hda: intel: Release i915 component when delayed probe fails

This commit releases display power and exits the i915 audio component in
azx_probe_work() when azx_probe_continue() fails, so the graphics driver
is not kept bound until azx_remove() frees the card.

Link: https://gitlab.freedesktop.org/drm/i915/kernel/-/work_items/17751

> diff --git a/sound/hda/controllers/intel.c b/sound/hda/controllers/intel.c
> index 0a62723b34549..73ff42faccb77 100644
> --- a/sound/hda/controllers/intel.c
> +++ b/sound/hda/controllers/intel.c
> @@ -1740,9 +1740,21 @@ 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) {
> +		struct azx *chip = &hda->chip;
> +
>  		hda->init_failed = 1;
>  		complete_all(&hda->probe_wait);
> -		snd_card_disconnect(hda->chip.card);
> +		snd_card_disconnect(chip->card);
> +
> +		/*
> +		 * The card itself is left to azx_remove() to free, but the
> +		 * graphics driver must not be kept bound to a controller that
> +		 * will never become operational; this would e.g. block
> +		 * unloading i915. Both calls are safe to repeat from azx_free().
> +		 */
> +		display_power(chip, false);
> +		if (chip->driver_caps & AZX_DCAPS_I915_COMPONENT)
> +			snd_hdac_i915_exit(azx_bus(chip));

[Severity: Medium]
Should the controller be stopped before dropping display power and exiting
the i915 component?

When azx_probe_continue() fails after azx_first_init() (for example in
azx_probe_codecs() or azx_codec_configure()), hda_intel_init_chip() has
already started CORB/RIRB DMA, enabled controller interrupts, and set
bus->chip_init = true.  Unlike __azx_shutdown_chip() and azx_free(), this
path releases display power while the controller is still running.

On platforms where the HDA controller sits in the GPU display power domain
(hda->need_i915_power), powering down the domain with DMA active leaves
bus->chip_init set, so when azx_remove() later runs azx_free(), it accesses
and polls controller MMIO registers after display power and the i915
component have already been released:

sound/hda/controllers/intel.c:azx_free() {
	...
	if (bus->chip_init) {
		azx_clear_irq_pending(chip);
		azx_stop_all_streams(chip);
		azx_stop_chip(chip);
	}
	...
}

[Severity: Medium]
Can exiting the i915 component here trigger WARN_ON(bus->display_power_active)
or leave codec devices registered on the bus without an audio component?

snd_card_disconnect() does not unregister or free SNDRV_DEV_CODEC devices.
If azx_probe_continue() fails in snd_hda_card_register() after
snd_hda_codec_register() has enabled per-codec display power via
snd_hda_codec_display_power(codec, true), display_power(chip, false) only
clears HDA_CODEC_IDX_CONTROLLER in bus->display_power_status.  The codec's
bit remains set until snd_card_free() runs in azx_remove(), so
snd_hdac_i915_exit() -> snd_hdac_acomp_exit() hits
WARN_ON(bus->display_power_active).

In addition, when azx_codec_configure() fails for all codecs (success == 0),
codec->core.dev stays registered on snd_hda_bus_type and in sysfs after
bus->audio_component is torn down, allowing late codec driver binding or
sysfs reconfig_codec() to run against a controller with no display power or
audio component.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261119162253.1779252-1-kai.vehmanen@linux.intel.com?part=1

      parent reply	other threads:[~2026-11-19 16:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-19 16:22 [PATCH] ALSA: hda: intel: Release i915 component when delayed probe fails Kai Vehmanen
2026-11-19 16:32 ` Michał Grzelak
2026-11-19 16:45 ` sashiko-bot [this message]

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=sashiko-outbox-223560@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=kai.vehmanen@linux.intel.com \
    --cc=linux-sound@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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