Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Passthrough NVIDIA Jetson AGX Orin WiFi card to NetVM #93

Closed
wants to merge 2 commits into from

Conversation

panufi
Copy link
Contributor

@panufi panufi commented Mar 22, 2023

Using qemu as hypervisor instead of crosvm because current version of crosvm didn't support passthrough.

Mika Tammi and others added 2 commits March 22, 2023 09:05
Signed-off-by: Mika Tammi <mika.tammi@unikie.com>
Signed-off-by: Panu Finnila <panu.finnila@unikie.com>
@vilvo
Copy link
Contributor

vilvo commented Apr 11, 2023

Finally got my local aarch64 remote builder working again.
On my local build I added my WIFI here but I'm not getting the netvm to connect the WIFI.

I get the services running:

[ghaf@ghaf-host:~]$ systemctl list-units
...
  microvm-pci-devices@netvm-nvidia-jetson-orin-debug.service                                loaded active exited    Setup MicroVM 'netvm-nvidia-jetson-orin-debug' devices for passthrough
  microvm-tap-interfaces@netvm-nvidia-jetson-orin-debug.service                             loaded active exited    Setup MicroVM 'netvm-nvidia-jetson-orin-debug' TAP interfaces
  microvm@netvm-nvidia-jetson-orin-debug.service                                            loaded active running   MicroVM 'netvm-nvidia-jetson-orin-debug

with

microvm     1091  0.5  2.0 1169728 633244 ?      SLsl 09:06   0:20 /nix/store/349qhx8vl93wzg1x1nqn2khw70djz41d-qemu-host-cpu-only-7.1.0/bin/qemu-system-aarch64 -name netvm -M virt,gic-version=max,accel=kvm:tcg -m 512 -cpu host -smp 1 -machine virt,accel=kvm -nodefaults -no-user-config -nographic -no-reboot -serial null -device virtio-serial-device -chardev pty,id=con0 -device virtconsole,chardev=con0 -chardev stdio,mux=on,id=con1,signal=off -device virtconsole,chardev=con1 -device virtio-rng-device -drive id=root,format=raw,media=cdrom,file=/nix/store/72fbh7njml2q1mjmvsx5d0pd3zvp6ysv-rootfs.squashfs,if=none,aio=io_uring -device virtio-blk-device,drive=root -kernel /nix/store/rv8xg9n24m3gax8lz8wwk1kkdfba0h39-linux-6.2/Image -append console=hvc1 console=hvc0 reboot=t panic=-1 root=/dev/vda ro init=/init devtmpfs.mount=0 stage2init=/nix/store/5jxb8wv1yrcvcr888lbr3d49crjdgg6n-nixos-system-netvm-22.11.20230310.824f886/init boot.panic_on_fail loglevel=4 regInfo=/nix/store/bgcjmi1x1f0kvfxq2w3avnmh6f80ppny-closure-info/registration -sandbox on -qmp unix:netvm.sock,server,nowait -netdev tap,id=vm-netvm,ifname=vm-netvm,script=no,downscript=no -device virtio-net-device,netdev=vm-netvm,mac=02:00:00:01:01:01 -device vfio-pci,host=0001:01:00.0,multifunction=on

Services have started with no issues:

[ghaf@ghaf-host:~]$ journalctl -u microvm@netvm-nvidia-jetson-orin-debug.service
Apr 11 08:09:04 ghaf-host systemd[1]: Starting MicroVM 'netvm-nvidia-jetson-orin-debug'...
Apr 11 08:09:04 ghaf-host systemd[1]: Started MicroVM 'netvm-nvidia-jetson-orin-debug'.
Apr 11 08:09:04 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]: char device redirected to /dev/pts/0 (label con0)
Apr 11 08:09:04 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]: qemu-system-aarch64: -drive id=root,format=raw,media=cdrom,file=/nix/store/72fbh7njml2q1mjmvsx5d0pd3zvp6ysv-rootfs.squashfs,if=none,aio=io_uring: warning: failed to register linux io_uring ring file descriptor
Apr 11 08:09:09 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]:
Apr 11 08:09:09 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]: <<< NixOS Stage 2 >>>
Apr 11 08:09:09 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]:
Apr 11 08:09:09 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]: running activation script...
Apr 11 08:09:09 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]: setting up /etc...
Apr 11 08:09:09 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]: starting systemd...
Apr 11 08:09:10 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]:
Apr 11 08:09:10 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]: Welcome to NixOS 22.11 (Raccoon)!
Apr 11 08:09:10 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]:
Apr 11 08:09:10 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]: [  OK  ] Created slice Slice /system/getty.
Apr 11 08:09:10 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]: [  OK  ] Created slice Slice /system/modprobe.
Apr 11 08:09:10 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]: [  OK  ] Created slice Slice /system/serial-getty.
Apr 11 08:09:10 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]: [  OK  ] Created slice User and Session Slice.
Apr 11 08:09:10 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]: [  OK  ] Started Dispatch Password …ts to Console Directory Watch.
Apr 11 08:09:10 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]: [  OK  ] Started Forward Password R…uests to Wall Directory Watch.
Apr 11 08:09:10 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]: [  OK  ] Reached target Local Encrypted Volumes.
Apr 11 08:09:10 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]: [  OK  ] Reached target Containers.
Apr 11 08:09:10 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]: [  OK  ] Reached target Path Units.
Apr 11 08:09:10 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]: [  OK  ] Reached target Remote File Systems.
Apr 11 08:09:10 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]: [  OK  ] Reached target Slice Units.
Apr 11 08:09:10 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]: [  OK  ] Reached target Swaps.
Apr 11 08:09:10 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]: [  OK  ] Listening on Process Core Dump Socket.
Apr 11 08:09:10 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]: [  OK  ] Listening on Journal Audit Socket.
Apr 11 08:09:10 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]: [  OK  ] Listening on Journal Socket (/dev/log).
Apr 11 08:09:10 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]: [  OK  ] Listening on Journal Socket.
Apr 11 08:09:10 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]: [  OK  ] Listening on Userspace Out-Of-Memory (OOM) Killer Socket.
Apr 11 08:09:10 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]: [  OK  ] Listening on udev Control Socket.
Apr 11 08:09:10 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]: [  OK  ] Listening on udev Kernel Socket.
Apr 11 08:09:10 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]:          Mounting Huge Pages File System...
Apr 11 08:09:10 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]:          Mounting POSIX Message Queue File System...
Apr 11 08:09:10 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]:          Mounting Kernel Debug File System...
Apr 11 08:09:10 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]:          Starting Create List of Static Device Nodes...
Apr 11 08:09:10 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]:          Starting Load Kernel Module configfs...
Apr 11 08:09:10 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]:          Starting Load Kernel Module drm...
Apr 11 08:09:10 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]:          Starting Load Kernel Module fuse...
Apr 11 08:09:10 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]:          Starting Journal Service...
Apr 11 08:09:10 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]:          Starting Load Kernel Modules...
Apr 11 08:09:10 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]:          Starting Remount Root and Kernel File Systems...
Apr 11 08:09:10 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]:          Starting Coldplug All udev Devices...
Apr 11 08:09:10 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]: [  OK  ] Mounted Huge Pages File System.
Apr 11 08:09:10 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]: [  OK  ] Mounted POSIX Message Queue File System.
Apr 11 08:09:10 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]: [  OK  ] Mounted Kernel Debug File System.
Apr 11 08:09:10 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]: [  OK  ] Finished Create List of Static Device Nodes.
Apr 11 08:09:10 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]: [  OK  ] Finished Load Kernel Module configfs.
Apr 11 08:09:10 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]: [  OK  ] Finished Load Kernel Module drm.
Apr 11 08:09:10 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]: [  OK  ] Finished Load Kernel Module fuse.
Apr 11 08:09:10 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]:          Mounting FUSE Control File System...
Apr 11 08:09:10 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]:          Mounting Kernel Configuration File System...
Apr 11 08:09:10 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]:          Starting Create Static Device Nodes in /dev...
Apr 11 08:09:10 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]: [  OK  ] Started Journal Service.
Apr 11 08:09:11 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]: [  OK  ] Finished Remount Root and Kernel File Systems.
Apr 11 08:09:11 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]: [  OK  ] Mounted FUSE Control File System.
Apr 11 08:09:11 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]: [  OK  ] Mounted Kernel Configuration File System.
Apr 11 08:09:11 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]:          Starting Flush Journal to Persistent Storage...
Apr 11 08:09:11 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]:          Starting Load/Save Random Seed...
Apr 11 08:09:11 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]: [  OK  ] Finished Load Kernel Modules.
Apr 11 08:09:11 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]:          Starting Firewall...
Apr 11 08:09:11 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]:          Starting Apply Kernel Variables...
Apr 11 08:09:11 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]: [  OK  ] Finished Create Static Device Nodes in /dev.
Apr 11 08:09:11 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]: [  OK  ] Finished Flush Journal to Persistent Storage.
Apr 11 08:09:11 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]: [  OK  ] Finished Load/Save Random Seed.
Apr 11 08:09:11 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]: [  OK  ] Reached target Preparation for Local File Systems.
Apr 11 08:09:11 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]: [  OK  ] Reached target Local File Systems.
Apr 11 08:09:11 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]:          Starting Create Volatile Files and Directories...
Apr 11 08:09:11 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]:          Starting Rule-based Manage…for Device Events and Files...
Apr 11 08:09:11 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]: [  OK  ] Finished Apply Kernel Variables.
Apr 11 08:09:11 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]: [  OK  ] Finished Create Volatile Files and Directories.
Apr 11 08:09:11 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]:          Starting Rebuild Journal Catalog...
Apr 11 08:09:11 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]:          Starting Userspace Out-Of-Memory (OOM) Killer...
Apr 11 08:09:11 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]:          Starting Network Time Synchronization...
Apr 11 08:09:11 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]:          Starting Record System Boot/Shutdown in UTMP...
Apr 11 08:09:11 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]: [  OK  ] Finished Rebuild Journal Catalog.
Apr 11 08:09:11 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]:          Starting Update is Completed...
Apr 11 08:09:11 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]: [  OK  ] Finished Record System Boot/Shutdown in UTMP.
Apr 11 08:09:11 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]: [  OK  ] Finished Update is Completed.
Apr 11 08:09:11 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]: [  OK  ] Started Rule-based Manager for Device Events and Files.
Apr 11 08:09:11 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]: [  OK  ] Started Userspace Out-Of-Memory (OOM) Killer.
Apr 11 08:09:11 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]: [  OK  ] Started Network Time Synchronization.
Apr 11 08:09:11 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]: [  OK  ] Finished Coldplug All udev Devices.
Apr 11 08:09:11 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]: [  OK  ] Reached target System Initialization.
Apr 11 08:09:11 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]: [  OK  ] Started logrotate.timer.
Apr 11 08:09:11 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]: [  OK  ] Started Daily Cleanup of Temporary Directories.
Apr 11 08:09:11 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]: [  OK  ] Reached target Timer Units.
Apr 11 08:09:11 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]: [  OK  ] Listening on D-Bus System Message Bus Socket.
Apr 11 08:09:11 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]: [  OK  ] Reached target Socket Units.
Apr 11 08:09:11 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]: [  OK  ] Reached target Basic System.
Apr 11 08:09:11 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]:          Starting Kernel Auditing...
Apr 11 08:09:11 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]:          Starting DHCP Client...
Apr 11 08:09:11 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]:          Starting Logrotate configuration check...
Apr 11 08:09:11 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]:          Starting Name Service Cache Daemon...
Apr 11 08:09:11 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]: [  OK  ] Started Reset console on configuration changes.
Apr 11 08:09:11 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]:          Starting resolvconf update...
Apr 11 08:09:11 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]: [  OK  ] Started WPA Supplicant instance.
Apr 11 08:09:11 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]: [  OK  ] Finished Kernel Auditing.
Apr 11 08:09:11 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]: [  OK  ] Finished Logrotate configuration check.
Apr 11 08:09:11 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]: [  OK  ] Found device /dev/hvc0.
Apr 11 08:09:11 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]:          Starting D-Bus System Message Bus...
Apr 11 08:09:11 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]: [  OK  ] Found device /dev/hvc1.
Apr 11 08:09:11 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]: [  OK  ] Started Name Service Cache Daemon.
Apr 11 08:09:11 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]: [  OK  ] Reached target Host and Network Name Lookups.
Apr 11 08:09:11 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]: [  OK  ] Reached target User and Group Name Lookups.
Apr 11 08:09:12 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]:          Starting User Login Management...
Apr 11 08:09:12 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]: [  OK  ] Started D-Bus System Message Bus.
Apr 11 08:09:12 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]: [  OK  ] Stopped target Host and Network Name Lookups.
Apr 11 08:09:12 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]:          Stopping Host and Network Name Lookups...
Apr 11 08:09:12 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]: [  OK  ] Stopped target User and Group Name Lookups.
Apr 11 08:09:12 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]:          Stopping User and Group Name Lookups...
Apr 11 08:09:12 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]:          Stopping Name Service Cache Daemon...
Apr 11 08:09:12 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]: [  OK  ] Stopped Name Service Cache Daemon.
Apr 11 08:09:12 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]: [  OK  ] Started User Login Management.
Apr 11 08:09:12 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]:          Starting Name Service Cache Daemon...
Apr 11 08:09:12 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]: [  OK  ] Started Name Service Cache Daemon.
Apr 11 08:09:12 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]: [  OK  ] Reached target Host and Network Name Lookups.
Apr 11 08:09:12 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]: [  OK  ] Reached target User and Group Name Lookups.
Apr 11 08:09:12 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]: [  OK  ] Finished resolvconf update.
Apr 11 08:09:12 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]: [  OK  ] Finished Firewall.
Apr 11 08:09:12 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]: [  OK  ] Reached target Preparation for Network.
Apr 11 08:09:12 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]: [  OK  ] Reached target All Network Interfaces (deprecated).
Apr 11 08:09:12 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]: [  OK  ] Found device /sys/subsystem/net/devices/eth0.
Apr 11 08:09:12 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]:          Starting Address configuration of eth0...
Apr 11 08:09:13 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]: [  OK  ] Listening on Load/Save RF …itch Status /dev/rfkill Watch.
Apr 11 08:09:13 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]: [  OK  ] Finished Address configuration of eth0.
Apr 11 08:09:13 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]:          Starting Networking Setup...
Apr 11 08:09:13 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]: [  OK  ] Finished Networking Setup.
Apr 11 08:09:13 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]:          Starting Extra networking commands....
Apr 11 08:09:13 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]: [  OK  ] Finished Extra networking commands..
Apr 11 08:09:13 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]: [  OK  ] Reached target Network.
Apr 11 08:09:13 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]:          Starting SSH Daemon...
Apr 11 08:09:13 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]:          Starting Permit User Sessions...
Apr 11 08:09:14 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]: [  OK  ] Finished Permit User Sessions.
Apr 11 08:09:14 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]: [  OK  ] Started Getty on tty1.
Apr 11 08:09:14 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]: [  OK  ] Started Serial Getty on hvc0.
Apr 11 08:09:14 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]: [  OK  ] Started Serial Getty on hvc1.
Apr 11 08:09:14 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]: [  OK  ] Reached target Login Prompts.
Apr 11 08:09:14 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]:          Starting Load/Save RF Kill Switch Status...
Apr 11 08:09:14 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]: [  OK  ] Started Load/Save RF Kill Switch Status.
Apr 11 08:09:14 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]:          Stopping WPA Supplicant instance...
Apr 11 08:09:14 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]: [  OK  ] Stopped WPA Supplicant instance.
Apr 11 08:09:14 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]: [  OK  ] Started WPA Supplicant instance.
Apr 11 08:09:16 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]: [  OK  ] Started SSH Daemon.
Apr 11 09:06:44 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]:
Apr 11 09:06:44 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]:
Apr 11 09:06:44 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]: <<< Welcome to NixOS 22.11.20230310.824f886 (aarch64) - hvc1 >>>
Apr 11 09:06:44 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]:
Apr 11 09:06:44 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]: Run 'nixos-help' for the NixOS manual.
Apr 11 09:06:44 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]:
Apr 11 09:06:44 ghaf-host microvm@netvm-nvidia-jetson-orin-debug[1091]: netvm login: [   12.065691] rtw_8822ce 0000:00:01.0: failed to do dpk calibration

