Giter Club home page Giter Club logo

gpu-passthrough-manager's Introduction

GPU Passthrough Manager

Showcase Video

If you ever wanted to pass through your GPU to a virtual machine and wanted to do it quickly and easily, then I have a program for all of you "script kiddies" out there.

GPU Passthrough Manager is a GUI application utilizing vfio drivers to quickly load your default and VFIO drivers with just a few clicks. passthrough a graphics devices to virtual machines is made easy now.

Run make in the program's directory to build the program. RUN GPUPM AS ROOT!

Requirements

!WARNING!

This program is only compatible with systems that support IOMMU / Virtualization.

  • make sure you have Intel VT-d or AMD Vi enabled in your bios.
  • more than one graphics device on the system. If you load vfio drivers to your host's main GPU, bad things will happen.

Dependencies

  • gtk is required for this version. see QT version by 89mpxf
  • polkit
  • jsoncpp
  • python3

First time configuration

Once GPUPM is runs for the first time, it will prompt you to run the first time setup. This Configures Grub bootloader to add IOMMU kernel parameter and adds VFIO modules to the system images. This rebuilds Grub bootloader and rebuilds system images. This is required for the program to work right or things will really break.

Documentation

GPUPM works by loading drivers to the device the user selects. Select what devices you want to pass through, then press Load VFIO. Then restart when prompted to load the vfio drivers on the devices you have selected. When the system is rebooted, you will have the drivers loaded. use lspci -k' to verify the vfio drivers are loaded. To load the default drivers, press the Load Default button to clear the config file of all devices.

The vfio config is stored at the programs directory as vfio.conf. This configuration is copied to /etc/modprobe.d/ and replaces or creates the file there. If you pass through a device and your system does not boot, then you need to chroot into your system and delete the config file from modprobe.d, then rebuild your system images to make your system bootable again..

Optimus Manager Users

For people who use laptops with dedicated or external graphics cards, GPUPM can be used with Optimus Manager to throw your graphics card off of the pci bus. With hybrid mode, you can put it onto the bus using integrated graphics on the host while having your GPU on the bus to running in your virtual machine. This means your laptop has great battery life, with the capability to switch to your GPU to do rendering work on.

gpu-passthrough-manager's People

Contributors

89mpxf avatar adamhitchen avatar amppz avatar aprunge avatar iceburgino avatar jm15itch avatar manulinares avatar mrglockenspiel avatar uwzis avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

gpu-passthrough-manager's Issues

nvidia early loading

hi, i have nvidia_modeset nvidia_uvm nvidia_drm in my mkinitcpio.conf.

should i remove it?

doas support

Please add support for doas as a authorization protocol.

Stuck at "Starting dracut pre-udev hook..." after loading vfio (and reboot) - EndeavourOS

I simply selected the GPU entries and one audio device, clicked on "Load VFIO" and rebooted. Now I'm stuck at:

"Starting dracut pre-udev hook...".

I can boot into Linux if I select "(fallback initramfs)" in grub.

So far I have added "vfio_virtqfd" and "crc32c" in /etc/dracut.conf.d/10-vfio.conf. (Saw that in another issue post).
Created a copy of 10-vfio.conf, named vfio.conf (always in /etc/dracut.conf.d/)
Removed the audio entry in /etc/modprobe.d/vfio.conf.
Rebuild dracut with "sudo dracut-rebuild" and "sudo dracut -f".

I made all this changes while booted in "fallback initramfs", so I don't know how much it affected the "normal" boot.

OS: EndeavourOS

EDIT: Also added "amd_iommu=on rd.driver.pre=vfio-pci" to /etc/default/grub since "GRUB_CMDLINE_LINUX" was empty.
There is also "GRUB_CMDLINE_LINUX_DEFAULT" with a bunch of stuff, but no iommu or vfio entries.

Ran also fts.sh. Didn't help either....

[Question] - How to use with optimus-manager

Hi, I'm pretty new to this topic, so I'm trying to better understand all, with a lot of test.

I've one laptop with Arch installed and with two graphics card

lspci | grep -E 'VGA|Display|3D'
01:00.0 VGA compatible controller: NVIDIA Corporation TU106M [GeForce RTX 2060 Mobile] (rev a1)
05:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Renoir (rev c6)

I installed GPU-Passthrough-Manager and all ok, I can isolate the nVidia resources and till here all ok, I think I'm still testing all the system.
So if I isolate the nVidia devices I can't use it inside Arch, am I right?
Actually if I make some test without drivers isolation I can do prime-run ./program to start the program with nVidia card or directly start the program and in this case the program run with AMD card
Then I installed optimus-manager I set the Hybrid mode at boot and all is still working, like nothing has changed, so I don't know if I'm on the right way.
Then, after all, I run GPU-Passthrough-Manager, isolate the nVidia driver but after reboot I can't run program with prime-run command.
Maybe is normal or maybe I'm doing it in the wrong way?
Is possible to "isolate" the nVidia devices for VM and at the same time use if needed under linux? Obviously or under VM or under Linux

