Skip to content

Commit

Permalink
GPIO passthrough source codes build on Ghaf
Browse files Browse the repository at this point in the history
kernel patches updated to jetson_35.4.1
  adfe63ef006a696e7384b9cee340f05bf7f4f1b3
gpio-virt driver patch updated
  d90bd5625957fd164e4eb50803bd724fda89ba68
qemu patch updated
  ba21ded8858a3e1a97cf30844ad80e7fe0de3acf

- updates comiples with ghaf
- microvm does not start up properly
  • Loading branch information
KimGSandstrom committed Sep 2, 2024
1 parent 88759a0 commit f04eac1
Show file tree
Hide file tree
Showing 13 changed files with 1,819 additions and 1,118 deletions.
58 changes: 29 additions & 29 deletions modules/jetpack-microvm/agx-gpiovm-passthrough.nix
Original file line number Diff line number Diff line change
Expand Up @@ -12,38 +12,38 @@ in {
lib.mkEnableOption
"GPIO passthrough to VM";

config = lib.mkIf cfg.enableGPIOPassthrough {
config = lib.mkIf cfg.enableGPIOPassthrough {

/*
ghaf.virtualization.microvm.gpiovm.extraModules = [
{
microvm.devices = [
{
# GPIO passthrough uses a character device (/dev/vda). No need to specify?
}
];
}
];
*/

# Make sure that Gpio-VM runs after the dependency service are enabled
# systemd.services."microvm@gpio-vm".after = ["gpio-dependency.service"];

/* Note: use qemu.extraArgs '-dtb' for guest device tree
* this section sets overlay for host device tree
hardware.deviceTree = builtins.trace "GpioVM: Evaluating hardware.deviceTree for gpio-vm" {
enable = true;
name = builtins.trace "GpioVM: Setting hardware.deviceTree.name" gpioDtbName;
# name = builtins.trace "GpioVM: Debugging with ${gpioGuestOrigName}" gpioOrigName;
overlays = builtins.trace "GpioVM: Setting hardware.deviceTree.overlays" [
/*
ghaf.virtualization.microvm.gpiovm.extraModules = [
{
microvm.devices = [
{
name = "gpio_pt_overlay";
dtsFile = gpioDts;
# filter = dtbFile;
filter = gpioDtbName;
# GPIO passthrough uses a character device (/dev/vda). No need to specify?
}
];
};
*/
}
];
*/

# Make sure that Gpio-VM runs after the dependency service are enabled
# systemd.services."microvm@gpio-vm".after = ["gpio-dependency.service"];

/* Note: use qemu.extraArgs '-dtb' for guest device tree
* this section sets overlay for host device tree
hardware.deviceTree = builtins.trace "GpioVM: Evaluating hardware.deviceTree for gpio-vm" {
enable = true;
name = builtins.trace "GpioVM: Setting hardware.deviceTree.name" gpioDtbName;
# name = builtins.trace "GpioVM: Debugging with ${gpioGuestOrigName}" gpioOrigName;
overlays = builtins.trace "GpioVM: Setting hardware.deviceTree.overlays" [
{
name = "gpio_pt_overlay";
dtsFile = gpioDts;
# filter = dtbFile;
filter = gpioDtbName;
}
];
};
*/
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,28 @@
...
}: let
cfg = config.ghaf.hardware.nvidia.virtualization;
pkgs = import <nixpkgs> { };

in {
config = lib.mkIf cfg.enable {

boot.kernelPatches = builtins.trace "kernelPatches GPIO Virtualization" [
/*
{
buildInputs = [ pkgs.unixtools.xxd ]; # seems this is not used
moduleBuildDependencies = [ pkgs.unixtools.xxd ]; # seems this is not used

name = "Added Configurations to Support GPIO passthrough";
patch = null;
extraStructuredConfig = {
PCI_STUB = lib.mkDefault lib.kernel.yes;
HOTPLUG_PCI = lib.mkDefault lib.kernel.yes;
HOTPLUG_PCI_ACPI = lib.mkDefault lib.kernel.yes;
PCI_DEBUG = lib.mkDefault lib.kernel.yes;
PCI_HOST_GENERIC = lib.mkDefault lib.kernel.yes;
PCI_HOST_COMMON = lib.mkDefault lib.kernel.yes;
VFIO = lib.mkDefault lib.kernel.yes;
VFIO_IOMMU_TYPE1 = lib.mkDefault lib.kernel.yes;
VFIO_PLATFORM = lib.mkDefault lib.kernel.yes;
# PCI_STUB = lib.mkDefault lib.kernel.yes;
# HOTPLUG_PCI = lib.mkDefault lib.kernel.yes;
# HOTPLUG_PCI_ACPI = lib.mkDefault lib.kernel.yes;
# PCI_DEBUG = lib.mkDefault lib.kernel.yes;
# PCI_HOST_GENERIC = lib.mkDefault lib.kernel.yes;
# PCI_HOST_COMMON = lib.mkDefault lib.kernel.yes;
# VFIO = lib.mkDefault lib.kernel.yes;
# VFIO_IOMMU_TYPE1 = lib.mkDefault lib.kernel.yes;
# VFIO_PLATFORM = lib.mkDefault lib.kernel.yes;
VIRTIO = lib.mkDefault lib.kernel.yes;
VIRTIO_PCI = lib.mkDefault lib.kernel.yes;
VIRTIO_MMIO = lib.mkDefault lib.kernel.yes;
Expand All @@ -35,12 +40,13 @@ in {

# long version of possibly needed additions for microvm and gpio + some obviously not needed configs
# most of these are set anyhow, some are unrelated (such as XUSB) but included while debugging
# virtualisation
/*
# Virtualisation
# VFIO_IOMMU_TYPE1 = lib.mkDefault lib.kernel.yes;
VFIO_PCI_INTX = lib.mkDefault lib.kernel.yes;
VFIO_PCI_MMAP = lib.mkDefault lib.kernel.yes;
VFIO_PCI = lib.mkDefault lib.kernel.yes;
VFIO_VIRQFD = lib.mkDefault lib.kernel.yes;
# VFIO_PCI_INTX = lib.mkDefault lib.kernel.yes;
# VFIO_PCI_MMAP = lib.mkDefault lib.kernel.yes;
# VFIO_PCI = lib.mkDefault lib.kernel.yes;
# VFIO_VIRQFD = lib.mkDefault lib.kernel.yes;
VIRTIO_MENU = lib.mkDefault lib.kernel.yes;
VIRTIO_PCI_LEGACY = lib.mkDefault lib.kernel.yes;
VIRTUALIZATION = lib.mkDefault lib.kernel.yes;
Expand Down Expand Up @@ -73,15 +79,16 @@ in {
PINCTRL_TEGRA234 = lib.mkDefault lib.kernel.yes;
PINCTRL_TEGRA_XUSB = lib.mkDefault lib.kernel.yes;
PINCTRL_TEGRA = lib.mkDefault lib.kernel.yes;
*/
};
}
*/

# patching the kernel for GPIO passthrough
{
name = "GPIO Virtualization";
patch = builtins.trace "GPIO Virtualization (patch kernel)" ./patches/0003-gpio-virt-kernel.patch;
}

# patching the custom GPIO kernel modules
{
name = "GPIO Virt Drivers";
Expand Down
Loading

0 comments on commit f04eac1

Please sign in to comment.