how to enable KVM on TX2

hello I am trying to add KVM support into kernal.

I am following the link http://www.jetsonhacks.com/2017/03/25/build-kernel-and-modules-nvidia-jetson-tx2/

in xconfig file, I choose Virusualization option with KVM support.

during makeKernal.sh step, it reports errors.

include/linux/irqchip/arm-gic.h: Assembler messages:
include/linux/irqchip/arm-gic.h:100: Error: unknown mnemonic enum' -- enum domain_gic_pm_event{’
include/linux/irqchip/arm-gic.h:101: Error: unknown mnemonic mod_domain_power_on' -- mod_domain_power_on,’
include/linux/irqchip/arm-gic.h:102: Error: unknown mnemonic mod_domain_power_off' -- mod_domain_power_off’
include/linux/irqchip/arm-gic.h:103: Error: junk at end of line, first unrecognized character is `}’
scripts/Makefile.build:297: recipe for target ‘arch/arm64/kvm/vgic-v2-switch.o’ failed
make[1]: *** [arch/arm64/kvm/vgic-v2-switch.o] Error 1
Makefile:973: recipe for target ‘arch/arm64/kvm’ failed
make: *** [arch/arm64/kvm] Error 2

My question is more general. How to enable KVM on TX2 board?

Thanks in advance.

Hi yanxin,

Please check if can find clue from https://devtalk.nvidia.com/default/topic/1008520/

Cheers

Hi yanxin.

Nvidia made a mistake when porting their stuff to 4.4. In arm-gic.h you will see that a line #ifndef ASSEMBLY appears after the “enum domain_gic_pm_event” declaration. The #ifndef should of course be before the declaration since enums are not valid assembly language either.

Moving the #ifndef should allow you to compile the file, however KVM still does not work on the TX2. The message in dmesg during boot is:

[ 0.418998] kvm [1]: error getting vgic maintenance irq from DT
[ 0.419054] kvm [1]: error initializing Hyp mode: -6

So it seems there is something missing from the Device Tree as well.

This reminds me that I should probably make a patch for all the mistakes I found and fixed in the 4.4 kernel sources and publish them somewhere. (There are other kernel features which do work but which can’t be compiled either with unpatched sources.)

Hello,
the same problem exists for me with the patch and L4T/r28_Release_v1.0 sources.

Hi great_humungus.

Please find a complete set of my changes to 28.1 as a patch here:
http://mc.pp.se/l4t-sources-28-1.patch

This includes the changes to the device tree needed for KVM to work (see this thread).

This was enough for me to get KVM running on the TX2 (but see the notes on core type affinity in the other thread) with 28.1.

Haven’t tried 28.2 yet.