Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Deepin-Kernel-SIG] [Upstream] [linux 6.6-y] ASoC: Sync some intel fixes from mainline #518

Merged
merged 3 commits into from
Dec 7, 2024

Conversation

opsiff
Copy link
Member

@opsiff opsiff commented Dec 6, 2024

wens and others added 3 commits December 6, 2024 23:34
mainline inclusion
from mainline-v6.8-rc1

Commit 014fdeb ("ASoC: SOF: Move sof_of_machine_select() to
sof-of-dev.c from sof-audio.c") caused a circular dependency between
the snd_sof and snd_sof_of modules:

	depmod: ERROR: Cycle detected: snd_sof -> snd_sof_of -> snd_sof
	depmod: ERROR: Found 2 modules in dependency cycles!

Move the function back with sof_machine_select().

Fixes: 014fdeb ("ASoC: SOF: Move sof_of_machine_select() to sof-of-dev.c from sof-audio.c")
Signed-off-by: Chen-Yu Tsai <[email protected]>
Acked-by: Peter Ujfalusi <[email protected]>
Reviewed-by: Daniel Baluta <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Mark Brown <[email protected]>
(cherry picked from commit d0ae9dc)
Signed-off-by: Wentao Guan <[email protected]>
mainline inclusion
from mainline-v6.9-rc1

Commit 6c393eb ("ASoC: SOF: core: Implement IPC version fallback if
firmware files are missing") changed the order of some operations and
the firmware paths are not available anymore at snd_sof_probe() time.

Precisely, fw_filename_prefix is set by sof_select_ipc_and_paths() via

  plat_data->fw_filename_prefix = out_profile.fw_path;

but sof_init_environment() which calls this function was moved from
snd_sof_device_probe() to sof_probe_continue(). Moreover,
snd_sof_probe() was moved from sof_probe_continue() to
sof_init_environment(), but before the call to
sof_select_ipc_and_paths().

The problem here is that amd_sof_acp_probe() uses fw_filename_prefix to
compute fw_code_bin and fw_data_bin paths, and because the field is not
yet initialized, the paths end up containing (null):

snd_sof_amd_vangogh 0000:04:00.5: Direct firmware load for (null)/sof-vangogh-code.bin failed with error -2
snd_sof_amd_vangogh 0000:04:00.5: sof signed firmware code bin is missing
snd_sof_amd_vangogh 0000:04:00.5: error: failed to load DSP firmware -2
snd_sof_amd_vangogh: probe of 0000:04:00.5 failed with error -2

Move usage of fw_filename_prefix right before request_firmware() calls
in acp_sof_load_signed_firmware().

Fixes: 6c393eb ("ASoC: SOF: core: Implement IPC version fallback if firmware files are missing")
Signed-off-by: Cristian Ciocaltea <[email protected]>
Reviewed-by: Emil Velikov <[email protected]>
Link: https://msgid.link/r/[email protected]
Signed-off-by: Mark Brown <[email protected]>
(cherry picked from commit d9cacc1)
Signed-off-by: Wentao Guan <[email protected]>
…hainDMA

mainline inclusion
from mainline-v6.11-rc1

The DMA Link ID is only valid in snd_sof_dai_config_data when the
dai_config is called with HW_PARAMS.

The commit that this patch fixes is actually moved a code section without
changing it, the same bug exists in the original code, needing different
patch to kernel prior to 6.9 kernels.

Cc: [email protected]
Fixes: 3858464 ("ASoC: SOF: ipc4-topology: change chain_dma handling in dai_config")
Link: thesofproject/linux#5116
Signed-off-by: Peter Ujfalusi <[email protected]>
Reviewed-by: Bard Liao <[email protected]>
Reviewed-by: Ranjani Sridharan <[email protected]>
Reviewed-by: Pierre-Louis Bossart <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Mark Brown <[email protected]>
(cherry picked from commit ae67ed9010a7b52933ad1038d13df8a3aae34b83)
Signed-off-by: Wentao Guan <[email protected]>
*/
if (flags & SOF_DAI_CONFIG_FLAGS_HW_PARAMS) {
pipeline->msg.primary &= ~SOF_IPC4_GLB_CHAIN_DMA_LINK_ID_MASK;
pipeline->msg.primary |= SOF_IPC4_GLB_CHAIN_DMA_LINK_ID(data->dai_data);
Copy link

Choose a reason for hiding this comment

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

WARNING: Prefer a maximum 75 chars per line (possible unwrapped commit description?)

@@ -16,15 +16,6 @@ struct snd_sof_of_mach {
const char *sof_tplg_filename;
};

Copy link

Choose a reason for hiding this comment

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

WARNING: Prefer a maximum 75 chars per line (possible unwrapped commit description?)

@deepin-ci-robot
Copy link

deepin pr auto review

代码审查意见:

  1. acp-loader.c文件中,request_firmware函数的调用被修改为使用动态生成的文件名,这可能会导致内存泄漏。如果request_firmware调用失败,应该释放之前分配的fw_filename内存。

  2. acp-loader.c文件中,snd_sof_dsp_block_write函数的调用被重复,但每次调用后都重新分配了fw_filename。这可能会导致不必要的内存分配和释放,应该优化这部分代码,避免重复的内存操作。

  3. acp.c文件中,amd_sof_acp_probe函数中使用了sdev->pdata,但在函数开始时并没有声明或初始化。这可能会导致编译错误或未定义行为。应该确保在使用sdev->pdata之前已经正确初始化。

  4. ipc4-topology.c文件中,sof_ipc4_dai_config函数中添加了对flags的检查,这是一个好的做法,可以避免不必要的操作。但是,应该确保flags的值在调用此函数时是有效的,并且已经正确设置。

  5. sof-of-dev.c文件中,sof_of_machine_select函数被移除,并且sof_of_machine_select的导出符号也被移除。如果这个函数在其他地方被使用,那么这个改动可能会导致编译错误或运行时错误。应该检查并更新所有使用sof_of_machine_select的代码。

  6. sof-of-dev.h文件中,sof_of_machine_select函数的导出符号被移除。如果这个函数在其他地方被使用,那么这个改动可能会导致编译错误或运行时错误。应该检查并更新所有使用sof_of_machine_select的代码。

  7. sof-of-dev.c文件中,sof_of_probe_complete函数被添加,但是没有提供函数的实现。应该提供函数的实现,以确保pm_runtime_enable被正确调用。

  8. sof-of-dev.c文件中,sof_of_probe函数被添加,但是没有提供函数的实现。应该提供函数的实现,以确保sof_of_probe_complete被正确调用。

  9. sof-of-dev.c文件中,sof_of_probe_complete函数被添加,但是没有提供函数的实现。应该提供函数的实现,以确保pm_runtime_enable被正确调用。

  10. sof-of-dev.c文件中,sof_of_probe函数被添加,但是没有提供函数的实现。应该提供函数的实现,以确保sof_of_probe_complete被正确调用。

总的来说,代码中存在一些潜在的问题,需要进一步审查和修复。

@deepin-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please ask for approval from opsiff. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@opsiff opsiff merged commit dc31acb into linux-6.6.y Dec 7, 2024
7 of 10 checks passed
@opsiff opsiff deleted the asoc-intel-fixes branch December 7, 2024 17:05
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.

5 participants