Skip to content

Commit 0fba96d

Browse files
jpruiz84brianmcgillion
authored andcommitted
netvm: enable on the new fw baseline.
1. fix uarti passthrough for nvidia Jetpack 6 2. disable pci_acs_override patch 0001-pci-add-pci_acs_override-for-pci-passthrough.patch not needed for Jetpack 36.4.3. PCI passthrough on NX working ok without this patch. 3. add 8 sec delay for nvidia pci passthrough - Add 8 seconds delay to wait for PCI devices to get full enumerated - Remove deprecated kernel parameters for PCI passthrough 4. disable uarti passthrough - The uarti passthrough is currently broken due we need to add a fixed device tree to the netvm that affects it normal behavior. Signed-off-by: Juan Pablo Ruiz <juanpablo.ruiz@unikie.com>
1 parent 42a4195 commit 0fba96d

File tree

7 files changed

+452
-196
lines changed

7 files changed

+452
-196
lines changed

modules/reference/hardware/jetpack-microvm/0001-pci-add-pci_acs_override-for-pci-passthrough.patch

Lines changed: 0 additions & 153 deletions
This file was deleted.

modules/reference/hardware/jetpack-microvm/nx-netvm-ethernet-pci-passthrough.nix

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,8 @@ in
1919
path = "0008:01:00.0";
2020
}
2121
];
22-
microvm.kernelParams = [
23-
"pci=nomsi"
24-
"pcie_acs_override=downstream,multifunction"
25-
];
26-
}
27-
];
28-
29-
boot.kernelPatches = [
30-
{
31-
name = "nx-pci-passthrough-patch";
32-
# This patch uses Alex Williamson's patch for enabling overrides for missing ACS capabilities on pci
33-
# bus which could be accessed from following link: https://lkml.org/lkml/2013/5/30/513
34-
patch = ./0001-pci-add-pci_acs_override-for-pci-passthrough.patch;
22+
# Add 8 seconds delay to wait for PCI devices to get full enumerated
23+
microvm.preStart = "/bin/sh -c 'sleep 8'";
3524
}
3625
];
3726

modules/reference/hardware/jetpack/nvidia-jetson-orin/virtualization/common/bpmp-virt-common/default.nix

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ in
3838
TEGRA_BPMP_HOST_PROXY = lib.mkDefault no;
3939
};
4040
}
41-
# {
42-
# name = "Vfio_platform Reset Required False";
43-
# patch = ./patches/0002-vfio_platform-reset-required-false.patch;
44-
# }
41+
{
42+
name = "Vfio_platform Reset Required False";
43+
patch = ./patches/0002-vfio_platform-reset-required-false.patch;
44+
}
4545
# {
4646
# name = "Bpmp Support Virtualization";
4747
# patch = ./patches/0003-bpmp-support-bpmp-virt.patch;

modules/reference/hardware/jetpack/nvidia-jetson-orin/virtualization/passthrough/uarti-net-vm/default.nix

Lines changed: 34 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,32 @@
88
}:
99
let
1010
cfg = config.ghaf.hardware.nvidia.passthroughs.uarti_net_vm;
11+
12+
# Derivation to build the GPU-VM guest device tree
13+
netvm-dtb = pkgs.stdenv.mkDerivation {
14+
name = "netvm-dtb";
15+
phases = [ "unpackPhase" "buildPhase" "installPhase" ];
16+
src = ./tegra234-netvm.dts;
17+
nativeBuildInputs = with pkgs; [
18+
dtc
19+
];
20+
unpackPhase = ''
21+
cp $src ./tegra234-netvm.dts
22+
'';
23+
buildPhase = ''
24+
$CC -E -nostdinc \
25+
-I${config.boot.kernelPackages.nvidia-modules.src}/hardware/nvidia/t23x/nv-public/include/nvidia-oot \
26+
-I${config.boot.kernelPackages.nvidia-modules.src}/hardware/nvidia/t23x/nv-public/include/kernel \
27+
-undef -D__DTS__ \
28+
-x assembler-with-cpp \
29+
tegra234-netvm.dts > preprocessed.dts
30+
dtc -I dts -O dtb -o tegra234-netvm.dtb preprocessed.dts
31+
'';
32+
installPhase = ''
33+
mkdir -p $out
34+
cp tegra234-netvm.dtb $out/
35+
'';
36+
};
1137
in
1238
{
1339
options.ghaf.hardware.nvidia.passthroughs.uarti_net_vm.enable = lib.mkOption {
@@ -19,7 +45,7 @@ in
1945
config = lib.mkIf cfg.enable {
2046
services.udev.extraRules = ''
2147
# Make group kvm all devices that bind to vfio in iommu group 59
22-
SUBSYSTEM=="vfio",KERNEL=="59",GROUP="kvm"
48+
SUBSYSTEM=="vfio",GROUP="kvm"
2349
'';
2450
ghaf.hardware.nvidia.virtualization.enable = true;
2551

@@ -34,7 +60,7 @@ in
3460
extraArgs = [
3561
# Add custom dtb to Net-VM with 31d0000.serial in platform devices
3662
"-dtb"
37-
"${config.hardware.deviceTree.package}/tegra234-p3701-ghaf-net-vm.dtb"
63+
"${netvm-dtb.out}/tegra234-netvm.dtb"
3864
# Add UARTI (31d0000.serial) as passtrhough device
3965
"-device"
4066
"vfio-platform,host=31d0000.serial"
@@ -50,13 +76,6 @@ in
5076
# Make sure that Net-VM runs after the binding services are enabled
5177
systemd.services."microvm@net-vm".after = [ "bindSerial31d0000.service" ];
5278

53-
boot.kernelPatches = [
54-
# {
55-
# name = "Add Net-VM device tree with UARTI in platform devices";
56-
# patch = ./patches/net_vm_dtb_with_uarti.patch;
57-
# }
58-
];
59-
6079
systemd.services.bindSerial31d0000 = {
6180
description = "Bind UARTI to the vfio-platform driver";
6281
wantedBy = [ "multi-user.target" ];
@@ -75,16 +94,11 @@ in
7594
# Enable hardware.deviceTree for handle host dtb overlays
7695
hardware.deviceTree.enable = true;
7796

78-
# Apply the device tree overlay only to tegra234-p3701-host-passthrough.dtb
79-
# hardware.deviceTree.overlays = [
80-
# {
81-
# name = "uarti_pt_host_overlay";
82-
# dtsFile = ./uarti_pt_host_overlay.dts;
83-
84-
# # Apply overlay only to host passthrough device tree
85-
# # TODO: make this avaliable if PCI passthrough is disabled
86-
# filter = "tegra234-p3701-host-passthrough.dtb";
87-
# }
88-
# ];
97+
hardware.deviceTree.overlays = [
98+
{
99+
name = "uarti_pt_host_overlay";
100+
dtsFile = ./uarti_pt_host_overlay.dts;
101+
}
102+
];
89103
};
90104
}

0 commit comments

Comments
 (0)