[PATCH] ASoC: Intel: sst: ipc command timeout
Amadeusz Sławiński
amadeuszx.slawinski at linux.intel.com
Tue Apr 14 10:59:47 CEST 2020
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 <brent.lu at intel.com>
> ---
> 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.
More information about the Alsa-devel
mailing list