On Tue, Oct 12, 2021 at 10:43:01AM +0100, Alex Benn??e via Stratos-dev wrote:
Mathieu Poirier mathieu.poirier@linaro.org writes:
Good day,
On Fri, 8 Oct 2021 at 04:44, Alex Bennée alex.bennee@linaro.org wrote:
Mathieu Poirier mathieu.poirier@linaro.org writes:
Hi Alex,
Thanks for the write-up, that was quite useful.
2.6 Running Dom0 ────────────────
To avoid complications with broken grub and bios firmware I'm currently just using my direct boot:
┌──── │ ./qemu-system-aarch64 -machine virt,virtualization=on \ │ -cpu cortex-a57 -serial mon:stdio \ │ -nic user,model=virtio-net-pci,hostfwd=tcp::2222-:22 \ │ -device virtio-scsi-pci \ │ -drive file=/dev/zvol/hackpool-0/debian-buster-arm64,id=hd0,index=0,if=none,format=raw \ │ -device scsi-hd,drive=hd0 \ │ -display none \ │ -m 8192 \ │ -kernel ~/lsrc/xen/xen.build.arm64-xen/xen/xen \ │ -append "dom0_mem=2G,max:2G dom0_max_vcpus=4 loglvl=all guest_loglvl=all" \ │ -device guest-loader,addr=0x46000000,kernel=$HOME/lsrc/linux.git/builds/arm64/arch/arm64/boot/Image,bootargs="root=/dev/sda2 console=hvc0 earlyprintk=xen" \ │ -smp 8 └────
Question from a neophyte... I don't know if it is a Xen or a QEMU problem but with the above command line my dom0 kernel couldn't recognise the partition inside of the image and as such wouldn't mount a file system. I had to use the virtio-blk-device interface instead of virtio-scsi-pci as follow:
./qemu-system-aarch64 \ -machine virt,virtualization=on \ -cpu cortex-a57 -serial mon:stdio \ -nic user,model=virtio-net-pci,hostfwd=tcp::8022-:22 \ -drive file=debian-buster-arm64,id=hd0,index=0,if=none,format=raw \ -device virtio-blk-device,drive=hd0 \ -display none \ -m 8192 -smp 4\ -kernel /home/mpoirier/work/stratos/xen/xen/xen/xen \ -append "dom0_mem=2G,max:2G dom0_max_vcpus=4 loglvl=all guest_loglvl=all" \ -device guest-loader,addr=0x46000000,kernel=/home/mpoirier/work/stratos/kernel/builds/dom0/arch/arm64/boot/Image,bootargs="root=/dev/vda2 console=hvc0 earlyprintk=xen"
The "-device guest-loader" option isn't supported on X86. Is there a similar method for booting Xen from qemu-system-x86_64 or will I have to follow the same heuristic that includes grub on real HW?
The device-loader only works with dynamic DTB based machines which is in practice the aarch64 and riscv "virt" machine models. I assume x86 involves some sort of ACPI but I've no idea how you would emulate that with QEMU rather than having the full bootchain. That said x86 Xen is at least more widely tested so I suspect has been less prone to bitrot.
Just FYI. I don't know this is a normal way for x86 systems, but we can make use of grub for "multiboot". What I actually practiced when I was developing my virtio-proxy was to take the following boot sequence: qemu => TF-A => U-Boot => grub => Xen + distro (Debian in my case) (Why U-Boot? Because U-Boot (on arm64) can boot grub as an EFI image.)
In a grub configuration, you can create a boot menu like: (for x86) multi_boot /boot/xen.efi ... module /boot/vmlinuz ... module --nounzip /boot/initrd.img ... (for arm64) xen_hypervisor /boot/xen.efi ... xen_module /boot/vmlinuz ... xen_module --nounzip /boot/initrd.img ...
Thanks, -Takahiro Akashi
I also found the qemu-xen git tree [1] but haven't made sense of it yet. Peter Maydell's name is all over that one so he may be the best person to ask.
[1]. https://xenbits.xen.org/gitweb/?p=qemu-xen.git%3Ba=summary
Only because he's the lead maintainer for QEMU. That is Xen's copy which is broadly the same as upstream QEMU with maybe one or two Xen specific patches on top which haven't made it upstream yet.
Only then was I able to boot my dom0 kernel up to a command line. My baselines are:
xen: c76cfada1cfa tools/libacpi: Use 64-byte alignment for FACS QEMU: ecf2706e271f Update version for v6.1.0-rc4 release
I think it all comes down to the kernel config. I tend to use virtio-pci because it should make discovery easier but it does require the kernel having support for PCI and the generic PCI bus controller. You also need the appropriate SCSI bits for chaining SCSI via VirtIO.
Ah perfect - the end result is the same then.
-- Alex Bennée -- Stratos-dev mailing list Stratos-dev@op-lists.linaro.org https://op-lists.linaro.org/mailman/listinfo/stratos-dev