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? 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 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.
Thanks, Mathieu
My kernel has:
✗ grep VIRTIO .config CONFIG_BLK_MQ_VIRTIO=y CONFIG_VIRTIO_VSOCKETS=y CONFIG_VIRTIO_VSOCKETS_COMMON=y CONFIG_BT_VIRTIO=y CONFIG_NET_9P_VIRTIO=y CONFIG_VIRTIO_BLK=y CONFIG_SCSI_VIRTIO=y CONFIG_VIRTIO_NET=y CONFIG_CAIF_VIRTIO=y CONFIG_VIRTIO_CONSOLE=y CONFIG_HW_RANDOM_VIRTIO=y CONFIG_DRM_VIRTIO_GPU=y CONFIG_VIRTIO=y CONFIG_VIRTIO_PCI_LIB=y CONFIG_VIRTIO_MENU=y CONFIG_VIRTIO_PCI=y # CONFIG_VIRTIO_PCI_LEGACY is not set CONFIG_VIRTIO_BALLOON=y CONFIG_VIRTIO_INPUT=y CONFIG_VIRTIO_MMIO=y # CONFIG_VIRTIO_MMIO_CMDLINE_DEVICES is not set CONFIG_VIRTIO_DMA_SHARED_BUFFER=y CONFIG_VIRTIO_IOMMU=y CONFIG_RPMSG_VIRTIO=y CONFIG_VIRTIO_FS=y CONFIG_CRYPTO_DEV_VIRTIO=y
➜ grep PCI .config | grep -v "not set" | grep -v "#" CONFIG_ACPI_PCI_SLOT=y CONFIG_BLK_MQ_PCI=y CONFIG_HAVE_PCI=y CONFIG_PCI=y CONFIG_PCI_DOMAINS=y CONFIG_PCI_DOMAINS_GENERIC=y CONFIG_PCI_SYSCALL=y CONFIG_PCIEASPM=y CONFIG_PCIEASPM_DEFAULT=y CONFIG_PCI_MSI=y CONFIG_PCI_MSI_IRQ_DOMAIN=y CONFIG_PCI_ECAM=y CONFIG_PCI_LABEL=y CONFIG_PCIE_BUS_DEFAULT=y CONFIG_PCI_HOST_COMMON=y CONFIG_PCI_HOST_GENERIC=y CONFIG_USB_PCI=y CONFIG_USB_XHCI_PCI=y CONFIG_USB_EHCI_PCI=y CONFIG_USB_OHCI_HCD_PCI=y CONFIG_VIRTIO_PCI_LIB=y CONFIG_VIRTIO_PCI=y CONFIG_ARM_GIC_V3_ITS_PCI=y CONFIG_GENERIC_PCI_IOMAP=y
Thanks, Mathieu
-- Alex Bennée