and

[ghaf@ghaf-host:~]$ journalctl -u microvm-pci-devices@netvm-nvidia-jetson-orin-debug.service
Apr 11 08:09:03 ghaf-host systemd[1]: Starting Setup MicroVM 'netvm-nvidia-jetson-orin-debug' devices for passthrough...
Apr 11 08:09:04 ghaf-host microvm-pci-devices@netvm-nvidia-jetson-orin-debug[992]: /sys/bus/pci/devices/0001:01:00.0 /var/lib/microvms/netvm-nvidia-jetson-orin-debug
Apr 11 08:09:04 ghaf-host microvm-pci-devices@netvm-nvidia-jetson-orin-debug[992]: /var/lib/microvms/netvm-nvidia-jetson-orin-debug
Apr 11 08:09:04 ghaf-host microvm-pci-devices@netvm-nvidia-jetson-orin-debug[1028]: changed ownership of '/dev/vfio/50' from root to microvm
Apr 11 08:09:04 ghaf-host microvm-pci-devices@netvm-nvidia-jetson-orin-debug[1028]: changed ownership of '/dev/vfio/vfio' from root to microvm
Apr 11 08:09:04 ghaf-host microvm-pci-devices@netvm-nvidia-jetson-orin-debug[1028]: changed ownership of '/dev/vfio' from root to microvm
Apr 11 08:09:04 ghaf-host systemd[1]: Finished Setup MicroVM 'netvm-nvidia-jetson-orin-debug' devices for passthrough.
[ghaf@ghaf-host:~]$ journalctl -u microvm-tap-interfaces@netvm-nvidia-jetson-orin-debug.service
Apr 11 08:09:04 ghaf-host systemd[1]: Starting Setup MicroVM 'netvm-nvidia-jetson-orin-debug' TAP interfaces...
Apr 11 08:09:04 ghaf-host systemd[1]: Finished Setup MicroVM 'netvm-nvidia-jetson-orin-debug' TAP interfaces.

Still the netvm can't access WIFI. Do you see something that I missed?

@vilvo
Copy link
Contributor

vilvo commented Apr 12, 2023

Ok. Got it working. I think this is good as it is to enable further Ghaf development on Orin without ethernet. Needs some guides and development mode changes to enable tools but those can be added in additional commits.

@vilvo vilvo self-requested a review April 12, 2023 07:18
# Passthrough Jetson Orin WiFi card
boot.kernelParams = [
"vfio-pci" "ids=10ec:c82f"
"vfio_iommu_type1.allow_unsafe_interrupts=1"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

allow_unsafe_interrupts enables threat vector via MSI (message signaled interrupts). This is possible with PCI devices if there's access to device configuration space. See https://invisiblethingslab.com/resources/2011/Software%20Attacks%20on%20Intel%20VT-d.pdf - pages 6-7.

I'll add this note to acknowledge the threat from within the netvm and make a ghaf issue out of this to document it - at least until we have iommu group interrupt remapping support or other documented VMM mitigations. It may be that there's other mitigations these days that I'm not aware of. If that turns out to be the case, let's document those and close the issue after the fact.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we already had some discussion about this, and in the discussion the conclusion was that this allow_unsafe_interrupts is not needed. But I'm not sure did anyone test with this line removed

+ interconnect-names = "dma-mem", "write";
+ /delete-property/ iommus;
+ /delete-property/ msi-parent;
+ /delete-property/ msi-map;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The previous concern with MSI seems irrelevant as we bypass the IOMMU protections completely for now. As this may be temporary but enables functional passthrough, I'll leave the earlier gh issue open and link this there.

@@ -6,6 +6,12 @@
firewall.allowedUDPPorts = [67]; # DHCP
useNetworkd = true;
};

