thesofproject / sof

Sound Open Firmware
Other
559 stars 317 forks source link

[FEATURE] Improve host input DMA start flow #7407

Open tlissows opened 1 year ago

tlissows commented 1 year ago

Is your feature request related to a problem? Please describe. Observing the problem of host-input DMA not starting of DMA traffic when using comp_host component from host-zephyr.c. An example of affected scenario is the following two-item pipeline configured for capture direction (scenario driven by existing test_02_uaol_capture.py script):

dai_uaol_output >>> host_input

In the example, the intel_adsp_hda_host_in Zephyr DMA device is used in direction DMA_DIR_LMEM_TO_HMEM. It looks, from behavior, that starting (or not) of DMA transfer is related to the order of two actions: setting of DGHISXCS.FIFORDY bit by SOF/Zephyr FW, and setting of ISDXCTL_B0.RUN bit by host SW:

With the existing version of SOF/Zephyr FW and python scripts, not working sequence occurs. This is because FIFORDY bit is set by Zephyr function intel_adsp_hda_enable(), which is called by dma_start() API function for intel_adsp_hda_host_in device. SOF calls to dma_start() within host_zephyr_trigger() when COMP_TRIGGER_START arrives. On the other hand, python script sets RUN bit after setting the pipeline to PAUSED state, but prior to the subsequent pipeline starting.

Describe the solution you'd like The issue could be fixed on FW side by preponed setting of FIFORDY bit (at the latest when component is entering PAUSED state). This solution is known from closed firmware, however it could not be confirmed in FAS if it is compliant with required/recommended flow.

Describe alternatives you've considered The issue could also be fixed on the script side by postponed setting of the RUN bit (until TRIGGER_START sent). This was used to on-hand confirm that inversed sequence really works.

lgirdwood commented 1 year ago

Adding @plbossart @ranj063 and @ujfalusi for alignment with driver DMA flow.

pblaszko commented 1 year ago

HDA DMA programming sequence in pipeline flows, coming from closed-source FW (obligatory to work properly with closed-source driver):

1. Pipeline create and start:

2. Pause/Resume:

3. Reset (XRUN):

4. Pipeline close:

fkwasowi commented 1 year ago

Setting the FIFORD bit to 1 in Zephyr/SOF (already in the dma_config() or dma_init() function) before setting the RUN bit did not solve the problem.

lgirdwood commented 1 year ago

@plbossart @ranj063 @ujfalusi pls see above - is kernel aligned ?

plbossart commented 1 year ago

I don't understand the ask at all

a) what doesn't work? Is this the USB offload or capturing from any interface? The latter seems surprising, we've been doing this for a long time.

b) what is the suggested solution? the last comment https://github.com/thesofproject/sof/issues/7407#issuecomment-1511068304 seems to suggest that playing with the FIFORDY before setting the RUN bit doesn't solve the problem.

I also don't get how this is a feature and not a bug. What are we trying to improve?

lgirdwood commented 1 year ago

@tlissows any update ? Will move to TBD milestone until direction is aligned.

lgirdwood commented 1 year ago

@mwasko @mmaka1 @marcinszkudlinski is there anything to be done here before v2.7 ?