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

NVIDIA Orin NX & AGX: Updating Jetpack-Nixos NVIDIA's BSP version and switching to upstream kernel #931

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@

jetpack-nixos = {
#url = "github:anduril/jetpack-nixos
url = "github:anduril/jetpack-nixos/793716c1ca29a1be6d9bea84296a933c4acdddc1";
url = "github:tiiuae/jetpack-nixos/f999f00e74151dcedd6025ba76b3075f0976037f";
#inputs.nixpkgs.follows = "nixpkgs";
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,13 @@ in
];

boot.kernelPatches = [
{
name = "nx-pci-passthrough-patch";
# This patch uses Alex Williamson's patch for enabling overrides for missing ACS capabilities on pci
# bus which could be accessed from following link: https://lkml.org/lkml/2013/5/30/513
patch = ./pci-passthrough-nx-test.patch;
}
# TODO: Re-enable if still needed with jetson 36.3 + upstream linux
# {
# name = "nx-pci-passthrough-patch";
# # This patch uses Alex Williamson's patch for enabling overrides for missing ACS capabilities on pci
# # bus which could be accessed from following link: https://lkml.org/lkml/2013/5/30/513
# patch = ./pci-passthrough-nx-test.patch;
# }
];

boot.kernelParams = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,16 @@ in
firmware.uefi = {
logo = ../../../../../docs/src/img/1600px-Ghaf_logo.svg;
edk2NvidiaPatches = [

# TODO Still valid with jetson 36.3
# This effectively disables EFI FB Simple Framebuffer, which does
# not work properly but causes kernel panic during the boot if the
# HDMI cable is connected during boot time.
#
# The patch reverts back to old behavior, which is to always reset
# the display when exiting UEFI, instead of doing handoff, when
# means not to reset anything.
./edk2-nvidia-always-reset-display.patch
# ./edk2-nvidia-always-reset-display.patch
];
};
};
Expand Down Expand Up @@ -108,16 +110,26 @@ in
enable = lib.mkDefault true;
# Add the include paths to build the dtb overlays
dtboBuildExtraIncludePaths = [
"${lib.getDev config.hardware.deviceTree.kernelPackage}/lib/modules/${config.hardware.deviceTree.kernelPackage.modDirVersion}/source/nvidia/soc/t23x/kernel-include"
# Empty.
];
}

