PINE64
Enable KVM on default OS (Debian 9) - Printable Version

+- PINE64 (https://forum.pine64.org)
+-- Forum: Pinebook Pro (https://forum.pine64.org/forumdisplay.php?fid=111)
+--- Forum: Linux on Pinebook Pro (https://forum.pine64.org/forumdisplay.php?fid=114)
+--- Thread: Enable KVM on default OS (Debian 9) (/showthread.php?tid=8391)



Enable KVM on default OS (Debian 9) - colemancda - 11-20-2019

Hi, I just received my PineBook Pro yesterday and I am using the default OS with Debian 9 (32bit user space, 64bit kernel). I would like to recompile the kernel to enable the KVM module. I want to test containers and possibly Windows 10 on ARM. I have seen the images on the wiki, but I am not sure where the sources are to build an image myself, although ideally I just want to update the kernel on my existing OS. Since there are so many repos and distros for the PineBook Pro, I am not sure where to start. I don't want to lose all the great driver support, like the Mali drivers, I am hoping someone could share simple instructions to clone the repo of the kernel, build a .deb and install a kernel upgrade. Or in any case, this could possibly be a feature request for @Mrfixit2001  or @ayufan to include in the official image?


RE: Enable KVM on default OS (Debian 9) - colemancda - 11-20-2019

See also  Ubuntu 19.10 for the Raspberry Pi 4 with a KVM-enabled kernel & Windows 10 guest

https://www.raspberrypi.org/forums/viewtopic.php?f=56&t=248345&p=1526221#p1526221


RE: Enable KVM on default OS (Debian 9) - nixcamic - 11-21-2019

I'd also be interested in this.


RE: Enable KVM on default OS (Debian 9) - manawyrm - 11-22-2019

It works very well on the current Manjaro preview:
[Image: xbcgefjhdiw.png]
[Image: rtpycmqudkx.png]
Code:
#!/bin/bash
export QEMU_AUDIO_DRV=pa

sudo qemu-system-aarch64 \
-cpu host \
-enable-kvm \
-M virt-2.12 \
-smp 2 \
-m 1.5G \
-bios QEMU_EFI.fd \
-device ramfb \
-device ich9-usb-ehci1 \
-device usb-kbd \
-device usb-mouse \
-device usb-tablet \
-device usb-storage,drive=drivers \
-drive if=none,id=drivers,media=cdrom,file=virtio-win-0.1.173.iso \
-device virtio-blk,drive=system \
-drive if=none,id=system,format=qcow2,file=system.qcow2 \
-soundhw hda \
-device usb-ehci,id=ehci -device usb-host,bus=ehci.0,vendorid=0x0bda,productid=0x8153

I used a USB network card (realtek gigabit), virtio-net and e1000 caused bluescreens. 
KVM only works on the 2 BIG cores, not the 4 little cores. Linux currently can't handle that automatically and the scheduler has problems with it as well. 
For now, I just disable the 4 little cores at runtime using the /sys/devices/system/cpu/cpu{0-3}/online flags. 


Windows image was a 19030.1, for arm64. 
x86 emulation works well, it's quite fast.


RE: Enable KVM on default OS (Debian 9) - Mrfixit2001 - 11-23-2019

Updated kernel in v1.5 update just released. A new release on GitHub was also pushed. I added virtualization and kvm to the kernel, as requested.


RE: Enable KVM on default OS (Debian 9) - astr0baby - 11-30-2019

(11-23-2019, 03:52 PM)Mrfixit2001 Wrote: Updated kernel in v1.5 update just released. A new release on GitHub was also pushed. I added virtualization and kvm to the kernel, as requested.

I can confirm that this does not work on the stock Debian-Desktop distribution with Kernel 4.4.202 
Qemu just bails out that that "kvm" accelerator not found

The Manjaro-ARM   ( Kernel 5.4.0-1) works fine after setting

echo 0 > /sys/devices/system/cpu/cpu0/online
echo 0 > /sys/devices/system/cpu/cpu1/online
echo 0 > /sys/devices/system/cpu/cpu2/online
echo 0 > /sys/devices/system/cpu/cpu3/online

Then the 2 cores work with -enable-kvm  ( tested with qemu-system-aarch64  4.1.93)


RE: Enable KVM on default OS (Debian 9) - Mrfixit2001 - 12-02-2019

(11-30-2019, 05:50 PM)astr0baby Wrote:
(11-23-2019, 03:52 PM)Mrfixit2001 Wrote: Updated kernel in v1.5 update just released. A new release on GitHub was also pushed. I added virtualization and kvm to the kernel, as requested.

I can confirm that this does not work on the stock Debian-Desktop distribution with Kernel 4.4.202 
Qemu just bails out that that "kvm" accelerator not found

The Manjaro-ARM   ( Kernel 5.4.0-1) works fine after setting

echo 0 > /sys/devices/system/cpu/cpu0/online
echo 0 > /sys/devices/system/cpu/cpu1/online
echo 0 > /sys/devices/system/cpu/cpu2/online
echo 0 > /sys/devices/system/cpu/cpu3/online

Then the 2 cores work with -enable-kvm  ( tested with qemu-system-aarch64  4.1.93)

It looks like maybe you're trying to use the 64-bit kvm? The default userspace is 32-bit while the kernel is 64-bit. So it supports 64-bit but you'll need to configure multiarch first. Otherwise I expect qemu-system-arm will work.


RE: Enable KVM on default OS (Debian 9) - astr0baby - 12-02-2019

Is therean official way how to do this for the Debian-Desktop distro ?

The issue is the following on the Pinebook-pro Debian-Desktop 4.4.205 (up2date)

# dpkg --print-architecture
armhf
# dpkg --print-foreign-arhitectures
aarch64
arm64
# dpkg --add-foreign-architecture aarch64
Odd number of elements in hash assignment at /usr/share/pkg-config-dpkghook line 30.
# dkg --add-foreign-architecture arm64
Odd number of elements in hash assignment at /usr/share/pkg-config-dpkghook line 30.