graphic: 0.887 performance: 0.827 kernel: 0.799 arm: 0.755 hypervisor: 0.746 device: 0.735 architecture: 0.727 ppc: 0.628 peripherals: 0.626 KVM: 0.622 network: 0.619 semantic: 0.605 PID: 0.546 mistranslation: 0.538 debug: 0.536 register: 0.502 socket: 0.466 vnc: 0.461 risc-v: 0.433 permissions: 0.398 user-level: 0.368 VMM: 0.356 virtual: 0.353 files: 0.316 boot: 0.293 TCG: 0.286 assembly: 0.215 i386: 0.123 x86: 0.099 `-M none` breaks on ARM64 platforms with max IPA size < 40 Description of problem: QEMU fails to initialize the KVM type properly when `-M none` is used. On ARM64, the KVM type sets the IPA size. Without that setting, the kernel defaults to 40 bits. This fails on machines which cannot support that IPA size, such as Apple M1 machines. This presumably happens because `virt_machine_class_init()` in `hw/arm/virt.c` never gets called in that case, which means it doesn't initialize `mc->kvm_type` to the correct callback to do the IPA check. Since the max IPA size is a property of the host CPU and must be queried properly for things to work at all, this logic should be invoked unconditionally for all machines, even `none`. This is breaking libvirt on Apple M1/M2 systems, since it uses `-M none,accel=kvm` for its KVM test, and when it fails it considers KVM support unavailable. See: https://gitlab.com/libvirt/libvirt/-/issues/365 Steps to reproduce: On any ARM64 machine: 1. strace -e ioctl qemu-system-aarch64 -M none,accel=kvm 2>&1 | grep -C1 CREATE_VM 2. strace -e ioctl qemu-system-aarch64 -M virt,accel=kvm 2>&1 | grep -C1 CREATE_VM Observe that the first command line does not issue a `KVM_CAP_ARM_VM_IPA_SIZE` and does not set the machine type argument to `KVM_CREATE_VM`, while the second one does. On machines with <40 bit max IPA, the first invocation would fail to initialize KVM.