# NOTE: "-nv.dtb" files are from NVIDIA's BSP
# Versions of the device tree without PCI passthrough related
# modifications.
// lib.optionalAttrs (cfg.somType == "agx") {
name = lib.mkDefault "tegra234-p3701-0000-p3737-0000.dtb";
name = lib.mkDefault "tegra234-p3737-0000+p3701-0000-nv.dtb";
}
// lib.optionalAttrs (cfg.somType == "nx") {
name = lib.mkDefault "tegra234-p3767-0000-p3509-a02.dtb";
# Sake of clarity: Jetson 35.4 and IO BASE B carrier board
# uses "tegra234-p3767-0000-p3509-a02.dtb"-device tree.
# p3509-a02 == IO BASE B carrier board
# p3767-0000 == Orin NX SOM
# p3768-0000 == Official NVIDIA's carrier board
# Upstream kernel has only official carrier board device tree,
# but it works with IO BASE B carrier board with minor
# modifications.
name = lib.mkDefault "tegra234-p3768-0000+p3767-0000-nv.dtb";
};
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ let
<filesystem_type> basic </filesystem_type>
<size> ROOT_SIZE </size>
<file_system_attribute> 0 </file_system_attribute>
<allocation_attribute> 0x8 </allocation_attribute>
<allocation_attribute> 0x808 </allocation_attribute>
<align_boundary> 16384 </align_boundary>
<percent_reserved> 0 </percent_reserved>
<unique_guid> APPUUID </unique_guid>
Expand Down Expand Up @@ -78,19 +78,19 @@ let
partitionTemplateReplaceRange =
if !cfg.flashScriptOverrides.onlyQSPI then
{
firstLineCount = 588;
firstLineCount = 618;
lastLineCount = 2;
}
else
{
# If we don't flash anything to eMMC, then we don't need to have the
# <device type="sdmmc_user" ...> </device> XML-tag at all.
firstLineCount = 587;
firstLineCount = 617;
lastLineCount = 1;
};
partitionTemplate = pkgs.runCommand "flash.xml" { } (
''
head -n ${builtins.toString partitionTemplateReplaceRange.firstLineCount} ${pkgs.nvidia-jetpack.bspSrc}/bootloader/t186ref/cfg/flash_t234_qspi_sdmmc.xml >"$out"
head -n ${builtins.toString partitionTemplateReplaceRange.firstLineCount} ${pkgs.nvidia-jetpack.bspSrc}/bootloader/generic/cfg/flash_t234_qspi_sdmmc.xml >"$out"

''
+ lib.optionalString (!cfg.flashScriptOverrides.onlyQSPI) ''
Expand All @@ -101,7 +101,7 @@ let
''
+ ''

tail -n ${builtins.toString partitionTemplateReplaceRange.lastLineCount} ${pkgs.nvidia-jetpack.bspSrc}/bootloader/t186ref/cfg/flash_t234_qspi_sdmmc.xml >>"$out"
tail -n ${builtins.toString partitionTemplateReplaceRange.lastLineCount} ${pkgs.nvidia-jetpack.bspSrc}/bootloader/generic/cfg/flash_t234_qspi_sdmmc.xml >>"$out"
''
);
in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
--disallow-untyped-defs \
$out
'';
fdtPath = "${config.hardware.deviceTree.package}/${config.hardware.deviceTree.name}";
fdtPath = builtins.trace "Note: Using DTB from NVIDIA BSP!" "${pkgs.nvidia-jetpack.bspSrc}/kernel/dtb/${config.hardware.deviceTree.name}";
in
{
firmwareSize = 256;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
--- bootloader/t186ref/BCT/tegra234-mb2-bct-scr-p3767-0000.dts
+++ bootloader/t186ref/BCT/tegra234-mb2-bct-scr-p3767-0000.dts
--- bootloader/generic/BCT/tegra234-mb2-bct-scr-p3767-0000.dts
+++ bootloader/generic/BCT/tegra234-mb2-bct-scr-p3767-0000.dts
@@ -5,6 +5,11 @@

/ {
Expand All @@ -12,8 +12,8 @@
reg@5138 { /* CBB_CENTRAL_CBB_FIREWALL_QSPI0_BLF, READ_CTL */
exclusion-info = <2>;
value = <0x00100009>;
--- bootloader/t186ref/BCT/tegra234-mb2-bct-scr-p3701-0000.dts
+++ bootloader/t186ref/BCT/tegra234-mb2-bct-scr-p3701-0000.dts
--- bootloader/generic/BCT/tegra234-mb2-bct-scr-p3701-0000.dts
+++ bootloader/generic/BCT/tegra234-mb2-bct-scr-p3701-0000.dts
@@ -5,6 +5,11 @@

/ {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,11 @@ in
config = lib.mkIf cfg.enable {
boot.kernelPatches = [
{
name = "Added Configurations to Support Vda";
name = "Added Configurations to Support VFIO";
patch = null;
extraStructuredConfig = with lib.kernel; {
PCI_STUB = lib.mkDefault yes;
VFIO = lib.mkDefault yes;
VIRTIO_PCI = lib.mkDefault yes;
VIRTIO_MMIO = lib.mkDefault yes;
HOTPLUG_PCI = lib.mkDefault yes;
PCI_DEBUG = lib.mkDefault yes;
PCI_HOST_GENERIC = lib.mkDefault yes;
VFIO_IOMMU_TYPE1 = lib.mkDefault yes;
HOTPLUG_PCI_ACPI = lib.mkDefault yes;
PCI_HOST_COMMON = lib.mkDefault yes;
VFIO_PLATFORM = lib.mkDefault yes;
TEGRA_BPMP_GUEST_PROXY = lib.mkDefault no;
TEGRA_BPMP_HOST_PROXY = lib.mkDefault no;
Expand All @@ -43,18 +35,14 @@ in
patch = ./patches/0002-vfio_platform-reset-required-false.patch;
}
{
name = "Bpmp Support Virtualization";
patch = ./patches/0003-bpmp-support-bpmp-virt.patch;
name = "Add bpmp-virt kernel modules";
patch = ./patches/0001-Add-bpmp-virt-modules.patch;
}
{
name = "Bpmp Virt Drivers";
patch = ./patches/0004-bpmp-virt-drivers.patch;
name = "Bpmp-host: allows all domains";
patch = ./patches/0002-Bpmp-host-allows-all-domains.patch;
}
{
name = "Bpmp Overlay";
patch = ./patches/0005-bpmp-overlay.patch;
}
];
];

boot.kernelParams = [ "vfio_iommu_type1.allow_unsafe_interrupts=1" ];
};
Expand Down
Loading
Loading