Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp391792ybz; Wed, 15 Apr 2020 10:41:28 -0700 (PDT) X-Google-Smtp-Source: APiQypLPjAJVr9GR76DwxVeYvdQZyIj1i/GbVzud0e1Xcv9/yjCbd0KBjNVsWYx5wXIi2ldlNylb X-Received: by 2002:aa7:cf83:: with SMTP id z3mr11953246edx.65.1586972488323; Wed, 15 Apr 2020 10:41:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586972488; cv=none; d=google.com; s=arc-20160816; b=bO8rQuJ1B0t552POXe31eAXqxUWFyfnopIsWpI+SQYD4fFheC936m/vG3gS3Cdzek7 ppw0GlpUDJSmILveLcGWIPFD3ImqlCDOJprAnoCiHx6Rgdv9A3Jn6hdw3hzW3FdYoUSC QJQs7Tnl9vVGoquVsT2CXvGKuGOkke8X6oCk63rWhHEiMkJUk4UmgKrhigRTeWwv5Qfh vNGRc1oj3dVdqmNGZBeNgkUQa84VkNSL+SZimaG3Qk14MXuCRjxpKzLASR9xW8Lpm/Z8 IVdCVu8tL0NaaJnJJZn0Wzs4aXx7zeEbuIXFiqhwVONjfE6/t7AdRpwZKNmZGGC0TzDq TL0Q== 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=clKAasY2jruMYThJXeyrINJualZ13i2YPWQVif+VJ2I=; b=bdX8KS5VayHfd9FRGDj1BGijgijpj7w/xNjWLr3z4HcBpTHJq1vViaJD0xmhmOxTTK pw3ZFEZp6WNOAo+aTbWRIPkU5B1+GeRA+W0d59rGwldaJGmqyrhBsnu0tAjhGo5GZd8g gu/TFP0NEfKthsHo5rd2BFukvo+UxfdB6ShOSVgWFnTzRHk9XxWn6WjfkXRlaX8X3FYh iifO2nuY0DBw9coHikHaYBA/UemQinLcXzKWb0KHrtDFr/nTJIwjk6EW+COllewWoJsA qSoebr6tZUjYff6iOxV8lT1Aw25W0IpCMhtXVjklng0lTxQp7YFPI1JI9KVjaWKxpr6g rMJg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for 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 w21si1438394edt.595.2020.04.15.10.41.04; Wed, 15 Apr 2020 10:41:28 -0700 (PDT) Received-SPF: pass (google.com: best guess record for 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: best guess record for 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 S2437297AbgDNJAC (ORCPT + 99 others); Tue, 14 Apr 2020 05:00:02 -0400 Received: from mga17.intel.com ([192.55.52.151]:58091 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2437280AbgDNI7z (ORCPT ); Tue, 14 Apr 2020 04:59:55 -0400 IronPort-SDR: OWTwU1xjVLqcg4ZyAc2E8iauy2D8NQFFAgIh3Qtx/WjYin6vwrODWfG+c/kipqDgoUZ1FWqSd3 TVk/LWTcP/2w== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga107.fm.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 Cc: Kate Stewart , Cezary Rojewski , linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com, Greg Kroah-Hartman , Takashi Iwai , Jie Yang , Pierre-Louis Bossart , Liam Girdwood , Richard Fontana , Mark Brown , Thomas Gleixner , Allison Randal 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 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.