MinhNV
MinhNV

Reputation: 324

How to enable accel=kvm (or --enable-kvm) while running qemu on arm host (arm guest)

in Linux x86_64 host machine, can simply run qemu with KVM enable by this command

qemu-system-x86_64 \ 
-enable-kvm \
-cpu max \
-smp cores=4,threads=1 \
-m 4096 \
-nographic \
-hda hd.raw \
-hdb cloud.img \
-device virtio-net-pci,netdev=n1 \
-netdev user,id=n1,hostfwd=tcp::2222-:22

In the guest machine, the performance gets almost native host performance.

Now I want to run an Arm guest machine in an Arm Host (ex: raspberry pi) and it does not allow me to enable kvm, How can I get near-native performance in an Arm guest machine (Arm host linux)

Upvotes: 1

Views: 5491

Answers (1)

Peter Maydell
Peter Maydell

Reputation: 11533

The basic principle is the same as for x86, but there are some restrictions:

  • Your host must be running 64-bit Arm, not 32-bit
  • You need to use the qemu-system-aarch64 binary
  • You need to pass -enable-kvm
  • You need to tell QEMU to emulate a machine type which supports KVM: this means the 'virt' machine type
  • You need to tell QEMU to give the guest the same CPU and interrupt controller as the host: '-cpu host -machine gic-version=host'

You also of course need to have a QEMU command line that works in the first place, i.e. passing QEMU a guest kernel that has support for the machine type and devices being emulated, a suitable filesystem, whatever devices you need, etc -- all the things you need for any kind of QEMU run, whether pure emulated or accelerated.

Upvotes: 5

Related Questions