Using Guest nvidia GPU on Host Machine which has Radeon drivers?

Hello! I've set up a QEMU/KVM virtual machine where I pass through my RTX 2070 to the guest machine and use my Radeon RX 570 for the Host, but I've encountered a problem: I want to be able to switch to the RTX 2070 within the Host so that I can run games in Linux as well, but I can't quite get it to work.

I saw a Reddit thread about this and followed this solution which got me a little progress, but not quite there. I'm thinking this might be a driver issue, and here's why:

Just to clarify, my guest GPU is RTX 2070S, my host GPU is RX 560.
RX560 has ID: 0000:04:00.0 & 0000:04:00.1
RTX 2070 has ID: 0000:0a:00.0 & 0000:0a:00.1
I am putting the RTX 2070 IDs in the "gpu_id" and "gpu_audio_id" fields of the solution I linked at the top of this post.
I've named the file "swap2"

The following makes heavy reference to the solution linked at the top of this post:

I changed the path /sys/bus/pci/drivers/nvidia because I don't have the nvidia folder. First I tried /sys/bus/pci/drivers/nvidia-gpu which I assumed was the nvidia driver that I'd need.

With the path /sys/bus/pci/drivers/nvidia-gpu :

Running $ sudo ./swap2 vfio-pci returns: vfio-pci is already loaded for device 0000:0a:00.0

Running $ sudo ./swap2 nvidia returns: ./swap2: line 12: echo: write error: No such device

Line 12 in the file is: echo -n "$gpu_id" > /sys/bus/pci/drivers/nvidia-gpu/bind

So then I tried the nouveau: /sys/bus/pci/drivers/nouveau/ and with that path I got no errors, but I'm not able to use the monitors connected to the RTX 2070. They are recognized as being plugged in Manjaro's "Display Configuration," but cannot be enabled (enabling them has no effect. Closing and reopening Display Config shows that the monitors are once again disabled.)

With this, I assume I need to install the latest nvidia drivers in order for this to work properly.

Running mhwd -li returns:

> Installed PCI configs:
--------------------------------------------------------------------------------
                  NAME               VERSION          FREEDRIVER           TYPE
--------------------------------------------------------------------------------
           video-linux            2018.05.04                true            PCI

So I don't have the nvidia driver installed. I tried installing it and after rebooting Manjaro failed to start the Simple Desktop Manager. I switched to the TTY and uninstalled the driver, which allowed me to get back to the desktop but also put me entirely back where I started.

Am I correct in assuming that the solution is to install the latest nvidia driver?

If so, how do I install the latest nvidia driver without interfering with my RX 560 so that I can swap to and from my RTX 2070 with the script linked at the top of this thread?

If not, what do I need to do for this to work? I've got plenty of time, so I don't mind if it ends up being a drawn out process.

There is a great forum that has built a very knowledgable user base around IOMMU, vfio and GPU passthrough that may have more insight than you'll find here.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.

Forum kindly sponsored by