Skip to content

audio: host: reload DMA when partial_size is non zero - #8743

Merged
lgirdwood merged 1 commit into
thesofproject:mainfrom
dnikodem:reload_dma_if_partial_size_non_zero
Jan 18, 2024
Merged

lgirdwood merged 1 commit into
thesofproject:mainfrom
dnikodem:reload_dma_if_partial_size_non_zero

Conversation

@dnikodem

Copy link
Copy Markdown
Contributor

When partial_size is non-zero and copy_bytes equals zero, the DMA buffer should be reloaded. Otherwise, the DMA status registers will indicate incorrect values.

@dnikodem
dnikodem force-pushed the reload_dma_if_partial_size_non_zero branch 2 times, most recently from b27051b to ba612d9 Compare January 16, 2024 11:29

@kv2019i kv2019i left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some comments inline, please check

Comment thread src/audio/host-zephyr.c
@@ -449,8 +449,20 @@ static int host_copy_normal(struct host_data *hd, struct comp_dev *dev, copy_cal
comp_dbg(dev, "host_copy_normal()");

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On the commit message, the git commit prefix should refer to the component changed, i.e. here "audio: host: ".

Could you explain a bit in which case this happens. "src" -> resampler case?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kai, thanks for feedback.
Regarding the commit message, I will make a correction to specify the component as "audio: host."

Regarding the scenario in which this could happen:
This condition typically occurs at the end of a stream, where the last data chunk does not meet the condition for reload DMA buffer (e.g., large buffers), leaving a non-zero partial_size.

Comment thread src/audio/host-zephyr.c

hd->partial_size = 0;
}
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to duplicate the logic at the end of the functions, so how about instaed:

if (copy_bytes)
     cb(dev, copy_bytes);

if (!hd->partial_bytes)
       return 0;

And let the existing code to call dma_reload at the end of the function.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dnikodem Ack, so above won't work with CONFIG_HOST_DMA_RELOAD_DELAY_ENABLE=y and if we get repeated calls copy_bytes==0 (stream is ending). So back to original version (with just the commit message clarified) is ok to me

@marc-hb

marc-hb commented Jan 16, 2024 •

Copy link
Copy Markdown
Collaborator

Another DSP panic on suspend/resume. We seem to somehow get better and collecting logs on suspend/resume failures as opposed to just TIMEOUTs.
https://sof-ci.01.org/sofpr/PR8743/build1905/devicetest/index.html?model=TGLU_RVP_NOCODEC-ipc4&testcase=check-suspend-resume-with-playback

Probably unrelated to this PR.

EDIT: looks similar to DSP panic #8721 which was bisected.
cc: @lyakh

