Turn on KVM on the VIM4

I received vim4 now. but, kvm is not supported now. ( checking : $kvm-ok )
build image is vim4-ubuntu-22.04-gnome-linux-5.4-fenix-1.4-221229-emmc.img

Other topic related to KVM is Cannot run KVM on the VIM4
that means I need to add configurations in /build/linux/arch/arm64/configs/defconfig
CONFIG_VIRTUALIZATION=y
CONFIG_KVM=y
CONFIG_KVM_MMIO=y
CONFIG_KVM_ARM_HOST=y

Actually, I don’t know kernel build. so, please let me know if Khadas can share image which is supporting KVM and how to update.

Thanks.

Pretty straight forward.
Download and install fenix.
Steps are in the docs, I don’t recall exactly where.

Cannot run KVM on the VIM4, as mentioned, I don’t know /build/linux/arch/arm64/configs/defconfig , let me know if this is kernel source or not. where can I see this directory?
I saw GitHub - khadas/fenix: One-stop script set to build Ubuntu/Debian images github. but, I can’t find /build/linux/arch/arm64/configs/defconfig directory. my board is ubuntu 22.04.
thanks.

Original author of the other thread here. You should be able to get KVM to be detected with those kernel build configs and the process is very similar to just recompiling the kernel with Fenix. Keep also in mind you also need to patch the dts to have access to vGIC2, which is required for virtualizing anything. I got a simple vm to run but i never upstreamed the patches since I switched to another ARM board for KVM work with a more modern kernel. Best of luck with your efforts :slight_smile:

1 Like

Hello @RHnnue

Please check here:

https://docs.khadas.com/products/sbc/vim4/development/linux/build-ubuntu
https://docs.khadas.com/products/sbc/vim4/development/linux/build-linux-kernel

Any way, we will add such configs in next release.

Hello,

Thank you for information. I updated kernel build successfully. kvm-ok is ok. but,
there is a new problem. when I run launch_cvd, then,
Address family not supported by protocolSetup failed for ModemSimulator
please let me know if you met and solve this problem. I’m not sure if this problem is related to kernel config.
Thank you

Are you using launch_cvd in qemu or CrosVM mode? I think there’s a flag to disable the modem emulation. Keep in mind that even if you manage to run it(I don’t remember how I did) the only graphics acceleration that works is via swiftshader and the emulated devices are incredibly slow. I gave up and use an M1 now but if you manage to get it working with virglrenderer please let me know how.

Hello,
I use CrosVM only. but, it’s not working. CrosVM is abnormally crashed repeatly. you mean “need to patch the dts to have access to vGIC2” is to solve this problem? if then, how can I fix it?
it seems this is about MSM chip.

Thank you.

You need a vGIC to have an ARM Virtual Machine that has functioning interrupts, and without those you can’t run any operating system. There is a git style patch that is on the previous thread that should fix it. Don’t assume it’ll fix the error you’re running into however. It’s even possible that it’s already upstreamed.

Hello,
It’s working fine. Thank you for your information.

Happy to hear it’s working fine, was it only the DTS patch and the kernel config? Did you manage to get GPU acceleration working?

Hello,
I have a question.
With KVM working, what OS where you able to run, and how good/usable is it?
thanks.