Support for ramdisks in PVH boot

Pierre Pronchery <[email protected]>
Newsgroups gmane.os.netbsd.devel.kernel
Message-ID <[email protected]>
			Hi tech-kern@,

This post is related to iMil's recent work on PVH support for NetBSD/amd64.
I was unable to use his work to boot on ramdisks directly with QEMU's -
initrd flag, when using -kernel.

Well after a deep dive into it, I think I am almost there:
https://git.edgebsd.org/gitweb/?
p=src.git;a=commitdiff;h=629621f41089af50584214a4d32b50ae8ee414f2

This patch:
- extends sys/arch/amd64/amd64/genassym.cf for additional knowledge of
  Xen's hvm_start_info (notably nr_modules and modlist_paddr)
- extends .start_genpvh in locore.S to copy the module entries, and their
  respective command lines and contents
- teaches x86_machdep.c to load Xen modules when a VM_GUEST_GENPVH guest

The code is not working yet unfortunately.
On an Intel-macOS host:

$ qemu-system-x86_64 -m 512 -accel hvf -cpu host -display none -serial \
  stdio -kernel netbsd-GENERIC -initrd ramdisk-cgdroot.fs -append \
  "console=com rw -v" -action reboot=shutdown -D qemu.log -d \
  cpu_reset,in_asm,guest_errors,unimp -drive \
  file=ld0.img,format=raw,if=virtio
[...]
[   4.5370781] boot device: ld0
[   4.5370781] md0: internal 5000 KB image area
[   4.5370781] root on md0a dumps on md0b
[   4.5370781] uvm_fault(0xffffffff81912da0, 0xffffffff9faf8000, 1) -> e
[   4.5370781] fatal page fault in supervisor mode
[   4.5370781] trap type 6 code 0 rip 0xffffffff80ff3274 cs 0x8 rflags 
0x10206 cr2 0xffffffff9faf8ff8 ilevel 0 rsp 0xffffffff81a07c38
[   4.5484101] curlwp 0xffffffff8188bfc0 pid 0.0 lowest kstack 
0xffffffff81a022c0
kernel: page fault trap, code=0
Stopped in pid 0.0 (system) at  ffffffff80ff3274:       movq    
fffffffffffffff8
(%rsi,%rdx,1),%r10

It seems to fail in bdev_strategy(); as of right now I do not know why.
I suspect my assembly code in locore.S to need review in particular.
Therefore: your help in completing this is very welcome.

Cheers & HTH,
-- 
khorben
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.