2024-01-16 13:17:02 UTC [ERROR] Caught kernel log error
===========================>>
[ 5563.143539] kernel: sof-audio-pci-intel-tgl 0000:00:1f.3: ------------[ DSP dump start ]------------
[ 5563.143541] kernel: sof-audio-pci-intel-tgl 0000:00:1f.3: DSP panic!
[ 5563.143544] kernel: sof-audio-pci-intel-tgl 0000:00:1f.3: fw_state: SOF_FW_BOOT_COMPLETE (7)
[ 5563.143563] kernel: sof-audio-pci-intel-tgl 0000:00:1f.3: 0x00000005: module: ROM, state: FW_ENTERED, running
[ 5563.143771] kernel: sof-audio-pci-intel-tgl 0000:00:1f.3: FW is built with XCC toolchain
[ 5563.143775] kernel: sof-audio-pci-intel-tgl 0000:00:1f.3: error: DSP Firmware Oops
[ 5563.143777] kernel: sof-audio-pci-intel-tgl 0000:00:1f.3: EXCCAUSE 0x0000003f EXCVADDR 0x00000000 PS       0x00060e20 SAR     0x0000001b
[ 5563.143780] kernel: sof-audio-pci-intel-tgl 0000:00:1f.3: EPC1     0xbe059b87 EPC2     0x00000000 EPC3     0x00000000 EPC4    0x00000000
[ 5563.143784] kernel: sof-audio-pci-intel-tgl 0000:00:1f.3: EPC5     0x00000000 EPC6     0x00000000 EPC7     0x00000000 DEPC    0x00000000
[ 5563.143786] kernel: sof-audio-pci-intel-tgl 0000:00:1f.3: EPS2     0x00000000 EPS3     0x00000000 EPS4     0x00000000 EPS5    0x00000000
[ 5563.143789] kernel: sof-audio-pci-intel-tgl 0000:00:1f.3: EPS6     0x00000000 EPS7     0x00000000 INTENABL 0x00000000 INTERRU 0x00000000
[ 5563.143791] kernel: sof-audio-pci-intel-tgl 0000:00:1f.3: stack dump from 0x00000000
[ 5563.143793] kernel: sof-audio-pci-intel-tgl 0000:00:1f.3: AR registers:
[ 5563.143796] kernel: sof-audio-pci-intel-tgl 0000:00:1f.3: 0x0: be014ff8 be0b1580 00000004 be0b1590
[ 5563.143800] kernel: sof-audio-pci-intel-tgl 0000:00:1f.3: 0x10: be0b1570 00000004 9e0c40a4 ffffff7c
[ 5563.143802] kernel: sof-audio-pci-intel-tgl 0000:00:1f.3: 0x20: be0141b9 be0b14f0 be07cf4c be0b1590
[ 5563.143805] kernel: sof-audio-pci-intel-tgl 0000:00:1f.3: 0x30: be0141b9 be0b14f0 be07cf4c be0b1590
[ 5563.143807] kernel: sof-audio-pci-intel-tgl 0000:00:1f.3: ------------[ DSP dump end ]------------
[ 5563.643026] kernel: sof-audio-pci-intel-tgl 0000:00:1f.3: ipc timed out for 0x13000002|0x1
[ 5563.643033] kernel: sof-audio-pci-intel-tgl 0000:00:1f.3: ------------[ IPC dump start ]------------
[ 5563.643076] kernel: sof-audio-pci-intel-tgl 0000:00:1f.3: hda irq intsts 0x00000000 intlctl 0xc0000000 rirb 00
[ 5563.643078] kernel: sof-audio-pci-intel-tgl 0000:00:1f.3: dsp irq ppsts 0x00000000 adspis 0x00000000
[ 5563.643125] kernel: sof-audio-pci-intel-tgl 0000:00:1f.3: Host IPC initiator: 0x93000002|0x1|0x0, target: 0x0|0x0|0x80000000, ctl: 0x3
[ 5563.643126] kernel: sof-audio-pci-intel-tgl 0000:00:1f.3: ------------[ IPC dump end ]------------
[ 5563.643127] kernel: sof-audio-pci-intel-tgl 0000:00:1f.3: ------------[ DSP dump start ]------------
[ 5563.643128] kernel: sof-audio-pci-intel-tgl 0000:00:1f.3: IPC timeout
[ 5563.643129] kernel: sof-audio-pci-intel-tgl 0000:00:1f.3: fw_state: SOF_FW_CRASHED (8)
[ 5563.643152] kernel: sof-audio-pci-intel-tgl 0000:00:1f.3: 0x00000005: module: ROM, state: FW_ENTERED, running
[ 5563.643348] kernel: sof-audio-pci-intel-tgl 0000:00:1f.3: FW is built with XCC toolchain
[ 5563.643349] kernel: sof-audio-pci-intel-tgl 0000:00:1f.3: error: DSP Firmware Oops
[ 5563.643350] kernel: sof-audio-pci-intel-tgl 0000:00:1f.3: EXCCAUSE 0x0000003f EXCVADDR 0x00000000 PS       0x00060e20 SAR     0x0000001b
[ 5563.643351] kernel: sof-audio-pci-intel-tgl 0000:00:1f.3: EPC1     0xbe059b87 EPC2     0x00000000 EPC3     0x00000000 EPC4    0x00000000
[ 5563.643352] kernel: sof-audio-pci-intel-tgl 0000:00:1f.3: EPC5     0x00000000 EPC6     0x00000000 EPC7     0x00000000 DEPC    0x00000000
[ 5563.643353] kernel: sof-audio-pci-intel-tgl 0000:00:1f.3: EPS2     0x00000000 EPS3     0x00000000 EPS4     0x00000000 EPS5    0x00000000
[ 5563.643354] kernel: sof-audio-pci-intel-tgl 0000:00:1f.3: EPS6     0x00000000 EPS7     0x00000000 INTENABL 0x00000000 INTERRU 0x00000000
[ 5563.643355] kernel: sof-audio-pci-intel-tgl 0000:00:1f.3: stack dump from 0x00000000
[ 5563.643356] kernel: sof-audio-pci-intel-tgl 0000:00:1f.3: AR registers:
[ 5563.643357] kernel: sof-audio-pci-intel-tgl 0000:00:1f.3: 0x0: be014ff8 be0b1580 00000004 be0b1590
[ 5563.643358] kernel: sof-audio-pci-intel-tgl 0000:00:1f.3: 0x10: be0b1570 00000004 9e0c40a4 ffffff7c
[ 5563.643359] kernel: sof-audio-pci-intel-tgl 0000:00:1f.3: 0x20: be0141b9 be0b14f0 be07cf4c be0b1590
[ 5563.643360] kernel: sof-audio-pci-intel-tgl 0000:00:1f.3: 0x30: be0141b9 be0b14f0 be07cf4c be0b1590
[ 5563.643362] kernel: sof-audio-pci-intel-tgl 0000:00:1f.3: ------------[ DSP dump end ]------------
[ 5563.643397] kernel: sof-audio-pci-intel-tgl 0000:00:1f.3: failed to set final state 2 for all pipelines
[ 5569.739394] kernel: sof-audio-pci-intel-tgl 0000:00:1f.3: FW reported error: 9 - Specified resource not found
[ 5569.739579] kernel: sof-audio-pci-intel-tgl 0000:00:1f.3: ipc error for msg 0x13000003|0x1
[ 5569.739593] kernel: sof-audio-pci-intel-tgl 0000:00:1f.3: failed to pause all pipelines
[ 5569.739606] kernel: sof-audio-pci-intel-tgl 0000:00:1f.3: ASoC: error at soc_component_trigger on 0000:00:1f.3: -22

@marc-hb marc-hb added the suspend-resume Issues observed when doing system suspend and resume label Jan 16, 2024
This patch ensures that the DMA buffer is reloaded when
partial_size is non-zero, even if copy_bytes is zero.
This condition typically occurs at the end of a stream,
where the last data chunk does not meet the condition
for reload DMA buffer, leaving a non-zero partial_size.

Signed-off-by: Damian Nikodem <damian.nikodem@intel.com>
@dnikodem
dnikodem force-pushed the reload_dma_if_partial_size_non_zero branch from ba612d9 to bc7f5f3 Compare January 17, 2024 10:15

@kv2019i kv2019i left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @dnikodem !

@dnikodem dnikodem changed the title src: reload DMA when partial_size is non zero audio: host: reload DMA when partial_size is non zero Jan 18, 2024
@lgirdwood
lgirdwood merged commit 16b53b4 into thesofproject:main Jan 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

suspend-resume Issues observed when doing system suspend and resume

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants