Is it possible to enable virtio pci drivers on VM hosted by TX2?

Hi everyone,

Thanks to gattis and marcus_c, i was able to launch a VM with KVM/Qemu on tx2 eventually.

To go further in my current work, i need to enable virtio pci driver on the VM.

Here are things what i had done:

  1. host kernel config [kernel version:4.4.38]
#nvidia@tegra-ubuntu:/boot$ zgrep VIRTIO /proc/config.gz
CONFIG_VIRTIO_BLK=y
# CONFIG_SCSI_VIRTIO is not set
# CONFIG_VIRTIO_NET is not set
# CONFIG_VIRTIO_CONSOLE is not set
CONFIG_TRUSTY_VIRTIO=y
CONFIG_TRUSTY_VIRTIO_IPC=y
CONFIG_VIRTIO=y
CONFIG_VIRTIO_PCI=y
CONFIG_VIRTIO_PCI_LEGACY=y
CONFIG_VIRTIO_BALLOON=y
CONFIG_VIRTIO_INPUT=y
CONFIG_VIRTIO_MMIO=y
# CONFIG_VIRTIO_MMIO_CMDLINE_DEVICES is not set
  1. guest kerenl config [kernel version:3.19.0-28-generic]
root@localhost:~$ cat /boot/config-3.19.0-28-generic | grep -i "virtio"
CONFIG_NET_9P_VIRTIO=m
CONFIG_VIRTIO_BLK=y
CONFIG_SCSI_VIRTIO=m
CONFIG_VIRTIO_NET=y
CONFIG_CAIF_VIRTIO=m
CONFIG_VIRTIO_CONSOLE=y
CONFIG_HW_RANDOM_VIRTIO=m
CONFIG_VIRTIO=y
# Virtio drivers
CONFIG_VIRTIO_PCI=y
CONFIG_VIRTIO_BALLOON=y
CONFIG_VIRTIO_MMIO=y
CONFIG_VIRTIO_MMIO_CMDLINE_DEVICES=y
  1. Run Qemu as follow
taskset 0x39 $QEMU  -machine virt  -cpu cortex-a57 \                                                                              
               -smp 4 -m 4096 \                                                                                                      
               -enable-kvm \                                                                                                         
               -device virtio-scsi-device,id=scsi \                                                                                  
               -device virtio-scsi-pci,id=pci \                                                                                      
               -kernel vmlinuz-3.19.0-28-generic \                                                                                   
               -initrd initrd.img-3.19.0-28-generic \                                                                                                                                                                          
               -device scsi-hd,drive=coreimg \                                                                                       
               -drive file="$DISK_FILE",id=coreimg,cache=unsafe,if=none \                                                                                                                                                    
               -netdev user,id=unet -device virtio-net-device,netdev=unet  \                                                         
               --append "console=ttyAMA0 root=/dev/sda" \                                                                            
               --redir tcp:2228::22 \                                                                                                
               -vnc :2 \                                                                                                             
               -device VGA -device ne2k_pci

However, run sudo lspci -nvv on guest show nothing!?
I had try similar setup on X86 environment, sudo lspci -nvv will output

... ...
Kernel driver in use: virtio-pci
...

Questions:

  1. Does it related to dtb files? cause in order to boot tx2 in hyp mode, i had change some .dtsi file.
  2. Possible some loss of kernel config options?
  3. Anything else I can try?

Thanks for your time ^0^

We are not yet providing VM support. Maybe other user can share their experience here.

My modification can let TX2’s a57 cores boot into Hyp mode, work fine together with KVM/QEMU.
Is TX2 not compatible with VIRTIO framework?

Hi jordan.huang,

I have virtio+9p working fine in my KVM guest, so it is definitely possible to use.

Since you built virtio as a module, did you remember to load it in the guest?

I’m using Linux 4.14.15 for the guest. Here’s my guest kernel configuration: Kernel configuration for big endian aarch64 KVM guest · GitHub

Note that my guest is big endian, you can change that if you want to.

This is my qemu invocation line:

taskset 0x39 qemu-system-aarch64 -machine virt -cpu host -enable-kvm -nographic -smp 1 -m 2048 \
  -virtfs local,path=/usr/aarch64_be-unknown-linux-gnu,mount_tag=root9p,security_model=passthrough,id=root9p \
  -virtfs local,path=/home,mount_tag=home9p,security_model=passthrough,id=home9p \
  -kernel "$KERNEL" -append "$CMDLINE"

From my guest I can do

sh-4.4# lspci
00:00.0 Host bridge: Red Hat, Inc. QEMU PCIe Host bridge
00:01.0 Ethernet controller: Red Hat, Inc. Virtio network device
00:02.0 Unclassified device [0002]: Red Hat, Inc. Virtio filesystem
00:03.0 Unclassified device [0002]: Red Hat, Inc. Virtio filesystem
sh-4.4#

Hi marcus_c,

Thank you for your continued support, it really help me a lot. :)

By comparing my kernel config with yours, i found something difference related to “IOMMU”, and directly update the guest kernel to ver.4.2.0-18 makes it work!

Hi all,

I successfully create virtual machines using KVM on Jetson TX2. If you are interested, please see my Github repository for detailed information.

Baoqian Wang

Hi Baoqian,

Even the VM is not we suggested, but thanks anyway for the sharing.

How to confim that GPU passthough worked for the VM after VM installation is succesfull?

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.