Repository navigation
ASoC: Intel: update pcm_params to provide proper period size to FW - #1037
Conversation
keyonjie
left a comment
There was a problem hiding this comment.
- fix your subject for each commit, please refer to what others do.
- the change to host_period_bytes is wrong.
- better to rename irq_mode to period_irq_mode or similar one.
- only 2 commits needed: 1, add period_irq_mode flag to struct(and maybe minor abi version bump needed?). 2. change to use the new struct in one shot(single commit).
plbossart
left a comment
There was a problem hiding this comment.
This is an ABI change...
Please fix all your commits to start with 'ASoC: SOF: Intel" or "ASoC: SOF: ipc" if it's not Intel-specific
the part on no_irq mode is very controversial and I don't know why you need a period if you use the no-irq mode. Something is not quite right there.
|
|
||
| /* for notifying host period has completed - 0 means no period IRQ */ | ||
| uint32_t host_period_bytes; | ||
| uint32_t irq_mode; /* 1 means IRQ mode ON */ |
There was a problem hiding this comment.
you've wasting an entire 32-bit field for a boolean. Maybe use 16 bits and add another 16-bit as reserved?
There was a problem hiding this comment.
@plbossart, yes good suggestion. I have just updated.
| /* set host_period_bytes to 0 if no IPC position */ | ||
| if (hda && hda->no_ipc_position) | ||
| ipc_params->host_period_bytes = 0; | ||
| ipc_params->irq_mode = 0; |
There was a problem hiding this comment.
Arrh, here we go again. The no_ipc_position has nothing to do with the no_irq mode. we've punted on this and it comes back.
There was a problem hiding this comment.
@plbossart, the naming wasn't clear to me. Do you think period_irq would be OK?
|
@mrajwa please provide the corresponding FW change at the same time, changing host_period_bytes to non-0 in driver only will lead the FW keep sending position IPCs to FW on SKL+, this may confuse driver. |
| /* set host_period_bytes to 0 if no IPC position */ | ||
| if (hda && hda->no_ipc_position) | ||
| ipc_params->host_period_bytes = 0; | ||
| ipc_params->period_irq = 0; |
There was a problem hiding this comment.
In this series, period_irq is never set to anything different from zero, so why do we need this parameter. Something's missing I guess
There was a problem hiding this comment.
Its not used here but FW uses it:
/* NO_IRQ mode if period_irq == 0 */
if (dev->params.period_irq != 0) { ... }
ALthough you won't find it in current master, I will submit a PR to master soon.
Also, please note the main focus of this PR is host_period_bytes. Previously it was set to 0 at kernel side so each time FW wanted to use it read 0 instead of true value. It was set to 0 by kernel because somebody decided to use host_period_bytes as an indicator of some sort of position - now, after this change we will use period_irq for this purpose.
| /* set host_period_bytes to 0 if no IPC position */ | ||
| if (hda && hda->no_ipc_position) | ||
| ipc_params->host_period_bytes = 0; | ||
| ipc_params->period_irq = 0; |
There was a problem hiding this comment.
Also the field is used before it's added to the header file in the next commit, this would break git bisect. Don't do it.
|
In my opinion, @plbossart @mrajwa please consider replacing the change here with something in this commit: 17558e9, that is: And sure, we need corresponding FW change at the same time. |
|
I have created corresponding FW PR thesofproject/sof#1592 This functionality has been proven to work during KWD tests. |
a110fe8 to
3b35b7e
Compare
|
@mrajwa can you please rebase and resubmit? |
|
@plbossart the new kernel (with this PR merged) will not work correctly with old FW(without Marcin's FW PR merged), even for the normal (not KWD) streams, that means, there will be many position update IPCs sent from FW with normal headset/speaker playback there, which might influence the operation in Linux SOF driver. We can say we don't have released platform with KWD stuff, but we do have released platforms with other normal streams already, where the kernel won't be backwards compatible with this Kernel PR merged. So, looks like we need a major version bump, or to use strict ABI match while only bumping minor version? |
|
we need a minor ABI bump and the driver needs to conditionally execute the old code that sets host_period_bytes to zero when the ABI level is lower that e.g. 11. |
|
@mrajwa can you please follow up with @plbossart 's comment? |
|
Hi, @mrajwa you can use something like this: |
|
@wenqingfu, @plbossart @keyonjie I have just updated this patch. Now kernel will be able to handle ABI mismatch if somebody use old FW with newer kernel. |
| else | ||
| ipc_params->no_stream_position = 1; | ||
| } | ||
| ipc_params->no_stream_position = 1; |
The host period bytes value needs to be passed to firmware. However current implementation uses this field for different purpose - to indicate whether FW should send stream position to the host. Therefore this patch introduces another field "no_stream_position", a boolean value aimed to store information about position tracking. This way host_period_bytes preserves its original value. Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
|
@plbossart, I have addressed your findings. I dunno how the commit message was affected as I only amended the old one.. |
|
Looks like the ABI check should be changed here from 3.10.0 to 3.11.0 as current version is 3.10.0 do you agree? |
This patch prevents the reset of host period bytes and uses no_stream_position to record requests for stream position. Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
Yes, thanks for spotting that. |
….c:367 Use irq*_rcu() functions to fix this kernel warning: WARNING: CPU: 0 PID: 0 at kernel/context_tracking.c:367 ct_irq_enter+0xa0/0xd0 Modules linked in: CPU: 0 PID: 0 Comm: swapper/0 Not tainted 6.7.0-rc3-64bit+ thesofproject#1037 Hardware name: 9000/785/C3700 IASQ: 0000000000000000 0000000000000000 IAOQ: 00000000412cd758 00000000412cd75c IIR: 03ffe01f ISR: 0000000000000000 IOR: 0000000043c20c20 CPU: 0 CR30: 0000000041caa000 CR31: 0000000000000000 ORIG_R28: 0000000000000005 IAOQ[0]: ct_irq_enter+0xa0/0xd0 IAOQ[1]: ct_irq_enter+0xa4/0xd0 RP(r2): irq_enter+0x34/0x68 Backtrace: [<000000004034a3ec>] irq_enter+0x34/0x68 [<000000004030dc48>] do_cpu_irq_mask+0xc0/0x450 [<0000000040303070>] intr_return+0x0/0xc Signed-off-by: Helge Deller <deller@gmx.de>
This patch enables to pass proper period_size value to the firmware.
It is needed to synchronize non-standard copy like i.e draining tasks
Signed-off-by: Marcin Rajwa marcin.rajwa@linux.intel.com