Not loading

Trying to pass an amd radeon 6800 and it doesn't work cpu is amd ryzen 7 5700g and motherboard is gigabyte b550 gaming x v2 the distro I am using is archcraft.

The modules in /etc/mkinitcpio.conf are
vfio_pci vfio_iommu_type1 vfio

dmesg output
AMD-VI IOMMU preformance counters supported
Detected AMD IOMMU #0

Any ideas what is wrong?

AUR package is built incorrectly

Description

The PKGBUILD you submitted to the AUR builds an empty package and instead you are writing files bypassing the package manager.

How to fix

First do not use external scripts if possible (no more ./tools/pkg.sh for example), so everything is explicit inside the PKGBUILD.
Then:

  • use $srcdir to select file and folders from source
  • use $pkgdir to select file and folders to be installed inside the package
  • you can use the install command to create folders
  • do not use sudo inside a PKGBUILD
  • if you have to copy something, use "cp --no-preserve=mode,ownership"
  • do not use echo to give the users info about the completion of the installation, to give the user a special message after installation please follow the PKGBUILD guidelines

example pkgbuild

Preview Output

It would be nice if GPUPM would have a option to create all files in a preview folder without actually changing the system files.

screwed up my grub.cfg

I'm not having any other issues with this but it did screw up my grub.cfg so badly that I had to recover from a backup. I might suggest having the program make a backup to prevent major issues with people who don't have backups, especially since my backup wasn't recent. That said, I did swap in the new linux command line and it seems to work fine.

Add option to pass-through all GPU devices

Thank you so much for this tool! I'd been loathe to try setting up GPU pass-through again; now I've eliminated dual-boot once and for all.

I just switched to another GPU (Nvidia GXT 1660). During the phase where I select the devices to pass through, I'm only offered the GPU and the HDMI sound card; this was the same with the previous card (GTX 1050). However, this new(er) card also had these devices (this is a list of the IOMMU group):

Group 15:	[10de:21c4] [R] 09:00.0  VGA compatible controller                TU116 [GeForce GTX 1660 SUPER]
		[10de:1aeb]     09:00.1  Audio device                             TU116 High Definition Audio Controller
		[10de:1aec]     09:00.2  USB controller                           TU116 USB 3.1 Host Controller
		[10de:1aed]     09:00.3  Serial bus controller                    TU116 USB Type-C UCSI Controller

Since QEMU seems to require that the entire IOMMU group is using VFIO drivers, I had to add the last (2) devices to the vfio.conf and rebuild initramfs before the pass-through worked. Can it be added to your script to allow selection of all devices attached to a GPU?

VFIO drivers not getting loaded

I have a 3060 Ti and a 2060 Super and I am trying to passthrough the 2060. I clicked "Load VFIO" in GPUPM and rebooted. When i tried to create the VM, it got stuck on "Creating domain".

image

/var/log/libvirt/libvirtd.log:

2022-11-22 15:12:56.316+0000: 4600: debug : qemuProcessPrepareHost:7084 : Preparing host devices

I checked lspci -k and the VFIO drives seem to not be loaded.

06:00.0 VGA compatible controller: NVIDIA Corporation TU106 [GeForce RTX 2060 SUPER] (rev a1)
        Subsystem: NVIDIA Corporation TU106 [GeForce RTX 2060 SUPER]
        Kernel modules: nouveau, nvidia_drm, nvidia
06:00.1 Audio device: NVIDIA Corporation TU106 High Definition Audio Controller (rev a1)
        Subsystem: NVIDIA Corporation Device 1f06
        Kernel driver in use: snd_hda_intel
        Kernel modules: snd_hda_intel
06:00.2 USB controller: NVIDIA Corporation TU106 USB 3.1 Host Controller (rev a1)
        Subsystem: NVIDIA Corporation Device 1f06
        Kernel driver in use: xhci_hcd
        Kernel modules: xhci_pci
06:00.3 Serial bus controller: NVIDIA Corporation TU106 USB Type-C UCSI Controller (rev a1)
        Subsystem: NVIDIA Corporation Device 1f06
        Kernel driver in use: nvidia-gpu
        Kernel modules: i2c_nvidia_gpu

Ubuntu not supported

The script couldnt find mkinicpio.conf , i believe this is a file that exists only in Arch

Trying to install on Mint, make not cooperating

When I run make I initially got the following:

  CC	tools/reboot.c
  CXX	GPUPM.cpp
