pavolelsig / passthrough_helper_ubuntu_20

Passthrough helper for Ubuntu 20.04 and 20.10
36 stars 13 forks source link

Script adds wrong GPU to vfio-pci #4

Open mako-is-here opened 2 years ago

mako-is-here commented 2 years ago

Hi, So I was trying to get KVM passthrough on many distros with no luck. This is the closest I've gotten since all that's happened before was a black screen on boot that required me to chroot from a live CD and fix the distro I was using. The script worked well on Kubuntu 20.02.3, except for one problem. When I run the script and reboot, it adds my AMD Radeon HD 8490 (which is gonna be my Linux display) to vfio-pci instead of my Nvidia RTX 2060 (which I want to pass to Windows 10). Is there a way I can modify the script so I can pass through the correct GPU to my Windows 10 VM? I cannot swap the cards because my RTX card is too big to clear the PSU because I am in a microATX case and my tiny AMD card barely clears said PSU.

Here's the output of lspci -k:

06:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Caicos XTX [Radeon HD 8490 / R5 235X OEM] Subsystem: Hewlett-Packard Company Caicos XTX [Radeon HD 8490 / R5 235X OEM] Kernel driver in use: vfio-pci Kernel modules: radeon

06:00.1 Audio device: Advanced Micro Devices, Inc. [AMD/ATI] Caicos HDMI Audio [Radeon HD 6450 / 7450/8450/8490 OEM / R5 230/235/235X OEM] Subsystem: Hewlett-Packard Company Caicos HDMI Audio [Radeon HD 6450 / 7450/8450/8490 OEM / R5 230/235/235X OEM] Kernel driver in use: vfio-pci Kernel modules: snd_hda_intel

07:00.0 VGA compatible controller: NVIDIA Corporation TU106 [GeForce RTX 2060 Rev. A] (rev a1) Subsystem: ZOTAC International (MCO) Ltd. TU106 [GeForce RTX 2060 Rev. A] Kernel driver in use: nouveau Kernel modules: nvidiafb, nouveau

07:00.1 Audio device: NVIDIA Corporation TU106 High Definition Audio Controller (rev a1) Subsystem: ZOTAC International (MCO) Ltd. TU106 High Definition Audio Controller Kernel driver in use: snd_hda_intel Kernel modules: snd_hda_intel

Thank you in advance.

mako-is-here commented 2 years ago

UPDATE: I FIGURED OUT HOW TO EDIT THE SCRIPT TO CHOOSE WHICH GPU THE SCRIPT WILL PASS THROUGH In vfio-pci-override-vga.sh there's this line that stood out to me for i in /sys/bus/pci/devices/*/boot_vga do if [ $(cat "$i") -eq **0** ]; then

