[alsa-devel] SOF firmware/ucm/topology packaging

Jaroslav Kysela perex at perex.cz
Thu May 30 14:41:23 CEST 2019


Dne 30. 05. 19 v 13:21 Pierre-Louis Bossart napsal(a):
> 
>>>>>> The same situation is for the SoC SOF firmware files (drivers are
>>>>>> in kernel, firmware files are missing). Perhaps, we can release those files
>>>>>> quickly in alsa-firmware and then migrate them slowly to linux-firmware.
>>>>>
>>>>> for SOF there are 4 cases
>>>>>
>>>>> 1. developers/integrators build from scratch themselves from the public
>>>>> tree.
>>>>> 2. integrators build from scratch with their own secret sauce added.
>>>>> 3. distros want a binary since they don't want to build from source
>>>>> and/or don't have access to all the DSP tools
>>>>> 4. distros needs a binary signed with the Intel production key (e.g. to
>>>>> run on devices initially designed for Windows).
>>>>
>>>> Do you mean that the firmware should be signed because the hardware is doing a
>>>> check, if the hardware vendor enables it and rejects the unsigned binaries?
>>>
>>> It depends on the platforms.
>>> Baytrail/Cherrytrail/Broadwell don't need any signature.
>>> Starting with Skylake, the firmware is authenticated and the DSP will
>>> not boot unless it's signed with the relevant key, but different
>>> platforms chose different protections. Most of the Windows platforms use
>>> a strong authentication based on a non-public 'production key', which
>>> prevents people from installing their own firmware. Other solutions such
>>> as Up Squared boards or 2019 Chromebooks use a public key that is
>>> already part of the SOF tree.
>>> Unfortunately I didn't find a way to detect which key is used, and it's
>>> not wise to try multiple keys since it adds a lot of latency on startup,
>>> so we are leaning to use DMI-based quirks to detect which key is used by
>>> what.
>>
>> Any ETA when then signed firmware will be available?
> 
> it's being productized as we speak and it's my understanding that SOF 
> 1.3 will provide a signed firmware for recent chipsets.
> 
>>>>> So far we were mostly dealing with case 1. Case 2 is allowed by the SOF
>>>>> permissive license and there's no need to look into this. We are
>>>>> planning releases for the last two cases, with a cadence aligned with
>>>>> kernel updates. It's not fully clear to me if the linux-firmware tree is
>>>>> the 'right' solution since ideally we'd want to have firmware, topology
>>>>> and UCM files released at the same time.
>>>>
>>>> Do you plan to create a new package for this? I can eventually offer the space
>>>> / docker build system on the ALSA server, if you like. The github releases
>>>> work fine, too. The question is, if it's the right way. It seems that the
>>>> firmware/topology files are read-only chunks used by the driver (standard
>>>> usage) and the UCM config is for alsa-lib (the user space). It might make
>>>> probably sense to add compatibility IDs to link/check the correct parts
>>>> together at runtime and keep the standard (binary) code distribution for the
>>>> most of users (linux-firmware / alsa-lib).
>>>
>>> There is a connection mostly between topology and UCM: the device
>>> numbers used for the PCM streams have to match. If you add/remove a
>>> stream in the topology, then UCM will use numbers that aren't quite
>>> right. Same if you have a volume control used in UCM, you need to make
>>> sure that volume control is actually part of the topology.
>>>
>>> In the past, we discussed about moving UCM files and topology out of the
>>> alsa-lib umbrella (and clarify what the license is for these
>>> configuration files), it's probably a good time to revisit this.
>>
>> It is also the packaging issue. This situation complicates the package
>> dependency tree. Basically, it might not be ideal to force users to install
>> extra package to support the specific hardware platform with fw/ucm/tplg
>> files. On the other side, there is no reason to have those bits installed on
>> system where the hardware does not exist. There should be an automatic way to
>> install the required bits on demand in the distribution in my opinion. I know,
>> it's not your issue.
>>
>> I see those ways:
>>
>> 1) package everything hw specific to one package (fw/ucm/tplg), let distros to
>> handle the automatic installation when the hardware is detected or the
>> integration to the current alsa-lib/linux-firmware packages to avoid on-demand
>> installation
>>
>> 2) use some versioning / linking IDs for the firmware/topology/ucm, so we can
>> have more topology/ucm files for one hardware; the driver can use the
>> component field in the ALSA's control interface to notify the user space which
>> firmware / topology was loaded, so the correct UCM files can be used
> 
> Unfortunately that would not work. The UCM file needs to be aligned with 
> the topology but also with the hardware peripherals used. The topology 
> file only describes the DSP graph, all the way from PCM streams to DAIs. 
> The platform hardware can be very different even when you use the same 
> topology file. A simple example is that some platforms have a single 
> speaker or others two. The mics may be analog or digital. That 
> hardware-level information that UCM needs to know is not discoverable 
> and we have to rely on DMI-based quirks to set a long name. Knowing 
> which topology file was used will not help.
> Even finding out which topology file is needed is not obvious. We 
> currently use the codec ACPI ID as a key to look-up a set of static 
> tables to figure out which firmware and topology files need to be used, 
> but it's likely we will have multiple platforms which will end-up using 
> the same generic topology even though they'd need a different one to 
> account for form-factor or acoustics. Again we will have to use quirks here.

I think that we're talking about different components. We have
snd_component_add() function in the ALSA kernel core interface which can send
any ASCII identification of used components to the user space (ALSA card
level). So the driver can detect and describe the hardware in a more verbose
way. We can use this string later in alsa-lib/ucm and load and use the proper
UCM config based on the driver detection. So you may use quirks in the driver,
compose the runtime ASCII component list and let alsa-lib to choose the right
UCM config.

					Jaroslav

-- 
Jaroslav Kysela <perex at perex.cz>
Linux Sound Maintainer; ALSA Project; Red Hat, Inc.


More information about the Alsa-devel mailing list