Linux PCI-Passthrough Tutorial (Framework Laptop)

I wanted to share resources that I’ve used to set up pic-passthrough on my systems. It’s not exactly in depth like the arch wiki but it’s quick and easy for anyone who doesn’t want to spend days configuring it.

Getting your packages setup:

  • Run the following command to install the mandatory and default packages in the virtualization group:

     sudo dnf install @virtualization
    

    Alternatively, to install the mandatory, default, and optional packages, run:

     sudo dnf group install --with-optional virtualization
    
  • After the packages install, start the libvirtd service:

     sudo systemctl start libvirtd
    

    To start the service on boot, run:

     sudo systemctl enable libvirtd
    
  • If you don’t want to put in your password each time you launch the application:

       sudo usermog -aG libvirt $(whoami)
    

Setting up iommu (PCI-Passthrough)

  • I have been using this git code from Pavol for a few years now and it’s been working great.
  • Code Source
  • Video Tutorial
    https://youtu.be/_9W18QN26-4
    
  • Pavol also has code for gvt-g and looking glass if you want to get those running. Just look for the videos on his youtube channel and the corresponding code on his github



I hope all these might help newcomers to virtualization like I was a few years ago and limit the amount of frustration that you’ll need to go through.

2 Likes

Also I would add that a few quick tweaks to make your life easier.

  • Make sure to edit your the xml for your vm if you using windows and change the from localtime to utc

Another good source for optimizations is Mathias’ website

Normally I just focus on the hyper v section:

<hyperv>
 <relaxed state='on'/>
   <vapic state='on'/>
   <spinlocks state='on' retries='8191'/>
   <vpindex state='on'/>
   <synic state='on'/>
   <stimer state='on'/>
   <reset state='on'/>
   <vendor_id state='on' value='1234567890ab'/> <!-- former nvidia error code 43 now AMD GPU prevention -->
   <frequencies state='on'/>

But you can do anything he lists on the page without much difficulty.

1 Like