Skip to content

Conversation

@jsarha
Copy link

@jsarha jsarha commented Oct 24, 2022

Its probably worth squashing this up a bit, especially now that I had to mangle Ranjani's commit quite a bit when solving sof-dev rebase conflicts. But maybe this is easier to review in pieces.

Both 16- and 32-bit audio works with this PR, but getting 44.1kHz need still some more work.

@RanderWang
Copy link

Could you give a full picture of solution ? How to use chain dma ? How to support in topology ? How does driver do to cooperate with topology?

@ranj063
Copy link
Collaborator

ranj063 commented Oct 25, 2022

@jsarha can you please squash the relevant patches and add descriptions? It is very hard to review it like this.

Also, IPC4 test fails spectacularly. So something is not right.

@jsarha
Copy link
Author

jsarha commented Oct 25, 2022

Here is the squashed up version, but there is still something severely wrong with normal playback, and I am in the middle of debugging it.

Copy link
Member

@plbossart plbossart left a comment

Choose a reason for hiding this comment

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

This is encouraging @jsarha, this PR needs more comments, background information and needs a bit of polishing.

I think we should really try the capture as well, this could be really really useful to hardware validation. In the end we would have
a) DSP-less
b) chained DMA
c) full firmware support with decoupled DMAs.

Copy link
Collaborator

@ujfalusi ujfalusi left a comment

Choose a reason for hiding this comment

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

@jsarha, this looks really good, few additional nit-picks, I can not see anything else apart from what has been asked.

@jsarha
Copy link
Author

jsarha commented Oct 27, 2022

All the issues found in the review are not yet addressed, but pushed the branch again to trigger CI tests to see if the nocodec problems persist.

@jsarha
Copy link
Author

jsarha commented Oct 27, 2022

I don't understand why details links lead to 404. Maybe another push will help. There is some more fixes this time too. I think this is the last unresolved issue: #3953 (comment)

@ranj063
Copy link
Collaborator

ranj063 commented Oct 27, 2022

I don't understand why details links lead to 404. Maybe another push will help. There is some more fixes this time too. I think this is the last unresolved issue: #3953 (comment)

01.org is down. Can you check the internal link @jsarha

