From 953318ab09ed18e1a6624cce80566872a34bcf18 Mon Sep 17 00:00:00 2001 From: Helmut Grohne Date: Sat, 21 Jan 2023 07:20:22 +0100 Subject: debvm-run: compute -machine independently of being native When running on armhf natively, there also is no default machine, so we should also pass -machine virt there. That likely affects all arms and riscv64 as well. --- bin/debvm-run | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) (limited to 'bin') diff --git a/bin/debvm-run b/bin/debvm-run index 7847cba..35a3459 100755 --- a/bin/debvm-run +++ b/bin/debvm-run @@ -217,7 +217,18 @@ set -- \ -device "virtio-net-pci,netdev=net0" \ "$@" +MACHINE= MAX_SMP= + +case "$VMARCH" in + amd64) + MACHINE="type=q35" + ;; + arm|arm64|armel|armhf|riscv64) + MACHINE="type=virt" + ;; +esac + if test "$ARCHITECTURE" = "$VMARCH"; then QEMU=kvm # While kvm will fall back gracefully, the following options can only @@ -227,7 +238,7 @@ if test "$ARCHITECTURE" = "$VMARCH"; then fi case "$VMARCH" in arm64) - set -- -machine type=virt,gic-version=host "$@" + MACHINE="$MACHINE,gic-version=host" ;; esac else @@ -238,11 +249,11 @@ else ;; arm64) QEMU=qemu-system-aarch64 - set -- -machine virt -cpu max "$@" + set -- -cpu max "$@" ;; arm|armel|armhf) QEMU=qemu-system-arm - set -- -machine virt -cpu max "$@" + set -- -cpu max "$@" ;; powerpc) QEMU=qemu-system-ppc @@ -261,19 +272,16 @@ else mipsel) MAX_SMP=1 ;; - riscv64) - set -- -machine virt "$@" - ;; sparc64) MAX_SMP=1 ;; esac fi -case "$VMARCH" in - amd64) - set -- -machine q35 "$@" - ;; -esac + +if test -n "$MACHINE"; then + set -- -machine "$MACHINE" "$@" +fi + if test -z "$MAX_SMP" || test "$MAX_SMP" -gt 1; then NPROC=$(nproc) test -n "$MAX_SMP" && test "$NPROC" -gt "$MAX_SMP" && NPROC=$MAX_SMP -- cgit v1.2.3