Patch "ALSA: hda: avoid write to STATESTS if controller is in reset" has been added to the 4.4-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

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

to the 4.4-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     alsa-hda-avoid-write-to-statests-if-controller-is-in.patch
and it can be found in the queue-4.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit d73587b90058289c39bce137cdfb48544e0d4f5a
Author: Kai Vehmanen <kai.vehmanen@xxxxxxxxxxxxxxx>
Date:   Tue Oct 12 17:29:35 2021 +0300

    ALSA: hda: avoid write to STATESTS if controller is in reset
    
    [ Upstream commit b37a15188eae9d4c49c5bb035e0c8d4058e4d9b3 ]
    
    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@xxxxxxxxxxxxxxx>
    Link: https://lore.kernel.org/r/20211012142935.3731820-1-kai.vehmanen@xxxxxxxxxxxxxxx
    Signed-off-by: Takashi Iwai <tiwai@xxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/sound/hda/hdac_controller.c b/sound/hda/hdac_controller.c
index 4727f5b80e76..4ee3458ad810 100644
--- a/sound/hda/hdac_controller.c
+++ b/sound/hda/hdac_controller.c
@@ -288,8 +288,9 @@ static int azx_reset(struct hdac_bus *bus, bool full_reset)
 	if (!full_reset)
 		goto skip_reset;
 
-	/* clear STATESTS */
-	snd_hdac_chip_writew(bus, STATESTS, STATESTS_INT_MASK);
+	/* clear STATESTS if not in reset */
+	if (snd_hdac_chip_readb(bus, GCTL) & AZX_GCTL_RESET)
+		snd_hdac_chip_writew(bus, STATESTS, STATESTS_INT_MASK);
 
 	/* reset controller */
 	snd_hdac_bus_enter_link_reset(bus);



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux