Re: [PATCH] arm64: dts: qcom: sdm845-mtp: Relocate remoteproc firmware

From: Bjorn Andersson
Date: Wed Mar 25 2020 - 20:08:04 EST


On Wed 25 Mar 14:13 PDT 2020, Arnd Bergmann wrote:

> On Mon, Mar 2, 2020 at 3:09 AM Bjorn Andersson
> <bjorn.andersson@xxxxxxxxxx> wrote:
> >
> > Update the firmware-name of the remoteproc nodes to mimic the firmware
> > structure on other 845 devices.
> >
> > Signed-off-by: Bjorn Andersson <bjorn.andersson@xxxxxxxxxx>
> > ---
> > arch/arm64/boot/dts/qcom/sdm845-mtp.dts | 7 +++++++
> > 1 file changed, 7 insertions(+)
>
> Hi Bjorn,
>
> Sorry for the late reply, I only came across this one while going
> through the pull requests
> that we had failed to pick up earlier.
>
> I really dislike the idea of hardcoding a firmware name in the
> devicetree, we had long
> discussions about this a few years ago and basically concluded that the firmware
> name needs to be generated by the driver after identifying the hardware itself.
>

I remember this discussion and generally I share your view, but after
postponing this problem for years we've not managed to come up with a
solution for our problem.

> The problem is that the firmware generally needs to match both the device driver
> and the hardware, so when there is a firmware update that changes the behavior
> (intentionally or not) in a way the driver needs to know about, then
> the driver should
> be able to request a particular firmware file based on information
> that the owner
> of the dtb may not have.
>

There are three variables in play here:

1) Large feature differences, e.g. does your modem Hexagon have
associated RF hardware, or is it WiFi only. Or other similar things,
which does affect DeviceTree anyways (memory maps, audio routing etc)

2) Purely software versions of the firmware. Generally no impact on
remoteproc level or the immediate layers above, bug fixes etc.

3) Vendor specific signatures. All these files are signed with vendor
specific private keys.


None of these affects how we describe the hardware, so we did choose to
use a compatible per platform and remoteproc, e.g. qcom,sdm845-mss-pil
will handle the modem core on all SDM845 devices, regardless of the
firmware implementing WiFi only or it's a devboard or a product with
strict signature validation.

We could add another property in the DT node to denote if the modem RF
hardware is present and have the sdm845-mss-pil compatible result in a
selection of qcom/sdm845/modem.mbn vs qcom/sdm845/modem_nm.mbn. This
would handle 1) above.


But this doesn't solve 3) and my Lenovo Yoga C630 will refuse to load
these files, as they are not signed by Lenovo.

For years we've toyed with the idea of building the necessary firmware
path based on e.g. information from DMI (which not all boards has) or
somehow tokenizing the machine compatible. But nothing sane has come out
of these attempts/ideas.

So after years of not being able to send these files to linux-firmware,
without breaking some other board we decided to just describe these
variations using firmware-name.

So this solves 1) and 3) in a straight forward way, and so far in all
cases we've handled 2) by upgrading (until now, our fork of)
linux-firmware.

But I don't have any suggestions for how to solve the case where kernel
version X and X+1 _needs_ different versions of the firmware.


Lastly, most variations in firmware features are discoverable by the
higher layers, but for the cases where the remoteproc driver itself is
affected we're looking at changes to the memory map, clocks, regulators,
power domains - problems that has to be resolved in DT anyways.

Which is the reason why several companies are looking at passing
dynamically loaded DT snippets with their remoteproc firmware.

> I'm holding off on the pull request for today, maybe there is something we can
> still do about it before the merge window.
>

The binding addition was merged in 5.1, with Rob's r-b, in 5.5 we used
these properties for the Lenovo Yoga C630 and in 5.6 we merged the
equivalent change for the Dragonboard 845c.

If there is a solution that allow us to move away from firmware-name in
DT I'm interested and would like to see us migrate towards it, but the
only thing this particular change does is to make the SDM845 MTP find
the right files in linux-firmware, using the already existing binding
and implementation.

Regards,
Bjorn