devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Warner Losh <imp@bsdimp.com>
To: Arnd Bergmann <arnd@arndb.de>
Cc: Lee Jones <lee.jones@linaro.org>,
	Peter Griffin <peter.griffin@linaro.org>,
	Rob Herring <robherring2@gmail.com>,
	Pawel Moll <pawel.moll@arm.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Ian Campbell <ijc+devicetree@hellion.org.uk>,
	Kumar Gala <galak@codeaurora.org>,
	Vinod Koul <vinod.koul@intel.com>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	Maxime Coquelin <maxime.coquelin@st.com>,
	Patrice Chotard <patrice.chotard@st.com>,
	Ludovic Barre <ludovic.barre@st.com>,
	"devicetree-spec@vger.kernel.org"
	<devicetree-spec@vger.kernel.org>
Subject: Re: st_fdma: Firmware filename in DT?
Date: Sat, 5 Sep 2015 15:06:35 -0600	[thread overview]
Message-ID: <CANCZdfrLbbN_nGJ8WLsBHHGuM3SxGgiLgjkZ+YG4zP4BBA68YQ@mail.gmail.com> (raw)
In-Reply-To: <201509051058.54229.arnd@arndb.de>

[-- Attachment #1: Type: text/plain, Size: 5268 bytes --]

On Sat, Sep 5, 2015 at 2:58 AM, Arnd Bergmann <arnd@arndb.de> wrote:

> On Friday 04 September 2015, Warner Losh wrote:
> > > On Sep 4, 2015, at 7:04 AM, Arnd Bergmann <arnd@arndb.de> wrote:
> > > On Friday 04 September 2015, Lee Jones wrote:
> > >>>> If we flip it the other way round, some subsystems derive the
> firmware
> > >>>> name from the 'node name'.  For instance, our zeroth General Purpose
> > >>>> Co-Processor RemoteProc driver has a corresponding node called
> > >>>> 'st231-gp0@40000000'.  RemoteProc adds an 'rproc-' prefix and a
> '-fw'
> > >>>> suffix and et voilà, we load file:
> > >>>>
> > >>>>  lib/firmware/rproc-st231-gp0-fw
> > >>>
> > >>> IMO deriving from the node name seems fragile. Also imposing a
> linux'ism
> > >>> "rproc" prefix on the firmware name doesn't seem correct as the
> firmwares
> > >>> can be shared across OS's. Although this is how remoteproc subsys
> core
> > >>> is currently working. It seems a generic DT firmware binding would
> actually
> > >>> be most useful for the remoteproc subsystem.
> > >>
> > >> The "rproc-%s-fw", where %s == driver name, is only a fall-back.  The
> > >> RProc driver is welcome to supply a different firmware name if it
> > >> desires.  This is where I think a generic 'firmware' property would
> be>
> > Warner
> >
> >
>
> > >> of use.
> > >
> > > The firmware file name is agreed on between the device driver and the
> > > file system, so encoding the linux driver name in it seems appropriate.
> >
> > Encoding the driver name is not OS independent. It fosters the
> > impression that DT isn’t OS independent, but rather some silly
> > Linux toy and hurts wider adaptation.
>
> I meant encoding the driver name in the path for the firmware file,
> e.g.
>
>          $DRIVER/$COMPATIBLE.bin
>
> where $DRIVER is the name of the driver, and $COMPATIBLE is the name
> from the compatible string.
>
> > > Generally speaking, I'd say a good policy would be to try basing
> > > the firmware name on the "compatible" property strings. That property
> > > already contains a hierarchical list of models, which makes it
> particularly
> > > easy to have firmware files for specific models or those that are
> shared
> > > across multiple variations if necessary. Just ask for the most specific
> > > compatible string first and try the more specific compatible strings
> > > (with an appropriate prefix and/or postfix added by the driver) until
> > > a file is found.
> >
> > I think this is a horrible policy. It is an ugly kludge that is fragile
> to change.
> > While it sounds cool, I don’t think it is really a viable one. It
> requires
> > different compatibility names for different bits of hardware that might
> otherwise
> > be the same just to get different firmware. Sometimes this may be OK,
> > but it does seem needlessly limiting for systems that may have firmware
> > “images” that are loaded into one hardware block, but actually control
> > other blocks indirectly (where the different compat strings would be).
>
> The idea is that the compatible string here not only encodes the hardware
> but also how it is getting used. This is the same as what we do with other
> programmable hardware, such as PHY controllers that can be either PCIe
> or USB3 depending on some setting. The driver would match on the more
> generic
> property that identifies the hardware, while the firmware can match on the
> more specific one, if any, or be provided by the user. As an example,
> you can have
>
>         compatible = "fwmaker,firmwaretype",
> "hardwaremaker,thisdevice-instance2",
>                 "hardwaremaker,thisdevice-version-3.1",
> "hardwaremaker,thisdevice";
>
> So the driver matches on the one of the last two strings (as any other
> driver),
> and the firmware can match on the same string, or the user can provide an
> image
> in the file system based on the instance (if there are multiple ones), or
> the
> boot loader can predefine which function should get loaded into this one,
> based
> on how the hardware is physically wired up.
>
> The file name for loading the firmware can still get constructed from
> additional
> properties, e.g. the instance can be appended by the driver instead of
> coming
> from compatible if that makes more sense
>

I understood what you were proposing. It wasn't a lack of understanding
that lead me to the opinion that it was a horrible policy. Despite your
lengthy explanation, you did nothing to address the very simple and common
use case of having identical hardware that none-the-less needs different
firmware which was my basis of the horrible brand I put on this policy.

Also, firmware comes from vendors generally named something other
than FDT compat strings. Renaming firmware generally is also a
horrible policy that most shops frown on. It hampers traceability from
a deployed system back to the sources, for one and introduces one
more place for an 'oops' rename to go undetected until the firmware
is deployed.

So there needs to be a standardized way to augment local policy
to say 'the firmware you need for this node so that the system behaves
as expect in the DT is Y.'

Warner

[-- Attachment #2: Type: text/html, Size: 6463 bytes --]

  reply	other threads:[~2015-09-05 21:06 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-03 14:49 st_fdma: Firmware filename in DT? Peter Griffin
2015-09-03 21:45 ` Rob Herring
     [not found]   ` <CAL_JsqKQqbAQCPR6xuR2Ke5gEdX4kQYb29-W3qNaZqjM_JBoYg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-09-04  6:59     ` Lee Jones
2015-09-04  9:20       ` Peter Griffin
2015-09-04 10:21         ` Lee Jones
2015-09-04 13:04           ` Arnd Bergmann
     [not found]             ` <201509041504.38412.arnd-r2nGTMty4D4@public.gmane.org>
2015-09-04 13:26               ` Lee Jones
2015-09-04 13:44                 ` Rob Herring
     [not found]                   ` <CAL_Jsq+XpBV+BMMq1gYnvKtv6O5mjqVw6zsP4G-4Za3cQm9PzQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-09-04 13:54                     ` Lee Jones
2015-09-04 14:36                       ` Warner Losh
2015-09-05  9:17                 ` Arnd Bergmann
     [not found]                   ` <201509051117.59751.arnd-r2nGTMty4D4@public.gmane.org>
2015-09-08  3:14                     ` David Gibson
2015-09-04 14:30               ` Warner Losh
     [not found]                 ` <C93CEE95-AF30-4B2D-BD96-66733B282414-uzTCJ5RojNnQT0dZR+AlfA@public.gmane.org>
2015-09-05  8:58                   ` Arnd Bergmann
2015-09-05 21:06                     ` Warner Losh [this message]
     [not found]                       ` <CANCZdfrLbbN_nGJ8WLsBHHGuM3SxGgiLgjkZ+YG4zP4BBA68YQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-09-07 12:41                         ` Arnd Bergmann
2015-09-04 14:27           ` Warner Losh
     [not found]             ` <5E0DCAA5-DB90-4682-92F2-061A07FE973E-uzTCJ5RojNnQT0dZR+AlfA@public.gmane.org>
2015-09-04 19:04               ` Rob Herring
     [not found]                 ` <CAL_Jsq+bw1TcXt0c8L4BSvwWK82L2cG-qdw369EkvxWe-5RXbQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-09-05  9:25                   ` Arnd Bergmann
     [not found]                     ` <201509051125.43527.arnd-r2nGTMty4D4@public.gmane.org>
2015-09-07 10:30                       ` Daniel Thompson
     [not found]                         ` <55ED6733.7050807-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2015-09-07 12:33                           ` Arnd Bergmann
2015-09-07 14:36                             ` Daniel Thompson
     [not found]                               ` <55EDA0EB.1040501-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2015-09-07 15:59                                 ` Arnd Bergmann
2015-09-10 14:18                                 ` Peter Griffin
2015-09-11  9:17                                   ` Lee Jones
2015-09-11  9:21                                     ` Arnd Bergmann
2015-09-11  9:39                                       ` Lee Jones
2015-09-11  9:46                                     ` Peter Griffin
2015-09-11 10:25                                       ` Lee Jones
2015-09-11 12:31                                         ` Peter Griffin
2015-09-04 16:19           ` Daniel Thompson
2015-09-04  8:46     ` Peter Griffin
2015-09-08  2:57     ` David Gibson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CANCZdfrLbbN_nGJ8WLsBHHGuM3SxGgiLgjkZ+YG4zP4BBA68YQ@mail.gmail.com \
    --to=imp@bsdimp.com \
    --cc=arnd@arndb.de \
    --cc=devicetree-spec@vger.kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=galak@codeaurora.org \
    --cc=ijc+devicetree@hellion.org.uk \
    --cc=lee.jones@linaro.org \
    --cc=ludovic.barre@st.com \
    --cc=mark.rutland@arm.com \
    --cc=maxime.coquelin@st.com \
    --cc=patrice.chotard@st.com \
    --cc=pawel.moll@arm.com \
    --cc=peter.griffin@linaro.org \
    --cc=robherring2@gmail.com \
    --cc=vinod.koul@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).