Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 85FF4C433F5 for ; Tue, 12 Oct 2021 15:01:42 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4E58761076 for ; Tue, 12 Oct 2021 15:01:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 4E58761076 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=suse.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 446D51674; Tue, 12 Oct 2021 17:00:49 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 446D51674 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1634050899; bh=J8SxJ2IDiRWUQfFSIWkUXX1hM4+FxMKUS+bFyBEq9rc=; h=Date:From:To:Subject:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=QY6vtf/IHPsptJG24z7/2rftZQrtlltV3IqWU6VbOJaRdX73voeXn3oEfxndfKEfU SgAUuaN6LQzUUbYbYq++RQBFXJg0B+TzW2LpVkaT+eV28Va4wrCsymx+7RkyDoId85 CmqST7U/9AoMIRTd1MVR+pdB1LnYr1VyWJ06frVA= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id C6B41F80088; Tue, 12 Oct 2021 17:00:48 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 67837F80212; Tue, 12 Oct 2021 17:00:47 +0200 (CEST) Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 3D05AF80088 for ; Tue, 12 Oct 2021 17:00:35 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 3D05AF80088 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="mLJt7iFo"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="JlDl3bza" Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 4C351220DA; Tue, 12 Oct 2021 15:00:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1634050835; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=ZePrqKFR1RZclZto78JKGTIg+B+naGQR4MKau6L7rqM=; b=mLJt7iFoT0U5xktfjJnIXIz6vyfnI7i2/8uUHnO8rNLEybaULwdmCV1eEsaIfbmSl/GcM4 Ad8C1PPWM1x4bOZEjK/McOXZ0LuxjUEIor55blxIs4pqLnoSmdSrbxGaDbk0MR5DwBiKtN lR3UJKIF13o/xji4ezPLhxA9dEggKiE= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1634050835; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=ZePrqKFR1RZclZto78JKGTIg+B+naGQR4MKau6L7rqM=; b=JlDl3bzaXZDvfCHD23bw8uoEAsNVIYb0WruO5r9sbwmyU9PdLYcqR/NZ2s1ZlCgYnZSyRg ezwBvJ9zSqCkVSBg== Received: from alsa1.suse.de (alsa1.suse.de [10.160.4.42]) by relay2.suse.de (Postfix) with ESMTP id 36EF8A3B85; Tue, 12 Oct 2021 15:00:35 +0000 (UTC) Date: Tue, 12 Oct 2021 17:00:35 +0200 Message-ID: From: Takashi Iwai To: Kai Vehmanen Subject: Re: [PATCH] ALSA: hda: avoid write to STATESTS if controller is in reset In-Reply-To: <20211012142935.3731820-1-kai.vehmanen@linux.intel.com> References: <20211012142935.3731820-1-kai.vehmanen@linux.intel.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.8 Emacs/25.3 (x86_64-suse-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Cc: alsa-devel@alsa-project.org, Danny Tholen , pierre-louis.bossart@linux.intel.com, ranjani.sridharan@linux.intel.com, Alex Deucher , Dmitry Osipenko , Thierry Reding X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" 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 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