If you run cat /sys/bus/pci/devices/*/boot_vga it will return the numbers 0 and 1

In my case 0 was my AMD card I want to keep in Linux and 1 was my NVidia card that I wanted to passthrough. All I had to do then was edit if [ $(cat "$i") -eq 0 ]; then and change the 0 to a 1

This is my output of lspci -k now:

06:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Caicos XTX [Radeon HD 8490 / R5 235X OEM] Subsystem: Hewlett-Packard Company Caicos XTX [Radeon HD 8490 / R5 235X OEM] Kernel driver in use: radeon Kernel modules: radeon 06:00.1 Audio device: Advanced Micro Devices, Inc. [AMD/ATI] Caicos HDMI Audio [Radeon HD 6450 / 7450/8450/8490 OEM / R5 230/235/235X OEM] Subsystem: Hewlett-Packard Company Caicos HDMI Audio [Radeon HD 6450 / 7450/8450/8490 OEM / R5 230/235/235X OEM] Kernel driver in use: snd_hda_intel Kernel modules: snd_hda_intel 07:00.0 VGA compatible controller: NVIDIA Corporation TU106 [GeForce RTX 2060 Rev. A] (rev a1) Subsystem: ZOTAC International (MCO) Ltd. TU106 [GeForce RTX 2060 Rev. A] Kernel driver in use: nouveau Kernel modules: nvidiafb, nouveau 07:00.1 Audio device: NVIDIA Corporation TU106 High Definition Audio Controller (rev a1) Subsystem: ZOTAC International (MCO) Ltd. TU106 High Definition Audio Controller Kernel driver in use: vfio-pci Kernel modules: snd_hda_intel

mako-is-here commented 2 years ago

ok i found another issue

i just learned that the monitor connected to the nvidia gpu HAS to go blank when the script is run. when i rebooted after the script ran, it didnt shut off. when i added the gpu to my vm and booted it. everything but the mouse froze. i had to hard reset my pc to get linux to functioning state again. i also learned looking back at the issue earlier is that my vga controller from my lspci output said it was still using the nouveau driver instead of the vfio-pci driver. is there anything i can do. the same issue also occured when my amd gpu was passed through. my second monitor where the amd gpu was connected was still on at the time.

pavolelsig commented 2 years ago

You might want to try to change the primary/boot GPU in BIOS. You want the Radeon in the 2nd PCIe (I'm assuming) slot to be the primary. Some BIOSes especially on Gigabyte boards let you do that. There are other ways of changing the order but you might want to look it up for your specific motherboard.

mako-is-here commented 2 years ago

hi, thank you for your swift reply. i have an asus motherboard, but i have zero idea how to do that or if i can do that

On Wed, Feb 9, 2022 at 6:12 PM pavolelsig @.***> wrote:

You might want to try to change the primary/boot GPU in BIOS. You want the Radeon in the 2nd PCIe (I'm assuming) slot to be the primary. Some BIOSes especially on Gigabyte boards let you do that. There are other ways of changing the order but you might want to look it up for your specific motherboard.

— Reply to this email directly, view it on GitHub https://github.com/pavolelsig/passthrough_helper_ubuntu_20/issues/4#issuecomment-1034295920, or unsubscribe https://github.com/notifications/unsubscribe-auth/AXWDSYMWPKXK2DVIKNCDV5LU2LYE3ANCNFSM5N6YQMEQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you modified the open/close state.Message ID: @.*** com>

pavolelsig commented 2 years ago

Back in the day, you used to be able to do it on Asus boards by changing the CSM. I don't know whether it will work on your board.

mako-is-here commented 2 years ago

if it helps i have an asus tuf b450m pro s. i’ll check a bit later as i have to fix my install because my dumbass disabled nouveau and i have to chroot from a live cd to fix it

On Wed, Feb 9, 2022 at 6:17 PM pavolelsig @.***> wrote:

Back in the day, you used to be able to do it on Asus boards by changing the CSM. I don't know whether it will work on your board.

— Reply to this email directly, view it on GitHub https://github.com/pavolelsig/passthrough_helper_ubuntu_20/issues/4#issuecomment-1034299452, or unsubscribe https://github.com/notifications/unsubscribe-auth/AXWDSYPC344AUCZFFTU2FOLU2LYZDANCNFSM5N6YQMEQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you modified the open/close state.Message ID: @.*** com>

mako-is-here commented 2 years ago

ok so im in the csm menu and i see no options on gpu settings

On Wed, Feb 9, 2022 at 6:19 PM Spicy Spicy Memes @.***> wrote:

if it helps i have an asus tuf b450m pro s. i’ll check a bit later as i have to fix my install because my dumbass disabled nouveau and i have to chroot from a live cd to fix it

On Wed, Feb 9, 2022 at 6:17 PM pavolelsig @.***> wrote:

Back in the day, you used to be able to do it on Asus boards by changing the CSM. I don't know whether it will work on your board.

— Reply to this email directly, view it on GitHub https://github.com/pavolelsig/passthrough_helper_ubuntu_20/issues/4#issuecomment-1034299452, or unsubscribe https://github.com/notifications/unsubscribe-auth/AXWDSYPC344AUCZFFTU2FOLU2LYZDANCNFSM5N6YQMEQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you modified the open/close state.Message ID: @.*** com>

pavolelsig commented 2 years ago

You might find this helpful: https://www.reddit.com/r/VFIO/comments/65oi0r/ryzen_mainboards_selection_of_primary_graphics/?utm_source=share&utm_medium=ios_app&utm_name=iossmf

mako-is-here commented 2 years ago

so i disabled csm and my nvme where kubuntu was installed was disabled so i had to reenable it

On Wed, Feb 9, 2022 at 6:24 PM pavolelsig @.***> wrote:

You might find this helpful: https://www.reddit.com/r/VFIO/comments/65oi0r/ryzen_mainboards_selection_of_primary_graphics/?utm_source=share&utm_medium=ios_app&utm_name=iossmf

— Reply to this email directly, view it on GitHub https://github.com/pavolelsig/passthrough_helper_ubuntu_20/issues/4#issuecomment-1034303634, or unsubscribe https://github.com/notifications/unsubscribe-auth/AXWDSYN4NPM4DXMBRITT3IDU2LZSXANCNFSM5N6YQMEQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you modified the open/close state.Message ID: @.*** com>