Conversation
|
Thanks to @sorear for the pointers! Requires http://lists.infradead.org/pipermail/linux-riscv/2018-February/000056.html to be useful |
hw/riscv/virt.c
Outdated
| @@ -265,15 +296,27 @@ static void riscv_virt_board_init(MachineState *machine) | |||
| main_mem); | |||
|
|
|||
| /* create device tree */ | |||
| create_fdt(s, memmap, machine->ram_size, machine->kernel_cmdline); | |||
| fdt = create_fdt(s, memmap, machine->ram_size, | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should avoid whitespace changes to code that isn't changing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
|
@palmer-dabbelt I like this patch, in some form... It would also be nice to split the monitor and the kernel as there is also a e.g. There are various reasons why this will be useful. One is CI, as riscv-pk and riscv-linux tag hooks could build and deploy test images independently. We won't need to rebuild bbl when we update the kernel, which would be more like other boot loaders. Thirdly, we could substitute other monitor implementations. Essentially it's the M-mode code that hooks I discussed this with @palmer-dabbelt and similarly we would add a kernel payload entry to device-tree which if present, bbl would jump to the address in device-tree. We'd then build it with the dummy-payload. This would be backward compatible, as if the device-tree entry is not present, bbl would jump to the embedded payload e.g. (plus associated change to With respect to this code, are we copying from a GPL licensed file into a MIT licensed file? We might have to switch the license of the machines to GPL. When I implemented Finally, if we add this change, should it be on all machines with device-tree? or just virt? @sagark @sorear I think we need authors to agree to a GPL license change, otherwise we prefix the MIT license with GPL. MIT code is able to be GPL, but the MIT clauses need to remain present, unless the authors agree to relicense as GPL. I don't think this is a problem... I've just submitted a v6 patch series upstream. I think we should do this stuff on another branch. I'll experiment with this code and look into adding a change to Thanks! It will be neat when we can separate boot loader from the kernel, as well as the initrd from the kernel as per this patch... |
|
@michaeljclark Will respond to the rest later, just wanted to let you know that the only thing I took from the arm side of things was the base address calculation (and the comment above it). No idea how that affects licensing questions. |
|
@shlevy I think its best to play safe and license the machines as GPL, esepcially if we copy an actual segment of code from hw/arm/virt.c (versus calling the same APIs with unique code). It's a gray/grey area if one looks at the other code (e.g. some companies prevent folk working on LLVM from looking at GCC code), conforms to its coding conventions and what not, but is indeed unique. I don't believe we have so far copied anything other than convention from hw/arm/virt.c and that fact we use the same APIs for fdt, however the fdt code was written from scratch (mostly from looking at the fdt header interfaces). The riscv device-tree makes unique use of phandles that are not present in other ports and besides our virtio nodes being similar (they are a little different due to interrupt-parent), the code to construct them was written from scratch. Interestingly, all of Fabrice's original code is MIT licensed. |
|
|
The kernel_start node is an interface with the first stage boot loader. The code that reads it would be riscv-pk/bbl, u-boot or any other bootloader. "riscv,kernel-start" seems fine, or "riscv,boot-kernel" (see below) It's obviously not going to have "linux" as per the initrd load address "linux,initrd-start" which is read by linux. Here the linux prefix makes sense, but clearly not for kernel load address. If there is an example from another FDT platform e.g. powerpc, then we can follow their convention. Okay. I see some powerpc code uses this: "qemu,boot-kernel" I don't like the idea of using qemu as a prefix as bootloaders on real hardware could use this device-tree node to for example locate a kernel in XIP flash. i.e. it's not necessarily qemu specific. |
|
|
|
@michaeljclark Should I point this PR to a new branch? Re Happy to consider this patch GPL or whatever license is appropriate. |
|
We'll have to think about branches. Given we're going through the upstreaming process, things are a bit odd as we don't have our port in master, and
You could make the pull request against From doing a grep on the source, there seems to be several MIT licensed files that handle initrd in device-tree, in the target/ppc directory. |
|
I've created a |
Logic for initrd start address borrowed from arm/boot.c
|
Otherwise I guess we have to merge a patch to switch the license to GPL, so its compatible. |
|
Rebased on |
|
@michaeljclark Who should make the call about the license question? |
|
@palmer-dabbelt said okay to GPL. I guess we can just switch the file to GPL. There is not anything particularly proprietary in there. Let me patch the license header... |
|
Merged. |
create_fdt sets the fdt variable on RISCVVirtState and this is used to access the fdt. This reverts a change introduced in riscvarchive#109 which introduced a redundant return value, overlooking the RISCVVirtState structure member that made create_fdt inconsistent with the other RISC-V machines. The other alternative is to change the other boards to return the fdt. Note: the RISCVVirtState also contains fdt_size. Signed-off-by: Michael Clark <mjc@sifive.com> Signed-off-by: Palmer Dabbelt <palmer@sifive.com>
create_fdt sets the fdt variable on RISCVVirtState and this is used to access the fdt. This reverts a change introduced in riscvarchive#109 which introduced a redundant return value, overlooking the RISCVVirtState structure member that made create_fdt inconsistent with the other RISC-V machines. The other alternative is to change the other boards to return the fdt. Note: the RISCVVirtState also contains fdt_size. Cc: Sagar Karandikar <sagark@eecs.berkeley.edu> Cc: Bastian Koppelmann <kbastian@mail.uni-paderborn.de> Signed-off-by: Michael Clark <mjc@sifive.com> Signed-off-by: Palmer Dabbelt <palmer@sifive.com>
create_fdt sets the fdt variable on RISCVVirtState and this is used to access the fdt. This reverts a change introduced in riscvarchive#109 which introduced a redundant return value, overlooking the RISCVVirtState structure member that made create_fdt inconsistent with the other RISC-V machines. The other alternative is to change the other boards to return the fdt. Note: the RISCVVirtState also contains fdt_size. Cc: Sagar Karandikar <sagark@eecs.berkeley.edu> Cc: Bastian Koppelmann <kbastian@mail.uni-paderborn.de> Signed-off-by: Michael Clark <mjc@sifive.com> Signed-off-by: Palmer Dabbelt <palmer@sifive.com>
create_fdt sets the fdt variable on RISCVVirtState and this is used to access the fdt. This reverts a change introduced in riscvarchive#109 which introduced a redundant return value, overlooking the RISCVVirtState structure member that made create_fdt inconsistent with the other RISC-V machines. The other alternative is to change the other boards to return the fdt. Note: the RISCVVirtState also contains fdt_size. Cc: Sagar Karandikar <sagark@eecs.berkeley.edu> Cc: Bastian Koppelmann <kbastian@mail.uni-paderborn.de> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Signed-off-by: Michael Clark <mjc@sifive.com> Signed-off-by: Palmer Dabbelt <palmer@sifive.com>
create_fdt sets the fdt variable on RISCVVirtState and this is used to access the fdt. This reverts a change introduced in riscvarchive#109 which introduced a redundant return value, overlooking the RISCVVirtState structure member that made create_fdt inconsistent with the other RISC-V machines. The other alternative is to change the other boards to return the fdt. Note: the RISCVVirtState also contains fdt_size. Cc: Sagar Karandikar <sagark@eecs.berkeley.edu> Cc: Bastian Koppelmann <kbastian@mail.uni-paderborn.de> Signed-off-by: Michael Clark <mjc@sifive.com> Signed-off-by: Palmer Dabbelt <palmer@sifive.com> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
create_fdt sets the fdt variable on RISCVVirtState and this is used to access the fdt. This reverts a change introduced in riscvarchive#109 which introduced a redundant return value, overlooking the RISCVVirtState structure member that made create_fdt inconsistent with the other RISC-V machines. The other alternative is to change the other boards to return the fdt. Note: the RISCVVirtState also contains fdt_size. Cc: Sagar Karandikar <sagark@eecs.berkeley.edu> Cc: Bastian Koppelmann <kbastian@mail.uni-paderborn.de> Signed-off-by: Michael Clark <mjc@sifive.com> Signed-off-by: Palmer Dabbelt <palmer@sifive.com> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
create_fdt sets the fdt variable on RISCVVirtState and this is used to access the fdt. This reverts a change introduced in #109 which introduced a redundant return value, overlooking the RISCVVirtState structure member that made create_fdt inconsistent with the other RISC-V machines. The other alternative is to change the other boards to return the fdt. Note: the RISCVVirtState also contains fdt_size. Cc: Sagar Karandikar <sagark@eecs.berkeley.edu> Cc: Bastian Koppelmann <kbastian@mail.uni-paderborn.de> Signed-off-by: Michael Clark <mjc@sifive.com> Signed-off-by: Palmer Dabbelt <palmer@sifive.com> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
create_fdt sets the fdt variable on RISCVVirtState and this is used to access the fdt. This reverts a change introduced in riscvarchive#109 which introduced a redundant return value, overlooking the RISCVVirtState structure member that made create_fdt inconsistent with the other RISC-V machines. The other alternative is to change the other boards to return the fdt. Note: the RISCVVirtState also contains fdt_size. Cc: Sagar Karandikar <sagark@eecs.berkeley.edu> Cc: Bastian Koppelmann <kbastian@mail.uni-paderborn.de> Signed-off-by: Michael Clark <mjc@sifive.com> Signed-off-by: Palmer Dabbelt <palmer@sifive.com> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Logic for initrd start address borrowed from arm/boot.c