> On Sep 4, 2015, at 7:54 AM, Lee Jones <lee.jones@xxxxxxxxxx> wrote: > > On Fri, 04 Sep 2015, Rob Herring wrote: > >> On Fri, Sep 4, 2015 at 8:26 AM, Lee Jones <lee.jones@xxxxxxxxxx> wrote: >>> On Fri, 04 Sep 2015, Arnd Bergmann 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 >>>>> 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. >>>> >>>> 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. >>> >>> It depends what you mean by "basing the firmware name on the >>> \"compatible\" property" here. If you mean actually renaming the >>> firmware binary file to match a driver's compatible string, that's >>> absolutely out of the question. Firmwares are not only OS agnostic, >>> but are also independent of any H/W description language a particular >>> OS or platform might be using. Using DT'isums to rename these >>> binaries is not logical. >>> >>> However, if you mean simply match on compatible string and supply the >>> name from within the driver, that's closer to the mark (as then we can >>> at least keep it in-house [kernel]), but it's still not particularly >>> practical for the aforementioned reasons mentioned by Peter earlier. >>> >>> Why not just create a new 'firmware' property? Simples! [0] >> >> Someone give me some evidence that other OS's use or will use the same >> names. Does *BSD use linux-firmware would be enough. With the >> complaints I get that bindings are just Linux driver properties, I'm >> not inclined to take this. Having a filename does imply the OS has a >> filesystem and drivers can access the filesystem which may not always >> be true. > > Peter already provided a real-world example of multiple OSes using the > same Firmware based on his experience at ST. Any vendor using this API > who doesn't _soley_ use Linux is likely to use the same firmware files > across all platforms. The co-processor's jobs don't often change just > because the platform is running a different OS. > > I don't know enough about the inner workings of other Operating > Systems to comment on your final statement, but if they can get > access to the filesystem them they'll need the name too. If they > don't have access to the firmware file, then they don't require the > property and it becomes unused by them. That's not an issue is it? Based on my experience with FreeBSD and different firmware and such, I’d have to agree with Peter. FreeBSD often uses the vendor supplied firmware, just like Linux, because that firmware establishes the ABI for talking to the device. This ABI is typically OS agnostic, and when it isn’t that’s more the exception than the rule. As for ‘not all OSes provide a filesystem’ Sure, but who cares. While the filesystem provides a natural mapping of the property to the binary data to load (e.g. os-firmware-path + “/“ + property-name), that’s not the only way to map names to binary blobs. FreeBSD itself allows one to compile firmware images into the kernel, and those images are addressed / found by name, even though no filesystem is involved based on what the driver desires to load. I would imagine that an OS minimal enough to not support a filesystem would run into this sort of issue often enough to provide a mechanism similar to FreeBSD. Failing that, I’d imagine driver writers would compile images into their drivers on such a system and use the name to pick which one to load. Warner
Attachment:
signature.asc
Description: Message signed with OpenPGP using GPGMail