3 ms·
How does the OS <discover/gain access to/build/enumerate> the device tree? Edit: Apparently the device tree is handled by the firmware (UEFI?), so that a RISC-
by formerly_proven 6y ago
How does the OS <discover/gain access to/build/enumerate> the device tree?
Edit: Apparently the device tree is handled by the firmware (UEFI?), so that a RISC-V OS asks the firmware to provide the device tree and I suppose if it ever gets to desktops, it'd be firmware's job to figure out what CPU is plugged into the board. The current state seems to only cater to integrated systems, though?
- microcolonel 6y agoThe firmware or the bootloader leaves it in memory somewhere. Re: the added question on "integrated systems": your VM hypervisor will map a device tree for VM guests as well, this is how QEMU and other hypervisors expose virtio devices to guests as well.
- formerly_proven 6y agoYeah, but that sort of punts the question of "how does the [firmware] code figure out what CPU is being used", unless that's backed into the firmware at build time.
- monocasa 6y agoYep, it's baked into the firmware somehow. Sometimes it'll actually be linked in, sometimes the firmware knows where in flash or whatever to grab it from before loading the kernel, sometimes the firmware knows how to interrogate hardware and generate a new one. Sometimes it's a combo of all three.
- cmrx64 6y agoyeah, it usually is, that's how those device trees work. it's generally bundled with the "bootloader" (chain loader component of the firmware). you can even bake them into your kernel if you want, i believe. RISC-V is a processor ISA, not a platform spec. you may be interested in the SBI: https://github.com/riscv/riscv-sbi-doc/blob/v0.2.0/riscv-sbi.adoc https://github.com/riscv/riscv-sbi-doc/blob/v0.2.0/riscv-sbi... the details of how all this stuff works at a human-collaboration level has changed a bit since 1993. there's a higher level of collaboration expected. vs intel and ms bossing people around. edit: you may also be interested in https://doc.coreboot.org/arch/riscv/index.html https://doc.coreboot.org/arch/riscv/index.html and https://lkml.org/lkml/2020/2/25/1209 https://lkml.org/lkml/2020/2/25/1209 and https://lists.gnu.org/archive/html/grub-devel/2019-02/msg00021.html https://lists.gnu.org/archive/html/grub-devel/2019-02/msg000... not exactly "desktop" yet, but hopefully you can see how that might look, given the existing linux infrastructure :)