networking.nat = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Address host NAT in the minimal host documentation

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This enables NAT from host to the VMs, i.e. you can share the host's network with VMs. This is not needed at all other than debugging purposes

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok. This should go only via nix development-modules then. Even if I'd like to see "no networking on host" in development mode as well, it may not be very practical at this phase in development when tools from nix caches are often quite helpful to try/debug something in the development. Making the host no-networking/read-only (like netvm) would require reflashing for any small change.

Copy link
Contributor

@vilvo vilvo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works to enable further development of netvm with wifi passthrough.

# Passthrough Jetson Orin WiFi card
boot.kernelParams = [
"vfio-pci" "ids=10ec:c82f"
"vfio_iommu_type1.allow_unsafe_interrupts=1"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we already had some discussion about this, and in the discussion the conclusion was that this allow_unsafe_interrupts is not needed. But I'm not sure did anyone test with this line removed

@@ -16,4 +16,7 @@

networking.hostName = "ghaf-host";
system.stateVersion = "22.11";

# PCI passthrough needs larger locked-in-memory space than default
systemd.services."microvm@".serviceConfig.LimitMEMLOCK = 999999999;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line breaks the build

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was already fixed in microvm.nix astro/microvm.nix@68a0242

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I'll wait for @panufi 's comment on allow_unsafe_interrupts before testing removing it.

@@ -6,6 +6,12 @@
firewall.allowedUDPPorts = [67]; # DHCP
useNetworkd = true;
};

