Skip to content

h2: capture boot registers and forward a DTB address to the Linux guest#72

Open
Brian Cain (androm3da) wants to merge 2 commits into
qualcomm:masterfrom
androm3da:bcain/qemu_boot-2
Open

h2: capture boot registers and forward a DTB address to the Linux guest#72
Brian Cain (androm3da) wants to merge 2 commits into
qualcomm:masterfrom
androm3da:bcain/qemu_boot-2

Conversation

@androm3da

Copy link
Copy Markdown
Member

Platform boot firmware may hand the kernel boot parameters in r1:0 at reset; a bootloader passes the generated device tree blob's physical address there. Those registers were clobbered during early init, so guests could never see them and fell back to built-in device trees.

Reserve a boot parameter block at a fixed offset in the entry page -- alongside the angel mailbox area, and patchable by external tooling -- and capture r1:0 into it on the boot thread before anything clobbers them. Expose the captured values through two new info-trap operations, INFO_BOOT_R00 and INFO_BOOT_R01, appended to the enum to preserve the existing ABI.

loadlinux reads them, validates the address (alignment plus FDT magic), and passes it as the vmboot argument, which lands in the guest's r1:0 per the existing thread-create convention. The Linux kernel's RISC-V style boot protocol picks the DTB address up from there and adopts the generated device tree.

Platform boot firmware may hand the kernel boot parameters in r1:0 at
reset; a bootloader passes the generated device tree blob's physical
address there.  Those registers were clobbered during early init, so
guests could never see them and fell back to built-in device trees.

Reserve a boot parameter block at a fixed offset in the entry page --
alongside the angel mailbox area, and patchable by external tooling --
and capture r1:0 into it on the boot thread before anything clobbers
them.  Expose the captured values through two new info-trap operations,
INFO_BOOT_R00 and INFO_BOOT_R01, appended to the enum to preserve the
existing ABI.

loadlinux reads them, validates the address (alignment plus FDT magic),
and passes it as the vmboot argument, which lands in the guest's r1:0
per the existing thread-create convention.  The Linux kernel's RISC-V
style boot protocol picks the DTB address up from there and adopts the
generated device tree.

Signed-off-by: Brian Cain <brian.cain@oss.qualcomm.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

untested Mark untested PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant