From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.2 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2BEA8C2BA19 for ; Tue, 14 Apr 2020 09:00:58 +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 AC983206D5 for ; Tue, 14 Apr 2020 09:00:57 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="bU6eVUjo" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AC983206D5 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@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 F2DA61680; Tue, 14 Apr 2020 11:00:05 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz F2DA61680 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1586854856; bh=/pG6LtNHP3OkEtun23stZHjuj+LWbBGXDhFFDIqCCW8=; h=Subject:To:References:From:Date:In-Reply-To:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=bU6eVUjobW7ijeKmC9w4FIvZyjGHk8mi7GFqpqp8m+eB93IFJ9yxrT2ZOzLG9+w0V /9cu7HU4VHpILC0jvcMPBP3VdO9N0Pme+7JPdOfd4EfkEvW/edWM4SnTJ1qXGceMjb ue4tu2d40MXCEPIE9JlMCPBiB+Tj+lDI0NZJ8hKA= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 2A1DCF80126; Tue, 14 Apr 2020 11:00:05 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 73CBCF800F5; Tue, 14 Apr 2020 11:00:01 +0200 (CEST) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id E32C7F800F5 for ; Tue, 14 Apr 2020 10:59:57 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz E32C7F800F5 IronPort-SDR: TMo++OnPzkldiz51u/49vzsMJD44WIGpZQkOWN2HpIssL+iCffO5V3ePQYolCiDtb7rRMihl1Z I0BaZxmFa1ZA== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Apr 2020 01:59:54 -0700 IronPort-SDR: nTRY4F9FYKyL9PfVM6xsZ5/9u0TRKVZNswM5DrPWZ0E9d8IIUx3Jnr5XWmaDCrn73Jj4aa20Gd 101o5HYFttVQ== X-IronPort-AV: E=Sophos;i="5.72,382,1580803200"; d="scan'208";a="253141691" Received: from aslawinx-mobl1.ger.corp.intel.com (HELO [10.249.141.95]) ([10.249.141.95]) by orsmga003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Apr 2020 01:59:50 -0700 Subject: Re: [PATCH] ASoC: Intel: sst: ipc command timeout To: Brent Lu , alsa-devel@alsa-project.org References: <1586506705-3194-1-git-send-email-brent.lu@intel.com> From: =?UTF-8?Q?Amadeusz_S=c5=82awi=c5=84ski?= Message-ID: Date: Tue, 14 Apr 2020 10:59:47 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.6.0 MIME-Version: 1.0 In-Reply-To: <1586506705-3194-1-git-send-email-brent.lu@intel.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Cc: Kate Stewart , Pierre-Louis Bossart , Cezary Rojewski , Richard Fontana , Greg Kroah-Hartman , Jie Yang , Takashi Iwai , linux-kernel@vger.kernel.org, Liam Girdwood , clang-built-linux@googlegroups.com, Mark Brown , Thomas Gleixner , Allison Randal 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 4/10/2020 10:18 AM, Brent Lu wrote: > After sending an ipc command to DSP, the host waits for the reply message > which will be read from SST_IPCD register in sst_byt_irq_thread() to > complete the transaction. Sometimes the value read from SST_IPCD register > is still the reply message for previous command instead of the waiting > command so ipc command timeout happens. > > In an experiment we read the same SST_IPCD register again when the defect > happens and found the value of second read is different from previous one > and is the correct reply message. It suggests the DSP is okay but the way > we read the register may be the cause. > > Currently the driver is using memcpy_fromio() to read the value of 64-bit > registers. This function is based on __builtin_memcpy() call and depends > on the implementation of compiler. Since this issue happens right after > the toolchain switched from clang 10 to clang 11, we replace the register > read with two readl() function calls to avoid all optimization from > compiler's library. > > Signed-off-by: Brent Lu > --- > sound/soc/intel/common/sst-dsp.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/sound/soc/intel/common/sst-dsp.c b/sound/soc/intel/common/sst-dsp.c > index ec66be2..12af7aa 100644 > --- a/sound/soc/intel/common/sst-dsp.c > +++ b/sound/soc/intel/common/sst-dsp.c > @@ -42,7 +42,7 @@ u64 sst_shim32_read64(void __iomem *addr, u32 offset) > { > u64 val; > > - memcpy_fromio(&val, addr + offset, sizeof(val)); > + sst_memcpy_fromio_32(NULL, &val, addr + offset, sizeof(val)); > return val; > } > EXPORT_SYMBOL_GPL(sst_shim32_read64); > I'm not convinced that it is a correct fix. From your description it seems to be a timing issue and you are just masking a problem, while real problem is flow which allows to read data before confirming that DSP finished processing.