ret = sof_set_widget_pipeline(sdev, spipe, swidget);
if (ret < 0)
return ret;
if (widget_ops[swidget->id].ipc_setup) {

Choose a reason for hiding this comment

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

add white space line before "if (widget_ops[swidget->id].ipc_setup) {"

RanderWang
RanderWang previously approved these changes Nov 30, 2022
@jsarha
Copy link
Author

jsarha commented Nov 30, 2022

Hmm. Just setting node_id to invalid does not appear to be enough:

Nov 30 09:09:17 jhary kernel: divide error: 0000 [#1] PREEMPT SMP NOPTI
Nov 30 09:09:17 jhary kernel: CPU: 0 PID: 1594 Comm: aplay Not tainted 6.1.0-rc6test-84170-g300fc52a0bc0 #246
Nov 30 09:09:17 jhary kernel: Hardware name: AAEON UPX-TGL01/UPX-TGL01, BIOS UXTGBM14 11/05/2021
Nov 30 09:09:17 jhary kernel: RIP: 0010:sof_ipc4_pcm_delay+0x192/0x1b0 [snd_sof]
Nov 30 09:09:17 jhary kernel: Code: 24 90 03 00 00 e8 6e 1b ff ff 48 8b 44 24 04 48 83 f8 ff 0f 84 5a ff ff ff 41 8b 4e 2c 41 0f b6 56 3c c1 e9 03 0f af ca 31 d2>
Nov 30 09:09:17 jhary kernel: RSP: 0018:ffffad030303bc10 EFLAGS: 00010246
Nov 30 09:09:17 jhary kernel: RAX: 2e79646165727766 RBX: ffff9d76c5da3000 RCX: 0000000000000000
Nov 30 09:09:17 jhary kernel: RDX: 0000000000000000 RSI: ffffad0301781040 RDI: ffffad030303bc24
Nov 30 09:09:17 jhary kernel: RBP: ffff9d76c707ca28 R08: ffffad030303bc14 R09: 0000000000000000
Nov 30 09:09:17 jhary kernel: R10: ffffad030303bd70 R11: 0000000000000001 R12: ffff9d76c35ce028
Nov 30 09:09:17 jhary kernel: R13: ffff9d76c5ee2a80 R14: ffff9d76c5cd2f00 R15: ffff9d76c5205028
Nov 30 09:09:17 jhary kernel: FS: 00007efd539c8440(0000) GS:ffff9d7843800000(0000) knlGS:0000000000000000
Nov 30 09:09:17 jhary kernel: CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
Nov 30 09:09:17 jhary kernel: CR2: 00007efd53e74008 CR3: 000000013569e001 CR4: 0000000000770ef0
Nov 30 09:09:17 jhary kernel: PKRU: 55555554
Nov 30 09:09:17 jhary kernel: Call Trace:
Nov 30 09:09:17 jhary kernel:
Nov 30 09:09:17 jhary kernel: snd_soc_pcm_component_delay+0x56/0xd0 [snd_soc_core]
Nov 30 09:09:17 jhary kernel: soc_pcm_pointer+0x5f/0xa0 [snd_soc_core]
Nov 30 09:09:17 jhary kernel: snd_pcm_update_hw_ptr0+0x4c/0x870 [snd_pcm]
Nov 30 09:09:17 jhary kernel: ? __snd_pcm_lib_xfer+0xcc/0x910 [snd_pcm]
Nov 30 09:09:17 jhary kernel: ? find_held_lock+0x32/0x90
Nov 30 09:09:17 jhary kernel: ? snd_pcm_hw_constraint_mask64+0x70/0x70 [snd_pcm]
Nov 30 09:09:17 jhary kernel: __snd_pcm_lib_xfer+0x84d/0x910 [snd_pcm]
Nov 30 09:09:17 jhary kernel: ? snd_pcm_hw_rule_step+0x100/0x100 [snd_pcm]
Nov 30 09:09:17 jhary kernel: ? _raw_spin_unlock_irqrestore+0x33/0x60
Nov 30 09:09:17 jhary kernel: ? __wake_up_common_lock+0x8a/0xc0
Nov 30 09:09:17 jhary kernel: snd_pcm_common_ioctl+0xca7/0x11c0 [snd_pcm]
Nov 30 09:09:17 jhary kernel: ? ioctl_has_perm.constprop.0+0xdb/0x140
Nov 30 09:09:17 jhary kernel: snd_pcm_ioctl+0x23/0x40 [snd_pcm]
Nov 30 09:09:17 jhary kernel: __x64_sys_ioctl+0x88/0xc0
Nov 30 09:09:17 jhary kernel: do_syscall_64+0x38/0x90
Nov 30 09:09:17 jhary kernel: entry_SYSCALL_64_after_hwframe+0x63/0xcd
Nov 30 09:09:17 jhary kernel: RIP: 0033:0x7efd53c323db
Nov 30 09:09:17 jhary kernel: Code: 0f 1e fa 48 8b 05 b5 7a 0d 00 64 c7 00 26 00 00 00 48 c7 c0 ff ff ff ff c3 66 0f 1f 44 00 00 f3 0f 1e fa b8 10 00 00 00 0f 05>
Nov 30 09:09:17 jhary kernel: RSP: 002b:00007ffe31a9b268 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
Nov 30 09:09:17 jhary kernel: RAX: ffffffffffffffda RBX: 000055f6040e7770 RCX: 00007efd53c323db
Nov 30 09:09:17 jhary kernel: RDX: 00007ffe31a9b270 RSI: 0000000040184150 RDI: 0000000000000004
Nov 30 09:09:17 jhary kernel: RBP: 000055f6040e76f0 R08: 0000000000000000 R09: 000055f6040e9720
Nov 30 09:09:17 jhary kernel: R10: 000055f6040c5010 R11: 0000000000000246 R12: 000055f6040e96d0
Nov 30 09:09:17 jhary kernel: R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000800
Nov 30 09:09:17 jhary kernel:
Nov 30 09:09:17 jhary kernel: Modules linked in: fuse snd_soc_skl_hda_dsp snd_soc_intel_hda_dsp_common snd_soc_hdac_hdmi snd_sof_ipc_msg_injector snd_sof_probes >
Nov 30 09:09:17 jhary kernel: e1000e xhci_pci mfd_core drm drm_panel_orientation_quirks xhci_hcd video wmi
Nov 30 09:09:17 jhary kernel: ---[ end trace 0000000000000000 ]---
Nov 30 09:09:17 jhary kernel: RIP: 0010:sof_ipc4_pcm_delay+0x192/0x1b0 [snd_sof]
Nov 30 09:09:17 jhary kernel: Code: 24 90 03 00 00 e8 6e 1b ff ff 48 8b 44 24 04 48 83 f8 ff 0f 84 5a ff ff ff 41 8b 4e 2c 41 0f b6 56 3c c1 e9 03 0f af ca 31 d2>
Nov 30 09:09:17 jhary kernel: RSP: 0018:ffffad030303bc10 EFLAGS: 00010246
Nov 30 09:09:17 jhary kernel: RAX: 2e79646165727766 RBX: ffff9d76c5da3000 RCX: 0000000000000000
Nov 30 09:09:17 jhary kernel: RDX: 0000000000000000 RSI: ffffad0301781040 RDI: ffffad030303bc24
Nov 30 09:09:17 jhary kernel: RBP: ffff9d76c707ca28 R08: ffffad030303bc14 R09: 0000000000000000
Nov 30 09:09:17 jhary kernel: R10: ffffad030303bd70 R11: 0000000000000001 R12: ffff9d76c35ce028
Nov 30 09:09:17 jhary kernel: R13: ffff9d76c5ee2a80 R14: ffff9d76c5cd2f00 R15: ffff9d76c5205028
Nov 30 09:09:17 jhary kernel: FS: 00007efd539c8440(0000) GS:ffff9d7843800000(0000) knlGS:0000000000000000
Nov 30 09:09:17 jhary kernel: CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
Nov 30 09:09:17 jhary kernel: CR2: 00007efd53e74008 CR3: 000000013569e001 CR4: 0000000000770ef0
Nov 30 09:09:17 jhary kernel: PKRU: 55555554

@jsarha
Copy link
Author

jsarha commented Nov 30, 2022

I do not see a single division in snd_soc_pcm_component_delay(), so where does the "divide error" come from?
... more coffee.

@jsarha
Copy link
Author

jsarha commented Nov 30, 2022

... one more time. @ujfalusi , @ranj063 , @plbossart , and @RanderWang , please review again.

@RanderWang
Copy link

RanderWang commented Nov 30, 2022

Hmm. Just setting node_id to invalid does not appear to be enough:

Nov 30 09:09:17 jhary kernel: divide error: 0000 [#1] PREEMPT SMP NOPTI Nov 30 09:09:17 jhary kernel: CPU: 0 PID: 1594 [snd_sof] Nov 30 09:09:17 jhary kernel: Code: 24 90 03 00 00 e8 6e 1b ff ff 48 8b 44 24 04 48 83 f8 ff 0f 84 5a ff ff ff 41 8b 4e 2c R12: ffff9d76c35ce028 Nov 30 09:09:17 jhary kernel: R13: ffff9d76c5ee2a80 R14: ffff9d76c5cd2f00 R15: ffff9d76c5205028 Nov 30 09:09:17 jhary kernel: FS: 00007efd539c8440(0000) GS:ffff9d7843800000(0000) knlGS:0000000000000000 Nov 30 09:09:17 jhary kernel: CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 Nov 30 09:09:17 jhary kernel: CR2: 00007efd53e74008 CR3: 000000013569e001 CR4: 0000000000770ef0 Nov 30 09:09:17 jhary kernel: PKRU: 55555554

@jsarha can you try #4050. Thanks!

@RanderWang
Copy link

@jsarha please skip the first commit since there is a fixup, thanks

@jsarha
Copy link
Author

jsarha commented Nov 30, 2022

@jsarha please skip the first commit since there is a fixup, thanks

Sure, I'll rebase as soon as #4050 is merged, and drop the first patch.

RanderWang
RanderWang previously approved these changes Nov 30, 2022
ujfalusi
ujfalusi previously approved these changes Nov 30, 2022
Copy link
Collaborator

@ujfalusi ujfalusi left a comment

Choose a reason for hiding this comment

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

@jsarha, looks good, one nitpcik of mine is the setting of bools in one line in sof_ipc4_chain_dma_trigger(), but nothing else.

ranj063 and others added 3 commits November 30, 2022 16:59
Set up the IPC structure for scheduler widgets and set the pipeline widget
before updating the IPC structures for all widgets. This will be needed to
look up pipeline information during IPC structure set up.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Jyri Sarha <jyri.sarha@intel.com>
In the chained DMA mode, the firmware allocates buffers for the host
and link DMA, and takes care of copying data between host- and
link-DMA buffers in a low-latency thread. This is different to a
regular pipeline, no processing is allowed, and the connection between
host- and link DMA is handled with a dedicated IPC.

This patch exposes the macros needed to create the required IPC messages.

Signed-off-by: Jyri Sarha <jyri.sarha@intel.com>
Add logic for setting up and tearing down chained DMA connections.

Since pipelines are not used, all the logic to set the pipeline states
can be bypassed, with only the DMA programming sequences remaining. In
addition the same format needs to be used for host- and link-DMA,
without the usual fixup to use the S32_LE format on the link.

Note however that for convenience and compatibility with existing
definitions, the topology relies on the concept of pipelines with a
'USE_CHAIN_DMA' token indicating that all the logic shall be bypassed.

Unlike 'normal' ALSA sequences, the chain DMA is not programmed in
hw_params/hw_free. The IPC message to set-up and tear-down chained DMA
are sent in sof_ipc4_trigger_pipelines(), but the contents prepared
earlier.

Chained DMA is only supported by the Intel HDA DAI for now, and only
S16_LE and S32_LE formats are supported for now.

Signed-off-by: Jyri Sarha <jyri.sarha@intel.com>
@jsarha
Copy link
Author

jsarha commented Nov 30, 2022

Now that #4050 is merged, there should nothing stopping from approving and merging this too (but I have been wrong many times before 😅) . @ujfalusi , @ranj063 , @plbossart , and @RanderWang , please review again.

@ranj063
Copy link
Collaborator

ranj063 commented Nov 30, 2022

Now that #4050 is merged, there should nothing stopping from approving and merging this too (but I have been wrong many times before sweat_smile) . @ujfalusi , @ranj063 , @plbossart , and @RanderWang , please review again.

Nice work and thanks for being patient with this one @jsarha.

@ranj063
Copy link
Collaborator

ranj063 commented Nov 30, 2022

SOFCI TEST

Copy link
Collaborator

@ujfalusi ujfalusi left a comment

Choose a reason for hiding this comment

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

@jsarha, thank you for the update, no more nitpicks from my side.

@ranj063 ranj063 merged commit f87fd63 into thesofproject:topic/sof-dev Dec 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants