Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp588853ybz; Wed, 15 Apr 2020 14:39:01 -0700 (PDT) X-Google-Smtp-Source: APiQypJwcMeiQ5G8ni6f/KnVBO8V2rZNGT6RN/imW3LTJKz4kYFWKF08j3hzsYLhiLE7MAfV0JsP X-Received: by 2002:a05:6402:22f7:: with SMTP id dn23mr27681195edb.167.1586986740960; Wed, 15 Apr 2020 14:39:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586986740; cv=none; d=google.com; s=arc-20160816; b=ZvDa+H8pkanB6SfqOCCfC6/7xBEYXksI5T5fVg3a696O8VIE2oUeViRdAGBL+gWHE/ +c2zu2HqfMm+6mYbzTqdD4e+pnX9qaNx327Nzdg9SM2WbQhCA5iLtNIbT9xCYK0youDA 8bVfKsasfZ6QgNRGF6/WM9HASfLpXpuWlApUp6eEJ24mNKRaw8V8Y1busTAs2ye/x13d DeoBLktElmamqmOMYVEQ+ARlXfX5PSuvBWzfXCk9wXj4C6OZhLir1BBlX45GXkDrXN9h 2r298paE5bhEVg9By18hdVrDVeyNq5lx7khSrhIRMhClJoj0cvfZXOCqVyMA5+rL+2Rj J17g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:ironport-sdr:ironport-sdr; bh=U9WVUqh6hQcCI8DBS8zlWNEoMmCyFJTrZa5upMaCXLk=; b=siGMa1kkIRWAhwwp0ZGbgCJOyI5S/s5dcKb3nMC2t1nR3pJUx8Xy0FE64NhZ+uz6UA fgqXXNYmf8KM0uPnbT2xlcfl++1RWqsHc5h+0Y8TajGwQZWLqQ3u/78t2srUu30k+Urg Db8kx1pjz6yfhHTjgAWl78Iw22XeG6xK/AWIhIkD8JbfJPmxiVMO+ZPiXxo0qn9mcpMD q8fa5Jo1Orwc18cs5u9iZAvMJHZe9MQbCf/+lkTFYyKyMJ9fZnT+LG0FtED45w4NnrVb UXtFEz20UTaOyB5loH48fBoYmMtZQZGDQe9BFs34jgwq7ytk+erehzKqF83GC1rRA/m1 c2Pw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id jr4si10737234ejb.114.2020.04.15.14.38.37; Wed, 15 Apr 2020 14:39:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2405170AbgDNOu3 (ORCPT + 99 others); Tue, 14 Apr 2020 10:50:29 -0400 Received: from mga04.intel.com ([192.55.52.120]:60134 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404893AbgDNOu1 (ORCPT ); Tue, 14 Apr 2020 10:50:27 -0400 IronPort-SDR: I+iW4+X83bVl2bFVTAE9e4ynnZh0nC9rRL8XLcAoqhpE6H+YNuhYNkS3pI3Z6YcZOZEDJveyC3 718uLcv2HpgA== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Apr 2020 07:50:26 -0700 IronPort-SDR: oa2zvcLMiMYunwJX3n9IURpRxFu+jBxtLqXxgNWnLVssizVt+6mI3tJD51M0AcDg3FlHIzddx0 hJZpPg6b0YGw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,382,1580803200"; d="scan'208";a="288238064" Received: from bjkulkar-mobl.amr.corp.intel.com (HELO [10.212.152.71]) ([10.212.152.71]) by fmsmga002.fm.intel.com with ESMTP; 14 Apr 2020 07:50:24 -0700 Subject: Re: [PATCH] ASoC: Intel: sst: ipc command timeout To: Brent Lu , alsa-devel@alsa-project.org Cc: Kate Stewart , Cezary Rojewski , linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com, Greg Kroah-Hartman , Takashi Iwai , Jie Yang , Liam Girdwood , Richard Fontana , Mark Brown , Thomas Gleixner , Allison Randal References: <1586506705-3194-1-git-send-email-brent.lu@intel.com> From: Pierre-Louis Bossart Message-ID: <4f495cf1-4740-cf3b-196f-cc850c503b43@linux.intel.com> Date: Tue, 14 Apr 2020 09:50:24 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1 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 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 4/10/20 3: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. I have mixed feelings about this. One one hand, this looks simple enough. But on the other hand we have other users of memcpy_fromio(), including SOF drivers, so what are the odds we have the same problems in other places? Wouldn't it be safer to either change this function so that it's behavior is not ambiguous or compiler-dependent, or fix the compiler? > > 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); >