You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
arm: do not relocate DTB, instead read it ahead of time
As noted in one of the email threads, the aarch64 build of OSv fails
to boot with the following error: "dtb_setup: failed to move dtb (dtb too large?)".
It turns out that the dtb ("Device Tree Blob") provided by QEMU is 1MB in size which is far
larger that the 64K buffer reserved at the beginning OSV_KERNEL_BASE address. Because of
this, the fdt_move() call to relocate (copy) dtb from the original place
to the reserved buffer fails. It could be that in early days dtb might
have been small enough to fit into 64K area and fdt_move() would succeed.
It is also not clear why dtb had to relocated in first place. Possibly
it was done because the memory where dtb was originally located
would not be unavailable (not mapped) after switching to runtime page tables.
One way to fix this error would be to increase the buffer to 1MB.
But what if that will not be enough in future. Another way is to not
relocate dtb at all and simply pre-read the configuration values from original
dtb and store them in known variables so they can be accessed as needed without
having to read from dtb later.
So this patch modifies the dtb contructor function in arch-dtb.cc to
parse following configuration values from dtb:
- dtb_cpu_count
- dtb_cpus_mpids
- dtb_timer_irq
- dtb_pci_irqmask
- dtb_pci_irqmap_count
- dtb_pci_bdfs
- dtb_pci_irq_ids
It also modifies relevant dtb_get_* functions to simply return the values
of the variables above to the caller instead of parsing them from dtb.
This patch is enough to make OSv aarch64 build and boot again. This
has only been tested on Fedora 29.
./scripts/build -j4 image=native-example fs=ramfs arch=aarch64
qemu-system-aarch64 -s -nographic -machine virt \
-machine gic-version=2 -kernel ./build/release.aarch64/loader.img \
-cpu cortex-a57 -m 1024M \
-append "--verbose --nomount --maxnic=0 /tools/uush.so" -smp 2
Signed-off-by: Waldemar Kozaczuk <jwkozaczuk@gmail.com>
Message-Id: <20191231030407.8641-1-jwkozaczuk@gmail.com>
0 commit comments