[PATCH] ALSA: hda: avoid write to STATESTS if controller is in reset

Takashi Iwai tiwai at suse.de
Tue Oct 12 17:00:35 CEST 2021


On Tue, 12 Oct 2021 16:29:35 +0200,
Kai Vehmanen wrote:
> 
> The snd_hdac_bus_reset_link() contains logic to clear STATESTS register
> before performing controller reset. This code dates back to an old
> bugfix in commit e8a7f136f5ed ("[ALSA] hda-intel - Improve HD-audio
> codec probing robustness"). Originally the code was added to
> azx_reset().
> 
> The code was moved around in commit a41d122449be ("ALSA: hda - Embed bus
> into controller object") and ended up to snd_hdac_bus_reset_link() and
> called primarily via snd_hdac_bus_init_chip().
> 
> The logic to clear STATESTS is correct when snd_hdac_bus_init_chip() is
> called when controller is not in reset. In this case, STATESTS can be
> cleared. This can be useful e.g. when forcing a controller reset to retry
> codec probe. A normal non-power-on reset will not clear the bits.
> 
> However, this old logic is problematic when controller is already in
> reset. The HDA specification states that controller must be taken out of
> reset before writing to registers other than GCTL.CRST (1.0a spec,
> 3.3.7). The write to STATESTS in snd_hdac_bus_reset_link() will be lost
> if the controller is already in reset per the HDA specification mentioned.
> 
> This has been harmless on older hardware. On newer generation of Intel
> PCIe based HDA controllers, if configured to report issues, this write
> will emit an unsupported request error. If ACPI Platform Error Interface
> (APEI) is enabled in kernel, this will end up to kernel log.
> 
> Fix the code in snd_hdac_bus_reset_link() to only clear the STATESTS if
> the function is called when controller is not in reset. Otherwise
> clearing the bits is not possible and should be skipped.
> 
> Signed-off-by: Kai Vehmanen <kai.vehmanen at linux.intel.com>

Do we have a bug reference?  I guess it worth to be pushed to 5.15-rc
and Cc-to-stable, if this is hitting already on the recent machines.


thanks,

Takashi


More information about the Alsa-devel mailing list