Package jsoncpp was not found in the pkg-config search path.
Perhaps you should add the directory containing `jsoncpp.pc'
to the PKG_CONFIG_PATH environment variable
No package 'jsoncpp' found
In file included from GPUPM.cpp:2:
/usr/include/gtk-3.0/gtk/gtk.h:30:10: fatal error: gdk/gdk.h: No such file or directory
   30 | #include <gdk/gdk.h>
      |          ^~~~~~~~~~~
compilation terminated.
make: *** [Makefile:16: gpupm] Error 1

After installing libgtk-3-dev, I tried running again and got back:

  CC	tools/reboot.c
  CXX	GPUPM.cpp
Package jsoncpp was not found in the pkg-config search path.
Perhaps you should add the directory containing `jsoncpp.pc'
to the PKG_CONFIG_PATH environment variable
No package 'jsoncpp' found
In file included from GPUPM.cpp:2:
/usr/include/gtk-3.0/gtk/gtk.h:30:10: fatal error: gdk/gdk.h: No such file or directory
   30 | #include <gdk/gdk.h>
      |          ^~~~~~~~~~~
compilation terminated.
make: *** [Makefile:16: gpupm] Error 1

I installed jsoncpp, and now when I run make all I get is :

  CC	tools/reboot.c
  CXX	GPUPM.cpp
  CC	tools/apphandler.c

I'm using Linux Mint 21.1 Cinnamon

No devices listed after adding Radeon HD 7450

I was able to use GPU Passthrough Manager to set up my integrated AMD GPU for passthrough. I wasn't getting any output from it in QEMU/KVM, so I put an old Radeon HD 7450 in to test with that. Now when I run GPU Passthrough Manager, it doesn't list any devices.

I'm getting this output in the terminal:

Running pre-initialization process...
Deleting cached configuration files...
Writing vfio.conf template...
Writing data.json template...
Gathering device data...
Found 7 devices. Preparing data.json payload...
Traceback (most recent call last):
  File "/usr/share/gpu-passthrough-manager/./py/load.py", line 50, in <module>
    load(*sys.argv[1:])
  File "/usr/share/gpu-passthrough-manager/./py/load.py", line 38, in load
    device["id"] = re.search(r"[0-9,a-f]{4}:[0-9,a-f]{4}", lspci_res[i]).group()
AttributeError: 'NoneType' object has no attribute 'group'

(GPUPM:3272): Gtk-CRITICAL **: 16:42:14.554: gtk_box_pack: assertion '_gtk_widget_get_parent (child) == NULL' failed

(GPUPM:3272): Gtk-CRITICAL **: 16:42:14.554: gtk_box_pack: assertion '_gtk_widget_get_parent (child) == NULL' failed

I took a look at the script in question, and it looks like it's failing because the lspci output for that card gets truncated.

[alicrow@theBeast ~]$ lspci -nnD | grep -iE 'Audio|VGA|3D'
0000:01:00.0 VGA compatible controller [0300]: NVIDIA Corporation GP104 [GeForce GTX 1080] [10de:1b80] (rev a1)
0000:01:00.1 Audio device [0403]: NVIDIA Corporation GP104 High Definition Audio Controller [10de:10f0] (rev a1)
0000:09:00.0 VGA compatible controller [0300]: Advanced Micro Devices, Inc. [AMD/ATI] Caicos PRO [Radeon HD 7450] [1002:677b]
0000:09:00.1 Audio device [0403]: Advanced Micro Devices, Inc. [AMD/ATI] Caicos HDMI Audio [Radeon HD 6450 / 7450/8450/8490 OEM / R5 230/235/235X OEM] [1002:a...
0000:11:00.0 VGA compatible controller [0300]: Advanced Micro Devices, Inc. [AMD/ATI] Raphael [1002:164e] (rev c2)
0000:11:00.1 Audio device [0403]: Advanced Micro Devices, Inc. [AMD/ATI] Rembrandt Radeon High Definition Audio Controller [1002:1640]
0000:11:00.6 Audio device [0403]: Advanced Micro Devices, Inc. [AMD] Family 17h/19h HD Audio Controller [1022:15e3]

Hopefully there's a way to get lspci to not truncate the info, but I'm not too familiar with it.

At the least, there should be error-handling so that the other devices show up (and probably a warning that it was unable to list a device).

Add a license

Hi, to not confuse people please add a license of your choice to the repository. If you don't know which to choose just tell what you expect from it.

GPU Passthrough Manager not compatible with certain laptops

The most recent version of GPU Passthrough Manager (1.2.1) does not run the VFIO scripts successfully on my MSI GS65 Stealth Thin 8RF running pure Arch Linux. I had to reinstall my entire operating system after running this program despite the fact my device meets all of the listed requirements due to my operating system becoming unbootable after first time setup. Please fix.

EndeavourOS support?

If I use this program on EOS, I don't notice any changes made to my grub and initramfs. Is EOS supported?

GPU not loading correct drivers when selecting load VFIO

image
I've selected the bottom 2 options to pass through by using VFIO drivers, but only the audio controller is passing through.
I am so sorry if I just clicked the wrong two, but I think I selected the wright ones, and It's still not passing them through.

I'd be good it these IDs (as marked in the picture) would show up in the app, so you can't select the wrong ones.
image

I may have loaded VFIO drivers to the wrong GPU because it wasn't named correct (also marked below)
image

Acs Patching Support

Add the ability to acs patching as some gpu and audio drivers dont have their IOMMU Groups separated.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.