networking.nat = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This enables NAT from host to the VMs, i.e. you can share the host's network with VMs. This is not needed at all other than debugging purposes

new file mode 100644
index 000000000000..e4656287da82
--- /dev/null
+++ b/nvidia/platform/t23x/concord/kernel-dts/tegra234-p3701-host-passthrough.dts
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like this to be an overlay, instead of defining completely new devicetree that replaces the old

# TODO: Maybe add store path or some unique identifier to the filename
extraFiles."dtbs/${config.hardware.deviceTree.name}" = "${config.hardware.deviceTree.package}/${config.hardware.deviceTree.name}";
extraInstallCommands = ''
default_cfg=$(cat /boot/loader/loader.conf | grep default | awk '{print $2}')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This stuff is now available in module boot/systemd-boot-dtb.nix. This whole WIP commit can be removed from this branch

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it make sense to push @panufi 's PR branch from his personal fork to under ghaf? We could then work many of these issues together in the same branch while he is out. Including rebasing with main to get some of the microvm.nix upstream changes merged to main earlier.


# Passthrough Jetson Orin WiFi card
boot.kernelParams = [
"vfio-pci" "ids=10ec:c82f"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to have some toggle for this, and not enable this always by default

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What would be the motivation on Orin reference device? Wifi is basically the only networking interface we can easily and consistently pass through to netvm. I'd rather have it enabled by default even when we can't/shouldn't make it connect any WIFI automatically. And to support wifi, bring nmcli to netvm to easily scan and connect wifis over debug console.

# path = "0001:01:00.0";
# }
# ];
microvm.devices = [
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to have some toggle for this, and not enable this always by default. Also this change is NVIDIA specific but affects all other targets as well. Of course this is a bigger refactoring question that might not be addressed within the context of this PR

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's valid toggle.

@@ -23,7 +23,8 @@ nixpkgs.lib.nixosSystem {
# For WLAN firmwares
hardware.enableRedistributableFirmware = true;

microvm.hypervisor = "crosvm";
# TODO: change back to crosvm after tested working
microvm.hypervisor = "qemu";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the situation with the crosvm currently?


hardware.deviceTree = {
enable = true;
name = "tegra234-p3701-host-passthrough.dtb";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like this to be an overlay, instead of defining completely new devicetree that replaces the old

@mikatammi mikatammi changed the title Passthrough Jetson Orin WiFi card to microvm Passthrough NVIDIA Jetson AGX Orin WiFi card to NetVM Apr 12, 2023
@mikatammi
Copy link
Contributor

I wasn't able to change branch in this PR, so let's continue this in new PR #107

@mikatammi mikatammi closed this Apr 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants