Follow

Need tech help. I have two GPUs in my motherboard. The motherboard keeps selecting the wrong GPU as the one to output to. In Linux I can't find any settings to make the os use the correct GPU. Anytime I search for this it ends up being an integrated vs dedicated thing. Butni have two dedicated cards. I need the PC to only use one since the other will be passed to vfio

ยท ยท 9 ยท 22 ยท 4

@roxie I think classically you'd right an X config file specifying what device to use.

@roxie
Can you open up the chassis and physically swap them around?

@SwooshyCueb switching them would limit the PCI lanes usable on the more powerful so that's not really an option as it would limit the performance

tech help, may not apply to your situation but it might 

@roxie Question: Would your GPUs both be using the same driver? If not, I think you might be able to disable the driver for the one you want to pass through at startup.

Although, I remember when I did a setup like this myself, it did lead to issues, but I believe that was because I was disabling AMD's drivers and there was some weird issue with the proprietary Nvidia drivers that completely broke things, and I needed to use the open source nvidia drivers.

@roxie bind the vfio driver to the one not to use by its pcie id number in modprobe conf (then don't forget to rebuild initrd)
also unbind the efi fb driver from whichever one your uefi chose during boot i'm not at home but i'll get u the command for that later

@roxie ok uh here's a bunch of things to try

* sometimes the bios just has an option to choose the default GPU. sometimes its visibility is gated behind UEFI mode. sometimes it's gated behind UEFI with legacy CSM disabled. sometimes there just isn't one at all even though the idea of multihead in a PC was made popular by friggin windows 98

* pretty sure there's a linux kernel cmdline thing to manually tell the passthrough stub driver to keep a given pci address out of the hands of the gpu driver but i can't remember it off the top of my head

* ... is swapping the cables an option?
@roxie

https://forums.centos.org/viewtopic.php?t=60531

I would higjly reccomend looking into what's called a 'pci-stub' - its basically a way to tell the kernel to immediately park a PCI device with a dummy driver so it can be safely detached and reattached after the system has fully booted.

This is useful when you need the system to stay hands-off with a particular device like a GPU until you're fully booted and ready for something like vfio to pick it up (which I presume is for PCI paasthrough in your case - as it was for me)

If you're using UEFI to boot you may also need `dracut` to help you rebuild the init ramdisk to prevent the GPU driver from being loaded when the init image is passed to the kernel.

If you have any questions feel free to ask - it can take a while to grasp how it all fits together and my explanation may not convey the useful bits effectively for you.

@seasharp would this take effect like when booting so that I could see grub and input a password for my root drive? All before the actual kernal loads but like its the ramfs kernal thingy

@roxie Oh that's a good question - I think you'd need to tell grub which output to use separately from the kernel. There might be a grub2-mkconfig option for that I would expect.

@seasharp that might be worth a shout. I just need to know what the password entry uses and if its still "grub" and then once it unlocks like then the kernal will do the rest

@roxie for sure! Worst case you're punching your root drive decryption passphrase in using the second monitor but after that the kernel and the stub driver should do the rest, as you said.

Good luck :)
@roxie check if the bios/uefi has an option to select the primary gpu
@roxie i have options vfio-pci ids=10de:1b80,10de:10f0 disable_vga=1 in /etc/modprobe.d/vfio.conf, maybe thats enough? (pcie ids are the gpu and its sound chip that i pass through) but i don't use the host os anyways so i just blacklisted all the gpu drivers aswell

@roxie My vague memory about this is that you want to blacklist the "wrong" GPU.

Maybe some useful things here (or in links from here) ? : reddit.com/r/VFIO/comments/k6y

@roxie I had a similar situation on my rig and assuming modprobing the vfio stuff isn't good enough for your needs (I found it worked okay, yes the bios shows up on the wrong card and sits there awkwardly blinking once the kernel runs on the other, but once the VM runs it sorts itself out)
but yeah if that's not good enough for your needs my only option was to physically swap the cards, seemed the motherboard always init'ed the lowest card (for me anyway)

Sign in to participate in the conversation
queerdorks.club

The social network of the future: No ads, no corporate surveillance, ethical design, and decentralization! Own your data with Mastodon!