-
Notifications
You must be signed in to change notification settings - Fork 132
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
ASoC: SOF: file layout profile handling with fallback mechanism #4309
ASoC: SOF: file layout profile handling with fallback mechanism #4309
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few quick comments. I'll try to test this still a bit before casting my final vote.
if (path_override->tplg_name) | ||
out_profile->tplg_name = path_override->tplg_name; | ||
|
||
out_profile->ipc_type = ipc_type; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess on remaining complication is that if e.g. default IPC type is 4 for a platform, but the override passes path to a IPC 3 FW, the test would be skipped (due to override) and but FW load would fail (kernel configured to IPC4 but FW is actually IPC3). I believe this is the typical case for many Chromebooks, so a pretty common case.
Not really a problem with this PR, but basicly limits the usefulness. If we keep IPC3 as the default for all platforms (that support multiple IPCs), then IPC3 will always be chosen as that's always available.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, it is the user who is asking for it, right? It will fail later.
If we change the IPC type based on what the override points to then we would need to verify that the tplg path is aligned, so we would need to look for a matching tplg default path if it is not overridden, and that will open other door.
This is why I decided to not verify in case the fw path or/and name is overridden, it is something we cannot handle in a clean and sane way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kv2019i, to the specific scenario: I don't have a good answer. I don't know how that can be handled apart from requiring user to specify the IPC type alongside the fw path/name change to make sure they are aligned.
If you have a good algorithm to follow to cover that case, I'm all ears, but it is a bit of a wack-a-mole game with almost unlimited holes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One thing might work:
If a fw path/name override is asked we would first test it and.take the IPC type from the file and proceed further to gather other paths.
We could warn if the IPC types differ, but not fail.
I think this can close the loophole.
desc->default_fw_filename[i]); | ||
} | ||
|
||
dev_err(dev, "Check if you have 'sof-firmware' package installed.\n"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor nit: not sure how stable "sof-firmware" is as a pointer. In many RPM-based distros, package name is alsa-sof-firmware. Thus we just referred to sof-bin in the kernel error in the past.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the user should try to find a distro way first before reaching out to wget ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ujfalusi Yup, we could add a "If you are seeing this message, you are looking too close." disclaimer here. ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not fully getting the picture @ujfalusi
sound/soc/sof/fw-file-profile.c
Outdated
/* firmware path */ | ||
if (path_override->fw_path) { | ||
out_profile->fw_path = path_override->fw_path; | ||
} else if (path_override->fw_path_postfix) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there any incompatibility between fw_path and fw_path_postfix? I can recall any of this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, if the path is overridden then it is the full path, the postfix is ignored.
The postfix is the 'community' in Intel platforms.
If the user sets the path to "/home/developer/work/my_firmware" then that should be used, no?
if (i == ipc_type) | ||
marker = "Requested"; | ||
else | ||
marker = "Fallback"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we would need to verify which IPC_TYPE is supported for a given platforms. Some only have IPC3, some only IPC4.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, true, I missed it from here.
if (i == ipc_type) | ||
marker = "Requested"; | ||
else | ||
marker = "Fallback"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the other problem here is that for IPC4 on TGL the default is the 'IPC4 tester', not cSOF.
static const struct sof_dev_desc tgl_desc = {
.default_fw_path = {
[SOF_IPC] = "intel/sof",
[SOF_INTEL_IPC4] = "intel/avs/tgl",
},
.default_lib_path = {
[SOF_INTEL_IPC4] = "intel/avs-lib/tgl",
},
.default_tplg_path = {
[SOF_IPC] = "intel/sof-tplg",
[SOF_INTEL_IPC4] = "intel/avs-tplg",
},
.default_fw_filename = {
[SOF_IPC] = "sof-tgl.ri",
[SOF_INTEL_IPC4] = "dsp_basefw.bin",
},
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, that is a problem, and the now closed PR would have solved that issue, but since that did not received well, I have dropped that to follow the suggestion to not support multiple profiles per IPC types.
We have one set of paths per IPC type and that can only be changed with a change similar to what was introduced by #4308
1d005c7
to
9f86975
Compare
Changes since v1:
|
9f86975
to
03cdad1
Compare
Changes since v2:
|
What is the purpose of this feature? To handle paths/etc in a single place? |
03cdad1
to
09dc400
Compare
Add a struct sof_loadable_file_profile which can be filled by platforms (sof-acpi-dev.c, sof-of-dev.c and sof-acpi-dev.c) to be able to use common, generic code to handle path customization. Signed-off-by: Peter Ujfalusi <[email protected]>
Store the default IPC type and the firmware and topology path overrides to ipc_file_profile_base Signed-off-by: Peter Ujfalusi <[email protected]>
Store the default IPC type and the firmware and topology path overrides to ipc_file_profile_base Signed-off-by: Peter Ujfalusi <[email protected]>
Store the default IPC type and the overrides to ipc_file_profile_base Signed-off-by: Peter Ujfalusi <[email protected]>
Use the information stored in ipc_file_profile_base by platforms to construct the paths, filenames that are going to be used to load the firmware and topology files. The sof_create_ipc_file_profile() function will perform firmware file presence checking and it can also fall back to other supported IPC types in case the requested file for the type is not present. If the firmware path or name is overridden by a module parameter, we will check the file's IPC type and adjust the all other paths accordingly. Signed-off-by: Peter Ujfalusi <[email protected]>
The core is now using the information from ipc_file_profile_base to create the paths for the loadable files, no need to set it in here anymore. Signed-off-by: Peter Ujfalusi <[email protected]>
The core is now using the information from ipc_file_profile_base to create the paths for the loadable files, no need to set it in here anymore. Signed-off-by: Peter Ujfalusi <[email protected]>
The core is now using the information from ipc_file_profile_base to create the paths for the loadable files, no need to set it in here anymore. Signed-off-by: Peter Ujfalusi <[email protected]>
Changes since v3:
|
Yes, this series is doing that with the additional bonus of handling fallback path in case the default firmware is not in place - fallback to different IPC type, that is. This is just on part of the puzzle I'm trying to solve, which is to be able to verify both firmware and topology file existence and if any of them is missing, try other ipc type. I could have tried to aim only for sof-pci-dev, but I think this feature can be useful for all of us in the long run and the code is not in hot path, so a bit of logic would not hurt performance, but let us use common ways to craft the paths (if they are let to their defaults). Does this answer your question? |
@ujfalusi thanks this answers the question and now things are more clear. Ideally this explanation should be placed in one of the commit messages that gets kept in git history. Also, thanks for going the generic way with pci/of/acpi. |
I'm going to replace this PR with a new one which will be able to do the topology file existence check also |
Replaced by take 3 at #4331, closing |
Hi,
replaces #4308
This PR contains #4301 as the first 10 patch, the topmost two patch is the new one:
ASoC: SOF: Add library function for constructing loadable file paths, names
ASoC: SOF: sof-pci-dev: Use sof_create_file_profile() to create the file paths
Instead of cleaning up the current path/filename definitions in sof_dev_desc, this PR will introduce (the last two patch) a library file which can set/craft the paths, names used by the driver to load firmware files.
The entry to the library is the
sof_create_file_profile()
function which can handle overrides and also fallback to other IPC types in case the defaults are used (no override for firmware path or name).Only sof-pci-dev.c is converted to use it atm as we only have multiple IPC types supported only with PCI devices.