[SLOF] [PATCH slof v5 3/6] fdt: Pass the resulting device tree to QEMU
Alexey Kardashevskiy
aik at ozlabs.ru
Thu Oct 19 15:10:16 AEDT 2017
On 18/10/17 20:46, Segher Boessenkool wrote:
> On Wed, Oct 18, 2017 at 08:34:57PM +1100, Alexey Kardashevskiy wrote:
>>> Or even not define words for the phandle and ihandle if you don't use
>>> them. Your choice :-)
>>
>> I need either:
>> - a variable for the unit address or
>> - a word to get it ("chosen-cpu-unit").
>>
>> They both are better be defined nearby set-chosen-cpu. But fdt.fs is parsed
>> before that.
>
> Well, set-chosen-cpu shouldn't really decide what the boot cpu is
> anyway -- it should just set the link in /chosen!
>
> The current method of just picking whatever is the first device in /cpus
> isn't so great anyway.
>
>> My choice was to do "defer chosen-cpu-unit" but you are opposing it which
>> makes me think I am missing something, again :)
>
> I'm not opposing it, just suggesting ways to make it better.
Let's assume I moved new FDT stuff to fdt-fl.fs. Now we have in OF.fs:
#include "board-qemu/slof/fdt.fs" <- parses the initial fdt
#include <slof/fs/root.fs> <- defines set-chosen
#include "board-qemu/slof/fdt-fl.fs" <- uses chosen-cpu-unit and defines
fdt-flatten-tree
#include "board-qemu/slof/rtas.fs" <- it needs fdt and it also needs
fdt-flatten-tree
#include "board-qemu/slof/tree.fs" <- defines set-chosen-cpu right now
(which uses set-chosen) and defines chosen-cpu-unit (as it uses shared
variable - chosen-cpu-ihandle)
#include "slof/fs/client.fs" <- uses fdt-flatten-tree
So, "set-chosen-cpu" is not found by running SLOF. How do I fix this properly?
I can move set-chosen-cpu/chosen-cpu-unit from QEMU's tree.fs to the common
root.fs, next to "set-chosen". Will this be less spaghetti or it is bad in
some other way?
Or move the set-chosen-cpu/chosen-cpu-unit definitions to
board-qemu/slof/OF.fs right after #include <slof/fs/root.fs> (but will
definitely look spaghetti)?
I pushed the tree to github if anyone is interested:
https://github.com/aik/SLOF/commits/fdt
> In general
> having DEFERs for random stuff means you should do some restructuring, or
> you'll end up with spaghetti (and things build with spaghetti aren't
> typically very sturdy).
--
Alexey
More information about the SLOF
mailing list