Skip to content

Draft: virt-qemu support of arm and ppc

This merge request adds support for arm64, armhf, armel, ppc64el as VM architectures to autopkgtest-virt-qemu.

This is tested the following 6 VMs:

  • i386 VM built by debci setup -b qemu -a i386 -s sid and autopkgtest-build-qemu 5.15 and vmdb2 0.19 in sid,
  • amd64 VM with UEFI booting,
  • arm64, armhf, armel, and ppc64el VMs

Specifically, I did the following tests on an amd64 host:

autopkgtest -B -u debci bash -- qemu -q qemu-system-i386 --debug --show-boot autopkgtest-sid-i386-noefi-madeby-genuine-debci.qcow2
autopkgtest -B -u debci bash -- qemu -q qemu-system-x86_64 --debug --show-boot --efi --qemu-options '-machine q35' autopkgtest-sid-amd64.qcow2
autopkgtest -B -u debci bash -- qemu -q qemu-system-ppc64le --timeout-reboot 300 --debug --show-boot autopkgtest-sid-ppc64el.qcow2
autopkgtest -B -u debci bash -- qemu -q qemu-system-aarch64 --debug --show-boot --efi --timeout-reboot 300 --qemu-options '-machine virt -cpu max' autopkgtest-sid-arm64.qcow2
autopkgtest -B -u debci bash -- qemu -q qemu-system-arm --debug --show-boot --efi --timeout-reboot 600 --qemu-options '-machine virt -cpu max' autopkgtest-sid-armel.qcow2

arm64 and armel testbeds can be run on an amd64 host as above. Then I did the following on an arm64 host:

autopkgtest -B -u debci bash -- qemu -q qemu-system-aarch64 --debug --show-boot --efi --qemu-options '-machine virt -cpu host' autopkgtest-sid-arm64.qcow2
autopkgtest -B -u debci bash -- qemu -q qemu-system-aarch64 --debug --show-boot --efi --qemu-options '-machine virt -cpu host,aarch64=off' autopkgtest-sid-armhf.qcow2
# autopkgtest -B -u debci bash -- qemu -q qemu-system-aarch64 --debug --show-boot --efi --qemu-options '-machine virt -cpu host,aarch64=off' autopkgtest-sid-armel.qcow2
# The last one did not boot... Is it a bug in grub-efi-arm-bin:armel??
# autopkgtest --timeout-factor 10 -B -u debci bash -- qemu -q qemu-system-arm --debug --show-boot --efi --timeout-reboot 600 --qemu-options '-machine virt -cpu max' autopkgtest-sid-armel.qcow2
# The last one timed out. Raspi4 is too slow. Note that the same command succeeded on amd64 as above.
 

All tested VM images are placed at http://153.240.174.134:64193/autopkgtest-VM/

The commit consists of the following changes:

  • Addition of stdin=subprocess.DEVNULL, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL to subprocess.Popen. This is the most important change. Without this, autopkgtest interprets VM's console outputs as responses from autopkgtest-virt-qemu for arm and ppc VMs. This change is really necessary to support arm and ppc VMs. Edit: this behavior is revised. See below.

  • Always use -device pci-serial-2x as /dev/ttyS0 and /dev/ttyS1 in VMs. This is necessary for arm and ppc VMs. amd64 and i386 VMs also now use pci-serial-2x. Conventionally isa-serial is used as it is equipped with the default machines of qemu-system-x86_64 and qemu-system-i386. In order to replace isa-serial by pci-serial-2x, -nodefaults is always given to qemu-system-*. If qemu-system-x86_64 and qemu-system-i386 stick to use isa-serial, then additional conditional branching is necessary, which complicates the program flow.

  • KVM was always enabled when /dev/kvm exists. This prevents qemu from starting arm VMs on amd64 hosts, because KVM acceleration of arm VMs is unavailable on amd64 hosts. Eneblement of KVM is now decided according to combinations of host and VM's architectures.

  • Recoginition of VM's architecture (output of dpkg --print-architecture in a VM) from image filenames. Conventionally VM's architecture is decided by the QEMU command name, and qemu-system-arm gives armhf as VM's architecture. On the other hand, ARM KVM acceleration of 32-bit ARM requires qemu-system-aarch64 (I am not kidding). Therefore, VM's architecture cannot be determined from the QEMU command name. Now VM's architecture is given by new --vm-arch option or guessed by the image filename.

  • Selection of AAVMF and AAVMF32 is now also determined by VM's architecture by using the above change.

  • Error with i386 UEFI booting as Debian i386 OVMF is unavailable.

  • discard=unmap is added to image options. Without this, discard mount option in VM gives warning "discard is not supported on the storage".

  • https://github.com/tianocore/edk2/blob/master/OvmfPkg/README includes unit= to OVMF ROMs in its examples. So unit= added to qemu options.

  • Examples of starting arm and ppc VMs are added to autopkgtest-virt-qemu.1.

  • prepare_overlay is moved after workdir = tempfile.mkdtemp. Without this, preparation of overlay in the temporary directory fails. Edit: this was committed separately as dc3b9eb4

I do not intend this MR as WIP or a draft.

Edited by Ryutaroh Matsumoto

Merge request reports

Loading