You are not logged in.

#1 2023-03-01 15:55:55

Quentolosse
Member
Registered: 2023-03-01
Posts: 5

[SOLVED] Help with PCI passthrough

Hi,
I am tying to make a Windows VM with KVM with PCI passtrough, and I need some help for doing that.

First, here is my setup :

  • Laptop : IdeaPad Gaming 3 15ARH05

  • CPU : AMD Ryzen 5 4600H

  • GPU : Integrated radeon graphics ; nvidia GTX 1650

  • Monitors : 1 integrated in the laptop and 1 external monitor plugged with HDMI

Logicial part :

  • Operating system : Arch linux

  • Desktop environment : Kde plasma

  • Display server : X11

My goal (if it's possible) is to make something like this :

  • When I start my laptop, I would have arch linux running on my 2 monitors, with optimus-manager to handle hybrid graphics

  • I would have a script that starts Windows in a VM (with KVM) on my external monitor, with the nvidia GPU (without restarting my laptop)

  • I would have a script which stop the VM and get back to the initial configuration (without restarting my laptop too)

I have 2 problems, the first one is unloading the nvidia drivers and enable VFIO without a restart :
For unloading nvidia drivers without blacklist them in /etc/modprobe.d/blacklist.conf (because I need to acess them in arch linux if the VM is not started), I use `modprobe -r nvidia`, which works fine.
My problem is when I enable VFIO and disable nvidia drivers, commands to check if vfio works fine show nothing (the commands I use are : lsmod | grep vfio , dmesg | grep vfio-pci and dmesg | grep VFIO)
Here is how I enabled VFIO :

  • added this line to /etc/default/grub :

    GRUB_CMDLINE_LINUX_DEFAULT="quiet splash intel_iommu=on"
  • created /etc/initramfs-tools/modules :

    vfio-pci ids=1002:67ef,1002:aae0
    vfio
    vfio_iommu_type1
    vfio_pci
    vhost-net
  • update grub and initramfs :

    sudo grub-update
    sudo mkinitcpio -P

Is it my VFIO configuration that goes wrong or do I need to blacklist nvidia drivers in modprobe for VFIO works ? (Is it possible to acess to nvidia GPU in arch linux if I blacklist drivers ?)

My second problem is about one thing that I read here (sorry it's not english) that I need to connect two cables from my laptop to my screen, but I have only 1 HDMI port on my laptop (no VGA port), is there any way to solve this problem ?

I read the archwiki on PCI passthrough but I didn't find solutions to my problems.

Last edited by Quentolosse (2023-03-06 18:57:23)

Offline

#2 2023-03-01 16:19:45

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 76,374

Re: [SOLVED] Help with PCI passthrough

created /etc/initramfs-tools/modules

sudo update-initramfs -u

Is this a Debian/Ubuntu system?

pacman -Qo update-initramfs

Offline

#3 2023-03-01 16:36:39

Quentolosse
Member
Registered: 2023-03-01
Posts: 5

Re: [SOLVED] Help with PCI passthrough

Oh sorry, I did this command :

sudo mkinitcpio -P

(I updated original post)

Offline

#4 2023-03-01 17:05:36

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 76,374

Re: [SOLVED] Help with PCI passthrough

/etc/initramfs-tools would also not exist or be completely irrelevant.
https://wiki.archlinux.org/title/Kernel … le_options

Offline

#5 2023-03-01 17:11:46

Quentolosse
Member
Registered: 2023-03-01
Posts: 5

Re: [SOLVED] Help with PCI passthrough

Ok, thanks you, I'll try as soon as I have enough time. I keep you up to date !

Last edited by Quentolosse (2023-03-01 20:57:15)

Offline

#6 2023-03-02 18:08:24

Quentolosse
Member
Registered: 2023-03-01
Posts: 5

Re: [SOLVED] Help with PCI passthrough

Thanks for your help, I made a little shell script that unload nvidia driver and set vfio driver instead :

#!/bin/bash

systemctl stop sddm.service &&

modprobe -r nvidia_drm nvidia_modeset nvidia &&
modprobe vfio_pci vfio vfio_iommu_type1 vfio_virqfd &&

systemctl start sddm.service
Quentolosse wrote:

My second problem is about one thing that I read that I need to connect two cables from my laptop to my screen, but I have only 1 HDMI port on my laptop (no VGA port), is there any way to solve this problem ?

Can you help me about this problem?

Offline

#7 2023-03-02 19:40:08

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 76,374

Re: [SOLVED] Help with PCI passthrough

I'm not gonna read that much french, but that's probably for a different context.

If you have only one monitor, but two GPUs and you want to use both GPUs w/ the same monitor, you'll need to wire both of them to the monitor (and switch the input there) - otherwise not.

So if you intend to use the internal display on your laptop w/ the IGP and the external monitor (HDMI) w/ the nvidia GPU (whether or not it's currently passed through) you need to attach the monitor to the nvidia GPU w/ one cable and that's it.

Offline

Board footer

Powered by FluxBB